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