Mac: Script for creating DMG package (adapted from fancy-dmg)

Peter Wortmann 2011-10-09 18:27:00 +01:00
parent 38dd699493
commit d3fb7c5d8f
4 changed files with 115 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# Project data
NAME = OpenClonk
VERSION = 2.0
# Assume default XCode output directory
SOURCE_DIR = ../../Release
SOURCE_FILES = clonk.app
TEMPLATE_DMG = template.dmg
include fancy-dmg/Makefile

View File

@ -0,0 +1,22 @@
Copyright (c) 2006-2009 Remko Tronçon
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,81 @@
#
# Build file for creating DMG files.
#
# The DMG packager looks for a template.dmg.bz2 for using as its
# DMG template. If it doesn't find one, it generates a clean one.
#
# If you create a DMG template, you should make one containing all
# the files listed in $(SOURCE_FILES) below, and arrange everything to suit
# your style. The contents of the files themselves does not matter, so
# they can be empty (they will be overwritten later).
#
# Remko Tronçon
# http://el-tramo.be/about
# Licensed under the MIT License. See COPYING for details.
################################################################################
# Customizable variables
################################################################################
NAME ?= MyApp
VERSION ?= 0.1
SOURCE_DIR ?= src
SOURCE_FILES ?= MyApp.app README COPYING
TEMPLATE_DMG ?= template.dmg
################################################################################
# DMG building. No editing should be needed beyond this point.
################################################################################
MASTER_DMG=$(NAME)-$(VERSION).dmg
WC_DMG=wc.dmg
WC_DIR=wc
.PHONY: all
all: $(MASTER_DMG)
$(TEMPLATE_DMG): $(TEMPLATE_DMG).bz2
bunzip2 -k $<
$(TEMPLATE_DMG).bz2:
@echo
@echo --------------------- Generating empty template --------------------
mkdir template
hdiutil create -fs HFSX -layout SPUD -size 40m "$(TEMPLATE_DMG)" -srcfolder template -format UDRW -volname "$(NAME)" -quiet
rmdir template
bzip2 "$(TEMPLATE_DMG)"
@echo
$(WC_DMG): $(TEMPLATE_DMG)
cp $< $@
$(MASTER_DMG): $(WC_DMG) $(addprefix $(SOURCE_DIR)/,$(SOURCE_FILES))
@echo
@echo --------------------- Creating Disk Image --------------------
mkdir -p $(WC_DIR)
hdiutil attach "$(WC_DMG)" -noautoopen -quiet -mountpoint "$(WC_DIR)"
for i in $(SOURCE_FILES); do \
rm -rf "$(WC_DIR)/$$i"; \
ditto -rsrc "$(SOURCE_DIR)/$$i" "$(WC_DIR)/$$i"; \
done
#rm -f "$@"
#hdiutil create -srcfolder "$(WC_DIR)" -format UDZO -imagekey zlib-level=9 "$@" -volname "$(NAME) $(VERSION)" -scrub -quiet
# Why so complicated? Am I missing something? This doesn't even work... --PMW
#WC_DEV=`hdiutil info | grep "$(WC_DIR)" | grep "Apple_HFS" | awk '{print $$1}'` && \
hdiutil detach $$WC_DEV -quiet -force
hdiutil detach wc -quiet -force
rm -f "$(MASTER_DMG)"
hdiutil convert "$(WC_DMG)" -quiet -format UDZO -imagekey zlib-level=9 -o "$@"
rm -rf $(WC_DIR) $(WC_DMG)
@echo
.PHONY: clean
clean:
-rm -rf $(TEMPLATE_DMG) $(MASTER_DMG) $(WC_DMG)

Binary file not shown.