~ubuntu-branches/ubuntu/raring/gcc-4.7/raring

« back to all changes in this revision

Viewing changes to debian/rules.defs

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-12-17 23:19:46 UTC
  • Revision ID: package-import@ubuntu.com-20111217231946-n668coanjbjgqxq7
Tags: 4.7-20111217-1
* GCC-4.7 snapshot build.
  - Including the GFDL documentation; will stay in experimental
    until the 4.7.0 release sometime next year.
* Update patches for the trunk.
* Update symbols files.
* Build libitm packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- makefile -*-
 
2
# definitions used in more than one Makefile / rules file
 
3
 
 
4
# common vars
 
5
SHELL           = /bin/bash -e  # brace expansion used in rules file
 
6
PWD             := $(shell pwd)
 
7
srcdir          = $(PWD)/src
 
8
builddir        = $(PWD)/build
 
9
stampdir        = stamps
 
10
 
 
11
distribution    := $(shell lsb_release -is)
 
12
distrelease     := $(shell lsb_release -cs)
 
13
 
 
14
# On non official archives, "lsb_release -cs" default to "n/a". Assume
 
15
# sid in that case 
 
16
ifeq ($(distrelease),n/a)
 
17
distrelease     := sid
 
18
endif
 
19
 
 
20
on_buildd := $(shell [ -f /CurrentlyBuilding -o "$$LOGNAME" = buildd ] && echo yes)
 
21
 
 
22
# creates {srcdir,builddir}_{hppa64,neon,spu}
 
23
$(foreach x,srcdir builddir,$(foreach target,hppa64 spu neon,$(eval \
 
24
  $(x)_$(target) := $($(x))-$(target))))
 
25
 
 
26
# for architecture dependent variables and changelog vars
 
27
vafilt = $(subst $(2)=,,$(filter $(2)=%,$(1)))
 
28
# for rules.sonames
 
29
vafilt_defined = 1
 
30
 
 
31
DPKG_VARS               := $(shell dpkg-architecture)
 
32
DEB_BUILD_GNU_TYPE      ?= $(call vafilt,$(DPKG_VARS),DEB_BUILD_GNU_TYPE)
 
33
DEB_HOST_ARCH           ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH)
 
34
DEB_HOST_GNU_CPU        ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_CPU)
 
35
DEB_HOST_GNU_SYSTEM     ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_SYSTEM)
 
36
DEB_HOST_GNU_TYPE       ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_TYPE)
 
37
DEB_HOST_MULTIARCH      ?= $(call vafilt,$(DPKG_VARS),DEB_HOST_MULTIARCH)
 
38
 
 
39
CHANGELOG_VARS := $(shell dpkg-parsechangelog | \
 
40
        sed -n 's/ /_/g;/^[^_]/s/^\([^:]*\):_\(.*\)/\1=\2/p')
 
41
 
 
42
# the name of the source package
 
43
PKGSOURCE := $(call vafilt,$(CHANGELOG_VARS),Source)
 
44
# those are required here too
 
45
SOURCE_VERSION := $(call vafilt,$(CHANGELOG_VARS),Version)
 
46
DEB_VERSION := $(strip $(shell echo $(SOURCE_VERSION) | \
 
47
        sed -e 's/.*://' -e 's/ds[0-9]*//'))
 
48
# epoch used for gcc versions up to 3.3.x, now used for some remaining
 
49
# libraries: libgcc1, libobjc1
 
50
EPOCH := 1
 
51
DEB_EVERSION := $(EPOCH):$(DEB_VERSION)
 
52
BASE_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/\([1-9]\.[0-9]\).*-.*/\1/')
 
53
 
 
54
ifneq (,$(findstring gdc,$(PKGSOURCE)))
 
55
  BASE_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/.*-\([1-9]\.[0-9]\).*-.*/\1/')
 
56
endif
 
57
 
 
58
# push glibc stack traces into stderr
 
59
export LIBC_FATAL_STDERR_=1
 
60
 
 
61
# ---------------------------------------------------------------------------
 
62
# set target
 
63
# - GNU triplet via DEB_TARGET_GNU_TYPE
 
64
# - Debian arch in debian/target
 
65
# - Debian arch via DEB_GCC_TARGET or GCC_TARGET
 
66
#
 
67
# alias
 
68
ifdef GCC_TARGET
 
69
  DEB_GCC_TARGET := $(GCC_TARGET)
 
70
endif
 
71
ifdef DEB_TARGET_GNU_TYPE
 
72
  TARGET_VARS := $(shell dpkg-architecture -f -t$(DEB_TARGET_GNU_TYPE) 2>/dev/null)
 
73
else
 
74
  # allow debian/target to be used instead of DEB_GCC_TARGET - this was requested
 
75
  # by toolchain-source maintainer
 
76
  DEBIAN_TARGET_FILE := $(strip $(if $(wildcard debian/target),$(shell cat debian/target 2>/dev/null)))
 
77
  ifndef DEB_TARGET_ARCH
 
78
    ifneq (,$(DEBIAN_TARGET_FILE))
 
79
      DEB_TARGET_ARCH := $(DEBIAN_TARGET_FILE)
 
80
    else
 
81
      ifdef DEB_GCC_TARGET
 
82
        DEB_TARGET_ARCH := $(DEB_GCC_TARGET)
 
83
      else
 
84
        DEB_TARGET_ARCH := $(DEB_HOST_ARCH)
 
85
      endif
 
86
    endif
 
87
  endif
 
88
  TARGET_VARS := $(shell dpkg-architecture -f -a$(DEB_TARGET_ARCH) 2>/dev/null)
 
89
endif
 
90
 
 
91
DEB_TARGET_ARCH         ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH)
 
92
DEB_TARGET_ARCH_OS      ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_OS)
 
93
DEB_TARGET_ARCH_CPU     ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_ARCH_CPU)
 
94
DEB_TARGET_GNU_CPU      ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_CPU)
 
95
DEB_TARGET_GNU_TYPE     ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_TYPE)
 
96
DEB_TARGET_GNU_SYSTEM   ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_GNU_SYSTEM)
 
97
DEB_TARGET_MULTIARCH    ?= $(call vafilt,$(TARGET_VARS),DEB_HOST_MULTIARCH)
 
98
 
 
99
ifeq ($(DEB_TARGET_ARCH),)
 
100
  $(error Invalid architecure.)
 
101
endif
 
102
 
 
103
# including unversiond symlinks for binaries
 
104
#with_unversioned = yes
 
105
 
 
106
# ---------------------------------------------------------------------------
 
107
# cross-compiler config
 
108
# - typical cross-compiler
 
109
# - reverse cross (built to run on the target)
 
110
# - full canadian
 
111
# - native
 
112
#
 
113
# build != host && host == target : reverse cross (REVERSE_CROSS == yes)
 
114
# build == host && host != target : typical cross (DEB_CROSS == yes)
 
115
# build != host && host != target : canadian (DEB_CROSS == yes)
 
116
# build == host && host == target : native
 
117
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
 
118
  ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_TARGET_GNU_TYPE))
 
119
    DEB_CROSS = yes
 
120
  else
 
121
    REVERSE_CROSS = yes
 
122
  endif
 
123
else
 
124
  ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_TARGET_GNU_TYPE))
 
125
    DEB_CROSS = yes
 
126
  else
 
127
    # first ones are squeeze+1 and maverick
 
128
    ifeq (,$(filter $(distrelease),lenny etch squeeze sid dapper hardy jaunty karmic lucid))
 
129
      with_sysroot = /
 
130
    endif
 
131
  endif
 
132
endif
 
133
 
 
134
# ---------------------------------------------------------------------------
 
135
# cross compiler support
 
136
ifeq ($(DEB_CROSS),yes)
 
137
  # TARGET: Alias to DEB_TARGET_ARCH (Debian arch name)
 
138
  # TP: Target Prefix. Used primarily as a prefix for cross tool
 
139
  #     names (e.g. powerpc-linux-gcc).
 
140
  # TS: Target Suffix. Used primarily at the end of cross compiler
 
141
  #     package names (e.g. gcc-powerpc).
 
142
  # LS: Library Suffix. Used primarily at the end of cross compiler
 
143
  #     library package names (e.g. libgcc-powerpc-cross).
 
144
  DEB_TARGET_ALIAS ?= $(DEB_TARGET_GNU_TYPE)
 
145
  TARGET := $(DEB_TARGET_ARCH)
 
146
  TP :=  $(subst _,-,$(DEB_TARGET_GNU_TYPE))-
 
147
  TS := -$(subst _,-,$(DEB_TARGET_ALIAS))
 
