File: binary-ada.mk

package info (click to toggle)
gcc-13 13.4.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 94,480 kB
  • sloc: makefile: 2,712; python: 1,107; sh: 955; awk: 23; perl: 18; cpp: 14
file content (332 lines) | stat: -rw-r--r-- 10,591 bytes parent folder | download | duplicates (5)
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
ifeq ($(with_separate_gnat),yes)
  $(lib_binaries) += gnatbase
endif

ifeq ($(with_libgnat),yes)
  # During native builds, gnat-BV Depends:
  # * libgnat             because of the development symlink.
  # During cross builds, gnat1 is linked statically. Only the latter remains.
  $(lib_binaries) += libgnat
endif

arch_binaries := $(arch_binaries) ada-nat ada-host
ifeq ($(unprefixed_names),yes)
  arch_binaries := $(arch_binaries) ada
  indep_binaries := $(indep_binaries) ada-build
endif
ifneq ($(DEB_CROSS),yes)
  ifneq ($(GFDL_INVARIANT_FREE),yes)
    indep_binaries := $(indep_binaries) ada-doc
  endif
endif

p_gbase		= $(p_xbase)
p_glbase	= $(p_lbase)
ifeq ($(with_separate_gnat),yes)
  p_gbase	= gnat$(pkg_ver)$(cross_bin_arch)-base
  p_glbase	= gnat$(pkg_ver)$(cross_bin_arch)-base
endif

p_gnat_n = gnat-$(GNAT_VERSION)-$(subst _,-,$(TARGET_ALIAS))
p_gnat_h = gnat-$(GNAT_VERSION)-for-host
p_gnat_b = gnat-$(GNAT_VERSION)-for-build
p_gnat	= gnat-$(GNAT_VERSION)
p_gnatsjlj= gnat-$(GNAT_VERSION)-sjlj$(cross_bin_arch)
p_lgnat	= libgnat-$(GNAT_VERSION)$(cross_lib_arch)
p_lgnat_dbg = libgnat-$(GNAT_VERSION)-dbg$(cross_lib_arch)
p_gnatd	= $(p_gnat)-doc

d_gbase	= debian/$(p_gbase)
d_gnat_n = debian/$(p_gnat_n)
d_gnat_h = debian/$(p_gnat_h)
d_gnat_b = debian/$(p_gnat_b)
d_gnat	= debian/$(p_gnat)
d_gnatsjlj	= debian/$(p_gnatsjlj)
d_lgnat	= debian/$(p_lgnat)
d_gnatd	= debian/$(p_gnatd)

GNAT_TOOLS = gnat gnatbind gnatchop gnatclean gnatkr gnatlink \
	     gnatls gnatmake gnatname gnatprep gnathtml

dirs_gnat_n = \
	$(docdir)/$(p_gbase) \
	$(PF)/bin \
	$(PF)/share/man/man1 \
	$(gcc_lib_dir)/{adalib,adainclude} \
	$(gcc_lexec_dir) \
	usr/share/lintian/overrides

dirs_gnat = \
	$(docdir)/$(p_gbase)/ada \
	$(PF)/bin \
	$(PF)/share/man/man1 \
	usr/share/lintian/overrides

