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.

116 lines
3.9 KiB

  1. #
  2. # Copyright (C) 2007-2014 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:=3.1.7
  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:=69658fca88f258276be92447b1b4462b64a1c6b9
  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 +seafile-ccnet +libsearpc +sqlite3-cli +python-mysql \
  28. +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 +libmysqlclient +libevhtp \
  29. +libpthread +libuuid +seafile-seahub +bash +sudo +procps +procps-pkill $(ICONV_DEPENDS)
  30. endef
  31. define Package/seafile-server/description
  32. Open source cloud storage with advanced features on privacy protection and teamwork.
  33. endef
  34. CONFIGURE_ARGS += --disable-riak \
  35. --disable-client \
  36. --disable-fuse \
  37. --enable-server \
  38. --enable-python \
  39. --disable-static-build \
  40. --disable-server-pkg \
  41. --disable-console
  42. PKG_BUILD_DEPENDS:=vala/host \
  43. libsearpc/host
  44. TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
  45. -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
  46. define Package/seafile-server/install
  47. $(INSTALL_DIR) $(1)/usr/{bin,lib}
  48. $(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
  49. $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/runtime
  50. $(INSTALL_DIR) $(1)/etc/init.d
  51. $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
  52. $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seafile/ $(1)/usr/lib/python2.7/site-packages/
  53. $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seaserv/ $(1)/usr/lib/python2.7/site-packages/
  54. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
  55. $(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
  56. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
  57. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
  58. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
  59. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
  60. $(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
  61. $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
  62. endef
  63. define Build/InstallDev
  64. $(INSTALL_DIR) $(1)/usr/include
  65. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  66. $(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
  67. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
  68. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
  69. endef
  70. define Package/seafile-server/postinst
  71. #!/bin/sh
  72. if ! id -u seafile >/dev/null 2>&1; then
  73. useradd seafile -d "/usr/share/seafile" -s /bin/sh; fi
  74. chown -R seafile:seafile /usr/share/seafile/
  75. chmod -R o-rwx /usr/share/seafile/
  76. if [ ! -d "/usr/share/seafile/seafile-data" ]
  77. then
  78. echo "*** Installation completed, running configuration script..."
  79. /etc/init.d/seafile setup
  80. if [ $$? -ne 0 ]
  81. then
  82. echo
  83. echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
  84. echo "*** \"/etc/init.d/seafile setup\""
  85. fi
  86. echo
  87. echo "*** NOTE: you need to create an admin account before using Seafile."
  88. echo "*** Please run \"/etc/init.d/seafile create_admin\" to do so."
  89. fi
  90. /etc/init.d/seafile enable
  91. /etc/init.d/seafile restart
  92. endef
  93. define Package/seafile-server/prerm
  94. #!/bin/sh
  95. /etc/init.d/seafile stop
  96. endef
  97. $(eval $(call BuildPackage,seafile-server))