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: January 2011
12 Qt4SourceVersion="qt-everywhere-opensource-src-${Qt4Version}"
13 Qt4BuildSubDir="qt-${Qt4Version}-build${MAC_API}"
16 # * a decent checkout of LyX sources (probably you have it already)
17 # * Qt4 - build with shared or static libraries for the used platforms (default: i386 and ppc)
18 # or - an unpacked source tree of Qt4 in $QT4SOURCEDIR or in the sibling directory (variable Qt4SourceVersion)
19 # * for aspell support:
20 # the aspell sources placed in a sibling directory (variable ASpellSourceVersion)
21 # * for hunspell support:
22 # the hunspell sources placed in a sibling directory (variable HunSpellSourceVersion)
23 # * for dictionary deployment (per default thesauri only):
24 # - aspell: the dictionary files of macports (in /opt/local/share/aspell and /opt/local/lib/aspell-0.60)
25 # - hunspell: the dictionary files in the sibling directory dictionaries/dicts
26 # - mythes: the data and idx files in the sibling directory dictionaries/thes
28 LyXConfigureOptions="--enable-warnings --enable-optimization=-Os --with-included-gettext --with-x=no"
29 AspellConfigureOptions="--enable-warnings --enable-optimization=-O0 --enable-debug --disable-nls --enable-compile-in-filters --disable-pspell-compatibility"
30 HunspellConfigureOptions="--with-warnings --disable-nls --with-included-gettext --disable-static"
31 Qt4ConfigureOptions="-opensource -silent -shared -release -fast -no-exceptions"
32 Qt4ConfigureOptions="${Qt4ConfigureOptions} -no-webkit -no-qt3support -no-javascript-jit -no-dbus"
33 Qt4ConfigureOptions="${Qt4ConfigureOptions} -nomake examples -nomake demos -nomake docs -nomake tools"
34 Qt4ConfigureOptions="${Qt4ConfigureOptions} ${MAC_API}"
36 aspell_dictionaries="no"
37 hunspell_dictionaries="no"
39 aspell_deployment="yes"
40 hunspell_deployment="yes"
41 thesaurus_deployment="yes"
45 MACOSX_DEPLOYMENT_TARGET="10.4" # Tiger support is default
46 SDKROOT="/Developer/SDKs/MacOSX10.5.sdk" # Leopard build is default
48 # detection of script home
49 LyxSourceDir=`dirname "$0"`
50 if [ ! -d "${LyxSourceDir}" ]; then
51 echo Missing LyX source directory.
54 case "${LyxSourceDir}" in
56 LyxSourceDir=`dirname "${LyxSourceDir}"`
60 */development|development)
61 LyxSourceDir=`dirname "${LyxSourceDir}"`
62 LyxSourceDir=`cd "${LyxSourceDir}";pwd`
65 LyxSourceDir=`cd "${LyxSourceDir}";pwd`
70 echo "*" Build script for LyX on Mac OS X
72 echo Optional arguments:
73 echo " --aspell-deployment=yes|no ." default yes
74 echo " --with-qt4-frameworks=yes|no" default no
75 echo " --qt4-deployment=yes|no ...." default yes
76 echo " --with-macosx-target=TARGET " default 10.4 "(Tiger)"
77 echo " --with-sdkroot=SDKROOT ....." default 10.5 "(Leopard)"
78 echo " --with-arch=ARCH ..........." default ppc,i386
79 echo " --with-build-path=PATH ....." default \${lyx-src-dir}/../lyx-build
80 echo " --with-dmg-location=PATH ..." default \${build-path}
82 echo "All other arguments with -- are passed to configure"
83 echo "including the defaults: ${LyXConfigureOptions}"
84 if [ -x "${LyxSourceDir}/configure" ]; then
86 echo "*" Configure options of LyX
88 "${LyxSourceDir}/configure" --help
93 while [ $# -gt 0 ]; do
95 --with-qt4-frameworks=*)
96 configure_qt4_frameworks=`echo ${1}|cut -d= -f2`
97 if [ "$configure_qt4_frameworks" = "yes" ]; then
104 QTDIR=`echo ${1}|cut -d= -f2`
107 --with-macosx-target=*)
108 MACOSX_DEPLOYMENT_TARGET=`echo ${1}|cut -d= -f2`
112 SDKROOT=`echo ${1}|cut -d= -f2`
115 SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk"
121 SDKROOT="/Developer/SDKs/MacOSX${SDKROOT}.sdk"
129 --aspell-deployment=*)
130 aspell_deployment=`echo ${1}|cut -d= -f2`
131 aspell_dictionaries=$aspell_deployment
134 --hunspell-deployment=*)
135 hunspell_deployment=`echo ${1}|cut -d= -f2`
136 hunspell_dictionaries=$hunspell_deployment
139 --thesaurus-deployment=*)
140 thesaurus_deployment=`echo ${1}|cut -d= -f2`
144 qt4_deployment=`echo ${1}|cut -d= -f2`
148 ARCH=`echo ${1}|cut -d= -f2|tr ',' ' '`
149 ARCH_LIST="${ARCH_LIST} ${ARCH}"
152 --with-dmg-location=*)
153 DMGLocation=`echo ${1}|cut -d= -f2`
157 LyxBuildDir=`echo ${1}|cut -d= -f2`
164 LyXConfigureOptions="${LyXConfigureOptions} ${1}"
165 aspell_deployment="no"
169 LyXConfigureOptions="${LyXConfigureOptions} ${1}"
170 hunspell_deployment="no"
174 LyxOnlyPackage=`echo ${1}|cut -d= -f2`
178 LyXConfigureOptions="${LyXConfigureOptions} ${1}"
187 if [ "${configure_qt4_frameworks}" != "yes" ]; then
188 QtInstallDir=${QTDIR:-"/opt/qt4"}
190 QtFrameworkVersion="4"
191 ASpellSourceVersion="aspell-0.60.6"
192 HunSpellSourceVersion="hunspell-1.2.12"
194 ARCH_LIST=${ARCH_LIST:-"ppc i386"}
199 LyxBuildDir=${LyxBuildDir:-`dirname "${LyxSourceDir}"`/lyx-build}
200 DMGLocation=${DMGLocation:-"${LyxBuildDir}"}
202 ASpellSourceDir=${ASPELLDIR:-`dirname "${LyxSourceDir}"`/${ASpellSourceVersion}}
203 ASpellInstallDir=${ASpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib}
204 HunSpellSourceDir=${HUNSPELLDIR:-`dirname "${LyxSourceDir}"`/${HunSpellSourceVersion}}
205 HunSpellInstallDir=${HunSpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib}
206 Qt4SourceDir=${QT4SOURCEDIR:-`dirname "${LyxSourceDir}"`/${Qt4SourceVersion}}
207 Qt4BuildDir=${Qt4BuildDir:-"${LyxBuildDir}"/${Qt4BuildSubDir:-"qt4-build"}}
208 DictionarySourceDir=${DICTIONARYDIR:-`dirname "${LyxSourceDir}"`/dictionaries}
209 DocumentationDir=`dirname "${LyxSourceDir}"`/Documents
210 DmgBackground="${LyxSourceDir}"/development/MacOSX/dmg-background.png
212 ASpellInstallHdr="${ASpellInstallDir}/include/aspell.h"
213 HunSpellInstallHdr="${HunSpellInstallDir}/include/hunspell/hunspell.h"
215 if [ -z "${LyXVersion}" ]; then
216 LyXVersion=`grep AC_INIT "${LyxSourceDir}"/configure.ac | cut -d, -f2 | tr -d " ()"`
218 LyXVersionSuffix=${LyXVersionSuffix:-`echo "${LyXVersion}" | cut -d. -f1-2`}
221 LyxBase="${LyxName}-${LyXVersion}"
222 LyxApp="${LyxBase}.app"
223 LyxAppDir="${LyxBuildDir}"/"${LyxBase}"
224 LyxBuildDir="${LyxAppDir}.build"
225 LyxAppPrefix="${LyxAppDir}.app"
226 # if zip file is needed... remove the comment sign
227 #LyxAppZip="${LyxAppPrefix}.zip"
229 BuildSystem=`"${LyxSourceDir}/config/config.guess"`
231 # ---------------------------------
232 # DON'T MODIFY ANYTHING BELOW HERE!
233 # ---------------------------------
235 # don't change order here...
236 QtLibraries="QtSvg QtXml QtGui QtNetwork QtCore"
241 # Check for existing SDKs
242 SDKs=`echo /Developer/SDKs/MacOSX10*sdk`
247 MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-"10.5"}; export MACOSX_DEPLOYMENT_TARGET
248 case "${MACOSX_DEPLOYMENT_TARGET}" in
250 SDKROOT="/Developer/SDKs/MacOSX10.6.sdk"; export SDKROOT
253 SDKROOT=${SDKROOT:-"/Developer/SDKs/MacOSX10.5.sdk"}; export SDKROOT
258 MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-"10.4"}; export MACOSX_DEPLOYMENT_TARGET
259 SDKROOT=${SDKROOT:-"/Developer/SDKs/MacOSX10.5.sdk"}; export SDKROOT
262 echo Unknown or missing SDK for Mac OS X.
266 MYCFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}"
268 # These variables define the identifiers of the
269 # system (both Intel and PowerPC) to compile for.
270 # (Note: darwin8 is 10.4; darwin9 is 10.5.)
271 # Only change these if necessary
273 HostSystem_i386="i686-apple-darwin8"
274 HostSystem_ppc="powerpc-apple-darwin8"
276 if [ "${configure_qt4_frameworks}" != "yes" -a -d "${Qt4SourceDir}" -a ! \( -d "${Qt4BuildDir}" -a -d "${QtInstallDir}" \) ]; then
277 echo Build Qt4 library ${Qt4SourceDir}
278 if [ "${QtInstallDir}" = "${Qt4BuildDir}" ]; then
279 echo Bad install directory for Qt.
280 echo Must be different from build directory "${Qt4BuildDir}".
284 mkdir -p "${Qt4BuildDir}" && cd "${Qt4BuildDir}"
285 for arch in ${ARCH_LIST} ; do
286 ARCHS="${ARCHS} -arch ${arch}"
288 echo configure options:
289 echo ${Qt4ConfigureOptions} ${ARCHS} -prefix "${QtInstallDir}"
290 echo yes | "${Qt4SourceDir}"/configure ${Qt4ConfigureOptions} ${ARCHS} -prefix "${QtInstallDir}"
293 cd "${QtInstallDir}" && (
296 for libnm in ${QtLibraries} ; do
297 test -d ${libnm} -o -L ${libnm} || ln -s ../lib/${libnm}.framework/Headers ${libnm}
302 if [ -d "${HunSpellSourceDir}" -a ! -f "${HunSpellInstallHdr}" ]; then
303 # we have a private HunSpell source tree at hand...
304 # so let's build and install it
305 if [ -z "${HunSpellVersion}" ]; then
306 HunSpellVersion=`grep AC_INIT "${HunSpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " ()"`
309 HunSpellName="Hunspell"
310 HunSpellBase="${HunSpellName}-${HunSpellVersion}"
312 echo Build hunspell library ${HunSpellBase}
313 echo configure options:
314 echo --prefix="${HunSpellInstallDir}" ${HunspellConfigureOptions}
316 cd "${HunSpellSourceDir}"
318 # ----------------------------------------
319 # Build HunSpell for different architectures
320 # ----------------------------------------
321 FILE_LIST="libhunspell-1.2.0.dylib"
323 for arch in ${ARCH_LIST} ; do
325 CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
326 LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
327 HOSTSYSTEM=`eval "echo \\$HostSystem_$arch"`
328 "${HunSpellSourceDir}/configure"\
329 --prefix="${HunSpellInstallDir}"\
330 ${HunspellConfigureOptions}
331 #--host="${HOSTSYSTEM}" ${BuildSystem:+"--build=${BuildSystem}"}
332 make && make install${strip}
333 for file in ${FILE_LIST} ; do
334 if [ -f "${HunSpellInstallDir}"/lib/${file} ]; then
335 mv "${HunSpellInstallDir}"/lib/${file}\
336 "${HunSpellInstallDir}"/lib/${file}-${arch}
338 echo Cannot build and install HunSpell for ${arch}.
343 # -------------------------
344 # Create universal binaries
345 # -------------------------
346 for file in ${FILE_LIST} ; do
348 for arch in ${ARCH_LIST} ; do
349 OBJ_LIST="${OBJ_LIST} lib/${file}-${arch}"
352 cd "${HunSpellInstallDir}"
353 lipo -create ${OBJ_LIST} -o lib/${file}
354 # check for the "missing link"...
355 test -f lib/libhunspell.dylib || (cd lib ; ln -s libhunspell-1.2.dylib libhunspell.dylib)
361 for arch in ${ARCH_LIST} ; do
362 rm -f "${HunSpellInstallDir}"/lib/*-${arch}
366 if [ -d "${ASpellSourceDir}" -a ! -f "${ASpellInstallHdr}" -a "yes" = "${aspell_deployment}" ]; then
367 # we have a private ASpell source tree at hand...
368 # so let's build and install it
369 if [ -z "${ASpellVersion}" ]; then
370 ASpellVersion=`grep AC_INIT "${ASpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " ()"`
374 ASpellBase="${ASpellName}-${ASpellVersion}"
376 echo Build aspell library ${ASpellBase}
377 echo configure options:
378 echo --prefix="${ASpellInstallDir}" ${AspellConfigureOptions}
380 # ASpell builds inplace only :(
381 cd "${ASpellSourceDir}"
383 # ----------------------------------------
384 # Build ASpell for different architectures
385 # ----------------------------------------
386 FILE_LIST="libaspell.15.dylib"
388 for arch in ${ARCH_LIST} ; do
390 CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
391 LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
392 HOSTSYSTEM=`eval "echo \\$HostSystem_$arch"`
393 CXXFLAGS=-g "${ASpellSourceDir}/configure"\
394 --prefix="${ASpellInstallDir}"\
395 ${AspellConfigureOptions}
396 make && make install${aspellstrip}
397 for file in ${FILE_LIST} ; do
398 if [ -f "${ASpellInstallDir}"/lib/${file} ]; then
399 mv "${ASpellInstallDir}"/lib/${file}\
400 "${ASpellInstallDir}"/lib/${file}-${arch}
402 echo Cannot build and install ASpell for ${arch}.
407 # -------------------------
408 # Create universal binaries
409 # -------------------------
410 for file in ${FILE_LIST} ; do
412 for arch in ${ARCH_LIST} ; do
413 OBJ_LIST="${OBJ_LIST} lib/${file}-${arch}"
416 cd "${ASpellInstallDir}"
417 lipo -create ${OBJ_LIST} -o lib/${file}
423 for arch in ${ARCH_LIST} ; do
424 rm -f "${ASpellInstallDir}"/lib/*-${arch}
430 echo "Frameworks/${1}.framework"
433 LYX_FILE_LIST="lyx lyxclient tex2lyx"
434 BUNDLE_PATH="Contents/MacOS"
435 LYX_BUNDLE_PATH="${LyxAppPrefix}/${BUNDLE_PATH}"
438 if [ -n "${LyxAppZip}" -a -f "${LyxAppZip}" ]; then rm "${LyxAppZip}"; fi
439 if [ -d "${LyxAppPrefix}" ]; then rm -rf "${LyxAppPrefix}"; fi
441 # -------------------------------------
442 # Automate configure check
443 # -------------------------------------
444 if [ ! -f "${LyxSourceDir}"/configure -o "${LyxSourceDir}"/configure -ot "${LyxSourceDir}"/configure.ac ]; then
445 ( cd "${LyxSourceDir}" && sh autogen.sh )
447 find "${LyxSourceDir}" -name Makefile.am -print | while read file ; do
448 dname=`dirname "$file"`
449 if [ -f "$dname/Makefile.in" -a "$dname/Makefile.in" -ot "$file" ]; then
450 ( cd "${LyxSourceDir}" && sh autogen.sh )
455 # -------------------------------------
456 # Build LyX for different architectures
457 # -------------------------------------
459 if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_deployment}" ]; then
460 ConfigureExtraInc="--with-extra-inc=${ASpellInstallDir}/include"
461 ConfigureExtraLib="--with-extra-lib=${ASpellInstallDir}/lib"
464 if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_deployment}" ]; then
465 HunSpellFramework=`framework_name Hunspell`
466 HunSpellFramework=`basename "${HunSpellFramework}"`
467 ConfigureExtraInc="--with-extra-inc=${HunSpellInstallDir}/include"
468 ConfigureExtraLib="--with-extra-lib=${HunSpellInstallDir}/lib"
469 # LyXConfigureOptions="${LyXConfigureOptions} --with-hunspell-framework=${HunSpellFramework}"
471 LyXConfigureOptions="${LyXConfigureOptions} ${ConfigureExtraInc}"
472 LyXConfigureOptions="${LyXConfigureOptions} ${ConfigureExtraLib}"
474 for arch in ${ARCH_LIST} ; do
476 if [ -d "${LyxBuildDir}" ]; then rm -r "${LyxBuildDir}"; fi
477 mkdir -p "${LyxBuildDir}" && cd "${LyxBuildDir}"
479 CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
480 LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
481 HOSTSYSTEM=`eval "echo \\$HostSystem_$arch"`
483 if [ "$configure_qt4_frameworks" = "yes" ]; then
484 export QT4_CORE_CFLAGS="-FQtCore"
485 export QT4_CORE_LIBS="-framework QtCore"
486 export QT4_FRONTEND_CFLAGS="-FQtGui"
487 export QT4_FRONTEND_LIBS="-framework QtGui"
489 CPPFLAGS="${CPPFLAGS} -I${SDKROOT}/Library/Frameworks/QtCore.framework/Headers"
490 CPPFLAGS="${CPPFLAGS} -I${SDKROOT}/Library/Frameworks/QtGui.framework/Headers"
493 echo LDFLAGS="${LDFLAGS}"
495 echo CPPFLAGS="${CPPFLAGS}"
497 echo CONFIGURE_OPTIONS="${LyXConfigureOptions}" ${QtInstallDir:+"--with-qt4-dir=${QtInstallDir}"}
498 "${LyxSourceDir}/configure"\
499 --prefix="${LyxAppPrefix}" --with-version-suffix="-${LyXVersionSuffix}"\
500 ${QtInstallDir:+"--with-qt4-dir=${QtInstallDir}"} \
501 ${LyXConfigureOptions}\
502 --host="${HOSTSYSTEM}" --build="${BuildSystem}" --enable-build-type=rel && \
503 make -j2 && make install${strip}
504 for file in ${LYX_FILE_LIST} ; do
505 if [ -f "${LYX_BUNDLE_PATH}/${file}" ]; then
506 mv "${LYX_BUNDLE_PATH}/${file}"\
507 "${LYX_BUNDLE_PATH}/${file}-${arch}"
509 echo ERROR: Cannot build and install LyX for ${arch}.
516 content_directory() {
518 content=`dirname "${target}"`
519 content=`dirname "${content}"`
523 private_framework() {
524 fwdir=`framework_name "$1"`
527 condir=`content_directory "${target}"`
528 libnm=`basename "${source}"`
529 mkdir -p "${condir}/${fwdir}"
530 if [ ! -f "${condir}/${fwdir}/${libnm}" ]; then
531 cp -p "${source}" "${condir}/${fwdir}"
532 echo Set library id in "${condir}/${fwdir}/${libnm}"
533 install_name_tool -id "@executable_path/../${fwdir}/${libnm}" "${condir}/${fwdir}/${libnm}"
535 echo Correct library id reference to "${libnm}" in "${target}"
536 install_name_tool -change "${source}" "@executable_path/../${fwdir}/${libnm}" "${target}"
540 source="${QtInstallDir}"
542 version="Versions/${QtFrameworkVersion}/"
543 condir=`content_directory "${target}"`
544 mkdir -p "${condir}/Resources"
545 test -f "${condir}/Resources/qt.conf" || cat - > "${condir}/Resources/qt.conf" <<-EOF
548 Translations = translations
550 if [ ! -d "${condir}/PlugIns" ]; then
551 mkdir -p "${condir}/PlugIns"
552 find "${source}/plugins" -name \*.dylib -print | while read libname ; do
553 echo Copy plugin "${libname}"
554 dylib=`basename "${libname}"`
555 dirname=`dirname "${libname}"`
556 dirname=`basename "${dirname}"`
557 mkdir -p "${condir}/PlugIns/${dirname}"
558 cp -p "${libname}" "${condir}/PlugIns/${dirname}"
561 for libnm in ${QtLibraries} ; do
562 fwdir=`framework_name "$libnm"`
563 dirname=`dirname "${fwdir}"`
564 mkdir -p "${condir}/${dirname}"
565 dirname=`basename "${fwdir}"`
566 test -d "${condir}/${fwdir}" || (
567 echo Copy framework "${source}/lib/"`basename "${fwdir}"`
568 cp -pR "${source}/lib/"`basename "${fwdir}"` "${condir}/${fwdir}"
569 echo Set library id in "${condir}/${fwdir}/${version}${libnm}"
570 install_name_tool -id "@executable_path/../${fwdir}/${version}${libnm}" "${condir}/${fwdir}/${version}${libnm}"
571 find "${condir}/PlugIns" "${condir}/"`dirname "${fwdir}"` -name Headers -prune -o -type f -print | while read filename ; do
572 if [ "${filename}" != "${target}" ]; then
573 otool -L "${filename}" 2>/dev/null | sort -u | while read library ; do
574 # pattern match for: /path/to/qt4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2)
576 *"${libnm}"*"("*version*")"*)
577 echo Correct library id reference to "${libnm}" in "${filename}"
578 install_name_tool -change\
579 "${source}/lib/${dirname}/${version}${libnm}"\
580 "@executable_path/../${fwdir}/${version}${libnm}"\
588 echo Correct library id reference to "${libnm}" in "${target}"
589 install_name_tool -change\
590 "${source}/lib/${dirname}/${version}${libnm}"\
591 "@executable_path/../${fwdir}/${version}${libnm}"\
594 if [ ! -d "${condir}/translations" ]; then
595 mkdir -p "${condir}/translations"
597 echo Copy Qt translations to "${condir}/translations"
598 cp -p "${source}"/translations/qt_*.qm "${condir}/translations"
601 # -------------------------
602 # Create universal binaries
603 # -------------------------
604 convert_universal() {
606 for file in ${LYX_FILE_LIST} ; do
608 for arch in ${ARCH_LIST} ; do
609 if [ -f "${BUNDLE_PATH}/${file}-${arch}" ]; then
610 OBJ_LIST="${OBJ_LIST} ${BUNDLE_PATH}/${file}-${arch}"
613 if [ -n "${OBJ_LIST}" ]; then
614 lipo -create ${OBJ_LIST} -o "${BUNDLE_PATH}/${file}"
616 if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_deployment}" ]; then
617 private_framework Aspell "${ASpellInstallDir}/lib/libaspell.15.dylib" "${LYX_BUNDLE_PATH}/${file}"
619 if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_deployment}" ]; then
620 private_framework Hunspell "${HunSpellInstallDir}/lib/libhunspell-1.2.0.dylib" "${LYX_BUNDLE_PATH}/${file}"
622 if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt4_deployment}" ]; then
623 deploy_qtlibs "${LYX_BUNDLE_PATH}/${file}"
625 otool -L "${BUNDLE_PATH}/${file}" | while read reference ; do
626 case "${reference}" in
627 *"${LyxBuildDir}"*"("*")")
628 echo ERROR: Bad reference to "${reference}" found!!
633 for arch in ${ARCH_LIST} ; do
634 rm -f ${BUNDLE_PATH}/*-${arch}
638 copy_dictionaries() {
639 if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_dictionaries}" ]; then
640 ASpellResources="${LyxAppPrefix}/Contents/Resources"
641 # try to reuse macports dictionaries for now
642 if [ -d /opt/local/lib/aspell-0.60 ]; then ASpellInstallDir=/opt/local ; fi
643 mkdir -p "${ASpellResources}"
644 echo Copy Aspell dictionaries from "${ASpellInstallDir}"
645 mkdir -p "${ASpellResources}"/data "${ASpellResources}"/dicts
646 cp -p -r "${ASpellInstallDir}/lib/aspell-0.60"/* "${ASpellResources}"/data
647 cp -p -r "${ASpellInstallDir}/share/aspell"/* "${ASpellResources}"/dicts
649 if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_dictionaries}" ]; then
650 HunSpellResources="${LyxAppPrefix}/Contents/Resources"
651 if [ -d "${DictionarySourceDir}" ]; then
652 ( cd "${DictionarySourceDir}" && find dicts -name .svn -prune -o -type f -print | cpio -pmdv "${HunSpellResources}" )
655 if [ -d "${DictionarySourceDir}" -a "yes" = "${thesaurus_deployment}" ]; then
656 MyThesResources="${LyxAppPrefix}/Contents/Resources"
657 ( cd "${DictionarySourceDir}" && find thes -name .svn -prune -o -type f -print | cpio -pmdv "${MyThesResources}" )
661 set_bundle_display_options() {
664 Y_POSITION=$((Y_BOUNDS - 65))
665 Y_BOUNDS=$((Y_BOUNDS + 20))
666 LYX_X_POSITION=$((X_BOUNDS / 4))
667 LYX_Y_POSITION=$Y_POSITION
668 APP_X_POSITION=$((3 * X_BOUNDS / 4))
669 APP_Y_POSITION=$Y_POSITION
671 tell application "Finder"
672 set f to POSIX file ("${1}" as string) as alias
675 tell container window
676 set toolbar visible to false
677 set statusbar visible to false
678 set current view to icon view
680 set the bounds to {20, 50, $X_BOUNDS, $Y_BOUNDS}
683 set icon size of the icon view options of container window to 64
684 set arrangement of the icon view options of container window to not arranged
685 set position of item "Documents" to {$LYX_X_POSITION,0}
686 set position of item "${LyxName}.app" to {$LYX_X_POSITION,$LYX_Y_POSITION}
687 set position of item "Applications" to {$APP_X_POSITION,$APP_Y_POSITION}
688 set background picture of the icon view options\
689 of container window to file "background.png" of folder "Pictures"
690 set the bounds of the container window to {0, 0, $X_BOUNDS, $Y_BOUNDS}
691 update without registering applications
703 BGSIZE=`file "$DmgBackground" | awk -F , '/PNG/{print $2 }' | tr x ' '`
704 BG_W=`echo ${BGSIZE} | awk '{print $1 }'`
705 BG_H=`echo ${BGSIZE} | awk '{print $2 }'`
707 rm -f "${DMGNAME}.sparseimage" "${DMGNAME}.dmg"
709 hdiutil create -type SPARSE -size ${DMGSIZE:-"250m"} -fs HFS+ -volname "${LyxBase}" "${DMGNAME}"
710 # Unmount currently mounted disk image
711 test -d /Volumes/"${LyxBase}" && umount /Volumes/"${LyxBase}"
713 # Mount the disk image
714 hdiutil attach "${DMGNAME}.sparseimage"
716 # Obtain device information
717 DEVS=$(hdiutil attach "${DMGNAME}.sparseimage" | cut -f 1)
718 DEV=$(echo $DEVS | cut -f 1 -d ' ')
719 VOLUME=$(mount |grep ${DEV} | cut -f 3 -d ' ')
721 # copy in the application bundle
722 cp -Rp "${LyxAppDir}.app" "${VOLUME}/${LyxName}.app"
724 # copy in background image
725 mkdir -p "${VOLUME}/Pictures"
726 cp "${DmgBackground}" "${VOLUME}/Pictures/background.png"
727 # symlink applications
728 ln -s /Applications/ "${VOLUME}"/Applications
729 test -d "${DocumentationDir}" && cp -r "${DocumentationDir}" "${VOLUME}"
730 set_bundle_display_options "${VOLUME}" ${BG_W} ${BG_H}
731 /Developer/Tools/SetFile -a C "${VOLUME}"
732 mv "${VOLUME}/Pictures" "${VOLUME}/.Pictures"
734 # Unmount the disk image
735 hdiutil detach ${DEV}
737 # Convert the disk image to read-only
738 hdiutil convert "${DMGNAME}.sparseimage" -format UDBZ -o "${DMGNAME}.dmg"
739 rm -f "${DMGNAME}.sparseimage"
742 # ------------------------------
743 # Building distribution packages
744 # ------------------------------
747 test -n "${LyxAppZip}" && (
748 cd "${LyxAppPrefix}" && zip -r "${LyxAppZip}" .
751 test -n "${DMGLocation}" && (
752 make_dmg "${DMGLocation}"
753 if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt4_deployment}" ]; then
754 rm -f "${DMGLocation}/${DMGNAME}+qt4.dmg"
755 echo move to "${DMGLocation}/${DMGNAME}+qt4${MAC_API}.dmg"
756 mv "${DMGLocation}/${DMGNAME}.dmg" "${DMGLocation}/${DMGNAME}+qt4${MAC_API}.dmg"
761 # ------------------------------
763 # ------------------------------
765 if [ ${LyxOnlyPackage:-"no"} = "no" ]; then