You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
5.4 KiB

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