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.

126 lines
4.5 KiB

  1. #
  2. # Copyright (C) 2007-2015 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:=4.0.6
  10. PKG_RELEASE=$(PKG_SOURCE_VERSION)
  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:=adf9a875a960c1471bf6c93fce397c576e985bb3
  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. define Package/seafile-server
  22. SECTION:=net
  23. CATEGORY:=Network
  24. TITLE:=Seafile server
  25. MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
  26. URL:=http://seafile.com/
  27. DEPENDS:=+shadow-useradd +libarchive +libopenssl +glib2 +libsearpc +seafile-ccnet +seafile-seahub \
  28. +sqlite3-cli +python-mysql +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 \
  29. +libmysqlclient +libevhtp +libpthread +libuuid \
  30. +bash +sudo +procps +procps-pkill $(ICONV_DEPENDS)
  31. EXTRA_DEPENDS:=seafile-ccnet (=4.0.6-1e1aeae83cc33356ebd5f064f4a4c148186b814d), seafile-seahub (=4.0.6-739b32b02c4803448d5cb75b3e22ec0073930aed)
  32. endef
  33. define Package/seafile-server/description
  34. Open source cloud storage with advanced features on privacy protection and teamwork.
  35. endef
  36. CONFIGURE_ARGS += --disable-riak \
  37. --disable-client \
  38. --disable-fuse \
  39. --enable-server \
  40. --enable-python \
  41. --disable-static-build \
  42. --disable-server-pkg \
  43. --disable-console
  44. PKG_BUILD_DEPENDS:=vala/host \
  45. libsearpc/host
  46. TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
  47. -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
  48. define Package/seafile-server/install
  49. $(INSTALL_DIR) $(1)/usr/{bin,lib}
  50. $(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
  51. $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/runtime
  52. $(INSTALL_DIR) $(1)/etc/init.d
  53. $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
  54. $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seafile/ $(1)/usr/lib/python2.7/site-packages/
  55. $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seaserv/ $(1)/usr/lib/python2.7/site-packages/
  56. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
  57. $(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
  58. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
  59. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
  60. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
  61. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
  62. $(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
  63. $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
  64. endef
  65. define Build/InstallDev
  66. $(INSTALL_DIR) $(1)/usr/include
  67. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  68. $(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
  69. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
  70. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
  71. endef
  72. define Package/seafile-server/postinst
  73. #!/bin/sh
  74. if ! id -u seafile >/dev/null 2>&1; then
  75. useradd seafile -d "/usr/share/seafile" -s /bin/sh; fi
  76. chown -R seafile:seafile /usr/share/seafile/
  77. chmod -R o-rwx /usr/share/seafile/
  78. if [ ! -d "/usr/share/seafile/seafile-data" ]
  79. then
  80. echo "*** Installation completed, running configuration script..."
  81. /etc/init.d/seafile setup
  82. if [ $$? -ne 0 ]
  83. then
  84. echo
  85. echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
  86. echo "*** \"/etc/init.d/seafile setup\""
  87. fi
  88. echo
  89. echo "*** NOTE: you need to create an admin account before using Seafile."
  90. echo "*** Please run \"/etc/init.d/seafile create_admin\" to do so."
  91. else
  92. echo "*** WARNING: it seems you are upgrading from an older version."
  93. echo "*** If so, please run the appropriate upgrade script before using the new version of Seafile."
  94. echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\""
  95. echo
  96. echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html"
  97. exit
  98. fi
  99. /etc/init.d/seafile enable
  100. /etc/init.d/seafile restart
  101. endef
  102. define Package/seafile-server/prerm
  103. #!/bin/sh
  104. /etc/init.d/seafile stop
  105. endef
  106. $(eval $(call BuildPackage,seafile-server))