-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
278 lines (236 loc) · 10.2 KB
/
Makefile
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# 15khz Arcade PKG Makefile
#
# This makefile automates deliverables
# production
SHELL = /bin/sh
DESTDIR = /usr/local
# To see current kernel version go to http://kernel.ubuntu.com/git/
UBUNTU_VERSION = yakkety
KERNEL_BASE_VERSION = 4.8.0
KERNEL_ABI_NUMBER = 51
KERNEL_UPLOAD_NUMBER = 54
KERNEL_GIT_URL = git://kernel.ubuntu.com/ubuntu/ubuntu-$(UBUNTU_VERSION).git
KERNEL_GIT_TAG = Ubuntu-$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER).$(KERNEL_UPLOAD_NUMBER)
KERNEL_SRC_PKG = vendor/ubuntu-$(UBUNTU_VERSION).tar.gz
LINUX_HEADERS_ALL_APT = linux-headers-$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER)
LINUX_HEADERS_ALL_DEB = vendor/$(LINUX_HEADERS_ALL_APT)_$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER).$(KERNEL_UPLOAD_NUMBER)+patched15khz_all.deb
LINUX_HEADERS_GENERIC_APT = linux-headers-$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER)-generic
LINUX_HEADERS_GENERIC_DEB = vendor/$(LINUX_HEADERS_GENERIC_APT)_$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER).$(KERNEL_UPLOAD_NUMBER)+patched15khz_amd64.deb
LINUX_IMAGE_APT = linux-image-$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER)-generic
LINUX_IMAGE_DEB = vendor/$(LINUX_IMAGE_APT)_$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER).$(KERNEL_UPLOAD_NUMBER)+patched15khz_amd64.deb
LINUX_IMAGE_EXTRA_APT = linux-image-extra-$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER)-generic
LINUX_IMAGE_EXTRA_DEB = vendor/$(LINUX_IMAGE_EXTRA_APT)_$(KERNEL_BASE_VERSION)-$(KERNEL_ABI_NUMBER).$(KERNEL_UPLOAD_NUMBER)+patched15khz_amd64.deb
LINUX_15KHZ_PATCH = src/linux-4.7.diff
LINUX_AT9200_PATCH = src/ati9200_pllfix-3.19.diff
LINUX_AVGA3000_PATCH = src/avga3000-4.4.diff
MAME_VERSION = 0183
MAME_SRC_PKG_URL = https://github.com/mamedev/mame/archive/mame$(MAME_VERSION).tar.gz
MAME_SRC_PKG = vendor/mame$(MAME_VERSION).tar.gz
GROOVYMAME_PATCH = src/0183_groovymame_017c.diff
GROOVYMAME_BIN = vendor/mame/mame64
XSERVER_XORG_VIDEO_NOUVEAU_VERSION = 1.0.12
XSERVER_XORG_VIDEO_NOUVEAU_DEB_VERSION = 1.0.12-2
XSERVER_XORG_VIDEO_NOUVEAU_DEB_SRC = vendor/xserver-xorg-video-nouveau-$(XSERVER_XORG_VIDEO_NOUVEAU_VERSION)
XSERVER_XORG_VIDEO_NOUVEAU_PATCH = src/xorg-video-nouveau-$(XSERVER_XORG_VIDEO_NOUVEAU_VERSION)-low-res.diff
XSERVER_XORG_VIDEO_NOUVEAU_DEB_PKG = vendor/xserver-xorg-video-nouveau_$(XSERVER_XORG_VIDEO_NOUVEAU_DEB_VERSION)+patched15khz_amd64.deb
SWITCHRES_SRC_PKG_URL = http://forum.arcadecontrols.com/index.php?action=dlattach;topic=106405.0;attach=308813
SWITCHRES_SRC_PKG = vendor/SwitchResLinux-1.52.rar
SWITCHRES_BIN = vendor/switchres/switchres
VICE_VERSION = 3.0
VICE_SRC_PKG_URL = https://downloads.sourceforge.net/project/vice-emu/releases/vice-3.0.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fvice-emu%2Ffiles%2Freleases%2Fvice-3.0.tar.gz%2Fdownload&ts=1488871485&use_mirror=netcologne
VICE_SRC_PKG = vendor/vice.tar.gz
VICE_BIN = vendor/vice-$(VICE_VERSION)/src/x64
HATARI_VERSION = 2.0.0
HATARI_SRC_PKG_URL = http://download.tuxfamily.org/hatari/$(HATARI_VERSION)/hatari-$(HATARI_VERSION).tar.bz2
HATARI_SRC_PKG = vendor/hatari.tar.bz2
HATARI_BIN = vendor/hatari-$(HATARI_VERSION)/src/hatari
ATTRACT_MODE_VERSION = 2.2.1
#ATTRACT_MODE_SRC_PKG_URL = https://github.com/mickelson/attract/archive/v$(ATTRACT_MODE_VERSION).tar.gz
ATTRACT_MODE_GIT_URL = https://github.com/mickelson/attract.git
ATTRACT_MODE_SRC_PKG = vendor/attract.tar.gz
ATTRACT_MODE_BIN = vendor/attract-$(ATTRACT_MODE_VERSION)/attract
.PHONY: all install clean
.NOTPARALLEL: $(LINUX_IMAGE_DEB)
all: linux-kernel \
xserver-xorg-video-nouveau \
attract \
groovymame \
switchres \
hatari \
vice
clean:
rm -rf vendor
install:
dpkg -i $(LINUX_HEADERS_ALL_DEB) \
$(LINUX_HEADERS_GENERIC_DEB) \
$(LINUX_IMAGE_DEB) \
$(LINUX_IMAGE_EXTRA_DEB) \
$(XSERVER_XORG_VIDEO_NOUVEAU_DEB_PKG)
mkdir -p $(DESTDIR)/lib/15khz-arcade-pkg
cp -r vendor/mame $(DESTDIR)/lib/15khz-arcade-pkg/groovymame
cp -r vendor/vice-$(VICE_VERSION) $(DESTDIR)/lib/15khz-arcade-pkg/vice
cp -r vendor/hatari-$(HATARI_VERSION) $(DESTDIR)/lib/15khz-arcade-pkg/hatari
cd $(DESTDIR)/lib/15khz-arcade-pkg/groovymame && make clean
cp vendor/switchres/switchres $(DESTDIR)/lib/15khz-arcade-pkg
cp -r vendor/attract-$(ATTRACT_MODE_VERSION) \
$(DESTDIR)/lib/15khz-arcade-pkg/attract
mkdir -p $(DESTDIR)/bin
cp bin/15khz-* $(DESTDIR)/bin
# Adjust binaries paths in wrappers
# Mame
sed -i -e "7s=.*=$(DESTDIR)/lib/15khz-arcade-pkg/groovymame/mame64 \"\$$@\"=" \
$(DESTDIR)/bin/15khz-mame
sed -i -re "4,5d" $(DESTDIR)/bin/15khz-mame
sed -i -e "16s=.*=$(DESTDIR)/lib/15khz-arcade-pkg/groovymame/mame64 \"\$$@\"=" \
$(DESTDIR)/bin/15khz-zaphod-mame
sed -i -re "4,5d" $(DESTDIR)/bin/15khz-zaphod-mame
# Change res exec
sed -i -e "11s=.*=switchres\=$(DESTDIR)/lib/15khz-arcade-pkg/switchres=" \
$(DESTDIR)/bin/15khz-change-res-exec
sed -i -re "10d" $(DESTDIR)/bin/15khz-change-res-exec
# FS-UAE
sed -i \
-e "8s=.*=declare changeresbin\=$(DESTDIR)/bin/15khz-change-res-exec=" \
$(DESTDIR)/bin/15khz-fs-uae
sed -i -re "4,5d" $(DESTDIR)/bin/15khz-fs-uae
# Hatari
sed -i -e "7s=.*=$(DESTDIR)/lib/15khz-arcade-pkg/hatari/src/hatari \"\$$@\"=" \
$(DESTDIR)/bin/15khz-hatari
sed -i -re "4,5d" $(DESTDIR)/bin/15khz-hatari
# Vice
sed -i \
-e "7s=.*=declare x64\=$(DESTDIR)/lib/15khz-arcade-pkg/vice/src/x64=" \
$(DESTDIR)/bin/15khz-x64
sed -i \
-e "8s=.*=declare changeresbin\=$(DESTDIR)/bin/15khz-change-res-exec=" \
$(DESTDIR)/bin/15khz-x64
sed -i \
-e "9s=.*=declare rompath\=$(DESTDIR)/lib/15khz-arcade-pkg/vice/data/C64=" \
$(DESTDIR)/bin/15khz-x64
sed -i \
-e "10s=.*=declare romdrivepath\=$(DESTDIR)/lib/15khz-arcade-pkg/vice/data/DRIVES=" \
$(DESTDIR)/bin/15khz-x64
sed -i -re "4,5d" $(DESTDIR)/bin/15khz-x64
# Attract mode
sed -i -e "7s=.*=$(DESTDIR)/lib/15khz-arcade-pkg/attract/attract \"\$$@\"=" \
$(DESTDIR)/bin/15khz-attract
sed -i -re "4,5d" $(DESTDIR)/bin/15khz-attract
@echo "Install finished"
@echo "Please reboot your computer to the new patched kernel"
uninstall:
-rm -r $(DESTDIR)/lib/15khz-arcade-pkg
-rm $(DESTDIR)/bin/15khz-*
-apt-get install --reinstall xserver-xorg-video-nouveau
-sudo apt-get remove $(LINUX_HEADERS_ALL_APT) \
$(LINUX_HEADERS_GENERIC_APT) \
$(LINUX_IMAGE_APT)
# Reinstall latest generic image/headers packages to avoid
# release the system without any kernel (!!). This should
# happen if the patched installed kernel is of the same version
# as the distribution's current one.
-apt-get install linux-image-generic linux-headers-generic
@echo "Uninstall finished. Please reboot your computer now"
dist:
linux-kernel: $(LINUX_IMAGE_DEB)
xserver-xorg-video-nouveau: $(XSERVER_XORG_VIDEO_NOUVEAU_DEB_PKG)
groovymame: $(GROOVYMAME_BIN)
switchres: $(SWITCHRES_BIN)
vice: $(VICE_BIN)
hatari: $(HATARI_BIN)
attract: $(ATTRACT_MODE_BIN)
$(LINUX_IMAGE_DEB): $(KERNEL_SRC_PKG)
mkdir -p vendor
rm -rf vendor/linux-source
mkdir -p vendor/linux-source
cd vendor/linux-source && tar xf $(realpath $(KERNEL_SRC_PKG))
cd vendor/linux-source \
&& patch -p1 < $(realpath $(LINUX_15KHZ_PATCH))
cd vendor/linux-source \
&& patch -p1 < $(realpath $(LINUX_AT9200_PATCH))
cd vendor/linux-source \
&& patch -p1 < $(realpath $(LINUX_AVGA3000_PATCH))
cd vendor/linux-source \
&& sed -i -e "1 s/)/+patched15khz)/" debian.master/changelog
cd vendor/linux-source \
&& env - PATH="$$PATH" fakeroot debian/rules clean
cd vendor/linux-source \
&& env - PATH="$$PATH" skipabi=true fakeroot debian/rules \
binary-headers \
binary-generic
$(KERNEL_SRC_PKG):
mkdir -p vendor
git clone --depth 1 --branch $(KERNEL_GIT_TAG) \
$(KERNEL_GIT_URL) vendor/ubuntu-$(UBUNTU_VERSION)
(cd vendor/ubuntu-$(UBUNTU_VERSION) && git archive $(KERNEL_GIT_TAG)) \
| gzip > $(KERNEL_SRC_PKG)
rm -rf vendor/ubuntu-$(UBUNTU_VERSION)
$(LINUX_KERNEL_PATCH_PKG):
mkdir -p $(dir $(LINUX_KERNEL_PATCH_PKG))
wget -O $(LINUX_KERNEL_PATCH_PKG) "$(LINUX_KERNEL_PATCH_PKG_URL)"
touch $(LINUX_KERNEL_PATCH_PKG)
$(XSERVER_XORG_VIDEO_NOUVEAU_DEB_PKG): $(XSERVER_XORG_VIDEO_NOUVEAU_DEB_SRC)
mkdir -p vendor
cd $(XSERVER_XORG_VIDEO_NOUVEAU_DEB_SRC)/src \
&& patch < $(realpath $(XSERVER_XORG_VIDEO_NOUVEAU_PATCH))
cd $(XSERVER_XORG_VIDEO_NOUVEAU_DEB_SRC)/ \
&& sed -i -e "1 s/)/+patched15khz)/" debian/changelog
mv vendor/xserver-xorg-video-nouveau_$(XSERVER_XORG_VIDEO_NOUVEAU_DEB_VERSION).dsc \
vendor/xserver-xorg-video-nouveau_$(XSERVER_XORG_VIDEO_NOUVEAU_DEB_VERSION)+patched15khz.dsc
cd $(XSERVER_XORG_VIDEO_NOUVEAU_DEB_SRC)/ \
&& dpkg-buildpackage -us -uc -nc
$(XSERVER_XORG_VIDEO_NOUVEAU_DEB_SRC):
mkdir -p vendor
cd vendor && apt-get source xserver-xorg-video-nouveau
$(GROOVYMAME_BIN): $(MAME_SRC_PKG)
rm -rf vendor/mame
cd vendor && tar xvf $(realpath $(MAME_SRC_PKG))
mv vendor/mame-mame$(MAME_VERSION) vendor/mame
cd vendor/mame && patch -p0 -E --binary < $(realpath $(GROOVYMAME_PATCH))
cd vendor/mame && MAKEFLAGS= MFLAGS= make
$(MAME_SRC_PKG):
mkdir -p $(dir $(MAME_SRC_PKG))
wget -O $(MAME_SRC_PKG) $(MAME_SRC_PKG_URL)
touch $(MAME_SRC_PKG)
$(SWITCHRES_BIN): $(SWITCHRES_SRC_PKG)
mkdir -p $(dir $(SWITCHRES_BIN))
cd $(dir $(SWITCHRES_BIN)) \
&& unrar e $(realpath $(SWITCHRES_SRC_PKG))
chmod +x $(dir $(SWITCHRES_BIN))/version.sh
cd $(dir $(SWITCHRES_BIN)) && make
$(SWITCHRES_SRC_PKG):
mkdir -p $(dir $(SWITCHRES_SRC_PKG))
wget -O $(SWITCHRES_SRC_PKG) "$(SWITCHRES_SRC_PKG_URL)"
touch $(SWITCHRES_SRC_PKG)
$(VICE_BIN): $(VICE_SRC_PKG)
mkdir -p vendor
cd vendor \
&& tar xf $(realpath $(VICE_SRC_PKG))
cd vendor/vice-$(VICE_VERSION) \
&& ./configure --enable-sdlui \
&& make
$(VICE_SRC_PKG):
mkdir -p $(dir $(VICE_SRC_PKG))
wget -O $(VICE_SRC_PKG) "$(VICE_SRC_PKG_URL)"
touch $(VICE_SRC_PKG)
$(HATARI_BIN): $(HATARI_SRC_PKG)
mkdir -p vendor
cd vendor \
&& tar xf $(realpath $(HATARI_SRC_PKG))
cd vendor/hatari-$(HATARI_VERSION) \
&& cmake . \
&& make
$(HATARI_SRC_PKG):
mkdir -p $(dir $(HATARI_SRC_PKG))
wget -O $(HATARI_SRC_PKG) "$(HATARI_SRC_PKG_URL)"
touch $(HATARI_SRC_PKG)
$(ATTRACT_MODE_BIN): $(ATTRACT_MODE_SRC_PKG)
mkdir -p vendor
cd vendor && tar xf $(realpath $(ATTRACT_MODE_SRC_PKG))
cd vendor/attract-$(ATTRACT_MODE_VERSION) && make
$(ATTRACT_MODE_SRC_PKG):
mkdir -p vendor
git clone --depth 1 --branch v$(ATTRACT_MODE_VERSION) \
$(ATTRACT_MODE_GIT_URL) vendor/attract-$(ATTRACT_MODE_VERSION)
cd vendor \
&& tar cvf attract.tar.gz attract-$(ATTRACT_MODE_VERSION)
rm -rf vendor/attract-$(ATTRACT_MODE_VERSION)