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
282
|
#!/usr/bin/make -f
#
# Based on the work by Marcus Brinkmann <brinkmd@debian.org>
# Rewritten by Guillem Jover <guillem@debian.org>
#
FULL_VERSION := $(shell dpkg-parsechangelog | grep ^Version: | sed -e 's/^.*: //g')
NOEPOCH_VERSION := $(shell echo $(FULL_VERSION) | sed -e 's/.*://g')
TAR_VERSION := $(shell echo $(NOEPOCH_VERSION) | sed -e 's/-.*//g')
UPSTREAM_VERSION := $(shell echo $(TAR_VERSION) | sed -e 's/\.dfsg.*//g')
NOGIT_VERSION := $(shell echo $(UPSTREAM_VERSION) | sed -e 's/+git[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]//g')
VERSION := $(NOGIT_VERSION)
MAJOR := $(shell echo $(VERSION) | sed -e 's/\..*//g')
DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
ifneq (,$(filter custom,$(DEB_BUILD_OPTIONS)))
VERSION := $(NOEPOCH_VERSION)
endif
MACHINE := 686
pkg := gnumach-image-$(VERSION)-$(MACHINE)
pkg_xen := gnumach-image-$(VERSION)-xen-$(MACHINE)
pkg_udeb := kernel-image-$(VERSION)-$(MACHINE)-di
pkg_xen_udeb := kernel-image-$(VERSION)-xen-$(MACHINE)-di
pkg_dbg := gnumach-image-$(VERSION)-$(MACHINE)-dbg
pkg_xen_dbg := gnumach-image-$(VERSION)-xen-$(MACHINE)-dbg
pkg_common := gnumach-common
pkg_dev := gnumach-dev
D := $(CURDIR)/debian/tmp
D_UDEB := $(D)-udeb
D_XEN := $(D)-xen
D_XEN_UDEB := $(D)-xen-udeb
D_DBG := $(D)-dbg
D_XEN_DBG := $(D)-xen-dbg
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
CFLAGS = -Wall -g -pipe -fno-strict-aliasing -march=i$(MACHINE)
ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
DEB_PARALLEL_JOBS ?= $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
endif
ifneq (,$(DEB_PARALLEL_JOBS))
MAKEFLAGS += -j$(DEB_PARALLEL_JOBS)
endif
drivers :=
common_configure := \
--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
--prefix=/usr \
--exec-prefix=/ \
--disable-net-group \
--disable-pcmcia-group \
--disable-wireless-group
debian/control: debian/control.stamp
debian/control.stamp: debian/control.in
ifneq (,$(filter custom,$(DEB_BUILD_OPTIONS)))
@echo Building a custom kernel: "$(VERSION)"
else
@echo Building a stock kernel: "$(VERSION)"
endif
sed -e 's/@version@/$(VERSION)/g' < $< > debian/control
touch $@
configure: configure.ac
autoreconf -fi
build/config.status: configure
dh_testdir
-mkdir build
cd build && PACKAGE_VERSION_SUFFIX=-486 ../configure $(drivers) \
CFLAGS="$(CFLAGS)" \
$(common_configure)
build-xen/config.status: configure
dh_testdir
-mkdir build-xen
cd build-xen && PACKAGE_VERSION_SUFFIX=-xen-486 ../configure \
CFLAGS="$(CFLAGS)" \
$(common_configure) \
--enable-platform=xen
build-dbg/config.status: configure
dh_testdir
-mkdir build-dbg
cd build-dbg && PACKAGE_VERSION_SUFFIX=-486-dbg ../configure --enable-kdb $(drivers) \
$(common_configure) \
build-xen-dbg/config.status: configure
dh_testdir
-mkdir build-xen-dbg
cd build-xen-dbg && PACKAGE_VERSION_SUFFIX=-xen-486-dbg ../configure --enable-kdb \
$(common_configure) \
--enable-platform=xen
build-arch: build/stamp build-xen/stamp build-dbg/stamp build-xen-dbg/stamp
build-indep: build-arch
build: build-arch build-indep
doc/mach.info: build/config.status
dh_testdir
$(MAKE) -C build ../doc/mach.info
build/stamp: build/config.status doc/mach.info
dh_testdir
ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
$(MAKE) -C build
else
$(MAKE) -C build check
endif
touch $@
build-xen/stamp: build-xen/config.status doc/mach.info
dh_testdir
ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
$(MAKE) -C build-xen
else
$(MAKE) -C build-xen check
endif
touch $@
build-dbg/stamp: build-dbg/config.status doc/mach.info
dh_testdir
ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
$(MAKE) -C build-dbg
else
$(MAKE) -C build-dbg check
endif
touch $@
build-xen-dbg/stamp: build-xen-dbg/config.status doc/mach.info
dh_testdir
ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
$(MAKE) -C build-xen-dbg
else
$(MAKE) -C build-xen-dbg check
endif
touch $@
clean:
dh_testdir
rm -f debian/control.stamp
rm -f machine
rm -rf build build-xen build-dbg build-xen-dbg $(D_UDEB) $(D_XEN_UDEB) $(D_XEN) $(D_DBG) $(D_XEN_DBG)
# Clean up autogenerated cruft
rm -rf autom4te.cache build-aux
rm -f aclocal.m4 config.h.in configure INSTALL Makefile.in
rm -f doc/mach.info* doc/stamp-vti doc/version.texi
find -name '*~' -o -name '*.rej' -o -name '*.orig' | xargs rm -f
rm -f debian/gnumach-image-*.preinst
rm -f debian/gnumach-image-*.prerm
rm -f debian/gnumach-image-*.postinst
rm -f debian/gnumach-image-*.postrm
dh_clean
install: build
dh_testdir
dh_testroot
dh_prep -a
-rm -rf $(D_DBG)
dh_installdirs -a
$(MAKE) -C build install \
DESTDIR=$(D)
$(MAKE) -C build-xen install \
DESTDIR=$(D_XEN)
$(MAKE) -C build-dbg install-exec \
DESTDIR=$(D_DBG) \
$(MAKE) -C build-xen-dbg install-exec \
DESTDIR=$(D_XEN_DBG) \
mkdir -p $(D_UDEB)/boot
cp $(D)/boot/gnumach $(D_UDEB)/boot/
mv $(D)/boot/gnumach $(D)/boot/gnumach-$(VERSION)-$(MACHINE)
mkdir -p $(D_XEN_UDEB)/boot
cp $(D_XEN)/boot/gnumach $(D_XEN_UDEB)/boot/
mv $(D_XEN)/boot/gnumach $(D_XEN)/boot/gnumach-$(VERSION)-xen-$(MACHINE)
mv $(D_DBG)/boot/gnumach $(D_DBG)/boot/gnumach-$(VERSION)-$(MACHINE)-dbg
mv $(D_XEN_DBG)/boot/gnumach $(D_XEN_DBG)/boot/gnumach-$(VERSION)-xen-$(MACHINE)-dbg
ifeq ($(DEB_HOST_ARCH_OS),hurd)
for script in preinst prerm postinst postrm ; do \
for prefix in "" -xen ; do \
for suffix in "" -dbg ; do \
sed -e "s/@VERSION@/$(VERSION)/g" \
-e "s/@RELEASE@/$(VERSION)$$prefix-$(MACHINE)$$suffix/g" \
debian/gnumach-image.$$script.in \
> debian/gnumach-image-$(VERSION)$$prefix-$(MACHINE)$$suffix.$$script ; \
done ; \
done ; \
done
endif
binary: binary-indep binary-arch
binary-indep: install debian/control.stamp
dh_testdir
dh_testroot
dh_install -i --sourcedir=$(D)
dh_installdocs -i
dh_installchangelogs -i -k ChangeLog
dh_installinfo -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
binary-arch: install debian/control.stamp
dh_testdir
dh_testroot
dh_install -a -N$(pkg_udeb) -N$(pkg_xen) -N$(pkg_xen_udeb) -N$(pkg_dbg) -N$(pkg_xen_dbg) --sourcedir=$(D)
dh_install -p$(pkg) --sourcedir=$(D) boot
dh_install -p$(pkg_xen) --sourcedir=$(D_XEN) boot
ifeq ($(DEB_HOST_ARCH_OS),hurd)
dh_install -p$(pkg_udeb) --sourcedir=$(D_UDEB) boot
dh_install -p$(pkg_xen_udeb) --sourcedir=$(D_XEN_UDEB) boot
endif
dh_install -p$(pkg_dbg) --sourcedir=$(D_DBG) boot
dh_install -p$(pkg_xen_dbg) --sourcedir=$(D_XEN_DBG) boot
dh_installdocs -p$(pkg) README NEWS i386/README-Drivers
dh_installdocs -p$(pkg_xen) README NEWS
dh_installdocs -p$(pkg_dbg) README NEWS i386/README-Drivers
dh_installdocs -p$(pkg_xen_dbg) README NEWS
dh_installdocs -a
dh_installchangelogs -a -k ChangeLog
dh_link -a
dh_strip -a -N$(pkg_dbg) -N$(pkg_xen_dbg)
dh_compress -a -N$(pkg) -N$(pkg_udeb) -N$(pkg_xen) -N$(pkg_xen_udeb) -N$(pkg_dbg) -N$(pkg_xen_dbg)
dh_compress -p$(pkg) boot/gnumach-$(VERSION)-$(MACHINE)
dh_compress -p$(pkg_xen) boot/gnumach-$(VERSION)-xen-$(MACHINE)
ifeq ($(DEB_HOST_ARCH_OS),hurd)
dh_compress -p$(pkg_udeb) boot/gnumach
dh_compress -p$(pkg_xen_udeb) boot/gnumach
endif
dh_compress -p$(pkg_dbg) boot/gnumach-$(VERSION)-$(MACHINE)-dbg
dh_compress -p$(pkg_xen_dbg) boot/gnumach-$(VERSION)-xen-$(MACHINE)-dbg
dh_fixperms -a
dh_installdeb -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
.PHONY: build build-arch build-indep clean
.PHONY: install binary binary-indep binary-arch
|