wing: Attempt to fix cross compile issues.
authorMichael Büsch <mb@bu3sch.de>
Sun, 10 Oct 2010 13:26:18 +0000 (13:26 +0000)
committerMichael Büsch <mb@bu3sch.de>
Sun, 10 Oct 2010 13:26:18 +0000 (13:26 +0000)
The target build inherits configure properties from the host. This results in broken compile for an ARM target and PPC host. (and other combinations as well).
This tries to fix it. However, it still is not 100% safe. However, it does work on ARM/PPC with these changes.
We should either split this into host and target packages, or run a "make clean" between the host and target parts.

SVN-Revision: 23376

net/wing/Makefile
net/wing/patches/100-cross-compile.patch [new file with mode: 0644]

index 0ce64a4..87d24de 100644 (file)
@@ -11,7 +11,7 @@ PKG_NAME:=wing
 
 ifneq ($(CONFIG_WING_STABLE),)
        PKG_VERSION:=20100903
-       PKG_RELEASE:=3
+       PKG_RELEASE:=4
        PKG_REV:=520e3168a5af4d26bec3779cfa4901d128a4bc6f
 else 
        PKG_VERSION:=$(shell date +%Y%m%d)
@@ -26,6 +26,7 @@ PKG_SOURCE_VERSION:=$(PKG_REV)
 PKG_SOURCE_PROTO:=git
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL:=1
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -48,6 +49,18 @@ define Package/wing/config
        source "$(SOURCE)/Config.in"
 endef
 
+EXTRA_LDFLAGS:=-ldl
+
+MAKE_FLAGS+=\
+       V=1 \
+       MINDRIVER=$(PKG_NAME) \
+       BUILD_CC=$(TARGET_CC) \
+       BUILD_CXX=$(TARGET_CXX)
+
+HOST_MAKE_FLAGS:=\
+       V=1 \
+       MINDRIVER=$(PKG_NAME)
+
 define Build/Configure
        (cd $(PKG_BUILD_DIR); \
                rm -rf config.{cache,status}; \
@@ -58,9 +71,19 @@ define Build/Configure
                        --enable-wing \
                        --disable-linuxmodule \
        );
-       $(MAKE) -C $(PKG_BUILD_DIR) tools elementmap.xml
+       $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(HOST_MAKE_FLAGS) tools
+       $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(HOST_MAKE_FLAGS) elementmap.xml
+       $(CP) $(PKG_BUILD_DIR)/tools/click-mkmindriver/click-mkmindriver $(PKG_BUILD_DIR)/
+       rm -rf $(PKG_BUILD_DIR)/config.{cache,status}
+       $(call Build/Configure/Default, \
+               --enable-tools=mixed \
+               --enable-userlevel \
+               --enable-wifi \
+               --enable-wing \
+               --disable-linuxmodule \
+       )
        (cd $(PKG_BUILD_DIR)/userlevel; \
-               ../tools/click-mkmindriver/click-mkmindriver -p $(PKG_NAME) -C .. \
+               ../click-mkmindriver -p $(PKG_NAME) -C .. \
                -f $(PKG_BUILD_DIR)/conf/wing/sample.click \
                -A --all -E Discard -E Print -E Null \
                -E InfiniteSource -E RatedSource -E EtherEncap -E UDPIPEncap \
@@ -68,30 +91,6 @@ define Build/Configure
                -E ProbeTXRate -E MadwifiRate -E AutoRateFallback \
                -E RoundRobinSched -E DRRSched; \
        )
-       (cd $(PKG_BUILD_DIR); \
-               rm -rf config.{cache,status} ; \
-               $(TARGET_CONFIGURE_OPTS) \
-               CXXFLAGS="-static -O2 -MD" CFLAGS="-static -MD" \
-               CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
-               LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
-               ./configure \
-                       --prefix=/usr \
-                       --target=$(GNU_TARGET_NAME) \
-                       --host=$(GNU_TARGET_NAME) \
-                       --build=$(GNU_HOST_NAME) \
-                       --enable-tools=mixed \
-                       --enable-userlevel \
-                       --enable-wifi \
-                       --enable-wing \
-                       --disable-linuxmodule \
-       );
-endef
-
-define Build/Compile
-       $(MAKE) -C $(PKG_BUILD_DIR) \
-               MINDRIVER=$(PKG_NAME) \
-               DESTDIR="$(PKG_INSTALL_DIR)" \
-               all install
 endef
 
 define Package/wing/install
diff --git a/net/wing/patches/100-cross-compile.patch b/net/wing/patches/100-cross-compile.patch
new file mode 100644 (file)
index 0000000..70c7c7c
--- /dev/null
@@ -0,0 +1,21 @@
+---
+ m4/click.m4 |    8 --------
+ 1 file changed, 8 deletions(-)
+
+--- wing-20100903.orig/m4/click.m4
++++ wing-20100903/m4/click.m4
+@@ -235,14 +235,6 @@ AC_DEFUN([CLICK_CHECK_BUILD_DYNAMIC_LINK
+     if test "x$ac_build_have_dlopen" = xyes -a "x$ac_build_have_dlfcn_h" = xyes; then
+       ac_build_have_dynamic_linking=yes
+     fi
+-    if test "x$ac_build_have_dynamic_linking" != "x$ac_have_dynamic_linking"; then
+-      AC_MSG_ERROR([
+-=========================================
+-
+-Build system and host system don't have the same dynamic linking state!
+-
+-=========================================])
+-    fi
+     AC_SUBST(BUILD_DL_LIBS)
+     eval "$saver"
+ ])