]> git.lyx.org Git - lyx.git/blobdiff - development/LyX-Mac-binary-release.sh
ctest update: Japanese documents (should) work with non-TeX fonts.
[lyx.git] / development / LyX-Mac-binary-release.sh
index 05cb757db577a80b6dc6a2cda85503292f40b5c3..80c1d7e786e5758f16dca4b88c728033f9586145 100644 (file)
@@ -21,7 +21,7 @@ ASpellVersion=${ASpellVersion:-"0.60.6.1"}
 ASpellSource="aspell-${ASpellVersion}"
 ASpellLibrary="libaspell.15.dylib"
 
-HunSpellVersion=${HunSpellVersion:-"1.3.2"}
+HunSpellVersion=${HunSpellVersion:-"1.3.3"}
 HunSpellSource="hunspell-${HunSpellVersion}"
 HunSpellLibrary="libhunspell-1.3.0.dylib"
 
@@ -65,12 +65,14 @@ case "${QtVersion}:${QtAPI}" in
        QtConfigureOptions="${QtConfigureOptions} -nomake examples -nomake demos -nomake docs -nomake tools"
        QtMajorVersion=qt5
        ;;
-5.6*)
+5.6*|5.7*)
        QtConfigureOptions="${QtConfigureOptions} -no-strip"
        QtConfigureOptions="${QtConfigureOptions} -no-kms -no-pkg-config"
        QtConfigureOptions="${QtConfigureOptions} -nomake examples -nomake tools"
        QtConfigureOptions="${QtConfigureOptions} -skip qtconnectivity -skip qtscript"
-       QtConfigureOptions="${QtConfigureOptions} -skip qtquickcontrols -skip qtdeclarative"
+       QtConfigureOptions="${QtConfigureOptions} -skip qtquickcontrols"
+       QtConfigureOptions="${QtConfigureOptions} -skip qttools"
+       QtConfigureOptions="${QtConfigureOptions} -skip qtdeclarative"
        QtMajorVersion=qt5
        ;;
 5.*)
@@ -104,11 +106,11 @@ thesaurus_deployment="yes"
 qt_deployment="yes"
 
 # auto detect Xcode location
-if [ -d "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" ]; then
-       DEVELOPER_SDKS="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs"
-       XCODE_DEVELOPER="/Applications/Xcode.app/Contents/Developer"
+DEVELOPER_SDKS=$(dirname $(xcrun --show-sdk-path))
+if [ -n "${DEVELOPER_SDKS}" ]; then
+       XCODE_DEVELOPER=$(dirname $(dirname $(xcrun --show-sdk-platform-path)))
        MACOSX_DEPLOYMENT_TARGET="10.7" # Lion support is default
-       SDKROOT="${DEVELOPER_SDKS}/MacOSX10.7.sdk" # Lion build is default
+       SDKROOT="${DEVELOPER_SDKS}/MacOSX$(xcrun --show-sdk-version).sdk" # use default SDK
 elif [ -d "/Developer/SDKs" ]; then
        DEVELOPER_SDKS="/Developer/SDKs"
        XCODE_DEVELOPER="/Developer"
@@ -200,11 +202,12 @@ while [ $# -gt 0 ]; do
                        export OBJC=gcc-4.0
                        export CXX=g++-4.0
                        ;;
-               10.5|10.6|10.7|10.8|10.9|10.10)
-                       SDKROOT="${DEVELOPER_SDKS}/MacOSX${SDKROOT}.sdk"
-                       ;;
                *)
-                       usage
+                       SDKROOT="${DEVELOPER_SDKS}/MacOSX${SDKROOT}.sdk"
+                       if [ ! -d "${SDKROOT}" ]; then
+                               echo Invalid SDKROOT given: "${SDKROOT}"
+                               usage --help=short
+                       fi
                        ;;
                esac
                shift
@@ -265,10 +268,19 @@ while [ $# -gt 0 ]; do
                hunspell_deployment="no"
                shift
                ;;
+       --only-qt*=*)
+               QtOnlyPackage=$(echo ${1}|cut -d= -f2)
+               shift
+               ;;
        --only-package=*)
                LyxOnlyPackage=$(echo ${1}|cut -d= -f2)
                shift
                ;;
+       --enable-cxx11)
+               LyXConfigureOptions="${LyXConfigureOptions} ${1}"
+               EnableCXX11="--enable-cxx11"
+               shift
+               ;;
        --*)
                LyXConfigureOptions="${LyXConfigureOptions} ${1}"
                shift
@@ -343,12 +355,8 @@ case "${QtVersion}" in
        QtLibraries="QtSvg QtXml QtPrintSupport QtWidgets QtGui QtNetwork QtConcurrent QtCore"
        QtFrameworkVersion="5"
        ;;
-5.2.*|5.3.*|5.4.*)
-       QtLibraries="QtSvg QtXml QtPrintSupport QtMacExtras QtWidgets QtGui QtNetwork QtConcurrent QtCore"
-       QtFrameworkVersion="5"
-       ;;
 5*)
