-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.macosx
103 lines (88 loc) · 3.96 KB
/
Makefile.macosx
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
ROOT_DIRECTORY=${realpath ./}
BUNDLE_NAME=Pentagram.app
include ${ROOT_DIRECTORY}/system/macosx/archs.mk
INSTALL := /usr/bin/install -c
INSTALL_DATA := ${INSTALL} -m 644 -g admin
INSTALL_PROGRAM := ${INSTALL} -m 755 -g admin
define BUNDLE_LIBRARY
${INSTALL_PROGRAM} ${PREFIX_DIR}/lib/lib${1}.dylib ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/Libraries/
otool -L ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/Libraries/lib${1}.dylib | \
awk '/${subst /,\/,${PREFIX_DIR}}\/lib\/lib${1}.*dylib/ \
{ lib = $$1; \
sub(/.*\/lib\//, "@executable_path/../Libraries/", lib); \
sub(/[^a-zA-Z]*.dylib/, ".dylib", lib); \
print lib, "${PREFIX_DIR}/${BUNDLE_NAME}/Contents/Libraries/lib${1}.dylib"; \
}' | \
xargs -n 3 install_name_tool -id
otool -L ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/Libraries/lib${1}.dylib | \
awk '/${subst /,\/,${PREFIX_DIR}}\/lib\/lib.*dylib/ \
{ lib = $$1; \
sub(/.*\/lib\//, "@executable_path/../Libraries/", lib); \
sub(/[^a-zA-Z]*.dylib/, ".dylib", lib); \
print $$1, lib, "${PREFIX_DIR}/${BUNDLE_NAME}/Contents/Libraries/lib${1}.dylib"; \
}' | \
xargs -n 3 install_name_tool -change
endef
define BUNDLE_PROGRAM
${INSTALL_PROGRAM} ${PREFIX_DIR}/bin/${1} ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/MacOS/
otool -L ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/MacOS/${1} | \
awk '/${subst /,\/,${PREFIX_DIR}}\/lib\/lib.*dylib/ \
{ lib = $$1; \
sub(/.*\/lib\//, "@executable_path/../Libraries/", lib); \
sub(/[^a-zA-Z]*.dylib/, ".dylib", lib); \
print $$1, lib, "${PREFIX_DIR}/${BUNDLE_NAME}/Contents/MacOS/${1}"; \
}' | \
xargs -n 3 install_name_tool -change
endef
all: configure build install
deps:
${MAKE} -f system/macosx/deps.mk ROOT_DIRECTORY=${ROOT_DIRECTORY} all
${eval ${call create_arch_targets,pentagram}}
configure: ${call arch_targets,pentagram,configure};
build: configure ${call arch_targets,pentagram,build};
install: build ${call arch_targets,pentagram,install};
bundle: install ${call arch_targets,pentagram,bundle}
clean: ${call arch_targets,pentagram,clean}
rm -f ${ROOT_DIRECTORY}/build/Pentagram.dmg
configure_%:
cd ${BUILD_DIR} && ${ROOT_DIRECTORY}/configure \
--prefix=${PREFIX_DIR} ${ARCH_CONFIG} \
--with-sdl-prefix=${PREFIX_DIR} \
--enable-hq2x=yes --enable-hq3x=yes --enable-gc-scalers=yes --enable-all-bilinear=yes \
--enable-timidity-midi=no --enable-fmopl-midi=no \
--enable-builtin-data=no
build_%:
cd ${BUILD_DIR} && make
install_%:
cd ${BUILD_DIR} && make install
bundle_%:
rm -fr ${PREFIX_DIR}/${BUNDLE_NAME}
mkdir -p ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/MacOS
mkdir -p ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/Resources
mkdir -p ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/Libraries
echo "APPL????" > ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/PkgInfo
${INSTALL_DATA} ${BUILD_DIR}/system/macosx/Info.plist ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/
${INSTALL_DATA} ${ROOT_DIRECTORY}/system/desktop/pentagram.* ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/Resources/
${INSTALL_DATA} ${PREFIX_DIR}/share/pentagram/* ${PREFIX_DIR}/${BUNDLE_NAME}/Contents/Resources/
${call BUNDLE_LIBRARY,z}
${call BUNDLE_LIBRARY,png}
${call BUNDLE_LIBRARY,freetype}
${call BUNDLE_LIBRARY,SDL}
${call BUNDLE_LIBRARY,SDL_ttf}
${call BUNDLE_PROGRAM,pentagram}
clean_%:
rm -fr ${BUILD_DIR}
rm -fr ${ROOT_DIRECTORY}/build/${PROJECT}.build/${ARCH}_*.stamp
rm -fr ${PREFIX_DIR}/${BUNDLE_NAME}
image:
rm -f ${ROOT_DIRECTORY}/build/Pentagram.dmg
rm -fr ${ROOT_DIRECTORY}/build/image
mkdir -p ${ROOT_DIRECTORY}/build/image
${ROOT_DIRECTORY}/system/macosx/uberlipo -create \
-output ${ROOT_DIRECTORY}/build/image/${BUNDLE_NAME} \
${foreach ARCH,${ARCHS},${ROOT_DIRECTORY}/build/${ARCH}/${BUNDLE_NAME}}
${INSTALL_DATA} ${ROOT_DIRECTORY}/system/macosx/pentagram.ini ${ROOT_DIRECTORY}/build/image/
${INSTALL_DATA} ${ROOT_DIRECTORY}/system/macosx/README.rtf ${ROOT_DIRECTORY}/build/image/
hdiutil create -ov -format UDZO -imagekey zlib-level=9 -fs HFS+ \
-srcfolder ${ROOT_DIRECTORY}/build/image \
-volname "Pentagram snapshot" ${ROOT_DIRECTORY}/build/Pentagram.dmg