files_gnat_n = \
	$(gcc_lexec_dir)/gnat1 \
	$(gcc_lib_dir)/ada_target_properties \
	$(gcc_lib_dir)/adainclude/*.ad[bs] \
	$(gcc_lib_dir)/adainclude/*.h \
	$(gcc_lib_dir)/adalib/*.ali \
	$(gcc_lib_dir)/adalib/lib*.a \
	$(foreach i,$(GNAT_TOOLS),$(PF)/bin/$(cmd_prefix)$(i)$(pkg_ver))

# Strip unreproducible -f*-prefix-map= options from installed .ali
# files until the proper solution BUILD_PATH_PREFIX_MAP is accepted.
sed_ali_strip_prefix_map := sed -i '/^A -f[a-z]+-prefix-map=/d'

$(binary_stamp)-gnatbase: $(install_stamp)
	dh_testdir
	dh_testroot
	dh_installdocs -p$(p_gbase) debian/ada/README.gnat debian/README.maintainers
	: # $(p_gbase)
ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
	mkdir -p $(d_gbase)/$(docdir)/$(p_xbase)
	ln -sf ../$(p_gbase) $(d_gbase)/$(docdir)/$(p_xbase)/Ada
endif
	dh_installchangelogs -p$(p_gbase) src/gcc/ada/ChangeLog
	dh_compress -p$(p_gbase)
	dh_fixperms -p$(p_gbase)
	dh_gencontrol -p$(p_gbase) -- -v$(DEB_VERSION) $(common_substvars)
	dh_installdeb -p$(p_gbase)
	dh_md5sums -p$(p_gbase)
	dh_builddeb -p$(p_gbase)
	touch $@


$(binary_stamp)-libgnat: $(install_stamp)
	dh_testdir
	dh_testroot
	mv $(install_stamp) $(install_stamp)-tmp

	: # libgnat
	rm -rf $(d_lgnat)

	dh_install -p$(p_lgnat) $(gcc_lib_dir)/adalib/libgna{t,rl}-$(GNAT_SONAME).so $(usr_lib)

	debian/dh_doclink -p$(p_lgnat) $(p_glbase)

	debian/dh_rmemptydirs -p$(p_lgnat)

	b=libgnat; \
	v=$(GNAT_VERSION); \
	for ext in preinst postinst prerm postrm; do \
	  for t in '' -dev -dbg; do \
	    if [ -f debian/$$b$$t.$$ext ]; then \
	      cp -pf debian/$$b$$t.$$ext debian/$$b$$v$$t.$$ext; \
	    fi; \
	  done; \
	done
	$(cross_makeshlibs) dh_makeshlibs $(ldconfig_arg) -p$(p_lgnat) \
		-V '$(p_lgnat) (>= $(shell echo $(DEB_VERSION) | sed 's/-.*//'))'
	$(call cross_mangle_shlibs,$(p_lgnat))

ifneq (,$(filter $(build_type), build-native cross-build-native))
	mkdir -p $(d_lgnat)/usr/share/lintian/overrides
	echo package-name-doesnt-match-sonames > \
		$(d_lgnat)/usr/share/lintian/overrides/$(p_lgnat)
endif

# The subst Make command below could be simplified, but ensures
# consistency with libraries building non-default multilib packages.
	$(call do_strip_lib_dbg, $(p_lgnat), $(p_lgnat_dbg), $(v_dbg),,)
	$(cross_shlibdeps) dh_shlibdeps -p$(p_lgnat) \
		$(call shlibdirs_to_search, \
			$(subst gnat-$(GNAT_SONAME),gcc-s$(GCC_SONAME),$(p_lgnat)) \
			$(subst gnat-$(GNAT_SONAME),atomic$(ATOMIC_SONAME),$(p_lgnat)) \
		,) \
		$(if $(filter yes, $(with_common_libs)),,-- -Ldebian/shlibs.common)
	$(call cross_mangle_substvars,$(p_lgnat))

ifeq ($(with_dbg),yes)
	: # $(p_lgnat_dbg)
	debian/dh_doclink -p$(p_lgnat_dbg) $(p_glbase)
endif
	echo $(p_lgnat) $(if $(with_dbg), $(p_lgnat_dbg)) >> debian/$(lib_binaries)

	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)

$(binary_stamp)-ada-nat: $(install_stamp)
	dh_testdir
	dh_testroot
	mv $(install_stamp) $(install_stamp)-tmp
	: # $(p_gnat_n)
	rm -rf $(d_gnat_n)
	dh_installdirs -p$(p_gnat_n) $(dirs_gnat_n)
	: # Upstream does not install gnathtml.
	cp src/gcc/ada/gnathtml.pl debian/tmp/$(PF)/bin/$(cmd_prefix)gnathtml$(pkg_ver)
	chmod 755 debian/tmp/$(PF)/bin/$(cmd_prefix)gnathtml$(pkg_ver)
	$(dh_compat2) dh_movefiles -p$(p_gnat_n) $(files_gnat_n)

