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.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:=9.6.3
  7. PKG_RELEASE:=3
  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:=1645b3736901f6d854e695a937389e68ff2066ce0cde9d73919d6ab7c995b9c6
  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:=+zlib +libreadline +libpthread +libncursesw
  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:=+libpq +librt
  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:=+libpq +librt
  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:=+libpq +librt +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_TARGET_avr32),--disable-spinlocks)
  136. EXTRA_CFLAGS:= -I$(PKG_BUILD_DIR)/src/include/
  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. TARGET_CFLAGS += $(FPIC) -lpthread
  157. # because PROFILE means something else in the project Makefile
  158. unexport PROFILE
  159. define Package/libpq/install
  160. $(INSTALL_DIR) $(1)/usr/lib
  161. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
  162. endef
  163. define Package/pgsql-cli/install
  164. $(INSTALL_DIR) $(1)/usr/bin
  165. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
  166. endef
  167. define Package/pgsql-cli-extra/install
  168. $(INSTALL_DIR) $(1)/usr/bin
  169. $(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
  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))