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.

246 lines
6.7 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:=9.6.12
  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:=2e8c8446ba94767bda8a26cf5a2152bf0ae68a86aaebf894132a763084579d84
  16. PKG_USE_MIPS16:=0
  17. PKG_FIXUP:=autoreconf
  18. PKG_MACRO_PATHS:=config
  19. PKG_BUILD_DEPENDS:=readline/host postgresql/host
  20. HOST_BUILD_DEPENDS:=zlib/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_receivexlog \
  78. pg_recvlogical \
  79. pg_resetxlog \
  80. pg_restore \
  81. pg_standby \
  82. pg_upgrade \
  83. pg_xlogdump \
  84. postgres \
  85. initdb
  86. PGSQL_CLI_EXTRA_BIN := \
  87. clusterdb \
  88. createdb \
  89. createlang \
  90. createuser \
  91. dropdb \
  92. droplang \
  93. dropuser \
  94. pgbench \
  95. reindexdb \
  96. vacuumdb
  97. PGSQL_CONFIG_VARS:= \
  98. pgac_cv_snprintf_long_long_int_format="%lld" \
  99. pgac_cv_snprintf_size_t_support=yes
  100. ifeq ($(CONFIG_USE_UCLIBC),y)
  101. # PostgreSQL does not build against uClibc with locales
  102. # enabled, due to an uClibc bug, see
  103. # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
  104. # so overwrite automatic detection and disable locale support
  105. PGSQL_CONFIG_VARS+= \
  106. pgac_cv_type_locale_t=no
  107. endif
  108. TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
  109. HOST_CONFIGURE_ARGS += \
  110. --disable-nls \
  111. --disable-rpath \
  112. --without-bonjour \
  113. --without-gssapi \
  114. --without-ldap \
  115. --without-openssl \
  116. --without-pam \
  117. --without-perl \
  118. --without-python \
  119. --without-readline \
  120. --without-tcl \
  121. --with-zlib="yes" \
  122. --enable-depend
  123. CONFIGURE_ARGS += \
  124. $(DISABLE_NLS) \
  125. --disable-rpath \
  126. --without-bonjour \
  127. --without-gssapi \
  128. --without-ldap \
  129. --without-openssl \
  130. --without-pam \
  131. --without-perl \
  132. --without-python \
  133. --without-tcl \
  134. --with-zlib="yes" \
  135. --enable-depend \
  136. $(if $(CONFIG_arc),--disable-spinlocks)
  137. # Need a native ecpg, pg_config and zic for build
  138. define Host/Compile
  139. $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
  140. $(MAKE) -C $(HOST_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)"
  141. $(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/interfaces/ecpg/preproc/ecpg $(STAGING_DIR_HOSTPKG)/bin/
  150. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR_HOSTPKG)/bin/
  151. endef
  152. define Build/Configure
  153. $(Build/Configure/Default)
  154. $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = $(STAGING_DIR_HOSTPKG)/bin/ecpg@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
  155. endef
  156. # because PROFILE means something else in the project Makefile
  157. unexport PROFILE
  158. define Package/libpq/install
  159. $(INSTALL_DIR) $(1)/usr/lib
  160. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
  161. endef
  162. define Package/pgsql-cli/install
  163. $(INSTALL_DIR) $(1)/usr/bin
  164. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
  165. endef
  166. define Package/pgsql-cli-extra/install
  167. $(INSTALL_DIR) $(1)/usr/bin
  168. $(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
  169. endef
  170. define Package/pgsql-server/install
  171. $(INSTALL_DIR) $(1)/usr/bin
  172. $(INSTALL_BIN) $(foreach bin,$(PGSQL_SERVER_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
  173. ln -sf postgres $(1)/usr/bin/postmaster
  174. $(INSTALL_DIR) $(1)/usr/share/postgresql
  175. $(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
  176. $(1)/usr/share/postgresql
  177. $(INSTALL_DIR) $(1)/usr/lib
  178. $(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
  179. $(1)/usr/lib/
  180. $(INSTALL_DIR) $(1)/lib/functions
  181. $(INSTALL_BIN) ./files/postgresql.sh $(1)/lib/functions/
  182. $(INSTALL_DIR) $(1)/etc/config
  183. $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
  184. $(INSTALL_DIR) $(1)/etc/init.d
  185. $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
  186. endef
  187. define Build/InstallDev
  188. $(INSTALL_DIR) $(1)/usr/bin
  189. $(CP) $(STAGING_DIR_HOSTPKG)/lib/pg_config $(1)/usr/bin
  190. $(INSTALL_DIR) $(1)/host/bin/
  191. $(LN) $(STAGING_DIR)/usr/bin/pg_config $(1)/host/bin
  192. $(INSTALL_DIR) $(1)/usr/include
  193. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
  194. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
  195. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
  196. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
  197. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
  198. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
  199. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
  200. $(INSTALL_DIR) $(1)/usr/lib
  201. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
  202. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  203. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpq.pc $(1)/usr/lib/pkgconfig/
  204. endef
  205. $(eval $(call HostBuild))
  206. $(eval $(call BuildPackage,libpq))
  207. $(eval $(call BuildPackage,pgsql-cli))
  208. $(eval $(call BuildPackage,pgsql-cli-extra))
  209. $(eval $(call BuildPackage,pgsql-server))