Last active
December 16, 2015 19:29
-
-
Save ant32/5485185 to your computer and use it in GitHub Desktop.
mingw-w64-postgresql-libs 9.2.4 using windows dll files and reimp
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
# Maintainer: Philip A Reimer <antreimer@gmail.com> | |
# Contributor: Schala Zeal <schalaalexiazeal@gmail.com> | |
pkgname=mingw-w64-postgresql-libs | |
pkgver=9.2.4 | |
pkgrel=2 | |
pkgdesc="Libraries for use with PostgreSQL (mingw-w64)" | |
arch=('any') | |
url="http://www.postgresql.org/" | |
license=('custom:PostgreSQL') | |
# I don't think it depends on readline since it says while configureing that postgresql doesn't work with readline in mingw32 | |
depends=('mingw-w64-crt' 'mingw-w64-openssl' 'mingw-w64-libxml2') | |
makedepends=('mingw-w64-gcc') | |
source=(http://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2) | |
options=(!libtool !strip !buildflags) | |
source=("http://get.enterprisedb.com/postgresql/postgresql-${pkgver}-1-windows-binaries.zip" | |
"http://get.enterprisedb.com/postgresql/postgresql-${pkgver}-1-windows-x64-binaries.zip" | |
"http://pub.ist.ac.at/~schloegl/software/reimp-0.50.zip") | |
#http://lists.gnu.org/archive/html/mingw-cross-env-list/2010-11/msg00101.html | |
md5sums=('516ce6950a74646c80665435f74ae757' | |
'a0388908fdce75f9c642454c7435e898' | |
'7794bf911905c2c5aefe3cc0dc956848') | |
_architectures="i686-w64-mingw32 x86_64-w64-mingw32" | |
build() { | |
unset LDFLAGS | |
mkdir i686-w64-mingw32 && cd i686-w64-mingw32 | |
unzip ${srcdir}/postgresql-${pkgver}-1-windows-binaries.zip | |
cd .. | |
mkdir x86_64-w64-mingw32 && cd x86_64-w64-mingw32 | |
unzip ${srcdir}/postgresql-${pkgver}-1-windows-x64-binaries.zip | |
unset WINEARCH | |
export WINEPREFIX=${srcdir}/wineprefix | |
for _arch in ${_architectures}; do | |
cd "${srcdir}/reimp" | |
${_arch}-gcc -g -I . reimp.c util.c ar.c -o reimp.exe | |
cd "${srcdir}/${_arch}/pgsql/lib" | |
for dll in {libecpg,libecpg_compat,libpgtypes,libpq}; do | |
wine ${srcdir}/reimp/reimp.exe -c -d ${dll}.lib | |
/usr/${_arch}/bin/dlltool -k --input-def ${dll^^}.def --dllname ${dll}.dll --output-lib ${dll}.dll.a | |
done | |
done | |
} | |
package() { | |
for _arch in ${_architectures} ; do | |
cd ${srcdir}/${_arch}/pgsql | |
mkdir -p ${pkgdir}/usr/${_arch}/{bin,include,lib} | |
for dll in {libecpg,libecpg_compat,libpgtypes,libpq}; do | |
install -Dm644 lib/${dll}.dll ${pkgdir}/usr/${_arch}/bin/${dll}.dll | |
install -Dm644 lib/${dll}.dll.a ${pkgdir}/usr/${_arch}/lib/${dll}.dll.a | |
${_arch}-ranlib ${pkgdir}/usr/${_arch}/lib/${dll}.dll.a | |
done | |
${_arch}-strip --strip-unneeded ${pkgdir}/usr/${_arch}/bin/*.dll | |
${_arch}-strip --strip-unneeded ${pkgdir}/usr/${_arch}/lib/*.dll.a | |
cd include | |
mkdir -p "${pkgdir}"/usr/${_arch}/include/{libpq,postgresql/internal/libpq} | |
# cannot copy everything since it copies files that shouldn't be coppied | |
#cp -R * "${pkgdir}/usr/${_arch}/include/" | |
install -m644 pgtypes*.h "${pkgdir}/usr/${_arch}/include/" | |
install -m644 ecpg*.h "${pkgdir}/usr/${_arch}/include/" | |
install -m644 libpq*.h "${pkgdir}/usr/${_arch}/include/" | |
install -m644 sql*.h "${pkgdir}/usr/${_arch}/include/" | |
# 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 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 | |
cd internal | |
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