Skip to content

Commit

Permalink
- Build server with ICU on Mac
Browse files Browse the repository at this point in the history
- Fix the binary path issue on pgAdmin
- Remove .Trash file from server.img as hdiutil was throwing error
resize request is above maximum size allowed.
  • Loading branch information
sandeep-edb committed Jul 13, 2017
1 parent a3b861e commit e4dd33a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
11 changes: 7 additions & 4 deletions server/build-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ _build_server_osx() {

# Configure the source tree
echo "Configuring the postgres source tree for Intel"
ssh $PG_SSH_OSX "cd $PG_PATH_OSX/server/source/postgres.osx/; PATH=/opt/local/Current/bin:$PATH CFLAGS='$PG_ARCH_OSX_CFLAGS -arch i386 -O2' LDFLAGS="-L/opt/local/Current/lib" PYTHON=$PG_PYTHON_OSX/bin/python3 TCL_CONFIG_SH=$PG_TCL_OSX/lib/tclConfig.sh PERL=$PG_PERL_OSX/bin/perl ./configure --host=i386-apple-darwin --prefix=$PG_STAGING --with-ldap --with-openssl --with-perl --with-python --with-tcl --with-bonjour --with-pam --enable-thread-safety --with-libxml --with-uuid=e2fs --with-includes=/opt/local/Current/include/libxml2:/opt/local/Current/include:/opt/local/Current/include/security --docdir=$PG_STAGING/doc/postgresql --with-libxslt --with-libedit-preferred --with-gssapi" || _die "Failed to configure postgres for i386"
ssh $PG_SSH_OSX "cd $PG_PATH_OSX/server/source/postgres.osx/; PATH=/opt/local/Current/bin:$PATH CFLAGS='$PG_ARCH_OSX_CFLAGS -arch i386 -O2' LDFLAGS="-L/opt/local/Current/lib" PYTHON=$PG_PYTHON_OSX/bin/python3 TCL_CONFIG_SH=$PG_TCL_OSX/lib/tclConfig.sh PERL=$PG_PERL_OSX/bin/perl ICU_LIBS=\"-L/opt/local/Current/lib -licuuc -licudata -licui18n\" ICU_CFLAGS=\"-I/opt/local/Current/include\" ./configure --with-icu --host=i386-apple-darwin --prefix=$PG_STAGING --with-ldap --with-openssl --with-perl --with-python --with-tcl --with-bonjour --with-pam --enable-thread-safety --with-libxml --with-uuid=e2fs --with-includes=/opt/local/Current/include/libxml2:/opt/local/Current/include:/opt/local/Current/include/security --docdir=$PG_STAGING/doc/postgresql --with-libxslt --with-libedit-preferred --with-gssapi" || _die "Failed to configure postgres for i386"
ssh $PG_SSH_OSX "cd $PG_PATH_OSX/server/source/postgres.osx; mv src/include/pg_config.h src/include/pg_config_i386.h"

echo "Configuring the postgres source tree for x86_64"
ssh $PG_SSH_OSX "cd $PG_PATH_OSX/server/source/postgres.osx/; PATH=/opt/local/Current/bin:$PATH CFLAGS='$PG_ARCH_OSX_CFLAGS -arch x86_64 -O2' LDFLAGS="-L/opt/local/Current/lib" PYTHON=$PG_PYTHON_OSX/bin/python3 TCL_CONFIG_SH=$PG_TCL_OSX/lib/tclConfig.sh PERL=$PG_PERL_OSX/bin/perl ./configure --host=x86_64-apple-darwin --prefix=$PG_STAGING --with-ldap --with-openssl --with-perl --with-python --with-tcl --with-bonjour --with-pam --enable-thread-safety --with-libxml --with-uuid=e2fs --with-includes=/opt/local/Current/include/libxml2:/opt/local/Current/include:/opt/local/Current/include/security --docdir=$PG_STAGING/doc/postgresql --with-libxslt --with-libedit-preferred --with-gssapi" || _die "Failed to configure postgres for x86_64"
ssh $PG_SSH_OSX "cd $PG_PATH_OSX/server/source/postgres.osx/; PATH=/opt/local/Current/bin:$PATH CFLAGS='$PG_ARCH_OSX_CFLAGS -arch x86_64 -O2' LDFLAGS="-L/opt/local/Current/lib" PYTHON=$PG_PYTHON_OSX/bin/python3 TCL_CONFIG_SH=$PG_TCL_OSX/lib/tclConfig.sh PERL=$PG_PERL_OSX/bin/perl ICU_LIBS=\"-L/opt/local/Current/lib -licuuc -licudata -licui18n\" ICU_CFLAGS=\"-I/opt/local/Current/include\" ./configure --with-icu --host=x86_64-apple-darwin --prefix=$PG_STAGING --with-ldap --with-openssl --with-perl --with-python --with-tcl --with-bonjour --with-pam --enable-thread-safety --with-libxml --with-uuid=e2fs --with-includes=/opt/local/Current/include/libxml2:/opt/local/Current/include:/opt/local/Current/include/security --docdir=$PG_STAGING/doc/postgresql --with-libxslt --with-libedit-preferred --with-gssapi" || _die "Failed to configure postgres for x86_64"
ssh $PG_SSH_OSX "cd $PG_PATH_OSX/server/source/postgres.osx; mv src/include/pg_config.h src/include/pg_config_x86_64.h"

echo "Configuring the postgres source tree for Universal"
ssh $PG_SSH_OSX "cd $PG_PATH_OSX/server/source/postgres.osx/; PATH=/opt/local/Current/bin:$PATH CFLAGS='$PG_ARCH_OSX_CFLAGS -arch i386 -arch x86_64 -O2' LDFLAGS="-L/opt/local/Current/lib" PYTHON=$PG_PYTHON_OSX/bin/python3 TCL_CONFIG_SH=$PG_TCL_OSX/lib/tclConfig.sh PERL=$PG_PERL_OSX/bin/perl ./configure --prefix=$PG_STAGING --with-ldap --with-openssl --with-perl --with-python --with-tcl --with-bonjour --with-pam --enable-thread-safety --with-libxml --with-uuid=e2fs --with-includes=/opt/local/Current/include/libxml2:/opt/local/Current/include:/opt/local/Current/include/security --docdir=$PG_STAGING/doc/postgresql --with-libxslt --with-libedit-preferred --with-gssapi" || _die "Failed to configure postgres for Universal"
ssh $PG_SSH_OSX "cd $PG_PATH_OSX/server/source/postgres.osx/; PATH=/opt/local/Current/bin:$PATH CFLAGS='$PG_ARCH_OSX_CFLAGS -arch i386 -arch x86_64 -O2' LDFLAGS="-L/opt/local/Current/lib" PYTHON=$PG_PYTHON_OSX/bin/python3 TCL_CONFIG_SH=$PG_TCL_OSX/lib/tclConfig.sh PERL=$PG_PERL_OSX/bin/perl ICU_LIBS=\"-L/opt/local/Current/lib -licuuc -licudata -licui18n\" ICU_CFLAGS=\"-I/opt/local/Current/include\" ./configure --with-icu --prefix=$PG_STAGING --with-ldap --with-openssl --with-perl --with-python --with-tcl --with-bonjour --with-pam --enable-thread-safety --with-libxml --with-uuid=e2fs --with-includes=/opt/local/Current/include/libxml2:/opt/local/Current/include:/opt/local/Current/include/security --docdir=$PG_STAGING/doc/postgresql --with-libxslt --with-libedit-preferred --with-gssapi" || _die "Failed to configure postgres for Universal"

# Create a replacement pg_config.h that will pull in the appropriate architecture-specific one:
cat <<EOT > "/tmp/pg_config.h"
Expand Down Expand Up @@ -373,6 +373,9 @@ EOT-PGADMIN
ssh $PG_SSH_OSX "cp -pR /opt/local/Current/lib/libexpat*.dylib $PG_STAGING/lib/" || _die "Failed to copy the latest libexpat"
ssh $PG_SSH_OSX "cp -pR /opt/local/Current/lib/libintl.*dylib $PG_STAGING/lib/" || _die "Failed to copy the latest libintl"
ssh $PG_SSH_OSX "cp -pR /opt/local/Current/lib/libcurl*dylib $PG_STAGING/lib/" || _die "Failed to copy the latest libcurl"
ssh $PG_SSH_OSX "cp -pR /opt/local/Current/lib/libicui18n*dylib $PG_STAGING/lib/" || _die "Failed to copy the latest libicui18n"
ssh $PG_SSH_OSX "cp -pR /opt/local/Current/lib/libicudata*dylib $PG_STAGING/lib/" || _die "Failed to copy the latest libicudata"
ssh $PG_SSH_OSX "cp -pR /opt/local/Current/lib/libicuuc*dylib $PG_STAGING/lib/" || _die "Failed to copy the latest libicuuc"

ssh $PG_SSH_OSX "cp -pR /opt/local/Current/lib/libwx_macu_adv-*.dylib $PG_STAGING/lib/" || _die "Failed to copy the latest libuuid"
ssh $PG_SSH_OSX "cp -pR /opt/local/Current/lib/libwx_macu_core-*.dylib $PG_STAGING/lib/" || _die "Failed to copy the latest libuuid"
Expand Down Expand Up @@ -688,7 +691,7 @@ _postprocess_server_osx() {
scp server.img.tar.bz2 $PG_SSH_OSX:$PG_PATH_OSX/output || _die "faled to copy server.img.tar.bz2 to $PG_PATH_OSX/output"
rm -rf server.img* || _die "Failed to remove server.img from output directory."

ssh $PG_SSH_OSX "cd $PG_PATH_OSX/output; source $PG_PATH_OSX/versions.sh; tar -jxvf server.img.tar.bz2; touch server.img/.Trash; hdiutil create -quiet -anyowners -srcfolder server.img -format UDZO -volname 'PostgreSQL $PG_PACKAGE_VERSION' -ov 'postgresql-$PG_PACKAGE_VERSION-osx.dmg'" || _die "Failed to create the disk image (postgresql-$PG_PACKAGE_VERSION-osx.dmg)"
ssh $PG_SSH_OSX "cd $PG_PATH_OSX/output; source $PG_PATH_OSX/versions.sh; tar -jxvf server.img.tar.bz2; hdiutil create -quiet -anyowners -srcfolder server.img -format UDZO -volname 'PostgreSQL $PG_PACKAGE_VERSION' -ov 'postgresql-$PG_PACKAGE_VERSION-osx.dmg'" || _die "Failed to create the disk image (postgresql-$PG_PACKAGE_VERSION-osx.dmg)"

echo "Attach the disk image, create zip and then detach the image"
ssh $PG_SSH_OSX "cd $PG_PATH_OSX/output; hdid postgresql-$PG_PACKAGE_VERSION-osx.dmg" || _die "Failed to open the disk image (postgresql-$PG_PACKAGE_VERSION-osx.dmg in remote host.)"
Expand Down
17 changes: 14 additions & 3 deletions server/installer.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -765,8 +765,19 @@ EOF
<compareText text="${platform_name}" logic="equals" value="windows"/>
</ruleList>
</setInstallerVariableFromRegEx>
<readFile path="${installdir}${slash}pgAdmin 4${slash}web${slash}config_distro.py" name="config_distro_content"/>
<addTextToFile file="${installdir}${slash}pgAdmin 4${slash}web${slash}config_distro.py" insertAt="end">
<setInstallerVariable name="config_disto_file" value="${installdir}${slash}pgAdmin 4${slash}web${slash}config_distro.py">
<ruleList>
<compareText text="${platform_name}" logic="does_not_equal" value="osx"/>
</ruleList>
</setInstallerVariable>
<setInstallerVariable name="config_disto_file" value="${installdir}${slash}pgAdmin 4.app${slash}Contents${slash}Resources${slash}web{slash}config_distro.py">
<ruleList>
<compareText text="${platform_name}" logic="equals" value="osx"/>
</ruleList>
</setInstallerVariable>

<readFile path="${config_disto_file}" name="config_distro_content"/>
<addTextToFile file="${config_disto_file}" insertAt="end">
<text>DEFAULT_BINARY_PATHS = {
"pg": "${server_install_path}",
"ppas": ""
Expand All @@ -778,7 +789,7 @@ EOF
</addTextToFile>
</actionList>
<ruleList>
<fileExists path="${installdir}${slash}pgAdmin 4${slash}web${slash}config_distro.py"/>
<fileExists path="${config_disto_file}"/>
<fileExists path="${installdir}${slash}bin${slash}${test_filename}"/>
<isFalse value="${extract_mode}"/>
</ruleList>
Expand Down

0 comments on commit e4dd33a

Please sign in to comment.