diff options
author | André Draszik <git@andred.net> | 2016-07-20 23:56:18 +0100 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2016-08-05 09:13:17 -0400 |
commit | 8b28f076f91c4ffa6ff9bb6e5df9df6603cd446e (patch) | |
tree | 13ded987660a3abf2e15756c6987dc66f4266670 /meta-networking/recipes-support | |
parent | 9fb484ed579eba3ab49cb5561ad8ac86928379c7 (diff) | |
download | meta-openembedded-8b28f076f91c4ffa6ff9bb6e5df9df6603cd446e.tar.gz |
bridge-utils: various build fixes (musl & CFLAGS)
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 <git@andred.net>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking/recipes-support')
6 files changed, 287 insertions, 3 deletions
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 @@ | |||
1 | From 5e102b453e254d16af1f95053134f58348e0f83a Mon Sep 17 00:00:00 2001 | ||
2 | From: root <git@andred.net> | ||
3 | Date: Wed, 20 Jul 2016 23:40:30 +0100 | ||
4 | Subject: [PATCH 1/5] build: error out correctly if a submake fails | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Due to use of a for loop, return status from submake was always | ||
10 | ignored. | ||
11 | |||
12 | In the context of build-systems like OE this causes them to not | ||
13 | detect any errors and continue happily, resulting in a successful, | ||
14 | but incomplete, build. | ||
15 | |||
16 | Fix by having a nicer Makefile.in which now has rules for the | ||
17 | individual targets (directories) so that make itself can | ||
18 | figure out all the dependencies and build those targets as | ||
19 | needed rather than using a for loop to iterate over the | ||
20 | directories in a shell and thus loosing the return status of | ||
21 | the command inside the loop. | ||
22 | |||
23 | This has the added advantage that parallel builds work now. | ||
24 | |||
25 | Upstream-Status: Pending | ||
26 | |||
27 | Signed-off-by: André Draszik <git@andred.net> | ||
28 | --- | ||
29 | Makefile.in | 18 ++++++++++++------ | ||
30 | 1 file changed, 12 insertions(+), 6 deletions(-) | ||
31 | |||
32 | diff --git a/Makefile.in b/Makefile.in | ||
33 | index 6028513..dab88bb 100644 | ||
34 | --- a/Makefile.in | ||
35 | +++ b/Makefile.in | ||
36 | @@ -13,11 +13,11 @@ distdir = $(PACKAGE)-$(VERSION) | ||
37 | |||
38 | SUBDIRS=libbridge brctl doc | ||
39 | |||
40 | -all: | ||
41 | - for x in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$x ; done | ||
42 | +all: override ACTION= | ||
43 | +all: $(SUBDIRS) | ||
44 | |||
45 | -clean: | ||
46 | - for x in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$x clean ; done | ||
47 | +clean: override ACTION=clean | ||
48 | +clean: $(SUBDIRS) | ||
49 | |||
50 | distclean: clean | ||
51 | rm -f config.log | ||
52 | @@ -30,6 +30,12 @@ maintainer-clean: distclean | ||
53 | rm -f libbridge/Makefile | ||
54 | rm -f doc/Makefile | ||
55 | |||
56 | -install: | ||
57 | - for x in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$x install; done | ||
58 | +install: override ACTION=install | ||
59 | +install: $(SUBDIRS) | ||
60 | |||
61 | + | ||
62 | +brctl: libbridge | ||
63 | +$(SUBDIRS): | ||
64 | + $(MAKE) $(MFLAGS) -C $@ $(ACTION) | ||
65 | + | ||
66 | +.PHONY: $(SUBDIRS) | ||
67 | -- | ||
68 | 2.8.1 | ||
69 | |||
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 @@ | |||
1 | From 68fafc4ea10365ac2e74ab7c660d097696857677 Mon Sep 17 00:00:00 2001 | ||
2 | From: root <git@andred.net> | ||
3 | Date: Wed, 20 Jul 2016 23:40:32 +0100 | ||
4 | Subject: [PATCH 2/5] libbridge: fix some build-time warnings (fcntl.h) | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | There are build-time warnings at the moment when building | ||
10 | against musl, as the code here #include's the wrong file, | ||
11 | sys/fcntl.h instead of fcntl.h | ||
12 | |||
13 | In file included from libbridge_devif.c:26:0: | ||
14 | <sysroot>/usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Wcpp] | ||
15 | #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> | ||
16 | ^~~~~~~ | ||
17 | In file included from libbridge_if.c:23:0: | ||
18 | <sysroot>/usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Wcpp] | ||
19 | #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> | ||
20 | ^~~~~~~ | ||
21 | |||
22 | glibc headers silently redirect sys/fcntl.h to fcntl.h so the | ||
23 | issue is not seen there. | ||
24 | |||
25 | Let's fix the #include's to so as to use the correct ones | ||
26 | and silence the compiler. | ||
27 | |||
28 | Upstream-Status: Pending | ||
29 | |||
30 | Signed-off-by: André Draszik <git@andred.net> | ||
31 | --- | ||
32 | libbridge/libbridge_devif.c | 2 +- | ||
33 | libbridge/libbridge_if.c | 2 +- | ||
34 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
35 | |||
36 | diff --git a/libbridge/libbridge_devif.c b/libbridge/libbridge_devif.c | ||
37 | index 1e83925..2cf78f6 100644 | ||
38 | --- a/libbridge/libbridge_devif.c | ||
39 | +++ b/libbridge/libbridge_devif.c | ||
40 | @@ -23,7 +23,7 @@ | ||
41 | #include <errno.h> | ||
42 | #include <string.h> | ||
43 | #include <dirent.h> | ||
44 | -#include <sys/fcntl.h> | ||
45 | +#include <fcntl.h> | ||
46 | |||
47 | #include "libbridge.h" | ||
48 | #include "libbridge_private.h" | ||
49 | diff --git a/libbridge/libbridge_if.c b/libbridge/libbridge_if.c | ||
50 | index 77d3f8a..9cf4bac 100644 | ||
51 | --- a/libbridge/libbridge_if.c | ||
52 | +++ b/libbridge/libbridge_if.c | ||
53 | @@ -20,7 +20,7 @@ | ||
54 | #include <stdlib.h> | ||
55 | #include <errno.h> | ||
56 | #include <string.h> | ||
57 | -#include <sys/fcntl.h> | ||
58 | +#include <fcntl.h> | ||
59 | #include <sys/ioctl.h> | ||
60 | |||
61 | #include "libbridge.h" | ||
62 | -- | ||
63 | 2.8.1 | ||
64 | |||
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 @@ | |||
1 | From 2b9dc245f93ab27d7da42a16ddbb9212888006e4 Mon Sep 17 00:00:00 2001 | ||
2 | From: root <git@andred.net> | ||
3 | Date: Wed, 20 Jul 2016 23:40:33 +0100 | ||
4 | Subject: [PATCH 3/5] bridge: fix some build-time warnings (errno.h) | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | There is a build-time warning at the moment when building | ||
10 | against musl, as the code here #include's the wrong file, | ||
11 | sys/errno.h instead of errno.h | ||
12 | |||
13 | In file included from brctl.c:22:0: | ||
14 | <sysroot>/usr/include/sys/errno.h:1:2: warning: #warning redirecting incorrect #include <sys/errno.h> to <errno.h> [-Wcpp] | ||
15 | #warning redirecting incorrect #include <sys/errno.h> to <errno.h> | ||
16 | ^~~~~~~ | ||
17 | |||
18 | glibc headers silently redirect sys/errno.h to errno.h so the | ||
19 | issue is not seen there. | ||
20 | |||
21 | Let's fix the #include's to so as to use the correct ones | ||
22 | and silence the compiler. | ||
23 | |||
24 | Upstream-Status: Pending | ||
25 | |||
26 | Signed-off-by: André Draszik <git@andred.net> | ||
27 | --- | ||
28 | brctl/brctl.c | 2 +- | ||
29 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
30 | |||
31 | diff --git a/brctl/brctl.c b/brctl/brctl.c | ||
32 | index 46ca352..8855234 100644 | ||
33 | --- a/brctl/brctl.c | ||
34 | +++ b/brctl/brctl.c | ||
35 | @@ -19,7 +19,7 @@ | ||
36 | #include <stdio.h> | ||
37 | #include <stdlib.h> | ||
38 | #include <string.h> | ||
39 | -#include <sys/errno.h> | ||
40 | +#include <errno.h> | ||
41 | #include <getopt.h> | ||
42 | |||
43 | #include "libbridge.h" | ||
44 | -- | ||
45 | 2.8.1 | ||
46 | |||
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 @@ | |||
1 | From c45b73829a8b8c7924df528baa7e16498f917288 Mon Sep 17 00:00:00 2001 | ||
2 | From: root <git@andred.net> | ||
3 | Date: Wed, 20 Jul 2016 23:40:33 +0100 | ||
4 | Subject: [PATCH 4/5] libbridge: add missing #include's (fix build against | ||
5 | musl) | ||
6 | MIME-Version: 1.0 | ||
7 | Content-Type: text/plain; charset=UTF-8 | ||
8 | Content-Transfer-Encoding: 8bit | ||
9 | |||
10 | Fixes error like: | ||
11 | |||
12 | In file included from libbridge_devif.c:28:0: | ||
13 | libbridge.h:45:17: error: field 'max_age' has incomplete type | ||
14 | struct timeval max_age; | ||
15 | ^~~~~~~ | ||
16 | In file included from libbridge_devif.c:28:0: | ||
17 | libbridge.h:51:2: error: unknown type name 'u_int16_t' | ||
18 | u_int16_t root_port; | ||
19 | ^~~~~~~~~ | ||
20 | |||
21 | These types are not standard C but rather Posix, | ||
22 | for struct timeval see: | ||
23 | http://pubs.opengroup.org/onlinepubs/7908799/xsh/systime.h.html | ||
24 | |||
25 | Upstream-Status: Pending | ||
26 | |||
27 | Signed-off-by: André Draszik <git@andred.net> | ||
28 | --- | ||
29 | libbridge/libbridge.h | 2 ++ | ||
30 | 1 file changed, 2 insertions(+) | ||
31 | |||
32 | diff --git a/libbridge/libbridge.h b/libbridge/libbridge.h | ||
33 | index 53ec869..b0727c1 100644 | ||
34 | --- a/libbridge/libbridge.h | ||
35 | +++ b/libbridge/libbridge.h | ||
36 | @@ -20,6 +20,8 @@ | ||
37 | #define _LIBBRIDGE_H | ||
38 | |||
39 | #include <sys/socket.h> | ||
40 | +#include <sys/time.h> | ||
41 | +#include <sys/types.h> | ||
42 | #include <linux/in6.h> | ||
43 | #include <linux/if.h> | ||
44 | #include <linux/if_bridge.h> | ||
45 | -- | ||
46 | 2.8.1 | ||
47 | |||
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 @@ | |||
1 | From 7bc1932cabfafca8c68e18bd43e3d203c70d2dd8 Mon Sep 17 00:00:00 2001 | ||
2 | From: root <git@andred.net> | ||
3 | Date: Wed, 20 Jul 2016 23:40:33 +0100 | ||
4 | Subject: [PATCH 5/5] build: don't ignore CFLAGS from environment | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | We need to take them into account so as to behave nicely towards | ||
10 | build environments which expect to be able to set them, e.g. for | ||
11 | optimisation flags, or debug options. | ||
12 | |||
13 | Therefore they need to be added to the compiler command line of | ||
14 | every source file, and in addition, the same CFLAGS that were | ||
15 | used during compilation must also always be used during linking! | ||
16 | |||
17 | Upstream-Status: Pending | ||
18 | |||
19 | Signed-off-by: André Draszik <git@andred.net> | ||
20 | --- | ||
21 | brctl/Makefile.in | 2 +- | ||
22 | libbridge/Makefile.in | 2 +- | ||
23 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
24 | |||
25 | diff --git a/brctl/Makefile.in b/brctl/Makefile.in | ||
26 | index e1956d6..eff260c 100644 | ||
27 | --- a/brctl/Makefile.in | ||
28 | +++ b/brctl/Makefile.in | ||
29 | @@ -34,7 +34,7 @@ install: $(PROGRAMS) | ||
30 | $(INSTALL) -m 755 $(PROGRAMS) $(DESTDIR)$(sbindir) | ||
31 | |||
32 | brctl: $(brctl_OBJECTS) ../libbridge/libbridge.a | ||
33 | - $(CC) $(LDFLAGS) $(brctl_OBJECTS) $(LIBS) -o brctl | ||
34 | + $(CC) $(CFLAGS) $(LDFLAGS) $(brctl_OBJECTS) $(LIBS) -o brctl | ||
35 | |||
36 | %.o: %.c brctl.h | ||
37 | $(CC) $(CFLAGS) $(INCLUDE) -c $< | ||
38 | diff --git a/libbridge/Makefile.in b/libbridge/Makefile.in | ||
39 | index 20512c4..4e1cddc 100644 | ||
40 | --- a/libbridge/Makefile.in | ||
41 | +++ b/libbridge/Makefile.in | ||
42 | @@ -5,7 +5,7 @@ AR=ar | ||
43 | RANLIB=@RANLIB@ | ||
44 | |||
45 | CC=@CC@ | ||
46 | -CFLAGS = -Wall -g $(KERNEL_HEADERS) | ||
47 | +CFLAGS = -Wall -g $(KERNEL_HEADERS) @CFLAGS@ | ||
48 | |||
49 | prefix=@prefix@ | ||
50 | exec_prefix=@exec_prefix@ | ||
51 | -- | ||
52 | 2.8.1 | ||
53 | |||
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 @@ | |||
1 | require bridge-utils.inc | 1 | require bridge-utils.inc |
2 | 2 | ||
3 | SRC_URI += "file://kernel-headers.patch" | 3 | SRC_URI += "\ |
4 | 4 | file://kernel-headers.patch \ | |
5 | PARALLEL_MAKE = "" | 5 | file://0001-build-error-out-correctly-if-a-submake-fails.patch \ |
6 | file://0002-libbridge-fix-some-build-time-warnings-fcntl.h.patch \ | ||
7 | file://0003-bridge-fix-some-build-time-warnings-errno.h.patch \ | ||
8 | file://0004-libbridge-add-missing-include-s-fix-build-against-mu.patch \ | ||
9 | file://0005-build-don-t-ignore-CFLAGS-from-environment.patch \ | ||
10 | " | ||
6 | 11 | ||
7 | LIC_FILES_CHKSUM = "file://COPYING;md5=f9d20a453221a1b7e32ae84694da2c37" | 12 | LIC_FILES_CHKSUM = "file://COPYING;md5=f9d20a453221a1b7e32ae84694da2c37" |
8 | 13 | ||