2a348476fbd71eac7df08172c07c5ee91a231f53
[openwrt/staging/rmilecki.git] /
1 From 3a5a84cdd1488bad118eeac72d09a60299bca744 Mon Sep 17 00:00:00 2001
2 From: Simon Kelley <simon@thekelleys.org.uk>
3 Date: Wed, 31 Oct 2018 21:30:13 +0000
4 Subject: [PATCH 08/57] Fix Makefile lines generating UBUS linker config.
5
6 If arg2 of pkg-wrapper is "--copy", then arg1 is NOT the name of
7 the package manager (--copy doesn't invoke it) it's a secondary
8 config string that inhibts the copy if found. This patch allows that
9 to be the empty string, for unconditional copy, and modifies the
10 ubus linker config to use it. It worked by coincidence before, because
11 there was no config string called "pkg-config".
12
13 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
14 ---
15 Makefile | 2 +-
16 bld/pkg-wrapper | 14 ++++++++------
17 2 files changed, 9 insertions(+), 7 deletions(-)
18
19 --- a/Makefile
20 +++ b/Makefile
21 @@ -53,7 +53,7 @@ top?=$(CURDIR)
22
23 dbus_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1`
24 dbus_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1`
25 -ubus_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_UBUS $(PKG_CONFIG) --copy -lubox -lubus`
26 +ubus_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_UBUS "" --copy -lubox -lubus`
27 idn_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --cflags libidn`
28 idn_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --libs libidn`
29 idn2_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFIG) --cflags libidn2`
30 --- a/bld/pkg-wrapper
31 +++ b/bld/pkg-wrapper
32 @@ -11,23 +11,25 @@ in=`cat`
33
34 if grep "^\#[[:space:]]*define[[:space:]]*$search" config.h >/dev/null 2>&1 || \
35 echo $in | grep $search >/dev/null 2>&1; then
36 -# Nasty, nasty, in --copy, arg 2 is another config to search for, use with NO_GMP
37 +# Nasty, nasty, in --copy, arg 2 (if non-empty) is another config to search for, used with NO_GMP
38 if [ $op = "--copy" ]; then
39 - if grep "^\#[[:space:]]*define[[:space:]]*$pkg" config.h >/dev/null 2>&1 || \
40 - echo $in | grep $pkg >/dev/null 2>&1; then
41 + if [ -z "$pkg" ]; then
42 + pkg="$*"
43 + elif grep "^\#[[:space:]]*define[[:space:]]*$pkg" config.h >/dev/null 2>&1 || \
44 + echo $in | grep $pkg >/dev/null 2>&1; then
45 pkg=""
46 else
47 pkg="$*"
48 fi
49 elif grep "^\#[[:space:]]*define[[:space:]]*${search}_STATIC" config.h >/dev/null 2>&1 || \
50 - echo $in | grep ${search}_STATIC >/dev/null 2>&1; then
51 + echo $in | grep ${search}_STATIC >/dev/null 2>&1; then
52 pkg=`$pkg --static $op $*`
53 else
54 pkg=`$pkg $op $*`
55 fi
56 -
57 +
58 if grep "^\#[[:space:]]*define[[:space:]]*${search}_STATIC" config.h >/dev/null 2>&1 || \
59 - echo $in | grep ${search}_STATIC >/dev/null 2>&1; then
60 + echo $in | grep ${search}_STATIC >/dev/null 2>&1; then
61 if [ $op = "--libs" ] || [ $op = "--copy" ]; then
62 echo "-Wl,-Bstatic $pkg -Wl,-Bdynamic"
63 else