148
  LS := -$(subst _,-,$(DEB_TARGET_ARCH))-cross
 
149
 
 
150
  cross_bin_arch := -$(subst _,-,$(DEB_TARGET_ALIAS))
 
151
  cross_lib_arch := -$(subst _,-,$(DEB_TARGET_ARCH))-cross
 
152
  cmd_prefix := $(DEB_TARGET_GNU_TYPE)-
 
153
 
 
154
  TARGET_ALIAS := $(DEB_TARGET_ALIAS)
 
155
 
 
156
  lib_binaries := indep_binaries
 
157
  cross_shlibdeps = $(SET_CROSS_LIB_PATH) ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something"
 
158
else
 
159
  TARGET_ALIAS := $(DEB_TARGET_GNU_TYPE)
 
160
 
 
161
  ifeq ($(TARGET_ALIAS),i386-gnu)
 
162
    TARGET_ALIAS := i586-gnu
 
163
  endif
 
164
 
 
165
  cmd_prefix :=
 
166
 
 
167
  #ifeq ($(TARGET_ALIAS),i486-linux-gnu)
 
168
  #  TARGET_ALIAS := i686-linux-gnu
 
169
  #endif
 
170
 
 
171
  TARGET_ALIAS := $(subst i386,i486,$(TARGET_ALIAS))
 
172
 
 
173
  # configure as linux-gnu, not linux
 
174
  #ifeq ($(findstring linux,$(TARGET_ALIAS))/$(findstring linux-gnu,$(TARGET_ALIAS)),linux/)
 
175
  #  TARGET_ALIAS := $(TARGET_ALIAS)-gnu
 
176
  #endif
 
177
 
 
178
  # configure as linux, not linux-gnu
 
179
  #TARGET_ALIAS := $(subst linux-gnu,linux,$(TARGET_ALIAS))
 
180
 
 
181
  lib_binaries := arch_binaries
 
182
  cross_shlibdeps :=
 
183
endif
 
184
 
 
185
printarch:
 
186
        @echo DEB_TARGET_ARCH: $(DEB_TARGET_ARCH)
 
187
        @echo DEB_TARGET_ARCH_OS: $(DEB_TARGET_ARCH_OS)
 
188
        @echo DEB_TARGET_ARCH_CPU: $(DEB_TARGET_ARCH_CPU)
 
189
        @echo DEB_TARGET_GNU_SYSTEM: $(DEB_TARGET_GNU_SYSTEM)
 
190
        @echo DEB_TARGET_MULTIARCH: $(DEB_TARGET_MULTIARCH)
 
191
        @echo MULTIARCH_CONFARG: $(MULTIARCH_CONFARG)
 
192
        @echo TARGET_ALIAS: $(TARGET_ALIAS)
 
193
        @echo TP: $(TP)
 
194
        @echo TS: $(TS)
 
195
 
 
196
# -------------------------------------------------------------------
 
197
# bootstrap options
 
198
ifdef WITH_BOOTSTRAP
 
199
  # "yes" is the default and causes a 3-stage bootstrap.
 
200
  # "off" runs a complete build with --disable-bootstrap
 
201
  # "no" means to just build the first stage, and not create the stage1
 
202
  # directory.
 
203
  # "lean" means a lean 3-stage bootstrap, i.e. delete each stage when no
 
204
  # longer needed.
 
205
  with_bootstrap = $(WITH_BOOTSTRAP)
 
206
endif
 
207
ifneq ($(findstring nostrap, $(DEB_BUILD_OPTIONS)),)
 
208
  with_bootstrap := off
 
209
endif
 
210
 
 
211
# -------------------------------------------------------------------
 
212
# stage options
 
213
ifdef DEB_STAGE
 
214
  with_cdev := yes
 
215
  separate_lang := yes
 
216
  # "stage1" is minimal compiler with static libgcc
 
217
  # "stage2" is minimal compiler with shared libgcc
 
218
  ifeq ($(DEB_STAGE),stage1)
 
219
    with_shared_libgcc := no
 
220
  endif
 
221
  ifeq ($(DEB_STAGE),stage2)
 
222
    with_libgcc := yes
 
223
    with_shared_libgcc := yes
 
224
  endif
 
225
endif
 
226
 
 
227
ifeq ($(BACKPORT),true)
 
228
  with_dev := no
 
229
  with_source := yes
 
230
  with_base_only := yes
 
231
endif
 
232
 
 
233
# -------------------------------------------------------------------
 
234
# sysroot options
 
235
ifdef WITH_SYSROOT
 
236
  with_sysroot = $(WITH_SYSROOT)
 
237
endif
 
238
ifdef WITH_BUILD_SYSROOT
 
239
  with_build_sysroot = $(WITH_BUILD_SYSROOT)
 
240
endif
 
241
 
 
242
# -------------------------------------------------------------------
 
243
# for components configuration
 
244
 
 
245
COMMA = ,
 
246
SPACE = $(EMPTY) $(EMPTY)
 
247
 
 
248
# lang= overwrites all of nolang=, overwrites all of WITHOUT_LANG
 
249
 
 
250
DEB_LANG_OPT    := $(filter lang=%,$(DEB_BUILD_OPTIONS))
 
251
DEB_LANG        := $(strip $(subst $(COMMA), ,$(patsubst lang=%,%,$(DEB_LANG_OPT))))
 
252
DEB_NOLANG_OPT  := $(filter nolang=%,$(DEB_BUILD_OPTIONS))
 
253
DEB_NOLANG      := $(strip $(subst $(COMMA), ,$(patsubst nolang=%,%,$(DEB_NOLANG_OPT))))
 
254
lfilt   = $(strip $(if $(DEB_LANG), \
 
255
                $(if $(filter $(1) $(2),$(DEB_LANG)),yes),$(3)))
 
256
nlfilt  = $(strip $(if $(DEB_NOLANG), \
 
257
                $(if $(filter $(1) $(2),$(DEB_NOLANG)),disabled by $(DEB_NOLANG_OPT),$(3))))
 
258
wlfilt  = $(strip $(if $(filter $(1) $(2), $(subst $(COMMA), ,$(WITHOUT_LANG))), \
 
259
                disabled by WITHOUT_LANG=$(WITHOUT_LANG),$(3)))
 
260
envfilt = $(strip $(or $(call lfilt,$(1),$(2)),$(call nlfilt,$(1),$(3)),$(call wlfilt,$(1),$(3)),$(4)))
 
261
 
 
262
# -------------------------------------------------------------------
 
263
# architecture specific config
 
264
 
 
265
# FIXME: libjava is not ported for thumb, this hack only works for
 
266
# separate gcj builds
 
267
ifeq (,$(findstring gcj,$(PKGSOURCE)))
 
268
  ifeq ($(distribution),Ubuntu)
 
269
    with_arm_thumb := yes
 
270
  endif
 
271
  ifeq ($(DEB_TARGET_ARCH),armhf)
 
272
    with_arm_thumb := yes
 
273
  endif
 
274
endif
 
275
 
 
276
# build using fsf or linaro
 
277
ifeq ($(distribution),Ubuntu)
 
278
  ifeq (,$(findstring gnat, $(PKGSOURCE)))
 
279
  ifneq (,$(findstring $(DEB_TARGET_ARCH),armel armhf amd64 i386 powerpc))
 
280
    with_linaro_branch = yes
 
281
  endif
 
282
  endif
 
283
endif
 
284
 
 
285
# check if we're building for armel or armhf
 
286
ifeq ($(DEB_TARGET_ARCH),armhf)
 
287
  float_abi := hard
 
288
else ifneq (,$(filter $(distribution)-$(DEB_TARGET_ARCH), Ubuntu-armel))
 
289
  float_abi := softfp
 
290
else ifneq (,$(filter $(DEB_TARGET_ARCH), arm armel))
 
291
  float_abi := soft
 
292
endif
 
293
 
 
294
# -------------------------------------------------------------------
 
295
# basic config
 
296
 
 
297
# common things ---------------
 
298
# build common packages, where package names don't differ in different
 
299
# gcc versions (fixincludes, libgcj-common) ...
 
300
with_common_pkgs := yes
 
301
# ... and some libraries, which do not change (libgcc1, libmudflap, libssp0).
 
302
with_common_libs := yes
 
303
# XXX: should with_common_libs be "yes" only if this is the default compiler
 
304
# version on the targeted arch?
 
305
 
 
306
# is this a multiarch-enabled build?
 
307
ifeq (,$(filter $(distrelease),lenny etch squeeze dapper hardy jaunty karmic lucid maverick))
 
