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.

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