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
49 echo Build script for LyX on Mac OS X
51 echo Optional arguments:
52 echo " --aspell-deployment=yes|no ." default yes
53 echo " --with-qt4-frameworks=yes|no" default no
54 echo " --qt4-deployment=yes|no ...." default yes
55 echo " --with-macosx-target=TARGET " default 10.4 "(Tiger)"
56 echo " --with-sdkroot=SDKROOT ....." default 10.5 "(Leopard)"
57 echo " --with-arch=ARCH ..........." default ppc,i386
58 echo " --with-build-path=PATH ....." default \${lyx-src-dir}/../lyx-build
59 echo " --with-dmg-location=PATH ..." default \${build-path}
61 echo "All other arguments with -- are passed to configure"
62 echo "including the defaults: ${LyXConfigureOptions}"
67 while [ $# -gt 0 ]; do
69 --with-qt4-frameworks=*)
70 configure_qt4_frameworks=`echo ${1}|cut -d= -f2`
71 if [ "$configure_qt4_frameworks" = "yes" ]; then
78 QTDIR=`echo ${1}|cut -d= -f2`
81 --with-macosx-target=*)
82 MACOSX_DEPLOYMENT_TARGET=`echo ${1}|cut -d= -f2`
86 SDKROOT=`echo ${1}|cut -d= -f2`
89 SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk"
95 SDKROOT="/Developer/SDKs/MacOSX${SDKROOT}.sdk"
103 --aspell-deployment=*)
104 aspell_deployment=`echo ${1}|cut -d= -f2`
105 aspell_dictionaries=$aspell_deployment
108 --hunspell-deployment=*)
109 hunspell_deployment=`echo ${1}|cut -d= -f2`
110 hunspell_dictionaries=$hunspell_deployment
113 --thesaurus-deployment=*)
114 thesaurus_deployment=`echo ${1}|cut -d= -f2`
118 qt4_deployment=`echo ${1}|cut -d= -f2`
122 ARCH=`echo ${1}|cut -d= -f2|tr ',' ' '`
123 ARCH_LIST="${ARCH_LIST} ${ARCH}"
126 --with-dmg-location=*)
127 DMGLocation=`echo ${1}|cut -d= -f2`
131 LyxBuildDir=`echo ${1}|cut -d= -f2`
138 LyXConfigureOptions="${LyXConfigureOptions} ${1}"
139 aspell_deployment="no"
143 LyXConfigureOptions="${LyXConfigureOptions} ${1}"
144 hunspell_deployment="no"
148 LyxOnlyPackage=`echo ${1}|cut -d= -f2`
152 LyXConfigureOptions="${LyXConfigureOptions} ${1}"
161 if [ "${configure_qt4_frameworks}" != "yes" ]; then
162 QtInstallDir=${QTDIR:-"/opt/qt4"}
164 QtFrameworkVersion="4"
165 ASpellSourceVersion="aspell-0.60.6"
166 HunSpellSourceVersion="hunspell-1.2.12"
168 ARCH_LIST=${ARCH_LIST:-"ppc i386"}
173 # detection of script home
174 LyxSourceDir=${1:-`dirname "$0"`}
175 if [ ! -d "${LyxSourceDir}" ]; then
176 echo Missing LyX source directory.
179 case "${LyxSourceDir}" in
181 LyxSourceDir=`dirname "${LyxSourceDir}"`
185 */development|development)
186 LyxSourceDir=`dirname "${LyxSourceDir}"`
187 LyxSourceDir=`cd "${LyxSourceDir}";pwd`
190 LyxSourceDir=`cd "${LyxSourceDir}";pwd`
194 LyxBuildDir=${LyxBuildDir:-`dirname "${LyxSourceDir}"`/lyx-build}
195 DMGLocation=${DMGLocation:-"${LyxBuildDir}"}
197 ASpellSourceDir=${ASPELLDIR:-`dirname "${LyxSourceDir}"`/${ASpellSourceVersion}}
198 ASpellInstallDir=${ASpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib}
199 HunSpellSourceDir=${HUNSPELLDIR:-`dirname "${LyxSourceDir}"`/${HunSpellSourceVersion}}
200 HunSpellInstallDir=${HunSpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib}
201 Qt4SourceDir=${QT4SOURCEDIR:-`dirname "${LyxSourceDir}"`/${Qt4SourceVersion}}
202 Qt4BuildDir=${Qt4BuildDir:-"${LyxBuildDir}"/${Qt4BuildSubDir:-"qt4-build"}}
203 DictionarySourceDir=${DICTIONARYDIR:-`dirname "${LyxSourceDir}"`/dictionaries}
204 DocumentationDir=`dirname "${LyxSourceDir}"`/Documents
205 DmgBackground="${LyxSourceDir}"/development/MacOSX/dmg-background.png
207 ASpellInstallHdr="${ASpellInstallDir}/include/aspell.h"
208 HunSpellInstallHdr="${HunSpellInstallDir}/include/hunspell/hunspell.h"
210 if [ -z "${LyXVersion}" ]; then
211 LyXVersion=`grep AC_INIT "${LyxSourceDir}"/configure.ac | cut -d, -f2 | tr -d " ()"`
213 LyXVersionSuffix=${LyXVersionSuffix:-`echo "${LyXVersion}" | cut -d. -f1-2`}
216 LyxBase="${LyxName}-${LyXVersion}"
217 LyxApp="${LyxBase}.app"
218 LyxAppDir="${LyxBuildDir}"/"${LyxBase}"
219 LyxBuildDir="${LyxAppDir}.build"
220 LyxAppPrefix="${LyxAppDir}.app"
221 # if zip file is needed... remove the comment sign
222 #LyxAppZip="${LyxAppPrefix}.zip"
224 BuildSystem=`"${LyxSourceDir}/config/config.guess"`
226 # ---------------------------------
227 # DON'T MODIFY ANYTHING BELOW HERE!
228 # ---------------------------------
230 # don't change order here...
231 QtLibraries="QtSvg QtXml QtGui QtNetwork QtCore"
236 # Check for existing SDKs
237 SDKs=`echo /Developer/SDKs/MacOSX10*sdk`
242 MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-"10.5"}; export MACOSX_DEPLOYMENT_TARGET
243 case "${MACOSX_DEPLOYMENT_TARGET}" in
245 SDKROOT="/Developer/SDKs/MacOSX10.6.sdk"; export SDKROOT
248 SDKROOT=${SDKROOT:-"/Developer/SDKs/MacOSX10.5.sdk"}; export SDKROOT
253 MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-"10.4"}; export MACOSX_DEPLOYMENT_TARGET
254 SDKROOT=${SDKROOT:-"/Developer/SDKs/MacOSX10.5.sdk"}; export SDKROOT
257 echo Unknown or missing SDK for Mac OS X.
261 MYCFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}"
263 # These variables define the identifiers of the
264 # system (both Intel and PowerPC) to compile for.
265 # (Note: darwin8 is 10.4; darwin9 is 10.5.)
266 # Only change these if necessary
268 HostSystem_i386="i686-apple-darwin8"
269 HostSystem_ppc="powerpc-apple-darwin8"
271 if [ "${configure_qt4_frameworks}" != "yes" -a -d "${Qt4SourceDir}" -a ! \( -d "${Qt4BuildDir}" -a -d "${QtInstallDir}" \) ]; then
272 echo Build Qt4 library ${Qt4SourceDir}
273 if [ "${QtInstallDir}" = "${Qt4BuildDir}" ]; then
274 echo Bad install directory for Qt.
275 echo Must be different from build directory "${Qt4BuildDir}".
279 mkdir -p "${Qt4BuildDir}" && cd "${Qt4BuildDir}"
280 for arch in ${ARCH_LIST} ; do
281 ARCHS="${ARCHS} -arch ${arch}"
283 echo configure options:
284 echo ${Qt4ConfigureOptions} ${ARCHS} -prefix "${QtInstallDir}"
285 echo yes | "${Qt4SourceDir}"/configure ${Qt4ConfigureOptions} ${ARCHS} -prefix "${QtInstallDir}"
288 cd "${QtInstallDir}" && (
291 for libnm in ${QtLibraries} ; do
292 test -d ${libnm} -o -L ${libnm} || ln -s ../lib/${libnm}.framework/Headers ${libnm}
297 if [ -d "${HunSpellSourceDir}" -a ! -f "${HunSpellInstallHdr}" ]; then
298 # we have a private HunSpell source tree at hand...
299 # so let's build and install it
300 if [ -z "${HunSpellVersion}" ]; then
301 HunSpellVersion=`grep AC_INIT "${HunSpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " ()"`
304 HunSpellName="Hunspell"
305 HunSpellBase="${HunSpellName}-${HunSpellVersion}"
307 echo Build hunspell library ${HunSpellBase}
308 echo configure options:
309 echo --prefix="${HunSpellInstallDir}" ${HunspellConfigureOptions}
311 cd "${HunSpellSourceDir}"
313 # ----------------------------------------
314 # Build HunSpell for different architectures
315 # ----------------------------------------
316 FILE_LIST="libhunspell-1.2.0.dylib"
318 for arch in ${ARCH_LIST} ; do
320 CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
321 LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
322 HOSTSYSTEM=`eval "echo \\$HostSystem_$arch"`
323 "${HunSpellSourceDir}/configure"\
324 --prefix="${HunSpellInstallDir}"\
325 ${HunspellConfigureOptions}
326 #--host="${HOSTSYSTEM}" ${BuildSystem:+"--build=${BuildSystem}"}
327 make && make install${strip}
328 for file in ${FILE_LIST} ; do
329 if [ -f "${HunSpellInstallDir}"/lib/${file} ]; then
330 mv "${HunSpellInstallDir}"/lib/${file}\
331 "${HunSpellInstallDir}"/lib/${file}-${arch}
333 echo Cannot build and install HunSpell for ${arch}.
338 # -------------------------
339 # Create universal binaries
340 # -------------------------
341 for file in ${FILE_LIST} ; do
343 for arch in ${ARCH_LIST} ; do
344 OBJ_LIST="${OBJ_LIST} lib/${file}-${arch}"
347 cd "${HunSpellInstallDir}"
348 lipo -create ${OBJ_LIST} -o lib/${file}
349 # check for the "missing link"...
350 test -f lib/libhunspell.dylib || (cd lib ; ln -s libhunspell-1.2.dylib libhunspell.dylib)
356 for arch in ${ARCH_LIST} ; do
357 rm -f "${HunSpellInstallDir}"/lib/*-${arch}
361 if [ -d "${ASpellSourceDir}" -a ! -f "${ASpellInstallHdr}" -a "yes" = "${aspell_deployment}" ]; then
362 # we have a private ASpell source tree at hand...
363 # so let's build and install it
364 if [ -z "${ASpellVersion}" ]; then
365 ASpellVersion=`grep AC_INIT "${ASpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " ()"`
369 ASpellBase="${ASpellName}-${ASpellVersion}"
371 echo Build aspell library ${ASpellBase}
372 echo configure options:
373 echo --prefix="${ASpellInstallDir}" ${AspellConfigureOptions}
375 # ASpell builds inplace only :(
376 cd "${ASpellSourceDir}"
378 # ----------------------------------------
379 # Build ASpell for different architectures
380 # ----------------------------------------
381 FILE_LIST="libaspell.15.dylib"
383 for arch in ${ARCH_LIST} ; do
385 CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
386 LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
387 HOSTSYSTEM=`eval "echo \\$HostSystem_$arch"`
388 CXXFLAGS=-g "${ASpellSourceDir}/configure"\
389 --prefix="${ASpellInstallDir}"\
390 ${AspellConfigureOptions}
391 #--host="${HOSTSYSTEM}" ${BuildSystem:+"--build=${BuildSystem}"}
392 make && make install${aspellstrip}
393 for file in ${FILE_LIST} ; do
394 if [ -f "${ASpellInstallDir}"/lib/${file} ]; then
395 mv "${ASpellInstallDir}"/lib/${file}\
396 "${ASpellInstallDir}"/lib/${file}-${arch}
398 echo Cannot build and install ASpell for ${arch}.
403 # -------------------------
404 # Create universal binaries
405 # -------------------------
406 for file in ${FILE_LIST} ; do
408 for arch in ${ARCH_LIST} ; do
409 OBJ_LIST="${OBJ_LIST} lib/${file}-${arch}"
412 cd "${ASpellInstallDir}"
413 lipo -create ${OBJ_LIST} -o lib/${file}
419 for arch in ${ARCH_LIST} ; do
420 rm -f "${ASpellInstallDir}"/lib/*-${arch}
426 echo "Frameworks/${1}.framework"
429 LYX_FILE_LIST="lyx lyxclient tex2lyx"
430 BUNDLE_PATH="Contents/MacOS"
431 LYX_BUNDLE_PATH="${LyxAppPrefix}/${BUNDLE_PATH}"
434 if [ -n "${LyxAppZip}" -a -f "${LyxAppZip}" ]; then rm "${LyxAppZip}"; fi
435 if [ -d "${LyxAppPrefix}" ]; then rm -rf "${LyxAppPrefix}"; fi
437 # -------------------------------------
438 # Automate configure check
439 # -------------------------------------
440 if [ ! -f "${LyxSourceDir}"/configure -o "${LyxSourceDir}"/configure -ot "${LyxSourceDir}"/configure.ac ]; then
441 ( cd "${LyxSourceDir}" && sh autogen.sh )
443 find "${LyxSourceDir}" -name Makefile.am -print | while read file ; do
444 dname=`dirname "$file"`
445 if [ -f "$dname/Makefile.in" -a "$dname/Makefile.in" -ot "$file" ]; then
446 ( cd "${LyxSourceDir}" && sh autogen.sh )
451 # -------------------------------------
452 # Build LyX for different architectures
453 # -------------------------------------
455 if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_deployment}" ]; then
456 ConfigureExtraInc="--with-extra-inc=${ASpellInstallDir}/include"
457 ConfigureExtraLib="--with-extra-lib=${ASpellInstallDir}/lib"
460 if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_deployment}" ]; then
461 HunSpellFramework=`framework_name Hunspell`
462 HunSpellFramework=`basename "${HunSpellFramework}"`
463 ConfigureExtraInc="--with-extra-inc=${HunSpellInstallDir}/include"
464 ConfigureExtraLib="--with-extra-lib=${HunSpellInstallDir}/lib"
465 # LyXConfigureOptions="${LyXConfigureOptions} --with-hunspell-framework=${HunSpellFramework}"
467 LyXConfigureOptions="${LyXConfigureOptions} ${ConfigureExtraInc}"
468 LyXConfigureOptions="${LyXConfigureOptions} ${ConfigureExtraLib}"
470 for arch in ${ARCH_LIST} ; do
472 if [ -d "${LyxBuildDir}" ]; then rm -r "${LyxBuildDir}"; fi
473 mkdir -p "${LyxBuildDir}" && cd "${LyxBuildDir}"
475 CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
476 LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
477 HOSTSYSTEM=`eval "echo \\$HostSystem_$arch"`
479 if [ "$configure_qt4_frameworks" = "yes" ]; then
480 export QT4_CORE_CFLAGS="-FQtCore"
481 export QT4_CORE_LIBS="-framework QtCore"
482 export QT4_FRONTEND_CFLAGS="-FQtGui"
483 export QT4_FRONTEND_LIBS="-framework QtGui"
485 CPPFLAGS="${CPPFLAGS} -I${SDKROOT}/Library/Frameworks/QtCore.framework/Headers"
486 CPPFLAGS="${CPPFLAGS} -I${SDKROOT}/Library/Frameworks/QtGui.framework/Headers"
488 LDFLAGS="${LDFLAGS}"${MAC_API:+" -framework Carbon"}
489 LDFLAGS="${LDFLAGS} -framework AppKit"
491 echo LDFLAGS="${LDFLAGS}"
493 echo CPPFLAGS="${CPPFLAGS}"
495 echo CONFIGURE_OPTIONS="${LyXConfigureOptions}" ${QtInstallDir:+"--with-qt4-dir=${QtInstallDir}"}
496 "${LyxSourceDir}/configure"\
497 --prefix="${LyxAppPrefix}" --with-version-suffix="-${LyXVersionSuffix}"\
498 ${QtInstallDir:+"--with-qt4-dir=${QtInstallDir}"} \
499 ${LyXConfigureOptions}\
500 --host="${HOSTSYSTEM}" --build="${BuildSystem}" --enable-build-type=rel && \
501 make -j2 && make install${strip}
502 for file in ${LYX_FILE_LIST} ; do
503 if [ -f "${LYX_BUNDLE_PATH}/${file}" ]; then
504 mv "${LYX_BUNDLE_PATH}/${file}"\
505 "${LYX_BUNDLE_PATH}/${file}-${arch}"
507 echo ERROR: Cannot build and install LyX for ${arch}.
514 content_directory() {
516 content=`dirname "${target}"`
517 content=`dirname "${content}"`
521 private_framework() {
522 fwdir=`framework_name "$1"`
525 condir=`content_directory "${target}"`
526 libnm=`basename "${source}"`
527 mkdir -p "${condir}/${fwdir}"
528 if [ ! -f "${condir}/${fwdir}/${libnm}" ]; then
529 cp -p "${source}" "${condir}/${fwdir}"
530 echo Set library id in "${condir}/${fwdir}/${libnm}"
531 install_name_tool -id "@executable_path/../${fwdir}/${libnm}" "${condir}/${fwdir}/${libnm}"
533 echo Correct library id reference to "${libnm}" in "${target}"
534 install_name_tool -change "${source}" "@executable_path/../${fwdir}/${libnm}" "${target}"
538 source="${QtInstallDir}"
540 version="Versions/${QtFrameworkVersion}/"
541 condir=`content_directory "${target}"`
542 mkdir -p "${condir}/Resources"
543 test -f "${condir}/Resources/qt.conf" || cat - > "${condir}/Resources/qt.conf" <<-EOF
546 Translations = translations
548 if [ ! -d "${condir}/PlugIns" ]; then
549 mkdir -p "${condir}/PlugIns"
550 find "${source}/plugins" -name \*.dylib -print | while read libname ; do
551 echo Copy plugin "${libname}"
552 dylib=`basename "${libname}"`
553 dirname=`dirname "${libname}"`
554 dirname=`basename "${dirname}"`
555 mkdir -p "${condir}/PlugIns/${dirname}"
556 cp -p "${libname}" "${condir}/PlugIns/${dirname}"
559 for libnm in ${QtLibraries} ; do
560 fwdir=`framework_name "$libnm"`
561 dirname=`dirname "${fwdir}"`
562 mkdir -p "${condir}/${dirname}"
563 dirname=`basename "${fwdir}"`
564 test -d "${condir}/${fwdir}" || (
565 echo Copy framework "${source}/lib/"`basename "${fwdir}"`
566 cp -pR "${source}/lib/"`basename "${fwdir}"` "${condir}/${fwdir}"
567 echo Set library id in "${condir}/${fwdir}/${version}${libnm}"
568 install_name_tool -id "@executable_path/../${fwdir}/${version}${libnm}" "${condir}/${fwdir}/${version}${libnm}"
569 find "${condir}/PlugIns" "${condir}/"`dirname "${fwdir}"` -name Headers -prune -o -type f -print | while read filename ; do
570 if [ "${filename}" != "${target}" ]; then
571 otool -L "${filename}" 2>/dev/null | sort -u | while read library ; do
572 # pattern match for: /path/to/qt4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2)
574 *"${libnm}"*"("*version*")"*)
575 echo Correct library id reference to "${libnm}" in "${filename}"
576 install_name_tool -change\
577 "${source}/lib/${dirname}/${version}${libnm}"\
578 "@executable_path/../${fwdir}/${version}${libnm}"\
586 echo Correct library id reference to "${libnm}" in "${target}"
587 install_name_tool -change\
588 "${source}/lib/${dirname}/${version}${libnm}"\
589 "@executable_path/../${fwdir}/${version}${libnm}"\
592 if [ ! -d "${condir}/translations" ]; then
593 mkdir -p "${condir}/translations"
595 echo Copy Qt translations to "${condir}/translations"
596 cp -p "${source}"/translations/qt_*.qm "${condir}/translations"
599 # -------------------------
600 # Create universal binaries
601 # -------------------------
602 convert_universal() {
604 for file in ${LYX_FILE_LIST} ; do
606 for arch in ${ARCH_LIST} ; do
607 if [ -f "${BUNDLE_PATH}/${file}-${arch}" ]; then
608 OBJ_LIST="${OBJ_LIST} ${BUNDLE_PATH}/${file}-${arch}"
611 if [ -n "${OBJ_LIST}" ]; then
612 lipo -create ${OBJ_LIST} -o "${BUNDLE_PATH}/${file}"
614 if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_deployment}" ]; then
615 private_framework Aspell "${ASpellInstallDir}/lib/libaspell.15.dylib" "${LYX_BUNDLE_PATH}/${file}"
617 if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_deployment}" ]; then
618 private_framework Hunspell "${HunSpellInstallDir}/lib/libhunspell-1.2.0.dylib" "${LYX_BUNDLE_PATH}/${file}"
620 if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt4_deployment}" ]; then
621 deploy_qtlibs "${LYX_BUNDLE_PATH}/${file}"
623 otool -L "${BUNDLE_PATH}/${file}" | while read reference ; do
624 case "${reference}" in
625 *"${LyxBuildDir}"*"("*")")
626 echo ERROR: Bad reference to "${reference}" found!!
631 for arch in ${ARCH_LIST} ; do
632 rm -f ${BUNDLE_PATH}/*-${arch}
636 copy_dictionaries() {
637 if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_dictionaries}" ]; then
638 ASpellResources="${LyxAppPrefix}/Contents/Resources"
639 # try to reuse macports dictionaries for now
640 if [ -d /opt/local/lib/aspell-0.60 ]; then ASpellInstallDir=/opt/local ; fi
641 mkdir -p "${ASpellResources}"
642 echo Copy Aspell dictionaries from "${ASpellInstallDir}"
643 mkdir -p "${ASpellResources}"/data "${ASpellResources}"/dicts
644 cp -p -r "${ASpellInstallDir}/lib/aspell-0.60"/* "${ASpellResources}"/data
645 cp -p -r "${ASpellInstallDir}/share/aspell"/* "${ASpellResources}"/dicts
647 if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_dictionaries}" ]; then
648 HunSpellResources="${LyxAppPrefix}/Contents/Resources"
649 if [ -d "${DictionarySourceDir}" ]; then
650 ( cd "${DictionarySourceDir}" && find dicts -name .svn -prune -o -type f -print | cpio -pmdv "${HunSpellResources}" )
653 if [ -d "${DictionarySourceDir}" -a "yes" = "${thesaurus_deployment}" ]; then
654 MyThesResources="${LyxAppPrefix}/Contents/Resources"
655 ( cd "${DictionarySourceDir}" && find thes -name .svn -prune -o -type f -print | cpio -pmdv "${MyThesResources}" )
659 set_bundle_display_options() {
662 Y_POSITION=$((Y_BOUNDS - 65))
663 Y_BOUNDS=$((Y_BOUNDS + 20))
664 LYX_X_POSITION=$((X_BOUNDS / 4))
665 LYX_Y_POSITION=$Y_POSITION
666 APP_X_POSITION=$((3 * X_BOUNDS / 4))
667 APP_Y_POSITION=$Y_POSITION
669 tell application "Finder"
670 set f to POSIX file ("${1}" as string) as alias
673 tell container window
674 set toolbar visible to false
675 set statusbar visible to false
676 set current view to icon view
678 set the bounds to {20, 50, $X_BOUNDS, $Y_BOUNDS}
681 set icon size of the icon view options of container window to 64
682 set arrangement of the icon view options of container window to not arranged
683 set position of item "Documents" to {$LYX_X_POSITION,0}
684 set position of item "${LyxName}.app" to {$LYX_X_POSITION,$LYX_Y_POSITION}
685 set position of item "Applications" to {$APP_X_POSITION,$APP_Y_POSITION}
686 set background picture of the icon view options\
687 of container window to file "background.png" of folder "Pictures"
688 set the bounds of the container window to {0, 0, $X_BOUNDS, $Y_BOUNDS}
689 update without registering applications
701 BGSIZE=`file "$DmgBackground" | awk -F , '/PNG/{print $2 }' | tr x ' '`
702 BG_W=`echo ${BGSIZE} | awk '{print $1 }'`
703 BG_H=`echo ${BGSIZE} | awk '{print $2 }'`
705 rm -f "${DMGNAME}.sparseimage" "${DMGNAME}.dmg"
707 hdiutil create -type SPARSE -size ${DMGSIZE:-"250m"} -fs HFS+ -volname "${LyxBase}" "${DMGNAME}"
708 # Unmount currently mounted disk image
709 test -d /Volumes/"${LyxBase}" && umount /Volumes/"${LyxBase}"
711 # Mount the disk image
712 hdiutil attach "${DMGNAME}.sparseimage"
714 # Obtain device information
715 DEVS=$(hdiutil attach "${DMGNAME}.sparseimage" | cut -f 1)
716 DEV=$(echo $DEVS | cut -f 1 -d ' ')
717 VOLUME=$(mount |grep ${DEV} | cut -f 3 -d ' ')
719 # copy in the application bundle
720 cp -Rp "${LyxAppDir}.app" "${VOLUME}/${LyxName}.app"
722 # copy in background image
723 mkdir -p "${VOLUME}/Pictures"
724 cp "${DmgBackground}" "${VOLUME}/Pictures/background.png"
725 # symlink applications
726 ln -s /Applications/ "${VOLUME}"/Applications
727 test -d "${DocumentationDir}" && cp -r "${DocumentationDir}" "${VOLUME}"
728 set_bundle_display_options "${VOLUME}" ${BG_W} ${BG_H}
729 /Developer/Tools/SetFile -a C "${VOLUME}"
730 mv "${VOLUME}/Pictures" "${VOLUME}/.Pictures"
732 # Unmount the disk image
733 hdiutil detach ${DEV}
735 # Convert the disk image to read-only
736 hdiutil convert "${DMGNAME}.sparseimage" -format UDBZ -o "${DMGNAME}.dmg"
737 rm -f "${DMGNAME}.sparseimage"
740 # ------------------------------
741 # Building distribution packages
742 # ------------------------------
745 test -n "${LyxAppZip}" && (
746 cd "${LyxAppPrefix}" && zip -r "${LyxAppZip}" .
749 test -n "${DMGLocation}" && (
750 make_dmg "${DMGLocation}"
751 if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt4_deployment}" ]; then
752 rm -f "${DMGLocation}/${DMGNAME}+qt4.dmg"
753 echo move to "${DMGLocation}/${DMGNAME}+qt4${MAC_API}.dmg"
754 mv "${DMGLocation}/${DMGNAME}.dmg" "${DMGLocation}/${DMGNAME}+qt4${MAC_API}.dmg"
759 # ------------------------------
761 # ------------------------------
763 if [ ${LyxOnlyPackage:-"no"} = "no" ]; then