Debian Codegraph @

debian/rules

raw symbols SCIP
1 #! /usr/bin/make -f
2 # -*- makefile -*-
3 # debian/rules file for GNU libc.
4 # Copyright 1998, 1999 by Joel Klecker <[email protected]>
5 # Copyright 2000-2004 Ben Collins <[email protected]>
6 # Copyright 2002-2004 Jeff Bailey <[email protected]>
7 # Copyright 2002-2005 Philip Blundell <[email protected]>
8 # Copyright 2002-2006 Daniel Jacobowitz <[email protected]>
9 # Copyright 2002-2006 GOTO Masanori <[email protected]>
10 # Copyright 2006 Denis Barbier <[email protected]>
11 # Copyright 2006-2025 Aurelien Jarno <[email protected]>
12 # Copyright 2007-2008 Pierre Habouzit <[email protected]>
13 # Copyright 2010-2013 Clint Adams <[email protected]>
14 # Copyright 2012-2019 Adam Conrad <[email protected]>
15 # Copyright 2016-2025 Samuel Thibault <[email protected]>
16 # This Makefile is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
20
21 # What are the phases to building glibc?
22
23 # Unpack main tarball
24 # Do any necessary overlays
25 # Apply patches
26 # Determine how many builds there are to do. For Each build:
27
28 # Create build directory
29 # Configure
30 # Build
31 # Test as desired
32 # Install to package directories
33
34 # Run debian magic to build packages.
35
36 # Things you may need to customise:
37
38 # These are done as absolute paths so that in the case of filesystem size
39 # limitations, they can be overridden and spread all over.
40 build-tree := build-tree
41 debian-tmp = debian/tmp$(filter-out -libc,-$(curpass))
42 stamp := $(CURDIR)/stamp-dir/
43 DUMMY := $(shell mkdir -p $(stamp))
44
45 # Beyond here you shouldn't need to customise anything:
46 include /usr/share/dpkg/architecture.mk
47 include /usr/share/dpkg/pkg-info.mk
48
49 # The minimum package version with which these packages are compatible.
50 shlib_dep_ver = $(DEB_VERSION_UPSTREAM)
51 shlib_dep = $(libc) (>= $(shlib_dep_ver))
52
53 DEB_BUILDDIR ?= $(build-tree)/$(DEB_HOST_ARCH)-$(curpass)
54 DEB_BUILDDIRLIBC ?= $(build-tree)/$(DEB_HOST_ARCH)-libc
55
56 GLIBC_SOURCES = $(filter-out debian $(shell basename $(stamp)) $(build-tree), $(wildcard *))
57
58 # Support multiple makes at once based on number of processors
59 include /usr/share/dpkg/buildopts.mk
60 NJOBS := $(DEB_BUILD_OPTION_PARALLEL:%=-j%)
61
62 # use the package settings, not the settings from the environment
63 define unsetenv
64 unexport $(1)
65 $(1) =
66 endef
67 $(foreach v, CPPFLAGS CFLAGS CXXFLAGS LDFLAGS, $(if $(filter environment,$(origin $(v))),$(eval $(call unsetenv, $(v)))))
68
69 # export debhelper substitution variables
70 export $(build-tree)
71
72 # Default setup
73 GLIBC_PASSES ?= libc
74
75 prefix=/usr
76 bindir=$(prefix)/bin
77 datadir=$(prefix)/share
78 complocaledir=$(prefix)/lib/locale
79 sysconfdir=/etc
80 libexecdir=$(prefix)/lib
81 rootsbindir=/sbin
82 includedir=$(prefix)/include
83 docdir=$(prefix)/share/doc
84 mandir=$(prefix)/share/man
85 sbindir=$(prefix)/sbin
86 vardbdir=/var/lib/misc
87 rtlddir=/lib
88 slibdir=/lib/$(DEB_HOST_MULTIARCH)
89 libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
90 mvec = no
91 debarch=$(curpass)
92
93 rtld_so=$(shell awk 'BEGIN {FS="="} /^ld\.so-version/ {print $$2}' $(DEB_BUILDDIR)/soversions.mk)
94 rtld_target=$(shell readlink $(debian-tmp)$(rtlddir)/$(rtld_so))
95 libc_so=$(shell awk 'BEGIN {FS="="} /^libc\.so-version/ {print "libc.so"$$2}' $(DEB_BUILDDIR)/soversions.mk)
96
97 BASE_CC = gcc
98 BASE_CXX = g++
99 BASE_MIG = mig
100 # If you override DEB_GCC_VERSION, consider adding DEB_CFLAGS_APPEND=-Wno-error.
101 DEB_GCC_VERSION ?= -15
102
103 RUN_TESTSUITE = yes
104 TIMEOUTFACTOR = 25
105
106 # Set cross and native compiler names, including version.
107 CC = $(DEB_HOST_GNU_TYPE)-$(BASE_CC)$(DEB_GCC_VERSION)
108 CXX = $(DEB_HOST_GNU_TYPE)-$(BASE_CXX)$(DEB_GCC_VERSION)
109 MIG = $(DEB_HOST_GNU_TYPE)-$(BASE_MIG)
110 BUILD_CC = $(DEB_BUILD_GNU_TYPE)-$(BASE_CC)
111 BUILD_CXX = $(DEB_BUILD_GNU_TYPE)-$(BASE_CXX)
112
113 # 32-bit MIPS builders have a 2GB memory space. This is not enough to
114 # build test-tgmath3.o with GCC, unless tweaking the garbage collector.
115 ifeq ($(findstring mips,$(DEB_BUILD_ARCH))-$(DEB_BUILD_ARCH_BITS), mips-32)
116 CC += --param ggc-min-expand=10
117 endif
118
119 configure_target := $(DEB_HOST_GNU_TYPE)
120
121 # Normally we'll just use this for --build. If the architecture requires
122 # that build daemons be able to run a particular optimized library, then
123 # they can set the --build to match --host for that optimized build.
124 # Among other things this lets tests run.
125 configure_build := $(DEB_BUILD_GNU_TYPE)
126
127 # Which build pass are we on?
128 curpass = $(filter-out %_,$(subst _,_ ,$@))
129
130 ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
131 DEB_ARCH_REGULAR_PACKAGES = $(libc)-dev
132 DEB_INDEP_REGULAR_PACKAGES =
133 DEB_UDEB_PACKAGES =
134 ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
135 DEB_BUILD_OPTIONS+=nocheck
136 endif
137 else
138 DEB_ARCH_REGULAR_PACKAGES = $(libc) $(libc)-dev $(libc)-dbg libc-bin libc-dev-bin libc-gconv-modules-extra
139 ifeq ($(filter stage2,$(DEB_BUILD_PROFILES)),)
140 DEB_ARCH_REGULAR_PACKAGES += libc-devtools
141 endif
142 DEB_INDEP_REGULAR_PACKAGES = glibc-doc glibc-source libc-l10n locales
143 ifneq ($(filter noudeb,$(DEB_BUILD_PROFILES)),)
144 DEB_UDEB_PACKAGES =
145 else
146 DEB_UDEB_PACKAGES = $(libc)-udeb
147 endif
148 ## Locales can only be pre-generated during native compiles
149 ifeq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
150 DEB_ARCH_REGULAR_PACKAGES += locales-all
151 endif
152 endif
153
154 # Generic kernel version check
155 define kernel_check
156 (if [ $(CURRENT_KERNEL_VERSION) -lt $(1) ]; then \
157 false; \
158 fi)
159 endef
160
161 # Include libidn for both NPTL and FBTL targets.
162 standard-add-ons = libidn,
163
164 # Pull in all the per-arch magic!
165
166 -include debian/sysdeps/$(DEB_HOST_ARCH_OS).mk
167 -include debian/sysdeps/$(DEB_HOST_ARCH).mk
168
169 ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
170 DEB_ARCH_REGULAR_PACKAGES += $(foreach p,$(DEB_ARCH_MULTILIB_PACKAGES), $(if $(findstring -dev,$(p)), $(p)))
171 else
172 DEB_ARCH_REGULAR_PACKAGES += $(DEB_ARCH_MULTILIB_PACKAGES)
173 endif
174
175 # Don't run dh_strip on this package
176 NOSTRIP_$(libc)-dbg = 1
177
178 # Put the debug files from these packages in $(libc)-dbg
179 DEBUG_$(libc) = 1
180
181 ifeq ($(filter stage1 stage2,$(DEB_BUILD_PROFILES)),)
182 ifeq ($(threads),yes)
183 DEB_ARCH_REGULAR_PACKAGES += nscd
184 endif
185 endif
186
187 # And now the rules...
188 include debian/rules.d/*.mk
189
190 clean:: unpatch
191 rm -rf $(patsubst %,debian/tmp-%,$(GLIBC_PASSES))
192 rm -rf $(build-tree)
193 rm -rf $(stamp)
194 rm -rf debian/include
195
196 # Required Debian targets
197 build-arch: $(stamp)info \
198 $(patsubst %,$(stamp)build_%,$(GLIBC_PASSES)) \
199 $(patsubst %,$(stamp)check_%,$(GLIBC_PASSES)) \
200 build-arch-post-check
201
202 ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
203 build-arch: $(stamp)build_C.utf8 \
204 $(stamp)build_locales-all
205 endif
206
207 build-indep: $(stamp)source $(stamp)build_libc
208
209 build: build-arch build-indep
210
211
212 binary-indep: build-indep testroot debian/control $(build-tree) \
213 $(patsubst %,$(stamp)binaryinst_%,$(DEB_INDEP_REGULAR_PACKAGES))
214
215 binary-arch: build-arch testroot debian/control $(build-tree) \
216 $(patsubst %,$(stamp)binaryinst_%,$(DEB_ARCH_REGULAR_PACKAGES)) \
217 $(patsubst %,$(stamp)binaryinst_%,$(DEB_UDEB_PACKAGES))
218
219 binary: binary-indep binary-arch
220
221 testroot:
222 dh_testroot