reaver: Fix build with external toolchains
authorFlorian Fainelli <f.fainelli@gmail.com>
Sat, 17 Jun 2017 02:53:59 +0000 (19:53 -0700)
committerFlorian Fainelli <f.fainelli@gmail.com>
Sat, 17 Jun 2017 03:47:03 +0000 (20:47 -0700)
We would not be able to search for pcap.h because CFLAGS are not passed
from src/Makefile down to src/wps/Makefile:

make[4]: Entering directory
'/home/florian/dev/openwrt/trunk/build_dir/target-mipsel-unknown-linux-gnu_glibc/reaver-1.4/src/wps'
mipsel-linux-gnu-gcc -I../utils -I ../ wps_attr_build.c -c
mipsel-linux-gnu-gcc -I../utils -I ../ wps_attr_parse.c -c
mipsel-linux-gnu-gcc -I../utils -I ../ wps_attr_process.c -c
mipsel-linux-gnu-gcc -I../utils -I ../ wps.c -c
mipsel-linux-gnu-gcc -I../utils -I ../ wps_common.c -c
mipsel-linux-gnu-gcc -I../utils -I ../ wps_dev_attr.c -c
mipsel-linux-gnu-gcc -I../utils -I ../ wps_enrollee.c -c
mipsel-linux-gnu-gcc -I../utils -I ../ wps_registrar.c -c
In file included from ../misc.h:41:0,
                 from wps_registrar.c:27:
../defs.h:43:18: fatal error: pcap.h: No such file or directory
 #include <pcap.h>
                  ^
compilation terminated.
Makefile:28: recipe for target 'wps_registrar.o' failed

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
net/reaver/Makefile
net/reaver/patches/0102-wps-cflags.patch [new file with mode: 0644]

index 1a499de7c64ab8a9e65d1061f49e046e358f114b..c663c4183757872a3ad8b3beacf3018422f303a4 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=reaver
 PKG_VERSION:=1.4
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
@@ -25,6 +25,7 @@ include $(INCLUDE_DIR)/package.mk
 
 CONFIGURE_PATH:=src
 MAKE_PATH:=src
+EXTRA_CFLAGS=$(TARGET_CPPFLAGS)
 
 define Package/reaver
   SECTION:=net
diff --git a/net/reaver/patches/0102-wps-cflags.patch b/net/reaver/patches/0102-wps-cflags.patch
new file mode 100644 (file)
index 0000000..9a98025
--- /dev/null
@@ -0,0 +1,45 @@
+Index: reaver-1.4/src/wps/Makefile
+===================================================================
+--- reaver-1.4.orig/src/wps/Makefile
++++ reaver-1.4/src/wps/Makefile
+@@ -4,31 +4,31 @@ INC=-I../utils -I ../
+ all: wps_attr_build.o wps_attr_parse.o wps_attr_process.o wps.o wps_common.o wps_dev_attr.o wps_enrollee.o wps_registrar.o wps_ufd.o
+ wps_attr_build.o:
+-      $(CC) $(INC) wps_attr_build.c -c
++      $(CC) $(CFLAGS) $(INC) wps_attr_build.c -c
+ wps_attr_parse.o:
+-      $(CC) $(INC) wps_attr_parse.c -c
++      $(CC) $(CFLAGS) $(INC) wps_attr_parse.c -c
+ wps_attr_process.o:
+-      $(CC) $(INC) wps_attr_process.c -c
++      $(CC) $(CFLAGS) $(INC) wps_attr_process.c -c
+ wps.o:
+-      $(CC) $(INC) wps.c -c
++      $(CC) $(CFLAGS) $(INC) wps.c -c
+ wps_common.o:
+-      $(CC) $(INC) wps_common.c -c
++      $(CC) $(CFLAGS) $(INC) wps_common.c -c
+ wps_dev_attr.o:
+-      $(CC) $(INC) wps_dev_attr.c -c
++      $(CC) $(CFLAGS) $(INC) wps_dev_attr.c -c
+ wps_enrollee.o:
+-      $(CC) $(INC) wps_enrollee.c -c
++      $(CC) $(CFLAGS) $(INC) wps_enrollee.c -c
+ wps_registrar.o:
+-      $(CC) $(INC) wps_registrar.c -c
++      $(CC) $(CFLAGS) $(INC) wps_registrar.c -c
+ wps_ufd.o:
+-      $(CC) $(INC) wps_ufd.c -c
++      $(CC) $(CFLAGS) $(INC) wps_ufd.c -c
+ clean:
+       rm -f *.o