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.

132 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)
  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 +libevhtp +libpthread +libuuid \
  30. +bash +sudo +procps +procps-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. TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
  50. -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
  51. define Package/seafile-server/install
  52. $(INSTALL_DIR) $(1)/usr/{bin,lib}
  53. $(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
  54. $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/runtime
  55. $(INSTALL_DIR) $(1)/etc/init.d
  56. $(INSTALL_DIR) $(1)/etc/config
  57. $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
  58. $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seafile/ $(1)/usr/lib/python2.7/site-packages/
  59. $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seaserv/ $(1)/usr/lib/python2.7/site-packages/
  60. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
  61. $(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
  62. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
  63. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
  64. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
  65. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
  66. $(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
  67. $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
  68. $(CP) ./files/seafile.conf $(1)/etc/config/seafile
  69. endef
  70. define Build/InstallDev
  71. $(INSTALL_DIR) $(1)/usr/include
  72. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  73. $(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
  74. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
  75. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
  76. endef
  77. define Package/seafile-server/postinst
  78. #!/bin/sh
  79. if ! id -u seafile >/dev/null 2>&1; then
  80. useradd seafile -d "/usr/share/seafile" -s /bin/sh; fi
  81. chown -R seafile:seafile /usr/share/seafile/
  82. chmod -R o-rwx /usr/share/seafile/
  83. if [ ! -d "/usr/share/seafile/seafile-data" ]
  84. then
  85. echo "*** Installation completed, running configuration script..."
  86. /etc/init.d/seafile setup
  87. if [ $$? -ne 0 ]
  88. then
  89. echo
  90. echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
  91. echo "*** \"/etc/init.d/seafile setup\""
  92. fi
  93. echo
  94. echo "*** NOTE: you need to create an admin account before using Seafile."
  95. echo "*** Please run \"/etc/init.d/seafile create_admin\" to do so."
  96. else
  97. echo "*** WARNING: it seems you are upgrading from an older version."
  98. echo "*** If so, please run the appropriate upgrade script before using the new version of Seafile."
  99. echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\""
  100. echo
  101. echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html"
  102. exit
  103. fi
  104. /etc/init.d/seafile enable
  105. /etc/init.d/seafile restart
  106. endef
  107. define Package/seafile-server/prerm
  108. #!/bin/sh
  109. /etc/init.d/seafile stop
  110. endef
  111. $(eval $(call BuildPackage,seafile-server))