Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PostGIS build scripts for Mac OSX #218

Merged
merged 5 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 27 additions & 22 deletions PostGIS/build-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ _prep_PostGIS_osx() {
mkdir -p postgis.osx || _die "Couldn't create the postgis.osx directory"
chmod ugo+w postgis.osx || _die "Couldn't set the permissions on the source directory"

echo "Copying pgJDBC jar files.."
cp postgresql-$PG_VERSION_PGJDBC*.jar postgis.osx || _die "Failed to copy pgJDBC jar files."
#echo "Copying pgJDBC jar files.."
#cp postgresql-$PG_VERSION_PGJDBC*.jar postgis.osx || _die "Failed to copy pgJDBC jar files."

# Grab a copy of the postgis source tree
cp -R postgis-$PG_VERSION_POSTGIS/* postgis.osx || _die "Failed to copy the source code (PostGIS/source/postgis-$PG_VERSION_POSTGIS)"
Expand Down Expand Up @@ -202,22 +202,22 @@ cat <<EOT-POSTGIS > $WD/PostGIS/build-postgis.sh

# Configure the source tree
echo "Configuring the PostGIS source"
PATH=$PATH:$IMAGEMAGICK_HOME_OSX/bin LD_LIBRARY_PATH=/opt/local/Current_v15/lib:$LD_LIBRARY_PATH; CXXFLAGS="$PG_ARCH_OSX_CXXFLAGS" CFLAGS="$PG_ARCH_OSX_CFLAGS" LDFLAGS="-L/opt/local/Current_v15/lib" MACOSX_DEPLOYMENT_TARGET=$MACOSX_MIN_VERSION PATH=/opt/local/Current_v15/bin:$PG_PERL_OSX/bin:$PATH ./configure --enable-debug --with-pgconfig=$PG_PGHOME_OSX/bin/pg_config --with-geosconfig=/opt/local/Current_v15/bin/geos-config --with-projdir=/opt/local/Current_v15 --with-xsldir=$PG_DOCBOOK_OSX --with-gdalconfig=/opt/local/Current_v15/bin/gdal-config --with-xml2config=/opt/local/Current_v15/bin/xml2-config --with-libiconv=/opt/local/Current_v15 --with-jsondir=/opt/local/Current_v15 --without-protobuf || _die "Failed to configure PostGIS"

PATH=$IMAGEMAGICK_HOME_OSX/bin:/opt/local/bin:/opt/local/Current_v15/bin:$PG_PERL_OSX/bin:$PATH LD_LIBRARY_PATH=/opt/local/Current_v15/lib:$LD_LIBRARY_PATH; CXXFLAGS="$PG_ARCH_OSX_CXXFLAGS" CFLAGS="$PG_ARCH_OSX_CFLAGS" LDFLAGS="-L/opt/local/Current_v15/lib" MACOSX_DEPLOYMENT_TARGET=$MACOSX_MIN_VERSION PROJ_CFLAGS="-I/opt/local/Current_v15/include" PROJ_LIBS="-L/opt/local/Current_v15/lib -lproj" ./configure --disable-extension-upgrades-install --enable-debug --with-pgconfig=$PG_PGHOME_OSX/bin/pg_config --with-geosconfig=/opt/local/Current_v15/bin/geos-config --with-projdir=/opt/local/Current_v15 --with-xsldir=$PG_DOCBOOK_OSX --with-gdalconfig=/opt/local/Current_v15/bin/gdal-config --with-xml2config=/opt/local/Current_v15/bin/xml2-config --with-libiconv=/opt/local/Current_v15 --with-jsondir=/opt/local/Current_v15 --without-protobuf --with-pcredir=/opt/local/Current_v15 --with-address_standardizer || _die "Failed to configure PostGIS"
echo "Building PostGIS"
echo "workaround: Patching topology Makefile to comment out the problematic lines"
sed -i '' '/prefix = /,+2 s/^/#/' topology/Makefile
LDFLAGS="-L/opt/local/Current_v15/lib" CFLAGS="$PG_ARCH_OSX_CFLAGS" MACOSX_DEPLOYMENT_TARGET=$MACOSX_MIN_VERSION make || _die "Failed to build PostGIS"
echo "Building comments"
make comments || _die "Failed to build comments"
#echo "Building comments"
#make comments || _die "Failed to build comments"
echo "Installing PostGIS"
echo "workaround: Patching topology Makefile to comment out the problematic lines"
sed -i '' '/top_builddir/,+3 s/^/#/' topology/Makefile
make install PGXSOVERRIDE=0 DESTDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS bindir=/bin pkglibdir=/lib/postgresql datadir=/share REGRESS=1 PGSQL_DOCDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/doc PGSQL_MANDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/man PGSQL_SHAREDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/share/postgresql || _die "Failed to install PostGIS"
echo "Installing comments"
make comments-install PGXSOVERRIDE=0 DESTDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS bindir=/bin pkglibdir=/lib datadir=/share REGRESS=1 PGSQL_DOCDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/doc PGSQL_MANDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/man PGSQL_SHAREDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/share/postgresql || _die "Failed to install PostGIS comments"
#echo "Installing comments"
#make comments-install PGXSOVERRIDE=0 DESTDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS bindir=/bin pkglibdir=/lib datadir=/share REGRESS=1 PGSQL_DOCDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/doc PGSQL_MANDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/man PGSQL_SHAREDIR=$PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/share/postgresql || _die "Failed to install PostGIS comments"

echo "Building postgis-doc"
cd $PG_PATH_OSX/PostGIS/source/postgis.osx/doc/html/image_src;
make clean
#cd $PG_PATH_OSX/PostGIS/source/postgis.osx/doc/html/image_src;
#make clean
LDFLAGS="-L/opt/local/Current_v15/lib" CFLAGS="$PG_ARCH_OSX_CFLAGS" MACOSX_DEPLOYMENT_TARGET=$MACOSX_MIN_VERSION make|| _die "Failed to build postgis-doc"
cd $PG_PATH_OSX/PostGIS/source/postgis.osx/doc;
LDFLAGS="-L/opt/local/Current_v15/lib" CFLAGS="$PG_ARCH_OSX_CFLAGS" MACOSX_DEPLOYMENT_TARGET=$MACOSX_MIN_VERSION make html || _die "Failed to build postgis-doc"
Expand All @@ -227,7 +227,7 @@ cat <<EOT-POSTGIS > $WD/PostGIS/build-postgis.sh
mkdir -p staging/osx.build/PostGIS/doc/postgis/
cp -pR source/postgis.osx/doc/html/images staging/osx.build/PostGIS/doc/postgis/
cp -pR source/postgis.osx/doc/html/postgis.html staging/osx.build/PostGIS/doc/postgis/
cp -pR source/postgis.osx/java/jdbc/src/main/javadoc/overview.html staging/osx.build/PostGIS/doc/postgis/
#cp -pR source/postgis.osx/java/jdbc/src/main/javadoc/overview.html staging/osx.build/PostGIS/doc/postgis/
cp -pR source/postgis.osx/doc/postgis-$PG_VERSION_POSTGIS.pdf staging/osx.build/PostGIS/doc/postgis/

mkdir -p staging/osx.build/PostGIS/man
Expand All @@ -238,16 +238,16 @@ cat <<EOT-POSTGIS > $WD/PostGIS/build-postgis.sh
cd $PG_PATH_OSX/PostGIS/source/postgis.osx/utils
cp *.pl $PG_STAGING/PostGIS/utils || _die "Failed to copy the utilities "

echo "Building postgis-jdbc"
cd $PG_PATH_OSX/PostGIS/source/postgis.osx/java/jdbc
CLASSPATH=$PG_PATH_OSX/PostGIS/source/postgis.osx/postgresql-$PG_JAR_POSTGRESQL.jar:\$CLASSPATH JAVA_HOME=$PG_JAVA_HOME_OSX $PG_MAVEN_HOME_OSX/bin/mvn -U clean install || _die "Failed to build postgis-jdbc jar."
#echo "Building postgis-jdbc"
#cd $PG_PATH_OSX/PostGIS/source/postgis.osx/java/jdbc
#CLASSPATH=$PG_PATH_OSX/PostGIS/source/postgis.osx/postgresql-$PG_JAR_POSTGRESQL.jar:\$CLASSPATH JAVA_HOME=$PG_JAVA_HOME_OSX $PG_MAVEN_HOME_OSX/bin/mvn -U clean install || _die "Failed to build postgis-jdbc jar."

mkdir -p $PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/java/jdbc
#mkdir -p $PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/java/jdbc

echo "Copying postgis-jdbc"
cd $PG_PATH_OSX/PostGIS/source/postgis.osx/java
cp jdbc/target/postgis*.jar $PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/java/jdbc || _die "Failed to copy postgis jars into postgis-jdbc"
cp -R ejb2 ejb3 $PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/java/ || _die "Failed to copy ejb2, ejb3 into postgis-java"
#echo "Copying postgis-jdbc"
#cd $PG_PATH_OSX/PostGIS/source/postgis.osx/java
#cp jdbc/target/postgis*.jar $PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/java/jdbc || _die "Failed to copy postgis jars into postgis-jdbc"
#cp -R ejb2 ejb3 $PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS/java/ || _die "Failed to copy ejb2, ejb3 into postgis-java"

EOT-POSTGIS

Expand Down Expand Up @@ -284,11 +284,16 @@ cat <<EOT-POSTGIS >> $WD/PostGIS/build-postgis.sh
cp -pR /opt/local/Current_v15/lib/libproj*dylib staging/osx.build/PostGIS/lib || _die "Failed to copy dependent libraries"
cp -pR /opt/local/Current_v15/lib/libgdal*dylib staging/osx.build/PostGIS/lib || _die "Failed to copy dependent libraries"
cp -pR /opt/local/Current_v15/lib/libcurl*dylib staging/osx.build/PostGIS/lib || _die "Failed to copy dependent libraries"
cp -pR /opt/local/Current_v15/lib/libpcre.*dylib staging/osx.build/PostGIS/lib || _die "Failed to copy dependent libraries"
cp -pR /opt/local/Current_v15/lib/libpcre2*dylib staging/osx.build/PostGIS/lib || _die "Failed to copy dependent libraries"
cp -pR /opt/local/Current_v15/lib/libjson-c.*dylib staging/osx.build/PostGIS/lib || _die "Failed to copy dependent (libjson-c) libraries"
cp -pR /opt/local/Current_v15/lib/libtiff.*dylib staging/osx.build/PostGIS/lib || _die "Failed to copy dependent (libtiff) libraries"
cp -pR /opt/local/Current_v15/lib/libjpeg.*dylib staging/osx.build/PostGIS/lib || _die "Failed to copy dependent (libjpeg) libraries"
cp -pR /opt/local/Current_v15/lib/libpng*.*dylib staging/osx.build/PostGIS/lib || _die "Failed to copy dependent (libpng) libraries"
cp -pR /opt/local/Current_v15/lib/libexpat*.*dylib staging/osx.build/PostGIS/lib || _die "Failed to copy dependent (expat) libraries"
cp -pR /opt/local/Current_v15/lib/libsqlite*.*dylib staging/osx.build/PostGIS/lib || _die "Failed to copy dependent (sqlite) libraries"
cp -pR /opt/local/Current_v15/share/proj staging/osx.build/PostGIS/share/ || _die "Failed to copy share/proj"
cp -pR /opt/local/Current_v15/share/gdal staging/osx.build/PostGIS/share/ || _die "Failed to copy share/gdal"


_rewrite_so_refs $PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS bin @loader_path/..
_rewrite_so_refs $PG_PATH_OSX/PostGIS/staging/osx.build/PostGIS lib @loader_path/..
Expand Down
12 changes: 6 additions & 6 deletions PostGIS/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ _prep_PostGIS() {
echo "Unpacking postgis source..."
extract_file ../../tarballs/postgis-$PG_VERSION_POSTGIS

echo "Extracting the postgis-java source..."
extract_file ../../tarballs/postgis-java-$PG_VERSION_POSTGIS_JAVA
mv postgis-java-$PG_VERSION_POSTGIS_JAVA postgis-$PG_VERSION_POSTGIS/java/
#echo "Extracting the postgis-java source..."
#extract_file ../../tarballs/postgis-java-$PG_VERSION_POSTGIS_JAVA
#mv postgis-java-$PG_VERSION_POSTGIS_JAVA postgis-$PG_VERSION_POSTGIS/java/

echo "Applying patches..."
#cd postgis-$PG_VERSION_POSTGIS
#patch -p1 < ~/tarballs/postgis-211-liblwgeom.patch

cd $WD/PostGIS/source

echo "Extracting the postgresql jar file..."
extract_file ../../tarballs/pgJDBC-$PG_VERSION_PGJDBC
mv pgJDBC-$PG_VERSION_PGJDBC/*.jar .
#echo "Extracting the postgresql jar file..."
#extract_file ../../tarballs/pgJDBC-$PG_VERSION_PGJDBC
#mv pgJDBC-$PG_VERSION_PGJDBC/*.jar .

# Per-platform prep
cd $WD
Expand Down
3 changes: 0 additions & 3 deletions PostGIS/installer.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -1089,9 +1089,6 @@ EOF
<distributionDirectory>
<origin>staging/osx/PostGIS/utils</origin>
</distributionDirectory>
<distributionDirectory>
<origin>staging/osx/PostGIS/java</origin>
</distributionDirectory>
<distributionDirectory>
<origin>staging/osx/PostGIS/man</origin>
</distributionDirectory>
Expand Down
2 changes: 1 addition & 1 deletion settings.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PG_PATH_OSX_NOTARY=/Users/buildfarm/pginstaller_15.notary
PG_PATH_OSX_SIGNTOOL=/opt/local/bin/osxsigner
PG_PGHOME_OSX=$PG_PATH_OSX/server/staging_cache/osx
PG_MAVEN_HOME_OSX=/opt/local/Current/apache-maven-3.8.2
PG_DOCBOOK_OSX=/usr/local/docbook-xsl-1.77.1
PG_DOCBOOK_OSX=/usr/local/Cellar/docbook-xsl/1.79.2_1/docbook-xsl
PG_CMAKE_OSX=/Applications/CMake.app/Contents/bin/cmake
PG_PERL_OSX=/Library/edb/languagepack/v3/Perl-5.36
PG_PYTHON_OSX=/Library/edb/languagepack/v3/Python-3.10
Expand Down
2 changes: 1 addition & 1 deletion versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ PG_MINOR_VERSION=10.1
# Other package versions
PG_VERSION_PGJDBC=42.7.2
PG_VERSION_PSQLODBC=15.00.0000
PG_VERSION_POSTGIS=3.3.1
PG_VERSION_POSTGIS=3.4.3
PG_VERSION_POSTGIS_JAVA=2.1.7.2
PG_VERSION_NPGSQL=3.2.6
PG_VERSION_PGAGENT=4.2.2
Expand Down