2016-06-02 07:56:56 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Build script to create Mac App Bundle and DMG for pgAdmin4 runtime
|
|
|
|
|
2020-05-18 04:22:59 -05:00
|
|
|
# Exit when any command fails
|
|
|
|
set -e -E
|
2016-06-02 07:56:56 -05:00
|
|
|
|
2020-05-18 04:22:59 -05:00
|
|
|
# Debugging shizz
|
|
|
|
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
|
|
|
|
trap 'if [ $? -ne 0 ]; then echo "\"${last_command}\" command filed with exit code $?."; fi' EXIT
|
|
|
|
|
|
|
|
SCRIPT_DIR=$(cd `dirname $0` && pwd)
|
|
|
|
SOURCE_DIR=$(realpath ${SCRIPT_DIR}/../..)
|
|
|
|
BUILD_ROOT=$(realpath ${SCRIPT_DIR}/../..)/mac-build
|
|
|
|
DIST_ROOT=$(realpath ${SCRIPT_DIR}/../..)/dist
|
|
|
|
|
|
|
|
if [ ! -f ${SCRIPT_DIR}/framework.conf ]; then
|
2017-02-16 05:25:32 -06:00
|
|
|
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
|
|
|
|
|
2020-05-18 04:22:59 -05:00
|
|
|
CODESIGN=1
|
|
|
|
if [ ! -f ${SCRIPT_DIR}/codesign.conf ]; then
|
|
|
|
echo
|
|
|
|
echo "******************************************************************"
|
|
|
|
echo "* ${SCRIPT_DIR}/codesign.conf not found. NOT signing the binaries."
|
|
|
|
echo "******************************************************************"
|
|
|
|
echo
|
|
|
|
CODESIGN=0
|
|
|
|
sleep 5
|
|
|
|
else
|
|
|
|
source ${SCRIPT_DIR}/codesign.conf
|
2016-06-02 07:56:56 -05:00
|
|
|
fi
|
|
|
|
|
2020-05-18 04:22:59 -05:00
|
|
|
if [ "x${PGADMIN_PYTHON_DIR}" == "x" ]; then
|
|
|
|
echo "PGADMIN_PYTHON_DIR not set. Setting it to the default: /usr/local/python"
|
|
|
|
export PGADMIN_PYTHON_DIR=/usr/local/python
|
|
|
|
fi
|
|
|
|
PYTHON_EXE=${PGADMIN_PYTHON_DIR}/bin/python3
|
|
|
|
|
2016-06-02 07:56:56 -05:00
|
|
|
# Check if Python is working and calculate PYTHON_VERSION
|
2020-05-18 04:22:59 -05:00
|
|
|
if ${PYTHON_EXE} -V > /dev/null 2>&1; then
|
|
|
|
PYTHON_VERSION=`${PYTHON_EXE} -V 2>&1 | awk '{print $2}' | cut -d"." -f1-2 | sed 's/\.//'`
|
2016-06-02 07:56:56 -05:00
|
|
|
else
|
|
|
|
echo "Error: Python installation missing!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-05-18 04:22:59 -05:00
|
|
|
if [ "${PYTHON_VERSION}" -gt "38" ] && [ "${PYTHON_VERSION}" -lt "34" ]; then
|
2020-05-04 08:56:28 -05:00
|
|
|
echo "Python version not supported."
|
2016-06-02 07:56:56 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-05-18 04:22:59 -05:00
|
|
|
if [ "x${PGADMIN_QT_DIR}" == "x" ]; then
|
|
|
|
echo "PGADMIN_QT_DIR not set. Setting it to the default: ~/Qt/5.13.2/clang_64"
|
|
|
|
export PGADMIN_QT_DIR=~/Qt/5.13.2/clang_64
|
2016-06-02 07:56:56 -05:00
|
|
|
fi
|
2020-05-18 04:22:59 -05:00
|
|
|
|
|
|
|
QMAKE=${PGADMIN_QT_DIR}/bin/qmake
|
2019-03-21 09:02:19 -05:00
|
|
|
if ! ${QMAKE} --version > /dev/null 2>&1; then
|
2016-06-02 07:56:56 -05:00
|
|
|
echo "Error: qmake not found. QT installation is not present or incomplete."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-05-18 04:22:59 -05:00
|
|
|
if [ "x${PGADMIN_POSTGRES_DIR}" == "x" ]; then
|
|
|
|
echo "PGADMIN_POSTGRES_DIR not set. Setting it to the default: /usr/local/pgsql"
|
|
|
|
export PGADMIN_POSTGRES_DIR=/usr/local/pgsql
|
2016-06-02 07:56:56 -05:00
|
|
|
fi
|
|
|
|
|
2020-05-18 04:22:59 -05:00
|
|
|
source ${SCRIPT_DIR}/build-functions.sh
|
2016-10-04 06:50:16 -05:00
|
|
|
|
2020-05-18 04:22:59 -05:00
|
|
|
_setup_env
|
2016-06-02 07:56:56 -05:00
|
|
|
_cleanup
|
2020-05-18 04:22:59 -05:00
|
|
|
_create_venv
|
|
|
|
_build_runtime
|
|
|
|
_build_docs
|
2016-06-02 07:56:56 -05:00
|
|
|
_complete_bundle
|
2017-02-16 05:25:32 -06:00
|
|
|
_framework_config
|
2020-01-03 03:56:45 -06:00
|
|
|
_codesign_binaries
|
2016-10-04 06:50:16 -05:00
|
|
|
_codesign_bundle
|
2016-06-02 07:56:56 -05:00
|
|
|
_create_dmg
|
2017-02-26 03:06:17 -06:00
|
|
|
_codesign_dmg
|