Merge branch 'macosx-app-bundle-1' of git://github.com/henrik242/subsurface

* '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
This commit is contained in:
Linus Torvalds 2011-10-31 17:12:59 -07:00
commit 5076397df0
6 changed files with 45 additions and 0 deletions

View file

@ -22,6 +22,9 @@ ICONFILE = $(NAME).svg
DESKTOPFILE = $(NAME).desktop DESKTOPFILE = $(NAME).desktop
MANFILES = $(NAME).1 MANFILES = $(NAME).1
MACOSXINSTALL = /Applications/Subsurface.app
MACOSXFILES = packaging/macosx
# find libdivecomputer # find libdivecomputer
# First deal with the cross compile environment. # First deal with the cross compile environment.
# For the native case, Linus doesn't want to trust pkg-config given # 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) GCONF2CFLAGS = $(shell $(PKGCONFIG) --cflags gconf-2.0)
GTK2CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-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 parse-xml.o: parse-xml.c dive.h
$(CC) $(CFLAGS) $(GLIB2CFLAGS) -c $(XML2CFLAGS) parse-xml.c $(CC) $(CFLAGS) $(GLIB2CFLAGS) -c $(XML2CFLAGS) parse-xml.c

6
main.c
View file

@ -167,6 +167,12 @@ static void parse_argument(const char *arg)
return; return;
} }
/* fallthrough */ /* fallthrough */
case 'p':
/* ignore process serial number argument when run as native macosx app */
if (strncmp(arg, "-psn_", 5) == 0) {
return;
}
/* fallthrough */
default: default:
fprintf(stderr, "Bad argument '%s'\n", arg); fprintf(stderr, "Bad argument '%s'\n", arg);
exit(1); exit(1);

View file

@ -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>

1
packaging/macosx/PkgInfo Normal file
View file

@ -0,0 +1 @@
APPL????

Binary file not shown.

5
packaging/macosx/subsurface.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
cd `dirname $0`/../Resources
../MacOS/subsurface &
exit 0