File: rules

package info (click to toggle)
mame 0.182-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 756,928 kB
  • ctags: 549,135
  • sloc: cpp: 3,539,924; xml: 1,248,595; ansic: 756,885; sh: 59,571; lisp: 15,826; python: 10,330; makefile: 8,759; java: 7,019; yacc: 6,710; objc: 5,866; cs: 4,725; asm: 4,584; perl: 2,906; ada: 1,681; lex: 1,174; pascal: 1,139; ruby: 323; sql: 160; awk: 35; php: 1
file content (281 lines) | stat: -rwxr-xr-x 8,513 bytes parent folder | download
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
278
279
280
281
#!/usr/bin/make -f
# -*- makefile -*-
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Default/i386/amd64 options from sdlmame rules file by Cesare Falco.

#export DH_VERBOSE = 1

DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_HOST_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS)

# Define DEB_HOST_MULTIARCH for QT prefix handling
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# add c++ hardening options (upstream makefile doesn't use CPPFLAGS)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = $(shell dpkg-buildflags --get CPPFLAGS)

# Sacrifice linking speed to avoid using so much memory
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--no-keep-memory

# taken verbatim from debian policy
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
MAKEFLAGS += -j$(NUMJOBS)
endif

# Override relevant make variables in original makefile
DEB_OPTS = \
    NOWERROR=1 \
    OSD=sdl \
    DEBUG= \
    TARGETOS=linux \
    DISTRO=debian-stable \
    FORCE_DRC_C_BACKEND=1 \
    PTR64= \
    BIGENDIAN= \
    NOASM=1 \
    NO_USE_LINENOISE=1 \
    QT_HOME=/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/ \
    USE_SYSTEM_LIB_EXPAT=1 \
    USE_SYSTEM_LIB_ZLIB=1 \
    USE_SYSTEM_LIB_JPEG=1 \
    USE_SYSTEM_LIB_FLAC=1 \
    USE_SYSTEM_LIB_LUA=lua5.3:/usr/include/lua5.3 \
    USE_SYSTEM_LIB_SQLITE3=1 \
    USE_SYSTEM_LIB_PORTMIDI=1 \
    USE_SYSTEM_LIB_PORTAUDIO=1 \
    USE_SYSTEM_LIB_UV=1 \
    VERBOSE=1

# Override make variables for specific archs
# Linux architectures
ifeq ($(DEB_HOST_ARCH),amd64)
DEB_OPTS += \
    FORCE_DRC_C_BACKEND= \
    PTR64=1 \
    NOASM=
endif

ifeq ($(DEB_HOST_ARCH),arm64)
DEB_OPTS += \
    ARCHOPTS="-mabi=lp64 -fPIC"
endif

ifeq ($(DEB_HOST_ARCH),i386)
DEB_OPTS += \
    FORCE_DRC_C_BACKEND= \
    NOASM=
endif

ifeq ($(DEB_HOST_ARCH),ia64)
DEB_OPTS += \
    PTR64=1
endif

ifeq ($(DEB_HOST_ARCH),mips)
DEB_OPTS += \
    ARCHOPTS=-Umips \
    BIGENDIAN=1
endif

ifeq ($(DEB_HOST_ARCH),mipsel)
DEB_OPTS += \
    ARCHOPTS=-Umips
endif

ifeq ($(DEB_HOST_ARCH),powerpc)
DEB_OPTS += \
    ARCHOPTS=-Upowerpc \
    NOASM= \
    BIGENDIAN=1
endif

ifeq ($(DEB_HOST_ARCH),ppc64)
DEB_OPTS += \
    PTR64=1 \
    NOASM= \
    BIGENDIAN=1
endif

ifeq ($(DEB_HOST_ARCH),ppc64el)
DEB_OPTS += \
    PTR64=1 \
    NOASM=
endif

ifeq ($(DEB_HOST_ARCH),s390)
DEB_OPTS += \
    BIGENDIAN=1
endif

ifeq ($(DEB_HOST_ARCH),s390x)
DEB_OPTS += \
    PTR64=1 \
    BIGENDIAN=1
endif

ifeq ($(DEB_HOST_ARCH),sparc)
DEB_OPTS += \
    BIGENDIAN=1
endif

ifeq ($(DEB_HOST_ARCH),sparc64)
DEB_OPTS += \
    PTR64=1 \
    BIGENDIAN=1
endif

ifeq ($(DEB_HOST_ARCH),x32)
DEB_OPTS += \
    FORCE_DRC_C_BACKEND= \
    NOASM=
endif

# kFreeBSD architectures
ifeq ($(DEB_HOST_ARCH),kfreebsd-amd64)
DEB_OPTS += \
    TARGETOS=freebsd \
    FORCE_DRC_C_BACKEND= \
    PTR64=1 \
    NOASM= \
    USE_SYSTEM_LIB_PORTMIDI=
export DEB_LDFLAGS_MAINT_APPEND = -ldl
endif

ifeq ($(DEB_HOST_ARCH),kfreebsd-i386)
DEB_OPTS += \
    TARGETOS=freebsd \
    FORCE_DRC_C_BACKEND= \
    NOASM= \
    USE_SYSTEM_LIB_PORTMIDI=
export DEB_LDFLAGS_MAINT_APPEND = -ldl
endif

# GNU/Hurd architecture
ifeq ($(DEB_HOST_ARCH),hurd-i386)
DEB_OPTS += \
    TARGETOS=gnu \
    FORCE_DRC_C_BACKEND= \
    NOASM= \
    USE_SYSTEM_LIB_PORTMIDI= \
    NO_USE_MIDI=1
endif

DEB_MAME_OPTS = \
    SDL_INI_PATH=/etc/mame \
    FULLNAME=mame \
    TARGET=mame \
    SUBTARGET=mame \
    TOOLS=1