308
  with_multiarch_lib := yes
 
309
endif
 
310
 
 
311
ifeq (,$(filter $(distrelease),lenny etch squeeze dapper hardy jaunty karmic lucid maverick))
 
312
  multiarch_stage1 := yes
 
313
endif
 
314
 
 
315
# mapping for the non-default biarch multilib / multiarch names
 
316
multiarch_xarch_map = \
 
317
        amd64=i386-linux-gnu \
 
318
        armel=arm-linux-gnueabi \
 
319
        armhf=arm-linux-gnueabihf \
 
320
        i386=x86_64-linux-gnu \
 
321
        powerpc=powerpc64-linux-gnu \
 
322
        ppc64=powerpc-linux-gnu \
 
323
        sparc=sparc64-linux-gnu \
 
324
        sparc64=sparc-linux-gnu \
 
325
        s390=s390x-linux-gnu \
 
326
        s390x=s390-linux-gnu \
 
327
        mips=mips64-linux-gnuabin32,mips64-linux-gnuabi64 \
 
328
        mipsel=mips64el-linux-gnuabin32,mips64el-linux-gnuabi64 \
 
329
        kfreebsd-amd64=i386-kfreebsd-gnu
 
330
xarch_multiarch_names = $(subst $(COMMA),$(SPACE),$(patsubst $(DEB_TARGET_ARCH)=%,%, \
 
331
                $(filter $(DEB_TARGET_ARCH)=%,$(multiarch_xarch_map))))
 
332
 
 
333
ifneq ($(DEB_STAGE),stage1)
 
334
  # build a -base package.
 
335
  ifneq ($(DEB_CROSS),yes)
 
336
    with_gccbase := yes
 
337
  else
 
338
    with_gccxbase := yes
 
339
  endif
 
340
endif
 
341
 
 
342
# build dev packages.
 
343
with_dev := yes
 
344
 
 
345
with_cpp := yes
 
346
 
 
347
# set lang when built from a different source package.
 
348
separate_lang := no
 
349
 
 
350
ifneq (,$(findstring gcc-snapshot, $(PKGSOURCE)))
 
351
  single_package = yes
 
352
  trunk_build = yes
 
353
else ifneq (,$(findstring gcc-linaro, $(PKGSOURCE)))
 
354
  single_package = yes
 
355
  trunk_build = no
 
356
else
 
357
  # --program-suffix=-$(BASE_VERSION)
 
358
  versioned_packages := yes
 
359
endif
 
360
 
 
361
#no_dummy_cpus := ia64 i386 hppa s390 sparc
 
362
#ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(no_dummy_cpus)))
 
363
#  with_base_only       := no
 
364
#  with_common_libs     := yes
 
365
#  with_common_pkgs     := yes
 
366
#else
 
367
#  with_base_only       := yes
 
368
#  with_common_libs     := no
 
369
#  with_common_pkgs     := no
 
370
#  with_dev             := no
 
371
#endif
 
372
 
 
373
ifeq ($(versioned_packages),yes)
 
374
  pkg_ver := -$(BASE_VERSION)
 
375
  PV := $(pkg_ver)
 
376
endif
 
377
 
 
378
# -------------------------------------------------------------------
 
379
# configure languages
 
380
 
 
381
# C ---------------------------
 
382
enabled_languages := c
 
383
 
 
384
# Build all packages needed for C development
 
385
ifneq ($(with_base_only),yes)
 
386
  ifeq ($(with_dev),yes)
 
387
    with_cdev := yes
 
388
  endif
 
389
endif
 
390
 
 
391
ifndef DEB_STAGE
 
392
# Ada --------------------
 
393
ada_no_cpus     := m32r m68k sh3 sh3eb sh4 sh4eb
 
394
ada_no_systems  := gnu knetbsd-gnu
 
395
ada_no_cross    := yes
 
396
ada_no_snap     := no
 
397
ifneq (,$(filter $(DEB_TARGET_ARCH),armhf m68k powerpcspe sh4 sparc64))
 
398
  ada_no_snap := yes
 
399
endif
 
400
 
 
401
ifeq ($(with_dev),yes)
 
402
  ifneq ($(separate_lang),yes)
 
403
    with_ada := yes
 
404
  endif
 
405
endif
 
406
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(ada_no_cpus)))
 
407
  with_ada := disabled for cpu $(DEB_TARGET_ARCH_CPU)
 
408
endif
 
409
ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(ada_no_systems)))
 
410
  with_ada := disabled for system $(DEB_TARGET_GNU_SYSTEM)
 
411
endif
 
412
ifeq ($(ada_no_cross)-$(DEB_CROSS),yes-yes)
 
413
  with_ada := disabled for cross compiler package
 
414
endif
 
415
ifeq ($(ada_no_snap)-$(single_package),yes-yes)
 
416
  with_ada := disabled for snapshot build
 
417
endif
 
418
with_ada := $(call envfilt, ada, , , $(with_ada))
 
419
 
 
420
ifneq ($(single_package),yes)
 
421
  with_separate_gnat := yes
 
422
endif
 
423
ifeq ($(with_ada)-$(with_separate_gnat),yes-yes)
 
424
  ifneq (,$(findstring gnat,$(PKGSOURCE)))
 
425
    languages := c
 
426
    separate_lang := yes
 
427
  else
 
428
    debian_extra_langs += ada
 
429
    with_ada := built from separate source
 
430
    with_libgnat := built from separate source
 
431
  endif
 
432
endif
 
433
 
 
434
ifeq ($(with_ada),yes)
 
435
  enabled_languages += ada
 
436
  with_libgnat := yes
 
437
  # There are two exception handling mechanisms: ZCX (Zero-Cost
 
438
  # eXceptions) and SJLJ (setjump/longjump), selected and supported by
 
439
  # libgnat.  Thus we build both versions of libgnat on architectures
 
440
  # that support both (see ada-sjlj.diff).  Most cpus support both
 
441
  # mechanisms; here, we declare the few that support only one.
 
442
  libgnat_zcx_only_cpus :=
 
443
  libgnat_sjlj_only_cpus := arm armel armhf
 
444
  ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(libgnat_sjlj_only_cpus)))
 
445
    with_gnat_zcx := no
 
446
  else
 
447
    with_gnat_zcx := yes
 
448
  endif
 
449
  ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(libgnat_zcx_only_cpus)))
 
450
    with_gnat_sjlj := no
 
451
  else
 
452
    with_gnat_sjlj := yes
 
453
  endif
 
454
  ifeq ($(with_gnat_zcx)-$(with_gnat_sjlj),no-no)
 
455
    # TODO: support cpus that do not support exceptions at all,
 
456
    # perhaps by building a restricted runtime library?  For now, flag
 
457
    # this as a packaging error.
 
458
    $(error this target supports neither ZCX nor SJLJ)
 
459
  endif
 
460
endif
 
461
 
 
462
# C++ -------------------------
 
463
cxx_no_cpus := avr
 
464
ifneq ($(with_base_only),yes)
 
465
  ifneq ($(separate_lang),yes)
 
466
    with_cxx := yes
 
467
  endif
 
468
endif
 
469
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(cxx_no_cpus)))
 
470
  with_cxx := disabled for cpu $(DEB_TARGET_ARCH_CPU)
 
471
endif
 
472
with_cxx := $(call envfilt, c++, obj-c++ java, , $(with_cxx))
 
473
 
 
474
# Build all packages needed for C++ development
 
475
ifeq ($(with_cxx),yes)
 
476
  ifeq ($(with_dev),yes)
 
477
    with_cxxdev := yes
 
478
    with_libcxxdbg := yes
 
479
  endif
 
480
  ifeq ($(with_common_pkgs),yes)
 
481
    with_libcxx := yes
 
482
  endif
 
483
 
 
484
  # debugging versions of libstdc++
 
485
  ifeq ($(with_cxxdev),yes)
 
486
    with_debug := yes
 
487
    debug_no_cpus :=
 
488
    ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(debug_no_cpus)))
 
489
      with_debug := disabled for cpu $(DEB_TARGET_GNU_CPU)
 
490
    endif
 
491
  endif
 
492
  with_debug := $(call envfilt, debug, , , $(with_debug))
 
493
 
 
494
  enabled_languages += c++
 
495
endif
 
496
 
 
497
# Java --------------------
 
498
# - To build a standalone gcj package (with no corresponding gcc
 
499
#   package): with_separate_libgcj=yes, with_standalone_gcj=yes
 
500
# - To build the java packages from the gcc source package:
 
