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.

249 lines
6.6 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:=13.0
  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:=80e750be8d436b54197636a02636f8fd3263ba6779bf865b04832495ea592296
  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. HOST_CFLAGS += -std=gnu99
  138. # Need a native zic and pg_config for build
  139. define Host/Compile
  140. +$(HOST_MAKE_VARS) MAKELEVEL=0 $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
  141. +$(HOST_MAKE_VARS) MAKELEVEL=0 $(MAKE) -C $(HOST_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
  142. endef
  143. define Host/Install
  144. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/lib/
  145. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/common/libpgcommon.a $(STAGING_DIR_HOSTPKG)/lib/
  146. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/port/libpgport.a $(STAGING_DIR_HOSTPKG)/lib/
  147. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/bin/pg_config/pg_config $(STAGING_DIR_HOSTPKG)/lib/
  148. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
  149. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR_HOSTPKG)/bin/
  150. endef
  151. define Build/Compile
  152. $(MAKE) -C $(PKG_BUILD_DIR) MAKELEVEL=0 all contrib
  153. endef
  154. # because PROFILE means something else in the project Makefile
  155. unexport PROFILE
  156. define Package/libpq/install
  157. $(INSTALL_DIR) $(1)/usr/lib
  158. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
  159. endef
  160. define Package/pgsql-cli/install
  161. $(INSTALL_DIR) $(1)/usr/bin
  162. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
  163. endef
  164. define Package/pgsql-cli-extra/install
  165. $(INSTALL_DIR) $(1)/usr/bin
  166. $(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
  167. endef
  168. define Package/pgsql-server/conffiles
  169. /etc/config/postgresql
  170. endef
  171. define Package/pgsql-server/install
  172. $(INSTALL_DIR) $(1)/usr/bin
  173. $(INSTALL_BIN) $(foreach bin,$(PGSQL_SERVER_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
  174. ln -sf postgres $(1)/usr/bin/postmaster
  175. $(INSTALL_DIR) $(1)/usr/share/postgresql
  176. $(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
  177. $(1)/usr/share/postgresql
  178. $(INSTALL_DIR) $(1)/usr/lib
  179. $(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
  180. $(1)/usr/lib/
  181. $(INSTALL_DIR) $(1)/lib/functions
  182. $(INSTALL_BIN) ./files/postgresql.sh $(1)/lib/functions/
  183. $(INSTALL_DIR) $(1)/etc/config
  184. $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
  185. $(INSTALL_DIR) $(1)/etc/init.d
  186. $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
  187. endef
  188. define Build/InstallDev
  189. $(INSTALL_DIR) $(1)/usr/bin
  190. $(CP) $(STAGING_DIR_HOSTPKG)/lib/pg_config $(1)/usr/bin
  191. $(INSTALL_DIR) $(1)/host/bin/
  192. $(LN) $(STAGING_DIR)/usr/bin/pg_config $(1)/host/bin
  193. $(INSTALL_DIR) $(1)/usr/include
  194. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
  195. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
  196. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
  197. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
  198. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
  199. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
  200. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
  201. $(INSTALL_DIR) $(1)/usr/lib
  202. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
  203. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  204. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpq.pc $(1)/usr/lib/pkgconfig/
  205. endef
  206. $(eval $(call HostBuild))
  207. $(eval $(call BuildPackage,libpq))
  208. $(eval $(call BuildPackage,pgsql-cli))
  209. $(eval $(call BuildPackage,pgsql-cli-extra))
  210. $(eval $(call BuildPackage,pgsql-server))