From e5573ab8c120ade79c2dcbc16dd16b640514b999 Mon Sep 17 00:00:00 2001 From: "George Gelashvili, Sarah McAlear and Tira Odhner" Date: Tue, 14 Feb 2017 10:08:44 -0500 Subject: [PATCH] Fixes QT build. requires mac/pkg/codesign.conf --- .gitignore | 2 ++ README | 4 +++ pkg/mac/build.sh | 21 ++++++++++++-- pkg/mac/codesign-bundle.sh | 55 ----------------------------------- pkg/mac/codesign.conf.in | 10 ------- pkg/mac/complete-bundle.sh | 1 + pkg/mac/framework-config.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++ pkg/mac/framework.conf.in | 10 +++++++ 8 files changed, 107 insertions(+), 67 deletions(-) create mode 100755 pkg/mac/framework-config.sh create mode 100644 pkg/mac/framework.conf.in diff --git a/.gitignore b/.gitignore index 0ae80985..53010caf 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ _build build-* pgadmin4.log pkg/win32/installer.iss +pkg/mac/codesign.conf +pkg/mac/framework.conf runtime/.qmake.cache runtime/.qmake.stash runtime/Makefile diff --git a/README b/README index 5675e5fe..3fad71c6 100644 --- a/README +++ b/README @@ -239,6 +239,10 @@ On a Mac, build an application bundle in a disk image (DMG file) with: (pgadmin4) $ make appbundle +Configure the framework.conf to match the QT and Python versions the app is being built with: + $ cp $PGADMIN4_SRC/pkg/mac/framework.conf.in $PGADMIN4_SRC/pkg/mac/framework.conf + $ vi $PGADMIN4_SRC/pkg/mac/framework.conf + If you have an Apple code signing certificate, both the app bundle and disk image can be automatically signed by configuring signing: diff --git a/pkg/mac/build.sh b/pkg/mac/build.sh index 430d0635..fefc4628 100755 --- a/pkg/mac/build.sh +++ b/pkg/mac/build.sh @@ -175,9 +175,25 @@ _complete_bundle() { find . -name *.pyc | xargs rm -f } +_framework_config() { + cd $SOURCEDIR/pkg/mac + + if [ ! -f framework.conf ]; then + echo + echo "******************************************************************" + echo "* framework-config.sh failed: framework.conf not present." + echo "* See: framework.conf.in" + echo "******************************************************************" + echo + exit 1 + fi + + ./framework-config.sh "$BUILDROOT/$APP_BUNDLE_NAME" || { echo "framework-config.sh failed"; exit 1; } +} + _codesign_bundle() { cd $SOURCEDIR/pkg/mac - + if [ ! -f codesign.conf ]; then echo echo "******************************************************************" @@ -188,7 +204,7 @@ _codesign_bundle() { return fi - ./codesign-bundle.sh "$BUILDROOT/$APP_BUNDLE_NAME" || { echo codesign-bundle.sh failed; exit 1; } + ./codesign-bundle.sh "$BUILDROOT/$APP_BUNDLE_NAME" || { echo codesign-bundle.sh failed; exit 1; } } _create_dmg() { @@ -219,6 +235,7 @@ _cleanup _build_runtime || { echo Runtime build failed; exit 1; } _build_doc _complete_bundle +_framework_config _codesign_bundle _create_dmg _codesign_dmg \ No newline at end of file diff --git a/pkg/mac/codesign-bundle.sh b/pkg/mac/codesign-bundle.sh index 360c2536..04abeb0e 100755 --- a/pkg/mac/codesign-bundle.sh +++ b/pkg/mac/codesign-bundle.sh @@ -10,61 +10,6 @@ fi # Get the config source codesign.conf -SCRIPT_DIR=`pwd` - -echo Reorganising the framework structure - -# Create "Current" and "Current/Resources" inside each of the framework dirs -MYDIR=`pwd` -find "${BUNDLE}/Contents/Frameworks"/*framework -type d -name "Versions" | while read -r myVar; do - cd "${myVar}" - - # Create framework 'Current' soft link - VERSION_NUMBER=`ls -1` - ln -s $VERSION_NUMBER Current - - # Create "Resources" subdirectory - if [ ! -d Current/Resources ]; then - mkdir Current/Resources - fi - - cd "${MYDIR}" -done - -# Stuff for Qt framework files only -find "${BUNDLE}/Contents/Frameworks" -type d -name "Qt*framework" | while read -r myVar; do - cd "${myVar}" - - # Create soft link to the framework binary - ln -s Versions/Current/Qt* - - # Create soft link to the framework Resources dir - ln -s Versions/Current/Resources - - # Create the Info.plist files - MYNAME=`ls -1 Qt*` - sed 's/__SHORT_VERSION__/${QT_SHORT_VERSION}/' "${SCRIPT_DIR}/Info.plist-template_Qt5" | sed 's/__FULL_VERSION__/${QT_FULL_VERSION}/' | sed "s/__FRAMEWORK_NAME__/${MYNAME}/" > "Resources/Info.plist" - - cd "${MYDIR}" -done - -# Same thing, but specific to the Python framework dir -find "${BUNDLE}/Contents/Frameworks" -type d -name "P*framework" | while read -r myVar; do - cd "${myVar}" - - # Create soft link to the framework binary - ln -s Versions/Current/Py* - - # Create soft link to the framework Resources dir - ln -s Versions/Current/Resources - - # Create the Info.plist file - MYNAME=`ls -1 Py*` - sed 's/__SHORT_VERSION__/${PYTHON_SHORT_VERSION}/' "${SCRIPT_DIR}/Info.plist-template_Python" | sed 's/__FULL_VERSION__/${PYTHON_FULL_VERSION}/' | sed "s/__FRAMEWORK_NAME__/${MYNAME}/" > "Resources/Info.plist" - - cd "${MYDIR}" -done - # Sign the .app echo Signing ${BUNDLE} codesign --sign "${DEVELOPER_ID}" --verbose --deep --force "${BUNDLE}" diff --git a/pkg/mac/codesign.conf.in b/pkg/mac/codesign.conf.in index 73c4a6ce..9951ee94 100644 --- a/pkg/mac/codesign.conf.in +++ b/pkg/mac/codesign.conf.in @@ -2,13 +2,3 @@ # codesign.conf, and edit the value below to reflect your developer ID DEVELOPER_ID="Developer ID Application: My Name (12345ABCD)" - -# Edit the settings below if different versions of Python/Qt are used - -PYTHON_SHORT_VERSION=2.7 -PYTHON_FULL_VERSION=2.7.0 - -QT_SHORT_VERSION=5.5 -QT_FULL_VERSION=5.5.1 - - diff --git a/pkg/mac/complete-bundle.sh b/pkg/mac/complete-bundle.sh index a476f30c..31b92b35 100755 --- a/pkg/mac/complete-bundle.sh +++ b/pkg/mac/complete-bundle.sh @@ -121,6 +121,7 @@ function CompleteSingleApp() { if echo $lib | grep Python > /dev/null ; then fw_relpath="$fw_relpath/$pyfw_path" fi + chmod +w $todo_obj echo "Rewriting library $lib to @loader_path/$fw_relpath/$lib_bn in $todo_obj" echo install_name_tool -change "$lib" "@loader_path/$fw_relpath/$lib_bn" "$todo_obj" install_name_tool -change \ diff --git a/pkg/mac/framework-config.sh b/pkg/mac/framework-config.sh new file mode 100755 index 00000000..3c1f21b2 --- /dev/null +++ b/pkg/mac/framework-config.sh @@ -0,0 +1,71 @@ +#!/bin/sh + +BUNDLE="$1" + +if ! test -d "${BUNDLE}" ; then + echo "${BUNDLE} is no bundle!" >&2 + exit 1 +fi + +# Get the config +source framework.conf + +SCRIPT_DIR=`pwd` + +echo Reorganising the framework structure + +# Create "Current" and "Current/Resources" inside each of the framework dirs +MYDIR=`pwd` +find "${BUNDLE}/Contents/Frameworks"/*framework -type d -name "Versions" | while read -r framework_dir; do + cd "${framework_dir}" + + # Create framework 'Current' soft link + VERSION_NUMBER=`ls -1` + ln -s $VERSION_NUMBER Current || { echo "link creation in framework-config.sh failed"; exit 1; } + + # Create "Resources" subdirectory + if [ ! -d Current/Resources ]; then + mkdir Current/Resources + fi + + cd "${MYDIR}" +done + +# Stuff for Qt framework files only +find "${BUNDLE}/Contents/Frameworks" -type d -name "Qt*framework" | while read -r framework_dir; do + cd "${framework_dir}" + + # Create soft link to the framework binary + ln -s Versions/Current/Qt* || { echo "link creation in framework-config.sh failed"; exit 1; } + + # Create soft link to the framework Resources dir + ln -s Versions/Current/Resources || { echo "link creation in framework-config.sh failed"; exit 1; } + + # Create the Info.plist files + MYNAME=`ls -1 Qt*` + if [ -f Resources/Info.plist ]; then + chmod +w Resources/Info.plist + fi + sed 's/__SHORT_VERSION__/${QT_SHORT_VERSION}/' "${SCRIPT_DIR}/Info.plist-template_Qt5" | sed 's/__FULL_VERSION__/${QT_FULL_VERSION}/' | sed "s/__FRAMEWORK_NAME__/${MYNAME}/" > "Resources/Info.plist" || { echo "sed replacement in framework-config.sh failed"; exit 1; } + + cd "${MYDIR}" +done + +# Same thing, but specific to the Python framework dir +find "${BUNDLE}/Contents/Frameworks" -type d -name "P*framework" | while read -r framework_dir; do + cd "${framework_dir}" + + # Create soft link to the framework binary + ln -s Versions/Current/Py* || { echo "link creation in framework-config.sh failed"; exit 1; } + + # Create soft link to the framework Resources dir + ln -s Versions/Current/Resources || { echo "link creation in framework-config.sh failed"; exit 1; } + + # Create the Info.plist file + MYNAME=`ls -1 Py*` + sed 's/__SHORT_VERSION__/${PYTHON_SHORT_VERSION}/' "${SCRIPT_DIR}/Info.plist-template_Python" | sed 's/__FULL_VERSION__/${PYTHON_FULL_VERSION}/' | sed "s/__FRAMEWORK_NAME__/${MYNAME}/" > "Resources/Info.plist" || { echo "sed replacement in framework-config.sh failed"; exit 1; } + + cd "${MYDIR}" +done + +echo ${BUNDLE} framework config finished diff --git a/pkg/mac/framework.conf.in b/pkg/mac/framework.conf.in new file mode 100644 index 00000000..cb190715 --- /dev/null +++ b/pkg/mac/framework.conf.in @@ -0,0 +1,10 @@ +# copy this file to framework.conf, and edit the values below to reflect your environment +# (versions of Python/Qt used) + +PYTHON_SHORT_VERSION=2.7 +PYTHON_FULL_VERSION=2.7.0 + +QT_SHORT_VERSION=5.5 +QT_FULL_VERSION=5.5.1 + + -- 2.11.0