Skip to content

Commit

Permalink
Use /usr/bin/localedef during qemu builds
Browse files Browse the repository at this point in the history
Enabler for accelerating glibc build with sb2.

Signed-off-by: Juha Kallioinen <juha.kallioinen@jollamobile.com>
Change-Id: Id037b0b356b2eb10f9a05f44d2f936d663599296
  • Loading branch information
kaltsi committed Mar 18, 2013
1 parent 0ca4c1d commit 0ca2356
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
31 changes: 31 additions & 0 deletions eglibc-2.15-use-usrbin-localedef.patch
@@ -0,0 +1,31 @@
diff -Naur eglibc-2.15.old/localedata/Makefile eglibc-2.15/localedata/Makefile
--- eglibc-2.15.old/localedata/Makefile 2011-11-17 21:56:08.000000000 +0000
+++ eglibc-2.15/localedata/Makefile 2013-03-18 15:25:40.078955980 +0000
@@ -159,7 +159,11 @@
# Dependency for the locale files. We actually make it depend only on
# one of the files.
$(addprefix $(objpfx),$(CTYPE_FILES)): %: \
- gen-locale.sh $(common-objpfx)locale/localedef Makefile \
+ if [ -f /usr/bin/localedef ]; then \
+ gen-locale.sh /usr/bin/localedef Makefile \
+ else \
+ gen-locale.sh $(common-objpfx)locale/localedef Makefile \
+ fi\
$(addprefix charmaps/,$(CHARMAPS)) $(addprefix locales/,$(LOCALE_SRCS))
@$(SHELL) -e gen-locale.sh $(common-objpfx) \
'$(if $(cross-localedef), \
@@ -235,8 +239,12 @@
INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))

# Sometimes the whole collection of locale files should be installed.
-LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
-$(common-objpfx)elf/ld.so --library-path $(rpath-link) $(common-objpfx)locale/localedef
+ifeq (,$(wildcard /usr/bin/localedef))
+LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C $(common-objpfx)elf/ld.so --library-path $(rpath-link) $(common-objpfx)locale/localedef
+else
+LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C /usr/bin/localedef
+endif
+
install-locales: $(INSTALL-SUPPORTED-LOCALES)

install-locales-dir:
3 changes: 3 additions & 0 deletions glibc.changes
@@ -1,3 +1,6 @@
* Mon Mar 18 2013 Juha Kallioinen <juha.kallioinen@jollamobile.com> - 2.15
- If available, use /usr/bin/localedef in qemu builds

* Thu Mar 14 2013 Juha Kallioinen <juha.kallioinen@jollamobile.com> - 2.15
- Force -mfpu=vfpv3-d16 for armv7tnhl

Expand Down
19 changes: 14 additions & 5 deletions glibc.spec
Expand Up @@ -35,6 +35,7 @@ Patch9: eglibc-2.15-mips-async-unwind.patch
Patch10: eglibc-2.15-mips-no-n32-n64.patch
Patch11: glibc-2.14-locarchive-fedora.patch
Patch12: eglibc-2.15-disable-multilib.patch
Patch13: eglibc-2.15-use-usrbin-localedef.patch

Provides: ldconfig
# The dynamic linker supports DT_GNU_HASH
Expand Down Expand Up @@ -195,6 +196,9 @@ If unsure if you need this, don't install this package.
%patch10 -p1
%patch11 -p1
%patch12 -p1
%if 0%{?qemu_user_space_build}
%patch13 -p1
%endif

# Not well formatted locales --cvm
sed -i "s|^localedata/locale-eo_EO.diff$||g" debian/patches/series
Expand Down Expand Up @@ -367,11 +371,16 @@ rm locale-archive || :
# by build-locale-archive.
# note that due to qemu-arm emulation behaviour, we need to break this up into multiple invocations.
# see BMC 10526.
find . -name '*_*' -maxdepth 1 | xargs -r -n10 -P1 --verbose \
$olddir/build-%{nptl_target_cpu}-linuxnptl/elf/ld.so \
--library-path $olddir/build-%{nptl_target_cpu}-linuxnptl/ \
$olddir/build-%{nptl_target_cpu}-linuxnptl/locale/localedef \
--prefix ${RPM_BUILD_ROOT} --add-to-archive

localedef_bin="$olddir/build-%{nptl_target_cpu}-linuxnptl/elf/ld.so --library-path $olddir/build-%{nptl_target_cpu}-linuxnptl/ $olddir/build-%{nptl_target_cpu}-linuxnptl/locale/localedef"

%if 0%{?qemu_user_space_build}
if [ -f /usr/bin/localedef ]; then
localedef_bin=/usr/bin/localedef
fi
%endif

find . -name '*_*' -maxdepth 1 | xargs -r -n10 -P1 --verbose $localedef_bin --prefix ${RPM_BUILD_ROOT} --add-to-archive

rm -rf *_*
mv locale-archive{,.tmpl}
Expand Down

0 comments on commit 0ca2356

Please sign in to comment.