diff --git a/postgresql/mingw-w64/PKGBUILD b/postgresql/mingw-w64/PKGBUILD new file mode 100644 index 00000000..501ba0c3 --- /dev/null +++ b/postgresql/mingw-w64/PKGBUILD @@ -0,0 +1,74 @@ +# Maintainer: Martchus +# Contributor: ant32 + +pkgname=mingw-w64-postgresql +pkgver=9.6.2 +pkgrel=1 +pkgdesc='A sophisticated object-relational DBMS (mingw-w64)' +arch=('any') +url='https://www.postgresql.org' +license=('custom:PostgreSQL') +makedepends=('mingw-w64-configure' 'libxml2') +depends=('mingw-w64-gettext' 'mingw-w64-openssl>=1.0.0' 'mingw-w64-libxml2' 'mingw-w64-readline') +options=(staticlibs !strip !buildflags) +provides=('mingw-w64-postgresql-libs') +conflicts=('mingw-w64-postgresql-libs') +replaces=('mingw-w64-postgresql-libs') +source=("http://ftp.postgresql.org/pub/source/v${pkgver}/postgresql-${pkgver}.tar.bz2" + 'postgresql-9.4.1-mingw-link.patch') +sha256sums=('0187b5184be1c09034e74e44761505e52357248451b0c854dddec6c231fe50c9' + '0f2b5c7edb48dd106900854c9323ca2d483054595c4cf8a5b796a1d536d22aad') + +_architectures="i686-w64-mingw32 x86_64-w64-mingw32" + +prepare() { + cd postgresql-$pkgver + patch -p1 -i ${srcdir}/postgresql-9.4.1-mingw-link.patch +} + +build() { + cd postgresql-$pkgver + for _arch in ${_architectures}; do + mkdir -p build-${_arch} && pushd build-${_arch} + ${_arch}-configure \ + --enable-thread-safety \ + --enable-nls \ + --with-libxml \ + --with-openssl + + # 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/ + + make + + # Build static lib + ${_arch}-ar rvs -o libpq.a src/interfaces/libpq/*.o + popd + done +} + +package() { + for _arch in ${_architectures}; do + cd "$srcdir/postgresql-$pkgver/build-${_arch}" + mkdir -p "${pkgdir}/usr/${_arch}/"{bin,include,lib} + + make DESTDIR=$pkgdir install + mv libpq.a "${pkgdir}/usr/${_arch}/lib/" + mv "$pkgdir/usr/${_arch}/lib/"*.dll "$pkgdir/usr/${_arch}/bin/" + + find "${pkgdir}/usr/${_arch}" -name "*.exe" -exec ${_arch}-strip --strip-all {} \; + find "${pkgdir}/usr/${_arch}" -name "*.dll" -exec ${_arch}-strip --strip-unneeded {} \; + find "${pkgdir}/usr/${_arch}" -name "*.a" -exec ${_arch}-strip -g {} \; + + # these headers are needed by the not-so-public headers of the interfaces + cd "${srcdir}/postgresql-$pkgver/src/include" + mkdir -p "${pkgdir}"/usr/${_arch}/include/{libpq,postgresql/internal/libpq} + 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 +} diff --git a/postgresql/mingw-w64/postgresql-9.4.1-mingw-link.patch b/postgresql/mingw-w64/postgresql-9.4.1-mingw-link.patch new file mode 100644 index 00000000..86b57c6a --- /dev/null +++ b/postgresql/mingw-w64/postgresql-9.4.1-mingw-link.patch @@ -0,0 +1,52 @@ +--- postgresql-9.4.1/src/Makefile.shlib.orig 2015-02-10 19:14:10.984800000 +0300 ++++ postgresql-9.4.1/src/Makefile.shlib 2015-02-10 19:14:16.554000000 +0300 +@@ -86,7 +86,7 @@ + # Naming convention for dynamically loadable modules + shlib = $(NAME)$(DLSUFFIX) + endif +-stlib = lib$(NAME).a ++stlib = lib$(NAME).dll.a + + ifndef soname + # additional flags for backend modules +--- postgresql-9.4.1/src/backend/Makefile.orig 2015-02-10 21:01:34.928800000 +0300 ++++ postgresql-9.4.1/src/backend/Makefile 2015-02-10 21:03:43.819000000 +0300 +@@ -79,9 +79,9 @@ + LIBS += -lsecur32 + + postgres: $(OBJS) $(WIN32RES) +- $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) -Wl,--stack=$(WIN32_STACK_RLIMIT) -Wl,--export-all-symbols -Wl,--out-implib=libpostgres.a $(call expand_subsys,$(OBJS)) $(WIN32RES) $(LIBS) -o $@$(X) ++ $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) -Wl,--stack=$(WIN32_STACK_RLIMIT) -Wl,--export-all-symbols -Wl,--out-implib=libpostgres.dll.a $(call expand_subsys,$(OBJS)) $(WIN32RES) $(LIBS) -o $@$(X) + +-libpostgres.a: postgres ; ++libpostgres.dll.a: postgres ; + + endif # win32 + +@@ -207,7 +207,7 @@ + endif + ifeq ($(PORTNAME), win32) + ifeq ($(MAKE_DLL), true) +- $(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a' ++ $(INSTALL_DATA) libpostgres.dll.a '$(DESTDIR)$(libdir)/libpostgres.dll.a' + endif + endif + $(MAKE) -C catalog install-data +@@ -265,7 +265,7 @@ + endif + ifeq ($(PORTNAME), win32) + ifeq ($(MAKE_DLL), true) +- rm -f '$(DESTDIR)$(libdir)/libpostgres.a' ++ rm -f '$(DESTDIR)$(libdir)/libpostgres.dll.a' + endif + endif + $(MAKE) -C catalog uninstall-data +@@ -288,7 +288,7 @@ + rm -f postgres.dll libpostgres.a + endif + ifeq ($(PORTNAME), win32) +- rm -f postgres.dll libpostgres.a $(WIN32RES) ++ rm -f postgres.dll libpostgres.dll.a $(WIN32RES) + endif + + distclean: clean