X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=development%2FLyX-Mac-binary-release.sh;h=18b7285ba306ebb2067af56c2bc83303eae96a2a;hb=13b1277cd2f22bca7b4dec40eb6ca762b7d6fafe;hp=58ef92148948840a0c0e796789263488b2d33b29;hpb=823397bc80cce00730b362083cadf4d0b764fe2b;p=lyx.git diff --git a/development/LyX-Mac-binary-release.sh b/development/LyX-Mac-binary-release.sh index 58ef921489..18b7285ba3 100644 --- a/development/LyX-Mac-binary-release.sh +++ b/development/LyX-Mac-binary-release.sh @@ -7,10 +7,10 @@ # latest changes by Stephan Witt # Last modified: January 2011 -CARBON=-carbon +MAC_API=-cocoa Qt4Version="4.6.3" Qt4SourceVersion="qt-everywhere-opensource-src-${Qt4Version}" -Qt4BuildSubDir="qt-${Qt4Version}-build${CARBON}" +Qt4BuildSubDir="qt-${Qt4Version}-build${MAC_API}" # Prerequisite: # * a decent checkout of LyX sources (probably you have it already) @@ -31,7 +31,7 @@ HunspellConfigureOptions="--with-warnings --disable-nls --with-included-gettext Qt4ConfigureOptions="-opensource -silent -shared -release -fast -no-exceptions" Qt4ConfigureOptions="${Qt4ConfigureOptions} -no-webkit -no-qt3support -no-javascript-jit -no-dbus" Qt4ConfigureOptions="${Qt4ConfigureOptions} -nomake examples -nomake demos -nomake docs -nomake tools" -#Qt4ConfigureOptions="${Qt4ConfigureOptions} ${CARBON}" +Qt4ConfigureOptions="${Qt4ConfigureOptions} ${MAC_API}" aspell_dictionaries="no" hunspell_dictionaries="no" @@ -45,8 +45,29 @@ qt4_deployment="yes" MACOSX_DEPLOYMENT_TARGET="10.4" # Tiger support is default SDKROOT="/Developer/SDKs/MacOSX10.5.sdk" # Leopard build is default +# detection of script home +LyxSourceDir=`dirname "$0"` +if [ ! -d "${LyxSourceDir}" ]; then + echo Missing LyX source directory. + exit 2 +fi +case "${LyxSourceDir}" in +/*/development) + LyxSourceDir=`dirname "${LyxSourceDir}"` + ;; +/*) + ;; +*/development|development) + LyxSourceDir=`dirname "${LyxSourceDir}"` + LyxSourceDir=`cd "${LyxSourceDir}";pwd` + ;; +*) + LyxSourceDir=`cd "${LyxSourceDir}";pwd` + ;; +esac + usage() { - echo Build script for LyX on Mac OS X + echo "*" Build script for LyX on Mac OS X echo echo Optional arguments: echo " --aspell-deployment=yes|no ." default yes @@ -60,7 +81,12 @@ usage() { echo echo "All other arguments with -- are passed to configure" echo "including the defaults: ${LyXConfigureOptions}" - echo + if [ -x "${LyxSourceDir}/configure" ]; then + echo + echo "*" Configure options of LyX + echo + "${LyxSourceDir}/configure" --help + fi exit 0 } @@ -131,7 +157,7 @@ while [ $# -gt 0 ]; do LyxBuildDir=`echo ${1}|cut -d= -f2` shift ;; - --help) + --help|--help=*) usage ;; --without-aspell) @@ -144,6 +170,10 @@ while [ $# -gt 0 ]; do hunspell_deployment="no" shift ;; + --only-package=*) + LyxOnlyPackage=`echo ${1}|cut -d= -f2` + shift + ;; --*) LyXConfigureOptions="${LyXConfigureOptions} ${1}" shift @@ -166,27 +196,6 @@ ARCH_LIST=${ARCH_LIST:-"ppc i386"} strip="-strip" aspellstrip= -# detection of script home -LyxSourceDir=${1:-`dirname "$0"`} -if [ ! -d "${LyxSourceDir}" ]; then - echo Missing LyX source directory. - exit 2 -fi -case "${LyxSourceDir}" in -/*/development) - LyxSourceDir=`dirname "${LyxSourceDir}"` - ;; -/*) - ;; -*/development|development) - LyxSourceDir=`dirname "${LyxSourceDir}"` - LyxSourceDir=`cd "${LyxSourceDir}";pwd` - ;; -*) - LyxSourceDir=`cd "${LyxSourceDir}";pwd` - ;; -esac - LyxBuildDir=${LyxBuildDir:-`dirname "${LyxSourceDir}"`/lyx-build} DMGLocation=${DMGLocation:-"${LyxBuildDir}"} @@ -197,6 +206,8 @@ HunSpellInstallDir=${HunSpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib} Qt4SourceDir=${QT4SOURCEDIR:-`dirname "${LyxSourceDir}"`/${Qt4SourceVersion}} Qt4BuildDir=${Qt4BuildDir:-"${LyxBuildDir}"/${Qt4BuildSubDir:-"qt4-build"}} DictionarySourceDir=${DICTIONARYDIR:-`dirname "${LyxSourceDir}"`/dictionaries} +DocumentationDir=`dirname "${LyxSourceDir}"`/Documents +DmgBackground="${LyxSourceDir}"/development/MacOSX/dmg-background.png ASpellInstallHdr="${ASpellInstallDir}/include/aspell.h" HunSpellInstallHdr="${HunSpellInstallDir}/include/hunspell/hunspell.h" @@ -226,7 +237,6 @@ QtLibraries="QtSvg QtXml QtGui QtNetwork QtCore" DMGNAME="${LyxBase}" DMGSIZE="550m" -BACKGROUND="${LyxAppDir}.app/Contents/Resources/images/banner.png" # Check for existing SDKs SDKs=`echo /Developer/SDKs/MacOSX10*sdk` @@ -383,7 +393,6 @@ if [ -d "${ASpellSourceDir}" -a ! -f "${ASpellInstallHdr}" -a "yes" = "${aspell_ CXXFLAGS=-g "${ASpellSourceDir}/configure"\ --prefix="${ASpellInstallDir}"\ ${AspellConfigureOptions} - #--host="${HOSTSYSTEM}" ${BuildSystem:+"--build=${BuildSystem}"} make && make install${aspellstrip} for file in ${FILE_LIST} ; do if [ -f "${ASpellInstallDir}"/lib/${file} ]; then @@ -416,26 +425,12 @@ if [ -d "${ASpellSourceDir}" -a ! -f "${ASpellInstallHdr}" -a "yes" = "${aspell_ done fi -# exit 0 - framework_name() { echo "Frameworks/${1}.framework" } -if [ ! -f "${LyxSourceDir}"/configure -o "${LyxSourceDir}"/configure -ot "${LyxSourceDir}"/configure.ac ]; then - ( cd "${LyxSourceDir}" && sh autogen.sh ) -else - find "${LyxSourceDir}" -name Makefile.am -print | while read file ; do - dname=`dirname "$file"` - if [ -f "$dname/Makefile.in" -a "$dname/Makefile.in" -ot "$file" ]; then - ( cd "${LyxSourceDir}" && sh autogen.sh ) - break - fi - done -fi - -FILE_LIST="lyx lyxclient tex2lyx" +LYX_FILE_LIST="lyx lyxclient tex2lyx" BUNDLE_PATH="Contents/MacOS" LYX_BUNDLE_PATH="${LyxAppPrefix}/${BUNDLE_PATH}" build_lyx() { @@ -443,6 +438,20 @@ build_lyx() { if [ -n "${LyxAppZip}" -a -f "${LyxAppZip}" ]; then rm "${LyxAppZip}"; fi if [ -d "${LyxAppPrefix}" ]; then rm -rf "${LyxAppPrefix}"; fi + # ------------------------------------- + # Automate configure check + # ------------------------------------- + if [ ! -f "${LyxSourceDir}"/configure -o "${LyxSourceDir}"/configure -ot "${LyxSourceDir}"/configure.ac ]; then + ( cd "${LyxSourceDir}" && sh autogen.sh ) + else + find "${LyxSourceDir}" -name Makefile.am -print | while read file ; do + dname=`dirname "$file"` + if [ -f "$dname/Makefile.in" -a "$dname/Makefile.in" -ot "$file" ]; then + ( cd "${LyxSourceDir}" && sh autogen.sh ) + break + fi + done + fi # ------------------------------------- # Build LyX for different architectures # ------------------------------------- @@ -480,8 +489,6 @@ build_lyx() { CPPFLAGS="${CPPFLAGS} -I${SDKROOT}/Library/Frameworks/QtCore.framework/Headers" CPPFLAGS="${CPPFLAGS} -I${SDKROOT}/Library/Frameworks/QtGui.framework/Headers" fi - LDFLAGS="${LDFLAGS}"${CARBON:+" -framework Carbon"} - LDFLAGS="${LDFLAGS} -framework AppKit" echo LDFLAGS="${LDFLAGS}" export LDFLAGS @@ -494,7 +501,7 @@ build_lyx() { ${LyXConfigureOptions}\ --host="${HOSTSYSTEM}" --build="${BuildSystem}" --enable-build-type=rel && \ make -j2 && make install${strip} - for file in ${FILE_LIST} ; do + for file in ${LYX_FILE_LIST} ; do if [ -f "${LYX_BUNDLE_PATH}/${file}" ]; then mv "${LYX_BUNDLE_PATH}/${file}"\ "${LYX_BUNDLE_PATH}/${file}-${arch}" @@ -538,6 +545,7 @@ deploy_qtlibs() { test -f "${condir}/Resources/qt.conf" || cat - > "${condir}/Resources/qt.conf" <<-EOF [Paths] Plugins = PlugIns +Translations = translations EOF if [ ! -d "${condir}/PlugIns" ]; then mkdir -p "${condir}/PlugIns" @@ -561,18 +569,20 @@ EOF echo Set library id in "${condir}/${fwdir}/${version}${libnm}" install_name_tool -id "@executable_path/../${fwdir}/${version}${libnm}" "${condir}/${fwdir}/${version}${libnm}" find "${condir}/PlugIns" "${condir}/"`dirname "${fwdir}"` -name Headers -prune -o -type f -print | while read filename ; do - otool -L "${filename}" 2>/dev/null | while read library ; do - # pattern match for: /path/to/qt4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2) - case "${library}" in - *"${libnm}"*"("*")"*) - echo Correct library id reference to "${libnm}" in "${filename}" - install_name_tool -change\ - "${source}/lib/${dirname}/${version}${libnm}"\ - "@executable_path/../${fwdir}/${version}${libnm}"\ - "${filename}" - ;; - esac - done + if [ "${filename}" != "${target}" ]; then + otool -L "${filename}" 2>/dev/null | sort -u | while read library ; do + # pattern match for: /path/to/qt4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2) + case "${library}" in + *"${libnm}"*"("*version*")"*) + echo Correct library id reference to "${libnm}" in "${filename}" + install_name_tool -change\ + "${source}/lib/${dirname}/${version}${libnm}"\ + "@executable_path/../${fwdir}/${version}${libnm}"\ + "${filename}" + ;; + esac + done + fi done ) echo Correct library id reference to "${libnm}" in "${target}" @@ -581,6 +591,11 @@ EOF "@executable_path/../${fwdir}/${version}${libnm}"\ "${target}" done + if [ ! -d "${condir}/translations" ]; then + mkdir -p "${condir}/translations" + fi + echo Copy Qt translations to "${condir}/translations" + cp -p "${source}"/translations/qt_*.qm "${condir}/translations" } # ------------------------- @@ -588,7 +603,7 @@ EOF # ------------------------- convert_universal() { cd "${LyxAppPrefix}" - for file in ${FILE_LIST} ; do + for file in ${LYX_FILE_LIST} ; do OBJ_LIST= for arch in ${ARCH_LIST} ; do if [ -f "${BUNDLE_PATH}/${file}-${arch}" ]; then @@ -643,9 +658,17 @@ copy_dictionaries() { fi } -function set_bundle_display_options() { +set_bundle_display_options() { + X_BOUNDS=$2 + Y_BOUNDS=$3 + Y_POSITION=$((Y_BOUNDS - 65)) + Y_BOUNDS=$((Y_BOUNDS + 20)) + LYX_X_POSITION=$((X_BOUNDS / 4)) + LYX_Y_POSITION=$Y_POSITION + APP_X_POSITION=$((3 * X_BOUNDS / 4)) + APP_Y_POSITION=$Y_POSITION osascript <<-EOF - tell application "Finder" + tell application "Finder" set f to POSIX file ("${1}" as string) as alias tell folder f open @@ -654,16 +677,17 @@ function set_bundle_display_options() { set statusbar visible to false set current view to icon view delay 1 -- sync - set the bounds to {20, 50, $2, $3} + set the bounds to {20, 50, $X_BOUNDS, $Y_BOUNDS} end tell delay 1 -- sync set icon size of the icon view options of container window to 64 set arrangement of the icon view options of container window to not arranged - set position of item "${LyxName}.app" to {100,$4} - set position of item "Applications" to {280,$4} + set position of item "Documents" to {$LYX_X_POSITION,0} + set position of item "${LyxName}.app" to {$LYX_X_POSITION,$LYX_Y_POSITION} + set position of item "Applications" to {$APP_X_POSITION,$APP_Y_POSITION} set background picture of the icon view options\ of container window to file "background.png" of folder "Pictures" - set the bounds of the container window to {0, 0, $2, $3} + set the bounds of the container window to {0, 0, $X_BOUNDS, $Y_BOUNDS} update without registering applications delay 5 -- sync close @@ -673,13 +697,12 @@ function set_bundle_display_options() { EOF } -function make_dmg() { +make_dmg() { cd "${1}" - BGSIZE=`file "$BACKGROUND" | awk -F , '/PNG/{print $2 }' | tr x ' '` + BGSIZE=`file "$DmgBackground" | awk -F , '/PNG/{print $2 }' | tr x ' '` BG_W=`echo ${BGSIZE} | awk '{print $1 }'` - BG_H=`echo ${BGSIZE} | awk '{h = $2 + 20 ;print h }'` - BG_Y=`echo ${BGSIZE} | awk '{y = $2 - 60 ;print y }'` + BG_H=`echo ${BGSIZE} | awk '{print $2 }'` rm -f "${DMGNAME}.sparseimage" "${DMGNAME}.dmg" @@ -700,10 +723,12 @@ function make_dmg() { # copy in background image mkdir -p "${VOLUME}/Pictures" - cp "${BACKGROUND}" "${VOLUME}/Pictures/background.png" + cp "${DmgBackground}" "${VOLUME}/Pictures/background.png" # symlink applications ln -s /Applications/ "${VOLUME}"/Applications - set_bundle_display_options "${VOLUME}" ${BG_W} ${BG_H} ${BG_Y} + test -d "${DocumentationDir}" && cp -r "${DocumentationDir}" "${VOLUME}" + set_bundle_display_options "${VOLUME}" ${BG_W} ${BG_H} + /Developer/Tools/SetFile -a C "${VOLUME}" mv "${VOLUME}/Pictures" "${VOLUME}/.Pictures" # Unmount the disk image @@ -714,28 +739,32 @@ function make_dmg() { rm -f "${DMGNAME}.sparseimage" } -build_lyx -convert_universal -copy_dictionaries - # ------------------------------ # Building distribution packages # ------------------------------ -test -n "${LyxAppZip}" && ( - cd "${LyxAppPrefix}" && zip -r "${LyxAppZip}" . -) - -test -n "${DMGLocation}" && ( - make_dmg "${DMGLocation}" - if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt4_deployment}" ]; then - rm -f "${DMGLocation}/${DMGNAME}+qt4.dmg" - echo move to "${DMGLocation}/${DMGNAME}+qt4.dmg" - mv "${DMGLocation}/${DMGNAME}.dmg" "${DMGLocation}/${DMGNAME}+qt4.dmg" - #for libnm in ${QtLibraries} ; do - # fwdir=`framework_name "$libnm"` - # rm -rf "${LyxAppDir}.app/Contents/${fwdir}" - #done - #make_dmg "${DMGLocation}" - fi -) +build_package() { + test -n "${LyxAppZip}" && ( + cd "${LyxAppPrefix}" && zip -r "${LyxAppZip}" . + ) + + test -n "${DMGLocation}" && ( + make_dmg "${DMGLocation}" + if [ -d "${QtInstallDir}/lib/QtCore.framework/Versions/${QtFrameworkVersion}" -a "yes" = "${qt4_deployment}" ]; then + rm -f "${DMGLocation}/${DMGNAME}+qt4.dmg" + echo move to "${DMGLocation}/${DMGNAME}+qt4${MAC_API}.dmg" + mv "${DMGLocation}/${DMGNAME}.dmg" "${DMGLocation}/${DMGNAME}+qt4${MAC_API}.dmg" + fi + ) +} + +# ------------------------------ +# main block +# ------------------------------ + +if [ ${LyxOnlyPackage:-"no"} = "no" ]; then + build_lyx + convert_universal + copy_dictionaries +fi +build_package