Create private frameworks on Mac with standard conforming internal structure

This commit is contained in:
Stephan Witt 2020-02-20 10:46:22 +01:00
parent 4e4bba441d
commit dc5221852c
2 changed files with 58 additions and 11 deletions

View File

@ -5,7 +5,7 @@
# This script automates creating universal binaries of LyX on Mac. # This script automates creating universal binaries of LyX on Mac.
# Author: Bennett Helm (and extended by Konrad Hofbauer) # Author: Bennett Helm (and extended by Konrad Hofbauer)
# latest changes by Stephan Witt # latest changes by Stephan Witt
# Last modified: July 2014 # Last modified: February 2020
QtAPI=${QtAPI:-"-cocoa"} QtAPI=${QtAPI:-"-cocoa"}
QtVersion=${QtVersion:-"4.6.3"} QtVersion=${QtVersion:-"4.6.3"}
@ -630,6 +630,7 @@ framework_name() {
LYX_FILE_LIST="lyx lyxclient tex2lyx lyxconvert" LYX_FILE_LIST="lyx lyxclient tex2lyx lyxconvert"
BUNDLE_PATH="Contents/MacOS" BUNDLE_PATH="Contents/MacOS"
LYX_BUNDLE_PATH="${LyxAppPrefix}/${BUNDLE_PATH}" LYX_BUNDLE_PATH="${LyxAppPrefix}/${BUNDLE_PATH}"
build_lyx() { build_lyx() {
# Clear Output # Clear Output
if [ -n "${LyxAppZip}" -a -f "${LyxAppZip}" ]; then rm "${LyxAppZip}"; fi if [ -n "${LyxAppZip}" -a -f "${LyxAppZip}" ]; then rm "${LyxAppZip}"; fi
@ -729,15 +730,36 @@ installname() {
} }
private_framework() { private_framework() {
fwdir=$(framework_name "$1") fwname="$1" ; shift
source="$2" source="$1" ; shift
target="$3" 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}") condir=$(content_directory "${target}")
libnm=$(basename "${source}") libnm=$(basename "${source}")
mkdir -p "${condir}/${fwdir}" libid="org.lyx."$(echo "${libnm}" | cut -d. -f1)
if [ ! -f "${condir}/${fwdir}/${libnm}" ]; then svrsn=$(echo "${version}" | cut -d. -f1-2)
cp -p "${source}" "${condir}/${fwdir}" 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}" 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 fi
installname -change "${source}" "@executable_path/../${fwdir}/${libnm}" "${target}" installname -change "${source}" "@executable_path/../${fwdir}/${libnm}" "${target}"
} }
@ -823,13 +845,16 @@ convert_universal() {
lipo -create ${OBJ_LIST} -o "${BUNDLE_PATH}/${file}" lipo -create ${OBJ_LIST} -o "${BUNDLE_PATH}/${file}"
fi fi
if [ -f "${LibMagicInstallDir}/lib/${LibMagicLibrary}" -a "yes" = "${libmagic_deployment}" ]; then 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 fi
if [ -f "${ASpellInstallDir}/lib/${ASpellLibrary}" -a "yes" = "${aspell_deployment}" ]; then 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 fi
if [ -f "${HunSpellInstallDir}/lib/${HunSpellLibrary}" -a "yes" = "${hunspell_deployment}" ]; then 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 fi
if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt_deployment}" ]; then if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt_deployment}" ]; then
deploy_qtlibs "${LYX_BUNDLE_PATH}/${file}" deploy_qtlibs "${LYX_BUNDLE_PATH}/${file}"
@ -843,7 +868,7 @@ convert_universal() {
done done
done done
for arch in ${ARCH_LIST} ; do for arch in ${ARCH_LIST} ; do
rm -f ${BUNDLE_PATH}/*-${arch} rm -f "${BUNDLE_PATH}"/*-${arch}
done done
} }

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>@CFBundleExecutable@</string>
<key>CFBundleGetInfoString</key>
<string>Created by LyX packager</string>
<key>CFBundleIdentifier</key>
<string>@CFBundleIdentifier@</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>@CFBundleShortVersionString@</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@CFBundleVersion@</string>
<key>NOTE</key>
<string>Please, do NOT change this file -- It was generated by LyX packager.</string>
</dict>
</plist>