First Commit
[librecmc/package-feed.git] / net / seafile-server / Makefile
1 #
2 # Copyright (C) 2007-2016 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:=5.1.4
12 PKG_RELEASE=$(PKG_SOURCE_VERSION)-1
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:=b9dc96ee845bb0148d9075aec597e6e07652cbdc
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 $(call include_mk, python-package.mk)
26
27 define Package/seafile-server
28     SECTION:=net
29     CATEGORY:=Network
30     TITLE:=Seafile server
31     MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
32     URL:=http://seafile.com/
33     DEPENDS:=+libarchive +libopenssl +glib2 +libsearpc +seafile-ccnet +seafile-seahub +sqlite3-cli +python-mysql +python-urllib3 \
34                 +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 +libmysqlclient \
35                 +libpthread +libuuid +bash +procps-ng +procps-ng-pkill +SEAFILE_FUSE_SUPPORT:libfuse $(ICONV_DEPENDS)
36     EXTRA_DEPENDS:=seafile-ccnet (=5.1.4-44f74fdc5160c1bf16a92e71d79b856763ddbc15-1), seafile-seahub (=5.1.4-1e1c02aa4f2a0256ffa29a28224aad2d678f43a0-1)
37     MENU:=1
38 endef
39
40 define Package/seafile-server/config
41         source "$(SOURCE)/Config.in"
42 endef
43
44 define Package/seafile-server/description
45    Open source cloud storage with advanced features on privacy protection and teamwork.
46 endef
47
48 CONFIGURE_ARGS += --disable-client \
49                     --enable-server \
50                     --enable-python \
51                     --disable-static-build \
52                     --disable-server-pkg
53
54 ifeq ($(CONFIG_SEAFILE_FUSE_SUPPORT),y)
55         CONFIGURE_ARGS += --enable-fuse
56         TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/fuse
57 else
58         CONFIGURE_ARGS += --disable-fuse
59 endif
60
61 ifeq ($(CONFIG_SEAFILE_CONSOLE_SUPPORT),y)
62         CONFIGURE_ARGS += --enable-console
63 else
64         CONFIGURE_ARGS += --disable-console
65 endif
66
67 ifeq ($(CONFIG_SEAFILE_RIAK_SUPPORT),y)
68         CONFIGURE_ARGS += --enable-riak
69 else
70         CONFIGURE_ARGS += --disable-riak
71 endif
72
73 PKG_BUILD_DEPENDS:=vala/host libevhtp
74
75 # This is required as python-package.mk overrides the default setting of having interlinking enabled
76 ifdef CONFIG_USE_MIPS16
77         TARGET_CFLAGS += -minterlink-mips16
78 endif
79 TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
80                     -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz -levent_openssl -levent
81
82 define Package/seafile-server/conffiles
83 /etc/config/seafile
84 endef
85
86 define Package/seafile-server/install
87         $(INSTALL_DIR) $(1)/usr/{bin,lib}
88         $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
89         $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server
90         $(INSTALL_DIR) $(1)/usr/share/seafile/conf
91         $(INSTALL_DIR) $(1)/etc/{config,init.d}
92         $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
93         $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/
94         $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/
95         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
96         $(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
97         $(CP) $(PKG_BUILD_DIR)/scripts/seaf-fsck.sh $(1)/usr/share/seafile/seafile-server/
98 ifeq ($(CONFIG_SEAFILE_FUSE_SUPPORT),y)
99         $(CP) $(PKG_BUILD_DIR)/scripts/seaf-fuse.sh $(1)/usr/share/seafile/seafile-server/
100 endif
101         $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
102         $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
103         $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
104         $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
105         $(CP) $(PKG_BUILD_DIR)/scripts/check_init_admin.py $(1)/usr/share/seafile/seafile-server/
106         $(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
107         $(CP) ./files/seafile.conf $(1)/etc/config/seafile
108         $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
109         $(INSTALL_BIN) ./files/seahub.init $(1)/etc/init.d/seahub
110         find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f
111 endef
112
113 define Build/InstallDev
114         $(INSTALL_DIR) $(1)/usr/include
115         $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
116         $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
117         $(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
118         $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
119         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
120         $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/
121         $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/
122 endef
123
124 define Package/seafile-server/postinst
125 #!/bin/sh
126 [ ! -f /etc/init.d/seafile ] && exit 0
127
128 if [ ! -d /usr/share/seafile/seafile-data ]
129 then
130    echo "*** Installation completed, running configuration script..."
131    /etc/init.d/seafile setup
132
133    if [ $$? -ne 0 ]
134    then
135       echo
136       echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
137       echo "*** \"/etc/init.d/seafile setup\""
138    fi
139 else
140    echo "*** seafile-data directory already exists."
141    echo
142    echo "*** In case you are upgrading seafile, please run the appropriate upgrade script"
143    echo "*** manually before using the new version."
144    echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\""
145    echo
146    echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html"
147 fi
148 endef
149
150 $(eval $(call BuildPackage,seafile-server))