X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-util.git;a=blobdiff_plain;f=cross-compile%2Fmacosx%2Fcreate_dmg;h=be976737a98908c44783799a58f65d4e6162dd7d;hp=fd36a273da475e556bfc0ca51d581fe302184133;hb=HEAD;hpb=b1181fe12749e653f74285f71edd09dd6fc859ff diff --git a/cross-compile/macosx/create_dmg b/cross-compile/macosx/create_dmg index fd36a27..be97673 100755 --- a/cross-compile/macosx/create_dmg +++ b/cross-compile/macosx/create_dmg @@ -2,7 +2,7 @@ ## ## This file is part of the sigrok-util project. ## -## Copyright (C) 2017 Uwe Hermann +## Copyright (C) 2017-2020 Uwe Hermann ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -23,8 +23,16 @@ set -e # The path where the installed sigrok libraries/binaries are located. PREFIX=$HOME/sr_macosx +if [ "x$1" = "xsigrok-cli" ]; then + APPNAME="sigrok-cli" + APPNAME_BINARY="sigrok-cli" +else + APPNAME="PulseView" + APPNAME_BINARY="pulseview" +fi + # The path where to download files to and where to build packages. -BUILDDIR=./build_app +BUILDDIR=./build_app_$APPNAME_BINARY # We use Qt 5.5 in order to remain compatible with more versions of Mac OS X. QTVER=qt@5.5 @@ -37,7 +45,7 @@ QTTRANSLATIONSDIR=`brew --prefix $QTVER`/translations BOOSTLIBDIR=`brew list boost | grep libboost_system | grep -v cmake | head -n 1 | xargs dirname` # Path to Python 3 framework. -PYTHONFRAMEWORKDIR=`brew list python3 | grep Python.framework | head -n 1 | xargs dirname`/../../../.. +PYTHONFRAMEWORKDIR=`brew list python3 | grep libpython | head -n 1 | xargs dirname`/../../../.. PYVER="3.7" @@ -50,8 +58,6 @@ rm -rf $BUILDDIR mkdir $BUILDDIR cd $BUILDDIR -APPNAME="PulseView" -APPNAME_BINARY="pulseview" APPVER="NIGHTLY" CONTENTSDIR="$APPNAME.app/Contents" @@ -63,22 +69,23 @@ PYDIR="$FRAMEWORKSDIR/Python.framework/Versions/$PYVER" mkdir -p $MACOSDIR $FRAMEWORKSDIR $SHARE_DIR cp $PREFIX/bin/$APPNAME_BINARY $MACOSDIR +# Implementation detail: Shared libraries are handled below. cp -R $PREFIX/share/libsigrokdecode $SHARE_DIR rm -rf $SHARE_DIR/libsigrokdecode/decoders/**/__pycache__ rm -rf $SHARE_DIR/libsigrokdecode/decoders/common/**/__pycache__ cp -R $PREFIX/share/sigrok-firmware $SHARE_DIR -# Manually copy some boost libs that "macdeployqt" won't copy. -cp $BOOSTLIBDIR/libboost_timer-mt.dylib $FRAMEWORKSDIR -cp $BOOSTLIBDIR/libboost_chrono-mt.dylib $FRAMEWORKSDIR -chmod 644 $FRAMEWORKSDIR/*boost* +if [ "x$APPNAME_BINARY" = "xpulseview" ]; then + # Manually copy some boost libs that "macdeployqt" won't copy. + cp $BOOSTLIBDIR/libboost_timer-mt.dylib $FRAMEWORKSDIR + cp $BOOSTLIBDIR/libboost_chrono-mt.dylib $FRAMEWORKSDIR + chmod 644 $FRAMEWORKSDIR/*boost* -# Manually copy translations ("macdeployqt" won't copy them). -mkdir -p $CONTENTSDIR/translations -for lang in "de"; do - cp $QTTRANSLATIONSDIR/qt_$lang.qm $CONTENTSDIR/translations - cp $QTTRANSLATIONSDIR/qtbase_$lang.qm $CONTENTSDIR/translations -done + # Manually copy translations ("macdeployqt" won't copy them). + mkdir -p $CONTENTSDIR/translations + cp $QTTRANSLATIONSDIR/qt_*.qm $CONTENTSDIR/translations + cp $QTTRANSLATIONSDIR/qtbase_*.qm $CONTENTSDIR/translations +fi $QTBINDIR/macdeployqt $APPNAME.app @@ -106,14 +113,18 @@ install_name_tool -change \ /usr/local/opt/python/Frameworks/Python.framework/Versions/$PYVER/Python \ @executable_path/../Frameworks/Python.framework/Versions/$PYVER/Python \ $FRAMEWORKSDIR/libsigrokdecode.*.dylib +install_name_tool -change \ + /usr/local/opt/python/Frameworks/Python.framework/Versions/$PYVER/Python \ + @executable_path/../Frameworks/Python.framework/Versions/$PYVER/Python \ + $PREFIX/lib/libirmp.*.dylib -# Add PulseView wrapper (sets PYTHONHOME/SIGROK_FIRMWARE_DIR/SIGROKDECODE_DIR). +# Add wrapper (sets PYTHONHOME/SIGROK_FIRMWARE_DIR/SIGROKDECODE_DIR). mv $MACOSDIR/$APPNAME_BINARY $MACOSDIR/$APPNAME_BINARY.real -cp ../contrib/pulseview $MACOSDIR +cp ../contrib/$APPNAME_BINARY $MACOSDIR chmod 755 $MACOSDIR/$APPNAME_BINARY -cp ../contrib/Info.plist $CONTENTSDIR -cp ../contrib/pulseview.icns $CONTENTSDIR/Resources +cp ../contrib/Info.plist_$APPNAME_BINARY $CONTENTSDIR/Info.plist +cp ../contrib/$APPNAME_BINARY.icns $CONTENTSDIR/Resources hdiutil create "${APPNAME}-${APPVER}.dmg" -volname "$APPNAME $APPVER" \ -fs HFS+ -srcfolder "$APPNAME.app"