changeset 450:2440677b8871

Wip, fix build on freebsd, hopefully didn't break it anywhere else
author Louis Opter <kalessin@kalessin.fr>
date Wed, 04 May 2016 15:14:23 -0700
parents df4535ef4bf0
children f1446ed50512
files add_power_transition.patch fix_freebsd_build.patch network_discovery.patch series
diffstat 4 files changed, 111 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/add_power_transition.patch	Sun May 01 18:27:09 2016 -0700
+++ b/add_power_transition.patch	Wed May 04 15:14:23 2016 -0700
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent  e591834e9fcbb5dd6428b186273d405c4269e98f
+# Parent  1bc2c2b54e56ebeb4dd5cfee17b55137ca1f1409
 Add a transition argument to the power functions
 
 Unlike LIFX's implementation, lightsd will properly get the bulbs to
@@ -17,7 +17,7 @@
 diff --git a/CMakeLists.txt b/CMakeLists.txt
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -88,6 +88,7 @@
+@@ -94,6 +94,7 @@
  
  ADD_SUBDIRECTORY(compat)
  ADD_SUBDIRECTORY(core)
@@ -1238,6 +1238,17 @@
  
      def get_light_state(self, target):
          return self._jsonrpc_call("get_light_state", [target])
+diff --git a/lifx/broadcast.c b/lifx/broadcast.c
+--- a/lifx/broadcast.c
++++ b/lifx/broadcast.c
+@@ -19,6 +19,7 @@
+ #include <sys/tree.h>
+ #include <sys/socket.h>
+ #include <arpa/inet.h>
++#include <net/if.h>
+ #include <netinet/in.h>
+ #include <assert.h>
+ #include <endian.h>
 diff --git a/lifx/wire_proto.c b/lifx/wire_proto.c
 --- a/lifx/wire_proto.c
 +++ b/lifx/wire_proto.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fix_freebsd_build.patch	Wed May 04 15:14:23 2016 -0700
@@ -0,0 +1,92 @@
+# HG changeset patch
+# Parent  0c7aec226bf65211a21118fc5092ac9ab96a8f4d
+Fix build on FreeBSD 10.3
+
+- properly use _XOPEN_SOURCE=700 instead of _POSIX_C_SOURCE;
+- fix missing includes;
+- add compat file for endian.h (maybe it should be the other way or
+  maybe I should just improve the CMake "finder").
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -55,14 +55,20 @@
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra -Wall -Wstrict-prototypes -std=c99")
+ SET(CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} "")
+ 
++IF (LINUX)
++    ADD_DEFINITIONS(
++        # see feature_test_macros(7)
++        "-D_XOPEN_SOURCE=700"
++        "-D_BSD_SOURCE=1"
++        "-D_DEFAULT_SOURCE=1"
++    )
++ENDIF ()
++
++IF (APPLE)
++    ADD_DEFINITIONS("-D_DARWIN_C_SOURCE=1")
++ENDIF ()
++
+ ADD_DEFINITIONS(
+-    # Only relevant for the GNU libc:
+-    "-D_POSIX_C_SOURCE=200809L"
+-    "-D_BSD_SOURCE=1"
+-    "-D_DEFAULT_SOURCE=1"
+-
+-    "-D_DARWIN_C_SOURCE=1"
+-
+     "-DLGTD_BIG_ENDIAN_SYSTEM=${BIG_ENDIAN_SYSTEM}"
+     "-DLGTD_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P}"
+ 
+diff --git a/compat/FreeBSD/endian.h b/compat/FreeBSD/endian.h
+new file mode 100644
+--- /dev/null
++++ b/compat/FreeBSD/endian.h
+@@ -0,0 +1,3 @@
++#pragma once
++
++#include <sys/endian.h>
+diff --git a/core/listen.c b/core/listen.c
+--- a/core/listen.c
++++ b/core/listen.c
+@@ -19,6 +19,7 @@
+ #include <sys/socket.h>
+ #include <sys/stat.h>
+ #include <sys/un.h>
++#include <netinet/in.h>
+ #include <assert.h>
+ #include <err.h>
+ #include <errno.h>
+diff --git a/lifx/broadcast.c b/lifx/broadcast.c
+--- a/lifx/broadcast.c
++++ b/lifx/broadcast.c
+@@ -18,6 +18,7 @@
+ #include <sys/queue.h>
+ #include <sys/tree.h>
+ #include <arpa/inet.h>
++#include <netinet/in.h>
+ #include <assert.h>
+ #include <endian.h>
+ #include <err.h>
+diff --git a/lifx/gateway.c b/lifx/gateway.c
+--- a/lifx/gateway.c
++++ b/lifx/gateway.c
+@@ -17,6 +17,7 @@
+ 
+ #include <sys/queue.h>
+ #include <sys/tree.h>
++#include <netinet/in.h>
+ #include <assert.h>
+ #include <endian.h>
+ #include <err.h>
+diff --git a/tests/core/pipe/test_pipe_open_fifo_already_exists.c b/tests/core/pipe/test_pipe_open_fifo_already_exists.c
+--- a/tests/core/pipe/test_pipe_open_fifo_already_exists.c
++++ b/tests/core/pipe/test_pipe_open_fifo_already_exists.c
+@@ -1,6 +1,7 @@
+ #include "pipe.c"
+ 
+ #include <sys/tree.h>
++#include <sys/stat.h>
+ #include <endian.h>
+ #include <limits.h>
+ 
--- a/network_discovery.patch	Sun May 01 18:27:09 2016 -0700
+++ b/network_discovery.patch	Wed May 04 15:14:23 2016 -0700
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent  f2c72d4c5e6aff10ff67b00c83451f64c8a84ea9
+# Parent  d6245f382c7a85dd48328f670698ee9f8c421ef8
 Properly broadcast LIFX discovery packets on all networks (closes GH-2)
 
 This is really the proper way of achieving the same semantic as
@@ -64,13 +64,13 @@
 diff --git a/lifx/broadcast.c b/lifx/broadcast.c
 --- a/lifx/broadcast.c
 +++ b/lifx/broadcast.c
-@@ -17,11 +17,14 @@
+@@ -17,12 +17,14 @@
  
  #include <sys/queue.h>
  #include <sys/tree.h>
 +#include <sys/socket.h>
  #include <arpa/inet.h>
-+#include <net/if.h>
+ #include <netinet/in.h>
  #include <assert.h>
  #include <endian.h>
  #include <err.h>
@@ -79,7 +79,7 @@
  #include <stdarg.h>
  #include <stdbool.h>
  #include <stdint.h>
-@@ -51,16 +54,37 @@
+@@ -52,16 +54,37 @@
  };
  
  static bool
@@ -123,7 +123,7 @@
      struct lgtd_lifx_packet_header get_pan_gateway;
      lgtd_lifx_wire_setup_header(
          &get_pan_gateway,
-@@ -70,31 +94,50 @@
+@@ -71,31 +94,50 @@
          LGTD_LIFX_GET_PAN_GATEWAY
      );
  
--- a/series	Sun May 01 18:27:09 2016 -0700
+++ b/series	Wed May 04 15:14:23 2016 -0700
@@ -1,4 +1,5 @@
 add_make_release.patch
+fix_freebsd_build.patch
 optional_jsonrpc_args.patch
 network_discovery.patch
 dont_use_ev_assign.patch