mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-12-25 08:21:04 -06:00
Ensure the Mac Appbundle builds correctly both with and without code signing.
Correct current versions of Python/Qt while we're passing.
This commit is contained in:
parent
9ad1316990
commit
e3041f1113
2
.gitignore
vendored
2
.gitignore
vendored
@ -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
|
||||
|
6
README
6
README
@ -239,6 +239,12 @@ 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:
|
||||
|
||||
|
@ -8,6 +8,14 @@ export BUILDROOT=$WD/../../mac-build
|
||||
export DISTROOT=$WD/../../dist
|
||||
export VIRTUALENV=venv
|
||||
|
||||
if [ ! -f $SOURCEDIR/pkg/mac/framework.conf ]; then
|
||||
echo
|
||||
echo "Error: pkg/mac/framework.conf not found!"
|
||||
echo "Copy pkg/mac/framework.conf.in to pkg/mac/framework.conf and edit as required for the current system."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x$PYTHON_HOME" == "x" ]; then
|
||||
echo "PYTHON_HOME not set. Setting it to default"
|
||||
export PYTHON_HOME=/System/Library/Frameworks/Python.framework/Versions/2.7
|
||||
@ -24,7 +32,7 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$PYTHON_VERSION" -gt "35" -a "$PYTHON_VERSION" -lt "26" ]; then
|
||||
if [ "$PYTHON_VERSION" -gt "36" -a "$PYTHON_VERSION" -lt "26" ]; then
|
||||
echo "Python version not supported"
|
||||
exit 1
|
||||
fi
|
||||
@ -41,7 +49,7 @@ fi
|
||||
|
||||
if [ "x$QTDIR" == "x" ]; then
|
||||
echo "QTDIR not set. Setting it to default"
|
||||
export QTDIR=~/Qt/5.7/clang_64
|
||||
export QTDIR=~/Qt/5.8/clang_64
|
||||
fi
|
||||
export QMAKE=$QTDIR/bin/qmake
|
||||
if ! $QMAKE --version > /dev/null 2>&1; then
|
||||
@ -175,9 +183,14 @@ _complete_bundle() {
|
||||
find . -name *.pyc | xargs rm -f
|
||||
}
|
||||
|
||||
_framework_config() {
|
||||
cd $SOURCEDIR/pkg/mac
|
||||
./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 +201,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 +232,7 @@ _cleanup
|
||||
_build_runtime || { echo Runtime build failed; exit 1; }
|
||||
_build_doc
|
||||
_complete_bundle
|
||||
_framework_config
|
||||
_codesign_bundle
|
||||
_create_dmg
|
||||
_codesign_dmg
|
@ -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}"
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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 \
|
||||
|
71
pkg/mac/framework-config.sh
Executable file
71
pkg/mac/framework-config.sh
Executable file
@ -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
|
10
pkg/mac/framework.conf.in
Normal file
10
pkg/mac/framework.conf.in
Normal file
@ -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.10
|
||||
|
||||
QT_SHORT_VERSION=5.8
|
||||
QT_FULL_VERSION=5.8.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user