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
7.0 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.5.1
  10. PKG_RELEASE:=1
  11. PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
  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:=11e037afaa4bd0c90bb3c3d955e2b401
  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
  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 +shadow-utils +shadow-su
  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 clean
  106. $(MAKE) -C $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)"
  107. mv $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg \
  108. $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host
  109. $(MAKE) -C $(PKG_BUILD_DIR)/src/timezone clean
  110. $(MAKE) -C $(PKG_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
  111. mv $(PKG_BUILD_DIR)/src/timezone/zic $(PKG_BUILD_DIR)/host-zic
  112. $(INSTALL_DIR) $(STAGING_DIR)/host/bin/
  113. $(CP) $(PKG_BUILD_DIR)/host-zic $(STAGING_DIR)/host/bin/zic
  114. $(MAKE) -C $(PKG_BUILD_DIR)/src/bin/pg_config clean
  115. $(MAKE) -C $(PKG_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
  116. mv $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config \
  117. $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host
  118. $(MAKE) -C $(PKG_BUILD_DIR) distclean
  119. (cd $(PKG_BUILD_DIR); rm -f config.cache; \
  120. $(TARGET_CONFIGURE_OPTS) \
  121. CFLAGS="$(TARGET_CFLAGS)" \
  122. CPPFLAGS="$$$$CPPFLAGS $(TARGET_CPPFLAGS)" \
  123. LDFLAGS="$(TARGET_LDFLAGS)" \
  124. ./configure \
  125. --target=$(GNU_TARGET_NAME) \
  126. --host=$(GNU_TARGET_NAME) \
  127. --build=$(GNU_HOST_NAME) \
  128. --program-prefix="" \
  129. --program-suffix="" \
  130. --prefix=/usr \
  131. --exec-prefix=/usr \
  132. --bindir=/usr/bin \
  133. --datadir=/usr/share \
  134. --includedir=/usr/include \
  135. --infodir=/usr/share/info \
  136. --libdir=/usr/lib \
  137. --libexecdir=/usr/lib \
  138. --localstatedir=/var \
  139. --mandir=/usr/share/man \
  140. --sbindir=/usr/sbin \
  141. --sysconfdir=/etc \
  142. $(DISABLE_NLS) \
  143. $(DISABLE_LARGEFILE) \
  144. --enable-shared \
  145. --enable-static \
  146. --disable-integer-datetimes \
  147. --disable-rpath \
  148. --without-bonjour \
  149. --without-gssapi \
  150. --without-ldap \
  151. --without-openssl \
  152. --without-pam \
  153. --without-perl \
  154. --without-python \
  155. --without-tcl \
  156. --with-zlib="yes" \
  157. --enable-depend \
  158. $(if $(CONFIG_TARGET_avr32),--disable-spinlocks) \
  159. );
  160. $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
  161. endef
  162. TARGET_CFLAGS += $(FPIC) -lpthread
  163. # because PROFILE means something else in the project Makefile
  164. unexport PROFILE
  165. define Build/Compile
  166. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  167. DESTDIR="$(PKG_INSTALL_DIR)" \
  168. all
  169. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  170. DESTDIR="$(PKG_INSTALL_DIR)" \
  171. install
  172. endef
  173. define Package/libpq/install
  174. $(INSTALL_DIR) $(1)/usr/lib
  175. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
  176. endef
  177. define Package/pgsql-cli/install
  178. $(INSTALL_DIR) $(1)/usr/bin
  179. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
  180. endef
  181. define Package/pgsql-server/install
  182. $(INSTALL_DIR) $(1)/usr/bin
  183. $(INSTALL_DIR) $(1)/usr/share/postgresql
  184. $(INSTALL_DIR) $(1)/usr/lib
  185. $(INSTALL_DIR) $(1)/etc/init.d
  186. $(INSTALL_DIR) $(1)/etc/config
  187. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
  188. ln -sf postgres $(1)/usr/bin/postmaster
  189. $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
  190. $(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
  191. $(1)/usr/share/postgresql
  192. $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
  193. $(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
  194. $(1)/usr/lib
  195. endef
  196. define Package/pgsql-server/conffiles
  197. /etc/config/postgresql
  198. endef
  199. define Build/InstallDev
  200. $(INSTALL_DIR) $(1)/usr/bin
  201. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(1)/usr/bin/pg_config
  202. $(INSTALL_DIR) $(1)/usr/include
  203. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
  204. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
  205. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
  206. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
  207. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
  208. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
  209. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
  210. $(INSTALL_DIR) $(1)/usr/lib
  211. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
  212. $(CP) $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host $(1)/usr/bin/ecpg
  213. $(CP) $(PKG_BUILD_DIR)/host-zic $(1)/usr/bin/zic
  214. endef
  215. $(eval $(call BuildPackage,libpq))
  216. $(eval $(call BuildPackage,pgsql-cli))
  217. $(eval $(call BuildPackage,pgsql-server))