From 8b28f076f91c4ffa6ff9bb6e5df9df6603cd446e Mon Sep 17 00:00:00 2001 From: André Draszik Date: Wed, 20 Jul 2016 23:56:18 +0100 Subject: bridge-utils: various build fixes (musl & CFLAGS) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bridge-utils suffers from a few problems: - doesn't build on musl - doesn't respect CFLAGS - build errors are silently ignored - doesn't support parallel make All of these are addressed with the included patches. Signed-off-by: André Draszik Signed-off-by: Martin Jansa Signed-off-by: Joe MacDonald --- ...ld-error-out-correctly-if-a-submake-fails.patch | 69 ++++++++++++++++++++++ ...idge-fix-some-build-time-warnings-fcntl.h.patch | 64 ++++++++++++++++++++ ...idge-fix-some-build-time-warnings-errno.h.patch | 46 +++++++++++++++ ...dd-missing-include-s-fix-build-against-mu.patch | 47 +++++++++++++++ ...uild-don-t-ignore-CFLAGS-from-environment.patch | 53 +++++++++++++++++ .../bridge-utils/bridge-utils_1.5.bb | 11 +++- 6 files changed, 287 insertions(+), 3 deletions(-) create mode 100644 meta-networking/recipes-support/bridge-utils/bridge-utils/0001-build-error-out-correctly-if-a-submake-fails.patch create mode 100644 meta-networking/recipes-support/bridge-utils/bridge-utils/0002-libbridge-fix-some-build-time-warnings-fcntl.h.patch create mode 100644 meta-networking/recipes-support/bridge-utils/bridge-utils/0003-bridge-fix-some-build-time-warnings-errno.h.patch create mode 100644 meta-networking/recipes-support/bridge-utils/bridge-utils/0004-libbridge-add-missing-include-s-fix-build-against-mu.patch create mode 100644 meta-networking/recipes-support/bridge-utils/bridge-utils/0005-build-don-t-ignore-CFLAGS-from-environment.patch (limited to 'meta-networking/recipes-support') diff --git a/meta-networking/recipes-support/bridge-utils/bridge-utils/0001-build-error-out-correctly-if-a-submake-fails.patch b/meta-networking/recipes-support/bridge-utils/bridge-utils/0001-build-error-out-correctly-if-a-submake-fails.patch new file mode 100644 index 000000000..c6897b4e7 --- /dev/null +++ b/meta-networking/recipes-support/bridge-utils/bridge-utils/0001-build-error-out-correctly-if-a-submake-fails.patch @@ -0,0 +1,69 @@ +From 5e102b453e254d16af1f95053134f58348e0f83a Mon Sep 17 00:00:00 2001 +From: root +Date: Wed, 20 Jul 2016 23:40:30 +0100 +Subject: [PATCH 1/5] build: error out correctly if a submake fails +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Due to use of a for loop, return status from submake was always +ignored. + +In the context of build-systems like OE this causes them to not +detect any errors and continue happily, resulting in a successful, +but incomplete, build. + +Fix by having a nicer Makefile.in which now has rules for the +individual targets (directories) so that make itself can +figure out all the dependencies and build those targets as +needed rather than using a for loop to iterate over the +directories in a shell and thus loosing the return status of +the command inside the loop. + +This has the added advantage that parallel builds work now. + +Upstream-Status: Pending + +Signed-off-by: André Draszik +--- + Makefile.in | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index 6028513..dab88bb 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -13,11 +13,11 @@ distdir = $(PACKAGE)-$(VERSION) + + SUBDIRS=libbridge brctl doc + +-all: +- for x in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$x ; done ++all: override ACTION= ++all: $(SUBDIRS) + +-clean: +- for x in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$x clean ; done ++clean: override ACTION=clean ++clean: $(SUBDIRS) + + distclean: clean + rm -f config.log +@@ -30,6 +30,12 @@ maintainer-clean: distclean + rm -f libbridge/Makefile + rm -f doc/Makefile + +-install: +- for x in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$x install; done ++install: override ACTION=install ++install: $(SUBDIRS) + ++ ++brctl: libbridge ++$(SUBDIRS): ++ $(MAKE) $(MFLAGS) -C $@ $(ACTION) ++ ++.PHONY: $(SUBDIRS) +-- +2.8.1 + diff --git a/meta-networking/recipes-support/bridge-utils/bridge-utils/0002-libbridge-fix-some-build-time-warnings-fcntl.h.patch b/meta-networking/recipes-support/bridge-utils/bridge-utils/0002-libbridge-fix-some-build-time-warnings-fcntl.h.patch new file mode 100644 index 000000000..25d08ab95 --- /dev/null +++ b/meta-networking/recipes-support/bridge-utils/bridge-utils/0002-libbridge-fix-some-build-time-warnings-fcntl.h.patch @@ -0,0 +1,64 @@ +From 68fafc4ea10365ac2e74ab7c660d097696857677 Mon Sep 17 00:00:00 2001 +From: root +Date: Wed, 20 Jul 2016 23:40:32 +0100 +Subject: [PATCH 2/5] libbridge: fix some build-time warnings (fcntl.h) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There are build-time warnings at the moment when building +against musl, as the code here #include's the wrong file, +sys/fcntl.h instead of fcntl.h + +In file included from libbridge_devif.c:26:0: +/usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include to [-Wcpp] + #warning redirecting incorrect #include to + ^~~~~~~ +In file included from libbridge_if.c:23:0: +/usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include to [-Wcpp] + #warning redirecting incorrect #include to + ^~~~~~~ + +glibc headers silently redirect sys/fcntl.h to fcntl.h so the +issue is not seen there. + +Let's fix the #include's to so as to use the correct ones +and silence the compiler. + +Upstream-Status: Pending + +Signed-off-by: André Draszik +--- + libbridge/libbridge_devif.c | 2 +- + libbridge/libbridge_if.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libbridge/libbridge_devif.c b/libbridge/libbridge_devif.c +index 1e83925..2cf78f6 100644 +--- a/libbridge/libbridge_devif.c ++++ b/libbridge/libbridge_devif.c +@@ -23,7 +23,7 @@ + #include + #include + #include +-#include ++#include + + #include "libbridge.h" + #include "libbridge_private.h" +diff --git a/libbridge/libbridge_if.c b/libbridge/libbridge_if.c +index 77d3f8a..9cf4bac 100644 +--- a/libbridge/libbridge_if.c ++++ b/libbridge/libbridge_if.c +@@ -20,7 +20,7 @@ + #include + #include + #include +-#include ++#include + #include + + #include "libbridge.h" +-- +2.8.1 + diff --git a/meta-networking/recipes-support/bridge-utils/bridge-utils/0003-bridge-fix-some-build-time-warnings-errno.h.patch b/meta-networking/recipes-support/bridge-utils/bridge-utils/0003-bridge-fix-some-build-time-warnings-errno.h.patch new file mode 100644 index 000000000..72f2a6292 --- /dev/null +++ b/meta-networking/recipes-support/bridge-utils/bridge-utils/0003-bridge-fix-some-build-time-warnings-errno.h.patch @@ -0,0 +1,46 @@ +From 2b9dc245f93ab27d7da42a16ddbb9212888006e4 Mon Sep 17 00:00:00 2001 +From: root +Date: Wed, 20 Jul 2016 23:40:33 +0100 +Subject: [PATCH 3/5] bridge: fix some build-time warnings (errno.h) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There is a build-time warning at the moment when building +against musl, as the code here #include's the wrong file, +sys/errno.h instead of errno.h + +In file included from brctl.c:22:0: +/usr/include/sys/errno.h:1:2: warning: #warning redirecting incorrect #include to [-Wcpp] + #warning redirecting incorrect #include to + ^~~~~~~ + +glibc headers silently redirect sys/errno.h to errno.h so the +issue is not seen there. + +Let's fix the #include's to so as to use the correct ones +and silence the compiler. + +Upstream-Status: Pending + +Signed-off-by: André Draszik +--- + brctl/brctl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/brctl/brctl.c b/brctl/brctl.c +index 46ca352..8855234 100644 +--- a/brctl/brctl.c ++++ b/brctl/brctl.c +@@ -19,7 +19,7 @@ + #include + #include + #include +-#include ++#include + #include + + #include "libbridge.h" +-- +2.8.1 + diff --git a/meta-networking/recipes-support/bridge-utils/bridge-utils/0004-libbridge-add-missing-include-s-fix-build-against-mu.patch b/meta-networking/recipes-support/bridge-utils/bridge-utils/0004-libbridge-add-missing-include-s-fix-build-against-mu.patch new file mode 100644 index 000000000..565186e0f --- /dev/null +++ b/meta-networking/recipes-support/bridge-utils/bridge-utils/0004-libbridge-add-missing-include-s-fix-build-against-mu.patch @@ -0,0 +1,47 @@ +From c45b73829a8b8c7924df528baa7e16498f917288 Mon Sep 17 00:00:00 2001 +From: root +Date: Wed, 20 Jul 2016 23:40:33 +0100 +Subject: [PATCH 4/5] libbridge: add missing #include's (fix build against + musl) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fixes error like: + +In file included from libbridge_devif.c:28:0: +libbridge.h:45:17: error: field 'max_age' has incomplete type + struct timeval max_age; + ^~~~~~~ +In file included from libbridge_devif.c:28:0: +libbridge.h:51:2: error: unknown type name 'u_int16_t' + u_int16_t root_port; + ^~~~~~~~~ + +These types are not standard C but rather Posix, +for struct timeval see: +http://pubs.opengroup.org/onlinepubs/7908799/xsh/systime.h.html + +Upstream-Status: Pending + +Signed-off-by: André Draszik +--- + libbridge/libbridge.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libbridge/libbridge.h b/libbridge/libbridge.h +index 53ec869..b0727c1 100644 +--- a/libbridge/libbridge.h ++++ b/libbridge/libbridge.h +@@ -20,6 +20,8 @@ + #define _LIBBRIDGE_H + + #include ++#include ++#include + #include + #include + #include +-- +2.8.1 + diff --git a/meta-networking/recipes-support/bridge-utils/bridge-utils/0005-build-don-t-ignore-CFLAGS-from-environment.patch b/meta-networking/recipes-support/bridge-utils/bridge-utils/0005-build-don-t-ignore-CFLAGS-from-environment.patch new file mode 100644 index 000000000..9f2155e9b --- /dev/null +++ b/meta-networking/recipes-support/bridge-utils/bridge-utils/0005-build-don-t-ignore-CFLAGS-from-environment.patch @@ -0,0 +1,53 @@ +From 7bc1932cabfafca8c68e18bd43e3d203c70d2dd8 Mon Sep 17 00:00:00 2001 +From: root +Date: Wed, 20 Jul 2016 23:40:33 +0100 +Subject: [PATCH 5/5] build: don't ignore CFLAGS from environment +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We need to take them into account so as to behave nicely towards +build environments which expect to be able to set them, e.g. for +optimisation flags, or debug options. + +Therefore they need to be added to the compiler command line of +every source file, and in addition, the same CFLAGS that were +used during compilation must also always be used during linking! + +Upstream-Status: Pending + +Signed-off-by: André Draszik +--- + brctl/Makefile.in | 2 +- + libbridge/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/brctl/Makefile.in b/brctl/Makefile.in +index e1956d6..eff260c 100644 +--- a/brctl/Makefile.in ++++ b/brctl/Makefile.in +@@ -34,7 +34,7 @@ install: $(PROGRAMS) + $(INSTALL) -m 755 $(PROGRAMS) $(DESTDIR)$(sbindir) + + brctl: $(brctl_OBJECTS) ../libbridge/libbridge.a +- $(CC) $(LDFLAGS) $(brctl_OBJECTS) $(LIBS) -o brctl ++ $(CC) $(CFLAGS) $(LDFLAGS) $(brctl_OBJECTS) $(LIBS) -o brctl + + %.o: %.c brctl.h + $(CC) $(CFLAGS) $(INCLUDE) -c $< +diff --git a/libbridge/Makefile.in b/libbridge/Makefile.in +index 20512c4..4e1cddc 100644 +--- a/libbridge/Makefile.in ++++ b/libbridge/Makefile.in +@@ -5,7 +5,7 @@ AR=ar + RANLIB=@RANLIB@ + + CC=@CC@ +-CFLAGS = -Wall -g $(KERNEL_HEADERS) ++CFLAGS = -Wall -g $(KERNEL_HEADERS) @CFLAGS@ + + prefix=@prefix@ + exec_prefix=@exec_prefix@ +-- +2.8.1 + diff --git a/meta-networking/recipes-support/bridge-utils/bridge-utils_1.5.bb b/meta-networking/recipes-support/bridge-utils/bridge-utils_1.5.bb index 04f863b22..6032ab05e 100644 --- a/meta-networking/recipes-support/bridge-utils/bridge-utils_1.5.bb +++ b/meta-networking/recipes-support/bridge-utils/bridge-utils_1.5.bb @@ -1,8 +1,13 @@ require bridge-utils.inc -SRC_URI += "file://kernel-headers.patch" - -PARALLEL_MAKE = "" +SRC_URI += "\ + file://kernel-headers.patch \ + file://0001-build-error-out-correctly-if-a-submake-fails.patch \ + file://0002-libbridge-fix-some-build-time-warnings-fcntl.h.patch \ + file://0003-bridge-fix-some-build-time-warnings-errno.h.patch \ + file://0004-libbridge-add-missing-include-s-fix-build-against-mu.patch \ + file://0005-build-don-t-ignore-CFLAGS-from-environment.patch \ +" LIC_FILES_CHKSUM = "file://COPYING;md5=f9d20a453221a1b7e32ae84694da2c37" -- cgit v1.2.3-54-g00ecf