From dc5221852cf2f1f5c2bbe1c5718687c7deb93b40 Mon Sep 17 00:00:00 2001 From: Stephan Witt Date: Thu, 20 Feb 2020 10:46:22 +0100 Subject: [PATCH] Create private frameworks on Mac with standard conforming internal structure --- development/LyX-Mac-binary-release.sh | 47 ++++++++++++++----- development/LyX-Mac-frameworks-template.plist | 22 +++++++++ 2 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 development/LyX-Mac-frameworks-template.plist diff --git a/development/LyX-Mac-binary-release.sh b/development/LyX-Mac-binary-release.sh index b754221056..2cb6f75a44 100644 --- a/development/LyX-Mac-binary-release.sh +++ b/development/LyX-Mac-binary-release.sh @@ -5,7 +5,7 @@ # This script automates creating universal binaries of LyX on Mac. # Author: Bennett Helm (and extended by Konrad Hofbauer) # latest changes by Stephan Witt -# Last modified: July 2014 +# Last modified: February 2020 QtAPI=${QtAPI:-"-cocoa"} QtVersion=${QtVersion:-"4.6.3"} @@ -630,6 +630,7 @@ framework_name() { LYX_FILE_LIST="lyx lyxclient tex2lyx lyxconvert" BUNDLE_PATH="Contents/MacOS" LYX_BUNDLE_PATH="${LyxAppPrefix}/${BUNDLE_PATH}" + build_lyx() { # Clear Output if [ -n "${LyxAppZip}" -a -f "${LyxAppZip}" ]; then rm "${LyxAppZip}"; fi @@ -729,15 +730,36 @@ installname() { } private_framework() { - fwdir=$(framework_name "$1") - source="$2" - target="$3" + 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}") condir=$(content_directory "${target}") libnm=$(basename "${source}") - mkdir -p "${condir}/${fwdir}" - if [ ! -f "${condir}/${fwdir}/${libnm}" ]; then - cp -p "${source}" "${condir}/${fwdir}" + 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 + if [ ! -f "${condir}/${fwdir}/Versions/${fwvrsn}/${libnm}" ]; then + cp -p "${source}" "${condir}/${fwdir}/Versions/${fwvrsn}/${libnm}" + 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" + ln -s Versions/Current/"${libnm}" "${condir}/${fwdir}/${libnm}" + ln -s Versions/Current/"${libnm}" "${condir}/${fwdir}/${fwname}" installname -id "@executable_path/../${fwdir}/${libnm}" "${condir}/${fwdir}/${libnm}" + if [ -f "${LyxSourceDir}"/development/LyX-Mac-frameworks-template.plist ]; then + cat "${LyxSourceDir}"/development/LyX-Mac-frameworks-template.plist | sed \ + -e "s/@CFBundleExecutable@/${libnm}/" \ + -e "s/@CFBundleIdentifier@/${libid}/" \ + -e "s/@CFBundleShortVersionString@/${svrsn}/" \ + -e "s/@CFBundleVersion@/${version}/" > "${condir}/${fwdir}"/Resources/Info.plist + fi fi installname -change "${source}" "@executable_path/../${fwdir}/${libnm}" "${target}" } @@ -823,13 +845,16 @@ convert_universal() { lipo -create ${OBJ_LIST} -o "${BUNDLE_PATH}/${file}" fi if [ -f "${LibMagicInstallDir}/lib/${LibMagicLibrary}" -a "yes" = "${libmagic_deployment}" ]; then - private_framework LibMagic "${LibMagicInstallDir}/lib/${LibMagicLibrary}" "${LYX_BUNDLE_PATH}/${file}" + private_framework LibMagic "${LibMagicInstallDir}/lib/${LibMagicLibrary}" "${LYX_BUNDLE_PATH}/${file}" \ + "${LibMagicVersion}" "${LibMagicInstallHdr}" fi if [ -f "${ASpellInstallDir}/lib/${ASpellLibrary}" -a "yes" = "${aspell_deployment}" ]; then - private_framework Aspell "${ASpellInstallDir}/lib/${ASpellLibrary}" "${LYX_BUNDLE_PATH}/${file}" + private_framework Aspell "${ASpellInstallDir}/lib/${ASpellLibrary}" "${LYX_BUNDLE_PATH}/${file}" \ + "${ASpellVersion}" "${ASpellInstallHdr}" fi if [ -f "${HunSpellInstallDir}/lib/${HunSpellLibrary}" -a "yes" = "${hunspell_deployment}" ]; then - private_framework Hunspell "${HunSpellInstallDir}/lib/${HunSpellLibrary}" "${LYX_BUNDLE_PATH}/${file}" + private_framework Hunspell "${HunSpellInstallDir}/lib/${HunSpellLibrary}" "${LYX_BUNDLE_PATH}/${file}" \ + "${HunSpellVersion}" "${HunSpellInstallDir}/include/hunspell/"*.hxx "${HunSpellInstallHdr}" fi if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt_deployment}" ]; then deploy_qtlibs "${LYX_BUNDLE_PATH}/${file}" @@ -843,7 +868,7 @@ convert_universal() { done done for arch in ${ARCH_LIST} ; do - rm -f ${BUNDLE_PATH}/*-${arch} + rm -f "${BUNDLE_PATH}"/*-${arch} done } diff --git a/development/LyX-Mac-frameworks-template.plist b/development/LyX-Mac-frameworks-template.plist new file mode 100644 index 0000000000..495fd57509 --- /dev/null +++ b/development/LyX-Mac-frameworks-template.plist @@ -0,0 +1,22 @@ + + + + + CFBundleExecutable + @CFBundleExecutable@ + CFBundleGetInfoString + Created by LyX packager + CFBundleIdentifier + @CFBundleIdentifier@ + CFBundlePackageType + FMWK + CFBundleShortVersionString + @CFBundleShortVersionString@ + CFBundleSignature + ???? + CFBundleVersion + @CFBundleVersion@ + NOTE + Please, do NOT change this file -- It was generated by LyX packager. + +