/usr/src/glibc/debian/rules.d/build.mk is in eglibc-source 2.19-0ubuntu6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # Because variables can be masked at anypoint by declaring
# PASS_VAR, we need to call all variables as $(call xx,VAR)
# This little bit of magic makes it possible:
xx=$(if $($(curpass)_$(1)),$($(curpass)_$(1)),$($(1)))
# We want to log output to a logfile but we also need to preserve the
# return code of the command being run.
# This little bit of magic makes it possible:
# $(call logme, [-a] <log file>, <cmd>)
define logme
(exec 3>&1; exit `( ( ( $(2) ) 2>&1 3>&-; echo $$? >&4) | tee $(1) >&3) 4>&1`)
endef
ifeq ($(DEB_BUILD_PROFILE),bootstrap)
libc_extra_config_options = $(extra_config_options) --disable-sanity-checks \
--enable-hacker-mode
endif
ifdef WITH_SYSROOT
libc_extra_config_options += --with-headers=$(WITH_SYSROOT)/$(includedir)
endif
$(patsubst %,mkbuilddir_%,$(EGLIBC_PASSES)) :: mkbuilddir_% : $(stamp)mkbuilddir_%
$(stamp)mkbuilddir_%: $(stamp)patch $(KERNEL_HEADER_DIR)
@echo Making builddir for $(curpass)
test -d $(DEB_BUILDDIR) || mkdir -p $(DEB_BUILDDIR)
touch $@
$(patsubst %,configure_%,$(EGLIBC_PASSES)) :: configure_% : $(stamp)configure_%
$(stamp)configure_%: $(stamp)mkbuilddir_%
@echo Configuring $(curpass)
rm -f $(DEB_BUILDDIR)/configparms
echo "CC = $(call xx,CC)" >> $(DEB_BUILDDIR)/configparms
echo "CXX = $(call xx,CXX)" >> $(DEB_BUILDDIR)/configparms
echo "BUILD_CC = $(BUILD_CC)" >> $(DEB_BUILDDIR)/configparms
echo "BUILD_CXX = $(BUILD_CXX)" >> $(DEB_BUILDDIR)/configparms
echo "CFLAGS = $(HOST_CFLAGS)" >> $(DEB_BUILDDIR)/configparms
echo "ASFLAGS = $(HOST_CFLAGS)" >> $(DEB_BUILDDIR)/configparms
echo "BUILD_CFLAGS = $(BUILD_CFLAGS)" >> $(DEB_BUILDDIR)/configparms
echo "LDFLAGS = " >> $(DEB_BUILDDIR)/configparms
echo "BASH := /bin/bash" >> $(DEB_BUILDDIR)/configparms
echo "KSH := /bin/bash" >> $(DEB_BUILDDIR)/configparms
echo "SHELL := /bin/bash" >> $(DEB_BUILDDIR)/configparms
echo "LIBGD = no" >> $(DEB_BUILDDIR)/configparms
echo "bindir = $(bindir)" >> $(DEB_BUILDDIR)/configparms
echo "datadir = $(datadir)" >> $(DEB_BUILDDIR)/configparms
echo "localedir = $(localedir)" >> $(DEB_BUILDDIR)/configparms
echo "sysconfdir = $(sysconfdir)" >> $(DEB_BUILDDIR)/configparms
echo "libexecdir = $(libexecdir)" >> $(DEB_BUILDDIR)/configparms
echo "rootsbindir = $(rootsbindir)" >> $(DEB_BUILDDIR)/configparms
echo "includedir = $(call xx,includedir)" >> $(DEB_BUILDDIR)/configparms
echo "docdir = $(docdir)" >> $(DEB_BUILDDIR)/configparms
echo "mandir = $(mandir)" >> $(DEB_BUILDDIR)/configparms
echo "sbindir = $(sbindir)" >> $(DEB_BUILDDIR)/configparms
echo "vardbdir = $(vardbdir)" >> $(DEB_BUILDDIR)/configparms
echo "libdir = $(call xx,libdir)" >> $(DEB_BUILDDIR)/configparms
echo "slibdir = $(call xx,slibdir)" >> $(DEB_BUILDDIR)/configparms
echo "rtlddir = $(call xx,rtlddir)" >> $(DEB_BUILDDIR)/configparms
# Define the installation directory for all calls to make. This avoid
# broken glibc makefiles to spuriously trigger install rules trying to
# overwrite system headers.
echo "install_root = $(CURDIR)/debian/tmp-$(curpass)" >> $(DEB_BUILDDIR)/configparms
# Prevent autoconf from running unexpectedly by setting it to false.
# Also explicitly pass CC down - this is needed to get -m64 on
# Sparc, et cetera.
configure_build=$(call xx,configure_build); \
if [ $(call xx,configure_target) = $$configure_build ]; then \
echo "Checking that we're running at least kernel version: $(call xx,MIN_KERNEL_SUPPORTED)"; \
if ! $(call kernel_check,$(call xx,MIN_KERNEL_SUPPORTED)); then \
configure_build=`echo $$configure_build | sed 's/^\([^-]*\)-\([^-]*\)$$/\1-dummy-\2/'`; \
echo "No. Forcing cross-compile by setting build to $$configure_build."; \
fi; \
fi; \
$(call logme, -a $(log_build), echo -n "Build started: " ; date --rfc-2822 ; echo "---------------") ; \
$(call logme, -a $(log_build), \
cd $(DEB_BUILDDIR) && \
CC="$(call xx,CC)" \
CXX="$(call xx,CXX)" \
AUTOCONF=false \
MAKEINFO=: \
$(CURDIR)/configure \
--host=$(call xx,configure_target) \
--build=$$configure_build --prefix=/usr --without-cvs \
--enable-add-ons=$(standard-add-ons)"$(call xx,add-ons)" \
--enable-profile \
--without-selinux \
--enable-stackguard-randomization \
--enable-obsolete-rpc \
--with-pkgversion="Ubuntu EGLIBC $(DEB_VERSION)" \
--with-bugurl="https://bugs.launchpad.net/ubuntu/+source/eglibc/+bugs" \
$(if $(filter $(pt_chown),yes),--enable-pt_chown) \
$(if $(filter $(threads),no),--disable-nscd) \
$(call xx,with_headers) $(call xx,extra_config_options))
touch $@
$(patsubst %,build_%,$(EGLIBC_PASSES)) :: build_% : $(stamp)build_%
$(stamp)build_%: $(stamp)configure_%
@echo Building $(curpass)
ifeq ($(DEB_BUILD_PROFILE),bootstrap)
$(MAKE) cross-compiling=yes -C $(DEB_BUILDDIR) $(NJOBS) csu/subdir_lib
else
$(call logme, -a $(log_build), $(MAKE) -C $(DEB_BUILDDIR) $(NJOBS))
$(call logme, -a $(log_build), echo "---------------" ; echo -n "Build ended: " ; date --rfc-2822)
if [ $(curpass) = libc ]; then \
I18NPATH=$(CURDIR)/localedata GCONV_PATH=$(DEB_BUILDDIR)/iconvdata localedef --quiet -c -f UTF-8 -i C $(CURDIR)/build-tree/C.UTF-8 ; \
fi
if [ $(curpass) = libc ]; then \
$(MAKE) -C $(DEB_BUILDDIR) $(NJOBS) \
objdir=$(DEB_BUILDDIR) install_root=$(CURDIR)/build-tree/locales-all \
localedata/install-locales; \
sync; \
rdfind -outputname /dev/null -makesymlinks true -removeidentinode false $(CURDIR)/build-tree/locales-all/usr/lib/locale ; \
symlinks -r -s -c $(CURDIR)/build-tree/locales-all/usr/lib/locale ; \
fi
endif
touch $@
$(patsubst %,check_%,$(EGLIBC_PASSES)) :: check_% : $(stamp)check_%
$(stamp)check_%: $(stamp)build_%
@set -e ; \
if [ -n "$(findstring nocheck,$(DEB_BUILD_OPTIONS))" ]; then \
echo "Tests have been disabled via DEB_BUILD_OPTIONS." | tee $(log_results) ; \
elif [ $(call xx,configure_build) != $(call xx,configure_target) ] && \
! $(DEB_BUILDDIR)/elf/ld.so $(DEB_BUILDDIR)/libc.so >/dev/null 2>&1 ; then \
echo "Flavour cross-compiled, tests have been skipped." | tee $(log_results) ; \
elif ! $(call kernel_check,$(call xx,MIN_KERNEL_SUPPORTED)); then \
echo "Kernel too old, tests have been skipped." | tee $(log_results) ; \
elif [ $(call xx,RUN_TESTSUITE) != "yes" ]; then \
echo "Testsuite disabled for $(curpass), skipping tests."; \
echo "Tests have been disabled." > $(log_results) ; \
else \
echo Testing $(curpass) / $(log_results); \
find $(DEB_BUILDDIR) -name '*.out' -exec rm {} ';' ; \
LD_PRELOAD="" LANG="" TIMEOUTFACTOR="50" $(MAKE) -C $(DEB_BUILDDIR) $(NJOBS) -k check 2>&1 | tee $(log_test); \
chmod +x debian/testsuite-checking/convertlog.sh ; \
debian/testsuite-checking/convertlog.sh $(log_test) | tee $(log_results) ; \
if test -f $(log_expected) ; then \
echo "***************" ; \
chmod +x debian/testsuite-checking/compare.sh ; \
debian/testsuite-checking/compare.sh $(log_expected) $(log_results) $(DEB_BUILDDIR) ; \
echo "***************" ; \
else \
echo "*** WARNING ***" ; \
echo "Please generate expected testsuite results for this arch ($(log_expected))!" ; \
echo "*** WARNING ***" ; \
fi ; \
fi
@n=$$(grep '^make.* Error' $(log_test) | wc -l || true); \
echo "TEST SUMMARY $(log_test) ($$n matching lines)"; \
grep '^make.* Error' $(log_test) || true; \
echo "END TEST SUMMARY $(log_test)"
touch $@
$(patsubst %,install_%,$(EGLIBC_PASSES)) :: install_% : $(stamp)install_%
$(stamp)install_%: $(stamp)check_%
@echo Installing $(curpass)
rm -rf $(CURDIR)/debian/tmp-$(curpass)
ifeq ($(DEB_BUILD_PROFILE),bootstrap)
$(call logme, -a $(log_build), $(MAKE) -C $(DEB_BUILDDIR) $(NJOBS) \
cross-compiling=yes install_root=$(CURDIR)/debian/tmp-$(curpass) \
install-bootstrap-headers=yes install-headers )
install -d $(CURDIR)/debian/tmp-$(curpass)/lib
install -m 644 $(DEB_BUILDDIR)/csu/crt[1in].o $(CURDIR)/debian/tmp-$(curpass)/lib
${CC} -nostdlib -nostartfiles -shared -x c /dev/null \
-o $(CURDIR)/debian/tmp-$(curpass)/lib/libc.so
else
: # FIXME: why just needed for ARM multilib?
case "$(curpass)" in \
armhf) \
libgcc_dirs=/lib/arm-linux-gnueabihf; \
if [ -n "$$WITH_BUILD_SYSROOT" ]; then \
libgcc_dirs="$$WITH_BUILD_SYSROOT/usr/arm-linux-gnueabi/lib/arm-linux-gnueabihf $$WITH_BUILD_SYSROOT/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/hf"; \
fi; \
;; \
armel) \
libgcc_dirs=/lib/arm-linux-gnueabi; \
if [ -n "$$WITH_BUILD_SYSROOT" ]; then \
libgcc_dirs="$$WITH_BUILD_SYSROOT/usr/arm-linux-gnueabihf/lib/arm-linux-gnueabi $$WITH_BUILD_SYSROOT/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/sf"; \
fi; \
;; \
esac; \
if [ -n "$$libgcc_dirs" ]; then \
for d in $$libgcc_dirs; do \
if [ -f $$d/libgcc_s.so.1 ]; then \
cp -p $$d/libgcc_s.so.1 $(DEB_BUILDDIR)/; \
break; \
fi; \
done; \
fi
$(MAKE) -C $(DEB_BUILDDIR) \
install_root=$(CURDIR)/debian/tmp-$(curpass) install
# Generate gconv-modules.cache
case $(curpass)-$(call xx,slibdir) in libc-* | *-/lib32 | *-/lib64 | *-/libx32) \
/usr/sbin/iconvconfig --nostdlib --prefix=$(CURDIR)/debian/tmp-$(curpass) \
-o $(CURDIR)/debian/tmp-$(curpass)/$(call xx,libdir)/gconv/gconv-modules.cache \
$(call xx,libdir)/gconv \
;; \
esac
# Generate the list of SUPPORTED locales
if [ $(curpass) = libc ]; then \
$(MAKE) -f debian/generate-supported.mk IN=localedata/SUPPORTED \
OUT=debian/tmp-$(curpass)/usr/share/i18n/SUPPORTED; \
fi
# Create the multiarch directories, and the configuration file in /etc/ld.so.conf.d
if [ $(curpass) = libc ]; then \
mkdir -p debian/tmp-$(curpass)/etc/ld.so.conf.d; \
conffile="debian/tmp-$(curpass)/etc/ld.so.conf.d/$(DEB_HOST_GNU_TYPE).conf"; \
echo "# Multiarch support" > $$conffile; \
echo "$(call xx,slibdir)" >> $$conffile; \
echo "$(call xx,libdir)" >> $$conffile; \
if [ "$(DEB_HOST_GNU_TYPE)" != "$(DEB_HOST_MULTIARCH)" ]; then \
echo "/lib/$(DEB_HOST_GNU_TYPE)" >> $$conffile; \
echo "/usr/lib/$(DEB_HOST_GNU_TYPE)" >> $$conffile; \
fi; \
mkdir -p debian/tmp-$(curpass)/usr/include/$(DEB_HOST_MULTIARCH); \
mv debian/tmp-$(curpass)/usr/include/bits debian/tmp-$(curpass)/usr/include/$(DEB_HOST_MULTIARCH); \
mv debian/tmp-$(curpass)/usr/include/gnu debian/tmp-$(curpass)/usr/include/$(DEB_HOST_MULTIARCH); \
mv debian/tmp-$(curpass)/usr/include/sys debian/tmp-$(curpass)/usr/include/$(DEB_HOST_MULTIARCH); \
mv debian/tmp-$(curpass)/usr/include/fpu_control.h debian/tmp-$(curpass)/usr/include/$(DEB_HOST_MULTIARCH); \
mv debian/tmp-$(curpass)/usr/include/a.out.h debian/tmp-$(curpass)/usr/include/$(DEB_HOST_MULTIARCH); \
mv debian/tmp-$(curpass)/usr/include/ieee754.h debian/tmp-$(curpass)/usr/include/$(DEB_HOST_MULTIARCH); \
fi
# For our biarch libc, add an ld.so.conf.d configuration; this
# is needed because multiarch libc Replaces: libc6-i386 for ld.so, and
# the multiarch ld.so doesn't look at the (non-standard) /lib32, so we
# need path compatibility when biarch and multiarch packages are both
# installed.
case $(call xx,slibdir) in /lib32 | /lib64 | /libx32) \
mkdir -p debian/tmp-$(curpass)/etc/ld.so.conf.d; \
conffile="debian/tmp-$(curpass)/etc/ld.so.conf.d/zz_$(curpass)-biarch-compat.conf"; \
echo "# Legacy biarch compatibility support" > $$conffile; \
echo "$(call xx,slibdir)" >> $$conffile; \
echo "$(call xx,libdir)" >> $$conffile; \
;; \
esac
# handle the non-default multilib for arm targets
case $(curpass) in arm*) \
mkdir -p debian/tmp-$(curpass)/etc/ld.so.conf.d; \
conffile="debian/tmp-$(curpass)/etc/ld.so.conf.d/zz_$(curpass)-biarch-compat.conf"; \
echo "# Multiarch support" > $$conffile; \
echo "$(call xx,slibdir)" >> $$conffile; \
echo "$(call xx,libdir)" >> $$conffile; \
esac
# ARM: add dynamic linker name for the non-default multilib in ldd
if [ $(curpass) = libc ]; then \
case $(DEB_HOST_ARCH) in \
armel) \
sed -i '/RTLDLIST=/s,=\(.*\),="\1 /lib/ld-linux-armhf.so.3",' debian/tmp-$(curpass)/usr/bin/ldd;; \
armhf) \
sed -i '/RTLDLIST=/s,=\(.*\),="\1 /lib/ld-linux.so.3",' debian/tmp-$(curpass)/usr/bin/ldd;; \
esac; \
fi
# Create the ld.so symlink to the multiarch directory
if [ $(curpass) = libc ]; then \
rtld_so="$$(LANG=C LC_ALL=C readelf -l debian/tmp-$(curpass)/usr/bin/iconv | grep 'interpreter' | sed -e 's/.*interpreter: \(.*\)]/\1/g')" ; \
rtld_so="$$(basename $$rtld_so)" ; \
link_name="debian/tmp-$(curpass)/lib/$$rtld_so" ; \
target="$(call xx,slibdir)/$$(readlink debian/tmp-$(curpass)/$(call xx,slibdir)/$$rtld_so)" ; \
ln -s $$target $$link_name ; \
fi
$(call xx,extra_install)
endif
touch $@
$(stamp)source: $(stamp)patch
mkdir -p $(build-tree)
tar -c -J -C .. \
-f $(build-tree)/eglibc-$(EGLIBC_VERSION).tar.xz \
$(EGLIBC_SOURCES)
mkdir -p debian/eglibc-source/usr/src/glibc
tar cf - --files-from debian/eglibc-source.filelist \
| tar -x -C debian/eglibc-source/usr/src/glibc -f -
touch $@
.NOTPARALLEL: $(patsubst %,check_%,$(EGLIBC_PASSES))
|