From 41256531b813c811fa416f204cfb3b6eab924450 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 15 Feb 2013 22:28:31 -0800 Subject: Further automization of the Mac build process This improves the Plist.info and automates the version data that it uses utilizing the same git magic that the Makefile uses. It also makes the complete DMG creation a matter of simply running packaging/macosx/make-package.sh Signed-off-by: Dirk Hohndel --- Makefile | 13 ++++++++++--- packaging/macosx/Info.plist | 26 -------------------------- packaging/macosx/Info.plist.in | 22 ++++++++++++++++++++++ packaging/macosx/make-package.sh | 14 ++++++++++---- 4 files changed, 42 insertions(+), 33 deletions(-) delete mode 100644 packaging/macosx/Info.plist create mode 100644 packaging/macosx/Info.plist.in diff --git a/Makefile b/Makefile index 17b69e0aa..43ab19a29 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,10 @@ XSLTFILES = xslt/*.xslt UNAME := $(shell $(CC) -dumpmachine 2>&1 | grep -E -o "linux|darwin|win") VERSION_STRING := $(shell git describe --tags --abbrev=12 || echo "v$(VERSION)") +# Windows .nsi style with four numbers 1.2.3.4 PRODVERSION_STRING := $(shell git describe --tags --abbrev=12 | sed 's/v\([0-9]*\)\.\([0-9]*\)-\([0-9]*\)-.*/\1.\2.\3.0/ ; s/v\([0-9]\)\.\([0-9]*\)/\1.\2.0.0/' || echo "$(VERSION).0.0") +# Mac Info.plist style with three numbers 1.2.3 +CFBUNDLEVERSION_STRING := $(shell git describe --tags --abbrev=12 | sed 's/v\([0-9]*\)\.\([0-9]*\)-\([0-9]*\)-.*/\1.\2.\3/ ; s/v\([0-9]\)\.\([0-9]*\)/\1.\2.0/' || echo "$(VERSION).0") # find libdivecomputer # First deal with the cross compile environment and with Mac. @@ -119,9 +122,11 @@ else ifeq ($(UNAME), darwin) MACOSXINSTALL = /Applications/Subsurface.app MACOSXFILES = packaging/macosx MACOSXSTAGING = $(MACOSXFILES)/Subsurface.app + INFOPLIST = $(MACOSXFILES)/Info.plist + INFOPLISTINPUT = $(INFOPLIST).in EXTRALIBS = $(shell $(PKGCONFIG) --libs gtk-mac-integration) -framework CoreFoundation CFLAGS += $(shell $(PKGCONFIG) --cflags gtk-mac-integration) - LDFLAGS += -headerpad_max_install_names -sectcreate __TEXT __info_plist ./packaging/macosx/Info.plist + LDFLAGS += -headerpad_max_install_names -sectcreate __TEXT __info_plist $(INFOPLIST) GTK_MAC_BUNDLER = ~/.local/bin/gtk-mac-bundler XSLT_CAPABLE = 1 else @@ -154,7 +159,7 @@ OBJS = main.o dive.o time.o profile.o info.o equipment.o divelist.o deco.o plann DEPS = $(wildcard .dep/*.dep) -$(NAME): $(OBJS) $(MSGOBJS) +$(NAME): $(OBJS) $(MSGOBJS) $(INFOPLIST) $(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS) install: $(NAME) @@ -234,9 +239,11 @@ install-cross-windows: $(NAME) create-windows-installer: $(NAME) $(NSIFILE) install-cross-windows $(MAKENSIS) $(NSIFILE) -$(NSIFILE): $(NSIINPUTFILE) Makefile +$(NSIFILE): $(NSIINPUTFILE) $(shell cat $(NSIINPUTFILE) | sed -e 's/VERSIONTOKEN/$(VERSION_STRING)/;s/PRODVTOKEN/$(PRODVERSION_STRING)/' > $(NSIFILE)) +$(INFOPLIST): $(INFOPLISTINPUT) + $(shell cat $(INFOPLISTINPUT) | sed -e 's/CFBUNDLEVERSION_TOKEN/$(CFBUNDLEVERSION_STRING)/' > $(INFOPLIST)) update-po-files: xgettext -o po/subsurface-new.pot -s -k_ -kN_ --keyword=C_:1c,2 --add-comments="++GETTEXT" *.c diff --git a/packaging/macosx/Info.plist b/packaging/macosx/Info.plist deleted file mode 100644 index aecd9ab76..000000000 --- a/packaging/macosx/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleIconFile - Subsurface.icns - CFBundleName - Subsurface - CFBundlePackageType - APPL - CFBundleGetInfoString - Multi Platform Divelog in C and Gtk - CFBundleSignature - ???? - CFBundleExecutable - subsurface - CFBundleIdentifier - org.hohndel.subsurface - CFBundleInfoDictionaryVersion - 1.0 - CFBundleVersionString - 2.9 - CFBundleVersion - 2.9 - - diff --git a/packaging/macosx/Info.plist.in b/packaging/macosx/Info.plist.in new file mode 100644 index 000000000..a623303a1 --- /dev/null +++ b/packaging/macosx/Info.plist.in @@ -0,0 +1,22 @@ + + + + + CFBundleIconFile + Subsurface.icns + CFBundleName + Subsurface + CFBundlePackageType + APPL + CFBundleSignature + SBSF + CFBundleExecutable + subsurface + CFBundleIdentifier + org.hohndel.subsurface + CFBundleInfoDictionaryVersion + 1.0 + CFBundleVersion + CFBUNDLEVERSION_TOKEN + + diff --git a/packaging/macosx/make-package.sh b/packaging/macosx/make-package.sh index 81e0f80f8..c8d21b283 100755 --- a/packaging/macosx/make-package.sh +++ b/packaging/macosx/make-package.sh @@ -21,16 +21,22 @@ DMGCREATE="../yoursway-create-dmg/create-dmg" # other components have been installed PREFIX="/Applications/Subsurface.app/Contents/Resources" -# maybe we want to update this to use the git tag magic instead. That -# would be more consistent -VERSION=`grep -1 CFBundleVersionString packaging/macosx/Info.plist | tail -1 | cut -d\> -f 2 | cut -d\< -f 1` +INFOPLIST=./packaging/macosx/Info.plist + +# same git version magic as in the Makefile +VERSION=`git describe --tags --abbrev=12 | sed 's/v\([0-9]*\)\.\([0-9]*\)-\([0-9]*\)-.*/\1.\2.\3/ ; s/v\([0-9]\)\.\([0-9]*\)/\1.\2.0/' || echo "git.missing.please.hardcode.version"` # gtk-mac-bundler allegedly supports signing by setting this environment # variable, but this fails as we change the shared objects below and all # the signatures become invalid. # export APPLICATION_CERT="Dirk" -# first clean up the staging area +# force rebuilding of Info.plist +rm ${INFOPLIST} + +# first build and install Subsurface and then clean up the staging area +make +make install-macosx rm -rf ./staging # now populate it with the bundle -- cgit v1.2.3-70-g09d2