ifeq ($(with_libgnat),yes)
  # Development links to actual shared libraries provided by libgnat.
	dh_install -p$(p_gnat_n) $(gcc_lib_dir)/adalib/libgna{t,rl}.so $(usr_lib)
  # Similar links specific to Debian. FIXME: what is their purpose?
	dh_link -p$(p_gnat_n) $(foreach lib,libgnat libgnarl,\
	  $(usr_lib)/$(lib)-$(GNAT_SONAME).so $(gcc_lib_dir)/adalib/$(lib).so)
endif
	debian/dh_doclink -p$(p_gnat_n)      $(p_gbase)
	for i in $(GNAT_TOOLS); do \
	  case "$$i" in \
	    gnat) cp -p debian/gnat.1 $(d_gnat_n)/$(PF)/share/man/man1/$(cmd_prefix)gnat$(pkg_ver).1 ;; \
	    *) ln -sf $(cmd_prefix)gnat$(pkg_ver).1 $(d_gnat_n)/$(PF)/share/man/man1/$(cmd_prefix)$$i$(pkg_ver).1; \
	  esac; \
	done

	: # still ship the unversioned prefixed names in the gnat package.
	for i in $(GNAT_TOOLS); do \
	  ln -sf $(cmd_prefix)$$i$(pkg_ver) \
	    $(d_gnat_n)/$(PF)/bin/$(cmd_prefix)$$i; \
	  ln -sf $(cmd_prefix)gnat$(pkg_ver).1.gz \
	    $(d_gnat_n)/$(PF)/share/man/man1/$(cmd_prefix)$$i.1.gz; \
	done

	: # keep this one unversioned, see Debian #802838.
	install -m755 debian/ada/gnatgcc $(d_gnat_n)/usr/bin/$(cmd_prefix)gnatgcc

ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTONS)))
	$(DWZ) \
	  $(d_gnat_n)/$(gcc_lexec_dir)/gnat1
endif
	dh_strip -p$(p_gnat_n)
	find $(d_gnat_n) -name '*.ali' | xargs $(sed_ali_strip_prefix_map)
	find $(d_gnat_n) -name '*.ali' | xargs chmod 444
	dh_shlibdeps -p$(p_gnat_n)
	( \
	  echo '$(p_gnat_n) binary: hardening-no-pie'; \
	  echo '$(p_gnat_n) binary: non-standard-file-perm' \
	) > $(d_gnat_n)/usr/share/lintian/overrides/$(p_gnat_n)
ifeq ($(GFDL_INVARIANT_FREE),yes)
	echo '$(p_gnat_n) binary: binary-without-manpage' \
	  >> $(d_gnat_n)/usr/share/lintian/overrides/$(p_gnat_n)
endif

	debian/dh_rmemptydirs -p$(p_gnat_n)

	echo $(p_gnat_n) >> debian/arch_binaries

	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)

$(binary_stamp)-ada-host: $(install_stamp)
	dh_testdir
	dh_testroot
	mv $(install_stamp) $(install_stamp)-tmp
	rm -rf $(d_gnat_h)
	debian/dh_doclink -p$(p_gnat_h) $(p_xbase)
	echo $(p_gnat_h) >> debian/arch_binaries
	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)

$(binary_stamp)-ada-build: $(install_stamp)
	dh_testdir
	dh_testroot
	mv $(install_stamp) $(install_stamp)-tmp
	rm -rf $(d_gnat_b)
	debian/dh_doclink -p$(p_gnat_b) $(p_cpp_b)
	echo $(p_gnat_b) >> debian/indep_binaries
	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)

$(binary_stamp)-ada: $(install_stamp)
	dh_testdir
	dh_testroot
	mv $(install_stamp) $(install_stamp)-tmp
	: # $(p_gnat)
	rm -rf $(d_gnat)
	dh_installdirs -p$(p_gnat) $(dirs_gnat)

ifeq ($(with_gnatsjlj),yes)
	dh_installdirs -p$(p_gnatsjlj) $(gcc_lib_dir)
	$(dh_compat2) dh_movefiles -p$(p_gnatsjlj) $(gcc_lib_dir)/rts-sjlj/adalib $(gcc_lib_dir)/rts-sjlj/adainclude
endif

	debian/dh_doclink -p$(p_gnat)      $(p_gbase)
ifeq ($(with_gnatsjlj),yes)
	debian/dh_doclink -p$(p_gnatsjlj) $(p_gbase)
