/[glibc-bsd]/trunk/kfreebsd-8/debian/rules
ViewVC logotype

Contents of /trunk/kfreebsd-8/debian/rules

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4813 - (show annotations) (download)
Sun Jul 28 19:48:43 2013 UTC (15 months ago) by rmh
File size: 13237 byte(s)
Disable CTF to fix FTBFS on newer buildutils. (Closes: #718162)
1 #!/usr/bin/make -f
2 # Sample debian/rules that uses debhelper.
3 # GNU copyright 1997 to 1999 by Joey Hess.
4
5 SHELL = bash
6
7 # Uncomment this to turn on verbose mode.
8 #export DH_VERBOSE=1
9
10 DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
11 DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
12
13 full_version := $(shell dpkg-parsechangelog | grep ^Version: | sed -e 's/^.*: //g')
14 tar_version := $(shell echo $(full_version) | sed -e 's/-.*//g')
15 version := $(shell echo $(full_version) | sed -e 's/[~+-].*//g')
16 major := $(shell echo $(version) | sed -e 's/\..*//g')
17 revision := $(shell echo $(full_version) | sed -e 's/^[^+-]*//g')
18 cpu := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
19 config_files := $(wildcard debian/arch/$(cpu)/*.config)
20 flavours := $(config_files:debian/arch/$(cpu)/%.config=%)
21 configfile := DEBCUSTOM
22 abiname := 1
23 ld_target := $(shell ld --help | sed -ne "s/[^ :]*: supported targets: \([^ ]*\) .*/\1/p")
24 gcc_version := 4.6
25
26 ifeq ($(cpu), mipsel)
27 kfreebsd_cpu := mips
28 else
29 kfreebsd_cpu := $(cpu)
30 endif
31
32 SVN := http://svn.freebsd.org/base/release/$(version).0
33 #SVN := http://svn.freebsd.org/base/releng/$(version)
34 #SVN := http://svn.freebsd.org/base/stable/$(major)
35 SOURCE_PACKAGE := $(CURDIR)/debian/kfreebsd-source-$(version)
36 IMAGE_PACKAGE := $(CURDIR)/debian/kfreebsd-image-$(version)-$(abiname)
37 HEADERS_PACKAGE := $(CURDIR)/debian/kfreebsd-headers-$(version)-$(abiname)
38 SRC_TAR := kfreebsd-source-$(version).tar.xz
39 SRC_DIR := kfreebsd-source-$(version)
40 HEADERS_DIR := kfreebsd-headers-$(version)-$(abiname)
41 FLAVOR_DIR := flavor-$(version)-$(abiname)
42 ORIG_DIR := kfreebsd-$(major)-$(tar_version)
43 ORIG_TAR := kfreebsd-$(major)_$(tar_version).orig.tar.gz
44 MAKE := make MACHINE_ARCH=$(kfreebsd_cpu) CC=gcc-$(gcc_version) WERROR=
45 PATH := $(CURDIR)/config:/usr/lib/freebsd:$(PATH)
46
47 # Disable install of *.ko.symbols files (their presence would trigger an
48 # "unstripped-binary-or-object" lintian error).
49 MAKE += -DWITHOUT_KERNEL_SYMBOLS
50
51 MAKE += -DWITHOUT_CTF
52
53 get-orig-source:
54 rm -rf $(ORIG_DIR)
55 for i in sys usr.sbin/config ; do \
56 svn export $(SVN)/$$i $(ORIG_DIR)/$$i ; \
57 done
58 cd $(ORIG_DIR) && $(CURDIR)/debian/prune.sh
59 tar --numeric-owner --owner 0 --group 0 -czf ../$(ORIG_TAR) $(ORIG_DIR)
60 rm -rf $(ORIG_DIR)
61
62 control: clean
63 for arch in `ls $(CURDIR)/debian/arch/` ; do \
64 KW_CONFIG_DIR=debian/arch/$$arch/installer ; \
65 if test -e $$KW_CONFIG_DIR ; then \
66 for config in `ls $(CURDIR)/debian/arch/$$arch/ | grep \.config` ; do \
67 flavor=$${config/.config/} ; \
68 if test -e debian/arch/$$arch/$$flavor.installer ; then \
69 echo "kfreebsd-$$arch $(version)-$(abiname) $$flavor $(version)-$(abiname)-$$flavor - -" ; \
70 fi ; \
71 done > $$KW_CONFIG_DIR/kernel-versions ; \
72 fi ; \
73 echo ; \
74 done
75 sed -e "s/@major@/$(major)/g" -e "s/@version@/$(version)/g" -e "s/@abiname@/$(abiname)/g" -e "s/@flavor@/$$flavor/g" -e "s/@gcc_version@/$(gcc_version)/g" \
76 $(CURDIR)/debian/control.in > $(CURDIR)/debian/control
77 echo >> $(CURDIR)/debian/control
78 for arch in `ls $(CURDIR)/debian/arch/` ; do \
79 for config in `ls $(CURDIR)/debian/arch/$$arch/ | grep \.config` ; do \
80 flavor=$${config/.config/} ; \
81 recommends= ; \
82 test -f $(CURDIR)/debian/arch/$$arch/$$flavor.defines && recommends=`awk '/^Recommends: / {print $$2}' $(CURDIR)/debian/arch/$$arch/$$flavor.defines` ; \
83 sed -e "s/@major@/$(major)/g" -e "s/@version@/$(version)/g" -e "s/@abiname@/$(abiname)/g" -e "s/@flavor@/$$flavor/g" -e "s/@arch@/$$arch/g" -e "s/@recommends@/$$recommends/g" \
84 $(CURDIR)/debian/control.flavor.in ; \
85 echo ; \
86 done ; \
87 export KW_CONFIG_DIR=debian/arch/$$arch/installer ; \
88 if test -e $$KW_CONFIG_DIR/kernel-versions ; then \
89 kernel-wedge gen-control ; \
90 fi ; \
91 echo ; \
92 done >> $(CURDIR)/debian/control
93
94 clean:
95 dh_testdir
96 dh_testroot
97 rm -rf src kfreebsd-source-* flavor-* config
98 rm -f debian/kfreebsd-image-*.preinst
99 rm -f debian/kfreebsd-image-*.prerm
100 rm -f debian/kfreebsd-image-*.postinst
101 rm -f debian/kfreebsd-image-*.postrm
102
103 rm -f *-stamp
104 dh_clean
105
106 src: src-stamp
107 src-stamp:
108 mkdir $(CURDIR)/src
109 cp -af $(CURDIR)/sys $(CURDIR)/usr.sbin $(CURDIR)/src
110
111 set -e ; find src/sys -type f | (while read i ; do \
112 sed -i $$i \
113 -e 's/defined\( \|\t\)*(\( \|\t\)*__FreeBSD__\( \|\t\)*)/1/g' \
114 -e 's/#\( \|\t\)*ifdef\( \|\t\)*__FreeBSD__/#if 1/g' \
115 -e 's/#\( \|\t\)*ifndef\( \|\t\)*__FreeBSD__/#if 0/g' \
116 -e 's/defined\( \|\t\)*(\( \|\t\)*\(__linux__\|linux\)\( \|\t\)*)/0/g' \
117 -e 's/#\( \|\t\)*ifdef\( \|\t\)*\(__linux__\|linux\)/#if 0/g' \
118 -e 's/#\( \|\t\)*ifndef\( \|\t\)*\(__linux__\|linux\)/#if 1/g' \
119 -e 's/__FreeBSD__/$(major)/g' \
120 -e 's,#\( \|\t\)*include\( \|\t\)*<sys/device.h>,,g' \
121 -e 's,#\( \|\t\)*include\( \|\t\)*<dev/rndvar.h>,,g' \
122 -e 's,#\( \|\t\)*include\( \|\t\)*<sys/pool.h>,,g' \
123 -e 's,#\( \|\t\)*include\( \|\t\)*<netinet/ip_ipsp.h>,,g' \
124 -e 's,#\( \|\t\)*include\( \|\t\)*\(<\|"\)bpfilter.h\(>\|"\),,g' \
125 -e 's,#\( \|\t\)*include\( \|\t\)*\(<\|"\)pflog.h\(>\|"\),,g' \
126 ; done)
127
128 touch src-stamp
129
130 build-indep: build-indep-stamp
131 build-indep-stamp: src
132 dh_testdir
133
134 cp -af src $(SRC_DIR)
135
136 touch build-indep-stamp
137
138 build: build-arch build-indep
139
140 install-indep: install-indep-stamp
141 install-indep-stamp: build-indep
142 dh_testdir
143 dh_testroot
144 dh_clean -k
145 dh_installdirs -i
146
147 mkdir -p $(SOURCE_PACKAGE)/usr/src
148 chown -R root.src $(SRC_DIR)
149 tar cfJ $(SOURCE_PACKAGE)/usr/src/$(SRC_TAR) $(SRC_DIR)
150
151 touch install-indep-stamp
152
153 config: config-stamp
154 config-stamp: src
155 rm -rf config
156 cp -af src/usr.sbin/config config
157 CFLAGS="-D__va_list=__builtin_va_list" $(MAKE) -C config
158 touch $@
159
160 build-arch: $(foreach flavor,$(flavours),build-flavor-$(flavor)-stamp)
161 src-flavor-%-stamp: src config
162 cp -af src $(FLAVOR_DIR)-$*
163 touch $@
164 build-flavor-%-stamp: src-flavor-%-stamp
165 # Add the abiname and the flavor to the kernel version
166 sed -i -e 's/^RELEASE=".*"/RELEASE="$(version)-$(abiname)-$*"/g' $(FLAVOR_DIR)-$*/sys/conf/newvers.sh
167
168 # Change ident to the kernel version
169 sed -i -e 's/^i=.*/i="Debian $* ($(full_version))"/g' $(FLAVOR_DIR)-$*/sys/conf/newvers.sh
170
171 # Set /lib/modules/${RELEASE} as module dir
172 sed -i -e 's,^KODIR?=.*,KODIR="/lib/modules/$(version)-$(abiname)-$*",g' $(FLAVOR_DIR)-$*/sys/conf/kern.pre.mk
173 sed -i -e '/^static char linker_path/s,".*","/lib/modules/$(version)-$(abiname)-$*",g' $(FLAVOR_DIR)-$*/sys/kern/kern_linker.c
174
175 # Always set explicit link target to match with ld's implicit target (needed
176 # to build on non-kFreeBSD)
177 sed -i \
178 -e 's/elf32-i386-freebsd/$(ld_target)/g' \
179 -e 's/elf64-x86-64-freebsd/$(ld_target)/g' \
180 -e 's/elf32-tradlittlemips-freebsd/$(ld_target)/g' \
181 -e 's/elf32-tradbigmips-freebsd/$(ld_target)/g' \
182 $(FLAVOR_DIR)-$*/sys/conf/ldscript.$(kfreebsd_cpu)
183
184 # Configure the kernel
185 cp debian/arch/$(cpu)/$*.config $(FLAVOR_DIR)-$*/sys/$(kfreebsd_cpu)/conf/
186 ln -sf $*.config $(FLAVOR_DIR)-$*/sys/$(kfreebsd_cpu)/conf/$(configfile)
187 cd $(FLAVOR_DIR)-$*/sys/$(kfreebsd_cpu)/conf \
188 && config $(configfile)
189
190 # Build it
191 $(MAKE) -C $(FLAVOR_DIR)-$*/sys/$(kfreebsd_cpu)/compile/$(configfile)/ depend
192 $(MAKE) -C $(FLAVOR_DIR)-$*/sys/$(kfreebsd_cpu)/compile/$(configfile)/
193
194 touch build-flavor-$*-stamp
195
196 install-common-stamp: src
197 dh_testdir
198 dh_testroot
199 mkdir -p $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR)
200 cd src \
201 && find . -type f -name "*.h" -not -regex ".*modules.*" -not -regex ".*sys/$(kfreebsd_cpu)/.*" -exec cp --parents {} $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR) \;
202
203 mkdir -p $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR)/conf
204 cd src && cp --parents \
205 sys/conf/kern.mk \
206 sys/conf/kmod.mk \
207 sys/conf/kmod_syms.awk \
208 sys/kern/bus_if.m \
209 sys/dev/pci/pci_if.m \
210 sys/kern/device_if.m \
211 sys/kern/vnode_if.src \
212 sys/tools/vnode_if.awk \
213 sys/tools/makeobjops.awk \
214 $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR)
215
216 find $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR) -type f -exec chmod 644 {} \;
217 find $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR) -type f -name "*.awk" -exec chmod 755 {} \;
218
219 touch install-common-stamp
220
221 install-arch: $(foreach flavor,$(flavours),install-flavor-$(flavor)-stamp) install-udeb-stamp
222 install-flavor-%-stamp: install-common-stamp build-flavor-%-stamp
223 dh_testdir
224 dh_testroot
225 dh_clean -k -pkfreebsd-image-$(version)-$(abiname)-$*
226
227 mkdir -p $(IMAGE_PACKAGE)-$*/{boot,lib/modules/$(version)-$(abiname)-$*}
228
229 # make the install target happy
230 install -o root -g root -m 644 \
231 $(FLAVOR_DIR)-$*/sys/$(kfreebsd_cpu)/conf/GENERIC.hints \
232 $(IMAGE_PACKAGE)-$*/boot/device.hints || touch $(IMAGE_PACKAGE)-$*/boot/device.hints
233 install -o root -g root -m 644 \
234 $(FLAVOR_DIR)-$*/sys/boot/forth/loader.conf \
235 $(IMAGE_PACKAGE)-$*/boot/loader.conf
236 mkdir -p $(IMAGE_PACKAGE)-$*/boot/defaults
237 install -o root -g root -m 644 \
238 $(FLAVOR_DIR)-$*/sys/boot/forth/loader.conf \
239 $(IMAGE_PACKAGE)-$*/boot/defaults/loader.conf
240
241 # install the config file
242 install -o root -g root -m 644 \
243 $(FLAVOR_DIR)-$*/sys/$(kfreebsd_cpu)/conf/$*.config \
244 $(IMAGE_PACKAGE)-$*/boot/config-$(version)-$(abiname)-$*
245
246 # now install the kernel
247 $(MAKE) -C $(FLAVOR_DIR)-$*/sys/$(kfreebsd_cpu)/compile/$(configfile) DESTDIR=$(IMAGE_PACKAGE)-$* install
248 mv $(IMAGE_PACKAGE)-$*/lib/modules/$(version)-$(abiname)-$*/kernel $(IMAGE_PACKAGE)-$*/boot/kfreebsd-$(version)-$(abiname)-$*
249 chmod 644 $(IMAGE_PACKAGE)-$*/boot/kfreebsd-$(version)-$(abiname)-$*
250 gzip -9 $(IMAGE_PACKAGE)-$*/boot/kfreebsd-$(version)-$(abiname)-$*
251
252 # fix broken perms in module dir
253 -chmod 644 $(IMAGE_PACKAGE)-$*/lib/modules/$(version)-$(abiname)-$*/*
254
255 # remove loader.conf (part of kfreebsd-loader)
256 rm -f $(IMAGE_PACKAGE)-$*/boot/loader.conf
257 rm -rf $(IMAGE_PACKAGE)-$*/boot/defaults
258
259 # remove device.hints (built into kernel)
260 rm -f $(IMAGE_PACKAGE)-$*/boot/device.hints
261
262 # README file
263 mkdir -p $(IMAGE_PACKAGE)-$*/usr/share/doc/kfreebsd-image-$(version)-$(abiname)-$*
264 install -p -o root -g root -m 644 \
265 debian/kfreebsd-image.README.Debian \
266 $(IMAGE_PACKAGE)-$*/usr/share/doc/kfreebsd-image-$(version)-$(abiname)-$*/README.Debian
267
268 # override file
269 mkdir -p $(IMAGE_PACKAGE)-$*/usr/share/lintian/overrides
270 install -p -o root -g root -m 644 \
271 debian/kfreebsd-image.overrides \
272 $(IMAGE_PACKAGE)-$*/usr/share/lintian/overrides/kfreebsd-image-$(version)-$(abiname)-$*
273
274 # scripts
275 for script in preinst prerm postinst postrm ; do \
276 sed -e "s/@VERSION@/$(version)/g" \
277 -e "s/@RELEASE@/$(version)-$(abiname)-$*/g" \
278 debian/kfreebsd-image.$$script.in \
279 > debian/kfreebsd-image-$(version)-$(abiname)-$*.$$script ; \
280 done
281
282 # headers package
283 mkdir -p $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kfreebsd_cpu)
284 cd $(FLAVOR_DIR)-$*/sys/$(kfreebsd_cpu) \
285 && find . -type f -name "*.h" -not -regex ".*modules.*" -exec cp --parents {} $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kfreebsd_cpu) \; \
286 && cp -d --parents compile/$(configfile)/machine $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kfreebsd_cpu) \
287 && cp -d --parents conf/$(configfile) $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kfreebsd_cpu)
288 find $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$(kfreebsd_cpu) -type f -exec chmod 644 {} \;
289 for dir in `ls $(HEADERS_PACKAGE)/usr/src/$(HEADERS_DIR)/sys` ; do \
290 ln -s ../../$(HEADERS_DIR)/sys/$$dir $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/$$dir ; \
291 done
292 ln -s $(kfreebsd_cpu)/include $(HEADERS_PACKAGE)-$*/usr/src/$(HEADERS_DIR)-$*/sys/machine
293
294 touch install-flavor-$*-stamp
295
296 install-udeb-stamp: $(foreach flavor,$(flavours),install-flavor-$(flavor)-stamp)
297 ifeq ($(DEB_HOST_ARCH_OS), kfreebsd)
298 dh_testdir
299 dh_testroot
300 for i in debian/arch/$(DEB_HOST_ARCH_CPU)/*.installer ; do \
301 subarch=`basename $$i .installer` ; \
302 dh_clean -k -pkernel-image-$(version)-$(abiname)-$${subarch}-di ; \
303 done
304
305 KW_CONFIG_DIR=debian/arch/$(DEB_HOST_ARCH_CPU)/installer kernel-wedge install-files \
306 $(version)-$(abiname) debian/arch/$(DEB_HOST_ARCH_CPU)/installer
307
308 for i in debian/arch/$(DEB_HOST_ARCH_CPU)/*.installer ; do \
309 subarch=`basename $$i .installer` ; \
310 # override file \n\
311 mkdir -p $(CURDIR)/debian/zlib-modules-$(version)-$(abiname)-$${subarch}-di/usr/share/lintian/overrides ; \
312 install -p -o root -g root -m 644 \
313 debian/zlib-modules.overrides \
314 $(CURDIR)/debian/zlib-modules-$(version)-$(abiname)-$${subarch}-di/usr/share/lintian/overrides/zlib-modules-$(version)-$(abiname)-$${subarch}-di ; \
315 done
316 endif
317 touch $@
318
319
320 # Build architecture-independent files here.
321 binary-indep: build-indep install-indep
322 dh_testdir
323 dh_testroot
324 dh_installdocs -i
325 dh_installchangelogs -i
326 dh_link -i
327 dh_strip -i
328 dh_compress -i
329 dh_fixperms -i
330 dh_makeshlibs -i
331 dh_installdeb -i
332 dh_shlibdeps -i
333 dh_gencontrol -i
334 dh_md5sums -i
335 dh_builddeb -i
336
337 # Build architecture-dependent files here.
338 binary-arch: build-arch install-arch
339 dh_testdir
340 dh_testroot
341 dh_installdocs -s
342 dh_installchangelogs -s
343 dh_link -s
344 dh_strip -s -X/boot -X/lib/modules
345 dh_compress -s
346 dh_fixperms -s
347 dh_makeshlibs -s
348 dh_installdeb -s
349 dh_shlibdeps -s -X/boot -X/lib/modules
350 dh_gencontrol -s
351 dh_md5sums -s
352 dh_builddeb -s
353
354 binary: binary-indep binary-arch
355
356 .PHONY: clean build build-indep
357 .PHONY: binary-indep binary-arch binary-indep binary-arch binary

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5