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