501
#   with_separate_libgcj=no, with_standalone_gcj=no
 
502
# - To build gcc and java from separate sources:
 
503
#   with_separate_libgcj=yes, with_standalone_gcj=no
 
504
 
 
505
java_no_cpus := # mips mipsel
 
506
java_no_systems := knetbsd-gnu
 
507
java_no_cross := yes
 
508
 
 
509
ifneq ($(single_package),yes)
 
510
  with_separate_libgcj := yes
 
511
endif
 
512
with_standalone_gcj := no
 
513
 
 
514
ifneq ($(separate_lang),yes)
 
515
  with_java := yes
 
516
endif
 
517
 
 
518
# java converted for V3 C++ ABI for some archs
 
519
ifeq ($(with_base_only),yes)
 
520
  with_java := no
 
521
endif
 
522
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(java_no_cpus)))
 
523
  with_java := disabled for cpu $(DEB_TARGET_ARCH_CPU)
 
524
endif
 
525
ifneq (,$(filter $(DEB_TARGET_GNU_SYSTEM),$(java_no_systems)))
 
526
  with_java := disabled for system $(DEB_TARGET_GNU_SYSTEM)
 
527
endif
 
528
ifeq ($(java_no_cross)-$(DEB_CROSS),yes-yes)
 
529
  with_java := diasbled for cross compiler package
 
530
endif
 
531
with_java := $(call envfilt, java, , c++, $(with_java))
 
532
 
 
533
ifeq ($(with_java)-$(with_separate_libgcj),yes-yes)
 
534
  ifneq (,$(findstring gcj, $(PKGSOURCE)))
 
535
    languages := c c++
 
536
    separate_lang := yes
 
537
  else
 
538
    debian_extra_langs += java
 
539
    with_java := built from separate source
 
540
    with_gcj := built from separate source
 
541
    with_libgcj := buit from separate source
 
542
  endif
 
543
endif
 
544
 
 
545
with_java_plugin := no
 
546
 
 
547
ifeq ($(with_java),yes)
 
548
  # use the same names as OpenJDK
 
549
  java_cpu_map = armel=arm armhf=arm hppa=parisc i686=i386 i586=i386 i486=i386 mipsel=mips powerpc=ppc sh4=sh
 
550
  java_cpu = $(patsubst $(DEB_TARGET_ARCH_CPU)=%,%, \
 
551
                         $(filter $(DEB_TARGET_ARCH_CPU)=%,$(java_cpu_map)))
 
552
  ifeq (,$(java_cpu))
 
553
    java_cpu = $(DEB_TARGET_ARCH_CPU)
 
554
  endif
 
555
  java_priority = 10$(subst .,,$(BASE_VERSION))
 
556
 
 
557
  with_libgcj := yes
 
558
  with_libgcjbc := no
 
559
 
 
560
  ifneq (,$(findstring gcj-4,$(PKGSOURCE)))
 
561
    ifneq (,$(filter $(DEB_TARGET_ARCH), arm))
 
562
      with_gcj_base_only := yes
 
563
    endif
 
564
  endif
 
565
 
 
566
  ifeq ($(single_package),yes)
 
567
    with_ecj := yes
 
568
  endif
 
569
 
 
570
  #ifneq (,$(filter $(DEB_TARGET_ARCH),hppa))
 
571
  #  with_native_ecj := yes
 
572
  #endif
 
573
 
 
574
  with_java_maintainer_mode := no
 
575
 
 
576
  # used as well in debian/rules.conf to determine the build deps
 
577
  java_awt_peers = gtk # qt # xlib
 
578
 
 
579
  ifeq ($(with_common_libs),yes)
 
580
    with_libgcj_doc := yes
 
581
  endif
 
582
 
 
583
  # Build all packages needed for Java development (gcj, libgcj-dev)
 
584
  ifeq ($(with_dev),yes)
 
585
    with_javadev := yes
 
586
    with_gcj := yes
 
587
  endif
 
588
 
 
589
  with_java_alsa := yes
 
590
  ifeq (,$(filter $(DEB_TARGET_GNU_SYSTEM),linux-gnu))
 
591
    with_java_alsa := no
 
592
  endif
 
593
 
 
594
  enabled_languages += java
 
595
endif
 
596
 
 
597
# D ---------------------------
 
598
d_no_cross := yes
 
599
d_no_snap := yes
 
600
 
 
601
ifneq ($(single_package),yes)
 
602
  with_separate_gdc := yes
 
603
endif
 
604
 
 
605
ifneq ($(separate_lang),yes)
 
606
  with_d := yes
 
607
endif
 
608
ifeq ($(d_no_snap)-$(single_package),yes-yes)
 
609
  with_d := disabled for snapshot build
 
610
endif
 
611
 
 
612
ifeq ($(with_d)-$(with_separate_gdc),yes-yes)
 
613
  ifneq (,$(findstring gdc,$(PKGSOURCE)))
 
614
    languages := c c++
 
615
    separate_lang := yes
 
616
  else
 
617
    debian_extra_langs += d
 
618
    with_d := built from separate source
 
619
  endif
 
620
endif
 
621
 
 
622
ifeq ($(with_base_only),yes)
 
623
  with_d := no
 
624
endif
 
625
 
 
626
ifeq ($(with_d),yes)
 
627
  # no suffix for D 1.0
 
628
  #libphobos_version :=
 
629
  # still experimental
 
630
  libphobos_version := 2
 
631
 
 
632
  with_libphobos := yes
 
633
 
 
634
  libphobos_no_cpus := alpha avr arm hppa ia64 m68k mips mipsel powerpc ppc64 s390 sh4 sparc sparc64
 
635
  libphobos_no_systems := gnu
 
636
  ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(libphobos_no_cpus)))
 
637
    with_libphobos := disabled for cpu $(DEB_TARGET_ARCH_CPU)
 
638
  endif
 
639
  ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(libphobos_no_systems)))
 
640
    with_libphobos := disabled for system $(DEB_TARGET_GNU_SYSTEM)
 
641
  endif
 
642
 
 
643
  enabled_languages += d
 
644
endif
 
645
 
 
646
# Fortran 95 -------------------
 
647
fortran_no_cross := yes
 
648
fortran_no_cross := no
 
649
 
 
650
ifneq ($(with_base_only),yes)
 
651
  ifneq ($(separate_lang),yes)
 
652
    with_fortran := yes
 
653
  endif
 
654
endif
 
655
ifeq ($(fortran_no_cross)-$(DEB_CROSS),yes-yes)
 
656
  with_fortran := diasbled for cross compiler package
 
657
endif
 
658
with_fortran := $(call envfilt, fortran, , , $(with_fortran))
 
659
 
 
660
# Build all packages needed for Fortran development
 
661
ifeq ($(with_fortran),yes)
 
662
  ifeq ($(with_dev),yes)
 
663
    with_fdev := yes
 
664
  endif
 
665
  ifeq ($(with_common_libs),yes)
 
666
    with_libgfortran := yes
 
667
  endif
 
668
  enabled_languages += fortran
 
669
endif
 
670
 
 
671
# libquadmath -------------------
 
672
 
 
673
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU), ia64 i386 i486 i586 i686 amd64))
 
674
  with_qmath := yes
 
675
  ifneq (,$(findstring gcc-4,$(PKGSOURCE)))
 
676
    ifeq ($(with_common_libs),yes)
 
677
      with_libqmath := yes
 
678
    endif
 
679
  endif
 
680
endif
 
681
 
 
682
# ObjC ------------------------
 
683
objc_no_cross := no
 
684
 
 
685
ifneq ($(with_base_only),yes)
 
686
  ifneq ($(separate_lang),yes)
 
687
    with_objc := yes
 
688
  endif
 
689
endif
 
690
ifeq ($(objc_no_cross)-$(DEB_CROSS),yes-yes)
 
691
  with_objc := diasbled for cross compiler package
 
692
endif
 
693
with_objc := $(call envfilt, objc, obj-c++, , $(with_objc))
 
694
 
 
695
ifeq ($(with_objc),yes)
 
696
  # the ObjC runtime with garbage collection enabled needs the Boehm GC
 
697
  with_objc_gc := yes
 
698
 
 
699
  # disable ObjC garbage collection library (needs libgc)
 
700
  libgc_no_cpus := avr mips mipsel # alpha amd64 arm armel armhf hppa i386 ia64 m68k mips mipsel powerpc ppc64 s390 s390x sparc
 
701
  libgc_no_systems := knetbsd-gnu
 
702
  ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(libgc_no_cpus)))
 
