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.

150 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:=6
  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 +python-mysql +python-urllib3 \
  36. +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 +libmysqlclient +oniguruma \
  37. +libpthread +libuuid +bash +procps-ng +procps-ng-pkill +SEAFILE_FUSE_SUPPORT:libfuse $(ICONV_DEPENDS)
  38. MENU:=1
  39. endef
  40. define Package/seafile-server/config
  41. source "$(SOURCE)/Config.in"
  42. endef
  43. define Package/seafile-server/description
  44. Open source cloud storage with advanced features on privacy protection and teamwork.
  45. endef
  46. CONFIGURE_ARGS += --enable-python
  47. ifeq ($(CONFIG_SEAFILE_FUSE_SUPPORT),y)
  48. CONFIGURE_ARGS += --enable-fuse
  49. TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/fuse
  50. else
  51. CONFIGURE_ARGS += --disable-fuse
  52. endif
  53. ifeq ($(CONFIG_SEAFILE_CONSOLE_SUPPORT),y)
  54. CONFIGURE_ARGS += --enable-console
  55. else
  56. CONFIGURE_ARGS += --disable-console
  57. endif
  58. PKG_BUILD_DEPENDS:=vala/host libevhtp
  59. # This is required as python-package.mk overrides the default setting of having interlinking enabled
  60. ifdef CONFIG_USE_MIPS16
  61. TARGET_CFLAGS += -minterlink-mips16
  62. endif
  63. TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
  64. -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz -levent_openssl -levent
  65. ifdef CONFIG_GCC_LIBSSP
  66. TARGET_LDFLAGS += -lssp
  67. endif
  68. define Package/seafile-server/conffiles
  69. /etc/config/seafile
  70. endef
  71. define Package/seafile-server/install
  72. $(INSTALL_DIR) $(1)/usr/{bin,lib}
  73. $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
  74. $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server
  75. $(INSTALL_DIR) $(1)/usr/share/seafile/conf
  76. $(INSTALL_DIR) $(1)/etc/{config,init.d}
  77. $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
  78. $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/
  79. $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/
  80. $(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
  81. $(CP) $(PKG_BUILD_DIR)/scripts/seaf-fsck.sh $(1)/usr/share/seafile/seafile-server/
  82. ifeq ($(CONFIG_SEAFILE_FUSE_SUPPORT),y)
  83. $(CP) $(PKG_BUILD_DIR)/scripts/seaf-fuse.sh $(1)/usr/share/seafile/seafile-server/
  84. endif
  85. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
  86. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
  87. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
  88. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
  89. $(CP) $(PKG_BUILD_DIR)/scripts/check_init_admin.py $(1)/usr/share/seafile/seafile-server/
  90. $(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
  91. $(CP) ./files/seafile.conf $(1)/etc/config/seafile
  92. $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
  93. $(INSTALL_BIN) ./files/seahub.init $(1)/etc/init.d/seahub
  94. find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f
  95. endef
  96. define Build/InstallDev
  97. $(INSTALL_DIR) $(1)/usr/include
  98. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  99. $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
  100. $(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
  101. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
  102. $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/
  103. $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/
  104. endef
  105. define Package/seafile-server/postinst
  106. #!/bin/sh
  107. [ ! -f /etc/init.d/seafile ] && exit 0
  108. if [ ! -d /usr/share/seafile/seafile-data ]
  109. then
  110. echo "*** Installation completed, running configuration script..."
  111. /etc/init.d/seafile setup
  112. if [ $$? -ne 0 ]
  113. then
  114. echo
  115. echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
  116. echo "*** \"/etc/init.d/seafile setup\""
  117. fi
  118. else
  119. echo "*** seafile-data directory already exists."
  120. echo
  121. echo "*** In case you are upgrading seafile, please run the appropriate upgrade script"
  122. echo "*** manually before using the new version."
  123. echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\""
  124. echo
  125. echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html"
  126. fi
  127. endef
  128. $(eval $(call BuildPackage,seafile-server))