949345d8abbcf4a5bc6f4ec4c011af3c96345e9f
[feed/packages.git] / net / seafile-server / Makefile
1 #
2 # Copyright (C) 2007-2015 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 # NOTE: make sure to update EXTRA_DEPENDS in case of version/release changes!
9
10 include $(TOPDIR)/rules.mk
11
12 PKG_NAME:=seafile-server
13 PKG_VERSION:=4.1.2
14 PKG_RELEASE=$(PKG_SOURCE_VERSION)-5
15 PKG_LICENSE:=GPL-3.0
16
17 PKG_SOURCE_PROTO:=git
18 PKG_SOURCE_URL:=https://github.com/haiwen/seafile.git
19 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
20 PKG_SOURCE_VERSION:=c0166019c712e2e1d5e532fd5f7401b1b72db6d8
21 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
22 PKG_FIXUP:=autoreconf
23 PKG_INSTALL:=1
24
25 include $(INCLUDE_DIR)/package.mk
26 include $(INCLUDE_DIR)/nls.mk
27
28 define Package/seafile-server
29 SECTION:=net
30 CATEGORY:=Network
31 TITLE:=Seafile server
32 MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
33 URL:=http://seafile.com/
34 DEPENDS:=+libarchive +libopenssl +glib2 +libsearpc +seafile-ccnet +seafile-seahub \
35 +sqlite3-cli +python-mysql +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 \
36 +libmysqlclient +libpthread +libuuid \
37 +bash +sudo +procps-ng +procps-ng-pkill $(ICONV_DEPENDS)
38 EXTRA_DEPENDS:=seafile-ccnet (=4.1.2-a73109f09af4ecc49cdc4c57cdde51b38e15c31a-2), seafile-seahub (=4.1.2-3fb1288f920de03a4e2e6a06b60671ce98971742)
39 endef
40
41 define Package/seafile-server/description
42 Open source cloud storage with advanced features on privacy protection and teamwork.
43 endef
44
45 define Package/seafile-server/conffiles
46 /etc/config/seafile
47 endef
48
49 CONFIGURE_ARGS += --disable-riak \
50 --disable-client \
51 --disable-fuse \
52 --enable-server \
53 --enable-python \
54 --disable-static-build \
55 --disable-server-pkg \
56 --disable-console
57
58 PKG_BUILD_DEPENDS:=vala/host \
59 libsearpc/host \
60 libevhtp-1.1
61
62 TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
63 -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
64
65 define Package/seafile-server/install
66 $(INSTALL_DIR) $(1)/usr/{bin,lib}
67 $(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
68 $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/runtime
69 $(INSTALL_DIR) $(1)/etc/init.d
70 $(INSTALL_DIR) $(1)/etc/config
71 $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
72 $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seafile/ $(1)/usr/lib/python2.7/site-packages/
73 $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seaserv/ $(1)/usr/lib/python2.7/site-packages/
74 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
75 $(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
76 $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
77 $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
78 $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
79 $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
80 $(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
81 $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
82 $(CP) ./files/seafile.conf $(1)/etc/config/seafile
83 endef
84
85 define Build/InstallDev
86 $(INSTALL_DIR) $(1)/usr/include
87 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
88 $(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
89 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
90 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
91 endef
92
93 define Package/seafile-server/postinst
94 #!/bin/sh
95
96 if ! group_exists seafile; then
97 group_add_next seafile; fi
98
99 SEAFILE_GID=$$(grep -s '^seafile:' "$${IPKG_INSTROOT}/etc/group" | cut -d: -f3)
100
101 if ! user_exists seafile; then
102 user_add seafile "" "$${SEAFILE_GID}" seafile /usr/share/seafile /bin/sh; fi
103
104 if [ -z "$${IPKG_INSTROOT}" ]
105 then
106 chown -R seafile:seafile /usr/share/seafile/
107 chmod -R o-rwx /usr/share/seafile/
108
109 if [ ! -d /usr/share/seafile/seafile-data ]
110 then
111 echo "*** Installation completed, running configuration script..."
112 /etc/init.d/seafile setup
113
114 if [ $$? -ne 0 ]
115 then
116 echo
117 echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
118 echo "*** \"/etc/init.d/seafile setup\""
119 fi
120
121 echo
122 echo "*** NOTE: you need to create an admin account before using Seafile."
123 echo "*** Please run \"/etc/init.d/seafile create_admin\" to do so."
124 else
125 echo "*** It seems you are upgrading from an older version."
126 echo "*** If so, please run the appropriate upgrade scripts before using the new version of Seafile."
127 echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\""
128 echo
129 echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html"
130 fi
131 else
132 cat > "$${IPKG_INSTROOT}/etc/uci-defaults/99_seafile-server" << EOF
133 #!/bin/sh
134
135 chown -R seafile:seafile /usr/share/seafile/
136 chmod -R o-rwx /usr/share/seafile/
137 exit 0
138 EOF
139 fi
140 endef
141
142 $(eval $(call BuildPackage,seafile-server))