703
    with_objc_gc := disabled for cpu $(DEB_TARGET_ARCH_CPU)
 
704
  endif
 
705
  ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(libgc_no_systems)))
 
706
    with_objc_gc := disabled for system $(DEB_TARGET_GNU_SYSTEM)
 
707
  endif
 
708
 
 
709
  # Build all packages needed for Objective-C development
 
710
  ifeq ($(with_dev),yes)
 
711
    with_objcdev := yes
 
712
  endif
 
713
  # libobjc soname change in 4.7
 
714
  #ifeq ($(with_common_libs),yes)
 
715
    with_libobjc := yes
 
716
  #endif
 
717
 
 
718
  enabled_languages += objc
 
719
endif
 
720
 
 
721
# ObjC++ ----------------------
 
722
objcxx_no_cross := no
 
723
 
 
724
ifneq ($(with_base_only),yes)
 
725
  ifneq ($(separate_lang),yes)
 
726
    with_objcxx := yes
 
727
  endif
 
728
endif
 
729
ifeq ($(objcxx_no_cross)-$(DEB_CROSS),yes-yes)
 
730
  with_objcxx := diasbled for cross compiler package
 
731
endif
 
732
with_objcxx := $(call envfilt, obj-c++, , c++ objc, $(with_objcxx))
 
733
 
 
734
ifeq ($(with_objcxx),yes)
 
735
  enabled_languages += obj-c++
 
736
endif
 
737
 
 
738
# Go -------------------
 
739
go_no_cross := yes
 
740
go_no_cross := no
 
741
 
 
742
go_no_cpus := avr arm hppa ia64 m68k mips mipsel powerpc ppc64 s390 s390x sh4 sparc sparc64
 
743
ifneq ($(trunk_build),yes)
 
744
  go_no_cpus := := $(go_no_cpus) alpha
 
745
endif
 
746
go_no_systems := gnu kfreebsd-gnu
 
747
 
 
748
ifneq ($(with_base_only),yes)
 
749
  ifneq ($(separate_lang),yes)
 
750
    with_go := yes
 
751
  endif
 
752
endif
 
753
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(go_no_cpus)))
 
754
  with_go := disabled for cpu $(DEB_TARGET_ARCH_CPU)
 
755
endif
 
756
ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(go_no_systems)))
 
757
  with_go := disabled for system $(DEB_TARGET_GNU_SYSTEM)
 
758
endif
 
759
ifeq ($(go_no_cross)-$(DEB_CROSS),yes-yes)
 
760
  with_go := diasbled for cross compiler package
 
761
endif
 
762
with_go := $(call envfilt, go, , , $(with_go))
 
763
 
 
764
# Build all packages needed for Go development
 
765
ifeq ($(with_go),yes)
 
766
  ifeq ($(with_common_libs),yes)
 
767
    with_libgo := yes
 
768
  endif
 
769
  enabled_languages += go
 
770
endif
 
771
 
 
772
# -------------------------------------------------------------------
 
773
# other config
 
774
 
 
775
# not built from the main source package
 
776
ifeq (,$(findstring gcc,$(PKGSOURCE)))
 
777
  extra_package := yes
 
778
endif
 
779
 
 
780
with_nls := yes
 
781
ifeq ($(trunk_build),yes)
 
782
  with_nls := no
 
783
endif
 
784
with_nls := $(call envfilt, nls, , , $(with_nls))
 
785
 
 
786
# powerpc nof libraries -----
 
787
with_libnof := no
 
788
 
 
789
ifneq (,$(findstring gcc-4,$(PKGSOURCE)))
 
790
  with_source := yes
 
791
endif
 
792
with_source := $(call envfilt, source, , , $(with_source))
 
793
 
 
794
# ssp & libssp -------------------------
 
795
with_ssp := yes
 
796
ssp_no_archs = alpha hppa ia64 m68k
 
797
ifneq (, $(filter $(DEB_TARGET_ARCH),$(ssp_no_archs) $(ssp_no_archs:%=uclibc-%)))
 
798
  with_ssp := not available on $(DEB_TARGET_ARCH)
 
799
endif
 
800
with_ssp := $(call envfilt, ssp, , , $(with_ssp))
 
801
 
 
802
ifeq ($(with_ssp),yes)
 
803
  ifneq ($(distribution),Debian)
 
804
    ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
 
805
      with_ssp_default := yes
 
806
    endif
 
807
  endif
 
808
endif
 
809
 
 
810
# mudflap -------------------
 
811
with_mudflap := yes
 
812
with_mudflap := $(call envfilt, mudflap, , , $(with_mudflap))
 
813
 
 
814
# gomp --------------------
 
815
with_gomp := yes
 
816
with_gomp := $(call envfilt, gomp, , , $(with_gomp))
 
817
 
 
818
# itm --------------------
 
819
itm_archs = amd64 i386
 
820
ifneq (,$(filter $(DEB_TARGET_ARCH),$(itm_archs)))
 
821
  with_itm := yes
 
822
endif
 
823
with_itm := $(call envfilt, itm, , , $(with_itm))
 
824
 
 
825
# gold --------------------
 
826
# armel with binutils 2.20.51 only
 
827
gold_archs = amd64 armel armhf i386 lpia powerpc ppc64 sparc
 
828
ifneq (,$(filter $(DEB_TARGET_ARCH),$(gold_archs)))
 
829
  with_gold := yes
 
830
endif
 
831
 
 
832
# plugins --------------------
 
833
with_plugins := yes
 
834
 
 
835
endif # ifndef DEB_STAGE
 
836
 
 
837
# Don't include docs with GFDL invariant sections
 
838
GFDL_INVARIANT_FREE := yes
 
839
ifeq ($(distribution),Ubuntu)
 
840
  GFDL_INVARIANT_FREE := no
 
841
endif
 
842
GFDL_INVARIANT_FREE := no
 
843
 
 
844
# -------------------------------------------------------------------
 
845
# non-extra config
 
846
ifeq ($(extra_package),yes)
 
847
  ifeq ($(with_separate_libgcj)-$(with_standalone_gcj),yes-no)
 
848
    # build stuff
 
849
    with_mudflap :=
 
850
 
 
851
    # package stuff
 
852
    with_gccbase := no
 
853
    with_cdev := no
 
854
    with_cxx := no
 
855
    with_cxxdev := no
 
856
  endif
 
857
else
 
858
  # libssp ------------------
 
859
  ifeq ($(with_ssp)-$(with_common_libs),yes-yes)
 
860
    #ifneq ($(DEB_CROSS),yes)
 
861
      with_libssp := $(if $(wildcard $(builddir)/gcc/auto-host.h), \
 
862
                       $(shell if grep -qs '^\#define TARGET_LIBC_PROVIDES_SSP 1' $(builddir)/gcc/auto-host.h; then echo 'libc provides ssp'; else echo 'yes'; fi))
 
863
    #endif
 
864
  endif
 
865
 
 
866
  # libmudflap --------------
 
867
  ifeq ($(with_mudflap)-$(with_common_libs),yes-yes)
 
868
      with_libmudflap := yes
 
869
  endif
 
870
 
 
871
  # libgomp -----------------
 
872
  ifeq ($(with_gomp)-$(with_common_libs),yes-yes)
 
873
    #ifneq ($(DEB_CROSS),yes)
 
874
      with_libgomp := yes
 
875
    #endif
 
876
  endif
 
877
 
 
878
  # libitm -----------------
 
879
  ifeq ($(with_itm)-$(with_common_libs),yes-yes)
 
880
    #ifneq ($(DEB_CROSS),yes)
 
881
      with_libitm := yes
 
882
    #endif
 
883
  endif
 
884
 
 
885
  # libquadmath -----------------
 
886
  ifeq ($(with_qmath)-$(with_common_libs),yes-yes)
 
887
    #ifneq ($(DEB_CROSS),yes)
 
888
      with_libqmath := yes
 
889
    #endif
 
890
  endif
 
891
 
 
892
  # fixincludes -------
 
893
  ifneq ($(DEB_CROSS),yes)
 
894
    ifeq ($(with_common_pkgs),yes)
 
895
      with_fixincl      := yes
 
896
    endif
 
897
  endif
 
898
 
 
899
  # Shared libgcc --------------------
 
900
  ifeq ($(with_common_libs),yes)
 
901
    with_libgcc := yes
 
902
    ifneq ($(DEB_STAGE),stage1)
 
903
      with_shared_libgcc := yes
 
904
    endif
 
905
  endif
 
906
 
 
907
  # libgcc-math --------------------
 
908
  with_libgmath := no
 
