sigrok-native-macosx: Add sigrok-cli DMG creation support.
authorUwe Hermann <uwe@hermann-uwe.de>
Sat, 30 May 2020 13:54:22 +0000 (15:54 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Sat, 30 May 2020 13:56:28 +0000 (15:56 +0200)
cross-compile/macosx/README
cross-compile/macosx/contrib/Info.plist [deleted file]
cross-compile/macosx/contrib/Info.plist_pulseview [new file with mode: 0644]
cross-compile/macosx/contrib/Info.plist_sigrok-cli [new file with mode: 0644]
cross-compile/macosx/contrib/sigrok-cli [new file with mode: 0755]
cross-compile/macosx/create_dmg

index 342757fc3d18df9469e9ecdc3db9061448960eaa..2b863e35d991ff08babf68f81a4d685fe4ebd32c 100644 (file)
@@ -38,3 +38,11 @@ Per default it will install the compiled packages in:
 
 Please edit the script if you want to change any settings.
 
+
+Creating a DMG file
+-------------------
+
+ $ ./create_dmg pulseview
+
+ $ ./create_dmg sigrok-cli
+
diff --git a/cross-compile/macosx/contrib/Info.plist b/cross-compile/macosx/contrib/Info.plist
deleted file mode 100644 (file)
index c595e6b..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
-<plist version="0.9">
-<dict>
-       <key>NSPrincipalClass</key>
-       <string>NSApplication</string>
-       <key>CFBundleIconFile</key>
-       <string>pulseview.icns</string>
-       <key>CFBundlePackageType</key>
-       <string>APPL</string>
-       <key>CFBundleGetInfoString</key>
-       <string>PulseView is a Qt based logic analyzer, oscilloscope and MSO GUI for sigrok.</string>
-       <key>CFBundleSignature</key>
-       <string>????</string>
-       <key>CFBundleExecutable</key>
-       <string>pulseview</string>
-       <key>CFBundleIdentifier</key>
-       <string>org.sigrok.PulseView</string>
-</dict>
-</plist>
diff --git a/cross-compile/macosx/contrib/Info.plist_pulseview b/cross-compile/macosx/contrib/Info.plist_pulseview
new file mode 100644 (file)
index 0000000..c595e6b
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+       <key>NSPrincipalClass</key>
+       <string>NSApplication</string>
+       <key>CFBundleIconFile</key>
+       <string>pulseview.icns</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleGetInfoString</key>
+       <string>PulseView is a Qt based logic analyzer, oscilloscope and MSO GUI for sigrok.</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleExecutable</key>
+       <string>pulseview</string>
+       <key>CFBundleIdentifier</key>
+       <string>org.sigrok.PulseView</string>
+</dict>
+</plist>
diff --git a/cross-compile/macosx/contrib/Info.plist_sigrok-cli b/cross-compile/macosx/contrib/Info.plist_sigrok-cli
new file mode 100644 (file)
index 0000000..8babac2
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+       <key>NSPrincipalClass</key>
+       <string>NSApplication</string>
+       <key>CFBundleIconFile</key>
+       <string>sigrok-cli.icns</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleGetInfoString</key>
+       <string>sigrok-cli is a command-line client for sigrok.</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleExecutable</key>
+       <string>sigrok-cli</string>
+       <key>CFBundleIdentifier</key>
+       <string>org.sigrok.sigrok-cli</string>
+</dict>
+</plist>
diff --git a/cross-compile/macosx/contrib/sigrok-cli b/cross-compile/macosx/contrib/sigrok-cli
new file mode 100755 (executable)
index 0000000..f3adbb0
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+##
+## This file is part of the sigrok-util project.
+##
+## Copyright (C) 2020 Uwe Hermann <uwe@hermann-uwe.de>
+##
+## 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
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+
+DIR="$(dirname "$0")"
+cd "$DIR"
+export PYTHONHOME="../Frameworks/Python.framework/Versions/3.7"
+export SIGROK_FIRMWARE_DIR="../share/sigrok-firmware"
+export SIGROKDECODE_DIR="../share/libsigrokdecode/decoders"
+exec ./sigrok-cli.real "$@"
index 93acf04d4edaa6a4a5d9a27053b07421b3483d34..2821533fe79920bce44fcc9505607cba0527e633 100755 (executable)
@@ -2,7 +2,7 @@
 ##
 ## This file is part of the sigrok-util project.
 ##
-## Copyright (C) 2017 Uwe Hermann <uwe@hermann-uwe.de>
+## Copyright (C) 2017-2020 Uwe Hermann <uwe@hermann-uwe.de>
 ##
 ## 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
@@ -50,8 +58,6 @@ rm -rf $BUILDDIR
 mkdir $BUILDDIR
 cd $BUILDDIR
 
-APPNAME="PulseView"
-APPNAME_BINARY="pulseview"
 APPVER="NIGHTLY"
 
 CONTENTSDIR="$APPNAME.app/Contents"
@@ -68,17 +74,19 @@ 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*
-
-# 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
+if [ "x$1" = "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
+fi
 
 $QTBINDIR/macdeployqt $APPNAME.app
 
@@ -107,13 +115,13 @@ install_name_tool -change \
        @executable_path/../Frameworks/Python.framework/Versions/$PYVER/Python \
        $FRAMEWORKSDIR/libsigrokdecode.*.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"