1 # Because variables can be masked at anypoint by declaring
2 # PASS_VAR, we need to call all variables as $(call xx,VAR)
3 # This little bit of magic makes it possible:
4 xx=$(if $($(curpass)_$(1)),$($(curpass)_$(1)),$($(1)))
6 # We want to log output to a logfile but we also need to preserve the
7 # return code of the command being run.
8 # This little bit of magic makes it possible:
9 # $(call logme, [-a] <log file>, <cmd>)
11 (exec 3>&1; exit `( ( ( $(2) ) 2>&1 3>&-; echo $$? >&4) | tee $(1) >&3) 4>&1`)
15 $(patsubst %,mkbuilddir_%,$(EGLIBC_PASSES)) :: mkbuilddir_% : $(stamp)mkbuilddir_%
16 $(stamp)mkbuilddir_%: $(stamp)patch $(KERNEL_HEADER_DIR)
17 @echo Making builddir for $(curpass)
18 test -d $(DEB_BUILDDIR) || mkdir -p $(DEB_BUILDDIR)
21 $(patsubst %,configure_%,$(EGLIBC_PASSES)) :: configure_% : $(stamp)configure_%
22 $(stamp)configure_%: $(stamp)mkbuilddir_%
23 @echo Configuring $(curpass)
24 rm -f $(DEB_BUILDDIR)/configparms
25 echo "CC = $(call xx,CC)" >> $(DEB_BUILDDIR)/configparms
26 echo "CXX = $(call xx,CXX)" >> $(DEB_BUILDDIR)/configparms
27 echo "BUILD_CC = $(BUILD_CC)" >> $(DEB_BUILDDIR)/configparms
28 echo "BUILD_CXX = $(BUILD_CXX)" >> $(DEB_BUILDDIR)/configparms
29 echo "CFLAGS = $(HOST_CFLAGS)" >> $(DEB_BUILDDIR)/configparms
30 echo "ASFLAGS = $(HOST_CFLAGS)" >> $(DEB_BUILDDIR)/configparms
31 echo "BUILD_CFLAGS = $(BUILD_CFLAGS)" >> $(DEB_BUILDDIR)/configparms
32 echo "LDFLAGS = " >> $(DEB_BUILDDIR)/configparms
33 echo "BASH := /bin/bash" >> $(DEB_BUILDDIR)/configparms
34 echo "KSH := /bin/bash" >> $(DEB_BUILDDIR)/configparms
35 echo "SHELL := /bin/bash" >> $(DEB_BUILDDIR)/configparms
36 echo "LIBGD = no" >> $(DEB_BUILDDIR)/configparms
37 echo "have-fpie = $(fpie)" >> $(DEB_BUILDDIR)/configparms
38 echo "bindir = $(bindir)" >> $(DEB_BUILDDIR)/configparms
39 echo "datadir = $(datadir)" >> $(DEB_BUILDDIR)/configparms
40 echo "localedir = $(localedir)" >> $(DEB_BUILDDIR)/configparms
41 echo "sysconfdir = $(sysconfdir)" >> $(DEB_BUILDDIR)/configparms
42 echo "libexecdir = $(libexecdir)" >> $(DEB_BUILDDIR)/configparms
43 echo "rootsbindir = $(rootsbindir)" >> $(DEB_BUILDDIR)/configparms
44 echo "includedir = $(call xx,includedir)" >> $(DEB_BUILDDIR)/configparms
45 echo "docdir = $(docdir)" >> $(DEB_BUILDDIR)/configparms
46 echo "mandir = $(mandir)" >> $(DEB_BUILDDIR)/configparms
47 echo "sbindir = $(sbindir)" >> $(DEB_BUILDDIR)/configparms
48 echo "libdir = $(call xx,libdir)" >> $(DEB_BUILDDIR)/configparms
49 echo "slibdir = $(call xx,slibdir)" >> $(DEB_BUILDDIR)/configparms
50 rtlddir="$(call xx,rtlddir)" ; if test -n "$$rtlddir" ; then \
51 echo "rtlddir = $$rtlddir" >> $(DEB_BUILDDIR)/configparms ; \
54 # Prevent autoconf from running unexpectedly by setting it to false.
55 # Also explicitly pass CC down - this is needed to get -m64 on
58 configure_build=$(call xx,configure_build); \
59 if [ $(call xx,configure_target) = $$configure_build ]; then \
60 echo "Checking that we're running at least kernel version: $(call xx,MIN_KERNEL_SUPPORTED)"; \
61 if ! $(call kernel_check,$(call xx,MIN_KERNEL_SUPPORTED)); then \
62 configure_build=`echo $$configure_build | sed 's/^\([^-]*\)-\([^-]*\)$$/\1-dummy-\2/'`; \
63 echo "No. Forcing cross-compile by setting build to $$configure_build."; \
66 $(call logme, -a $(log_build), echo -n "Build started: " ; date --rfc-2822 ; echo "---------------") ; \
67 $(call logme, -a $(log_build), \
68 cd $(DEB_BUILDDIR) && \
70 CXX="$(call xx,CXX)" \
74 --host=$(call xx,configure_target) \
75 --build=$$configure_build --prefix=/usr --without-cvs \
76 --enable-add-ons=$(standard-add-ons)"$(call xx,add-ons)" \
79 --enable-stackguard-randomization \
80 --with-pkgversion="Debian EGLIBC $(DEB_VERSION)" \
81 --with-bugurl="http://www.debian.org/Bugs/" \
82 $(call xx,with_headers) $(call xx,extra_config_options))
85 $(patsubst %,build_%,$(EGLIBC_PASSES)) :: build_% : $(stamp)build_%
86 $(stamp)build_%: $(stamp)configure_%
87 @echo Building $(curpass)
88 $(call logme, -a $(log_build), $(MAKE) -C $(DEB_BUILDDIR) $(NJOBS))
89 $(call logme, -a $(log_build), echo "---------------" ; echo -n "Build ended: " ; date --rfc-2822)
90 if [ $(curpass) = libc ]; then \
91 $(MAKE) -C $(DEB_BUILDDIR) $(NJOBS) \
92 objdir=$(DEB_BUILDDIR) install_root=$(CURDIR)/build-tree/locales-all \
93 localedata/install-locales; \
94 tar --use-compress-program /usr/bin/lzma --owner root --group root -cf $(CURDIR)/build-tree/locales-all/supported.tar.lzma -C $(CURDIR)/build-tree/locales-all/usr/lib/locale .; \
98 $(patsubst %,check_%,$(EGLIBC_PASSES)) :: check_% : $(stamp)check_%
99 $(stamp)check_%: $(stamp)build_%
101 if [ -n "$(findstring nocheck,$(DEB_BUILD_OPTIONS))" ]; then \
102 echo "Tests have been disabled via DEB_BUILD_OPTIONS." | tee $(log_results) ; \
103 elif [ $(call xx,configure_build) != $(call xx,configure_target) ] && \
104 ! $(DEB_BUILDDIR)/elf/ld.so $(DEB_BUILDDIR)/libc.so >/dev/null 2>&1 ; then \
105 echo "Flavour cross-compiled, tests have been skipped." | tee $(log_results) ; \
106 elif ! $(call kernel_check,$(call xx,MIN_KERNEL_SUPPORTED)); then \
107 echo "Kernel too old, tests have been skipped." | tee $(log_results) ; \
108 elif [ $(call xx,RUN_TESTSUITE) != "yes" ]; then \
109 echo "Testsuite disabled for $(curpass), skipping tests."; \
110 echo "Tests have been disabled." > $(log_results) ; \
112 echo Testing $(curpass); \
113 find $(DEB_BUILDDIR) -name '*.out' -exec rm {} ';' ; \
114 LANG="" TIMEOUTFACTOR="50" $(MAKE) -C $(DEB_BUILDDIR) -k check 2>&1 | tee $(log_test); \
115 chmod +x debian/testsuite-checking/convertlog.sh ; \
116 debian/testsuite-checking/convertlog.sh $(log_test) | tee $(log_results) ; \
117 if test -f $(log_expected) ; then \
118 echo "***************" ; \
119 chmod +x debian/testsuite-checking/compare.sh ; \
120 debian/testsuite-checking/compare.sh $(log_expected) $(log_results) ; \
121 echo "***************" ; \
123 echo "*** WARNING ***" ; \
124 echo "Please generate expected testsuite results for this arch!" ; \
125 echo "*** WARNING ***" ; \
130 $(patsubst %,install_%,$(EGLIBC_PASSES)) :: install_% : $(stamp)install_%
131 $(stamp)install_%: $(stamp)check_%
132 @echo Installing $(curpass)
133 rm -rf $(CURDIR)/debian/tmp-$(curpass)
134 $(MAKE) -C $(DEB_BUILDDIR) \
135 install_root=$(CURDIR)/debian/tmp-$(curpass) install
137 ifneq (,$(findstring $(call xx,slibdir), /lib /lib32 /lib64))
138 # Generate gconv-modules.cache
139 /usr/sbin/iconvconfig --nostdlib --prefix=$(CURDIR)/debian/tmp-$(curpass) \
140 -o $(CURDIR)/debian/tmp-$(curpass)/$(call xx,libdir)/gconv/gconv-modules.cache \
141 $(call xx,libdir)/gconv
144 # Generate the list of SUPPORTED locales
145 if [ $(curpass) = libc ]; then \
146 $(MAKE) -f debian/generate-supported.mk IN=localedata/SUPPORTED \
147 OUT=debian/tmp-$(curpass)/usr/share/i18n/SUPPORTED; \
150 # Create the multiarch directories, and the configuration file in /etc/ld.so.conf.d
151 if [ $(curpass) = libc ]; then \
152 mkdir -p debian/tmp-$(curpass)/etc/ld.so.conf.d; \
153 machine=`sed '/^ *config-machine *=/!d;s/.*= *//g' $(DEB_BUILDDIR)/config.make`; \
154 os=`sed '/^ *config-os *=/!d;s/.*= *//g;s/gnu-gnu/gnu/' $(DEB_BUILDDIR)/config.make`; \
155 triplet="$$machine-$$os"; \
156 mkdir -p debian/tmp-$(curpass)/lib/$$triplet debian/tmp-$(curpass)/usr/lib/$$triplet; \
157 conffile="debian/tmp-$(curpass)/etc/ld.so.conf.d/$$triplet.conf"; \
158 echo "# Multiarch support" > $$conffile; \
159 echo /lib/$$triplet >> $$conffile; \
160 echo /usr/lib/$$triplet >> $$conffile; \
163 $(call xx,extra_install)
166 $(stamp)doc: $(stamp)patch
167 make -C $(CURDIR)/linuxthreads/man
170 $(stamp)source: $(stamp)patch
171 mkdir -p $(build-tree)
173 -f $(build-tree)/eglibc-$(EGLIBC_VERSION).tar.xz \
177 .NOTPARALLEL: $(patsubst %,check_%,$(EGLIBC_PASSES))