909
  ifneq (,$(findstring i486,$(DEB_TARGET_ARCH)))
 
910
    #with_libgccmath := yes
 
911
    #with_lib64gmath := yes
 
912
    #with_libgmathdev := yes
 
913
  endif
 
914
  ifeq ($(DEB_TARGET_ARCH),amd64)
 
915
    #with_libgccmath := yes
 
916
    #with_lib32gmath := yes
 
917
    #with_libgmathdev := yes
 
918
  endif
 
919
 
 
920
  # hppa64 build ----------------
 
921
  hppa64_no_snap := no
 
922
  ifeq ($(DEB_TARGET_ARCH),hppa)
 
923
    with_hppa64 := yes
 
924
  endif
 
925
  ifeq ($(hppa64_no_snap)-$(trunk_build),yes-yes)
 
926
    with_hppa64 := disabled for snapshot build
 
927
  endif
 
928
  with_hppa64 := $(call envfilt, hppa64, , , $(with_hppa64))
 
929
 
 
930
  # spu build -------------------
 
931
  spu_no_snap := no
 
932
  # FTBFS on ppc64, PR 48495
 
933
  ifneq (,$(findstring $(DEB_TARGET_ARCH),powerpc))
 
934
    ifneq ($(DEB_CROSS),yes)
 
935
      with_spu := yes
 
936
    endif
 
937
  endif
 
938
  ifeq ($(spu_no_snap)-$(trunk_build),yes-yes)
 
939
    with_spu := disabled for snapshot build
 
940
  endif
 
941
  with_spu := $(call envfilt, spu, , , $(with_spu))
 
942
 
 
943
  ifeq ($(with_spu),yes)
 
944
    with_spucache := yes
 
945
    with_spumea64 := yes
 
946
  endif
 
947
 
 
948
  # neon build -------------------
 
949
  # FIXME: build as a cross compiler to build on armv4 as well
 
950
  ifneq (,$(findstring gcc-4, $(PKGSOURCE)))
 
951
    ifeq ($(distribution),Ubuntu)
 
952
#      neon_archs = armel armhf
 
953
#      ifneq (, $(filter $(DEB_TARGET_ARCH),$(neon_archs)))
 
954
#        with_neon = yes
 
955
#      endif
 
956
    endif
 
957
  endif
 
958
endif
 
959
 
 
960
# run testsuite ---------------
 
961
with_check := yes
 
962
# if you don't want to run the gcc testsuite, uncomment the next line
 
963
#with_check := disabled by hand
 
964
ifeq ($(with_base_only),yes)
 
965
  with_check := no
 
966
endif
 
967
ifeq ($(DEB_CROSS),yes)
 
968
  with_check := disabled for cross compiler package
 
969
endif
 
970
ifeq ($(REVERSE_CROSS),yes)
 
971
  with_check := disabled for reverse cross build
 
972
endif
 
973
check_no_cpus := m68k
 
974
check_no_systems := gnu
 
975
ifneq (,$(findstring $(DEB_TARGET_ARCH_CPU),$(check_no_cpus)))
 
976
  with_check := disabled for cpu $(DEB_TARGET_ARCH_CPU)
 
977
endif
 
978
ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(check_no_systems)))
 
979
  with_check := disabled for system $(DEB_TARGET_GNU_SYSTEM)
 
980
endif
 
981
ifeq ($(distribution)-$(DEB_HOST_ARCH),Ubuntu-hppa)
 
982
  ifneq ($(single_package),yes)
 
983
    with_check := disabled, testsuite timeouts with expect
 
984
  endif
 
985
endif
 
986
ifneq (,$(findstring gdc,$(PKGSOURCE)))
 
987
  with_check := disabled for D
 
988
endif
 
989
with_check := $(call envfilt, check, , , $(with_check))
 
990
ifdef WITHOUT_CHECK
 
991
  with_check := disabled by environment
 
992
endif
 
993
ifneq ($(findstring nocheck, $(DEB_BUILD_OPTIONS)),)
 
994
  with_check := disabled by DEB_BUILD_OPTIONS
 
995
endif
 
996
#with_check := disabled for this build
 
997
 
 
998
# not a dependency on all archs, but if available, use it for the testsuite
 
999
ifneq (,$(wildcard /usr/bin/localedef))
 
1000
  locale_data = generate
 
1001
endif
 
1002
 
 
1003
all_enabled_languages := $(enabled_languages)
 
1004
languages_without_lang_opt := c++ objc obj-c++
 
1005
 
 
1006
debian_extra_langs := $(subst obj-c++,objcp,$(debian_extra_langs))
 
1007
export debian_extra_langs
 
1008
 
 
1009
# multilib
 
1010
biarch_map := i686=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x s390x=s390 \
 
1011
                x86_64=i686 powerpc64=powerpc mips=mips64 mipsel=mips64el
 
1012
ifeq (,$(filter $(distrelease),lenny etch squeeze sid dapper hardy jaunty karmic lucid))
 
1013
  biarch_map := $(subst i686=,i486=,$(biarch_map))
 
1014
endif
 
1015
ifeq ($(distribution),Ubuntu)
 
1016
  ifeq (,$(filter $(distrelease),dapper hardy jaunty karmic lucid maverick natty))
 
1017
    biarch_map += arm=arm
 
1018
  endif
 
1019
endif
 
1020
biarch_cpu := $(strip $(patsubst $(DEB_TARGET_GNU_CPU)=%,%, \
 
1021
                         $(filter $(DEB_TARGET_GNU_CPU)=%,$(biarch_map))))
 
1022
 
 
1023
biarch64 := no
 
1024
biarch32 := no
 
1025
biarchn32 := no
 
1026
biarchhf := no
 
1027
biarchsf := no
 
1028
flavours :=
 
1029
define gen_biarch
 
1030
  ifneq (yes,$$(call envfilt, biarch, , ,yes))
 
1031
    biarch$1archs :=
 
1032
  endif
 
1033
  ifneq (,$$(findstring /$$(DEB_TARGET_ARCH)/,$$(biarch$1archs)))
 
1034
    biarch$1 := yes
 
1035
    flavours += $1
 
1036
    #biarch$1subdir = $$(biarch_cpu)-$$(DEB_TARGET_GNU_SYSTEM)
 
1037
    biarch$1subdir = $1
 
1038
    ifeq ($$(with_libgcc),yes)
 
1039
      with_lib$1gcc := yes
 
1040
    endif
 
1041
    ifeq ($$(with_libcxx),yes)
 
1042
      with_lib$1cxx := yes
 
1043
    endif
 
1044
    ifeq ($$(with_libcxxdbg),yes)
 
1045
      with_lib$1cxxdbg := yes
 
1046
    endif
 
1047
    ifeq ($$(with_libobjc),yes)
 
1048
      with_lib$1objc := yes
 
1049
    endif
 
1050
    ifeq ($$(with_libgfortran),yes)
 
1051
      with_lib$1gfortran := yes
 
1052
    endif
 
1053
    ifeq ($$(with_libmudflap),yes)
 
1054
      with_lib$1mudflap := yes
 
1055
    endif
 
1056
    ifeq ($$(with_libssp),yes)
 
1057
      with_lib$1ssp := yes
 
1058
    endif
 
1059
    ifeq ($$(with_libgomp),yes)
 
1060
      with_lib$1gomp:= yes
 
1061
    endif
 
1062
    ifeq ($$(with_libitm),yes)
 
1063
      with_lib$1itm:= yes
 
1064
    endif
 
1065
    ifeq ($$(with_libqmath),yes)
 
1066
      with_lib$1qmath := yes
 
1067
    endif
 
1068
    ifeq ($$(with_libgo),yes)
 
1069
      with_lib$1go := yes
 
1070
    endif
 
1071
 
 
1072
    biarch_multidir_names = libiberty libgcc
 
1073
    ifneq (,$$(findstring gcc-, $$(PKGSOURCE)))
 
1074
      biarch_multidir_names += libstdc++-v3 libobjc libgfortran libssp \
 
1075
                                libgomp libmudflap zlib libitm
 
1076
      ifeq ($$(with_objc_gc),yes)
 
1077
        biarch_multidir_names += boehm-gc
 
1078
      endif
 
1079
    endif
 
1080
    ifneq (,$(findstring yes, $(with_java) $(with_go)))
 
1081
      biarch_multidir_names += libffi
 
1082
    endif
 
1083
    ifeq ($(with_fortran),yes)
 
1084
      biarch_multidir_names += libquadmath
 
1085
    endif
 
1086
    ifeq ($(with_go),yes)
 
