Skip to content

Commit

Permalink
host-localedef: Compile against glibc-2.28
Browse files Browse the repository at this point in the history
In glibc 2.27 the following change occurred:
"Statically compiled applications attempting to load locales compiled
for the GNU C Library version 2.27 will fail and fall back to the
builtin C/POSIX locale."

This impacts us since upstream buildroot uses a localdef built against
an older eglibc release [0].

This is a combination of my patch to move to glibc and Peter Seiderer's
patch to avoid building all of glibc just for localedef.

 [0] https://bugs.busybox.net/show_bug.cgi?id=11096

Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
[localedef build & fixups:]
Signed-off-by: Peter Seiderer <[email protected]>
[not yet upstream: open-power/op-build#2225]
Signed-off-by: Joel Stanley <[email protected]>
  • Loading branch information
sammj authored and shenki committed May 27, 2019
1 parent b57d8be commit df3156e
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 60 deletions.
50 changes: 0 additions & 50 deletions package/localedef/0001-Don-t-include-xlocale.h.patch

This file was deleted.

63 changes: 63 additions & 0 deletions package/localedef/0001-HACK-only-build-and-install-localedef.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
From 3a32e5840048ef7db7858ce324731be7a82ddf90 Mon Sep 17 00:00:00 2001
From: Michael Olbrich <[email protected]>
Date: Mon, 21 May 2018 16:45:02 +0200
Subject: [PATCH] HACK: only build and install localedef

Signed-off-by: Michael Olbrich <[email protected]>

Upstream: https://git.pengutronix.de/cgit/ptxdist/plain/patches/localedef-glibc-2.27/0001-HACK-only-build-and-install-localedef.patch?id=47116f66f411d4dadfce42c2fdd6d41b351ccfd4
Signed-off-by: Peter Seiderer <[email protected]>
---
Rules | 14 ++++++++++----
locale/Makefile | 6 +++---
2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Rules b/Rules
index 706c8a74..04f3f333 100644
--- a/Rules
+++ b/Rules
@@ -188,10 +188,16 @@ binaries-shared-notests = $(filter-out $(binaries-pie) $(binaries-static), \
$(binaries-all-notests))

ifneq "$(strip $(binaries-shared-notests))" ""
-$(addprefix $(objpfx),$(binaries-shared-notests)): %: %.o \
- $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
- $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
- $(+link)
+$(addprefix $(objpfx),$(binaries-shared-notests)): %: %.o
+ $(CC) -o $@ \
+ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
+ $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
+ $(filter-out $(addprefix $(csu-objpfx),start.o \
+ $(start-installed-name))\
+ $(+preinit) \
+ $(link-extra-libs) \
+ $(common-objpfx)libc% $(+postinit),$^) \
+ $(link-extra-libs)
endif

ifneq "$(strip $(binaries-shared-tests))" ""
diff --git a/locale/Makefile b/locale/Makefile
index fd997227..a8541593 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -32,13 +32,13 @@ categories = ctype messages monetary numeric time paper name \
address telephone measurement identification collate
aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
xlocale localename global-locale coll-lookup
-others = localedef locale
+others = localedef
#others-static = localedef locale
-install-bin = localedef locale
+install-bin = localedef
extra-objs = $(localedef-modules:=.o) $(localedef-aux:=.o) \
$(locale-modules:=.o) $(lib-modules:=.o)

-extra-libs = libBrokenLocale
+#extra-libs = libBrokenLocale
extra-libs-others = $(extra-libs)

libBrokenLocale-routines = broken_cur_max
--
2.19.2

44 changes: 44 additions & 0 deletions package/localedef/0002-HACK-accept-old-toolchains.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
From 3781bea6277974169cb64d676aad19d3ff358212 Mon Sep 17 00:00:00 2001
From: Peter Seiderer <[email protected]>
Date: Thu, 6 Dec 2018 19:10:24 +0100
Subject: [PATCH] HACK: accept old toolchains

Signed-off-by: Peter Seiderer <[email protected]>
---
configure | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index fde57d63..44082866 100755
--- a/configure
+++ b/configure
@@ -4519,7 +4519,7 @@ $as_echo_n "checking version of $AS... " >&6; }
ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*)
+ 2.1[0-9][0-9]*|2.2[4-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;

@@ -4649,7 +4649,7 @@ $as_echo_n "checking version of $LD... " >&6; }
ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*)
+ 2.1[0-9][0-9]*|2.2[4-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;

@@ -5058,7 +5058,7 @@ int
main ()
{

-#if !defined __GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
+#if !defined __GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
#error insufficient compiler
#endif
;
--
2.19.2

2 changes: 1 addition & 1 deletion package/localedef/localedef.hash
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Locally calculated
sha256 9a60f7cdab6fb39adf23a12102f2d950d5f07f0cd7e51e85ec327e07440a79c6 localedef-eglibc-2.14.1-r17443-ptx1.tar.bz2
sha256 877c7b4741501d1762af8ef1a2518bdf2d722947d2e8d48b203e2d83cc600bca glibc-glibc-2.28.tar.gz
43 changes: 34 additions & 9 deletions package/localedef/localedef.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,44 @@
#
################################################################################

LOCALEDEF_VERSION = 2.14.1-r17443-ptx1
LOCALEDEF_SOURCE = localedef-eglibc-$(LOCALEDEF_VERSION).tar.bz2
LOCALEDEF_SITE = http://www.pengutronix.de/software/ptxdist/temporary-src
# Use the same VERSION and SITE as target glibc
LOCALEDEF_VERSION = glibc-2.28
LOCALEDEF_SOURCE = glibc-$(LOCALEDEF_VERSION).tar.gz
LOCALEDEF_SITE = $(call github,bminor,glibc,$(LOCALEDEF_VERSION))

HOST_LOCALEDEF_CONF_OPTS += \
--prefix=/usr \
--with-glibc=./eglibc
HOST_LOCALEDEF_LICENSE = GPL-2.0+ (programs), LGPL-2.1+, BSD-3-Clause, MIT (library)
HOST_LOCALEDEF_LICENSE_FILES = COPYING COPYING.LIB LICENSES

HOST_LOCALEDEF_CONF_ENV = CFLAGS="$(HOST_CFLAGS) -fgnu89-inline"
# Even though we use the autotools-package infrastructure, we have to override
# the default configure commands for since we have to build out-of-tree, but we
# can't use the same 'symbolic link to configure' used with the gcc packages.
define HOST_LOCALEDEF_CONFIGURE_CMDS
mkdir -p $(@D)/build
# Do the configuration
(cd $(@D)/build; \
$(HOST_CONFIGURE_OPTS) \
$(SHELL) $(@D)/configure \
libc_cv_forced_unwind=yes \
libc_cv_ssp=no \
--target=$(GNU_HOST_NAME) \
--host=$(GNU_HOST_NAME) \
--build=$(GNU_HOST_NAME) \
--prefix=/usr \
--with-pkgversion="Buildroot" \
--without-cvs \
--disable-profile \
--without-gd \
--enable-obsolete-rpc)
endef

define HOST_LOCALEDEF_BUILD_CMDS
$(HOST_MAKE_ENV) $(MAKE) $(HOST_LOCALEDEF_MAKE_OPTS) \
-C $(@D)/build locale/others
endef

# The makefile does not implement an install target
# The makefile does not implement an install target for localedef
define HOST_LOCALEDEF_INSTALL_CMDS
$(INSTALL) -D -m 0755 $(@D)/localedef $(HOST_DIR)/bin/localedef
$(INSTALL) -D -m 0755 $(@D)/build/locale/localedef $(HOST_DIR)/bin/localedef
endef

$(eval $(host-autotools-package))

0 comments on commit df3156e

Please sign in to comment.