seafile: fetch sources using commit hashes instead of release tags
[feed/packages.git] / net / seafile-server / Makefile
1 #
2 # Copyright (C) 2007-2014 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:=seafile-server
11 PKG_VERSION:=3.1.7
12 PKG_RELEASE=$(PKG_SOURCE_VERSION)
13 PKG_LICENSE:=GPL-3.0
14
15 PKG_SOURCE_PROTO:=git
16 PKG_SOURCE_URL:=https://github.com/haiwen/seafile.git
17 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
18 PKG_SOURCE_VERSION:=69658fca88f258276be92447b1b4462b64a1c6b9
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
20 PKG_FIXUP:=autoreconf
21 PKG_INSTALL:=1
22
23 include $(INCLUDE_DIR)/package.mk
24 include $(INCLUDE_DIR)/nls.mk
25
26 define Package/seafile-server
27 SECTION:=net
28 CATEGORY:=Network
29 TITLE:=Seafile server
30 MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
31 URL:=http://seafile.com/
32 DEPENDS:=+shadow-useradd +libarchive +libopenssl +glib2 +seafile-ccnet +libsearpc +sqlite3-cli +python-mysql \
33 +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 +libmysqlclient +libevhtp \
34 +libpthread +libuuid +seafile-seahub +bash +sudo +procps +procps-pkill $(ICONV_DEPENDS)
35 endef
36
37 define Package/seafile-server/description
38 Open source cloud storage with advanced features on privacy protection and teamwork.
39 endef
40
41 CONFIGURE_ARGS += --disable-riak \
42 --disable-client \
43 --disable-fuse \
44 --enable-server \
45 --enable-python \
46 --disable-static-build \
47 --disable-server-pkg \
48 --disable-console
49
50 PKG_BUILD_DEPENDS:=vala/host \
51 libsearpc/host
52
53 TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
54 -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
55
56 define Package/seafile-server/install
57 $(INSTALL_DIR) $(1)/usr/{bin,lib}
58 $(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
59 $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/runtime
60 $(INSTALL_DIR) $(1)/etc/init.d
61 $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
62 $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seafile/ $(1)/usr/lib/python2.7/site-packages/
63 $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seaserv/ $(1)/usr/lib/python2.7/site-packages/
64 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
65 $(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
66 $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
67 $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
68 $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
69 $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
70 $(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
71 $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
72 endef
73
74 define Build/InstallDev
75 $(INSTALL_DIR) $(1)/usr/include
76 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
77 $(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
78 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
79 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
80 endef
81
82 define Package/seafile-server/postinst
83 #!/bin/sh
84
85 if ! id -u seafile >/dev/null 2>&1; then
86 useradd seafile -d "/usr/share/seafile" -s /bin/sh; fi
87
88 chown -R seafile:seafile /usr/share/seafile/
89 chmod -R o-rwx /usr/share/seafile/
90
91 if [ ! -d "/usr/share/seafile/seafile-data" ]
92 then
93 echo "*** Installation completed, running configuration script..."
94 /etc/init.d/seafile setup
95
96 if [ $$? -ne 0 ]
97 then
98 echo
99 echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
100 echo "*** \"/etc/init.d/seafile setup\""
101 fi
102 echo
103 echo "*** NOTE: you need to create an admin account before using Seafile."
104 echo "*** Please run \"/etc/init.d/seafile create_admin\" to do so."
105 fi
106
107 /etc/init.d/seafile enable
108 /etc/init.d/seafile restart
109 endef
110
111 define Package/seafile-server/prerm
112 #!/bin/sh
113 /etc/init.d/seafile stop
114 endef
115
116 $(eval $(call BuildPackage,seafile-server))