-       QtLibraries="QtSvg QtXml QtPrintSupport QtDBus QtMacExtras QtWidgets QtGui QtNetwork QtConcurrent QtCore"
+       QtLibraries="QtSvg QtXml QtPrintSupport QtMacExtras QtWidgets QtGui QtNetwork QtConcurrent QtCore"
        QtFrameworkVersion="5"
        ;;
 *)
@@ -386,8 +394,9 @@ case $SDKs in
        ;;
 esac
 MYCFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}"
+MYLDFLAGS="-mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}"
 
-if [ "${configure_qt_frameworks}" != "yes" -a -d "${QtSourceDir}" -a ! \( -d "${QtBuildDir}" -a -d "${QtInstallDir}" \) ]; then
+build_qt() {
        echo Build Qt library ${QtSourceDir}
        if [ "${QtInstallDir}" = "${QtBuildDir}" ]; then
                echo Bad install directory for Qt.
@@ -401,17 +410,29 @@ if [ "${configure_qt_frameworks}" != "yes" -a -d "${QtSourceDir}" -a ! \( -d "${
                "${QtSourceDir}"/configure ${QtConfigureOptions} ${QTARCHS} -prefix "${QtInstallDir}"
                make -j1 && make -j1 install
        )
-fi
-if [ -d "${QtInstallDir}" -a ! -f "${QtInstallDir}"/include/QtCore ]; then
-       cd "${QtInstallDir}" && (
-               mkdir -p include
-               cd include
-               for libnm in ${QtLibraries} ; do
-                       test -d ${libnm} -o -L ${libnm} || \
-                       ( ln -s ../lib/${libnm}.framework/Headers ${libnm} && echo Link to framework ${libnm} )
-               done
-       )
-fi
+       if [ -d "${QtInstallDir}" -a ! -f "${QtInstallDir}"/include/QtCore ]; then
+               cd "${QtInstallDir}" && (
+                       mkdir -p include
+                       cd include
+                       for libnm in ${QtLibraries} ; do
+                               test -d ${libnm} -o -L ${libnm} || \
+                               ( ln -s ../lib/${libnm}.framework/Headers ${libnm} && echo Link to framework ${libnm} )
+                       done
+               )
+       fi
+}
+
+case ${QtOnlyPackage:-"no"} in
+y*)
+       build_qt
+       exit 0
+       ;;
+*)
+       if [ "${configure_qt_frameworks}" != "yes" -a -d "${QtSourceDir}" -a ! \( -d "${QtBuildDir}" -a -d "${QtInstallDir}" \) ]; then
+               build_qt
+       fi
+       ;;
+esac
 
 if [ -d "${LibMagicSourceDir}" -a ! -f "${LibMagicInstallHdr}" ]; then
        # we have a private libmagic (file(1)) source tree at hand...
@@ -436,7 +457,7 @@ if [ -d "${LibMagicSourceDir}" -a ! -f "${LibMagicInstallHdr}" ]; then
 
        for arch in ${ARCH_LIST} ; do
                CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
-               LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
+               LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYLDFLAGS}"; export LDFLAGS
                "${LibMagicSourceDir}/configure"\
                        --prefix="${LibMagicInstallDir}"\
                        ${LibMagicConfigureOptions}
@@ -498,7 +519,7 @@ if [ -d "${HunSpellSourceDir}" -a ! -f "${HunSpellInstallHdr}" ]; then
        for arch in ${ARCH_LIST} ; do
                make distclean
                CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
-               LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
+               LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYLDFLAGS}"; export LDFLAGS
                "${HunSpellSourceDir}/configure"\
                        --prefix="${HunSpellInstallDir}"\
                        ${HunspellConfigureOptions}
@@ -561,7 +582,7 @@ if [ -d "${ASpellSourceDir}" -a ! -f "${ASpellInstallHdr}" -a "yes" = "${aspell_
        for arch in ${ARCH_LIST} ; do
                make distclean
                CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
-               LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
+               LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYLDFLAGS}"; export LDFLAGS
                CXXFLAGS=-g "${ASpellSourceDir}/configure"\
                        --prefix="${ASpellInstallDir}"\
                        ${AspellConfigureOptions}
@@ -602,7 +623,7 @@ framework_name() {
        echo "Frameworks/${1}.framework"
 }
 