1087
      biarch_multidir_names += libgo
 
1088
    endif
 
1089
    export biarch_multidir_names
 
1090
    ifneq (,$$(findstring 32,$1))
 
1091
      TARGET64_MACHINE := $$(strip $$(subst $$(DEB_TARGET_GNU_CPU),$$(biarch_cpu), \
 
1092
                                $$(TARGET_ALIAS)))
 
1093
      TARGET32_MACHINE := $$(TARGET_ALIAS)
 
1094
    else
 
1095
      TARGET64_MACHINE := $$(TARGET_ALIAS)
 
1096
      TARGET64_MACHINE := $$(strip $$(subst $$(DEB_TARGET_GNU_CPU),$$(biarch_cpu), \
 
1097
                                $$(TARGET_ALIAS)))
 
1098
    endif
 
1099
    export TARGET32_MACHINE
 
1100
    export TARGET64_MACHINE
 
1101
  endif
 
1102
endef
 
1103
biarch32archs := /amd64/ppc64/kfreebsd-amd64/s390x/
 
1104
biarch64archs := /i386/powerpc/sparc/s390/mips/mipsel/
 
1105
biarchn32archs := /mips/mipsel/
 
1106
ifeq ($(distribution),Ubuntu)
 
1107
  ifeq (,$(filter $(distrelease),dapper hardy jaunty karmic lucid maverick natty))
 
1108
    biarchhfarchs := /armel/
 
1109
    biarchsfarchs := /armhf/
 
1110
  endif
 
1111
endif
 
1112
$(foreach x,32 64 n32 hf sf,$(eval $(call gen_biarch,$(x))))
 
1113
 
 
1114
#ifeq ($(DEB_TARGET_ARCH),ia64)
 
1115
#  biarch32 := yes
 
1116
#endif
 
1117
 
 
1118
ifeq ($(trunk_build),yes)
 
1119
  no_biarch_libs := yes
 
1120
endif
 
1121
ifdef DEB_CROSS_NO_BIARCH
 
1122
  no_biarch_libs := yes
 
1123
endif
 
1124
ifeq ($(with_d)-$(with_separate_gdc),yes-yes)
 
1125
  no_biarch_libs := yes
 
1126
endif
 
1127
 
 
1128
ifeq ($(no_biarch_libs),yes)
 
1129
  with_lib64gcc         := no
 
1130
  with_lib64cxx         := no
 
1131
  with_lib64cxxdbg      := no
 
1132
  with_lib64objc        := no
 
1133
  with_lib64ffi         := no
 
1134
  with_lib64gcj         := no
 
1135
  with_lib64gfortran    := no
 
1136
  with_lib64mudflap     := no
 
1137
  with_lib64ssp         := no
 
1138
  with_lib64go          := no
 
1139
  with_lib64gomp        := no
 
1140
  with_lib64itm         := no
 
1141
  with_lib64qmath       := no
 
1142
 
 
1143
  with_lib32gcc         := no
 
1144
  with_lib32cxx         := no
 
1145
  with_lib32cxxdbg      := no
 
1146
  with_lib32objc        := no
 
1147
  with_lib32ffi         := no
 
1148
  with_lib32gcj         := no
 
1149
  with_lib32gfortran    := no
 
1150
  with_lib32mudflap     := no
 
1151
  with_lib32ssp         := no
 
1152
  with_lib32go          := no
 
1153
  with_lib32gomp        := no
 
1154
  with_lib32itm         := no
 
1155
  with_lib32qmath       := no
 
1156
 
 
1157
  with_libn32gcc        := no
 
1158
  with_libn32cxx        := no
 
1159
  with_libn32cxxdbg     := no
 
1160
  with_libn32objc       := no
 
1161
  with_libn32ffi        := no
 
1162
  with_libn32gcj        := no
 
1163
  with_libn32gfortran   := no
 
1164
  with_libn32mudflap    := no
 
1165
  with_libn32ssp        := no
 
1166
  with_libn32go         := no
 
1167
  with_libn32gomp       := no
 
1168
  with_libn32itm        := no
 
1169
  with_libn32qmath      := no
 
1170
 
 
1171
  with_libhfgcc         := no
 
1172
  with_libhfcxx         := no
 
1173
  with_libhfcxxdbg      := no
 
1174
  with_libhfobjc        := no
 
1175
  with_libhfffi         := no
 
1176
  with_libhfgcj         := no
 
1177
  with_libhfgfortran    := no
 
1178
  with_libhfmudflap     := no
 
1179
  with_libhfssp         := no
 
1180
  with_libhfgo          := no
 
1181
  with_libhfgomp        := no
 
1182
  with_libhfitm         := no
 
1183
  with_libhfqmath       := no
 
1184
 
 
1185
  with_libsfgcc         := no
 
1186
  with_libsfcxx         := no
 
1187
  with_libsfcxxdbg      := no
 
1188
  with_libsfobjc        := no
 
1189
  with_libsfffi         := no
 
1190
  with_libsfgcj         := no
 
1191
  with_libsfgfortran    := no
 
1192
  with_libsfmudflap     := no
 
1193
  with_libsfssp         := no
 
1194
  with_libsfgo          := no
 
1195
  with_libsfgomp        := no
 
1196
  with_libsfitm         := no
 
1197
  with_libsfqmath       := no
 
1198
 
 
1199
  with_java_plugin := no
 
1200
 
 
1201
  ifdef DEB_CROSS_NO_BIARCH
 
1202
    biarch64    := disabled by DEB_CROSS_NO_BIARCH
 
1203
    biarch32    := disabled by DEB_CROSS_NO_BIARCH
 
1204
    biarchn32   := disabled by DEB_CROSS_NO_BIARCH
 
1205
    biarchhf    := disabled by DEB_CROSS_NO_BIARCH
 
1206
    biarchsf    := disabled by DEB_CROSS_NO_BIARCH
 
1207
  endif
 
1208
 
 
1209
  ifeq ($(with_d)-$(with_separate_gdc),yes-yes)
 
1210
    biarch64    := disabled for D
 
1211
    biarch32    := disabled for D
 
1212
    biarchn32   := disabled for D
 
1213
    biarchhf    := disabled for D
 
1214
    biarchsf    := disabled for D
 
1215
  endif
 
1216
 
 
1217
endif
 
1218
 
 
1219
ifneq (,$(filter yes,$(biarch32) $(biarch64) $(biarchn32) $(biarchhf) $(biarchsf)))
 
1220
  multilib := yes
 
1221
endif
 
1222
 
 
1223
multilib_archs = $(sort $(subst /, , $(biarch64archs) $(biarch32archs) $(biarchn32archs) $(biarchhfarchs) $(biarchsfarchs)))
 
1224
 
 
1225
biarchsubdirs := \
 
1226
  $(if $(filter yes,$(biarch64)),$(biarch64subdir),) \
 
1227
  $(if $(filter yes,$(biarch32)),$(biarch32subdir),) \
 
1228
  $(if $(filter yes,$(biarchn32)),$(biarchn32subdir),) \
 
1229
  $(if $(filter yes,$(biarchhf)),$(biarchhfsubdir),) \
 
1230
  $(if $(filter yes,$(biarchsf)),$(biarchsfsubdir),)
 
1231
biarchsubdirs := {$(strip $(shell echo $(biarchsubdirs) | tr " " ","))}
 
1232
 
 
1233
ifeq ($(biarch32),yes)
 
1234
  with_32bit_check := $(strip $(if $(wildcard build/runcheck.out), \
 
1235
                                $(shell cat build/runcheck.out), \
 
1236
                                $(shell CC="gcc -m32" bash debian/runcheck.sh)))
 
1237
endif
 
1238
 
 
1239
ifeq ($(biarch64),yes)
 
1240
  ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),mips mipsel))
 
1241
    with_64bit_check := $(strip $(if $(wildcard build/runcheck.out), \
 
1242
                        $(shell cat build/runcheck.out), \
 
1243
                        $(shell CC="gcc -mabi=64" bash debian/runcheck.sh)))
 
1244
  else
 
1245
    with_64bit_check := $(strip $(if $(wildcard build/runcheck.out), \
 
1246
                        $(shell cat build/runcheck.out), \
 
1247
                        $(shell CC="gcc -m64" bash debian/runcheck.sh)))
 
1248
  endif
 
1249
endif
 
1250
 
 
1251
ifeq ($(biarchn32),yes)
 
1252
  with_n32bit_check := $(strip $(if $(wildcard build/runcheck.out), \
 
1253
                                $(shell cat build/runcheck.out), \
 
1254
                                $(shell CC="gcc -mabi=n32" bash debian/runcheck.sh)))
 
