forked from crawl/crawl
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile.app-bundle
108 lines (88 loc) · 2.81 KB
/
Makefile.app-bundle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# [ds] We all knew make's handling of embedded spaces is demented, but
# I had no idea just how demented it is.
CRAWL_BASE=$(CURDIR)/../..
CRAWL_SRC=$(CRAWL_BASE)/source
ZIP_QUALIFIER :=
ZIP_ARCH :=
ifdef BUILD_UNIVERSAL
ZIP_ARCH := -universal
endif
APP_NAME := Dungeon Crawl Stone Soup
ifneq (,$(findstring tiles,$(MAKECMDGOALS)))
BUNDLE_NAME := Dungeon\ Crawl\ Stone\ Soup\ -\ Tiles
TILE_APP := y
ifdef RELEASE
ZIP_QUALIFIER := -tiles
else
ZIP_QUALIFIER := _tiles
endif
EXECUTABLE_PATH := $(CRAWL_SRC)/crawl
else
BUNDLE_NAME := Dungeon\ Crawl\ Stone\ Soup\ -\ Console
EXECUTABLE_PATH := crawl
ifdef RELEASE
ZIP_QUALIFIER := -console
endif
endif
ifdef RELEASE
ZIP_NAME = stone_soup-$(SRC_VERSION)$(ZIP_QUALIFIER)-macosx.zip
else
ZIP_NAME = crawl$(ZIP_QUALIFIER)_osx-$(SRC_VERSION).zip
endif
STAGING_DIR := $(CRAWL_SRC)/build/app-bundle-stage
ZIPPED_APP_DIR := $(CRAWL_SRC)/mac-app-zips
BUNDLE_DIRNAME := $(STAGING_DIR)/$(BUNDLE_NAME).app
RESOURCES := $(BUNDLE_DIRNAME)/Contents/Resources
.PHONY: all clean clean-stage stage-dir copy-executable copy-resources \
copy-tiledata assemble-app-bundle create-bundle-directory
all: $(STAGING_DIR) $(ZIPPED_APP_DIR) \
clean-stage assemble-app-bundle zip-app-bundle
clean:
rm -rf $(CRAWL_SRC)/build
tiles: all
$(STAGING_DIR):
mkdir -p $@
$(ZIPPED_APP_DIR):
mkdir -p $@
clean-stage:
rm -rf $(STAGING_DIR)/*
assemble-app-bundle: create-bundle-directory copy-executable copy-resources \
copy-info-plist
zip-app-bundle:
rm -f $(ZIPPED_APP_DIR)/$(ZIP_NAME)
cd $(STAGING_DIR) && \
zip -r $(ZIPPED_APP_DIR)/$(ZIP_NAME) $(BUNDLE_NAME).app
create-bundle-directory: $(BUNDLE_DIRNAME)
$(BUNDLE_DIRNAME):
mkdir -p "$@"/Contents/{MacOS/contrib,Resources}
# The console Crawl bundle has a shell script launcher that uses the
# real executable from Contents/Resources, so an extra copy for the wrapper+
# real thing.
copy-executable:
cp $(EXECUTABLE_PATH) $(BUNDLE_DIRNAME)/Contents/MacOS/$(BUNDLE_NAME)
ifndef TILE_APP
cp $(CRAWL_SRC)/crawl $(RESOURCES)
endif
copy-resources:
ifdef TILE_APP
cp -r $(CRAWL_SRC)/contrib/fonts $(BUNDLE_DIRNAME)/Contents/MacOS/contrib
endif
cp $(CRAWL_SRC)/mac/Crawl.icns $(RESOURCES)
cp -r $(CRAWL_BASE)/settings $(RESOURCES)
cp -r $(CRAWL_SRC)/dat $(RESOURCES)
cp -r $(CRAWL_BASE)/docs $(RESOURCES)
cp $(CRAWL_BASE)/licence.txt $(RESOURCES)/LICENCE.txt
cp $(CRAWL_BASE)/CREDITS.txt $(RESOURCES)
rm -rf $(RESOURCES)/docs/obsolete
rm -rf $(RESOURCES)/docs/template
rm -f $(RESOURCES)/docs/*.html
rm -f $(RESOURCES)/docs/*.pdf
rm -f $(RESOURCES)/docs/*.reST
rm -f $(RESOURCES)/docs/crawl.6
rm -f $(RESOURCES)/*.png
copy-info-plist:
perl -lpe "s/%VERSION%/$(SRC_VERSION)/g;" \
-e "s/%NAME%/$(APP_NAME)/g;" \
-e "s/%YEAR%/(localtime)[5] + 1900/ge;" \
-e "s/%EXECUTABLE%/$(BUNDLE_NAME)/g;" \
Crawl-Info.plist >$(BUNDLE_DIRNAME)/Contents/Info.plist