net/lsm: add link state monitor package. (thank you Brian J. Murrell)
[openwrt/svn-archive/archive.git] / net / prosody / Makefile
1 #
2 # Copyright (C) 2009-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=prosody
11 PKG_VERSION:=0.6.2
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://prosody.im/downloads/source
16 PKG_MD5SUM:=5da59bc906419ad3b4faa21516a6ca18
17
18 PKG_INSTALL:=1
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/prosody
23 SECTION:=net
24 CATEGORY:=Network
25 SUBMENU:=Instant Messaging
26 DEPENDS:=+luafilesystem +libidn +luaexpat +luasec
27 TITLE:=XMPP server
28 URL:=http://prosody.im/
29 endef
30
31 define Package/prosody/description
32 Prosody is an exciting new server for Jabber/XMPP
33 written in Lua. It aims to be easy to use, and light
34 on resources
35 endef
36
37 define Package/prosody/conffiles
38 /etc/prosody/prosody.cfg.lua
39 endef
40
41 TARGET_CFLAGS += $(FPIC)
42
43 define Build/Configure
44 # this is *NOT* GNU autoconf stuff
45 (cd $(PKG_BUILD_DIR); ./configure \
46 --prefix=/usr \
47 --with-lua="$(STAGING_DIR)/host/bin" \
48 --with-lua-include="$(STAGING_DIR)/usr/include" \
49 --with-lua-lib="$(STAGING_DIR)/usr/lib" \
50 --cflags="$(TARGET_CFLAGS)" \
51 --datadir="/etc/prosody/data" \
52 )
53 endef
54
55 MAKE_FLAGS += \
56 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -std=gnu99" \
57 LDFLAGS="$(TARGET_LDFLAGS)" \
58 PREFIX="/usr" \
59
60 define Package/prosody/install
61 $(INSTALL_DIR) $(1)/etc/init.d
62 $(INSTALL_BIN) ./files/prosody.init $(1)/etc/init.d/prosody
63 $(INSTALL_DIR) $(1)/etc/prosody
64 $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/prosody/prosody.cfg.lua $(1)/etc/prosody/
65 $(INSTALL_DIR) $(1)/etc/prosody/certs
66 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/prosody/certs/localhost.{cert,key} $(1)/etc/prosody/certs/
67 $(INSTALL_DIR) $(1)/etc/prosody/data
68 $(INSTALL_DIR) $(1)/usr/bin
69 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/prosody{,ctl} $(1)/usr/bin/
70 $(INSTALL_DIR) $(1)/usr/lib/prosody
71 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/prosody/prosody.version $(1)/usr/lib/prosody/
72 $(INSTALL_DIR) $(1)/usr/lib/prosody/core
73 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/core/*.lua $(1)/usr/lib/prosody/core/
74 $(INSTALL_DIR) $(1)/usr/lib/prosody/fallbacks
75 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/fallbacks/*.lua $(1)/usr/lib/prosody/fallbacks/
76 $(INSTALL_DIR) $(1)/usr/lib/prosody/modules
77 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/modules/*.lua $(1)/usr/lib/prosody/modules/
78 $(INSTALL_DIR) $(1)/usr/lib/prosody/modules/muc
79 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/modules/muc/*.lua $(1)/usr/lib/prosody/modules/muc/
80 $(INSTALL_DIR) $(1)/usr/lib/prosody/net
81 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/net/*.lua $(1)/usr/lib/prosody/net/
82 $(INSTALL_DIR) $(1)/usr/lib/prosody/util
83 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/prosody/util/*.lua $(1)/usr/lib/prosody/util/
84 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/prosody/util/*.so $(1)/usr/lib/prosody/util/
85 endef
86
87 define Package/prosody/postinst
88 #!/bin/sh
89
90 id=54
91 name=prosody
92 home=/tmp/.$${name}
93 shell=/bin/false
94
95 # do not change below
96 # check if we are on real system
97 if [ -z "$${IPKG_INSTROOT}" ]; then
98 # create copies of passwd and group, if we use squashfs
99 rootfs=`mount |awk '/root/ { print $$5 }'`
100 if [ "$$rootfs" = "squashfs" ]; then
101 if [ -h /etc/group ]; then
102 rm /etc/group
103 cp -p /rom/etc/group /etc/group
104 fi
105 if [ -h /etc/passwd ]; then
106 rm /etc/passwd
107 cp -p /rom/etc/passwd /etc/passwd
108 fi
109 fi
110 fi
111
112 echo ""
113 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
114 echo "adding group $$name to /etc/group"
115 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
116 fi
117 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
118 echo "adding user $$name to /etc/passwd"
119 echo "$${name}:x:$${id}:$${id}:$${name}:$${home}:$${shell}" >> $${IPKG_INSTROOT}/etc/passwd
120 fi
121
122 chown -R $${name}:$${name} $${IPKG_INSTROOT}/etc/prosody
123 endef
124
125 $(eval $(call BuildPackage,prosody))