]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Merge branch 'macosx-app-bundle-1' of git://github.com/henrik242/subsurface
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 1 Nov 2011 00:12:59 +0000 (17:12 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 1 Nov 2011 00:12:59 +0000 (17:12 -0700)
* 'macosx-app-bundle-1' of git://github.com/henrik242/subsurface:
  Use the new packaging directory for MacOSX specific files, and provide shell script workaround to make the svg icon reachable.
  Ignore process serial number argument when run as native MacOSX app
  Add basic MacOSX app bundle install target

Makefile
main.c
packaging/macosx/Info.plist [new file with mode: 0644]
packaging/macosx/PkgInfo [new file with mode: 0644]
packaging/macosx/Subsurface.icns [new file with mode: 0644]
packaging/macosx/subsurface.sh [new file with mode: 0755]

index 3f563a3b51e55af0aa264e29fc21890da39ba4a6..ab7df0003b493071c777bd310e0dccdfce3f63ab 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,9 @@ ICONFILE = $(NAME).svg
 DESKTOPFILE = $(NAME).desktop
 MANFILES = $(NAME).1
 
+MACOSXINSTALL = /Applications/Subsurface.app
+MACOSXFILES = packaging/macosx
+
 # find libdivecomputer
 # First deal with the cross compile environment.
 # For the native case, Linus doesn't want to trust pkg-config given
@@ -102,6 +105,16 @@ GLIB2CFLAGS = $(shell $(PKGCONFIG) --cflags glib-2.0)
 GCONF2CFLAGS =  $(shell $(PKGCONFIG) --cflags gconf-2.0)
 GTK2CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-2.0)
 
+install-macosx: $(NAME)
+       $(INSTALL) -d -m 755 $(MACOSXINSTALL)/Contents/Resources
+       $(INSTALL) -d -m 755 $(MACOSXINSTALL)/Contents/MacOS
+       $(INSTALL) $(NAME) $(MACOSXINSTALL)/Contents/MacOS/
+       $(INSTALL) $(MACOSXFILES)/subsurface.sh $(MACOSXINSTALL)/Contents/MacOS/
+       $(INSTALL) $(MACOSXFILES)/PkgInfo $(MACOSXINSTALL)/Contents/
+       $(INSTALL) $(MACOSXFILES)/Info.plist $(MACOSXINSTALL)/Contents/
+       $(INSTALL) $(ICONFILE) $(MACOSXINSTALL)/Contents/Resources/
+       $(INSTALL) $(MACOSXFILES)/Subsurface.icns $(MACOSXINSTALL)/Contents/Resources/
+
 parse-xml.o: parse-xml.c dive.h
        $(CC) $(CFLAGS) $(GLIB2CFLAGS) -c $(XML2CFLAGS)  parse-xml.c
 
diff --git a/main.c b/main.c
index f34e3ae51b3f3fa952bf69cb6373b1eefef788ca..5fed4cd6ed0e5b74b140e7bf8a8971eab9f24c45 100644 (file)
--- a/main.c
+++ b/main.c
@@ -167,6 +167,12 @@ static void parse_argument(const char *arg)
                                return;
                        }
                        /* fallthrough */
+               case 'p':
+                       /* ignore process serial number argument when run as native macosx app */
+                       if (strncmp(arg, "-psn_", 5) == 0) {
+                               return;
+                       }
+                       /* fallthrough */ 
                default:
                        fprintf(stderr, "Bad argument '%s'\n", arg);
                        exit(1);
diff --git a/packaging/macosx/Info.plist b/packaging/macosx/Info.plist
new file mode 100644 (file)
index 0000000..4ee1243
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleIconFile</key>
+       <string>Subsurface</string>
+       <key>CFBundleName</key>
+       <string>Subsurface</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+        <key>CFBundleGetInfoString</key>
+       <string>Rough divelog in C and Gtk</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleExecutable</key>
+       <string>subsurface.sh</string>
+       <key>CFBundleIdentifier</key>
+       <string>torvalds.subsurface</string>
+</dict>
+</plist>
diff --git a/packaging/macosx/PkgInfo b/packaging/macosx/PkgInfo
new file mode 100644 (file)
index 0000000..6f749b0
--- /dev/null
@@ -0,0 +1 @@
+APPL????
diff --git a/packaging/macosx/Subsurface.icns b/packaging/macosx/Subsurface.icns
new file mode 100644 (file)
index 0000000..27c077f
Binary files /dev/null and b/packaging/macosx/Subsurface.icns differ
diff --git a/packaging/macosx/subsurface.sh b/packaging/macosx/subsurface.sh
new file mode 100755 (executable)
index 0000000..ee9427c
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+cd `dirname $0`/../Resources
+../MacOS/subsurface &
+exit 0