File: rules

package info (click to toggle)
gdb-mingw-w64 5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 36 kB
  • sloc: makefile: 116
file content (147 lines) | stat: -rwxr-xr-x 3,955 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
#!/usr/bin/make -f
# -*- makefile -*-
# Copyright © 2010-2011 Stephen Kitt <steve@sk2.org>

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

top_dir := $(shell pwd)
gdb_dir := /usr/src
upstream_gdb_dir := $(top_dir)/upstream
upstream_gdbserver_dir := $(upstream_gdb_dir)/gdb/gdbserver
build_gdb_dir := $(top_dir)/build-gdb
build_gdbserver_dir := $(top_dir)/build-gdbserver
source_version := $(shell dpkg-query -W -f="\$${Version}\n" gdb-source)
deb_version := $(source_version)+$(shell dpkg-parsechangelog | sed -ne "s/^Version: \(.*\)/\1/p")
deb_upstream_version := $(shell echo $(deb_version) | cut -d- -f1)
gnu_upstream_version := $(shell echo $(deb_upstream_version) | cut -d. -f1-3)
package := gdb-mingw-w64

targets := i686-w64-mingw32 x86_64-w64-mingw32

# Default hardening for Debian-targeted builds
dpkg_buildflags_arch = dpkg-buildflags

# Windows targets don't support stackprotector, relro, bindnow or pie
dpkg_buildflags_indep = DEB_BUILD_MAINT_OPTIONS="hardening=-stackprotector,-relro,-bindnow,-pie" dpkg-buildflags

unpack: unpack-stamp
unpack-stamp:
	tar xf $(gdb_dir)/gdb.tar.*
	rm -rf $(upstream_gdb_dir)
	mv gdb $(upstream_gdb_dir)
	touch $@

patch: patch-stamp
patch-stamp: unpack-stamp
	# No patches for now
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -rf *-stamp $(build_gdb_dir) $(build_gdbserver_dir) $(upstream_gdb_dir)
	dh_clean

configure-arch-stamp: patch-stamp
	dh_testdir
	set -e; \
	for target in $(targets); do \
		$(shell $(dpkg_buildflags_arch) --export=sh); \
		dh_auto_configure -B$(build_gdb_dir)/$$target -D$(upstream_gdb_dir) -- \
				  --prefix=/usr --enable-lto --with-system-readline \
				  --enable-tui --with-expat --with-python \
				  --target=$$target; \
	done
	touch $@

configure-indep-stamp: patch-stamp
	dh_testdir
	set -e; \
	for target in $(targets); do \
		$(shell $(dpkg_buildflags_indep) --export=sh); \
		dh_auto_configure -B$(build_gdbserver_dir)/$$target \
				  -D$(upstream_gdbserver_dir) -- \
				  --host=$$target --target=$$target; \
	done
	touch $@

# dpkg-buildpackage -B calls build rather than build-arch,
# so have build only depend on build-arch
build: build-arch

build-arch: build-arch-stamp
build-arch-stamp: configure-arch-stamp
	dh_testdir
	set -e; \
	for target in $(targets); do \
		$(shell $(dpkg_buildflags_arch) --export=sh); \
		dh_auto_build --parallel -B$(build_gdb_dir)/$$target; \
	done
	touch $@

build-indep: build-indep-stamp
build-indep-stamp: configure-indep-stamp
	dh_testdir
	set -e; \
	for target in $(targets); do \
		$(shell $(dpkg_buildflags_indep) --export=sh); \
		dh_auto_build --parallel -B$(build_gdbserver_dir)/$$target; \
	done
	touch $@

install: install-stamp
install-stamp: build-arch-stamp
	dh_testdir
	dh_testroot
	dh_prep
	set -e; \
	for target in $(targets); do \
		dh_auto_install -B$(build_gdb_dir)/$$target; \
	done

	# Drop files which will conflict with other packages
	rm -rf debian/$(package)/usr/lib
	rm -rf debian/$(package)/usr/share/gdb
	rm -rf debian/$(package)/usr/share/info
	rm -rf debian/$(package)/usr/share/locale

	touch $@

binary-indep: build-indep
	dh_testdir -i
	dh_testroot -i
	dh_install -i
	dh_installdocs -i
	dh_installchangelogs -i $(upstream_gdb_dir)/ChangeLog
	dh_link -i
	dh_strip -i
	dh_lintian -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_shlibdeps -i
	dh_gencontrol -i -- -v$(deb_version) -Vlocal:Version=$(deb_upstream_version) -Vgdb:Version=$(source_version)
	dh_md5sums -i
	dh_builddeb -i

binary-arch: install
	dh_testdir -a
	dh_testroot -a
	dh_install -a
	dh_installdocs -a
	dh_installchangelogs -a $(upstream_gdb_dir)/ChangeLog
	dh_link -a
	dh_strip -a
	dh_lintian -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a -- -v$(deb_version) -Vlocal:Version=$(deb_upstream_version) -Vgdb:Version=$(source_version)
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch

.PHONY: binary-indep binary-arch binary clean build install