ifndef DEBUG
# Disable -g entirely
CFLAGS := $(CFLAGS:-g=-g0)
endif

%:
	dh $@

override_dh_auto_build-arch:
	$(MAKE) $(DEB_OPTS) $(DEB_MAME_OPTS)
	-mv mame64 mame #FIXME
	$(CURDIR)/mame -createconfig
	mv mame.ini default.mame.ini
	mv plugin.ini default.plugin.ini
	mv ui.ini default.ui.ini

override_dh_auto_build-indep:
	$(MAKE) -C docs singlehtml

override_dh_auto_test-arch:
	# Run MAME's internal validation tests
	-$(CURDIR)/mame -validate

override_dh_install:
	dh_install --fail-missing \
		   --exclude=dir.txt \
		   --exclude=LICENSE \
		   --exclude=README.md \
		   --exclude=jquery.js \
		   --exclude=underscore.js

override_dh_installchangelogs:
	dh_installchangelogs whatsnew.txt

override_dh_fixperms-arch:
	dh_fixperms
	find debian/mame/etc/mame -type f -execdir chmod 644 {} \;

override_dh_fixperms-indep:
	dh_fixperms
	find debian/mame-data/usr/share/games/mame/artwork -type f -execdir chmod 644 {} \;
	find debian/mame-data/usr/share/games/mame/bgfx -type f -execdir chmod 644 {} \;
	find debian/mame-data/usr/share/games/mame/ctrlr -type f -execdir chmod 644 {} \;
	find debian/mame-data/usr/share/games/mame/fonts -type f -execdir chmod 644 {} \;
	find debian/mame-data/usr/share/games/mame/hash -type f -execdir chmod 644 {} \;
	find debian/mame-data/usr/share/games/mame/keymaps -type f -execdir chmod 644 {} \;
	find debian/mame-data/usr/share/games/mame/language -type f -name "*.po" -delete
	find debian/mame-data/usr/share/games/mame/language -type f -execdir chmod 644 {} \;
	find debian/mame-data/usr/share/games/mame/plugins -type f -execdir chmod 644 {} \;

PKD := $(abspath $(dir $(MAKEFILE_LIST)))
PKG := $(shell dpkg-parsechangelog -l$(PKD)/changelog --show-field=Source)
DTYPE :=
VER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog --show-field=Version | sed -e 's/\(.*\)-.*/\1/')
# Upstream source has no dot in its name, so we have to cut it out
UVER := $(shell echo $(VER) | sed -e 's/\.//' )
TMPDIR := $(shell mktemp --dry-run --directory -p .)

.PHONY: get-orig-source
get-orig-source: $(PKG)_$(VER)$(DTYPE).orig.tar.xz $(info I: $(PKG)_$(VER)$(DTYPE))
	@

$(PKG)_$(VER)$(DTYPE).orig.tar.xz:
	@echo "# Downloading..."
	uscan --noconf --verbose --rename --destdir=$(CURDIR) \
        --check-dirname-level=0 --force-download \
        --download-version $(VER) $(PKD)
	@echo "# Extracting..."
	mkdir -p $(TMPDIR)/$(PKG)-$(VER)
	tar -xzf $(PKG)_$(VER).orig.tar.gz --strip-component=1 \
        -C $(TMPDIR)/$(PKG)-$(VER)/ --exclude=\.*
	@echo "# Cleaning-up..."
	# Remove binaries and other cruft
	cd $(TMPDIR)/$(PKG)-$(VER) && make clean && make cleansrc
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/.mame_version
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/zlib/contrib/dotzlib/DotZLib.chm
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/bx/tools/bin/linux/bin2c
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/bx/tools/bin/linux/genie
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/bx/tools/bin/linux/ninja
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/bx/tools/bin/windows/bin2c.exe
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/bx/tools/bin/windows/genie.exe
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/bx/tools/bin/windows/ninja.exe
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/bgfx/3rdparty/remotery/vis/extern/BrowserLib/Core/Code/Convert.js
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/bgfx/3rdparty/scintilla/src/Editor.cxx.orig
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/bgfx/3rdparty/scintilla/gtk/makefile.orig
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/glm/doc/api
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/linenoise-ng/src/ConvertUTF.*
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/lzma/7zr.exe
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/lzma/lzma.exe
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/portmidi/pm_java/JavaExe.exe
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/portmidi/pm_java/UpdateRsrcJavaExe.exe
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/portmidi/pm_csharp/pm_managed/app.rc
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/portmidi/pm_csharp/pm_managed/resource.h
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/portmidi/pm_java/pmjni/pmjni.rc
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/portmidi/pm_java/setup/pmdefaults-setup.exe
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/android-project/gradle/wrapper/gradle-wrapper.jar
	rm -rf $(TMPDIR)/$(PKG)-$(VER)/3rdparty/zlib/contrib/dotzlib/DotZLib.chm
	# Add upstream changelog and other useful bits distributed separately
	wget https://github.com/mamedev/build/archive/master.zip
	unzip -oqjd $(TMPDIR) master.zip \
        *mamedirs.zip *whatsnew_$(UVER).txt
	mv $(TMPDIR)/whatsnew_$(UVER).txt \
        $(TMPDIR)/$(PKG)-$(VER)/whatsnew.txt
	unzip -oqd $(TMPDIR)/$(PKG)-$(VER)/ $(TMPDIR)/mamedirs.zip
	@echo "# Packing..."
	tar -C $(TMPDIR) -cf - $(PKG)-$(VER) | xz -9c > $(PKG)_$(VER)$(DTYPE).orig.tar.xz
	rm -rf $(TMPDIR) $(PKG)_$(VER).orig.tar.gz master.zip