-
Notifications
You must be signed in to change notification settings - Fork 383
/
Makefile.am
191 lines (176 loc) · 10.4 KB
/
Makefile.am
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Main Makefile for DOSBox-X
EXTRA_DIST = autogen.sh
SUBDIRS = src include
if MACOSX
if MACOS_UNIVERSAL
MACOS_BINARIES=src/dosbox-x-arm64 src/dosbox-x-x86_64
else
MACOS_BINARIES=src/dosbox-x-$(shell uname -m)
endif
endif
.PHONY: dosbox-x.app
dosbox-x.app: $(MACOS_BINARIES) contrib/macos/dosbox.icns src/tool/mach-o-matic
rm -Rfv dosbox-x.app
mkdir dosbox-x.app
mkdir dosbox-x.app/Contents
mkdir dosbox-x.app/Contents/MacOS
mkdir dosbox-x.app/Contents/MacOS/arm64
mkdir dosbox-x.app/Contents/MacOS/x86_64
mkdir dosbox-x.app/Contents/Resources
mkdir dosbox-x.app/Contents/Resources/drivez
mkdir dosbox-x.app/Contents/Resources/glshaders
mkdir dosbox-x.app/Contents/Resources/languages
cp -v contrib/macos/dosbox-x.plist dosbox-x.app/Contents/Info.plist
cp -v contrib/macos/dosbox-x.pkginfo dosbox-x.app/Contents/PkgInfo
cp -v contrib/macos/dosbox.icns dosbox-x.app/Contents/Resources/dosbox-x.icns
cp -v contrib/fonts/FREECG98.BMP dosbox-x.app/Contents/Resources/freecg98.bmp
cp -v contrib/fonts/wqy_1?pt.bdf dosbox-x.app/Contents/Resources/
cp -v contrib/fonts/Nouveau_IBM.ttf dosbox-x.app/Contents/Resources/Nouveau_IBM.ttf
cp -v contrib/fonts/SarasaGothicFixed.ttf dosbox-x.app/Contents/Resources/SarasaGothicFixed.ttf
cp -v contrib/windows/installer/drivez_readme.txt dosbox-x.app/Contents/Resources/drivez/readme.txt
cp -v contrib/glshaders/* dosbox-x.app/Contents/Resources/glshaders/
cp -v contrib/translations/*/*.lng dosbox-x.app/Contents/Resources/languages/
cp -v dosbox-x.reference.conf dosbox-x.app/Contents/Resources/
cp -v dosbox-x.reference.full.conf dosbox-x.app/Contents/Resources/
if [ -f src/dosbox-x-arm64 ]; then cp -v src/dosbox-x-arm64 dosbox-x.app/Contents/MacOS/arm64/dosbox-x; fi
if [ -f src/dosbox-x-x86_64 ]; then cp -v src/dosbox-x-x86_64 dosbox-x.app/Contents/MacOS/x86_64/dosbox-x; fi
# Find all dependencies of the binary. This time we have a Python script to find them all, so it is not as ugly.
# Find dependent libraries and copy them into the app bundle separated by architecture
@for exe in dosbox-x.app/Contents/MacOS/arm64/dosbox-x dosbox-x.app/Contents/MacOS/x86_64/dosbox-x; do \
if [ -f "$$exe" ]; then \
./appbundledeps.py --exe "$$exe" | while read R; do \
Y=`echo "$$R" | cut -d $$'\t' -f 1`; \
dylib=`echo "$$R" | cut -d $$'\t' -f 2`; \
echo "Copying $$dylib"; \
if echo $$Y | grep -Eq '/opt/homebrew'; then \
cp -v $$Y dosbox-x.app/Contents/MacOS/arm64/$$dylib; \
codesign --remove-signature "dosbox-x.app/Contents/MacOS/arm64/$$dylib" || exit 1; \
chmod 0755 "dosbox-x.app/Contents/MacOS/arm64/$$dylib" || exit 1; \
else \
cp -v $$Y dosbox-x.app/Contents/MacOS/x86_64/$$dylib; \
codesign --remove-signature "dosbox-x.app/Contents/MacOS/x86_64/$$dylib" || exit 1; \
chmod 0755 "dosbox-x.app/Contents/MacOS/x86_64/$$dylib" || exit 1; \
fi; \
done; \
fi; \
done
# Fix the linker search paths of the libraries we copied
@for dir in dosbox-x.app/Contents/MacOS/arm64 dosbox-x.app/Contents/MacOS/x86_64; do \
if [ `ls $$dir/*.dylib 2>/dev/null | wc -l` -gt 0 ]; then \
arpf=`basename $$dir`; \
for dylib in $$dir/*.dylib; do \
[ -f "$$dylib" ] && (ARCHPREF=$$arpf src/tool/mach-o-matic "$$dylib") || exit 1; \
done; \
fi; \
done
# Remove the signatures from the architecture-dependant executables, and fix their linker search paths.
@if [ -f dosbox-x.app/Contents/MacOS/arm64/dosbox-x ]; then \
export ARCHPREF=arm64; \
codesign --remove-signature dosbox-x.app/Contents/MacOS/arm64/dosbox-x || exit 1; \
src/tool/mach-o-matic dosbox-x.app/Contents/MacOS/arm64/dosbox-x || exit 1; \
fi
@if [ -f dosbox-x.app/Contents/MacOS/x86_64/dosbox-x ]; then \
export ARCHPREF=x86_64; \
codesign --remove-signature dosbox-x.app/Contents/MacOS/x86_64/dosbox-x || exit 1; \
src/tool/mach-o-matic dosbox-x.app/Contents/MacOS/x86_64/dosbox-x || exit 1; \
fi
# Create universal binary executable if both architectures are present or just move the one we have
@if [ -f dosbox-x.app/Contents/MacOS/arm64/dosbox-x ] && [ -f dosbox-x.app/Contents/MacOS/x86_64/dosbox-x ]; then \
lipo -create dosbox-x.app/Contents/MacOS/arm64/dosbox-x dosbox-x.app/Contents/MacOS/x86_64/dosbox-x -output dosbox-x.app/Contents/MacOS/dosbox-x; \
rm -f dosbox-x.app/Contents/MacOS/arm64/dosbox-x dosbox-x.app/Contents/MacOS/x86_64/dosbox-x; \
elif [ -f dosbox-x.app/Contents/MacOS/arm64/dosbox-x ]; then \
mv -f dosbox-x.app/Contents/MacOS/arm64/dosbox-x dosbox-x.app/Contents/MacOS/dosbox-x; \
elif [ -f dosbox-x.app/Contents/MacOS/x86_64/dosbox-x ]; then \
mv -f dosbox-x.app/Contents/MacOS/x86_64/dosbox-x dosbox-x.app/Contents/MacOS/dosbox-x; \
fi
# Re-sign the universal binary executable and all the libraries
codesign --deep -s - dosbox-x.app/Contents/MacOS/dosbox-x || exit 1
debug-dosbox-x-app:
(cd dosbox-x.app/Contents/MacOS && (DYLD_PRINT_LIBRARIES=1 ./dosbox-x -defaultconf -defaultdir . -silent -c 'echo hello' -c 'exit')) 2>mac-os-x-dylib-report.txt
@echo 'Please review mac-os-x-dylib-report.txt to make sure the .app bundle loaded only from the executable path and not any external Brew libraries.'
@echo 'This is crucial to maintain the ability to distribute this application in the Mac OS X world.'
src/tool/mach-o-matic: src/tool/mach-o-matic.cpp
g++ -o $@ $<
clean-local:
rm -f src/tool/mach-o-matic
contrib/macos/dosbox.icns: contrib/macos/dosbox-x.png
rm -Rfv src/dosbox.iconset
mkdir src/dosbox.iconset
sips -z 16 16 contrib/macos/dosbox-x.png --out src/dosbox.iconset/icon_16x16.png
sips -z 32 32 contrib/macos/dosbox-x.png --out src/dosbox.iconset/icon_16x16@2.png
sips -z 32 32 contrib/macos/dosbox-x.png --out src/dosbox.iconset/icon_32x32.png
sips -z 128 128 contrib/macos/dosbox-x.png --out src/dosbox.iconset/icon_128x128.png
sips -z 256 256 contrib/macos/dosbox-x.png --out src/dosbox.iconset/icon_256x256.png
sips -z 512 512 contrib/macos/dosbox-x.png --out src/dosbox.iconset/icon_512x512.png
sips -z 1024 1024 contrib/macos/dosbox-x.png --out src/dosbox.iconset/icon_1024x1024.png
iconutil -c icns -o contrib/macos/dosbox.icns src/dosbox.iconset
rm -Rfv src/dosbox.iconset
dox:
rm -Rfv doxygen
doxygen
dox-site-update:
if [[ !( -d ../dosbox-x-gh-pages ) ]]; then git clone -b gh-pages https://github.com/joncampbell123/dosbox-x.git ../dosbox-x-gh-pages; fi
(cd ../dosbox-x-gh-pages && rm -Rfv doxygen)
cp -Rf doxygen ../dosbox-x-gh-pages/
(cd ../dosbox-x-gh-pages && git add doxygen/)
(cd ../dosbox-x-gh-pages && git commit doxygen/)
compat-site-update:
if [[ !( -d ../dosbox-x-gh-pages ) ]]; then git clone -b gh-pages https://github.com/joncampbell123/dosbox-x.git ../dosbox-x-gh-pages; fi
true # ----------
(cd /mnt/main/emu/demotest && ./make-compat-chart.pl)
cp /mnt/main/emu/demotest/compat-chart.html ../dosbox-x-gh-pages/demoscene-compat.html
true # ----------
(cd /mnt/main/emu/msdostest && ./make-compat-chart.pl)
cp /mnt/main/emu/msdostest/compat-chart.html ../dosbox-x-gh-pages/msdos-compat.html
true # ----------
(cd ../dosbox-x-gh-pages && git add demoscene-compat.html)
(cd ../dosbox-x-gh-pages && git add msdos-compat.html)
(cd ../dosbox-x-gh-pages && git commit -m 'more' {msdos,demoscene}-compat.html)
install: src/dosbox-x
mkdir -p $(DESTDIR)$(bindir)
install -m 755 src/dosbox-x $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(prefix)/share/dosbox-x/drivez
mkdir -p $(DESTDIR)$(prefix)/share/dosbox-x/glshaders
mkdir -p $(DESTDIR)$(prefix)/share/dosbox-x/languages
install -m 644 $(srcdir)/CHANGELOG $(DESTDIR)$(prefix)/share/dosbox-x
install -m 644 $(srcdir)/contrib/fonts/FREECG98.BMP $(DESTDIR)$(prefix)/share/dosbox-x
install -m 644 $(srcdir)/dosbox-x.reference.conf $(DESTDIR)$(prefix)/share/dosbox-x
install -m 644 $(srcdir)/dosbox-x.reference.full.conf $(DESTDIR)$(prefix)/share/dosbox-x
install -m 644 $(srcdir)/contrib/fonts/wqy_1?pt.bdf $(DESTDIR)$(prefix)/share/dosbox-x
install -m 644 $(srcdir)/contrib/fonts/Nouveau_IBM.ttf $(DESTDIR)$(prefix)/share/dosbox-x
install -m 644 $(srcdir)/contrib/fonts/SarasaGothicFixed.ttf $(DESTDIR)$(prefix)/share/dosbox-x
install -m 644 $(srcdir)/contrib/windows/installer/drivez_readme.txt $(DESTDIR)$(prefix)/share/dosbox-x/drivez/readme.txt
install -m 644 $(srcdir)/contrib/glshaders/*.glsl $(DESTDIR)$(prefix)/share/dosbox-x/glshaders
install -m 644 $(srcdir)/contrib/translations/*/*.lng $(DESTDIR)$(prefix)/share/dosbox-x/languages
mkdir -p $(DESTDIR)$(prefix)/share/icons/hicolor/scalable/apps
install -m 644 $(srcdir)/contrib/icons/dosbox-x.svg $(DESTDIR)$(prefix)/share/icons/hicolor/scalable/apps/dosbox-x.svg
mkdir -p $(DESTDIR)$(prefix)/share/applications
install -m 644 $(srcdir)/contrib/linux/com.dosbox_x.DOSBox-X.desktop $(DESTDIR)$(prefix)/share/applications
mkdir -p $(DESTDIR)$(prefix)/share/metainfo
install -m 644 $(srcdir)/contrib/linux/com.dosbox_x.DOSBox-X.metainfo.xml $(DESTDIR)$(prefix)/share/metainfo
mkdir -p $(DESTDIR)$(mandir)/man1
install -m 644 $(srcdir)/contrib/linux/dosbox-x.1 $(DESTDIR)$(mandir)/man1
mkdir -p $(DESTDIR)$(prefix)/share/bash-completion/completions
install -m 644 $(srcdir)/contrib/linux/dosbox-x $(DESTDIR)$(prefix)/share/bash-completion/completions
-command -v setcap >/dev/null && setcap cap_net_raw=ep $(DESTDIR)$(bindir)/dosbox-x
install_strip: src/dosbox-x install
install -m 755 -s src/dosbox-x $(DESTDIR)$(bindir)
-command -v setcap >/dev/null && setcap cap_net_raw=ep $(DESTDIR)$(bindir)/dosbox-x
uninstall:
rm -f $(DESTDIR)$(bindir)/dosbox-x
rm -f $(DESTDIR)$(prefix)/share/dosbox-x/drivez/*
rmdir $(DESTDIR)$(prefix)/share/dosbox-x/drivez
rm -f $(DESTDIR)$(prefix)/share/dosbox-x/glshaders/*
rmdir $(DESTDIR)$(prefix)/share/dosbox-x/glshaders
rm -f $(DESTDIR)$(prefix)/share/dosbox-x/languages/*
rmdir $(DESTDIR)$(prefix)/share/dosbox-x/languages
rm -f $(DESTDIR)$(prefix)/share/dosbox-x/*
rmdir $(DESTDIR)$(prefix)/share/dosbox-x
rm -f $(DESTDIR)$(prefix)/share/icons/hicolor/48x48/apps/dosbox-x.png
rm -f $(DESTDIR)$(prefix)/share/icons/hicolor/scalable/apps/dosbox-x.svg
rm -f $(DESTDIR)$(prefix)/share/applications/dosbox-x.desktop
rm -f $(DESTDIR)$(prefix)/share/applications/com.dosbox_x.DOSBox-X.desktop
rm -f $(DESTDIR)$(prefix)/share/metainfo/dosbox-x.metainfo.xml
rm -f $(DESTDIR)$(prefix)/share/metainfo/com.dosbox_x.DOSBox-X.metainfo.xml
rm -f $(DESTDIR)$(mandir)/man1/dosbox-x.1
rm -f $(DESTDIR)$(prefix)/share/bash-completion/completions/dosbox-x