1255
endif
 
1256
 
 
1257
# GNU locales
 
1258
force_gnu_locales := yes
 
1259
locale_no_cpus :=
 
1260
locale_no_systems := knetbsd-gnu
 
1261
ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(locale_no_systems)))
 
1262
  force_gnu_locales := disabled for system $(DEB_TARGET_GNU_SYSTEM)
 
1263
endif
 
1264
 
 
1265
gcc_tarpath             := $(firstword $(wildcard gcc-*.tar.* /usr/src/gcc-$(BASE_VERSION)/gcc-*.tar.*))
 
1266
gcc_tarball             := $(notdir $(gcc_tarpath))
 
1267
gcc_srcdir              := $(subst -dfsg,,$(patsubst %.tar.xz,%,$(patsubst %.tar.lzma,%,$(patsubst %.tar.gz,%,$(gcc_tarball:.tar.bz2=)))))
 
1268
 
 
1269
ifeq ($(with_d),yes)
 
1270
  gdc_tarpath           := $(firstword $(wildcard gdc-*.tar.* /usr/src/gcc-$(BASE_VERSION)/gdc-*.tar.*))
 
1271
  gdc_tarball           := $(notdir $(gdc_tarpath))
 
1272
  gdc_srcdir            := $(patsubst %.tar.xz,%,$(patsubst %.tar.lzma,%,$(patsubst %.tar.gz,%,$(gdc_tarball:.tar.bz2=))))
 
1273
endif
 
1274
 
 
1275
ecj_jar := $(firstword $(wildcard ecj.jar /usr/share/java/eclipse-ecj.jar /usr/share/java/ecj.jar))
 
1276
 
 
1277
unpack_stamp            := $(stampdir)/01-unpack-stamp
 
1278
pre_patch_stamp         := $(stampdir)/02-pre-patch-stamp
 
1279
patch_stamp             := $(stampdir)/02-patch-stamp
 
1280
src_spu_stamp           := $(stampdir)/02-src-spu-stamp
 
1281
control_stamp           := $(stampdir)/03-control-stamp
 
1282
configure_stamp         := $(stampdir)/04-configure-stamp
 
1283
build_stamp             := $(stampdir)/05-build-stamp
 
1284
build_html_stamp        := $(stampdir)/05-build-html-stamp
 
1285
build_locale_stamp      := $(stampdir)/05-build-locale-stamp
 
1286
build_doxygen_stamp     := $(stampdir)/05-build-doxygen-stamp
 
1287
build_javasrc_stamp     := $(stampdir)/05-build-javasrc-stamp
 
1288
build_javadoc_stamp     := $(stampdir)/05-build-javadoc-stamp
 
1289
check_stamp             := $(stampdir)/06-check-stamp
 
1290
check_inst_stamp        := $(stampdir)/06-check-inst-stamp
 
1291
install_stamp           := $(stampdir)/07-install-stamp
 
1292
install_snap_stamp      := $(stampdir)/07-install-snap-stamp
 
1293
binary_stamp            := $(stampdir)/08-binary-stamp
 
1294
 
 
1295
configure_dummy_stamp   := $(stampdir)/04-configure-dummy-stamp
 
1296
build_dummy_stamp       := $(stampdir)/05-build-dummy-stamp
 
1297
install_dummy_stamp     := $(stampdir)/07-install-dummy-stamp
 
1298
 
 
1299
configure_hppa64_stamp  := $(stampdir)/04-configure-hppa64-stamp
 
1300
build_hppa64_stamp      := $(stampdir)/05-build-hppa64-stamp
 
1301
install_hppa64_stamp    := $(stampdir)/07-install-hppa64-stamp
 
1302
 
 
1303
configure_neon_stamp    := $(stampdir)/04-configure-neon-stamp
 
1304
build_neon_stamp                := $(stampdir)/05-build-neon-stamp
 
1305
install_neon_stamp      := $(stampdir)/07-install-neon-stamp
 
1306
 
 
1307
configure_spu_stamp     := $(stampdir)/04-configure-spu-stamp
 
1308
build_spu_stamp         := $(stampdir)/05-build-spu-stamp
 
1309
install_spu_stamp       := $(stampdir)/07-install-spu-stamp
 
1310
 
 
1311
control_dependencies    := $(patch_stamp)
 
1312
 
 
1313
ifeq ($(single_package),yes)
 
1314
    configure_dependencies = $(configure_stamp)
 
1315
    build_dependencies = $(build_stamp)
 
1316
    install_dependencies = $(install_snap_stamp)
 
1317
    ifeq ($(with_check),yes)
 
1318
      check_dependencies += $(check_stamp)
 
1319
    endif
 
1320
else
 
1321
  ifeq ($(with_base_only),yes)
 
1322
    configure_dependencies = $(configure_dummy_stamp)
 
1323
    build_dependencies = $(build_dummy_stamp)
 
1324
    install_dependencies = $(install_dummy_stamp)
 
1325
  else
 
1326
    configure_dependencies = $(configure_stamp)
 
1327
    build_dependencies = $(build_stamp)
 
1328
    install_dependencies = $(install_stamp)
 
1329
    ifeq ($(with_check),yes)
 
1330
      check_dependencies += $(check_stamp)
 
1331
    endif
 
1332
  endif
 
1333
endif
 
1334
 
 
1335
ifneq (,$(findstring gcj-, $(PKGSOURCE)))
 
1336
  ifeq ($(with_gcj_base_only),yes)
 
1337
    configure_dependencies = $(configure_dummy_stamp)
 
1338
    build_dependencies = $(build_dummy_stamp)
 
1339
    install_dependencies = $(install_dummy_stamp)
 
1340
  endif
 
1341
endif
 
1342
 
 
1343
ifeq ($(with_neon),yes)
 
1344
  build_dependencies += $(build_neon_stamp)
 
1345
  install_dependencies += $(install_neon_stamp)
 
1346
endif
 
1347
 
 
1348
ifeq ($(with_hppa64),yes)
 
1349
  build_dependencies += $(build_hppa64_stamp)
 
1350
  ifneq ($(trunk_build),yes)
 
1351
    install_dependencies += $(install_hppa64_stamp)
 
1352
  endif
 
1353
endif
 
1354
 
 
1355
ifeq ($(with_spu),yes)
 
1356
  control_dependencies += $(src_spu_stamp)
 
1357
  build_dependencies += $(build_spu_stamp)
 
1358
  ifneq ($(trunk_build),yes)
 
1359
    install_dependencies += $(install_spu_stamp)
 
1360
  endif
 
1361
endif
 
1362
 
 
1363
build_dependencies += $(check_dependencies)
 
1364
 
 
1365
stamp-dir:
 
1366
        mkdir -p $(stampdir)
 
1367
 
 
1368
ifeq ($(DEB_CROSS),yes)
 
1369
  define cross_mangle_shlibs
 
1370
        sed -i s/$(cross_lib_arch)//g debian/$(1)/DEBIAN/shlibs
 
1371
  endef
 
1372
  define cross_mangle_substvars
 
1373
        sed -i 's/lib[^ ,(]*/&$(cross_lib_arch)/g' debian/$(1).substvars
 
1374
  endef
 
1375
else
 
1376
  define cross_mangle_shlibs
 
1377
  endef
 
1378
  define cross_mangle_substvars
 
1379
  endef
 
1380
endif
 
1381
 
 
1382
ifneq (,$(filter $(DEB_TARGET_ARCH), mips mipsel))
 
1383
  define cross_mangle_control
 
1384
        $(if $(findstring 64,$(1)),sed -i -r '/^(Dep|Rec|Sug)/s/[a-z0-9-]+32[^$(COMMA)]+($(COMMA) *|$$)//g;/^(Dep|Rec|Sug)/s/$(p_lgcc)/$(p_l64gcc)/;/^(Dep|Rec|Sug)/s/ *$(COMMA) *$$//' debian/$(1)/DEBIAN/control,@:)
 
1385
        $(if $(findstring n32,$(1)),sed -i -r '/^(Dep|Rec|Sug)/s/[a-z0-9-]+64[^$(COMMA)]+($(COMMA) *|$$)//g;/^(Dep|Rec|Sug)/s/$(p_lgcc)/$(p_ln32gcc)/;/^(Dep|Rec|Sug)/s/ *$(COMMA) *$$//' debian/$(1)/DEBIAN/control,@:)
 
1386
  endef
 
1387
else
 
1388
  define cross_mangle_control
 
1389
  endef
 
1390
endif