endif
ifeq ($(PKGSOURCE),gnat-$(BASE_VERSION))
  ifeq ($(with_check),yes)
	cp -p test-summary $(d_gnat)/$(docdir)/$(p_gbase)/.
  endif
else
	cp -p src/gcc/ada/ChangeLog $(d_gnat)/$(docdir)/$(p_gbase)/ada/.
endif

ifneq (,$(filter $(build_type), build-native cross-build-native))
	: # ship the versioned prefixed names in the gnat package.
	for i in $(GNAT_TOOLS); do \
	  ln -sf $(cmd_prefix)$$i$(pkg_ver) \
	    $(d_gnat)/$(PF)/bin/$$i$(pkg_ver); \
	  ln -sf $(cmd_prefix)gnat$(pkg_ver).1.gz \
	    $(d_gnat)/$(PF)/share/man/man1/$$i$(pkg_ver).1.gz; \
	done

	: # still ship the unversioned names in the gnat package.
	for i in $(GNAT_TOOLS); do \
	  ln -sf $$i$(pkg_ver) \
	    $(d_gnat)/$(PF)/bin/$$i; \
	  ln -sf gnat$(pkg_ver).1.gz \
	    $(d_gnat)/$(PF)/share/man/man1/$$i.1.gz; \
	done

endif

ifneq ($(GFDL_INVARIANT_FREE),yes)
	dh_link -p$(p_gnat) \
		usr/share/man/man1/$(cmd_prefix)gcc$(pkg_ver).1.gz \
		usr/share/man/man1/$(cmd_prefix)gnatgcc.1.gz
endif
ifeq ($(unprefixed_names),yes)
	dh_link -p$(p_gnat) \
		usr/bin/$(cmd_prefix)gnatgcc usr/bin/gnatgcc
  ifneq ($(GFDL_INVARIANT_FREE),yes)
	dh_link -p$(p_gnat) \
		usr/share/man/man1/$(cmd_prefix)gcc$(pkg_ver).1.gz \
		usr/share/man/man1/gnatgcc.1.gz
  endif
endif

ifeq ($(GFDL_INVARIANT_FREE),yes)
	echo '$(p_gnat) binary: binary-without-manpage' \
	  >> $(d_gnat)/usr/share/lintian/overrides/$(p_gnat)
endif

	debian/dh_rmemptydirs -p$(p_gnat)

	echo $(p_gnat) >> debian/arch_binaries

ifeq ($(with_gnatsjlj),yes)
	dh_strip -p$(p_gnatsjlj)
	find $(d_gnatsjlj) -name '*.ali' | xargs $(sed_ali_strip_prefix_map)
	find $(d_gnatsjlj) -name '*.ali' | xargs chmod 444
	dh_shlibdeps -p$(p_gnatsjlj)
	echo $(p_gnatsjlj) >> debian/arch_binaries
endif

	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)


$(build_gnatdoc_stamp): $(build_stamp)
	mkdir -p html
	rm -f html/*.info
	echo -n gnat_ugn gnat_rm gnat-style | xargs -d ' ' -L 1 -P $(USE_CPUS) -I{} \
	  sh -c 'cd html && \
	    echo "generating {}-$(GNAT_VERSION).info"; \
	    makeinfo -I $(srcdir)/gcc/doc/include -I $(srcdir)/gcc/ada \
		-I $(builddir)/gcc \
		-o {}-$(GNAT_VERSION).info \
		$(srcdir)/gcc/ada/{}.texi'
	touch $@

$(binary_stamp)-ada-doc: $(build_html_stamp) $(build_gnatdoc_stamp)
	dh_testdir
	dh_testroot
	mv $(install_stamp) $(install_stamp)-tmp

	rm -rf $(d_gnatd)
	dh_installdirs -p$(p_gnatd) \
		$(PF)/share/info
	cp -p html/gnat*info* $(d_gnatd)/$(PF)/share/info/.
	dh_installdocs -p$(p_gnatd) \
	    html/gnat_ugn.html html/gnat_rm.html html/gnat-style.html
	echo $(p_gnatd) >> debian/indep_binaries

	trap '' 1 2 3 15; touch $@; mv $(install_stamp)-tmp $(install_stamp)