Makefile 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. #
  2. # Copyright (C) 2006-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=postgresql
  9. PKG_VERSION:=9.5.4
  10. PKG_RELEASE:=4
  11. PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
  12. PKG_LICENSE:=PostgreSQL
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  14. PKG_SOURCE_URL:=\
  15. https://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
  16. http://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
  17. ftp://ftp.postgresql.org/pub/source/v$(PKG_VERSION)
  18. PKG_MD5SUM:=cf5e571164ad66028ecd7dd8819e3765470d45bcd440d258b686be7e69c76ed0
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_USE_MIPS16:=0
  21. PKG_FIXUP:=autoreconf
  22. PKG_MACRO_PATHS:=config
  23. PKG_BUILD_DEPENDS += postgresql/host
  24. include $(INCLUDE_DIR)/host-build.mk
  25. include $(INCLUDE_DIR)/package.mk
  26. define Package/libpq
  27. SECTION:=libs
  28. CATEGORY:=Libraries
  29. DEPENDS:=+zlib +libreadline +libpthread +libncursesw
  30. TITLE:=PostgreSQL client library
  31. URL:=http://www.postgresql.org/
  32. SUBMENU:=database
  33. endef
  34. define Package/libpq/description
  35. PostgreSQL client library.
  36. endef
  37. define Package/pgsql-cli
  38. SECTION:=utils
  39. CATEGORY:=Utilities
  40. DEPENDS:=+libpq +librt
  41. TITLE:=Command Line Interface (CLI) to PostgreSQL databases
  42. URL:=http://www.postgresql.org/
  43. SUBMENU:=database
  44. endef
  45. define Package/pgsql-cli/description
  46. Command Line Interface (CLI) to PostgreSQL databases.
  47. endef
  48. define Package/pgsql-cli-extra
  49. SECTION:=utils
  50. CATEGORY:=Utilities
  51. DEPENDS:=+libpq +librt
  52. TITLE:=Command Line extras for PostgreSQL databases
  53. URL:=http://www.postgresql.org/
  54. SUBMENU:=database
  55. endef
  56. define Package/pgsql-cli-extra/description
  57. Command Line extras for PostgreSQL databases.
  58. endef
  59. define Package/pgsql-server
  60. SECTION:=utils
  61. CATEGORY:=Utilities
  62. DEPENDS:=+libpq +librt +pgsql-cli
  63. TITLE:=PostgreSQL databases Server
  64. URL:=http://www.postgresql.org/
  65. SUBMENU:=database
  66. USERID:=postgres=5432:postgres=5432
  67. endef
  68. define Package/pgsql-server/description
  69. PostgreSQL databases Server.
  70. endef
  71. PGSQL_CLI_EXTRA_BIN := \
  72. clusterdb \
  73. createdb \
  74. createlang \
  75. createuser \
  76. dropdb \
  77. droplang \
  78. dropuser \
  79. pgbench \
  80. reindexdb \
  81. vacuumdb
  82. PGSQL_CONFIG_VARS:= \
  83. pgac_cv_snprintf_long_long_int_format="%lld" \
  84. pgac_cv_snprintf_size_t_support=yes
  85. ifeq ($(CONFIG_USE_UCLIBC),y)
  86. # PostgreSQL does not build against uClibc with locales
  87. # enabled, due to an uClibc bug, see
  88. # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
  89. # so overwrite automatic detection and disable locale support
  90. PGSQL_CONFIG_VARS+= \
  91. pgac_cv_type_locale_t=no
  92. endif
  93. TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
  94. HOST_CONFIGURE_ARGS += \
  95. $(DISABLE_NLS) \
  96. --disable-rpath \
  97. --without-bonjour \
  98. --without-gssapi \
  99. --without-ldap \
  100. --without-openssl \
  101. --without-pam \
  102. --without-perl \
  103. --without-python \
  104. --without-readline \
  105. --without-tcl \
  106. --with-zlib="yes" \
  107. --enable-depend
  108. CONFIGURE_ARGS += \
  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-tcl \
  118. --with-zlib="yes" \
  119. --enable-depend \
  120. $(if $(CONFIG_TARGET_avr32),--disable-spinlocks)
  121. # Need a native ecpg ,pg_config, and zic for build
  122. define Host/Compile
  123. $(MAKE) -C $(HOST_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)"
  124. $(MAKE) -C $(HOST_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
  125. $(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
  126. endef
  127. define Host/Install
  128. $(INSTALL_DIR) $(STAGING_DIR)/usr/bin/
  129. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/bin/pg_config/pg_config $(STAGING_DIR)/usr/bin/
  130. $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
  131. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg $(STAGING_DIR_HOSTPKG)/bin/
  132. $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR_HOSTPKG)/bin/
  133. endef
  134. define Build/Configure
  135. $(Build/Configure/Default)
  136. $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = $(STAGING_DIR_HOSTPKG)/bin/ecpg@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
  137. endef
  138. TARGET_CFLAGS += $(FPIC) -lpthread
  139. # because PROFILE means something else in the project Makefile
  140. unexport PROFILE
  141. define Build/Compile
  142. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  143. DESTDIR="$(PKG_INSTALL_DIR)" \
  144. all
  145. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  146. DESTDIR="$(PKG_INSTALL_DIR)" \
  147. install
  148. endef
  149. define Package/libpq/install
  150. $(INSTALL_DIR) $(1)/usr/lib
  151. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
  152. endef
  153. define Package/pgsql-cli/install
  154. $(INSTALL_DIR) $(1)/usr/bin
  155. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
  156. endef
  157. define Package/pgsql-cli-extra/install
  158. $(INSTALL_DIR) $(1)/usr/bin
  159. $(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
  160. endef
  161. define Package/pgsql-server/install
  162. $(INSTALL_DIR) $(1)/usr/bin
  163. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pg_* $(PKG_INSTALL_DIR)/usr/bin/postgres \
  164. $(PKG_INSTALL_DIR)/usr/bin/initdb $(1)/usr/bin/
  165. ln -sf postgres $(1)/usr/bin/postmaster
  166. $(INSTALL_DIR) $(1)/usr/share/postgresql
  167. $(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
  168. $(1)/usr/share/postgresql
  169. $(INSTALL_DIR) $(1)/usr/lib
  170. $(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
  171. $(1)/usr/lib/
  172. $(INSTALL_DIR) $(1)/lib/functions
  173. $(INSTALL_BIN) ./files/postgresql.sh $(1)/lib/functions/
  174. $(INSTALL_DIR) $(1)/etc/config
  175. $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
  176. $(INSTALL_DIR) $(1)/etc/init.d
  177. $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
  178. endef
  179. define Build/InstallDev
  180. $(INSTALL_DIR) $(1)/usr/bin
  181. $(INSTALL_DIR) $(1)/usr/include
  182. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
  183. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
  184. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
  185. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
  186. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
  187. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
  188. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
  189. $(INSTALL_DIR) $(1)/usr/lib
  190. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
  191. endef
  192. $(eval $(call HostBuild))
  193. $(eval $(call BuildPackage,libpq))
  194. $(eval $(call BuildPackage,pgsql-cli))
  195. $(eval $(call BuildPackage,pgsql-cli-extra))
  196. $(eval $(call BuildPackage,pgsql-server))