packages: add missing conffiles define
[openwrt/svn-archive/archive.git] / net / restund / Makefile
1 #
2 # Copyright (C) 2010-2011 OpenWrt.org
3 # Copyright (C) 2010 Alfred E. Heggestad
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=restund
12 PKG_VERSION:=0.3.0
13 PKG_RELEASE:=3
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.creytiv.com/pub/
17 PKG_MD5SUM:=e82bdb994b26b8c16d799b3dc8dd0008
18
19 restund-mods:= \
20 mysql \
21
22 PKG_CONFIG_DEPENDS:= \
23 $(patsubst %,CONFIG_PACKAGE_restund-mod-%,$(restund-mods)) \
24
25 include $(INCLUDE_DIR)/package.mk
26
27 define Package/restund/Default
28 SECTION:=net
29 CATEGORY:=Network
30 SUBMENU:=Telephony
31 URL:=http://www.creytiv.com/
32 endef
33
34 define Package/restund
35 $(call Package/restund/Default)
36 TITLE:=Modular STUN/TURN server
37 DEPENDS:=+libre +libpthread
38 endef
39
40
41 restund-mod-mysql := USE_MYSQL
42
43 RESTUND_MOD_OPTIONS:= \
44 $(foreach m,$(restund-mods),$(restund-mod-$(m))=$(if $(CONFIG_PACKAGE_restund-mod-$(m)),1))
45
46 define Build/Compile
47 $(MAKE) -C $(PKG_BUILD_DIR) \
48 LIBRE_MK="$(STAGING_DIR)/usr/share/re/re.mk" \
49 LIBRE_INC="$(STAGING_DIR)/usr/include/re" \
50 LIBRE_SO="$(STAGING_DIR)/usr/lib" \
51 CC="$(TARGET_CC)" \
52 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
53 DESTDIR="$(PKG_INSTALL_DIR)" \
54 SYSROOT="$(TOOLCHAIN_DIR)" \
55 SYSROOT_ALT="$(STAGING_DIR)/usr" \
56 RELEASE=1 \
57 CROSS_COMPILE="$(TARGET_CROSS)" \
58 OS="linux" \
59 $(RESTUND_MOD_OPTIONS) \
60 all install
61 endef
62
63 define Package/restund/install
64 $(INSTALL_DIR) $(1)/usr/sbin
65 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/restund $(1)/usr/sbin/
66 $(INSTALL_DIR) $(1)/usr/lib/restund/modules
67 $(CP) \
68 $(PKG_INSTALL_DIR)/usr/lib/restund/modules/auth.so \
69 $(PKG_INSTALL_DIR)/usr/lib/restund/modules/binding.so \
70 $(PKG_INSTALL_DIR)/usr/lib/restund/modules/stat.so \
71 $(PKG_INSTALL_DIR)/usr/lib/restund/modules/status.so \
72 $(PKG_INSTALL_DIR)/usr/lib/restund/modules/syslog.so \
73 $(PKG_INSTALL_DIR)/usr/lib/restund/modules/turn.so \
74 $(1)/usr/lib/restund/modules/
75 $(INSTALL_DIR) $(1)/etc
76 $(INSTALL_CONF) $(PKG_BUILD_DIR)/etc/restund.conf $(1)/etc/
77 $(SED) \
78 's|^\(module_path\)\([ \t]\+\).*$$$$|\1\2/usr/lib/restund/modules|g' \
79 $(1)/etc/restund.conf
80 $(INSTALL_DIR) $(1)/etc/init.d
81 $(INSTALL_BIN) ./files/restund.init $(1)/etc/init.d/restund
82 endef
83
84 define Package/restund/conffiles
85 /etc/restund.conf
86 endef
87
88 #
89 # 1. Name
90 # 2. Title
91 # 3. Files
92 # 4. Depends
93 #
94 define BuildPlugin
95
96 define Package/restund-mod-$(1)
97 $$(call Package/restund/Default)
98 TITLE:= restund $(2) module
99 DEPENDS:= restund $(4)
100 endef
101
102 define Package/restund-mod-$(1)/install
103 [ -z "$(3)" ] || $(INSTALL_DIR) $$(1)/usr/lib/restund/modules
104 for f in $(3); do \
105 $(CP) \
106 $(PKG_INSTALL_DIR)/usr/lib/restund/modules/$$$$$$$${f}.so \
107 $$(1)/usr/lib/restund/modules/ ; \
108 done
109 endef
110
111 $$(eval $$(call BuildPackage,restund-mod-$(1)))
112 endef
113
114
115 $(eval $(call BuildPackage,restund))
116
117 $(eval $(call BuildPlugin,mysql,MySQL database backend,mysql_ser,+PACKAGE_restund-mod-mysql:libmysqlclient))