fix build on recent gcc (>= 4.1.1) by statically linking against libstdc++ portions...
[packages.git] / net / rrs / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=rrs
12 PKG_VERSION:=1.70
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.cycom.se/uploads/36/19 
17 PKG_MD5SUM:=b400d03c0e39e3e78a7327ba78f789f0
18 PKG_CAT:=zcat
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/rrs/Default
25   SECTION:=net
26   CATEGORY:=Network
27   DEPENDS:=+uclibcxx 
28   TITLE:=A reverse (connecting) remote shell
29   URL:=http://www.cycom.se/dl/rrs/
30 endef
31
32 define Package/rrs
33   $(call Package/rrs/Default)
34   DEPENDS+= +libopenssl
35   TITLE+= (with SSL support)
36 endef
37
38 define Package/rrs-nossl
39   TITLE+= (without SSL support)
40 endef
41
42 define Build/Compile/Template
43         $(MAKE) -C $(PKG_BUILD_DIR) \
44                 CC="$(TARGET_CC)" \
45                 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include -fno-builtin -fno-rtti -nostdinc++" \
46                 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -Wl,-Bdynamic,-luClibc++,-Bstatic,-lstdc++,-Bdynamic $(3) -lutil -lm -lc" \
47                 $(2)
48         ( cd $(PKG_BUILD_DIR); mv rrs rrs-$(1); )
49 endef
50
51 ifneq ($(CONFIG_PACKAGE_rrs),)
52   define Build/Compile/with-ssl
53         $(call Build/Compile/Template,ssl,generic,-lcrypto -lssl)
54   endef
55 endif
56
57 ifneq ($(CONFIG_PACKAGE_rrs-nossl),)
58   define Build/Compile/without-ssl
59         $(call Build/Compile/Template,nossl,generic-nossl,)
60   endef
61 endif
62
63 define Build/Compile
64         $(call Build/Compile/with-ssl)
65         $(call Build/Compile/without-ssl)
66 endef
67
68 define Package/rrs/install      
69         install -d -m0755 $(1)/usr/bin
70         install -m0755 $(PKG_BUILD_DIR)/rrs-ssl $(1)/usr/bin/rrs
71 endef
72
73 define Package/rrs-nossl/install        
74         install -d -m0755 $(1)/usr/bin
75         install -m0755 $(PKG_BUILD_DIR)/rrs-nossl $(1)/usr/bin/rrs
76 endef
77
78 $(eval $(call BuildPackage,rrs))
79 $(eval $(call BuildPackage,rrs-nossl))