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-2016 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:=5.1.4
  10. PKG_RELEASE=$(PKG_SOURCE_VERSION)-1
  11. PKG_LICENSE:=GPL-3.0
  12. PKG_SOURCE_PROTO:=git
  13. PKG_SOURCE_URL:=https://github.com/haiwen/seafile.git
  14. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  15. PKG_SOURCE_VERSION:=b9dc96ee845bb0148d9075aec597e6e07652cbdc
  16. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  17. PKG_FIXUP:=autoreconf
  18. PKG_INSTALL:=1
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/nls.mk
  21. $(call include_mk, python-package.mk)
  22. define Package/seafile-server
  23. SECTION:=net
  24. CATEGORY:=Network
  25. TITLE:=Seafile server
  26. MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
  27. URL:=http://seafile.com/
  28. DEPENDS:=+libarchive +libopenssl +glib2 +libsearpc +seafile-ccnet +seafile-seahub +sqlite3-cli +python-mysql +python-urllib3 \
  29. +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 +libmysqlclient \
  30. +libpthread +libuuid +bash +procps-ng +procps-ng-pkill +SEAFILE_FUSE_SUPPORT:libfuse $(ICONV_DEPENDS)
  31. EXTRA_DEPENDS:=seafile-ccnet (=5.1.4-44f74fdc5160c1bf16a92e71d79b856763ddbc15-1), seafile-seahub (=5.1.4-1e1c02aa4f2a0256ffa29a28224aad2d678f43a0-1)
  32. MENU:=1
  33. endef
  34. define Package/seafile-server/config
  35. source "$(SOURCE)/Config.in"
  36. endef
  37. define Package/seafile-server/description
  38. Open source cloud storage with advanced features on privacy protection and teamwork.
  39. endef
  40. CONFIGURE_ARGS += --disable-client \
  41. --enable-server \
  42. --enable-python \
  43. --disable-static-build \
  44. --disable-server-pkg
  45. ifeq ($(CONFIG_SEAFILE_FUSE_SUPPORT),y)
  46. CONFIGURE_ARGS += --enable-fuse
  47. TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/fuse
  48. else
  49. CONFIGURE_ARGS += --disable-fuse
  50. endif
  51. ifeq ($(CONFIG_SEAFILE_CONSOLE_SUPPORT),y)
  52. CONFIGURE_ARGS += --enable-console
  53. else
  54. CONFIGURE_ARGS += --disable-console
  55. endif
  56. ifeq ($(CONFIG_SEAFILE_RIAK_SUPPORT),y)
  57. CONFIGURE_ARGS += --enable-riak
  58. else
  59. CONFIGURE_ARGS += --disable-riak
  60. endif
  61. PKG_BUILD_DEPENDS:=vala/host libevhtp
  62. # This is required as python-package.mk overrides the default setting of having interlinking enabled
  63. ifdef CONFIG_USE_MIPS16
  64. TARGET_CFLAGS += -minterlink-mips16
  65. endif
  66. TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
  67. -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz -levent_openssl -levent
  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_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
  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)/usr/lib/libseafile.so* $(1)/usr/lib/
  104. $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seafile/ $(1)$(PYTHON_PKG_DIR)/
  105. $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/seaserv/ $(1)$(PYTHON_PKG_DIR)/
  106. endef
  107. define Package/seafile-server/postinst
  108. #!/bin/sh
  109. [ ! -f /etc/init.d/seafile ] && exit 0
  110. if [ ! -d /usr/share/seafile/seafile-data ]
  111. then
  112. echo "*** Installation completed, running configuration script..."
  113. /etc/init.d/seafile setup
  114. if [ $$? -ne 0 ]
  115. then
  116. echo
  117. echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
  118. echo "*** \"/etc/init.d/seafile setup\""
  119. fi
  120. else
  121. echo "*** seafile-data directory already exists."
  122. echo
  123. echo "*** In case you are upgrading seafile, please run the appropriate upgrade script"
  124. echo "*** manually before using the new version."
  125. echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\""
  126. echo
  127. echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html"
  128. fi
  129. endef
  130. $(eval $(call BuildPackage,seafile-server))