Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ogr_fdw building dependencies and fdw under mingw64. For this I used mingw64 x86_64-4.8.3-win32-seh-rt_v3-rev1 (http://sourceforge.net/projects/mingw-w64/)
#my windows 64-bit build chain described here is available at http://www.bostongis.com/postgisstuff/ming64gcc48.7z
#(with most of these libraries already built)
#My 32-bit chain is much the same except uses gcc 4.8.1, I'll be posting that as well after I clean it up a bit
#Paul's instructions for setting up mingw on 32-bit are pretty close in concept - https://github.com/pramsey/postgis-build-windows
#Although these are built with mingw64 chain, they are designed to work with the EDB VC++ distributions of PostgreSQL
export OS_BUILD=64
export GCC_TYPE=gcc48
PROJECTS=/projects
SOURCES=/sources
if [[ "${OS_BUILD}" == "64" ]] ; then
export MINGHOST=x86_64-w64-mingw32
else
export MINGHOST=i686-w64-mingw32
fi
#compile postgresql 9.5+ (can do the same for other versions of postgresql you want to build for)
# prior versions needed configure --disable-float8-byval (from 9.5 on the VC++ builds no longer use that
# so for older put in --disable-float8-byval to be compatible with EDB VC++, and 9.5+ take it out.)
if true; then
mkdir ${PROJECTS}/postgresql
cd ${PROJECTS}/postgresql
export PG_VER=9.6w${OS_BUILD}${GCC_TYPE}
export PG_VER_FULL=9.6.2
export PG_DIR=${PROJECTS}/postgresql/postgresql-${PG_VER_FULL}
rm -rf postgresql-${PG_VER_FULL}
wget http://ftp.postgresql.org/pub/source/v${PG_VER_FULL}/postgresql-${PG_VER_FULL}.tar.bz2
tar -xvjf postgresql-${PG_VER_FULL}.tar.bz2
cd postgresql-${PG_VER_FULL}
export PATH="${PROJECTS}/rel/pg${PG_VER}/bin:${PROJECTS}/rel/pg${PG_VER}/lib:$PATH"
make distclean
#if you are building for 32-bit in 9.4 you need to edit the
#src/template/win32 and change the LDFLAGS
#LDFLAGS="-Wl,--allow-multiple-definition -Wl,--disable-auto-import"
# to LDFLAGS="-Wl,--allow-multiple-definition"
#if you don't then the extensions you build will not work in the VC++ 32-bit PostgreSQL build
#this is a non-issue for 64-bit build
./configure --prefix=${PROJECTS}/postgresql/rel/pg${PG_VER}\
--build=${MINGHOST} \
--with-pgport=8443 --enable-cassert --enable-debug \
--without-zlib
make clean
make
rm -rf ${PROJECTS}/postgresql/rel/pg${PG_VER}
make install
make check
#gmake install-world
cd ${PG_DIR}/contrib/postgres_fdw
make install
cd ${PG_DIR}/contrib/hstore
make
make install
cd ${PG_DIR}/contrib/fuzzystrmatch
make
make install
cd ${PG_DIR}/contrib/pg_trgm
make
make install
fi
#You'll need GDAL refer to my https://gist.github.com/robe2/83be1da8b85dd83b7f950d55f5154d81#file-build_gdal_and_depends-sh
# for building the GDAL shared library and it's dependencies
##finally we can build ogr_fdw
if true; then
cd ${SOURCES}
export PGUSER=postgres
export PG_VER=9.6
export GDAL_VER=2.1.3
#for simplicity, I copy all the dependency dlls (sql lite, ssl, curl in rel-gdal*/bin folder
export GDAL_REL_PATH=${PROJECTS}/gdal/rel-${GDAL_VER}w${OS_BUILD}${GCC_TYPE}
export PGWINVER=${PG_VER}w${OS_BUILD}edb
export PGPATH=${PROJECTS}/postgresql/rel/pg${PG_VER}w${OS_BUILD}${GCC_TYPE}
export PATH="/mingw/bin:/mingw/include:/bin:${PGPATH}/bin:${GDAL_REL_PATH}/bin"
export PGPORT=5446
rm -rf pgsql_ogr_fdw
git clone -b master https://github.com/pramsey/pgsql-ogr-fdw.git pgsql_ogr_fdw
cd pgsql_ogr_fdw
git pull
make clean
#since I don't build GDAL with postgresql support the postgresql test fails
#so I sed it out
sed -i 's/pgsql//' Makefile
make
make install
make installcheck
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.