]> sigrok.org Git - sigrok-util.git/commitdiff
macosx: Add a script that creates a self-contained DMG.
authorUwe Hermann <redacted>
Tue, 1 Aug 2017 21:03:56 +0000 (23:03 +0200)
committerUwe Hermann <redacted>
Wed, 2 Aug 2017 09:00:24 +0000 (11:00 +0200)
cross-compile/macosx/contrib/Info.plist [new file with mode: 0644]
cross-compile/macosx/contrib/pulseview [new file with mode: 0755]
cross-compile/macosx/contrib/pulseview.icns [new file with mode: 0644]
cross-compile/macosx/create_dmg [new file with mode: 0755]

diff --git a/cross-compile/macosx/contrib/Info.plist b/cross-compile/macosx/contrib/Info.plist
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/pulseview b/cross-compile/macosx/contrib/pulseview
new file mode 100755 (executable)
index 0000000..e97e3f0
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+##
+## This file is part of the sigrok-util project.
+##
+## Copyright (C) 2017 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.6"
+export SIGROKDECODE_DIR="../share/libsigrokdecode/decoders"
+./pulseview.real
diff --git a/cross-compile/macosx/contrib/pulseview.icns b/cross-compile/macosx/contrib/pulseview.icns
new file mode 100644 (file)
index 0000000..a569ce7
Binary files /dev/null and b/cross-compile/macosx/contrib/pulseview.icns differ
diff --git a/cross-compile/macosx/create_dmg b/cross-compile/macosx/create_dmg
new file mode 100755 (executable)
index 0000000..7b4b12c
--- /dev/null
@@ -0,0 +1,108 @@
+#!/bin/sh
+##
+## This file is part of the sigrok-util project.
+##
+## Copyright (C) 2017 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/>.
+##
+
+set -e
+
+# The path where the installed sigrok libraries/binaries are located.
+PREFIX=$HOME/sr_macosx
+
+# The path where to download files to and where to build packages.
+BUILDDIR=./build_app
+
+# Path to Qt5 binaries.
+QTBINDIR=`brew list qt5 | grep bin | head -n 1 | xargs dirname`
+
+# Path to boost libraries.
+BOOSTLIBDIR=`brew list boost | grep libboost_system | head -n 1 | xargs dirname`
+
+# Path to Python 3 framework.
+PYTHONFRAMEWORKDIR=`brew list python3 | grep Python.framework | head -n 1 | xargs dirname`/../../../..
+
+PYVER="3.6"
+
+# You usually don't need to change anything below this line.
+
+# -----------------------------------------------------------------------------
+
+# Remove build directory contents (if any) and create a new build dir.
+rm -rf $BUILDDIR
+mkdir $BUILDDIR
+cd $BUILDDIR
+
+APPNAME="PulseView"
+APPNAME_BINARY="pulseview"
+APPVER="nightly"
+
+CONTENTSDIR="$APPNAME.app/Contents"
+MACOSDIR="$CONTENTSDIR/MacOS"
+FRAMEWORKSDIR="$CONTENTSDIR/Frameworks"
+SHARE_DIR="$CONTENTSDIR/share"
+PYDIR="$FRAMEWORKSDIR/Python.framework/Versions/$PYVER"
+
+mkdir -p $MACOSDIR $FRAMEWORKSDIR $SHARE_DIR
+
+cp $PREFIX/bin/$APPNAME_BINARY $MACOSDIR
+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*
+
+$QTBINDIR/macdeployqt $APPNAME.app
+
+# Copy Python framework and fix it up.
+cp -R $PYTHONFRAMEWORKDIR $FRAMEWORKSDIR
+chmod 644 $PYDIR/lib/libpython*.dylib
+rm -rf $PYDIR/Headers
+rm -rf $PYDIR/bin
+rm -rf $PYDIR/include
+rm -rf $PYDIR/share
+rm -rf $PYDIR/lib/pkgconfig
+rm -rf $PYDIR/lib/python$PYVER/lib2to3
+rm -rf $PYDIR/lib/python$PYVER/distutils
+rm -rf $PYDIR/lib/python$PYVER/idlelib
+rm -rf $PYDIR/lib/python$PYVER/test
+rm -rf $PYDIR/lib/python$PYVER/**/test
+rm -rf $PYDIR/lib/python$PYVER/tkinter
+rm -rf $PYDIR/lib/python$PYVER/turtledemo
+rm -rf $PYDIR/lib/python$PYVER/unittest
+rm -rf $PYDIR/lib/python$PYVER/__pycache__
+rm -rf $PYDIR/lib/python$PYVER/**/__pycache__
+rm -rf $PYDIR/lib/python$PYVER/**/**/__pycache__
+rm -rf $PYDIR/Resources
+install_name_tool -change \
+       /usr/local/opt/python3/Frameworks/Python.framework/Versions/$PYVER/Python \
+       @executable_path/../Frameworks/Python.framework/Versions/$PYVER/Python \
+       $FRAMEWORKSDIR/libsigrokdecode.*.dylib
+
+# Add PulseView wrapper script that sets PYTHONHOME and SIGROKDECODE_DIR.
+mv $MACOSDIR/$APPNAME_BINARY $MACOSDIR/$APPNAME_BINARY.real
+cp ../contrib/pulseview $MACOSDIR
+chmod 755 $MACOSDIR/$APPNAME_BINARY
+
+cp ../contrib/Info.plist $CONTENTSDIR
+cp ../contrib/pulseview.icns $CONTENTSDIR/Resources
+
+hdiutil create "${APPNAME}_${APPVER}.dmg" -volname "$APPNAME $APPVER" \
+       -fs HFS+ -srcfolder "$APPNAME.app"