Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glibc: fixed locale support by adding on-target locale archive genera… #4434

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions packages/devel/glibc/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fi
NSS_CONF_DIR="$PKG_BUILD/nss"

GLIBC_EXCLUDE_BIN="catchsegv gencat getconf iconv iconvconfig ldconfig lddlibc4"
GLIBC_EXCLUDE_BIN="$GLIBC_EXCLUDE_BIN localedef makedb mtrace pcprofiledump"
GLIBC_EXCLUDE_BIN="$GLIBC_EXCLUDE_BIN makedb mtrace pcprofiledump"
GLIBC_EXCLUDE_BIN="$GLIBC_EXCLUDE_BIN pldd rpcgen sln sotruss sprof tzselect"
GLIBC_EXCLUDE_BIN="$GLIBC_EXCLUDE_BIN xtrace zdump zic"

Expand Down Expand Up @@ -137,14 +137,18 @@ post_makeinstall_target() {
rm -rf $INSTALL/usr/lib/*.map
rm -rf $INSTALL/var

# remove locales and charmaps
rm -rf $INSTALL/usr/share/i18n/charmaps

if [ ! "$GLIBC_LOCALES" = yes ]; then
# remove locales and charmaps
rm -rf $INSTALL/usr/share/i18n/charmaps
rm -rf $INSTALL/usr/share/i18n/locales

mkdir -p $INSTALL/usr/share/i18n/locales
cp -PR $ROOT/$PKG_BUILD/localedata/locales/POSIX $INSTALL/usr/share/i18n/locales
cp -PR $ROOT/$PKG_BUILD/localedata/locales/POSIX $INSTALL/usr/share/i18n/locales
cp -PR $ROOT/$PKG_BUILD/localedata/locales/* $INSTALL/usr/share/i18n/locales
else
# prepare locale environment, actual archive generation has to be done on target
cp $PKG_DIR/scripts/locale-gen-archive $INSTALL/usr/bin
ln -s /storage/.config/locale $INSTALL/usr/lib/
fi

# create default configs
Expand Down Expand Up @@ -178,3 +182,9 @@ makeinstall_init() {
ln -sf ld.so $INSTALL/lib/ld-linux.so.3
fi
}

post_install() {
if [ "$GLIBC_LOCALES" = yes ]; then
enable_service locale.service
fi
}
12 changes: 12 additions & 0 deletions packages/devel/glibc/scripts/locale-gen-archive
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# generate locale archive containing for some common languages
# TODO: make configurable
mkdir -p /storage/.config/locale
echo "This directory contains the locale archive, please do not delete" > /storage/.config/locale/README

localedef --prefix=$INSTALL -v -c -i de_DE -f UTF-8 de_DE.UTF-8
localedef --prefix=$INSTALL -v -c -i en_US -f UTF-8 en_US.UTF-8
localedef --prefix=$INSTALL -v -c -i es_ES -f UTF-8 es_ES.UTF-8
localedef --prefix=$INSTALL -v -c -i fr_FR -f UTF-8 fr_FR.UTF-8
localedef --prefix=$INSTALL -v -c -i ru_RU -f UTF-8 ru_RU.UTF-8
13 changes: 13 additions & 0 deletions packages/devel/glibc/system.d/locale.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Generate locale archive if not already there
DefaultDependencies=no
ConditionPathExists=!/storage/.config/locale/locale-archive
After=userconfig.service

[Service]
Type=oneshot
ExecStart=/bin/sh -c "/usr/bin/locale-gen-archive &> /dev/null"
RemainAfterExit=yes

[Install]
WantedBy=sysinit.target
4 changes: 3 additions & 1 deletion scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ if [ ! -f $STAMP ]; then
rm -rf $i/share/doc
rm -rf $i/share/gtk-doc
rm -rf $i/share/info
rm -rf $i/share/locale
if [ ! "$GLIBC_LOCALES" = yes ]; then
rm -rf $i/share/locale
fi
rm -rf $i/share/man
rm -rf $i/share/pkgconfig
find $i -name "*.la" -exec rm -f "{}" ";" 2>/dev/null || true
Expand Down