Created
February 2, 2015 20:40
-
-
Save ant32/32485a995f3324708b48 to your computer and use it in GitHub Desktop.
mingw-w64-postgresql-libs PKGBUILD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Contributor: ant32 <antreimer@gmail.com> | |
pkgname=mingw-w64-postgresql-libs | |
pkgver=9.4.0 | |
pkgrel=1 | |
pkgdesc="Libraries for use with PostgreSQL (mingw-w64)" | |
arch=(any) | |
url="http://www.postgresql.org" | |
license=("custom:PostgreSQL") | |
makedepends=(mingw-w64-configure libxml2) | |
depends=(mingw-w64-gettext mingw-w64-openssl mingw-w64-libxslt) | |
options=(staticlibs !strip !buildflags) | |
source=("http://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2" | |
"postgresql-9.3.5-plpgsql-link.patch") | |
md5sums=('8cd6e33e1f8d4d2362c8c08bd0e8802b' | |
'ec8535d4256cc243eb45c08d10489695') | |
_architectures="i686-w64-mingw32 x86_64-w64-mingw32" | |
prepare() { | |
cd "$srcdir/postgresql-$pkgver" | |
patch -p0 -i ../postgresql-9.3.5-plpgsql-link.patch | |
} | |
build() { | |
cd "$srcdir/postgresql-$pkgver" | |
for _arch in ${_architectures}; do | |
mkdir -p build-${_arch} && pushd build-${_arch} | |
${_arch}-configure \ | |
--with-openssl \ | |
--enable-thread-safety \ | |
--enable-nls \ | |
--with-libxml \ | |
--with-ldap \ | |
--enable-integer-datetimes \ | |
--with-libxslt | |
# 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/common src/interfaces src/bin/pg_config src/bin/pg_dump src/bin/psql src/bin/scripts; do | |
make -C ${dir} | |
done | |
popd | |
done | |
} | |
package() { | |
for _arch in ${_architectures}; do | |
cd "$srcdir/postgresql-$pkgver/build-${_arch}" | |
mkdir -p "${pkgdir}/usr/${_arch}/"{bin,include,lib} | |
# install libs | |
for dir in src/interfaces src/bin/pg_config src/bin/pg_dump src/bin/psql src/bin/scripts; do | |
make -C ${dir} DESTDIR="${pkgdir}" install | |
done | |
# Rename the .a files to .dll.a as they're actually import libraries and not static libraries | |
for implib in "${pkgdir}/usr/${_arch}/lib/"*.a; do | |
mv $implib ${implib/.a/.dll.a} | |
done | |
# bulid static libpq.a | |
${_arch}-ar rvs -o libpq.a src/interfaces/libpq/*.o | |
mv libpq.a "${pkgdir}/usr/${_arch}/lib/" | |
mv "$pkgdir/usr/${_arch}/lib/"*.dll "$pkgdir/usr/${_arch}/bin/" | |
find "$pkgdir/usr/${_arch}" -name '*.exe' -o -name '*.bat' -o -name '*.def' -o -name '*.exp' | xargs -rtl1 rm | |
find "$pkgdir/usr/${_arch}" -name '*.dll' | xargs -rtl1 ${_arch}-strip --strip-unneeded | |
find "$pkgdir/usr/${_arch}" -name '*.a' -o -name '*.dll' | xargs -rtl1 ${_arch}-strip -g | |
rm -r "$pkgdir/usr/${_arch}/share" | |
cd src/include | |
mkdir -p "${pkgdir}"/usr/${_arch}/include/{libpq,postgresql/internal/libpq} | |
# these headers are needed by the public headers of the interfaces | |
install -m644 pg_config.h "${pkgdir}/usr/${_arch}/include/" | |
install -m644 pg_config_os.h "${pkgdir}/usr/${_arch}/include/" | |
install -m644 pg_config_ext.h "${pkgdir}/usr/${_arch}/include/" | |
cd "${srcdir}/postgresql-$pkgver/src/include" | |
install -m644 postgres_ext.h "${pkgdir}/usr/${_arch}/include/" | |
install -m644 libpq/libpq-fs.h "${pkgdir}/usr/${_arch}/include/libpq/" | |
install -m644 pg_config_manual.h "${pkgdir}/usr/${_arch}/include/" | |
# these headers are needed by the not-so-public headers of the interfaces | |
install -m644 c.h "${pkgdir}/usr/${_arch}/include/postgresql/internal/" | |
install -m644 port.h "${pkgdir}/usr/${_arch}/include/postgresql/internal/" | |
install -m644 postgres_fe.h "${pkgdir}/usr/${_arch}/include/postgresql/internal/" | |
install -m644 libpq/pqcomm.h "${pkgdir}/usr/${_arch}/include/postgresql/internal/libpq/" | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment