7ea52d1f8640acc96d197a5cfb4ae46a9a131ad3
[openwrt/svn-archive/archive.git] / openwrt / package / openser / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=openser
6 PKG_VERSION:=1.0.1
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=eebc16665003ee92daf96b216d6f9563
9 # PKG_VARIANT:=-tls # for tls version
10 PKG_VARIANT:=
11
12 PKG_SOURCE_URL:=http://openser.org/pub/openser/$(PKG_VERSION)/src
13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)$(PKG_VARIANT)_src.tar.gz
14 PKG_CAT:=zcat
15
16 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
17 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
18
19 include $(TOPDIR)/package/rules.mk
20
21 define PKG_mod_template
22
23 $$(IPKG_$(1)):
24 [ -z "$(2)" ] || install -d -m 0755 $$(IDIR_$(1))/usr/lib/openser/modules/
25 $(CP) $(PKG_BUILD_DIR)/modules/$(2)/$(2).so \
26 $$(IDIR_$(1))/usr/lib/openser/modules/ ; \
27 $(RSTRIP) $$(IDIR_$(1))
28 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
29
30 endef
31
32 $(eval $(call PKG_template,OPENSER,openser,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
33 $(eval $(call PKG_template,OPENSER_MOD_ACCOUNTING,openser-mod-acc,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
34 $(eval $(call PKG_template,OPENSER_MOD_AUTH,openser-mod-auth,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
35 $(eval $(call PKG_template,OPENSER_MOD_AUTH_DB,openser-mod-auth-db,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
36 $(eval $(call PKG_template,OPENSER_MOD_AUTH_RADIUS,openser-mod-auth-radius,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
37 $(eval $(call PKG_template,OPENSER_MOD_AVP_RADIUS,openser-mod-avp-radius,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
38 $(eval $(call PKG_template,OPENSER_MOD_AVPOPS,openser-mod-avpops,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
39 $(eval $(call PKG_template,OPENSER_MOD_DISPATCHER,openser-mod-dispatcher,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
40 $(eval $(call PKG_template,OPENSER_MOD_DIVERSION,openser-mod-diversion,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
41 $(eval $(call PKG_template,OPENSER_MOD_FLATSTORE,openser-mod-flatstore,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
42 $(eval $(call PKG_template,OPENSER_MOD_GFLAGS,openser-mod-gflags,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
43 $(eval $(call PKG_template,OPENSER_MOD_GROUP,openser-mod-group,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
44 $(eval $(call PKG_template,OPENSER_MOD_GROUP_RADIUS,openser-mod-group-radius,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
45 $(eval $(call PKG_template,OPENSER_MOD_LCR,openser-mod-lcr,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
46 $(eval $(call PKG_template,OPENSER_MOD_MEDIAPROXY,openser-mod-mediaproxy,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
47 $(eval $(call PKG_template,OPENSER_MOD_MSILO,openser-mod-msilo,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
48 $(eval $(call PKG_template,OPENSER_MOD_MYSQL,openser-mod-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
49 $(eval $(call PKG_template,OPENSER_MOD_NATHELPER,openser-mod-nathelper,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
50 $(eval $(call PKG_template,OPENSER_MOD_OPTIONS,openser-mod-options,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
51 $(eval $(call PKG_template,OPENSER_MOD_PDT,openser-mod-pdt,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
52 $(eval $(call PKG_template,OPENSER_MOD_PERMISSIONS,openser-mod-permissions,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
53 $(eval $(call PKG_template,OPENSER_MOD_PIKE,openser-mod-pike,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
54 $(eval $(call PKG_template,OPENSER_MOD_SMS,openser-mod-sms,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
55 $(eval $(call PKG_template,OPENSER_MOD_UAC,openser-mod-uac,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
56 $(eval $(call PKG_template,OPENSER_MOD_UAC_REDIRECT,openser-mod-uac-redirect,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
57 $(eval $(call PKG_template,OPENSER_MOD_URI,openser-mod-uri,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
58 $(eval $(call PKG_template,OPENSER_MOD_URI_DB,openser-mod-uri-db,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
59 $(eval $(call PKG_template,OPENSER_MOD_URI_RADIUS,openser-mod-uri-radius,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
60 $(eval $(call PKG_template,OPENSER_MOD_AUTH_RADIUS,openser-mod-auth-radius,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
61 $(eval $(call PKG_template,OPENSER_MOD_XLOG,openser-mod-xlog,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
62
63 $(eval $(call PKG_mod_template,OPENSER_MOD_ACCOUNTING,acc))
64 $(eval $(call PKG_mod_template,OPENSER_MOD_AUTH,auth))
65 $(eval $(call PKG_mod_template,OPENSER_MOD_AUTH_DB,auth_db))
66 $(eval $(call PKG_mod_template,OPENSER_MOD_AUTH_RADIUS,auth_radius))
67 $(eval $(call PKG_mod_template,OPENSER_MOD_AVP_RADIUS,avp_radius))
68 $(eval $(call PKG_mod_template,OPENSER_MOD_AVPOPS,avpops))
69 $(eval $(call PKG_mod_template,OPENSER_MOD_DISPATCHER,dispatcher))
70 $(eval $(call PKG_mod_template,OPENSER_MOD_DIVERSION,diversion))
71 $(eval $(call PKG_mod_template,OPENSER_MOD_FLATSTORE,flatstore))
72 $(eval $(call PKG_mod_template,OPENSER_MOD_GFLAGS,gflags))
73 $(eval $(call PKG_mod_template,OPENSER_MOD_GROUP,group))
74 $(eval $(call PKG_mod_template,OPENSER_MOD_GROUP_RADIUS,group_radius))
75 $(eval $(call PKG_mod_template,OPENSER_MOD_LCR,lcr))
76 $(eval $(call PKG_mod_template,OPENSER_MOD_MEDIAPROXY,mediaproxy))
77 $(eval $(call PKG_mod_template,OPENSER_MOD_MSILO,msilo))
78 $(eval $(call PKG_mod_template,OPENSER_MOD_MYSQL,mysql))
79 $(eval $(call PKG_mod_template,OPENSER_MOD_NATHELPER,nathelper))
80 $(eval $(call PKG_mod_template,OPENSER_MOD_OPTIONS,options))
81 $(eval $(call PKG_mod_template,OPENSER_MOD_PDT,pdt))
82 $(eval $(call PKG_mod_template,OPENSER_MOD_PERMISSIONS,permissions))
83 $(eval $(call PKG_mod_template,OPENSER_MOD_PIKE,pike))
84 $(eval $(call PKG_mod_template,OPENSER_MOD_SMS,sms))
85 $(eval $(call PKG_mod_template,OPENSER_MOD_SPEEDIAL,speeddial))
86 $(eval $(call PKG_mod_template,OPENSER_MOD_UAC,uac))
87 $(eval $(call PKG_mod_template,OPENSER_MOD_UAC_REDIRECT,uac_redirect))
88 $(eval $(call PKG_mod_template,OPENSER_MOD_URI,uri))
89 $(eval $(call PKG_mod_template,OPENSER_MOD_URI_DB,uri_db))
90 $(eval $(call PKG_mod_template,OPENSER_MOD_URI_RADIUS,uri_radius))
91 $(eval $(call PKG_mod_template,OPENSER_MOD_XLOG,xlog))
92
93 # Select here the modules for the ipk package
94 OPENSER_MODULES := sl tm rr maxfwd usrloc registrar dbtext textops exec
95
96 OPENSER_MODULE_FILES := $(foreach module,$(OPENSER_MODULES),modules/$(module)/$(module).so)
97 OPENSER_MODULES := $(patsubst %,modules/%,$(OPENSER_MODULES))
98
99 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
100 touch $@
101
102 $(PKG_BUILD_DIR)/.built:
103 $(MAKE) -C $(PKG_BUILD_DIR) \
104 prefix=/ \
105 extra_defs="-DUSE_PTHREAD_MUTEX " \
106 CC="$(TARGET_CC)" \
107 ARCH="$(ARCH)" \
108 CFLAGS="$(TARGET_CFLAGS)" \
109 LOCALBASE="$(STAGING_DIR)/usr" \
110 all utils/gen_ha1/gen_ha1
111 touch $@
112
113 $(IPKG_OPENSER):
114 mkdir -p $(IDIR_OPENSER)/usr/sbin
115 $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(IDIR_OPENSER)/usr/sbin/
116 $(CP) $(PKG_BUILD_DIR)/utils/gen_ha1/gen_ha1 $(IDIR_OPENSER)/usr/sbin/openser_gen_ha1
117 $(CP) $(PKG_BUILD_DIR)/scripts/sc $(IDIR_OPENSER)/usr/sbin/openserctl
118 chmod 744 $(IDIR_OPENSER)/usr/sbin/openserctl
119 $(CP) $(PKG_BUILD_DIR)/scripts/sc.dbtext $(IDIR_OPENSER)/usr/sbin/dbtextctl
120 chmod 744 $(IDIR_OPENSER)/usr/sbin/dbtextctl
121 mkdir -p $(IDIR_OPENSER)/usr/lib/openser/modules
122 (cd $(PKG_BUILD_DIR);\
123 $(CP) $(OPENSER_MODULE_FILES) $(IDIR_OPENSER)/usr/lib/openser/modules/; \
124 )
125 mkdir -p $(IDIR_OPENSER)/etc/openser
126 $(CP) $(PKG_BUILD_DIR)/etc/openser.cfg $(IDIR_OPENSER)/etc/openser/
127 $(RSTRIP) $(IDIR_OPENSER)
128 $(IPKG_BUILD) $(IDIR_OPENSER) $(PACKAGE_DIR)