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