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