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.

242 lines
6.5 KiB

  1. # This is free software, licensed under the GNU General Public License v2.
  2. # See /LICENSE for more information.
  3. #
  4. include $(TOPDIR)/rules.mk
  5. PKG_NAME:=postgresql
  6. PKG_VERSION:=11.3
  7. PKG_RELEASE:=1
  8. PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
  9. PKG_LICENSE:=PostgreSQL
  10. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  11. PKG_SOURCE_URL:=\
  12. https://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
  13. http://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
  14. ftp://ftp.postgresql.org/pub/source/v$(PKG_VERSION)
  15. PKG_HASH:=2a85e082fc225944821dfd23990e32dfcd2284c19060864b0ad4ca537d30522d
  16. PKG_USE_MIPS16:=0
  17. PKG_FIXUP:=autoreconf
  18. PKG_MACRO_PATHS:=config
  19. PKG_BUILD_DEPENDS:=postgresql/host
  20. PKG_INSTALL:=1
  21. include $(INCLUDE_DIR)/host-build.mk
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/libpq
  24. SECTION:=libs
  25. CATEGORY:=Libraries
  26. DEPENDS:=+libpthread
  27. TITLE:=PostgreSQL client library
  28. URL:=http://www.postgresql.org/
  29. SUBMENU:=Database
  30. endef
  31. define Package/libpq/description
  32. PostgreSQL client library.
  33. endef
  34. define Package/pgsql-cli
  35. SECTION:=utils
  36. CATEGORY:=Utilities
  37. DEPENDS:=+libncursesw +libpq +libreadline +librt +zlib
  38. TITLE:=Command Line Interface (CLI) to PostgreSQL databases
  39. URL:=http://www.postgresql.org/
  40. SUBMENU:=Database
  41. endef
  42. define Package/pgsql-cli/description
  43. Command Line Interface (CLI) to PostgreSQL databases.
  44. endef
  45. define Package/pgsql-cli-extra
  46. SECTION:=utils
  47. CATEGORY:=Utilities
  48. DEPENDS:=+libncursesw +libpq +libreadline +librt +zlib
  49. TITLE:=Command Line extras for PostgreSQL databases
  50. URL:=http://www.postgresql.org/
  51. SUBMENU:=Database
  52. endef
  53. define Package/pgsql-cli-extra/description
  54. Command Line extras for PostgreSQL databases.
  55. endef
  56. define Package/pgsql-server
  57. SECTION:=utils
  58. CATEGORY:=Utilities
  59. DEPENDS:=+pgsql-cli
  60. TITLE:=PostgreSQL databases Server
  61. URL:=http://www.postgresql.org/
  62. SUBMENU:=Database
  63. USERID:=postgres=5432:postgres=5432
  64. endef
  65. define Package/pgsql-server/description
  66. PostgreSQL databases Server.
  67. endef
  68. PGSQL_SERVER_BIN := \
  69. pg_archivecleanup \
  70. pg_basebackup \
  71. pg_controldata \
  72. pg_ctl \
  73. pg_dump \
  74. pg_dumpall \
  75. pg_isready \
  76. pg_recvlogical \
  77. pg_resetwal \
  78. pg_restore \
  79. pg_standby \
  80. pg_upgrade \
  81. postgres \
  82. initdb
  83. PGSQL_CLI_EXTRA_BIN := \
  84. clusterdb \
  85. createdb \
  86. createuser \
  87. dropdb \
  88. dropuser \
  89. pgbench \
  90. reindexdb \
  91. vacuumdb
  92. PGSQL_CONFIG_VARS:= \
  93. pgac_cv_snprintf_long_long_int_format="%lld" \
  94. pgac_cv_snprintf_size_t_support=yes \
  95. USE_DEV_URANDOM=1 \
  96. ZIC=zic
  97. ifeq ($(CONFIG_USE_UCLIBC),y)
  98. # PostgreSQL does not build against uClibc with locales
  99. # enabled, due to an uClibc bug, see
  100. # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
  101. # so overwrite automatic detection and disable locale support
  102. PGSQL_CONFIG_VARS+= \
  103. pgac_cv_type_locale_t=no
  104. endif
  105. TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
  106. HOST_CONFIGURE_ARGS += \
  107. --disable-nls \
  108. --disable-rpath \
  109. --without-bonjour \
  110. --without-gssapi \
  111. --without-ldap \
  112. --without-openssl \
  113. --without-pam \
  114. --without-perl \
  115. --without-python \
  116. --without-readline \
  117. --without-tcl \
  118. --without-systemd \
  119. --with-zlib="yes" \
  120. --enable-depend
  121. CONFIGURE_ARGS += \
  122. $(DISABLE_NLS) \
  123. --disable-rpath \
  124. --without-bonjour \
  125. --without-gssapi \
  126. --without-ldap \
  127. --without-openssl \
  128. --without-pam \
  129. --without-perl \
  130. --without-python \
  131. --without-tcl \
  132. --without-systemd \
  133. --with-zlib="yes" \
  134. --enable-depend \
  135. $(if $(CONFIG_arc),--disable-spinlocks)
  136. # Need a native zic and pg_config for build
  137. define Host/Compile
  138. +$(HOST_MAKE_VARS) MAKELEVEL=0 $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
  139. +$(HOST_MAKE_VARS) MAKELEVEL=0 $(MAKE) -C $(HOST_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
  140. endef
  141. define Host/Install
  142. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/
  143. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/common/libpgcommon.a $(STAGING_DIR_HOSTPKG)/lib/
  144. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/port/libpgport.a $(STAGING_DIR_HOSTPKG)/lib/
  145. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/bin/pg_config/pg_config $(STAGING_DIR_HOSTPKG)/lib/
  146. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
  147. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR_HOSTPKG)/bin/
  148. endef
  149. define Build/Compile
  150. $(MAKE) -C $(PKG_BUILD_DIR) MAKELEVEL=0 all contrib
  151. endef
  152. # because PROFILE means something else in the project Makefile
  153. unexport PROFILE
  154. define Package/libpq/install
  155. $(INSTALL_DIR) $(1)/usr/lib
  156. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
  157. endef
  158. define Package/pgsql-cli/install
  159. $(INSTALL_DIR) $(1)/usr/bin
  160. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
  161. endef
  162. define Package/pgsql-cli-extra/install
  163. $(INSTALL_DIR) $(1)/usr/bin
  164. $(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
  165. endef
  166. define Package/pgsql-server/install
  167. $(INSTALL_DIR) $(1)/usr/bin
  168. $(INSTALL_BIN) $(foreach bin,$(PGSQL_SERVER_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
  169. ln -sf postgres $(1)/usr/bin/postmaster
  170. $(INSTALL_DIR) $(1)/usr/share/postgresql
  171. $(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
  172. $(1)/usr/share/postgresql
  173. $(INSTALL_DIR) $(1)/usr/lib
  174. $(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
  175. $(1)/usr/lib/
  176. $(INSTALL_DIR) $(1)/lib/functions
  177. $(INSTALL_BIN) ./files/postgresql.sh $(1)/lib/functions/
  178. $(INSTALL_DIR) $(1)/etc/config
  179. $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
  180. $(INSTALL_DIR) $(1)/etc/init.d
  181. $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
  182. endef
  183. define Build/InstallDev
  184. $(INSTALL_DIR) $(1)/usr/bin
  185. $(CP) $(STAGING_DIR_HOSTPKG)/lib/pg_config $(1)/usr/bin
  186. $(INSTALL_DIR) $(1)/host/bin/
  187. $(LN) $(STAGING_DIR)/usr/bin/pg_config $(1)/host/bin
  188. $(INSTALL_DIR) $(1)/usr/include
  189. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
  190. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
  191. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
  192. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
  193. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
  194. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
  195. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
  196. $(INSTALL_DIR) $(1)/usr/lib
  197. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
  198. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  199. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpq.pc $(1)/usr/lib/pkgconfig/
  200. endef
  201. $(eval $(call HostBuild))
  202. $(eval $(call BuildPackage,libpq))
  203. $(eval $(call BuildPackage,pgsql-cli))
  204. $(eval $(call BuildPackage,pgsql-cli-extra))
  205. $(eval $(call BuildPackage,pgsql-server))