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.

257 lines
6.8 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:=14.1
  7. PKG_RELEASE:=$(AUTORELEASE)
  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:=4d3c101ea7ae38982f06bdc73758b53727fb6402ecd9382006fa5ecc7c2ca41f
  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 +blockd
  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_amcheck \
  71. pg_archivecleanup \
  72. pg_basebackup \
  73. pg_checksums \
  74. pg_controldata \
  75. pg_ctl \
  76. pg_dump \
  77. pg_dumpall \
  78. pg_isready \
  79. pg_recvlogical \
  80. pg_receivewal \
  81. pg_resetwal \
  82. pg_restore \
  83. pg_rewind \
  84. pg_upgrade \
  85. pg_verifybackup \
  86. pg_waldump \
  87. postgres \
  88. initdb
  89. PGSQL_CLI_EXTRA_BIN := \
  90. clusterdb \
  91. createdb \
  92. createuser \
  93. dropdb \
  94. dropuser \
  95. oid2name \
  96. pgbench \
  97. reindexdb \
  98. vacuumdb \
  99. vacuumlo
  100. PGSQL_CONFIG_VARS:= \
  101. pgac_cv_snprintf_long_long_int_format="%lld" \
  102. pgac_cv_snprintf_size_t_support=yes \
  103. USE_DEV_URANDOM=1 \
  104. ac_cv_file__dev_urandom="/dev/urandom" \
  105. ZIC=zic
  106. ifeq ($(CONFIG_USE_UCLIBC),y)
  107. # PostgreSQL does not build against uClibc with locales
  108. # enabled, due to an uClibc bug, see
  109. # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
  110. # so overwrite automatic detection and disable locale support
  111. PGSQL_CONFIG_VARS+= \
  112. pgac_cv_type_locale_t=no
  113. endif
  114. TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
  115. HOST_CONFIGURE_ARGS += \
  116. --disable-nls \
  117. --disable-rpath \
  118. --without-bonjour \
  119. --without-gssapi \
  120. --without-ldap \
  121. --without-openssl \
  122. --without-pam \
  123. --without-perl \
  124. --without-python \
  125. --without-readline \
  126. --without-tcl \
  127. --without-systemd \
  128. --with-zlib="yes" \
  129. --enable-depend
  130. CONFIGURE_ARGS += \
  131. $(DISABLE_NLS) \
  132. --disable-rpath \
  133. --without-bonjour \
  134. --without-gssapi \
  135. --without-ldap \
  136. --without-openssl \
  137. --without-pam \
  138. --without-perl \
  139. --without-python \
  140. --without-tcl \
  141. --without-systemd \
  142. --with-zlib="yes" \
  143. --enable-depend \
  144. $(if $(CONFIG_arc),--disable-spinlocks)
  145. HOST_CFLAGS += -std=gnu99
  146. # Need a native zic and pg_config for build
  147. define Host/Compile
  148. +$(HOST_MAKE_VARS) MAKELEVEL=0 $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
  149. +$(HOST_MAKE_VARS) MAKELEVEL=0 $(MAKE) -C $(HOST_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
  150. endef
  151. define Host/Install
  152. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/
  153. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/common/libpgcommon.a $(STAGING_DIR_HOSTPKG)/lib/
  154. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/port/libpgport.a $(STAGING_DIR_HOSTPKG)/lib/
  155. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/bin/pg_config/pg_config $(STAGING_DIR_HOSTPKG)/lib/
  156. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
  157. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR_HOSTPKG)/bin/
  158. endef
  159. define Build/Compile
  160. $(MAKE) -C $(PKG_BUILD_DIR) MAKELEVEL=0 all contrib
  161. endef
  162. # because PROFILE means something else in the project Makefile
  163. unexport PROFILE
  164. define Package/libpq/install
  165. $(INSTALL_DIR) $(1)/usr/lib
  166. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
  167. endef
  168. define Package/pgsql-cli/install
  169. $(INSTALL_DIR) $(1)/usr/bin
  170. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
  171. endef
  172. define Package/pgsql-cli-extra/install
  173. $(INSTALL_DIR) $(1)/usr/bin
  174. $(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
  175. endef
  176. define Package/pgsql-server/conffiles
  177. /etc/config/postgresql
  178. endef
  179. define Package/pgsql-server/install
  180. $(INSTALL_DIR) $(1)/usr/bin
  181. $(INSTALL_BIN) $(foreach bin,$(PGSQL_SERVER_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
  182. ln -sf postgres $(1)/usr/bin/postmaster
  183. $(INSTALL_DIR) $(1)/usr/share/postgresql
  184. $(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
  185. $(1)/usr/share/postgresql
  186. $(INSTALL_DIR) $(1)/usr/lib
  187. $(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
  188. $(1)/usr/lib/
  189. $(INSTALL_DIR) $(1)/lib/functions
  190. $(INSTALL_BIN) ./files/postgresql.sh $(1)/lib/functions/
  191. $(INSTALL_DIR) $(1)/etc/config
  192. $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
  193. $(INSTALL_DIR) $(1)/etc/init.d
  194. $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
  195. endef
  196. define Build/InstallDev
  197. $(INSTALL_DIR) $(1)/usr/bin
  198. $(CP) $(STAGING_DIR_HOSTPKG)/lib/pg_config $(1)/usr/bin
  199. $(INSTALL_DIR) $(1)/host/bin/
  200. $(LN) $(STAGING_DIR)/usr/bin/pg_config $(1)/host/bin
  201. $(INSTALL_DIR) $(1)/usr/include
  202. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
  203. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
  204. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
  205. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
  206. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
  207. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
  208. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
  209. $(INSTALL_DIR) $(1)/usr/lib
  210. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
  211. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  212. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpq.pc $(1)/usr/lib/pkgconfig/
  213. endef
  214. $(eval $(call HostBuild))
  215. $(eval $(call BuildPackage,libpq))
  216. $(eval $(call BuildPackage,pgsql-cli))
  217. $(eval $(call BuildPackage,pgsql-cli-extra))
  218. $(eval $(call BuildPackage,pgsql-server))