File: rules

package info (click to toggle)
mess 0.146-4
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy
  • size: 217,984 kB
  • sloc: ansic: 2,503,559; xml: 734,652; objc: 2,382; cpp: 1,215; makefile: 654; sh: 152; asm: 75
file content (203 lines) | stat: -rwxr-xr-x 4,796 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
#!/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.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

CFLAGS = -Wall -g

DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)

# 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_MESS_OPTS = \
    OPT_FLAGS="-D'INI_PATH=\"/etc/mess\"'" \
    FULLNAME=mess \
    TARGET=mess \
    SUBTARGET=mess \
    OSD=sdl \
    CROSS_BUILD_OSD= \
    NOASM=1 \
    PREFIX= \
    SUFFIX= \
    DEBUG= \
    PROFILER= \
    NOWERROR=1 \
    MACOSX_USE_LIBSDL= \
    BUILD_EXPAT= \
    BUILD_ZLIB= \
    BUILD_JPEGLIB= \
    BUILD_FLAC= \
    SYMBOLS= \
    SYMLEVEL= \
    DUMPSYM= \
    PROFILE= \
    MAP= \
    VERBOSE= \
    OPTIMIZE=2 \
    LDFLAGS="-Wl,--as-needed" \
    LDFLAGSEMULATOR="-Wl,--as-needed"

# Override make variables for specific archs
# Linux architectures
ifeq ($(DEB_HOST_ARCH),amd64)
DEB_MESS_OPTS += \
    ARCHOPTS=-mtune=generic \
    FORCE_DRC_C_BACKEND= \
    PTR64=1 \
    NOASM= \
    BIGENDIAN=
endif

ifeq ($(DEB_HOST_ARCH),i386)
DEB_MESS_OPTS += \
    ARCHOPTS=-mtune=generic \
    FORCE_DRC_C_BACKEND= \
    PTR64= \
    NOASM= \
    BIGENDIAN=
endif

ifeq ($(DEB_HOST_ARCH),ia64)
DEB_MESS_OPTS += \
    FORCE_DRC_C_BACKEND=1 \
    PTR64=1 \
    NOASM=1 \
    BIGENDIAN=
endif

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

ifeq ($(DEB_HOST_ARCH),mipsel)
DEB_MESS_OPTS += \
    ARCHOPTS=-Umips \
    FORCE_DRC_C_BACKEND=1
endif

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

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

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

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

# kFreeBSD architectures
ifeq ($(DEB_HOST_ARCH),kfreebsd-amd64)
DEB_MESS_OPTS += \
    TARGETOS=freebsd \
    PTR64=1 \
    FORCE_DRC_C_BACKEND= \
    NOASM= \
    BIGENDIAN=
endif

ifeq ($(DEB_HOST_ARCH),kfreebsd-i386)
DEB_MESS_OPTS += \
    TARGETOS=freebsd \
    FORCE_DRC_C_BACKEND= \
    PTR64= \
    NOASM= \
    BIGENDIAN=
endif

%:
	dh $@

override_dh_auto_build:
	$(MAKE) $(DEB_MESS_OPTS) all
	$(CURDIR)/mess -createconfig
	mv mess.ini default.mess.ini

override_dh_auto_clean:
	echo "Starting clean process..."
	$(MAKE) $(DEB_MESS_OPTS) clean
	rm -rf default.mess.ini
	rm -rf obj

# dh_installchangelogs doesn't know about whatsnew.txt,
# so we need to make an explicit call
override_dh_installchangelogs:
	dh_installchangelogs whatsnew.txt
	dh_installchangelogs -pmess docs/messnew.txt

# Remove Windows specific documentation
override_dh_installdocs:
	dh_installdocs --exclude=license.txt \
                   --exclude=windows.txt \
                   --exclude=newvideo.txt

# Remove OSX specific keymaps
override_dh_install:
	dh_install --exclude=OSX.txt


# Convert upstream sources from zip to tar.xz
VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p')

MESS_PACKAGE = mess
MESS_FILEBASE = $(MESS_PACKAGE)$(VERSION)
MESS_URL = http://www.progettosnaps.net/MESS/src/

AGENT = Debian MAME/MESS Packagers <mame@packages.debian.org>
TMPDIR := $(shell mktemp --dry-run --directory -p .)

# Upstream zip file does not have a dot in its name, so we have to cut it out
UPSTREAM_VERSION := $(shell echo $(VERSION) | sed -e 's/\.//' )

$(MESS_FILEBASE)s.zip:
	wget -U '$(AGENT)' \
        "$(MESS_URL)$(MESS_PACKAGE)$(UPSTREAM_VERSION)s.zip" \
        -O $(MESS_FILEBASE)s.zip

get-orig-source: $(MESS_FILEBASE)s.zip
	mkdir $(TMPDIR)

	# Create an orig.tar.xz tarball for MESS
	mkdir -p $(TMPDIR)/$(MESS_PACKAGE)-$(VERSION)
	unzip $(MESS_FILEBASE)s.zip -d $(TMPDIR)/$(MESS_PACKAGE)-$(VERSION)
	# Strip trailing CR
	find $(TMPDIR)/$(MESS_PACKAGE)-$(VERSION) \
	    -type f -regextype posix-egrep \
	    ! -regex ".*(zip|gif|png|bmp|ico)" \
	    | sed 's/\ /\\\ /g' \
	    | xargs sed -i "s/\r$$//"
	tar -C $(TMPDIR) -cvf - $(MESS_PACKAGE)-$(VERSION) | \
	    xz > $(MESS_PACKAGE)_$(VERSION).orig.tar.xz
	rm -f $(MESS_FILEBASE)s.zip

	rm -rf $(TMPDIR)