From 15487ddbcba17753ef0553cc4ef8d3a105cf2186 Mon Sep 17 00:00:00 2001 From: Alexpux Date: Wed, 4 Dec 2013 00:30:36 +0400 Subject: [PATCH] Add postgresql package. --- mingw-w64-postgresql/PKGBUILD | 107 ++++++++++++++++++ .../postgresql-9.2.4-plperl-mingw.patch | 11 ++ .../postgresql-9.3.1-plpython-mingw.patch | 16 +++ 3 files changed, 134 insertions(+) create mode 100644 mingw-w64-postgresql/PKGBUILD create mode 100644 mingw-w64-postgresql/postgresql-9.2.4-plperl-mingw.patch create mode 100644 mingw-w64-postgresql/postgresql-9.3.1-plpython-mingw.patch diff --git a/mingw-w64-postgresql/PKGBUILD b/mingw-w64-postgresql/PKGBUILD new file mode 100644 index 0000000000..992081ed86 --- /dev/null +++ b/mingw-w64-postgresql/PKGBUILD @@ -0,0 +1,107 @@ +# Maintainer: Alexey Pavlov + +_realname=postgresql +_mingw_suff=mingw-w64-${CARCH} +pkgname="${_mingw_suff}-${_realname}" +pkgver=9.3.1 +pkgrel=1 +pkgdesc="Libraries for use with PostgreSQL (mingw-w64)" +arch=('any') +url="http://www.postgresql.org/" +license=('custom:PostgreSQL') +makedepends=("${_mingw_suff}-gcc" "${_mingw_suff}-libxml2" "${_mingw_suff}-python2") +depends=("${_mingw_suff}-crt" + "${_mingw_suff}-gettext" + "${_mingw_suff}-libxml2" + "${_mingw_suff}-openssl" + "${_mingw_suff}-readline" + "${_mingw_suff}-zlib" + "${_mingw_suff}-tcl" + "${_mingw_suff}-libxslt" + "${_mingw_suff}-python2") +options=('staticlibs' 'strip') +source=("http://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2" + postgresql-9.2.4-plperl-mingw.patch + postgresql-9.3.1-plpython-mingw.patch) +md5sums=('c003d871f712d4d3895956b028a96e74' + '6a11681fbd19a3ccf8d41f7fbc9b4392' + '6401b50c0dee9c963985f0d3f4dbe329') + +prepare() { + cd ${srcdir}/postgresql-$pkgver + #patch -p1 -i ${srcdir}/postgresql-9.2.4-plperl-mingw.patch + patch -p1 -i ${srcdir}/postgresql-9.3.1-plpython-mingw.patch +} + +build() { + mkdir -p "${srcdir}/build-${CARCH}" && cd "${srcdir}/build-${CARCH}" + CFLAGS+=" -D__USE_MINGW_ANSI_STDIO=1" + CXXFLAGS+=" -D__USE_MINGW_ANSI_STDIO=1" + ../postgresql-$pkgver/configure \ + --build=${MINGW_CHOST} \ + --host=${MINGW_CHOST} \ + --target=${MINGW_CHOST} \ + --prefix=${MINGW_PREFIX} \ + --with-openssl \ + --enable-thread-safety \ + --enable-integer-datetimes \ + --enable-nls \ + --with-ldap \ + --with-libxml \ + --with-libxslt \ + --with-python \ + --without-perl \ + --with-tcl --with-tclconfig=${MINGW_PREFIX}/lib + + # Make DLL definition file visible during each arch build + ln -s "${srcdir}/postgresql-$pkgver/src/interfaces/libpq/libpqdll.def" src/interfaces/libpq/ + ln -s "${srcdir}/postgresql-$pkgver/src/interfaces/ecpg/ecpglib/libecpgdll.def" src/interfaces/ecpg/ecpglib/ + ln -s "${srcdir}/postgresql-$pkgver/src/interfaces/ecpg/pgtypeslib/libpgtypesdll.def" src/interfaces/ecpg/pgtypeslib/ + ln -s "${srcdir}/postgresql-$pkgver/src/interfaces/ecpg/compatlib/libecpg_compatdll.def" src/interfaces/ecpg/compatlib/ + + #for dir in src/interfaces src/bin/pg_config src/bin/psql src/bin/pg_dump; do + # make -C ${dir} + #done + make +} + +package() { + cd "${srcdir}/build-${CARCH}" + mkdir -p "${pkgdir}${MINGW_PREFIX}/"{bin,include,lib} + + make DESTDIR="${pkgdir}" install + # install libs + + #for dir in src/interfaces src/bin/pg_config src/bin/psql src/bin/pg_dump; do + # make -C ${dir} DESTDIR="${pkgdir}" install + #done + + # Move dll's to bin directory + mv "${pkgdir}${MINGW_PREFIX}/lib/"*.dll "${pkgdir}${MINGW_PREFIX}/bin/" + + # Rename the .a files to .dll.a as they're actually import libraries and not static libraries + for implib in "${pkgdir}${MINGW_PREFIX}/lib/"*.a; do + mv $implib ${implib/.a/.dll.a} + done + + # these headers are needed by the not-so-public headers of the interfaces + mkdir -p "${pkgdir}${MINGW_PREFIX}"/include/{libpq,postgresql/internal/libpq} + install -m644 ${srcdir}/postgresql-${pkgver}/src/include/c.h "${pkgdir}${MINGW_PREFIX}/include/postgresql/internal/" + install -m644 ${srcdir}/postgresql-${pkgver}/src/include/port.h "${pkgdir}${MINGW_PREFIX}/include/postgresql/internal/" + install -m644 ${srcdir}/postgresql-${pkgver}/src/include/postgres_fe.h "${pkgdir}${MINGW_PREFIX}/include/postgresql/internal/" + install -m644 ${srcdir}/postgresql-${pkgver}/src/include/libpq/pqcomm.h "${pkgdir}${MINGW_PREFIX}/include/postgresql/internal/libpq/" + + + # rm -r "$pkgdir${MINGW_PREFIX}/share" + # rm "$pkgdir${MINGW_PREFIX}/bin/"*.exe + + # these headers are needed by the public headers of the interfaces + # install -m644 pg_config.h "${pkgdir}${MINGW_PREFIX}/include/" + # install -m644 pg_config_os.h "${pkgdir}${MINGW_PREFIX}/include/" + # install -m644 pg_config_ext.h "${pkgdir}${MINGW_PREFIX}/include/" + # cd "${srcdir}/postgresql-$pkgver/src/include" + # install -m644 postgres_ext.h "${pkgdir}${MINGW_PREFIX}/include/" + # install -m644 libpq/libpq-fs.h "${pkgdir}${MINGW_PREFIX}/include/libpq/" + # install -m644 pg_config_manual.h "${pkgdir}${MINGW_PREFIX}/include/" + +} diff --git a/mingw-w64-postgresql/postgresql-9.2.4-plperl-mingw.patch b/mingw-w64-postgresql/postgresql-9.2.4-plperl-mingw.patch new file mode 100644 index 0000000000..e697794fef --- /dev/null +++ b/mingw-w64-postgresql/postgresql-9.2.4-plperl-mingw.patch @@ -0,0 +1,11 @@ +--- postgresql-9.2.4/src/pl/plperl/GNUMakefile.orig 2013-05-13 14:18:22 +0300 ++++ postgresql-9.2.4/src/pl/plperl/GNUMakefile 2013-05-13 14:18:57 +0300 +@@ -19,7 +19,7 @@ + ifeq ($(PORTNAME), win32) + perl_archlibexp := $(subst \,/,$(perl_archlibexp)) + perl_privlibexp := $(subst \,/,$(perl_privlibexp)) +-perl_lib := $(basename $(notdir $(wildcard $(perl_archlibexp)/CORE/perl[5-9]*.lib))) ++perl_lib := $(subst lib,,$(basename $(notdir $(wildcard $(perl_archlibexp)/CORE/libperl[5-9]*.a)))) + perl_embed_ldflags = -L$(perl_archlibexp)/CORE -l$(perl_lib) + override CPPFLAGS += -DPLPERL_HAVE_UID_GID + # Perl on win32 contains /* within comment all over the header file, diff --git a/mingw-w64-postgresql/postgresql-9.3.1-plpython-mingw.patch b/mingw-w64-postgresql/postgresql-9.3.1-plpython-mingw.patch new file mode 100644 index 0000000000..4cc030c352 --- /dev/null +++ b/mingw-w64-postgresql/postgresql-9.3.1-plpython-mingw.patch @@ -0,0 +1,16 @@ +--- postgresql-9.3.1/src/pl/plpython/Makefile.orig 2013-12-01 09:52:55.043200000 +0400 ++++ postgresql-9.3.1/src/pl/plpython/Makefile 2013-12-01 09:54:53.591200000 +0400 +@@ -63,11 +63,8 @@ + ifeq ($(PORTNAME), win32) + pytverstr=$(subst .,,${python_version}) + OBJS += libpython${pytverstr}.a +-libpython${pytverstr}.a: python${pytverstr}.def +- dlltool --dllname python${pytverstr}.dll --def python${pytverstr}.def --output-lib libpython${pytverstr}.a +-WD=$(subst \,/,$(WINDIR)) +-python${pytverstr}.def: +- pexports $(WD)/system32/python${pytverstr}.dll > python${pytverstr}.def ++libpython${pytverstr}.a: ++ cp -f $(python_libdir)/libpython${python_version}.dll.a libpython${pytverstr}.a + endif + +