5 # This script automates creating universal binaries of LyX on Mac.
6 # Author: Bennett Helm (and extended by Konrad Hofbauer)
7 # latest changes by Stephan Witt
8 # Last modified: August 2012
11 Qt4Version=${Qt4Version:-"4.6.3"}
12 Qt4SourceVersion="qt-everywhere-opensource-src-${Qt4Version}"
13 Qt4BuildSubDir="qt-${Qt4Version}-build${MAC_API}"
15 unset DYLD_LIBRARY_PATH LD_LIBRARY_PATH
18 # * a decent checkout of LyX sources (probably you have it already)
19 # * Qt4 - build with shared or static libraries for the used platforms (default: i386 and ppc)
20 # or - an unpacked source tree of Qt4 in $QT4SOURCEDIR or in the sibling directory (variable Qt4SourceVersion)
21 # * for aspell support:
22 # the aspell sources placed in a sibling directory (variable ASpellSourceVersion)
23 # * for hunspell support:
24 # the hunspell sources placed in a sibling directory (variable HunSpellSourceVersion)
25 # * for dictionary deployment (per default thesauri only):
26 # - aspell: the dictionary files of macports (in /opt/local/share/aspell and /opt/local/lib/aspell-0.60)
27 # - hunspell: the dictionary files in the sibling directory dictionaries/dicts
28 # - mythes: the data and idx files in the sibling directory dictionaries/thes
30 LyXConfigureOptions="--enable-warnings --enable-optimization=-Os --with-included-gettext --with-x=no"
31 AspellConfigureOptions="--enable-warnings --enable-optimization=-O0 --enable-debug --disable-nls --enable-compile-in-filters --disable-pspell-compatibility"
32 HunspellConfigureOptions="--with-warnings --disable-nls --with-included-gettext --disable-static"
33 Qt4ConfigureOptions="-opensource -silent -shared -release -fast -no-exceptions"
34 Qt4ConfigureOptions="${Qt4ConfigureOptions} -no-webkit -no-qt3support -no-javascript-jit -no-dbus"
35 Qt4ConfigureOptions="${Qt4ConfigureOptions} -nomake examples -nomake demos -nomake docs -nomake tools"
36 Qt4ConfigureOptions="${Qt4ConfigureOptions} ${MAC_API}"
38 aspell_dictionaries="no"
39 hunspell_dictionaries="yes"
41 aspell_deployment="yes"
42 hunspell_deployment="yes"
43 thesaurus_deployment="yes"
47 if [ -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" ]; then
48 DEVELOPER_SDKS="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs"
49 XCODE_DEVELOPER="/Applications/Xcode.app/Contents/Developer"
50 MACOSX_DEPLOYMENT_TARGET="10.7" # Tiger support is default
51 SDKROOT="${DEVELOPER_SDKS}/MacOSX10.7.sdk" # Leopard build is default
52 elif [ -d "/Developer/SDKs" ]; then
53 DEVELOPER_SDKS="/Developer/SDKs"
54 XCODE_DEVELOPER="/Developer"
55 MACOSX_DEPLOYMENT_TARGET="10.4" # Tiger support is default
56 SDKROOT="${DEVELOPER_SDKS}/MacOSX10.5.sdk" # Leopard build is default
59 # detection of script home
60 LyxSourceDir=$(dirname "$0")
61 if [ ! -d "${LyxSourceDir}" ]; then
62 echo Missing LyX source directory.
65 case "${LyxSourceDir}" in
67 LyxSourceDir=$(dirname "${LyxSourceDir}")
71 */development|development)
72 LyxSourceDir=$(dirname "${LyxSourceDir}")
73 LyxSourceDir=$(cd "${LyxSourceDir}";pwd)
76 LyxSourceDir=$(cd "${LyxSourceDir}";pwd)
81 echo "*" Build script for LyX on Mac OS X
83 echo Optional arguments:
84 echo " --aspell-deployment=yes|no ." default yes
85 echo " --with-qt4-frameworks=yes|no" default no
86 echo " --qt4-deployment=yes|no ...." default yes
87 echo " --with-macosx-target=TARGET " default 10.4 "(Tiger)"
88 echo " --with-sdkroot=SDKROOT ....." default 10.5 "(Leopard)"
89 echo " --with-arch=ARCH ..........." default ppc,i386
90 echo " --with-build-path=PATH ....." default \${lyx-src-dir}/../lyx-build
91 echo " --with-dmg-location=PATH ..." default \${build-path}
93 echo "All other arguments with -- are passed to configure"
94 echo "including the defaults: ${LyXConfigureOptions}"
95 if [ -x "${LyxSourceDir}/configure" ]; then
97 echo "*" Configure options of LyX
99 "${LyxSourceDir}/configure" --help
104 while [ $# -gt 0 ]; do
106 --with-qt4-frameworks=*)
107 configure_qt4_frameworks=$(echo ${1}|cut -d= -f2)
108 if [ "$configure_qt4_frameworks" = "yes" ]; then
115 QTDIR=$(echo ${1}|cut -d= -f2)
118 --with-macosx-target=*)
119 MACOSX_DEPLOYMENT_TARGET=$(echo ${1}|cut -d= -f2)
123 SDKROOT=$(echo ${1}|cut -d= -f2)
126 SDKROOT="${DEVELOPER_SDKS}/MacOSX10.4u.sdk"
132 SDKROOT="${DEVELOPER_SDKS}/MacOSX${SDKROOT}.sdk"
140 --aspell-deployment=*)
141 aspell_deployment=$(echo ${1}|cut -d= -f2)
142 aspell_dictionaries=$aspell_deployment
145 --hunspell-deployment=*)
146 hunspell_deployment=$(echo ${1}|cut -d= -f2)
147 hunspell_dictionaries=$hunspell_deployment
150 --thesaurus-deployment=*)
151 thesaurus_deployment=$(echo ${1}|cut -d= -f2)
155 qt4_deployment=$(echo ${1}|cut -d= -f2)
159 ARCH=$(echo ${1}|cut -d= -f2|tr ',' ' ')
160 ARCH_LIST="${ARCH_LIST} ${ARCH}"
163 --with-dmg-location=*)
164 DMGLocation=$(echo ${1}|cut -d= -f2)
168 LyxBuildDir=$(echo ${1}|cut -d= -f2)
175 LyXConfigureOptions="${LyXConfigureOptions} ${1}"
176 aspell_deployment="no"
180 LyXConfigureOptions="${LyXConfigureOptions} ${1}"
181 hunspell_deployment="no"
185 LyxOnlyPackage=$(echo ${1}|cut -d= -f2)
189 LyXConfigureOptions="${LyXConfigureOptions} ${1}"
198 if [ "${configure_qt4_frameworks}" != "yes" ]; then
199 QtInstallDir=${QTDIR:-"/opt/qt4"}
201 QtFrameworkVersion="4"
202 ASpellSourceVersion="aspell-0.60.6"
203 HunSpellSourceVersion="hunspell-1.2.12"
205 ARCH_LIST=${ARCH_LIST:-"ppc i386"}
210 LyxBuildDir=${LyxBuildDir:-$(dirname "${LyxSourceDir}")/lyx-build}
211 DMGLocation=${DMGLocation:-"${LyxBuildDir}"}
213 ASpellSourceDir=${ASPELLDIR:-$(dirname "${LyxSourceDir}")/${ASpellSourceVersion}}
214 ASpellInstallDir=${ASpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib}
215 HunSpellSourceDir=${HUNSPELLDIR:-$(dirname "${LyxSourceDir}")/${HunSpellSourceVersion}}
216 HunSpellInstallDir=${HunSpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib}
217 Qt4SourceDir=${QT4SOURCEDIR:-$(dirname "${LyxSourceDir}")/${Qt4SourceVersion}}
218 Qt4BuildDir=${Qt4BuildDir:-"${LyxBuildDir}"/${Qt4BuildSubDir:-"qt4-build"}}
219 DictionarySourceDir=${DICTIONARYDIR:-$(dirname "${LyxSourceDir}")/dictionaries}
220 DocumentationDir=$(dirname "${LyxSourceDir}")/Documents
221 DmgBackground="${LyxSourceDir}"/development/MacOSX/dmg-background.png
223 ASpellInstallHdr="${ASpellInstallDir}/include/aspell.h"
224 HunSpellInstallHdr="${HunSpellInstallDir}/include/hunspell/hunspell.h"
226 if [ -z "${LyXVersion}" ]; then
227 LyXVersion=$(grep AC_INIT "${LyxSourceDir}"/configure.ac | cut -d, -f2 | tr -d " ()")
229 LyXVersionSuffix=${LyXVersionSuffix:-$(echo "${LyXVersion}" | cut -d. -f1-2)}
232 LyxBase="${LyxName}-${LyXVersion}"
233 LyxApp="${LyxBase}.app"
234 LyxAppDir="${LyxBuildDir}"/"${LyxBase}"
235 LyxBuildDir="${LyxAppDir}.build"
236 LyxAppPrefix="${LyxAppDir}.app"
237 # if zip file is needed... remove the comment sign
238 #LyxAppZip="${LyxAppPrefix}.zip"
240 # ---------------------------------
241 # DON'T MODIFY ANYTHING BELOW HERE!
242 # ---------------------------------
244 # don't change order here...
245 QtLibraries="QtSvg QtXml QtGui QtNetwork QtCore"
250 # Check for existing SDKs
251 SDKs=$(echo ${DEVELOPER_SDKS}/MacOSX10*sdk)
256 MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-"10.5"}; export MACOSX_DEPLOYMENT_TARGET
257 case "${MACOSX_DEPLOYMENT_TARGET}" in
259 SDKROOT="${DEVELOPER_SDKS}/MacOSX10.6.sdk"; export SDKROOT
262 SDKROOT=${SDKROOT:-"${DEVELOPER_SDKS}/MacOSX10.5.sdk"}; export SDKROOT
267 MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-"10.4"}; export MACOSX_DEPLOYMENT_TARGET
268 SDKROOT=${SDKROOT:-"${DEVELOPER_SDKS}/MacOSX10.5.sdk"}; export SDKROOT
271 echo Unknown or missing SDK for Mac OS X.
275 MYCFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}"
277 # These variables define the identifiers of the
278 # system (both Intel and PowerPC) to compile for.
279 # (Note: darwin8 is 10.4; darwin9 is 10.5.)
280 # Only change these if necessary
282 HostSystem_i386="i686-apple-darwin8"
283 HostSystem_ppc="powerpc-apple-darwin8"
285 if [ "${configure_qt4_frameworks}" != "yes" -a -d "${Qt4SourceDir}" -a ! \( -d "${Qt4BuildDir}" -a -d "${QtInstallDir}" \) ]; then
286 echo Build Qt4 library ${Qt4SourceDir}
287 if [ "${QtInstallDir}" = "${Qt4BuildDir}" ]; then
288 echo Bad install directory for Qt.
289 echo Must be different from build directory "${Qt4BuildDir}".
293 mkdir -p "${Qt4BuildDir}" && cd "${Qt4BuildDir}"
294 for arch in ${ARCH_LIST} ; do
295 ARCHS="${ARCHS} -arch ${arch}"
297 echo configure options:
298 echo ${Qt4ConfigureOptions} ${ARCHS} -prefix "${QtInstallDir}"
299 echo yes | "${Qt4SourceDir}"/configure ${Qt4ConfigureOptions} ${ARCHS} -prefix "${QtInstallDir}"
302 cd "${QtInstallDir}" && (
305 for libnm in ${QtLibraries} ; do
306 test -d ${libnm} -o -L ${libnm} || ln -s ../lib/${libnm}.framework/Headers ${libnm}
311 if [ -d "${HunSpellSourceDir}" -a ! -f "${HunSpellInstallHdr}" ]; then
312 # we have a private HunSpell source tree at hand...
313 # so let's build and install it
314 if [ -z "${HunSpellVersion}" ]; then
315 HunSpellVersion=$(grep AC_INIT "${HunSpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " ()")
318 HunSpellName="Hunspell"
319 HunSpellBase="${HunSpellName}-${HunSpellVersion}"
321 echo Build hunspell library ${HunSpellBase}
322 echo configure options:
323 echo --prefix="${HunSpellInstallDir}" ${HunspellConfigureOptions}
325 cd "${HunSpellSourceDir}"
327 # ----------------------------------------
328 # Build HunSpell for different architectures
329 # ----------------------------------------
330 FILE_LIST="libhunspell-1.2.0.dylib"
332 for arch in ${ARCH_LIST} ; do
334 CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
335 LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
336 HOSTSYSTEM=$(eval "echo \\$HostSystem_$arch")
337 "${HunSpellSourceDir}/configure"\
338 --prefix="${HunSpellInstallDir}"\
339 ${HunspellConfigureOptions}
340 make && make install${strip}
341 for file in ${FILE_LIST} ; do
342 if [ -f "${HunSpellInstallDir}"/lib/${file} ]; then
343 mv "${HunSpellInstallDir}"/lib/${file}\
344 "${HunSpellInstallDir}"/lib/${file}-${arch}
346 echo Cannot build and install HunSpell for ${arch}.
351 # -------------------------
352 # Create universal binaries
353 # -------------------------
354 for file in ${FILE_LIST} ; do
356 for arch in ${ARCH_LIST} ; do
357 OBJ_LIST="${OBJ_LIST} lib/${file}-${arch}"
360 cd "${HunSpellInstallDir}"
361 lipo -create ${OBJ_LIST} -o lib/${file}
362 # check for the "missing link"...
363 test -f lib/libhunspell.dylib || (cd lib ; ln -s libhunspell-1.2.dylib libhunspell.dylib)
369 for arch in ${ARCH_LIST} ; do
370 rm -f "${HunSpellInstallDir}"/lib/*-${arch}
374 if [ -d "${ASpellSourceDir}" -a ! -f "${ASpellInstallHdr}" -a "yes" = "${aspell_deployment}" ]; then
375 # we have a private ASpell source tree at hand...
376 # so let's build and install it
377 if [ -z "${ASpellVersion}" ]; then
378 ASpellVersion=$(grep AC_INIT "${ASpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " ()")
382 ASpellBase="${ASpellName}-${ASpellVersion}"
384 echo Build aspell library ${ASpellBase}
385 echo configure options:
386 echo --prefix="${ASpellInstallDir}" ${AspellConfigureOptions}
388 # ASpell builds inplace only :(
389 cd "${ASpellSourceDir}"
391 # ----------------------------------------
392 # Build ASpell for different architectures
393 # ----------------------------------------
394 FILE_LIST="libaspell.15.dylib"
396 for arch in ${ARCH_LIST} ; do
398 CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
399 LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
400 HOSTSYSTEM=$(eval "echo \\$HostSystem_$arch")
401 CXXFLAGS=-g "${ASpellSourceDir}/configure"\
402 --prefix="${ASpellInstallDir}"\
403 ${AspellConfigureOptions}
404 make && make install${aspellstrip}
405 for file in ${FILE_LIST} ; do
406 if [ -f "${ASpellInstallDir}"/lib/${file} ]; then
407 mv "${ASpellInstallDir}"/lib/${file}\
408 "${ASpellInstallDir}"/lib/${file}-${arch}
410 echo Cannot build and install ASpell for ${arch}.
415 # -------------------------
416 # Create universal binaries
417 # -------------------------
418 for file in ${FILE_LIST} ; do
420 for arch in ${ARCH_LIST} ; do
421 OBJ_LIST="${OBJ_LIST} lib/${file}-${arch}"
424 cd "${ASpellInstallDir}"
425 lipo -create ${OBJ_LIST} -o lib/${file}
431 for arch in ${ARCH_LIST} ; do
432 rm -f "${ASpellInstallDir}"/lib/*-${arch}
438 echo "Frameworks/${1}.framework"
441 LYX_FILE_LIST="lyx lyxclient tex2lyx"
442 BUNDLE_PATH="Contents/MacOS"
443 LYX_BUNDLE_PATH="${LyxAppPrefix}/${BUNDLE_PATH}"
446 if [ -n "${LyxAppZip}" -a -f "${LyxAppZip}" ]; then rm "${LyxAppZip}"; fi
447 if [ -d "${LyxAppPrefix}" ]; then rm -rf "${LyxAppPrefix}"; fi
449 # -------------------------------------
450 # Automate configure check
451 # -------------------------------------
452 if [ ! -f "${LyxSourceDir}"/configure -o "${LyxSourceDir}"/configure -ot "${LyxSourceDir}"/configure.ac ]; then
453 ( cd "${LyxSourceDir}" && sh autogen.sh )
455 find "${LyxSourceDir}" -name Makefile.am -print | while read file ; do
456 dname=$(dirname "$file")
457 if [ -f "$dname/Makefile.in" -a "$dname/Makefile.in" -ot "$file" ]; then
458 ( cd "${LyxSourceDir}" && sh autogen.sh )
463 # -------------------------------------
464 # Build LyX for different architectures
465 # -------------------------------------
467 if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_deployment}" ]; then
468 ConfigureExtraInc="--with-extra-inc=${ASpellInstallDir}/include"
469 ConfigureExtraLib="--with-extra-lib=${ASpellInstallDir}/lib"
472 if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_deployment}" ]; then
473 HunSpellFramework=$(framework_name Hunspell)
474 HunSpellFramework=$(basename "${HunSpellFramework}")
475 ConfigureExtraInc="--with-extra-inc=${HunSpellInstallDir}/include"
476 ConfigureExtraLib="--with-extra-lib=${HunSpellInstallDir}/lib"
477 # LyXConfigureOptions="${LyXConfigureOptions} --with-hunspell-framework=${HunSpellFramework}"
479 LyXConfigureOptions="${LyXConfigureOptions} ${ConfigureExtraInc}"
480 LyXConfigureOptions="${LyXConfigureOptions} ${ConfigureExtraLib}"
482 for arch in ${ARCH_LIST} ; do
484 if [ -d "${LyxBuildDir}" ]; then rm -r "${LyxBuildDir}"; fi
485 mkdir -p "${LyxBuildDir}" && cd "${LyxBuildDir}"
487 CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
488 LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
489 HOSTSYSTEM=$(eval "echo \\$HostSystem_$arch")
491 if [ "$configure_qt4_frameworks" = "yes" ]; then
492 export QT4_CORE_CFLAGS="-FQtCore"
493 export QT4_CORE_LIBS="-framework QtCore"
494 export QT4_FRONTEND_CFLAGS="-FQtGui"
495 export QT4_FRONTEND_LIBS="-framework QtGui"
497 CPPFLAGS="${CPPFLAGS} -I${SDKROOT}/Library/Frameworks/QtCore.framework/Headers"
498 CPPFLAGS="${CPPFLAGS} -I${SDKROOT}/Library/Frameworks/QtGui.framework/Headers"
501 echo LDFLAGS="${LDFLAGS}"
503 echo CPPFLAGS="${CPPFLAGS}"
505 echo CONFIGURE_OPTIONS="${LyXConfigureOptions}" ${QtInstallDir:+"--with-qt4-dir=${QtInstallDir}"}
506 "${LyxSourceDir}/configure"\
507 --prefix="${LyxAppPrefix}" --with-version-suffix="-${LyXVersionSuffix}"\
508 ${QtInstallDir:+"--with-qt4-dir=${QtInstallDir}"} \
509 ${LyXConfigureOptions}\
510 --enable-build-type=rel && \
511 make -j2 && make install${strip}
512 for file in ${LYX_FILE_LIST} ; do
513 if [ -f "${LYX_BUNDLE_PATH}/${file}" ]; then
514 mv "${LYX_BUNDLE_PATH}/${file}"\
515 "${LYX_BUNDLE_PATH}/${file}-${arch}"
517 echo ERROR: Cannot build and install LyX for ${arch}.
524 content_directory() {
526 content=$(dirname "${target}")
527 content=$(dirname "${content}")
531 private_framework() {
532 fwdir=$(framework_name "$1")
535 condir=$(content_directory "${target}")
536 libnm=$(basename "${source}")
537 mkdir -p "${condir}/${fwdir}"
538 if [ ! -f "${condir}/${fwdir}/${libnm}" ]; then
539 cp -p "${source}" "${condir}/${fwdir}"
540 echo Set library id in "${condir}/${fwdir}/${libnm}"
541 install_name_tool -id "@executable_path/../${fwdir}/${libnm}" "${condir}/${fwdir}/${libnm}"
543 echo Correct library id reference to "${libnm}" in "${target}"
544 install_name_tool -change "${source}" "@executable_path/../${fwdir}/${libnm}" "${target}"
548 source="${QtInstallDir}"
550 version="Versions/${QtFrameworkVersion}/"
551 condir=$(content_directory "${target}")
552 mkdir -p "${condir}/Resources"
553 test -f "${condir}/Resources/qt.conf" || cat - > "${condir}/Resources/qt.conf" <<-EOF
556 Translations = translations
558 if [ ! -d "${condir}/PlugIns" ]; then
559 mkdir -p "${condir}/PlugIns"
560 find "${source}/plugins" -name \*.dylib -print | while read libname ; do
561 echo Copy plugin "${libname}"
562 dylib=$(basename "${libname}")
563 dirname=$(dirname "${libname}")
564 dirname=$(basename "${dirname}")
565 mkdir -p "${condir}/PlugIns/${dirname}"
566 cp -p "${libname}" "${condir}/PlugIns/${dirname}"
569 for libnm in ${QtLibraries} ; do
570 fwdir=$(framework_name "$libnm")
571 dirname=$(dirname "${fwdir}")
572 mkdir -p "${condir}/${dirname}"
573 dirname=$(basename "${fwdir}")
574 test -d "${condir}/${fwdir}" || (
575 echo Copy framework "${source}/lib/"$(basename "${fwdir}")
576 cp -pR "${source}/lib/"$(basename "${fwdir}") "${condir}/${fwdir}"
577 echo Set library id in "${condir}/${fwdir}/${version}${libnm}"
578 install_name_tool -id "@executable_path/../${fwdir}/${version}${libnm}" "${condir}/${fwdir}/${version}${libnm}"
579 find "${condir}/PlugIns" "${condir}/"$(dirname "${fwdir}") -name Headers -prune -o -type f -print | while read filename ; do
580 if [ "${filename}" != "${target}" ]; then
581 otool -L "${filename}" 2>/dev/null | sort -u | while read library ; do
582 # pattern match for: /path/to/qt4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2)
584 *"${libnm}"*"("*version*")"*)
585 echo Correct library id reference to "${libnm}" in "${filename}"
586 install_name_tool -change\
587 "${source}/lib/${dirname}/${version}${libnm}"\
588 "@executable_path/../${fwdir}/${version}${libnm}"\
596 echo Correct library id reference to "${libnm}" in "${target}"
597 install_name_tool -change\
598 "${source}/lib/${dirname}/${version}${libnm}"\
599 "@executable_path/../${fwdir}/${version}${libnm}"\
602 if [ ! -d "${condir}/translations" ]; then
603 mkdir -p "${condir}/translations"
605 echo Copy Qt translations to "${condir}/translations"
606 cp -p "${source}"/translations/qt_*.qm "${condir}/translations"
609 # -------------------------
610 # Create universal binaries
611 # -------------------------
612 convert_universal() {
614 for file in ${LYX_FILE_LIST} ; do
616 for arch in ${ARCH_LIST} ; do
617 if [ -f "${BUNDLE_PATH}/${file}-${arch}" ]; then
618 OBJ_LIST="${OBJ_LIST} ${BUNDLE_PATH}/${file}-${arch}"
621 if [ -n "${OBJ_LIST}" ]; then
622 lipo -create ${OBJ_LIST} -o "${BUNDLE_PATH}/${file}"
624 if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_deployment}" ]; then
625 private_framework Aspell "${ASpellInstallDir}/lib/libaspell.15.dylib" "${LYX_BUNDLE_PATH}/${file}"
627 if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_deployment}" ]; then
628 private_framework Hunspell "${HunSpellInstallDir}/lib/libhunspell-1.2.0.dylib" "${LYX_BUNDLE_PATH}/${file}"
630 if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt4_deployment}" ]; then
631 deploy_qtlibs "${LYX_BUNDLE_PATH}/${file}"
633 otool -L "${BUNDLE_PATH}/${file}" | while read reference ; do
634 case "${reference}" in
635 *"${LyxBuildDir}"*"("*")")
636 echo ERROR: Bad reference to "${reference}" found!!
641 for arch in ${ARCH_LIST} ; do
642 rm -f ${BUNDLE_PATH}/*-${arch}
646 copy_dictionaries() {
647 if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_dictionaries}" ]; then
648 ASpellResources="${LyxAppPrefix}/Contents/Resources"
649 # try to reuse macports dictionaries for now
650 if [ -d /opt/local/lib/aspell-0.60 ]; then ASpellInstallDir=/opt/local ; fi
651 mkdir -p "${ASpellResources}"
652 echo Copy Aspell dictionaries from "${ASpellInstallDir}"
653 mkdir -p "${ASpellResources}"/data "${ASpellResources}"/dicts
654 cp -p -r "${ASpellInstallDir}/lib/aspell-0.60"/* "${ASpellResources}"/data
655 cp -p -r "${ASpellInstallDir}/share/aspell"/* "${ASpellResources}"/dicts
657 if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_dictionaries}" ]; then
658 HunSpellResources="${LyxAppPrefix}/Contents/Resources"
659 if [ -d "${DictionarySourceDir}" ]; then
660 ( cd "${DictionarySourceDir}" && find dicts -name .svn -prune -o -type f -print | cpio -pmdv "${HunSpellResources}" )
663 if [ -d "${DictionarySourceDir}" -a "yes" = "${thesaurus_deployment}" ]; then
664 MyThesResources="${LyxAppPrefix}/Contents/Resources"
665 ( cd "${DictionarySourceDir}" && find thes -name .svn -prune -o -type f -print | cpio -pmdv "${MyThesResources}" )
669 set_bundle_display_options() {
672 Y_POSITION=$((Y_BOUNDS - 65))
673 Y_BOUNDS=$((Y_BOUNDS + 20))
674 LYX_X_POSITION=$((X_BOUNDS / 4))
675 LYX_Y_POSITION=$Y_POSITION
676 APP_X_POSITION=$((3 * X_BOUNDS / 4))
677 APP_Y_POSITION=$Y_POSITION
679 tell application "Finder"
680 set f to POSIX file ("${1}" as string) as alias
683 tell container window
684 set toolbar visible to false
685 set statusbar visible to false
686 set current view to icon view
688 set the bounds to {20, 50, $X_BOUNDS, $Y_BOUNDS}
691 set icon size of the icon view options of container window to 64
692 set arrangement of the icon view options of container window to not arranged
693 set position of item "Documents" to {$LYX_X_POSITION,0}
694 set position of item "${LyxName}.app" to {$LYX_X_POSITION,$LYX_Y_POSITION}
695 set position of item "Applications" to {$APP_X_POSITION,$APP_Y_POSITION}
696 set background picture of the icon view options\
697 of container window to file "background.png" of folder "Pictures"
698 set the bounds of the container window to {0, 0, $X_BOUNDS, $Y_BOUNDS}
699 update without registering applications
711 BGSIZE=$(file "$DmgBackground" | awk -F , '/PNG/{print $2 }' | tr x ' ')
712 BG_W=$(echo ${BGSIZE} | awk '{print $1 }')
713 BG_H=$(echo ${BGSIZE} | awk '{print $2 }')
715 rm -f "${DMGNAME}.sparseimage" "${DMGNAME}.dmg"
717 hdiutil create -type SPARSE -size ${DMGSIZE:-"250m"} -fs HFS+ -volname "${LyxBase}" "${DMGNAME}"
718 # Unmount currently mounted disk image
719 test -d /Volumes/"${LyxBase}" && umount /Volumes/"${LyxBase}"
721 # Mount the disk image
722 hdiutil attach "${DMGNAME}.sparseimage"
724 # Obtain device information
725 DEVS=$(hdiutil attach "${DMGNAME}.sparseimage" | cut -f 1)
726 DEV=$(echo $DEVS | cut -f 1 -d ' ')
727 VOLUME=$(mount |grep ${DEV} | cut -f 3 -d ' ')
729 # copy in the application bundle
730 cp -Rp "${LyxAppDir}.app" "${VOLUME}/${LyxName}.app"
732 # copy in background image
733 mkdir -p "${VOLUME}/Pictures"
734 cp "${DmgBackground}" "${VOLUME}/Pictures/background.png"
735 # symlink applications
736 ln -s /Applications/ "${VOLUME}"/Applications
737 test -d "${DocumentationDir}" && cp -r "${DocumentationDir}" "${VOLUME}"
738 set_bundle_display_options "${VOLUME}" ${BG_W} ${BG_H}
739 ${XCODE_DEVELOPER}/Tools/SetFile -a C "${VOLUME}"
740 mv "${VOLUME}/Pictures" "${VOLUME}/.Pictures"
742 # Unmount the disk image
743 hdiutil detach ${DEV}
745 # Convert the disk image to read-only
746 hdiutil convert "${DMGNAME}.sparseimage" -format UDBZ -o "${DMGNAME}.dmg"
747 rm -f "${DMGNAME}.sparseimage"
750 # ------------------------------
751 # Building distribution packages
752 # ------------------------------
755 test -n "${LyxAppZip}" && (
756 cd "${LyxAppPrefix}" && zip -r "${LyxAppZip}" .
759 test -n "${DMGLocation}" && (
760 make_dmg "${DMGLocation}"
761 if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt4_deployment}" ]; then
762 rm -f "${DMGLocation}/${DMGNAME}+qt4.dmg"
763 echo move to "${DMGLocation}/${DMGNAME}+qt4${MAC_API}.dmg"
764 mv "${DMGLocation}/${DMGNAME}.dmg" "${DMGLocation}/${DMGNAME}+qt4${MAC_API}.dmg"
769 # ------------------------------
771 # ------------------------------
773 if [ ${LyxOnlyPackage:-"no"} = "no" ]; then