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.

242 lines
6.9 KiB

  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.4.4
  10. PKG_RELEASE:=1
  11. PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
  12. PKG_LICENSE:=PostgreSQL
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  14. PKG_SOURCE_URL:=\
  15. http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v$(PKG_VERSION) \
  16. http://ftp.be.postgresql.org/postgresql/source/v$(PKG_VERSION) \
  17. ftp://ftp-archives.postgresql.org/pub/source/v$(PKG_VERSION)
  18. PKG_MD5SUM:=1fe952c44ed26d7e6a335cf991a9c1c6
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_USE_MIPS16:=0
  21. PKG_FIXUP:=autoreconf
  22. PKG_MACRO_PATHS:=config
  23. include $(INCLUDE_DIR)/package.mk
  24. define Package/libpq
  25. SECTION:=libs
  26. CATEGORY:=Libraries
  27. DEPENDS:=+zlib +libreadline +libpthread +libncurses +shadow-utils +shadow-su
  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:=+libpq +USE_UCLIBC:librt
  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-server
  47. SECTION:=utils
  48. CATEGORY:=Utilities
  49. DEPENDS:=+libpq +USE_UCLIBC:librt
  50. TITLE:=PostgreSQL databases Server
  51. URL:=http://www.postgresql.org/
  52. SUBMENU:=database
  53. USERID:=postgres=5432:postgres=5432
  54. endef
  55. define Package/pgsql-server/description
  56. PostgreSQL databases Server.
  57. endef
  58. PGSQL_CONFIG_VARS:= \
  59. pgac_cv_snprintf_long_long_int_format="%lld" \
  60. pgac_cv_snprintf_size_t_support=yes
  61. ifeq ($(CONFIG_USE_UCLIBC),y)
  62. # PostgreSQL does not build against uClibc with locales
  63. # enabled, due to an uClibc bug, see
  64. # http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
  65. # so overwrite automatic detection and disable locale support
  66. PGSQL_CONFIG_VARS+= \
  67. pgac_cv_type_locale_t=no
  68. endif
  69. TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
  70. # Need a native ecpg ,pg_config, and zic for build
  71. define Build/Configure
  72. (cd $(PKG_BUILD_DIR); rm -f config.cache; \
  73. $(PGSQL_CONFIG_VARS) \
  74. ./configure \
  75. --prefix=/usr \
  76. --exec-prefix=/usr \
  77. --bindir=/usr/bin \
  78. --datadir=/usr/share \
  79. --includedir=/usr/include \
  80. --infodir=/usr/share/info \
  81. --libdir=/usr/lib \
  82. --libexecdir=/usr/lib \
  83. --localstatedir=/var \
  84. --mandir=/usr/share/man \
  85. --sbindir=/usr/sbin \
  86. --sysconfdir=/etc \
  87. $(DISABLE_NLS) \
  88. --enable-shared \
  89. --enable-static \
  90. --disable-integer-datetimes \
  91. --disable-rpath \
  92. --without-bonjour \
  93. --without-gssapi \
  94. --without-ldap \
  95. --without-openssl \
  96. --without-pam \
  97. --without-perl \
  98. --without-python \
  99. --without-readline \
  100. --without-tcl \
  101. --with-zlib="yes" \
  102. --enable-depend \
  103. --with-system-timezone=/tmp \
  104. );
  105. $(MAKE) -C $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)" CFLAGS+="-I../../libpq"
  106. mv $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg \
  107. $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host
  108. $(MAKE) -C $(PKG_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
  109. mv $(PKG_BUILD_DIR)/src/timezone/zic $(PKG_BUILD_DIR)/host-zic
  110. $(INSTALL_DIR) $(STAGING_DIR)/host/bin/
  111. $(CP) $(PKG_BUILD_DIR)/host-zic $(STAGING_DIR)/host/bin/zic
  112. $(MAKE) -C $(PKG_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
  113. mv $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config \
  114. $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host
  115. $(MAKE) -C $(PKG_BUILD_DIR) distclean
  116. (cd $(PKG_BUILD_DIR); rm -f config.cache; \
  117. $(TARGET_CONFIGURE_OPTS) \
  118. CFLAGS="$(TARGET_CFLAGS)" \
  119. CPPFLAGS="$$$$CPPFLAGS $(TARGET_CPPFLAGS)" \
  120. LDFLAGS="$(TARGET_LDFLAGS)" \
  121. ./configure \
  122. --target=$(GNU_TARGET_NAME) \
  123. --host=$(GNU_TARGET_NAME) \
  124. --build=$(GNU_HOST_NAME) \
  125. --program-prefix="" \
  126. --program-suffix="" \
  127. --prefix=/usr \
  128. --exec-prefix=/usr \
  129. --bindir=/usr/bin \
  130. --datadir=/usr/share \
  131. --includedir=/usr/include \
  132. --infodir=/usr/share/info \
  133. --libdir=/usr/lib \
  134. --libexecdir=/usr/lib \
  135. --localstatedir=/var \
  136. --mandir=/usr/share/man \
  137. --sbindir=/usr/sbin \
  138. --sysconfdir=/etc \
  139. $(DISABLE_NLS) \
  140. $(DISABLE_LARGEFILE) \
  141. --enable-shared \
  142. --enable-static \
  143. --disable-integer-datetimes \
  144. --disable-rpath \
  145. --without-bonjour \
  146. --without-gssapi \
  147. --without-ldap \
  148. --without-openssl \
  149. --without-pam \
  150. --without-perl \
  151. --without-python \
  152. --without-tcl \
  153. --with-zlib="yes" \
  154. --enable-depend \
  155. $(if $(CONFIG_TARGET_avr32),--disable-spinlocks) \
  156. );
  157. $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
  158. endef
  159. TARGET_CFLAGS += $(FPIC) -lpthread
  160. # because PROFILE means something else in the project Makefile
  161. unexport PROFILE
  162. define Build/Compile
  163. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  164. DESTDIR="$(PKG_INSTALL_DIR)" \
  165. all
  166. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  167. DESTDIR="$(PKG_INSTALL_DIR)" \
  168. install
  169. endef
  170. define Package/libpq/install
  171. $(INSTALL_DIR) $(1)/usr/lib
  172. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
  173. endef
  174. define Package/pgsql-cli/install
  175. $(INSTALL_DIR) $(1)/usr/bin
  176. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
  177. endef
  178. define Package/pgsql-server/install
  179. $(INSTALL_DIR) $(1)/usr/bin
  180. $(INSTALL_DIR) $(1)/usr/share/postgresql
  181. $(INSTALL_DIR) $(1)/usr/lib
  182. $(INSTALL_DIR) $(1)/etc/init.d
  183. $(INSTALL_DIR) $(1)/etc/config
  184. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
  185. ln -sf postgres $(1)/usr/bin/postmaster
  186. $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
  187. $(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
  188. $(1)/usr/share/postgresql
  189. $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
  190. $(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
  191. $(1)/usr/lib
  192. endef
  193. define Package/pgsql-server/conffiles
  194. /etc/config/postgresql
  195. endef
  196. define Build/InstallDev
  197. $(INSTALL_DIR) $(1)/usr/bin
  198. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(1)/usr/bin/pg_config
  199. $(INSTALL_DIR) $(1)/usr/include
  200. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
  201. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
  202. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
  203. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
  204. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
  205. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
  206. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
  207. $(INSTALL_DIR) $(1)/usr/lib
  208. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
  209. $(CP) $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host $(1)/usr/bin/ecpg
  210. $(CP) $(PKG_BUILD_DIR)/host-zic $(1)/usr/bin/zic
  211. endef
  212. $(eval $(call BuildPackage,libpq))
  213. $(eval $(call BuildPackage,pgsql-cli))
  214. $(eval $(call BuildPackage,pgsql-server))