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.

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