net-snmp: fix compile errors
authorFelix Fietkau <nbd@openwrt.org>
Mon, 19 Oct 2009 10:48:55 +0000 (10:48 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 19 Oct 2009 10:48:55 +0000 (10:48 +0000)
SVN-Revision: 18076

libs/net-snmp/Makefile
libs/net-snmp/patches/170-ldflags.patch [new file with mode: 0644]

index c3f10b79774e1496ad46de70bd124a0cda42417e..95e44d91ed7da5c2f304c28c003ccdec812eea55 100644 (file)
@@ -175,22 +175,23 @@ SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
 CONFIGURE_ARGS+= --enable-ipv6
 endif
 
+TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
+
+ifdef CONFIG_PACKAGE_snmpd-static
+  define Build/Compile/static
+       $(MAKE) -C $(PKG_BUILD_DIR)/agent \
+               LDFLAGS="$(TARGET_LDFLAGS) -lm -static" \
+               EXEEXT="-static" \
+               snmpd-static
+  endef
+endif
+
 define Build/Compile
-       rm -rf $(PKG_INSTALL_DIR)
-       mkdir -p $(PKG_INSTALL_DIR)
        $(MAKE) -C $(PKG_BUILD_DIR) \
-               LDFLAGS="$(TARGET_LDFLAGS) -lm" \
-               INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
-               all install
-       ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-shared; )
-       #ifneq ($(CONFIG_PACKAGE_snmpd-static),)
-       ( cd $(PKG_BUILD_DIR); rm -f agent/snmpd; )
-       $(MAKE) -C $(PKG_BUILD_DIR) \
-               LDFLAGS="$(TARGET_LDFLAGS) -lm -static" \
                INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
-               all install
-       ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-static; )
-       #endif
+               LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
+               all install     
+       $(Build/Compile/static)
 endef
 
 define Build/InstallDev
@@ -224,7 +225,7 @@ define Package/snmpd/install
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
        $(INSTALL_DIR) $(1)/usr/sbin
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd-shared $(1)/usr/sbin/snmpd
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
 endef
 
 define Package/snmpd-static/conffiles
@@ -242,7 +243,7 @@ define Package/snmpd-static/install
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
        $(INSTALL_DIR) $(1)/usr/sbin
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd-static $(1)/usr/sbin/snmpd
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/agent/snmpd-static $(1)/usr/sbin/snmpd
 endef
 
 define Package/snmp-utils/install
diff --git a/libs/net-snmp/patches/170-ldflags.patch b/libs/net-snmp/patches/170-ldflags.patch
new file mode 100644 (file)
index 0000000..d9826bc
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.top
++++ b/Makefile.top
+@@ -81,7 +81,7 @@ LIBCURRENT  = 16
+ LIBAGE      = 1
+ LIBREVISION = 2
+-LIB_LD_CMD      = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -o
++LIB_LD_CMD      = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) $(LDFLAGS) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -o
+ LIB_EXTENSION   = la
+ LIB_VERSION     =
+ LIB_LDCONFIG_CMD = $(LIBTOOL) --mode=finish $(libdir)