2010-04-09 12:09:11 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# set -x
|
|
|
|
|
|
|
|
# This script automates creating universal binaries of LyX on Mac.
|
|
|
|
# Author: Bennett Helm (and extended by Konrad Hofbauer)
|
2011-02-18 08:55:24 +00:00
|
|
|
# latest changes by Stephan Witt
|
2020-02-20 09:46:22 +00:00
|
|
|
# Last modified: February 2020
|
2010-06-06 19:09:22 +00:00
|
|
|
|
2014-07-20 16:16:36 +00:00
|
|
|
QtAPI=${QtAPI:-"-cocoa"}
|
|
|
|
QtVersion=${QtVersion:-"4.6.3"}
|
2020-02-06 21:16:13 +00:00
|
|
|
QtSourceVersion=${QtSourceVersion:-"qt-everywhere-opensource-src-${QtVersion}"}
|
2014-07-20 16:16:36 +00:00
|
|
|
QtBuildSubDir="qt-${QtVersion}-build${QtAPI}"
|
|
|
|
QtConfigureOptions=${QtConfigureOptions:-"-release"}
|
2020-02-06 21:19:15 +00:00
|
|
|
QtSkipComponents=${QtSkipComponents:-"qtconnectivity qtscript qtquickcontrols qtmultimedia qtvirtualkeyboard qtwayland qtwebengine"}
|
2014-08-22 07:52:39 +00:00
|
|
|
LibMagicVersion=${LibMagicVersion:-"5.19"}
|
|
|
|
LibMagicSource="file-${LibMagicVersion}"
|
|
|
|
LibMagicLibrary="libmagic.1.dylib"
|
2013-01-18 20:15:40 +00:00
|
|
|
|
|
|
|
ASpellVersion=${ASpellVersion:-"0.60.6.1"}
|
|
|
|
ASpellSource="aspell-${ASpellVersion}"
|
|
|
|
ASpellLibrary="libaspell.15.dylib"
|
|
|
|
|
2016-05-29 18:38:57 +00:00
|
|
|
HunSpellVersion=${HunSpellVersion:-"1.3.3"}
|
2013-01-18 20:15:40 +00:00
|
|
|
HunSpellSource="hunspell-${HunSpellVersion}"
|
2016-08-22 07:02:50 +00:00
|
|
|
HunSpellLibrary="libhunspell-1.3.0.dylib"
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2012-09-23 13:02:46 +00:00
|
|
|
unset DYLD_LIBRARY_PATH LD_LIBRARY_PATH
|
|
|
|
|
2010-04-09 12:09:11 +00:00
|
|
|
# Prerequisite:
|
|
|
|
# * a decent checkout of LyX sources (probably you have it already)
|
2014-07-20 16:16:36 +00:00
|
|
|
# * Qt - build with shared or static libraries for the used platforms (default: i386 and ppc)
|
|
|
|
# or - an unpacked source tree of Qt in $QTSOURCEDIR or in the sibling directory (variable QtSourceVersion)
|
2010-04-09 12:09:11 +00:00
|
|
|
# * for aspell support:
|
2013-01-18 20:15:40 +00:00
|
|
|
# the aspell sources placed in a sibling directory (variable ASpellSource)
|
2010-05-29 14:36:51 +00:00
|
|
|
# * for hunspell support:
|
2013-01-18 20:15:40 +00:00
|
|
|
# the hunspell sources placed in a sibling directory (variable HunSpellSource)
|
2015-11-30 08:27:35 +00:00
|
|
|
# * for dictionary deployment (only hunspell dicts and mythes thesauri are deployed per default):
|
2010-05-29 14:36:51 +00:00
|
|
|
# - aspell: the dictionary files of macports (in /opt/local/share/aspell and /opt/local/lib/aspell-0.60)
|
2011-02-18 08:55:24 +00:00
|
|
|
# - hunspell: the dictionary files in the sibling directory dictionaries/dicts
|
|
|
|
# - mythes: the data and idx files in the sibling directory dictionaries/thes
|
2014-08-22 07:52:39 +00:00
|
|
|
# * for magic file type detection support:
|
|
|
|
# the libmagic sources placed in a sibling directory (variable LibMagicSource)
|
2010-05-29 14:36:51 +00:00
|
|
|
|
2013-01-18 20:15:40 +00:00
|
|
|
LyXConfigureOptions="--enable-warnings --enable-optimization=-Os --with-x=no"
|
|
|
|
LyXConfigureOptions="${LyXConfigureOptions} --disable-stdlib-debug"
|
2010-06-06 19:09:22 +00:00
|
|
|
AspellConfigureOptions="--enable-warnings --enable-optimization=-O0 --enable-debug --disable-nls --enable-compile-in-filters --disable-pspell-compatibility"
|
2013-01-18 20:15:40 +00:00
|
|
|
HunspellConfigureOptions="--with-warnings --disable-nls --disable-static"
|
|
|
|
|
2021-12-06 06:51:26 +00:00
|
|
|
QtMajorVersion=$(echo "${QtVersion}"|cut -d. -f1)
|
2014-08-22 07:58:32 +00:00
|
|
|
QtConfigureOptions="${QtConfigureOptions} -opensource -silent -shared -confirm-license"
|
2013-01-18 20:15:40 +00:00
|
|
|
# stupid special case...
|
2014-07-20 16:16:36 +00:00
|
|
|
case "${QtVersion}:${QtAPI}" in
|
2013-01-18 20:15:40 +00:00
|
|
|
4.6*:-carbon)
|
2014-08-22 07:58:32 +00:00
|
|
|
QtConfigureOptions="${QtConfigureOptions} -fast -no-exceptions"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -no-webkit -no-qt3support -no-javascript-jit -no-dbus"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -nomake examples -nomake demos -nomake docs -nomake tools"
|
2015-11-20 19:51:47 +00:00
|
|
|
for arch in ${ARCH_LIST} ; do
|
|
|
|
QTARCHS="${QTARCHS} -arch ${arch}"
|
|
|
|
done
|
2013-01-18 20:15:40 +00:00
|
|
|
;;
|
2013-02-03 11:23:31 +00:00
|
|
|
5.0*)
|
2014-08-22 07:58:32 +00:00
|
|
|
QtConfigureOptions="${QtConfigureOptions} -fast -no-strip"
|
2014-07-20 16:16:36 +00:00
|
|
|
QtConfigureOptions="${QtConfigureOptions} -no-javascript-jit -no-pkg-config"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -nomake examples -nomake demos -nomake docs -nomake tools"
|
2014-03-04 21:28:17 +00:00
|
|
|
;;
|
2017-01-14 15:05:50 +00:00
|
|
|
5.6*|5.7*)
|
2015-10-24 18:48:08 +00:00
|
|
|
QtConfigureOptions="${QtConfigureOptions} -no-strip"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -no-kms -no-pkg-config"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -nomake examples -nomake tools"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -skip qtconnectivity -skip qtscript"
|
2016-02-28 10:34:06 +00:00
|
|
|
QtConfigureOptions="${QtConfigureOptions} -skip qtquickcontrols"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -skip qttools"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -skip qtdeclarative"
|
2015-10-24 18:48:08 +00:00
|
|
|
;;
|
2014-03-04 21:28:17 +00:00
|
|
|
5.*)
|
2014-08-22 07:58:32 +00:00
|
|
|
QtConfigureOptions="${QtConfigureOptions} -no-strip"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -no-kms -no-pkg-config"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -nomake examples -nomake tools"
|
2020-02-06 21:19:15 +00:00
|
|
|
for component in ${QtSkipComponents} ; do
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -skip ${component}"
|
|
|
|
done
|
2013-02-03 11:23:31 +00:00
|
|
|
;;
|
2013-01-18 20:15:40 +00:00
|
|
|
*)
|
2014-08-22 07:58:32 +00:00
|
|
|
QtConfigureOptions="${QtConfigureOptions} -fast -no-exceptions"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -no-webkit -no-qt3support -no-javascript-jit -no-dbus"
|
|
|
|
QtConfigureOptions="${QtConfigureOptions} -nomake examples -nomake demos -nomake docs -nomake tools"
|
2014-07-20 16:16:36 +00:00
|
|
|
QtConfigureOptions="${QtConfigureOptions} ${QtAPI}"
|
2015-11-20 19:51:47 +00:00
|
|
|
for arch in ${ARCH_LIST} ; do
|
|
|
|
QTARCHS="${QTARCHS} -arch ${arch}"
|
|
|
|
done
|
2013-01-18 20:15:40 +00:00
|
|
|
;;
|
|
|
|
esac
|
2010-05-29 14:36:51 +00:00
|
|
|
|
2010-07-11 21:30:47 +00:00
|
|
|
aspell_dictionaries="no"
|
2012-07-30 23:34:09 +00:00
|
|
|
hunspell_dictionaries="yes"
|
2010-07-11 21:30:47 +00:00
|
|
|
|
2014-08-22 07:52:39 +00:00
|
|
|
libmagic_deployment="yes"
|
2010-05-29 14:36:51 +00:00
|
|
|
aspell_deployment="yes"
|
|
|
|
hunspell_deployment="yes"
|
|
|
|
thesaurus_deployment="yes"
|
2010-07-11 21:30:47 +00:00
|
|
|
|
2014-07-20 16:16:36 +00:00
|
|
|
qt_deployment="yes"
|
2010-07-11 21:30:47 +00:00
|
|
|
|
2013-01-18 20:15:40 +00:00
|
|
|
# auto detect Xcode location
|
2016-01-06 09:14:39 +00:00
|
|
|
DEVELOPER_SDKS=$(dirname $(xcrun --show-sdk-path))
|
|
|
|
if [ -n "${DEVELOPER_SDKS}" ]; then
|
|
|
|
XCODE_DEVELOPER=$(dirname $(dirname $(xcrun --show-sdk-platform-path)))
|
2013-01-18 20:15:40 +00:00
|
|
|
MACOSX_DEPLOYMENT_TARGET="10.7" # Lion support is default
|
2016-01-06 09:14:39 +00:00
|
|
|
SDKROOT="${DEVELOPER_SDKS}/MacOSX$(xcrun --show-sdk-version).sdk" # use default SDK
|
2012-09-23 13:02:46 +00:00
|
|
|
elif [ -d "/Developer/SDKs" ]; then
|
|
|
|
DEVELOPER_SDKS="/Developer/SDKs"
|
|
|
|
XCODE_DEVELOPER="/Developer"
|
|
|
|
MACOSX_DEPLOYMENT_TARGET="10.4" # Tiger support is default
|
|
|
|
SDKROOT="${DEVELOPER_SDKS}/MacOSX10.5.sdk" # Leopard build is default
|
|
|
|
fi
|
2010-04-14 13:22:00 +00:00
|
|
|
|
2011-09-21 19:43:13 +00:00
|
|
|
# detection of script home
|
2012-07-30 23:34:09 +00:00
|
|
|
LyxSourceDir=$(dirname "$0")
|
2011-09-21 19:43:13 +00:00
|
|
|
if [ ! -d "${LyxSourceDir}" ]; then
|
|
|
|
echo Missing LyX source directory.
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
case "${LyxSourceDir}" in
|
|
|
|
/*/development)
|
2012-07-30 23:34:09 +00:00
|
|
|
LyxSourceDir=$(dirname "${LyxSourceDir}")
|
2011-09-21 19:43:13 +00:00
|
|
|
;;
|
|
|
|
/*)
|
|
|
|
;;
|
|
|
|
*/development|development)
|
2012-07-30 23:34:09 +00:00
|
|
|
LyxSourceDir=$(dirname "${LyxSourceDir}")
|
|
|
|
LyxSourceDir=$(cd "${LyxSourceDir}";pwd)
|
2011-09-21 19:43:13 +00:00
|
|
|
;;
|
|
|
|
*)
|
2012-07-30 23:34:09 +00:00
|
|
|
LyxSourceDir=$(cd "${LyxSourceDir}";pwd)
|
2011-09-21 19:43:13 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2010-04-14 13:22:00 +00:00
|
|
|
usage() {
|
2011-09-21 19:43:13 +00:00
|
|
|
echo "*" Build script for LyX on Mac OS X
|
2010-04-14 13:22:00 +00:00
|
|
|
echo
|
|
|
|
echo Optional arguments:
|
2010-05-29 14:36:51 +00:00
|
|
|
echo " --aspell-deployment=yes|no ." default yes
|
2014-07-20 16:16:36 +00:00
|
|
|
echo " --with-qt-frameworks=yes|no." default no
|
|
|
|
echo " --qt-deployment=yes|no ....." default yes
|
2010-07-21 15:36:01 +00:00
|
|
|
echo " --with-sdkroot=SDKROOT ....." default 10.5 "(Leopard)"
|
2010-04-14 13:22:00 +00:00
|
|
|
echo " --with-arch=ARCH ..........." default ppc,i386
|
|
|
|
echo " --with-build-path=PATH ....." default \${lyx-src-dir}/../lyx-build
|
|
|
|
echo " --with-dmg-location=PATH ..." default \${build-path}
|
2014-07-16 20:25:25 +00:00
|
|
|
echo " --with-binary-strip=yes ...." default no
|
2020-05-21 11:30:22 +00:00
|
|
|
echo " --codesign-identity=CSID ..." default is w/o CSID
|
2010-04-14 13:22:00 +00:00
|
|
|
echo
|
|
|
|
echo "All other arguments with -- are passed to configure"
|
2010-05-29 14:36:51 +00:00
|
|
|
echo "including the defaults: ${LyXConfigureOptions}"
|
2014-07-16 20:25:25 +00:00
|
|
|
case "${1}" in
|
|
|
|
--help=short)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ -x "${LyxSourceDir}/configure" ]; then
|
|
|
|
echo
|
|
|
|
echo "*" Configure options of LyX
|
|
|
|
echo
|
|
|
|
"${LyxSourceDir}/configure" --help
|
|
|
|
fi
|
|
|
|
esac
|
2010-04-14 13:22:00 +00:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2013-02-03 11:23:31 +00:00
|
|
|
NCPU=$(sysctl -n hw.ncpu)
|
|
|
|
NCPU=$((NCPU / 2))
|
|
|
|
if [ $NCPU -gt 1 ]; then
|
|
|
|
MAKEJOBS=-j${NCPU}
|
|
|
|
fi
|
|
|
|
|
2010-04-14 13:22:00 +00:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "${1}" in
|
2014-07-20 16:16:36 +00:00
|
|
|
--with-qt-frameworks=*)
|
|
|
|
configure_qt_frameworks=$(echo ${1}|cut -d= -f2)
|
|
|
|
if [ "$configure_qt_frameworks" = "yes" ]; then
|
2010-10-28 12:53:10 +00:00
|
|
|
unset QTDIR
|
2014-07-20 16:16:36 +00:00
|
|
|
qt_deployment="no"
|
2010-10-28 12:53:10 +00:00
|
|
|
fi
|
|
|
|
shift
|
|
|
|
;;
|
2014-07-19 01:34:28 +00:00
|
|
|
--with-qt-dir=*)
|
2012-07-30 23:34:09 +00:00
|
|
|
QTDIR=$(echo ${1}|cut -d= -f2)
|
2010-04-14 13:22:00 +00:00
|
|
|
shift
|
|
|
|
;;
|
2021-12-05 10:10:11 +00:00
|
|
|
--with-macos-deployment-target=*)
|
2012-07-30 23:34:09 +00:00
|
|
|
MACOSX_DEPLOYMENT_TARGET=$(echo ${1}|cut -d= -f2)
|
2021-12-05 10:10:11 +00:00
|
|
|
LyXConfigureOptions="${LyXConfigureOptions} ${1}"
|
2010-05-29 14:36:51 +00:00
|
|
|
shift
|
|
|
|
;;
|
2010-07-21 15:36:01 +00:00
|
|
|
--with-sdkroot=*)
|
2012-07-30 23:34:09 +00:00
|
|
|
SDKROOT=$(echo ${1}|cut -d= -f2)
|
2010-07-21 15:36:01 +00:00
|
|
|
case "${SDKROOT}" in
|
|
|
|
10.4)
|
2012-09-23 13:02:46 +00:00
|
|
|
SDKROOT="${DEVELOPER_SDKS}/MacOSX10.4u.sdk"
|
2010-10-28 12:53:10 +00:00
|
|
|
export CC=gcc-4.0
|
|
|
|
export OBJC=gcc-4.0
|
|
|
|
export CXX=g++-4.0
|
2010-07-21 15:36:01 +00:00
|
|
|
;;
|
|
|
|
*)
|
2016-01-06 09:14:39 +00:00
|
|
|
SDKROOT="${DEVELOPER_SDKS}/MacOSX${SDKROOT}.sdk"
|
|
|
|
if [ ! -d "${SDKROOT}" ]; then
|
|
|
|
echo Invalid SDKROOT given: "${SDKROOT}"
|
|
|
|
usage --help=short
|
|
|
|
fi
|
2010-07-21 15:36:01 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
;;
|
2020-02-20 09:47:23 +00:00
|
|
|
--codesign-identity=*)
|
|
|
|
CODESIGN_IDENTITY=$(echo "${1}"|cut -d= -f2)
|
|
|
|
shift
|
|
|
|
;;
|
2014-08-22 07:52:39 +00:00
|
|
|
--libmagic-deployment=*)
|
|
|
|
libmagic_deployment=$(echo ${1}|cut -d= -f2)
|
2013-01-18 20:15:40 +00:00
|
|
|
shift
|
|
|
|
;;
|
2010-05-29 14:36:51 +00:00
|
|
|
--aspell-deployment=*)
|
2012-07-30 23:34:09 +00:00
|
|
|
aspell_deployment=$(echo ${1}|cut -d= -f2)
|
2010-09-16 15:13:25 +00:00
|
|
|
aspell_dictionaries=$aspell_deployment
|
2010-05-29 14:36:51 +00:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--hunspell-deployment=*)
|
2012-07-30 23:34:09 +00:00
|
|
|
hunspell_deployment=$(echo ${1}|cut -d= -f2)
|
2010-09-16 15:13:25 +00:00
|
|
|
hunspell_dictionaries=$hunspell_deployment
|
2010-04-14 13:22:00 +00:00
|
|
|
shift
|
|
|
|
;;
|
2010-05-29 14:36:51 +00:00
|
|
|
--thesaurus-deployment=*)
|
2012-07-30 23:34:09 +00:00
|
|
|
thesaurus_deployment=$(echo ${1}|cut -d= -f2)
|
2010-04-14 13:22:00 +00:00
|
|
|
shift
|
|
|
|
;;
|
2014-07-20 16:16:36 +00:00
|
|
|
--qt-deployment=*)
|
|
|
|
qt_deployment=$(echo ${1}|cut -d= -f2)
|
2010-04-14 13:22:00 +00:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--with-arch=*)
|
2012-07-30 23:34:09 +00:00
|
|
|
ARCH=$(echo ${1}|cut -d= -f2|tr ',' ' ')
|
2010-04-14 13:22:00 +00:00
|
|
|
ARCH_LIST="${ARCH_LIST} ${ARCH}"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--with-dmg-location=*)
|
2012-07-30 23:34:09 +00:00
|
|
|
DMGLocation=$(echo ${1}|cut -d= -f2)
|
2010-04-14 13:22:00 +00:00
|
|
|
shift
|
|
|
|
;;
|
2014-07-16 20:25:25 +00:00
|
|
|
--with-binary-strip=yes)
|
|
|
|
strip="-strip"
|
|
|
|
shift
|
|
|
|
;;
|
2010-04-14 13:22:00 +00:00
|
|
|
--with-build-path=*)
|
2012-07-30 23:34:09 +00:00
|
|
|
LyxBuildDir=$(echo ${1}|cut -d= -f2)
|
2010-04-14 13:22:00 +00:00
|
|
|
shift
|
|
|
|
;;
|
2014-08-22 06:39:14 +00:00
|
|
|
--with-util-dir=*)
|
|
|
|
LyXUtilitiesDir=$(echo ${1}|cut -d= -f2)
|
|
|
|
shift
|
|
|
|
;;
|
2011-09-21 19:43:13 +00:00
|
|
|
--help|--help=*)
|
2014-07-16 20:25:25 +00:00
|
|
|
usage "${1}"
|
2010-04-14 13:22:00 +00:00
|
|
|
;;
|
2010-05-29 14:36:51 +00:00
|
|
|
--without-aspell)
|
|
|
|
LyXConfigureOptions="${LyXConfigureOptions} ${1}"
|
|
|
|
aspell_deployment="no"
|
|
|
|
shift
|
|
|
|
;;
|
2021-07-16 14:35:30 +00:00
|
|
|
--with-included-hunspell)
|
|
|
|
LyXConfigureOptions="${LyXConfigureOptions} ${1}"
|
|
|
|
hunspell_deployment="no"
|
|
|
|
shift
|
|
|
|
;;
|
2010-05-29 14:36:51 +00:00
|
|
|
--without-hunspell)
|
|
|
|
LyXConfigureOptions="${LyXConfigureOptions} ${1}"
|
|
|
|
hunspell_deployment="no"
|
2021-07-16 14:35:30 +00:00
|
|
|
hunspell_dictionaries="no"
|
2010-05-29 14:36:51 +00:00
|
|
|
shift
|
|
|
|
;;
|
2016-02-28 10:34:06 +00:00
|
|
|
--only-qt*=*)
|
|
|
|
QtOnlyPackage=$(echo ${1}|cut -d= -f2)
|
|
|
|
shift
|
|
|
|
;;
|
2011-05-28 12:35:38 +00:00
|
|
|
--only-package=*)
|
2012-07-30 23:34:09 +00:00
|
|
|
LyxOnlyPackage=$(echo ${1}|cut -d= -f2)
|
2011-05-28 12:35:38 +00:00
|
|
|
shift
|
|
|
|
;;
|
2022-04-09 07:19:46 +00:00
|
|
|
--enable-cxx11|--enable-cxx-mode=*)
|
|
|
|
EnableCXXMode="${1}"
|
2017-01-14 15:05:50 +00:00
|
|
|
shift
|
|
|
|
;;
|
2010-04-14 13:22:00 +00:00
|
|
|
--*)
|
2010-05-29 14:36:51 +00:00
|
|
|
LyXConfigureOptions="${LyXConfigureOptions} ${1}"
|
2010-04-14 13:22:00 +00:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2014-07-20 16:16:36 +00:00
|
|
|
if [ "${configure_qt_frameworks}" != "yes" ]; then
|
2022-11-25 09:10:14 +00:00
|
|
|
QtInstallDir=${QTDIR}
|
2010-10-28 12:53:10 +00:00
|
|
|
fi
|
2010-05-29 14:36:51 +00:00
|
|
|
|
2010-04-14 13:22:00 +00:00
|
|
|
ARCH_LIST=${ARCH_LIST:-"ppc i386"}
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2010-06-06 19:09:22 +00:00
|
|
|
aspellstrip=
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2012-07-30 23:34:09 +00:00
|
|
|
LyxBuildDir=${LyxBuildDir:-$(dirname "${LyxSourceDir}")/lyx-build}
|
2010-04-14 13:22:00 +00:00
|
|
|
DMGLocation=${DMGLocation:-"${LyxBuildDir}"}
|
|
|
|
|
2014-08-26 05:37:59 +00:00
|
|
|
LyXUtilitiesDir=${LyXUtilitiesDir:-"${LyxBuildDir}"/utilities}
|
|
|
|
|
2014-08-22 07:52:39 +00:00
|
|
|
LibMagicSourceDir=${LIBMAGICDIR:-$(dirname "${LyxSourceDir}")/${LibMagicSource}}
|
|
|
|
LibMagicBuildDir="${LyxBuildDir}"/"${LibMagicSource}"
|
|
|
|
LibMagicInstallDir=${LibMagicInstallDir:-"${LyXUtilitiesDir}"}
|
|
|
|
LibMagicInstallHdr="${LibMagicInstallDir}/include/magic.h"
|
2013-01-18 20:15:40 +00:00
|
|
|
|
|
|
|
ASpellSourceDir=${ASPELLDIR:-$(dirname "${LyxSourceDir}")/${ASpellSource}}
|
|
|
|
ASpellBuildDir="${ASpellSourceDir}"
|
2014-08-22 06:39:14 +00:00
|
|
|
ASpellInstallDir=${ASpellInstallDir:-"${LyXUtilitiesDir}"}
|
2013-01-18 20:15:40 +00:00
|
|
|
ASpellInstallHdr="${ASpellInstallDir}/include/aspell.h"
|
|
|
|
|
|
|
|
HunSpellSourceDir=${HUNSPELLDIR:-$(dirname "${LyxSourceDir}")/${HunSpellSource}}
|
|
|
|
HunSpellBuildDir="${HunSpellSourceDir}"
|
2014-08-22 06:39:14 +00:00
|
|
|
HunSpellInstallDir=${HunSpellInstallDir:-"${LyXUtilitiesDir}"}
|
2013-01-18 20:15:40 +00:00
|
|
|
HunSpellInstallHdr="${HunSpellInstallDir}/include/hunspell/hunspell.h"
|
|
|
|
|
2014-07-20 16:16:36 +00:00
|
|
|
QtSourceDir=${QTSOURCEDIR:-$(dirname "${LyxSourceDir}")/${QtSourceVersion}}
|
|
|
|
QtBuildDir=${QtBuildDir:-"${LyxBuildDir}"/${QtBuildSubDir:-"qt-build"}}
|
2013-01-18 20:15:40 +00:00
|
|
|
|
2012-07-30 23:34:09 +00:00
|
|
|
DictionarySourceDir=${DICTIONARYDIR:-$(dirname "${LyxSourceDir}")/dictionaries}
|
|
|
|
DocumentationDir=$(dirname "${LyxSourceDir}")/Documents
|
2022-01-10 06:48:54 +00:00
|
|
|
DmgBackground="${LyxSourceDir}"/development/MacOSX/dmg-background.tiff
|
2010-05-29 14:36:51 +00:00
|
|
|
|
2010-04-09 12:09:11 +00:00
|
|
|
if [ -z "${LyXVersion}" ]; then
|
2019-06-17 16:07:05 +00:00
|
|
|
LyXVersion=$(grep AC_INIT "${LyxSourceDir}"/configure.ac | cut -d, -f2 | tr -d " []()")
|
2010-04-09 12:09:11 +00:00
|
|
|
fi
|
2012-07-30 23:34:09 +00:00
|
|
|
LyXVersionSuffix=${LyXVersionSuffix:-$(echo "${LyXVersion}" | cut -d. -f1-2)}
|
2014-11-17 18:43:33 +00:00
|
|
|
case "${LyXVersion}" in
|
|
|
|
*dev*)
|
|
|
|
LyXGitCommitHash=$(cd "${LyxSourceDir}" ; git log -1 --pretty=format:%h)
|
|
|
|
;;
|
|
|
|
esac
|
2010-04-09 12:09:11 +00:00
|
|
|
|
|
|
|
LyxName="LyX"
|
|
|
|
LyxBase="${LyxName}-${LyXVersion}"
|
|
|
|
LyxApp="${LyxBase}.app"
|
2010-04-14 13:22:00 +00:00
|
|
|
LyxAppDir="${LyxBuildDir}"/"${LyxBase}"
|
2010-04-09 12:09:11 +00:00
|
|
|
LyxBuildDir="${LyxAppDir}.build"
|
|
|
|
LyxAppPrefix="${LyxAppDir}.app"
|
|
|
|
# if zip file is needed... remove the comment sign
|
|
|
|
#LyxAppZip="${LyxAppPrefix}.zip"
|
|
|
|
|
|
|
|
# ---------------------------------
|
|
|
|
# DON'T MODIFY ANYTHING BELOW HERE!
|
|
|
|
# ---------------------------------
|
|
|
|
|
2010-05-29 14:36:51 +00:00
|
|
|
# don't change order here...
|
2014-07-20 16:16:36 +00:00
|
|
|
case "${QtVersion}" in
|
2014-03-04 21:28:17 +00:00
|
|
|
5.0.*|5.1.*)
|
2020-02-06 21:17:35 +00:00
|
|
|
QtLibraries=${QtLibraries:-"QtSvg QtXml QtPrintSupport QtWidgets QtGui QtNetwork QtConcurrent QtCore"}
|
|
|
|
QtFrameworkVersion="5"
|
|
|
|
;;
|
2022-12-30 22:37:43 +00:00
|
|
|
5.1[2-5].*)
|
2021-06-16 05:45:20 +00:00
|
|
|
QtLibraries=${QtLibraries:-"QtDBus QtSvg QtXml QtPrintSupport QtMacExtras QtWidgets QtGui QtNetwork QtConcurrent QtCore"}
|
2013-02-03 11:23:31 +00:00
|
|
|
QtFrameworkVersion="5"
|
|
|
|
;;
|
2015-07-08 15:58:07 +00:00
|
|
|
5*)
|
2020-02-06 21:17:35 +00:00
|
|
|
QtLibraries=${QtLibraries:-"QtSvg QtXml QtPrintSupport QtMacExtras QtWidgets QtGui QtNetwork QtConcurrent QtCore"}
|
2015-07-08 15:58:07 +00:00
|
|
|
QtFrameworkVersion="5"
|
|
|
|
;;
|
2021-10-24 19:41:11 +00:00
|
|
|
6*)
|
2023-06-14 06:19:34 +00:00
|
|
|
QtLibraries=${QtLibraries:-"QtDBus QtSvg QtXml QtPrintSupport QtSvgWidgets QtWidgets QtGui QtNetwork QtConcurrent QtCore"}
|
2021-10-24 19:41:11 +00:00
|
|
|
QtFrameworkVersion="A"
|
2022-04-09 07:19:46 +00:00
|
|
|
case "${EnableCXXMode}" in
|
|
|
|
--enable-cxx11|--enable-cxx-mode=11)
|
|
|
|
echo Warning: Adjust cxx standard "${EnableCXXMode}" for Qt 6. C++17 or better is required.
|
|
|
|
EnableCXXMode="--enable-cxx-mode=17"
|
|
|
|
;;
|
|
|
|
esac
|
2021-10-24 19:41:11 +00:00
|
|
|
;;
|
2013-02-03 11:23:31 +00:00
|
|
|
*)
|
2020-02-06 21:17:35 +00:00
|
|
|
QtLibraries=${QtLibraries:-"QtSvg QtXml QtGui QtNetwork QtCore"}
|
2013-02-03 11:23:31 +00:00
|
|
|
QtFrameworkVersion="4"
|
|
|
|
;;
|
|
|
|
esac
|
2010-05-29 14:36:51 +00:00
|
|
|
|
2014-11-17 18:43:33 +00:00
|
|
|
DMGNAME="${LyxBase}${LyXGitCommitHash:+-}${LyXGitCommitHash}"
|
2010-07-07 17:40:50 +00:00
|
|
|
DMGSIZE="550m"
|
2010-04-14 13:22:00 +00:00
|
|
|
|
2010-04-09 12:09:11 +00:00
|
|
|
# Check for existing SDKs
|
2021-05-30 15:22:42 +00:00
|
|
|
SDKs=$(echo ${DEVELOPER_SDKS}/MacOSX1[01]*sdk)
|
2012-09-23 13:02:46 +00:00
|
|
|
case $SDKs in
|
|
|
|
*${SDKROOT}*)
|
2010-07-21 15:36:01 +00:00
|
|
|
;;
|
2010-04-09 12:09:11 +00:00
|
|
|
*10.6*)
|
2010-04-14 13:22:00 +00:00
|
|
|
MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-"10.5"}; export MACOSX_DEPLOYMENT_TARGET
|
|
|
|
case "${MACOSX_DEPLOYMENT_TARGET}" in
|
2010-08-31 20:35:17 +00:00
|
|
|
10.6)
|
2012-09-23 13:02:46 +00:00
|
|
|
SDKROOT="${DEVELOPER_SDKS}/MacOSX10.6.sdk"; export SDKROOT
|
2010-08-31 20:35:17 +00:00
|
|
|
;;
|
2010-07-11 21:30:47 +00:00
|
|
|
10.5|10.4)
|
2012-09-23 13:02:46 +00:00
|
|
|
SDKROOT=${SDKROOT:-"${DEVELOPER_SDKS}/MacOSX10.5.sdk"}; export SDKROOT
|
2010-04-14 13:22:00 +00:00
|
|
|
;;
|
|
|
|
esac
|
2010-04-09 12:09:11 +00:00
|
|
|
;;
|
|
|
|
*10.5*)
|
2010-07-11 21:30:47 +00:00
|
|
|
MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-"10.4"}; export MACOSX_DEPLOYMENT_TARGET
|
2012-09-23 13:02:46 +00:00
|
|
|
SDKROOT=${SDKROOT:-"${DEVELOPER_SDKS}/MacOSX10.5.sdk"}; export SDKROOT
|
2010-04-09 12:09:11 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo Unknown or missing SDK for Mac OS X.
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2010-07-11 21:30:47 +00:00
|
|
|
MYCFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}"
|
2018-09-21 19:48:48 +00:00
|
|
|
MYLDFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}"
|
2010-07-07 17:40:50 +00:00
|
|
|
|
2022-04-09 07:19:46 +00:00
|
|
|
case "${EnableCXXMode}" in
|
|
|
|
--enable-cxx11|--enable-cxx-mode=11)
|
|
|
|
export CC=cc
|
|
|
|
export CXX="c++ -stdlib=libc++"
|
|
|
|
export CXXFLAGS=-std=c++11
|
2022-07-30 13:04:37 +00:00
|
|
|
LyXConfigureOptions="${LyXConfigureOptions} --enable-cxx-mode=11"
|
2022-04-09 07:19:46 +00:00
|
|
|
;;
|
|
|
|
--enable-cxx-mode=17)
|
|
|
|
export CC=cc
|
|
|
|
export CXX="c++ -stdlib=libc++"
|
|
|
|
export CXXFLAGS=-std=c++17
|
2022-07-30 13:04:37 +00:00
|
|
|
LyXConfigureOptions="${LyXConfigureOptions} ${EnableCXXMode}"
|
2022-04-09 07:19:46 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2016-02-28 10:34:06 +00:00
|
|
|
build_qt() {
|
2014-07-20 16:16:36 +00:00
|
|
|
echo Build Qt library ${QtSourceDir}
|
|
|
|
if [ "${QtInstallDir}" = "${QtBuildDir}" ]; then
|
2010-12-03 21:24:48 +00:00
|
|
|
echo Bad install directory for Qt.
|
2014-07-20 16:16:36 +00:00
|
|
|
echo Must be different from build directory "${QtBuildDir}".
|
2010-12-03 21:24:48 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2010-05-29 14:36:51 +00:00
|
|
|
(
|
2014-07-20 16:16:36 +00:00
|
|
|
mkdir -p "${QtBuildDir}" && cd "${QtBuildDir}"
|
2010-05-29 14:36:51 +00:00
|
|
|
echo configure options:
|
2015-11-20 19:51:47 +00:00
|
|
|
echo ${QtConfigureOptions} ${QTARCHS} -prefix "${QtInstallDir}"
|
|
|
|
"${QtSourceDir}"/configure ${QtConfigureOptions} ${QTARCHS} -prefix "${QtInstallDir}"
|
2015-07-08 16:01:05 +00:00
|
|
|
make -j1 && make -j1 install
|
2010-05-29 14:36:51 +00:00
|
|
|
)
|
2016-02-28 10:34:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case ${QtOnlyPackage:-"no"} in
|
|
|
|
y*)
|
|
|
|
build_qt
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ "${configure_qt_frameworks}" != "yes" -a -d "${QtSourceDir}" -a ! \( -d "${QtBuildDir}" -a -d "${QtInstallDir}" \) ]; then
|
|
|
|
build_qt
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2010-05-29 14:36:51 +00:00
|
|
|
|
2014-08-22 07:52:39 +00:00
|
|
|
if [ -d "${LibMagicSourceDir}" -a ! -f "${LibMagicInstallHdr}" ]; then
|
|
|
|
# we have a private libmagic (file(1)) source tree at hand...
|
2013-01-18 20:15:40 +00:00
|
|
|
# so let's build and install it
|
2014-08-22 07:52:39 +00:00
|
|
|
if [ -z "${LibMagicVersion}" ]; then
|
2020-02-06 21:15:08 +00:00
|
|
|
LibMagicVersion=$(grep AC_INIT "${LibMagicSourceDir}"/configure.ac | cut -d, -f2|tr -d " []()")
|
2013-01-18 20:15:40 +00:00
|
|
|
fi
|
|
|
|
|
2014-08-22 07:52:39 +00:00
|
|
|
LibMagicName="LibMagic"
|
|
|
|
LibMagicBase="${LibMagicName}-${LibMagicVersion}"
|
2013-01-18 20:15:40 +00:00
|
|
|
|
2014-08-22 07:52:39 +00:00
|
|
|
echo Build libmagic library ${LibMagicBase}
|
2013-01-18 20:15:40 +00:00
|
|
|
echo configure options:
|
2014-08-22 07:52:39 +00:00
|
|
|
echo --prefix="${LibMagicInstallDir}" ${LibMagicConfigureOptions}
|
2013-01-18 20:15:40 +00:00
|
|
|
|
2014-08-22 07:52:39 +00:00
|
|
|
mkdir -p "${LibMagicBuildDir}" && cd "${LibMagicBuildDir}"
|
2013-01-18 20:15:40 +00:00
|
|
|
|
|
|
|
# ----------------------------------------
|
2014-08-22 07:52:39 +00:00
|
|
|
# Build LibMagic for different architectures
|
2013-01-18 20:15:40 +00:00
|
|
|
# ----------------------------------------
|
2014-08-22 07:52:39 +00:00
|
|
|
FILE_LIST="${LibMagicLibrary}"
|
2013-01-18 20:15:40 +00:00
|
|
|
|
|
|
|
for arch in ${ARCH_LIST} ; do
|
|
|
|
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
|
2018-09-21 19:48:48 +00:00
|
|
|
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYLDFLAGS}"; export LDFLAGS
|
2014-08-22 07:52:39 +00:00
|
|
|
"${LibMagicSourceDir}/configure"\
|
|
|
|
--prefix="${LibMagicInstallDir}"\
|
|
|
|
${LibMagicConfigureOptions}
|
2013-01-18 20:15:40 +00:00
|
|
|
make && make install${strip}
|
|
|
|
for file in ${FILE_LIST} ; do
|
2014-08-22 07:52:39 +00:00
|
|
|
if [ -f "${LibMagicInstallDir}"/lib/${file} ]; then
|
|
|
|
mv "${LibMagicInstallDir}"/lib/${file}\
|
|
|
|
"${LibMagicInstallDir}"/lib/${file}-${arch}
|
2013-01-18 20:15:40 +00:00
|
|
|
else
|
2014-08-22 07:52:39 +00:00
|
|
|
echo Cannot build and install LibMagic for ${arch}.
|
2013-01-18 20:15:40 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
# -------------------------
|
|
|
|
# Create universal binaries
|
|
|
|
# -------------------------
|
|
|
|
for file in ${FILE_LIST} ; do
|
|
|
|
OBJ_LIST=
|
|
|
|
for arch in ${ARCH_LIST} ; do
|
|
|
|
OBJ_LIST="${OBJ_LIST} lib/${file}-${arch}"
|
|
|
|
done
|
|
|
|
(
|
2014-08-22 07:52:39 +00:00
|
|
|
cd "${LibMagicInstallDir}"
|
2013-01-18 20:15:40 +00:00
|
|
|
lipo -create ${OBJ_LIST} -o lib/${file}
|
2014-08-22 08:05:40 +00:00
|
|
|
# check for the "missing link"...
|
|
|
|
test -f lib/libmagic.dylib || (cd lib ; ln -s "${LibMagicLibrary}" libmagic.dylib)
|
2013-01-18 20:15:40 +00:00
|
|
|
)
|
|
|
|
done
|
|
|
|
# --------
|
|
|
|
# Clean up
|
|
|
|
# --------
|
|
|
|
for arch in ${ARCH_LIST} ; do
|
2014-08-22 07:52:39 +00:00
|
|
|
rm -f "${LibMagicInstallDir}"/lib/*-${arch}
|
2013-01-18 20:15:40 +00:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2010-05-29 14:36:51 +00:00
|
|
|
if [ -d "${HunSpellSourceDir}" -a ! -f "${HunSpellInstallHdr}" ]; then
|
|
|
|
# we have a private HunSpell source tree at hand...
|
|
|
|
# so let's build and install it
|
|
|
|
if [ -z "${HunSpellVersion}" ]; then
|
2020-02-06 21:15:08 +00:00
|
|
|
HunSpellVersion=$(grep AC_INIT "${HunSpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " []()")
|
2010-05-29 14:36:51 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
HunSpellName="Hunspell"
|
|
|
|
HunSpellBase="${HunSpellName}-${HunSpellVersion}"
|
|
|
|
|
|
|
|
echo Build hunspell library ${HunSpellBase}
|
|
|
|
echo configure options:
|
|
|
|
echo --prefix="${HunSpellInstallDir}" ${HunspellConfigureOptions}
|
|
|
|
|
2013-01-18 20:15:40 +00:00
|
|
|
mkdir -p "${HunSpellBuildDir}" && cd "${HunSpellBuildDir}"
|
2010-05-29 14:36:51 +00:00
|
|
|
|
|
|
|
# ----------------------------------------
|
|
|
|
# Build HunSpell for different architectures
|
|
|
|
# ----------------------------------------
|
2013-01-18 20:15:40 +00:00
|
|
|
FILE_LIST="${HunSpellLibrary}"
|
2010-05-29 14:36:51 +00:00
|
|
|
|
|
|
|
for arch in ${ARCH_LIST} ; do
|
|
|
|
make distclean
|
2010-07-11 21:30:47 +00:00
|
|
|
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
|
2018-09-21 19:48:48 +00:00
|
|
|
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYLDFLAGS}"; export LDFLAGS
|
2010-05-29 14:36:51 +00:00
|
|
|
"${HunSpellSourceDir}/configure"\
|
|
|
|
--prefix="${HunSpellInstallDir}"\
|
|
|
|
${HunspellConfigureOptions}
|
|
|
|
make && make install${strip}
|
|
|
|
for file in ${FILE_LIST} ; do
|
|
|
|
if [ -f "${HunSpellInstallDir}"/lib/${file} ]; then
|
|
|
|
mv "${HunSpellInstallDir}"/lib/${file}\
|
|
|
|
"${HunSpellInstallDir}"/lib/${file}-${arch}
|
|
|
|
else
|
|
|
|
echo Cannot build and install HunSpell for ${arch}.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
# -------------------------
|
|
|
|
# Create universal binaries
|
|
|
|
# -------------------------
|
|
|
|
for file in ${FILE_LIST} ; do
|
|
|
|
OBJ_LIST=
|
|
|
|
for arch in ${ARCH_LIST} ; do
|
|
|
|
OBJ_LIST="${OBJ_LIST} lib/${file}-${arch}"
|
|
|
|
done
|
|
|
|
(
|
|
|
|
cd "${HunSpellInstallDir}"
|
|
|
|
lipo -create ${OBJ_LIST} -o lib/${file}
|
|
|
|
# check for the "missing link"...
|
2013-01-18 20:15:40 +00:00
|
|
|
test -f lib/libhunspell.dylib || (cd lib ; ln -s "${HunSpellLibrary}" libhunspell.dylib)
|
2010-05-29 14:36:51 +00:00
|
|
|
)
|
|
|
|
done
|
|
|
|
# --------
|
|
|
|
# Clean up
|
|
|
|
# --------
|
|
|
|
for arch in ${ARCH_LIST} ; do
|
|
|
|
rm -f "${HunSpellInstallDir}"/lib/*-${arch}
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d "${ASpellSourceDir}" -a ! -f "${ASpellInstallHdr}" -a "yes" = "${aspell_deployment}" ]; then
|
2010-04-09 12:09:11 +00:00
|
|
|
# we have a private ASpell source tree at hand...
|
|
|
|
# so let's build and install it
|
|
|
|
if [ -z "${ASpellVersion}" ]; then
|
2020-02-06 21:15:08 +00:00
|
|
|
ASpellVersion=$(grep AC_INIT "${ASpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " []()")
|
2010-04-09 12:09:11 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
ASpellName="Aspell"
|
|
|
|
ASpellBase="${ASpellName}-${ASpellVersion}"
|
2010-04-14 13:22:00 +00:00
|
|
|
|
|
|
|
echo Build aspell library ${ASpellBase}
|
2010-05-29 14:36:51 +00:00
|
|
|
echo configure options:
|
|
|
|
echo --prefix="${ASpellInstallDir}" ${AspellConfigureOptions}
|
2010-04-09 12:09:11 +00:00
|
|
|
|
|
|
|
# ASpell builds inplace only :(
|
2010-05-29 14:36:51 +00:00
|
|
|
cd "${ASpellSourceDir}"
|
2010-04-09 12:09:11 +00:00
|
|
|
|
|
|
|
# ----------------------------------------
|
|
|
|
# Build ASpell for different architectures
|
|
|
|
# ----------------------------------------
|
2013-01-18 20:15:40 +00:00
|
|
|
FILE_LIST="${ASpellLibrary}"
|
2010-04-09 12:09:11 +00:00
|
|
|
|
|
|
|
for arch in ${ARCH_LIST} ; do
|
2010-05-29 14:36:51 +00:00
|
|
|
make distclean
|
2010-07-11 21:30:47 +00:00
|
|
|
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
|
2018-09-21 19:48:48 +00:00
|
|
|
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYLDFLAGS}"; export LDFLAGS
|
2010-06-06 19:09:22 +00:00
|
|
|
CXXFLAGS=-g "${ASpellSourceDir}/configure"\
|
2010-04-14 13:22:00 +00:00
|
|
|
--prefix="${ASpellInstallDir}"\
|
2010-05-29 14:36:51 +00:00
|
|
|
${AspellConfigureOptions}
|
2010-06-06 19:09:22 +00:00
|
|
|
make && make install${aspellstrip}
|
2010-04-09 12:09:11 +00:00
|
|
|
for file in ${FILE_LIST} ; do
|
2010-04-14 13:22:00 +00:00
|
|
|
if [ -f "${ASpellInstallDir}"/lib/${file} ]; then
|
|
|
|
mv "${ASpellInstallDir}"/lib/${file}\
|
|
|
|
"${ASpellInstallDir}"/lib/${file}-${arch}
|
2010-04-09 12:09:11 +00:00
|
|
|
else
|
|
|
|
echo Cannot build and install ASpell for ${arch}.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
# -------------------------
|
|
|
|
# Create universal binaries
|
|
|
|
# -------------------------
|
|
|
|
for file in ${FILE_LIST} ; do
|
|
|
|
OBJ_LIST=
|
|
|
|
for arch in ${ARCH_LIST} ; do
|
|
|
|
OBJ_LIST="${OBJ_LIST} lib/${file}-${arch}"
|
|
|
|
done
|
|
|
|
(
|
2010-04-14 13:22:00 +00:00
|
|
|
cd "${ASpellInstallDir}"
|
2010-04-09 12:09:11 +00:00
|
|
|
lipo -create ${OBJ_LIST} -o lib/${file}
|
|
|
|
)
|
|
|
|
done
|
|
|
|
# --------
|
|
|
|
# Clean up
|
|
|
|
# --------
|
|
|
|
for arch in ${ARCH_LIST} ; do
|
2010-04-14 13:22:00 +00:00
|
|
|
rm -f "${ASpellInstallDir}"/lib/*-${arch}
|
2010-04-09 12:09:11 +00:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2010-07-07 17:40:50 +00:00
|
|
|
|
2010-04-14 13:22:00 +00:00
|
|
|
framework_name() {
|
|
|
|
echo "Frameworks/${1}.framework"
|
|
|
|
}
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2017-09-30 16:13:21 +00:00
|
|
|
LYX_FILE_LIST="lyx lyxclient tex2lyx lyxconvert"
|
2010-04-14 13:22:00 +00:00
|
|
|
BUNDLE_PATH="Contents/MacOS"
|
|
|
|
LYX_BUNDLE_PATH="${LyxAppPrefix}/${BUNDLE_PATH}"
|
2020-02-20 09:46:22 +00:00
|
|
|
|
2010-04-14 13:22:00 +00:00
|
|
|
build_lyx() {
|
|
|
|
# Clear Output
|
|
|
|
if [ -n "${LyxAppZip}" -a -f "${LyxAppZip}" ]; then rm "${LyxAppZip}"; fi
|
2020-02-21 17:04:28 +00:00
|
|
|
if [ -d "${LyxAppPrefix}" ]; then
|
|
|
|
find "${LyxAppPrefix}" -type d -exec chmod u+w '{}' \;
|
|
|
|
rm -rf "${LyxAppPrefix}"
|
|
|
|
fi
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2011-04-02 12:16:32 +00:00
|
|
|
# -------------------------------------
|
|
|
|
# Automate configure check
|
|
|
|
# -------------------------------------
|
|
|
|
if [ ! -f "${LyxSourceDir}"/configure -o "${LyxSourceDir}"/configure -ot "${LyxSourceDir}"/configure.ac ]; then
|
|
|
|
( cd "${LyxSourceDir}" && sh autogen.sh )
|
|
|
|
else
|
|
|
|
find "${LyxSourceDir}" -name Makefile.am -print | while read file ; do
|
2012-07-30 23:34:09 +00:00
|
|
|
dname=$(dirname "$file")
|
2011-04-02 12:16:32 +00:00
|
|
|
if [ -f "$dname/Makefile.in" -a "$dname/Makefile.in" -ot "$file" ]; then
|
|
|
|
( cd "${LyxSourceDir}" && sh autogen.sh )
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2010-04-14 13:22:00 +00:00
|
|
|
# -------------------------------------
|
|
|
|
# Build LyX for different architectures
|
|
|
|
# -------------------------------------
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2010-05-29 14:36:51 +00:00
|
|
|
if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_deployment}" ]; then
|
|
|
|
ConfigureExtraInc="--with-extra-inc=${ASpellInstallDir}/include"
|
|
|
|
ConfigureExtraLib="--with-extra-lib=${ASpellInstallDir}/lib"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_deployment}" ]; then
|
2012-07-30 23:34:09 +00:00
|
|
|
HunSpellFramework=$(framework_name Hunspell)
|
|
|
|
HunSpellFramework=$(basename "${HunSpellFramework}")
|
2010-05-29 14:36:51 +00:00
|
|
|
ConfigureExtraInc="--with-extra-inc=${HunSpellInstallDir}/include"
|
|
|
|
ConfigureExtraLib="--with-extra-lib=${HunSpellInstallDir}/lib"
|
|
|
|
# LyXConfigureOptions="${LyXConfigureOptions} --with-hunspell-framework=${HunSpellFramework}"
|
2010-04-14 13:22:00 +00:00
|
|
|
fi
|
2010-05-29 14:36:51 +00:00
|
|
|
LyXConfigureOptions="${LyXConfigureOptions} ${ConfigureExtraInc}"
|
|
|
|
LyXConfigureOptions="${LyXConfigureOptions} ${ConfigureExtraLib}"
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2010-04-14 13:22:00 +00:00
|
|
|
for arch in ${ARCH_LIST} ; do
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2010-04-14 13:22:00 +00:00
|
|
|
if [ -d "${LyxBuildDir}" ]; then rm -r "${LyxBuildDir}"; fi
|
2011-02-18 08:55:24 +00:00
|
|
|
mkdir -p "${LyxBuildDir}" && cd "${LyxBuildDir}"
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2021-12-05 10:10:11 +00:00
|
|
|
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch}"
|
|
|
|
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch}"
|
2010-04-14 13:22:00 +00:00
|
|
|
|
2014-07-20 16:16:36 +00:00
|
|
|
if [ "$configure_qt_frameworks" = "yes" ]; then
|
2014-07-19 01:34:28 +00:00
|
|
|
export QT_CORE_CFLAGS="-FQtCore"
|
|
|
|
export QT_CORE_LIBS="-framework QtCore"
|
|
|
|
export QT_FRONTEND_CFLAGS="-FQtGui"
|
|
|
|
export QT_FRONTEND_LIBS="-framework QtGui"
|
2010-10-28 12:53:10 +00:00
|
|
|
CPPFLAGS="${CPPFLAGS} -I${SDKROOT}/Library/Frameworks/QtCore.framework/Headers"
|
|
|
|
CPPFLAGS="${CPPFLAGS} -I${SDKROOT}/Library/Frameworks/QtGui.framework/Headers"
|
|
|
|
fi
|
|
|
|
|
2010-04-14 13:22:00 +00:00
|
|
|
echo LDFLAGS="${LDFLAGS}"
|
2010-10-28 12:53:10 +00:00
|
|
|
export LDFLAGS
|
2010-04-14 13:22:00 +00:00
|
|
|
echo CPPFLAGS="${CPPFLAGS}"
|
2010-10-28 12:53:10 +00:00
|
|
|
export CPPFLAGS
|
2014-07-19 01:34:28 +00:00
|
|
|
echo CONFIGURE_OPTIONS="${LyXConfigureOptions}" ${QtInstallDir:+"--with-qt-dir=${QtInstallDir}"}
|
2024-06-24 05:32:08 +00:00
|
|
|
export PATH="${QtInstallDir}/bin:${QtInstallDir}/libexec:$PATH"
|
2010-04-14 13:22:00 +00:00
|
|
|
"${LyxSourceDir}/configure"\
|
2010-09-19 16:11:31 +00:00
|
|
|
--prefix="${LyxAppPrefix}" --with-version-suffix="-${LyXVersionSuffix}"\
|
2014-07-19 01:34:28 +00:00
|
|
|
${QtInstallDir:+"--with-qt-dir=${QtInstallDir}"} \
|
2010-05-29 14:36:51 +00:00
|
|
|
${LyXConfigureOptions}\
|
2012-01-26 06:16:46 +00:00
|
|
|
--enable-build-type=rel && \
|
2013-02-03 11:23:31 +00:00
|
|
|
make ${MAKEJOBS} && make install${strip}
|
2011-04-02 12:16:32 +00:00
|
|
|
for file in ${LYX_FILE_LIST} ; do
|
2010-04-14 13:22:00 +00:00
|
|
|
if [ -f "${LYX_BUNDLE_PATH}/${file}" ]; then
|
|
|
|
mv "${LYX_BUNDLE_PATH}/${file}"\
|
|
|
|
"${LYX_BUNDLE_PATH}/${file}-${arch}"
|
|
|
|
else
|
2017-09-30 16:13:21 +00:00
|
|
|
echo ERROR: Cannot build and install ${file} for ${arch}.
|
2010-04-14 13:22:00 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
2010-04-09 12:09:11 +00:00
|
|
|
done
|
2010-04-14 13:22:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
content_directory() {
|
|
|
|
target="$1"
|
2012-07-30 23:34:09 +00:00
|
|
|
content=$(dirname "${target}")
|
|
|
|
content=$(dirname "${content}")
|
2010-04-14 13:22:00 +00:00
|
|
|
echo "${content}"
|
|
|
|
}
|
|
|
|
|
2015-07-08 16:02:21 +00:00
|
|
|
installname() {
|
|
|
|
echo install_name_tool "$@"
|
2018-09-21 19:47:29 +00:00
|
|
|
install_name_tool "$@" || exit 1
|
2015-07-08 16:02:21 +00:00
|
|
|
}
|
|
|
|
|
2010-04-14 13:22:00 +00:00
|
|
|
private_framework() {
|
2020-02-20 09:46:22 +00:00
|
|
|
fwname="$1" ; shift
|
|
|
|
source="$1" ; shift
|
|
|
|
target="$1" ; shift
|
|
|
|
version=$(echo ${1:-"1.1.1"}.1.1.1 | cut -d. -f1-3) ; shift
|
|
|
|
fwdir=$(framework_name "${fwname}")
|
2012-07-30 23:34:09 +00:00
|
|
|
condir=$(content_directory "${target}")
|
|
|
|
libnm=$(basename "${source}")
|
2020-02-20 09:46:22 +00:00
|
|
|
libid="org.lyx."$(echo "${libnm}" | cut -d. -f1)
|
|
|
|
svrsn=$(echo "${version}" | cut -d. -f1-2)
|
|
|
|
fwvrsn="1"
|
|
|
|
mkdir -p "${condir}/${fwdir}"/Versions/${fwvrsn}/Headers
|
|
|
|
mkdir -p "${condir}/${fwdir}"/Versions/${fwvrsn}/Resources
|
2020-02-21 08:43:10 +00:00
|
|
|
if [ ! -f "${condir}/${fwdir}/Versions/${fwvrsn}/${fwname}" ]; then
|
|
|
|
cp -p "${source}" "${condir}/${fwdir}/Versions/${fwvrsn}/${fwname}"
|
2020-02-20 09:46:22 +00:00
|
|
|
for hfile in "$@" ; do
|
|
|
|
test -f "${hfile}" && cp -p "${hfile}" "${condir}/${fwdir}"/Versions/${fwvrsn}/Headers
|
|
|
|
done
|
|
|
|
ln -s ${fwvrsn} "${condir}/${fwdir}/Versions/Current"
|
|
|
|
ln -s Versions/Current/Headers "${condir}/${fwdir}/Headers"
|
|
|
|
ln -s Versions/Current/Resources "${condir}/${fwdir}/Resources"
|
2020-02-21 08:43:10 +00:00
|
|
|
ln -s Versions/Current/"${fwname}" "${condir}/${fwdir}/${fwname}"
|
|
|
|
installname -id "@executable_path/../${fwdir}/${fwname}" "${condir}/${fwdir}/${fwname}"
|
2020-02-20 09:46:22 +00:00
|
|
|
if [ -f "${LyxSourceDir}"/development/LyX-Mac-frameworks-template.plist ]; then
|
|
|
|
cat "${LyxSourceDir}"/development/LyX-Mac-frameworks-template.plist | sed \
|
2020-02-21 08:43:10 +00:00
|
|
|
-e "s/@CFBundleExecutable@/${fwname}/" \
|
2020-02-20 09:46:22 +00:00
|
|
|
-e "s/@CFBundleIdentifier@/${libid}/" \
|
|
|
|
-e "s/@CFBundleShortVersionString@/${svrsn}/" \
|
|
|
|
-e "s/@CFBundleVersion@/${version}/" > "${condir}/${fwdir}"/Resources/Info.plist
|
|
|
|
fi
|
2010-04-14 13:22:00 +00:00
|
|
|
fi
|
2020-02-21 08:43:10 +00:00
|
|
|
installname -change "${source}" "@executable_path/../${fwdir}/${fwname}" "${target}"
|
2010-04-14 13:22:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
deploy_qtlibs() {
|
|
|
|
source="${QtInstallDir}"
|
|
|
|
target="$1"
|
|
|
|
version="Versions/${QtFrameworkVersion}/"
|
2012-07-30 23:34:09 +00:00
|
|
|
condir=$(content_directory "${target}")
|
2010-04-14 13:22:00 +00:00
|
|
|
mkdir -p "${condir}/Resources"
|
|
|
|
test -f "${condir}/Resources/qt.conf" || cat - > "${condir}/Resources/qt.conf" <<-EOF
|
|
|
|
[Paths]
|
|
|
|
Plugins = PlugIns
|
2011-09-05 18:24:54 +00:00
|
|
|
Translations = translations
|
2010-04-14 13:22:00 +00:00
|
|
|
EOF
|
|
|
|
if [ ! -d "${condir}/PlugIns" ]; then
|
|
|
|
mkdir -p "${condir}/PlugIns"
|
2014-03-01 09:23:24 +00:00
|
|
|
find "${source}/plugins" -name \*.dylib -print | grep -v _debug.dylib | while read libname ; do
|
2010-04-14 13:22:00 +00:00
|
|
|
echo Copy plugin "${libname}"
|
2012-07-30 23:34:09 +00:00
|
|
|
dylib=$(basename "${libname}")
|
|
|
|
dirname=$(dirname "${libname}")
|
|
|
|
dirname=$(basename "${dirname}")
|
2010-04-14 13:22:00 +00:00
|
|
|
mkdir -p "${condir}/PlugIns/${dirname}"
|
|
|
|
cp -p "${libname}" "${condir}/PlugIns/${dirname}"
|
|
|
|
done
|
|
|
|
fi
|
2023-06-14 06:17:10 +00:00
|
|
|
echo Copy frameworks ${QtLibraries} ...
|
2010-05-29 14:36:51 +00:00
|
|
|
for libnm in ${QtLibraries} ; do
|
2012-07-30 23:34:09 +00:00
|
|
|
fwdir=$(framework_name "$libnm")
|
|
|
|
dirname=$(dirname "${fwdir}")
|
2010-08-31 20:35:17 +00:00
|
|
|
mkdir -p "${condir}/${dirname}"
|
2012-07-30 23:34:09 +00:00
|
|
|
dirname=$(basename "${fwdir}")
|
2023-06-14 06:17:10 +00:00
|
|
|
libpath="${source}/lib/${dirname}"
|
|
|
|
if [ -d "${libpath}" ]; then
|
|
|
|
test -d "${condir}/${fwdir}" || (
|
|
|
|
echo Copy framework "${libpath}"
|
|
|
|
cp -pR "${libpath}" "${condir}/${fwdir}"
|
|
|
|
rm -f "${condir}/${fwdir}/${libnm}"_debug "${condir}/${fwdir}/${version}${libnm}"_debug
|
|
|
|
test -f "${condir}/${fwdir}/${libnm}".prl && mv "${condir}/${fwdir}/${libnm}".prl "${condir}/${fwdir}"/Resources
|
|
|
|
test -f "${condir}/${fwdir}/${libnm}"_debug.prl && mv "${condir}/${fwdir}/${libnm}"_debug.prl "${condir}/${fwdir}"/Resources
|
|
|
|
installname -id "@executable_path/../${fwdir}/${version}${libnm}" "${condir}/${fwdir}/${version}${libnm}"
|
|
|
|
find "${condir}/PlugIns" "${condir}/"$(dirname "${fwdir}") -name Headers -prune -o -type f -print | while read filename ; do
|
|
|
|
if [ "${filename}" != "${target}" ]; then
|
|
|
|
otool -L "${filename}" 2>/dev/null | sort -u | while read library ; do
|
|
|
|
# pattern match for: /path/to/qt/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2)
|
|
|
|
case "${library}" in
|
|
|
|
*@rpath/*"${libnm}"*"("*version*")"*)
|
|
|
|
# echo rpath based name for ${libnm} is ok.
|
|
|
|
;;
|
|
|
|
*"${libnm}"*"("*version*")"*)
|
|
|
|
installname -change\
|
|
|
|
"${source}/lib/${dirname}/${version}${libnm}"\
|
|
|
|
"@executable_path/../${fwdir}/${version}${libnm}"\
|
|
|
|
"${filename}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
)
|
|
|
|
installname -change\
|
|
|
|
"${source}/lib/${dirname}/${version}${libnm}"\
|
|
|
|
"@executable_path/../${fwdir}/${version}${libnm}"\
|
|
|
|
"${target}"
|
|
|
|
else
|
|
|
|
echo Warning: Cannot copy framework for "$libnm" ... missing source "${libpath}"
|
|
|
|
fi
|
2010-04-14 13:22:00 +00:00
|
|
|
done
|
2016-08-21 15:50:48 +00:00
|
|
|
if [ -d "${source}"/translations ]; then
|
|
|
|
if [ ! -d "${condir}/translations" ]; then
|
|
|
|
mkdir -p "${condir}/translations"
|
|
|
|
fi
|
|
|
|
echo Copy Qt translations to "${condir}/translations"
|
|
|
|
cp -p "${source}"/translations/qt_*.qm "${condir}/translations"
|
2011-09-05 18:24:54 +00:00
|
|
|
fi
|
2010-04-14 13:22:00 +00:00
|
|
|
}
|
2010-04-09 12:09:11 +00:00
|
|
|
|
|
|
|
# -------------------------
|
|
|
|
# Create universal binaries
|
|
|
|
# -------------------------
|
2010-04-14 13:22:00 +00:00
|
|
|
convert_universal() {
|
|
|
|
cd "${LyxAppPrefix}"
|
2011-04-02 12:16:32 +00:00
|
|
|
for file in ${LYX_FILE_LIST} ; do
|
2010-04-14 13:22:00 +00:00
|
|
|
OBJ_LIST=
|
|
|
|
for arch in ${ARCH_LIST} ; do
|
|
|
|
if [ -f "${BUNDLE_PATH}/${file}-${arch}" ]; then
|
|
|
|
OBJ_LIST="${OBJ_LIST} ${BUNDLE_PATH}/${file}-${arch}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "${OBJ_LIST}" ]; then
|
|
|
|
lipo -create ${OBJ_LIST} -o "${BUNDLE_PATH}/${file}"
|
|
|
|
fi
|
2014-08-22 07:52:39 +00:00
|
|
|
if [ -f "${LibMagicInstallDir}/lib/${LibMagicLibrary}" -a "yes" = "${libmagic_deployment}" ]; then
|
2020-02-20 09:46:22 +00:00
|
|
|
private_framework LibMagic "${LibMagicInstallDir}/lib/${LibMagicLibrary}" "${LYX_BUNDLE_PATH}/${file}" \
|
|
|
|
"${LibMagicVersion}" "${LibMagicInstallHdr}"
|
2013-01-18 20:15:40 +00:00
|
|
|
fi
|
|
|
|
if [ -f "${ASpellInstallDir}/lib/${ASpellLibrary}" -a "yes" = "${aspell_deployment}" ]; then
|
2020-02-20 09:46:22 +00:00
|
|
|
private_framework Aspell "${ASpellInstallDir}/lib/${ASpellLibrary}" "${LYX_BUNDLE_PATH}/${file}" \
|
|
|
|
"${ASpellVersion}" "${ASpellInstallHdr}"
|
2010-04-14 13:22:00 +00:00
|
|
|
fi
|
2013-01-18 20:15:40 +00:00
|
|
|
if [ -f "${HunSpellInstallDir}/lib/${HunSpellLibrary}" -a "yes" = "${hunspell_deployment}" ]; then
|
2020-02-20 09:46:22 +00:00
|
|
|
private_framework Hunspell "${HunSpellInstallDir}/lib/${HunSpellLibrary}" "${LYX_BUNDLE_PATH}/${file}" \
|
|
|
|
"${HunSpellVersion}" "${HunSpellInstallDir}/include/hunspell/"*.hxx "${HunSpellInstallHdr}"
|
2010-05-29 14:36:51 +00:00
|
|
|
fi
|
2014-07-20 16:16:36 +00:00
|
|
|
if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt_deployment}" ]; then
|
2010-04-14 13:22:00 +00:00
|
|
|
deploy_qtlibs "${LYX_BUNDLE_PATH}/${file}"
|
|
|
|
fi
|
|
|
|
otool -L "${BUNDLE_PATH}/${file}" | while read reference ; do
|
|
|
|
case "${reference}" in
|
|
|
|
*"${LyxBuildDir}"*"("*")")
|
|
|
|
echo ERROR: Bad reference to "${reference}" found!!
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
done
|
2010-04-09 12:09:11 +00:00
|
|
|
for arch in ${ARCH_LIST} ; do
|
2020-02-20 09:46:22 +00:00
|
|
|
rm -f "${BUNDLE_PATH}"/*-${arch}
|
2010-04-09 12:09:11 +00:00
|
|
|
done
|
2024-06-24 06:24:45 +00:00
|
|
|
if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt_deployment}" ]; then
|
|
|
|
echo Verify runtime path configuration
|
|
|
|
for file in "${LyxAppPrefix}"/Contents/MacOS/*lyx* $(find "${LyxAppPrefix}"/Contents -name '*.dylib' -print) ; do
|
|
|
|
echo Check "${file}"
|
|
|
|
BAD_FRAMEWORKS=$(otool -L "${file}" | grep 'Qt.*framework' | grep -v '@rpath' | sort -u)
|
|
|
|
if [ -n "${BAD_FRAMEWORKS}" ]; then
|
|
|
|
echo Bad runtime path configuration in "${file}" for frameworks "${BAD_FRAMEWORKS}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2010-04-14 13:22:00 +00:00
|
|
|
}
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2020-02-20 09:47:23 +00:00
|
|
|
# -------------------------
|
|
|
|
# Create code sign signatures
|
|
|
|
# -------------------------
|
|
|
|
code_sign() {
|
|
|
|
target="$1"
|
|
|
|
condir=$(content_directory "${target}"/lyx)
|
|
|
|
appdir=$(dirname "${condir}")
|
|
|
|
# have to sign frameworks first
|
2020-02-21 08:45:09 +00:00
|
|
|
for fwname in Aspell Hunspell LibMagic ; do
|
|
|
|
fwitem="${condir}"/$(framework_name "${fwname}")
|
|
|
|
if [ -d "${fwitem}" ]; then
|
|
|
|
codesign --verbose --force --sign "${CODESIGN_IDENTITY}" "${fwitem}"
|
|
|
|
fi
|
|
|
|
done
|
2020-02-20 09:47:23 +00:00
|
|
|
for csitem in \
|
|
|
|
"${condir}"/Frameworks/Qt*.framework/Versions/${QtFrameworkVersion} \
|
|
|
|
"${condir}"/PlugIns/*/lib*.dylib \
|
|
|
|
"${condir}"/Library/Spotlight/* \
|
|
|
|
"${target}"/inkscape \
|
2020-08-03 15:44:01 +00:00
|
|
|
"${target}"/lilypond \
|
|
|
|
"${target}"/lilypond-book \
|
2020-02-20 09:47:23 +00:00
|
|
|
"${target}"/maxima \
|
|
|
|
"${target}"/tex2lyx \
|
|
|
|
"${target}"/lyxeditor \
|
|
|
|
"${target}"/lyxconvert \
|
|
|
|
"${target}"/lyxclient
|
|
|
|
do
|
|
|
|
codesign --verbose --force --sign "${CODESIGN_IDENTITY}" "${csitem}"
|
|
|
|
done
|
|
|
|
|
|
|
|
/usr/bin/codesign --verbose --force --sign "${CODESIGN_IDENTITY}" "${appdir}" || {
|
|
|
|
echo Warning: codesign failed with certificate named '"'${CODESIGN_IDENTITY}'"'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-23 10:55:02 +00:00
|
|
|
deduplicate() {
|
|
|
|
find "$@" -type f -print | while read file ; do
|
|
|
|
echo $(md5 -q "$file") "$file"
|
|
|
|
done | sort | while read hash file ; do
|
2015-07-24 16:41:26 +00:00
|
|
|
ppath=$(dirname "$pfile")
|
|
|
|
path=$(dirname "$file")
|
|
|
|
if [ "$phash" = "$hash" -a "$ppath" = "$path" ]; then
|
|
|
|
pname=$(basename "$pfile")
|
|
|
|
name=$(basename "$file")
|
2015-07-23 10:55:02 +00:00
|
|
|
cmp -s "$pfile" "$file" && (
|
|
|
|
rm "$file"
|
2015-07-24 16:41:26 +00:00
|
|
|
cd "$path" && ln -s "$pname" "$name" && echo link for "$file" created
|
2015-07-23 10:55:02 +00:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
phash="$hash"
|
|
|
|
pfile="$file"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2010-04-14 13:22:00 +00:00
|
|
|
copy_dictionaries() {
|
2010-07-11 21:30:47 +00:00
|
|
|
if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_dictionaries}" ]; then
|
2010-07-07 17:40:50 +00:00
|
|
|
ASpellResources="${LyxAppPrefix}/Contents/Resources"
|
2010-04-14 13:22:00 +00:00
|
|
|
# try to reuse macports dictionaries for now
|
|
|
|
if [ -d /opt/local/lib/aspell-0.60 ]; then ASpellInstallDir=/opt/local ; fi
|
|
|
|
mkdir -p "${ASpellResources}"
|
|
|
|
echo Copy Aspell dictionaries from "${ASpellInstallDir}"
|
2011-02-18 08:55:24 +00:00
|
|
|
mkdir -p "${ASpellResources}"/data "${ASpellResources}"/dicts
|
2010-07-07 17:40:50 +00:00
|
|
|
cp -p -r "${ASpellInstallDir}/lib/aspell-0.60"/* "${ASpellResources}"/data
|
2011-02-18 08:55:24 +00:00
|
|
|
cp -p -r "${ASpellInstallDir}/share/aspell"/* "${ASpellResources}"/dicts
|
2010-04-14 13:22:00 +00:00
|
|
|
fi
|
2021-07-16 14:35:30 +00:00
|
|
|
if [ -d "${DictionarySourceDir}" -a "yes" = "${hunspell_dictionaries}" ]; then
|
2010-05-29 14:36:51 +00:00
|
|
|
HunSpellResources="${LyxAppPrefix}/Contents/Resources"
|
2021-07-16 14:35:30 +00:00
|
|
|
( cd "${DictionarySourceDir}" && find dicts -name .svn -prune -o -type f -print | cpio -pmdv "${HunSpellResources}" )
|
|
|
|
deduplicate "${HunSpellResources}"/dicts
|
2010-05-29 14:36:51 +00:00
|
|
|
fi
|
|
|
|
if [ -d "${DictionarySourceDir}" -a "yes" = "${thesaurus_deployment}" ]; then
|
|
|
|
MyThesResources="${LyxAppPrefix}/Contents/Resources"
|
2011-02-18 08:55:24 +00:00
|
|
|
( cd "${DictionarySourceDir}" && find thes -name .svn -prune -o -type f -print | cpio -pmdv "${MyThesResources}" )
|
2015-07-23 10:55:02 +00:00
|
|
|
deduplicate "${MyThesResources}"/thes
|
2010-05-29 14:36:51 +00:00
|
|
|
fi
|
2010-04-14 13:22:00 +00:00
|
|
|
}
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2011-04-02 12:16:32 +00:00
|
|
|
set_bundle_display_options() {
|
2011-05-28 12:35:38 +00:00
|
|
|
X_BOUNDS=$2
|
|
|
|
Y_BOUNDS=$3
|
|
|
|
Y_POSITION=$((Y_BOUNDS - 65))
|
2022-01-10 06:48:54 +00:00
|
|
|
Y_BOUNDS=$((Y_BOUNDS + 50))
|
2011-05-28 12:35:38 +00:00
|
|
|
LYX_X_POSITION=$((X_BOUNDS / 4))
|
|
|
|
LYX_Y_POSITION=$Y_POSITION
|
|
|
|
APP_X_POSITION=$((3 * X_BOUNDS / 4))
|
|
|
|
APP_Y_POSITION=$Y_POSITION
|
2013-05-25 18:16:10 +00:00
|
|
|
WITH_DOCUMENTS=$(test -d "${1}/Documents" && echo true || echo false)
|
2010-04-09 12:09:11 +00:00
|
|
|
osascript <<-EOF
|
2011-05-28 12:35:38 +00:00
|
|
|
tell application "Finder"
|
2010-04-09 12:09:11 +00:00
|
|
|
set f to POSIX file ("${1}" as string) as alias
|
|
|
|
tell folder f
|
|
|
|
open
|
|
|
|
tell container window
|
|
|
|
set toolbar visible to false
|
|
|
|
set statusbar visible to false
|
|
|
|
set current view to icon view
|
|
|
|
delay 1 -- sync
|
2011-05-28 12:35:38 +00:00
|
|
|
set the bounds to {20, 50, $X_BOUNDS, $Y_BOUNDS}
|
2010-04-09 12:09:11 +00:00
|
|
|
end tell
|
|
|
|
delay 1 -- sync
|
|
|
|
set icon size of the icon view options of container window to 64
|
|
|
|
set arrangement of the icon view options of container window to not arranged
|
2013-05-25 18:16:10 +00:00
|
|
|
if ${WITH_DOCUMENTS} then
|
|
|
|
set position of item "Documents" to {$LYX_X_POSITION,0}
|
|
|
|
end if
|
2011-05-28 12:35:38 +00:00
|
|
|
set position of item "${LyxName}.app" to {$LYX_X_POSITION,$LYX_Y_POSITION}
|
|
|
|
set position of item "Applications" to {$APP_X_POSITION,$APP_Y_POSITION}
|
2010-04-09 12:09:11 +00:00
|
|
|
set background picture of the icon view options\
|
2013-05-25 18:16:10 +00:00
|
|
|
of container window to file "background.png" of folder "Pictures"
|
2011-05-28 12:35:38 +00:00
|
|
|
set the bounds of the container window to {0, 0, $X_BOUNDS, $Y_BOUNDS}
|
2010-04-09 12:09:11 +00:00
|
|
|
update without registering applications
|
|
|
|
delay 5 -- sync
|
|
|
|
close
|
|
|
|
end tell
|
|
|
|
delay 5 -- sync
|
|
|
|
end tell
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2022-01-10 06:48:54 +00:00
|
|
|
# The image was made with with inkscape and tiffutil from dmg-background.svgz
|
|
|
|
make_image() {
|
|
|
|
INKSCAPE=/Applications/Inkscape.app/Contents/MacOS/inkscape
|
2022-12-16 15:10:34 +00:00
|
|
|
(
|
|
|
|
cd "${LyxSourceDir}"/development/MacOSX
|
|
|
|
test -x ${INKSCAPE} && ${INKSCAPE} --export-type=png -w 560 -o dmg-background.png dmg-background.svgz
|
|
|
|
test -x ${INKSCAPE} && ${INKSCAPE} --export-type=png -w 1120 -o dmg-background@2x.png dmg-background.svgz
|
|
|
|
tiffutil -cathidpicheck dmg-background.png dmg-background@2x.png -out dmg-background.tiff
|
|
|
|
)
|
2022-01-10 06:48:54 +00:00
|
|
|
}
|
|
|
|
|
2011-04-02 12:16:32 +00:00
|
|
|
make_dmg() {
|
2010-04-14 13:22:00 +00:00
|
|
|
cd "${1}"
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2022-12-16 15:10:34 +00:00
|
|
|
test -f "${DmgBackground}" || make_image
|
2022-01-10 06:48:54 +00:00
|
|
|
BGSIZE=$(file "$DmgBackground" | awk -F , '/TIFF/{ print $10 $4 ;}/PNG/{ print $2; }'|sed -e 's/width=//' -e 's/height=//' -e 's/x//')
|
2012-07-30 23:34:09 +00:00
|
|
|
BG_W=$(echo ${BGSIZE} | awk '{print $1 }')
|
|
|
|
BG_H=$(echo ${BGSIZE} | awk '{print $2 }')
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2010-05-29 14:36:51 +00:00
|
|
|
rm -f "${DMGNAME}.sparseimage" "${DMGNAME}.dmg"
|
2010-04-09 12:09:11 +00:00
|
|
|
|
2010-04-14 13:22:00 +00:00
|
|
|
hdiutil create -type SPARSE -size ${DMGSIZE:-"250m"} -fs HFS+ -volname "${LyxBase}" "${DMGNAME}"
|
2010-04-09 12:09:11 +00:00
|
|
|
# Unmount currently mounted disk image
|
2014-10-24 16:14:42 +00:00
|
|
|
mount | grep "${LyxBase}" && umount /Volumes/"${LyxBase}"
|
|
|
|
test -d /Volumes/"${LyxBase}" && rmdir /Volumes/"${LyxBase}"
|
2010-04-09 12:09:11 +00:00
|
|
|
|
|
|
|
# Mount the disk image
|
2017-04-14 20:14:21 +00:00
|
|
|
DEVICES=$(hdiutil attach "${DMGNAME}.sparseimage" | cut -f 1)
|
2010-04-09 12:09:11 +00:00
|
|
|
|
|
|
|
# Obtain device information
|
2017-04-14 20:14:21 +00:00
|
|
|
DEVICE=$(echo $DEVICES | cut -f 1 -d ' ')
|
|
|
|
VOLUME=$(mount |grep ${DEVICE} | cut -f 3 -d ' ')
|
2010-04-09 12:09:11 +00:00
|
|
|
|
|
|
|
# copy in the application bundle
|
2020-02-21 17:04:28 +00:00
|
|
|
ditto --hfsCompression "${LyxAppPrefix}" "${VOLUME}/${LyxName}.app"
|
2010-04-09 12:09:11 +00:00
|
|
|
|
|
|
|
# copy in background image
|
2010-05-29 14:36:51 +00:00
|
|
|
mkdir -p "${VOLUME}/Pictures"
|
2017-04-14 20:15:50 +00:00
|
|
|
ditto --hfsCompression "${DmgBackground}" "${VOLUME}/Pictures/background.png"
|
2010-04-09 12:09:11 +00:00
|
|
|
# symlink applications
|
2010-05-29 14:36:51 +00:00
|
|
|
ln -s /Applications/ "${VOLUME}"/Applications
|
2017-04-14 20:15:50 +00:00
|
|
|
test -d "${DocumentationDir}" && ditto --hfsCompression "${DocumentationDir}" "${VOLUME}"
|
2011-05-28 12:35:38 +00:00
|
|
|
set_bundle_display_options "${VOLUME}" ${BG_W} ${BG_H}
|
2020-03-29 16:56:53 +00:00
|
|
|
PATH="${XCODE_DEVELOPER}/Tools:$PATH" SetFile -a C "${VOLUME}"
|
2010-05-29 14:36:51 +00:00
|
|
|
mv "${VOLUME}/Pictures" "${VOLUME}/.Pictures"
|
2010-04-09 12:09:11 +00:00
|
|
|
|
|
|
|
# Unmount the disk image
|
2017-04-14 20:14:21 +00:00
|
|
|
hdiutil detach ${DEVICE}
|
2010-04-09 12:09:11 +00:00
|
|
|
|
|
|
|
# Convert the disk image to read-only
|
2010-05-29 14:36:51 +00:00
|
|
|
hdiutil convert "${DMGNAME}.sparseimage" -format UDBZ -o "${DMGNAME}.dmg"
|
|
|
|
rm -f "${DMGNAME}.sparseimage"
|
2010-04-14 13:22:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
# Building distribution packages
|
|
|
|
# ------------------------------
|
|
|
|
|
2011-05-28 12:35:38 +00:00
|
|
|
build_package() {
|
2011-04-02 12:16:32 +00:00
|
|
|
test -n "${LyxAppZip}" && (
|
|
|
|
cd "${LyxAppPrefix}" && zip -r "${LyxAppZip}" .
|
|
|
|
)
|
|
|
|
|
2014-07-16 20:25:25 +00:00
|
|
|
DMGARCH=""
|
|
|
|
for arch in ${ARCH_LIST} ; do
|
|
|
|
DMGARCH="${DMGARCH}-${arch}"
|
|
|
|
done
|
2021-12-06 06:51:26 +00:00
|
|
|
QtDmgArchSuffix="qt"${QtMajorVersion}${DMGARCH}${QtAPI}.dmg
|
2014-07-16 20:25:25 +00:00
|
|
|
|
2011-04-02 12:16:32 +00:00
|
|
|
test -n "${DMGLocation}" && (
|
|
|
|
make_dmg "${DMGLocation}"
|
2014-07-20 16:16:36 +00:00
|
|
|
if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt_deployment}" ]; then
|
2014-07-16 20:25:25 +00:00
|
|
|
rm -f "${DMGLocation}/${DMGNAME}+${QtDmgArchSuffix}"
|
|
|
|
echo move to "${DMGLocation}/${DMGNAME}+${QtDmgArchSuffix}"
|
|
|
|
mv "${DMGLocation}/${DMGNAME}.dmg" "${DMGLocation}/${DMGNAME}+${QtDmgArchSuffix}"
|
2011-04-02 12:16:32 +00:00
|
|
|
fi
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
# main block
|
|
|
|
# ------------------------------
|
|
|
|
|
2011-05-28 12:35:38 +00:00
|
|
|
if [ ${LyxOnlyPackage:-"no"} = "no" ]; then
|
|
|
|
build_lyx
|
|
|
|
convert_universal
|
|
|
|
copy_dictionaries
|
2021-10-24 19:43:23 +00:00
|
|
|
find "${LyxAppPrefix}" -type d -exec chmod go-w '{}' \;
|
2022-12-30 11:07:20 +00:00
|
|
|
test -n "${CODESIGN_IDENTITY}" && code_sign "${LYX_BUNDLE_PATH}"
|
2011-05-28 12:35:38 +00:00
|
|
|
fi
|
|
|
|
build_package
|