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.

146 lines
5.3 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:=2
  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_FIXUP:=autoreconf
  17. PKG_INSTALL:=1
  18. include $(INCLUDE_DIR)/package.mk
  19. include $(INCLUDE_DIR)/nls.mk
  20. include ../../lang/python/python-package.mk
  21. # Check that the actual Makefile version-relase match the above.
  22. $(eval $(shell awk '/^PKG_VERSION.*=/ { print "SEAHUB_" $$$$0 }' ../seafile-seahub/Makefile))
  23. ifneq ($(PKG_VERSION),$(SEAHUB_PKG_VERSION))
  24. $(error $(if $(SEAHUB_PKG_VERSION), \
  25. Version mismatch between seafile-seahub ($(SEAHUB_PKG_VERSION)) and \
  26. seafile-server ($(PKG_VERSION)), \
  27. Could not get PKG_VERSION from seafile-seahub Makefile))
  28. endif
  29. define Package/seafile-server
  30. SECTION:=net
  31. CATEGORY:=Network
  32. TITLE:=Seafile server
  33. MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
  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 \
  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. define Package/seafile-server/conffiles
  66. /etc/config/seafile
  67. endef
  68. define Package/seafile-server/install
  69. $(INSTALL_DIR) $(1)/usr/{bin,lib}
  70. $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
  71. $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server
  72. $(INSTALL_DIR) $(1)/usr/share/seafile/conf
  73. $(INSTALL_DIR) $(1)/etc/{config,init.d}
  74. $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
  75. $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/
  76. $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/
  77. $(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
  78. $(CP) $(PKG_BUILD_DIR)/scripts/seaf-fsck.sh $(1)/usr/share/seafile/seafile-server/
  79. ifeq ($(CONFIG_SEAFILE_FUSE_SUPPORT),y)
  80. $(CP) $(PKG_BUILD_DIR)/scripts/seaf-fuse.sh $(1)/usr/share/seafile/seafile-server/
  81. endif
  82. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
  83. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
  84. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
  85. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
  86. $(CP) $(PKG_BUILD_DIR)/scripts/check_init_admin.py $(1)/usr/share/seafile/seafile-server/
  87. $(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
  88. $(CP) ./files/seafile.conf $(1)/etc/config/seafile
  89. $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
  90. $(INSTALL_BIN) ./files/seahub.init $(1)/etc/init.d/seahub
  91. find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f
  92. endef
  93. define Build/InstallDev
  94. $(INSTALL_DIR) $(1)/usr/include
  95. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  96. $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
  97. $(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
  98. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
  99. $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/
  100. $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/
  101. endef
  102. define Package/seafile-server/postinst
  103. #!/bin/sh
  104. [ ! -f /etc/init.d/seafile ] && exit 0
  105. if [ ! -d /usr/share/seafile/seafile-data ]
  106. then
  107. echo "*** Installation completed, running configuration script..."
  108. /etc/init.d/seafile setup
  109. if [ $$? -ne 0 ]
  110. then
  111. echo
  112. echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
  113. echo "*** \"/etc/init.d/seafile setup\""
  114. fi
  115. else
  116. echo "*** seafile-data directory already exists."
  117. echo
  118. echo "*** In case you are upgrading seafile, please run the appropriate upgrade script"
  119. echo "*** manually before using the new version."
  120. echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\""
  121. echo
  122. echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html"
  123. fi
  124. endef
  125. $(eval $(call BuildPackage,seafile-server))