Nav apraksta

Makefile 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. # NOTE: make sure to update EXTRA_DEPENDS in case of version/release changes!
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=seafile-server
  10. PKG_VERSION:=4.1.2
  11. PKG_RELEASE=$(PKG_SOURCE_VERSION)-5
  12. PKG_LICENSE:=GPL-3.0
  13. PKG_SOURCE_PROTO:=git
  14. PKG_SOURCE_URL:=https://github.com/haiwen/seafile.git
  15. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  16. PKG_SOURCE_VERSION:=c0166019c712e2e1d5e532fd5f7401b1b72db6d8
  17. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  18. PKG_FIXUP:=autoreconf
  19. PKG_INSTALL:=1
  20. include $(INCLUDE_DIR)/package.mk
  21. include $(INCLUDE_DIR)/nls.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 \
  29. +sqlite3-cli +python-mysql +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 \
  30. +libmysqlclient +libpthread +libuuid \
  31. +bash +sudo +procps-ng +procps-ng-pkill $(ICONV_DEPENDS)
  32. EXTRA_DEPENDS:=seafile-ccnet (=4.1.2-a73109f09af4ecc49cdc4c57cdde51b38e15c31a-2), seafile-seahub (=4.1.2-3fb1288f920de03a4e2e6a06b60671ce98971742)
  33. endef
  34. define Package/seafile-server/description
  35. Open source cloud storage with advanced features on privacy protection and teamwork.
  36. endef
  37. define Package/seafile-server/conffiles
  38. /etc/config/seafile
  39. endef
  40. CONFIGURE_ARGS += --disable-riak \
  41. --disable-client \
  42. --disable-fuse \
  43. --enable-server \
  44. --enable-python \
  45. --disable-static-build \
  46. --disable-server-pkg \
  47. --disable-console
  48. PKG_BUILD_DEPENDS:=vala/host \
  49. libsearpc/host \
  50. libevhtp-1.1
  51. TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
  52. -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
  53. define Package/seafile-server/install
  54. $(INSTALL_DIR) $(1)/usr/{bin,lib}
  55. $(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
  56. $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/runtime
  57. $(INSTALL_DIR) $(1)/etc/init.d
  58. $(INSTALL_DIR) $(1)/etc/config
  59. $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
  60. $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seafile/ $(1)/usr/lib/python2.7/site-packages/
  61. $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seaserv/ $(1)/usr/lib/python2.7/site-packages/
  62. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
  63. $(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
  64. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
  65. $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
  66. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
  67. $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
  68. $(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
  69. $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
  70. $(CP) ./files/seafile.conf $(1)/etc/config/seafile
  71. endef
  72. define Build/InstallDev
  73. $(INSTALL_DIR) $(1)/usr/include
  74. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  75. $(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
  76. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
  77. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
  78. endef
  79. define Package/seafile-server/postinst
  80. #!/bin/sh
  81. if ! group_exists seafile; then
  82. group_add_next seafile; fi
  83. SEAFILE_GID=$$(grep -s '^seafile:' "$${IPKG_INSTROOT}/etc/group" | cut -d: -f3)
  84. if ! user_exists seafile; then
  85. user_add seafile "" "$${SEAFILE_GID}" seafile /usr/share/seafile /bin/sh; fi
  86. if [ -z "$${IPKG_INSTROOT}" ]
  87. then
  88. chown -R seafile:seafile /usr/share/seafile/
  89. chmod -R o-rwx /usr/share/seafile/
  90. if [ ! -d /usr/share/seafile/seafile-data ]
  91. then
  92. echo "*** Installation completed, running configuration script..."
  93. /etc/init.d/seafile setup
  94. if [ $$? -ne 0 ]
  95. then
  96. echo
  97. echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
  98. echo "*** \"/etc/init.d/seafile setup\""
  99. fi
  100. echo
  101. echo "*** NOTE: you need to create an admin account before using Seafile."
  102. echo "*** Please run \"/etc/init.d/seafile create_admin\" to do so."
  103. else
  104. echo "*** It seems you are upgrading from an older version."
  105. echo "*** If so, please run the appropriate upgrade scripts before using the new version of Seafile."
  106. echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\""
  107. echo
  108. echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html"
  109. fi
  110. else
  111. cat > "$${IPKG_INSTROOT}/etc/uci-defaults/99_seafile-server" << EOF
  112. #!/bin/sh
  113. chown -R seafile:seafile /usr/share/seafile/
  114. chmod -R o-rwx /usr/share/seafile/
  115. exit 0
  116. EOF
  117. fi
  118. endef
  119. $(eval $(call BuildPackage,seafile-server))