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.

227 lines
6.4 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
  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
  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. # Need a native ecpg ,pg_config, and zic for build
  59. define Build/Configure
  60. (cd $(PKG_BUILD_DIR); rm -f config.cache; \
  61. ./configure \
  62. --prefix=/usr \
  63. --exec-prefix=/usr \
  64. --bindir=/usr/bin \
  65. --datadir=/usr/share \
  66. --includedir=/usr/include \
  67. --infodir=/usr/share/info \
  68. --libdir=/usr/lib \
  69. --libexecdir=/usr/lib \
  70. --localstatedir=/var \
  71. --mandir=/usr/share/man \
  72. --sbindir=/usr/sbin \
  73. --sysconfdir=/etc \
  74. $(DISABLE_NLS) \
  75. --enable-shared \
  76. --enable-static \
  77. --disable-integer-datetimes \
  78. --disable-rpath \
  79. --without-bonjour \
  80. --without-gssapi \
  81. --without-ldap \
  82. --without-openssl \
  83. --without-pam \
  84. --without-perl \
  85. --without-python \
  86. --without-readline \
  87. --without-tcl \
  88. --with-zlib="yes" \
  89. --enable-depend \
  90. --with-system-timezone=/tmp \
  91. );
  92. $(MAKE) -C $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)" CFLAGS+="-I../../libpq"
  93. mv $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg \
  94. $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host
  95. $(MAKE) -C $(PKG_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
  96. mv $(PKG_BUILD_DIR)/src/timezone/zic $(PKG_BUILD_DIR)/host-zic
  97. $(INSTALL_DIR) $(STAGING_DIR)/host/bin/
  98. $(CP) $(PKG_BUILD_DIR)/host-zic $(STAGING_DIR)/host/bin/zic
  99. $(MAKE) -C $(PKG_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
  100. mv $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config \
  101. $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host
  102. $(MAKE) -C $(PKG_BUILD_DIR) distclean
  103. (cd $(PKG_BUILD_DIR); rm -f config.cache; \
  104. $(TARGET_CONFIGURE_OPTS) \
  105. CFLAGS="$(TARGET_CFLAGS)" \
  106. CPPFLAGS="$$$$CPPFLAGS $(TARGET_CPPFLAGS)" \
  107. LDFLAGS="$(TARGET_LDFLAGS)" \
  108. ./configure \
  109. --target=$(GNU_TARGET_NAME) \
  110. --host=$(GNU_TARGET_NAME) \
  111. --build=$(GNU_HOST_NAME) \
  112. --program-prefix="" \
  113. --program-suffix="" \
  114. --prefix=/usr \
  115. --exec-prefix=/usr \
  116. --bindir=/usr/bin \
  117. --datadir=/usr/share \
  118. --includedir=/usr/include \
  119. --infodir=/usr/share/info \
  120. --libdir=/usr/lib \
  121. --libexecdir=/usr/lib \
  122. --localstatedir=/var \
  123. --mandir=/usr/share/man \
  124. --sbindir=/usr/sbin \
  125. --sysconfdir=/etc \
  126. $(DISABLE_NLS) \
  127. $(DISABLE_LARGEFILE) \
  128. --enable-shared \
  129. --enable-static \
  130. --disable-integer-datetimes \
  131. --disable-rpath \
  132. --without-bonjour \
  133. --without-gssapi \
  134. --without-ldap \
  135. --without-openssl \
  136. --without-pam \
  137. --without-perl \
  138. --without-python \
  139. --without-tcl \
  140. --with-zlib="yes" \
  141. --enable-depend \
  142. $(if $(CONFIG_TARGET_avr32),--disable-spinlocks) \
  143. );
  144. $(SED) 's@ECPG = ../../preproc/ecpg@ECPG = ../../preproc/ecpg.host@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
  145. endef
  146. TARGET_CFLAGS += $(FPIC) -lpthread
  147. # because PROFILE means something else in the project Makefile
  148. unexport PROFILE
  149. define Build/Compile
  150. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  151. DESTDIR="$(PKG_INSTALL_DIR)" \
  152. all
  153. +$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
  154. DESTDIR="$(PKG_INSTALL_DIR)" \
  155. install
  156. endef
  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-server/install
  166. $(INSTALL_DIR) $(1)/usr/bin
  167. $(INSTALL_DIR) $(1)/usr/share/postgresql
  168. $(INSTALL_DIR) $(1)/usr/lib
  169. $(INSTALL_DIR) $(1)/etc/init.d
  170. $(INSTALL_DIR) $(1)/etc/config
  171. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
  172. ln -sf postgres $(1)/usr/bin/postmaster
  173. $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
  174. $(CP) -r $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
  175. $(1)/usr/share/postgresql
  176. $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
  177. $(CP) -r \
  178. $(PKG_INSTALL_DIR)/usr/lib/postgresql \
  179. $(1)/usr/lib
  180. endef
  181. define Package/pgsql-server/conffiles
  182. /etc/config/postgresql
  183. endef
  184. define Build/InstallDev
  185. $(INSTALL_DIR) $(1)/usr/bin
  186. $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(1)/usr/bin/pg_config
  187. $(INSTALL_DIR) $(1)/usr/include
  188. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
  189. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
  190. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
  191. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
  192. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
  193. $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
  194. $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
  195. $(INSTALL_DIR) $(1)/usr/lib
  196. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
  197. $(CP) $(PKG_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg.host $(1)/usr/bin/ecpg
  198. $(CP) $(PKG_BUILD_DIR)/host-zic $(1)/usr/bin/zic
  199. endef
  200. $(eval $(call BuildPackage,libpq))
  201. $(eval $(call BuildPackage,pgsql-cli))
  202. $(eval $(call BuildPackage,pgsql-server))