2 # Copyright (C) 2009-2010 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://prosody.im/downloads/source
16 PKG_MD5SUM:=5da59bc906419ad3b4faa21516a6ca18
20 include $(INCLUDE_DIR)/package.mk
22 define Package/prosody
25 SUBMENU:=Instant Messaging
26 DEPENDS:=+luafilesystem +libidn +luaexpat +luasec
28 URL:=http://prosody.im/
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
37 define Package/prosody/conffiles
38 /etc/prosody/prosody.cfg.lua
41 TARGET_CFLAGS += $(FPIC)
43 define Build/Configure
44 # this is *NOT* GNU autoconf stuff
45 (cd $(PKG_BUILD_DIR); ./configure \
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" \
56 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -std=gnu99" \
57 LDFLAGS="$(TARGET_LDFLAGS)" \
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/
87 define Package/prosody/postinst
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
103 cp -p /rom/etc/group /etc/group
105 if [ -h /etc/passwd ]; then
107 cp -p /rom/etc/passwd /etc/passwd
112 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
113 echo "adding group $$name to /etc/group"
114 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
116 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
117 echo "adding user $$name to /etc/passwd"
118 echo "$${name}:x:$${id}:$${id}:$${name}:$${home}:$${shell}" >> $${IPKG_INSTROOT}/etc/passwd
121 chown -R $${name}:$${name} $${IPKG_INSTROOT}/etc/prosody
125 $(eval $(call BuildPackage,prosody))