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
547 if [ ! -d "${condir}/PlugIns" ]; then
548 mkdir -p "${condir}/PlugIns"
549 find "${source}/plugins" -name \*.dylib -print | while read libname ; do
550 echo Copy plugin "${libname}"
551 dylib=`basename "${libname}"`
552 dirname=`dirname "${libname}"`
553 dirname=`basename "${dirname}"`
554 mkdir -p "${condir}/PlugIns/${dirname}"
555 cp -p "${libname}" "${condir}/PlugIns/${dirname}"
558 for libnm in ${QtLibraries} ; do
559 fwdir=`framework_name "$libnm"`
560 dirname=`dirname "${fwdir}"`
561 mkdir -p "${condir}/${dirname}"
562 dirname=`basename "${fwdir}"`
563 test -d "${condir}/${fwdir}" || (
564 echo Copy framework "${source}/lib/"`basename "${fwdir}"`
565 cp -pR "${source}/lib/"`basename "${fwdir}"` "${condir}/${fwdir}"
566 echo Set library id in "${condir}/${fwdir}/${version}${libnm}"
567 install_name_tool -id "@executable_path/../${fwdir}/${version}${libnm}" "${condir}/${fwdir}/${version}${libnm}"
568 find "${condir}/PlugIns" "${condir}/"`dirname "${fwdir}"` -name Headers -prune -o -type f -print | while read filename ; do
569 if [ "${filename}" != "${target}" ]; then
570 otool -L "${filename}" 2>/dev/null | sort -u | while read library ; do
571 # pattern match for: /path/to/qt4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2)
573 *"${libnm}"*"("*version*")"*)
574 echo Correct library id reference to "${libnm}" in "${filename}"
575 install_name_tool -change\
576 "${source}/lib/${dirname}/${version}${libnm}"\
577 "@executable_path/../${fwdir}/${version}${libnm}"\
585 echo Correct library id reference to "${libnm}" in "${target}"
586 install_name_tool -change\
587 "${source}/lib/${dirname}/${version}${libnm}"\
588 "@executable_path/../${fwdir}/${version}${libnm}"\
593 # -------------------------
594 # Create universal binaries
595 # -------------------------
596 convert_universal() {
598 for file in ${LYX_FILE_LIST} ; do
600 for arch in ${ARCH_LIST} ; do
601 if [ -f "${BUNDLE_PATH}/${file}-${arch}" ]; then
602 OBJ_LIST="${OBJ_LIST} ${BUNDLE_PATH}/${file}-${arch}"
605 if [ -n "${OBJ_LIST}" ]; then
606 lipo -create ${OBJ_LIST} -o "${BUNDLE_PATH}/${file}"
608 if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_deployment}" ]; then
609 private_framework Aspell "${ASpellInstallDir}/lib/libaspell.15.dylib" "${LYX_BUNDLE_PATH}/${file}"
611 if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_deployment}" ]; then
612 private_framework Hunspell "${HunSpellInstallDir}/lib/libhunspell-1.2.0.dylib" "${LYX_BUNDLE_PATH}/${file}"
614 if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt4_deployment}" ]; then
615 deploy_qtlibs "${LYX_BUNDLE_PATH}/${file}"
617 otool -L "${BUNDLE_PATH}/${file}" | while read reference ; do
618 case "${reference}" in
619 *"${LyxBuildDir}"*"("*")")
620 echo ERROR: Bad reference to "${reference}" found!!
625 for arch in ${ARCH_LIST} ; do
626 rm -f ${BUNDLE_PATH}/*-${arch}
630 copy_dictionaries() {
631 if [ -d "${ASpellInstallDir}" -a "yes" = "${aspell_dictionaries}" ]; then
632 ASpellResources="${LyxAppPrefix}/Contents/Resources"
633 # try to reuse macports dictionaries for now
634 if [ -d /opt/local/lib/aspell-0.60 ]; then ASpellInstallDir=/opt/local ; fi
635 mkdir -p "${ASpellResources}"
636 echo Copy Aspell dictionaries from "${ASpellInstallDir}"
637 mkdir -p "${ASpellResources}"/data "${ASpellResources}"/dicts
638 cp -p -r "${ASpellInstallDir}/lib/aspell-0.60"/* "${ASpellResources}"/data
639 cp -p -r "${ASpellInstallDir}/share/aspell"/* "${ASpellResources}"/dicts
641 if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_dictionaries}" ]; then
642 HunSpellResources="${LyxAppPrefix}/Contents/Resources"
643 if [ -d "${DictionarySourceDir}" ]; then
644 ( cd "${DictionarySourceDir}" && find dicts -name .svn -prune -o -type f -print | cpio -pmdv "${HunSpellResources}" )
647 if [ -d "${DictionarySourceDir}" -a "yes" = "${thesaurus_deployment}" ]; then
648 MyThesResources="${LyxAppPrefix}/Contents/Resources"
649 ( cd "${DictionarySourceDir}" && find thes -name .svn -prune -o -type f -print | cpio -pmdv "${MyThesResources}" )
653 set_bundle_display_options() {
656 Y_POSITION=$((Y_BOUNDS - 65))
657 Y_BOUNDS=$((Y_BOUNDS + 20))
658 LYX_X_POSITION=$((X_BOUNDS / 4))
659 LYX_Y_POSITION=$Y_POSITION
660 APP_X_POSITION=$((3 * X_BOUNDS / 4))
661 APP_Y_POSITION=$Y_POSITION
663 tell application "Finder"
664 set f to POSIX file ("${1}" as string) as alias
667 tell container window
668 set toolbar visible to false
669 set statusbar visible to false
670 set current view to icon view
672 set the bounds to {20, 50, $X_BOUNDS, $Y_BOUNDS}
675 set icon size of the icon view options of container window to 64
676 set arrangement of the icon view options of container window to not arranged
677 set position of item "Documents" to {$LYX_X_POSITION,0}
678 set position of item "${LyxName}.app" to {$LYX_X_POSITION,$LYX_Y_POSITION}
679 set position of item "Applications" to {$APP_X_POSITION,$APP_Y_POSITION}
680 set background picture of the icon view options\
681 of container window to file "background.png" of folder "Pictures"
682 set the bounds of the container window to {0, 0, $X_BOUNDS, $Y_BOUNDS}
683 update without registering applications
695 BGSIZE=`file "$DmgBackground" | awk -F , '/PNG/{print $2 }' | tr x ' '`
696 BG_W=`echo ${BGSIZE} | awk '{print $1 }'`
697 BG_H=`echo ${BGSIZE} | awk '{print $2 }'`
699 rm -f "${DMGNAME}.sparseimage" "${DMGNAME}.dmg"
701 hdiutil create -type SPARSE -size ${DMGSIZE:-"250m"} -fs HFS+ -volname "${LyxBase}" "${DMGNAME}"
702 # Unmount currently mounted disk image
703 test -d /Volumes/"${LyxBase}" && umount /Volumes/"${LyxBase}"
705 # Mount the disk image
706 hdiutil attach "${DMGNAME}.sparseimage"
708 # Obtain device information
709 DEVS=$(hdiutil attach "${DMGNAME}.sparseimage" | cut -f 1)
710 DEV=$(echo $DEVS | cut -f 1 -d ' ')
711 VOLUME=$(mount |grep ${DEV} | cut -f 3 -d ' ')
713 # copy in the application bundle
714 cp -Rp "${LyxAppDir}.app" "${VOLUME}/${LyxName}.app"
716 # copy in background image
717 mkdir -p "${VOLUME}/Pictures"
718 cp "${DmgBackground}" "${VOLUME}/Pictures/background.png"
719 # symlink applications
720 ln -s /Applications/ "${VOLUME}"/Applications
721 test -d "${DocumentationDir}" && cp -r "${DocumentationDir}" "${VOLUME}"
722 set_bundle_display_options "${VOLUME}" ${BG_W} ${BG_H}
723 /Developer/Tools/SetFile -a C "${VOLUME}"
724 mv "${VOLUME}/Pictures" "${VOLUME}/.Pictures"
726 # Unmount the disk image
727 hdiutil detach ${DEV}
729 # Convert the disk image to read-only
730 hdiutil convert "${DMGNAME}.sparseimage" -format UDBZ -o "${DMGNAME}.dmg"
731 rm -f "${DMGNAME}.sparseimage"
734 # ------------------------------
735 # Building distribution packages
736 # ------------------------------
739 test -n "${LyxAppZip}" && (
740 cd "${LyxAppPrefix}" && zip -r "${LyxAppZip}" .
743 test -n "${DMGLocation}" && (
744 make_dmg "${DMGLocation}"
745 if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt4_deployment}" ]; then
746 rm -f "${DMGLocation}/${DMGNAME}+qt4.dmg"
747 echo move to "${DMGLocation}/${DMGNAME}+qt4.dmg"
748 mv "${DMGLocation}/${DMGNAME}.dmg" "${DMGLocation}/${DMGNAME}+qt4${MAC_API}.dmg"
753 # ------------------------------
755 # ------------------------------
757 if [ ${LyxOnlyPackage:-"no"} = "no" ]; then