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.

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