-LYX_FILE_LIST="lyx lyxclient tex2lyx"
+LYX_FILE_LIST="lyx lyxclient tex2lyx lyxconvert"
 BUNDLE_PATH="Contents/MacOS"
 LYX_BUNDLE_PATH="${LyxAppPrefix}/${BUNDLE_PATH}"
 build_lyx() {
@@ -610,6 +631,14 @@ build_lyx() {
        if [ -n "${LyxAppZip}" -a -f "${LyxAppZip}" ]; then rm "${LyxAppZip}"; fi
        if [ -d "${LyxAppPrefix}" ]; then rm -rf "${LyxAppPrefix}"; fi
 
+       case "${EnableCXX11}" in
+       "--enable-cxx11")
+               export CC=cc
+               export CXX="c++ -stdlib=libc++"
+               export CXXFLAGS=-std=c++11
+               ;;
+       esac
+
        # -------------------------------------
        # Automate configure check
        # -------------------------------------
@@ -649,7 +678,7 @@ build_lyx() {
                mkdir -p "${LyxBuildDir}" && cd "${LyxBuildDir}"
 
                CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
-               LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
+               LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYLDFLAGS}"
 
                if [ "$configure_qt_frameworks" = "yes" ]; then
                        export QT_CORE_CFLAGS="-FQtCore"
@@ -676,7 +705,7 @@ build_lyx() {
                                mv "${LYX_BUNDLE_PATH}/${file}"\
                                        "${LYX_BUNDLE_PATH}/${file}-${arch}" 
                        else
-                               echo ERROR: Cannot build and install LyX for ${arch}.
+                               echo ERROR: Cannot build and install ${file} for ${arch}.
                                exit 1
                        fi
                done
@@ -692,7 +721,7 @@ content_directory() {
 
 installname() {
                echo install_name_tool "$@"
-               install_name_tool "$@"
+               install_name_tool "$@" || exit 1
 }
 
 private_framework() {
@@ -739,6 +768,7 @@ EOF
                test -d "${condir}/${fwdir}" || (
                        echo Copy framework "${source}/lib/"$(basename "${fwdir}")
                        cp -pR "${source}/lib/"$(basename "${fwdir}") "${condir}/${fwdir}"
+                       rm -f "${condir}/${fwdir}/${version}${libnm}"_debug
                        installname -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
                                if [ "${filename}" != "${target}" ]; then
@@ -746,7 +776,7 @@ EOF
                                                # pattern match for: /path/to/qt/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2)
                                                case "${library}" in
                                                *@rpath/*"${libnm}"*"("*version*")"*)
-                                                       echo rpath based name for ${libnm} is ok.
+                                                       echo rpath based name for ${libnm} is ok.
                                                        ;;
                                                *"${libnm}"*"("*version*")"*)
                                                        installname -change\
@@ -764,11 +794,13 @@ EOF
                        "@executable_path/../${fwdir}/${version}${libnm}"\
                        "${target}"
        done
-       if [ ! -d "${condir}/translations" ]; then
-               mkdir -p "${condir}/translations"
+       if [ -d "${source}"/translations ]; then
+               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"
        fi
-       echo Copy Qt translations to "${condir}/translations"
-       cp -p "${source}"/translations/qt_*.qm "${condir}/translations"
 }
 
 # -------------------------
@@ -912,28 +944,27 @@ make_dmg() {
        test -d /Volumes/"${LyxBase}" && rmdir /Volumes/"${LyxBase}"
 
        # Mount the disk image
-       hdiutil attach "${DMGNAME}.sparseimage"
+       DEVICES=$(hdiutil attach "${DMGNAME}.sparseimage" | cut -f 1)
 
        # Obtain device information
-       DEVS=$(hdiutil attach "${DMGNAME}.sparseimage" | cut -f 1)
-       DEV=$(echo $DEVS | cut -f 1 -d ' ')
-       VOLUME=$(mount |grep ${DEV} | cut -f 3 -d ' ')
+       DEVICE=$(echo $DEVICES | cut -f 1 -d ' ')
+       VOLUME=$(mount |grep ${DEVICE} | cut -f 3 -d ' ')
 
        # copy in the application bundle
-       cp -Rp "${LyxAppDir}.app" "${VOLUME}/${LyxName}.app"
+       ditto --hfsCompression "${LyxAppDir}.app" "${VOLUME}/${LyxName}.app"
 
        # copy in background image
        mkdir -p "${VOLUME}/Pictures"
-       cp "${DmgBackground}" "${VOLUME}/Pictures/background.png"
+       ditto --hfsCompression "${DmgBackground}" "${VOLUME}/Pictures/background.png"
        # symlink applications
        ln -s /Applications/ "${VOLUME}"/Applications
-       test -d "${DocumentationDir}" && cp -r "${DocumentationDir}" "${VOLUME}"
+       test -d "${DocumentationDir}" && ditto --hfsCompression "${DocumentationDir}" "${VOLUME}"
        set_bundle_display_options "${VOLUME}" ${BG_W} ${BG_H}
        ${XCODE_DEVELOPER}/Tools/SetFile -a C "${VOLUME}"
        mv "${VOLUME}/Pictures" "${VOLUME}/.Pictures"
 
        # Unmount the disk image
-       hdiutil detach ${DEV}
+       hdiutil detach ${DEVICE}
 
        # Convert the disk image to read-only
        hdiutil convert "${DMGNAME}.sparseimage" -format UDBZ -o "${DMGNAME}.dmg"