Skip to content

Commit f1a2cad

Browse files
committed
glibc: fixed locale support by adding on-target locale archive generation
1 parent 25c23fe commit f1a2cad

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

packages/devel/glibc/package.mk

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,17 @@ post_makeinstall_target() {
141141
rm -rf $INSTALL/usr/share/i18n/charmaps
142142

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

146148
mkdir -p $INSTALL/usr/share/i18n/locales
147-
cp -PR $ROOT/$PKG_BUILD/localedata/locales/POSIX $INSTALL/usr/share/i18n/locales
149+
cp -PR $ROOT/$PKG_BUILD/localedata/locales/POSIX $INSTALL/usr/share/i18n/locales
150+
cp -PR $ROOT/$PKG_BUILD/localedata/locales/* $INSTALL/usr/share/i18n/locales
151+
else
152+
# prepare locale environment, actual archive generation has to be done on target
153+
cp $PKG_DIR/scripts/locale-gen-archive $INSTALL/usr/bin
154+
ln -s /storage/.config/locale $INSTALL/usr/lib/
148155
fi
149156

150157
# create default configs
@@ -178,3 +185,9 @@ makeinstall_init() {
178185
ln -sf ld.so $INSTALL/lib/ld-linux.so.3
179186
fi
180187
}
188+
189+
post_install() {
190+
if [ "$GLIBC_LOCALES" = yes ]; then
191+
enable_service locale.service
192+
fi
193+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
# generate locale archive containing for some common languages
4+
# TODO: make configurable
5+
mkdir -p /storage/.config/locale
6+
echo "This directory contains the locale archive, please do not delete" > /storage/.config/locale/README
7+
8+
localedef --prefix=$INSTALL -v -c -i de_DE -f UTF-8 de_DE.UTF-8
9+
localedef --prefix=$INSTALL -v -c -i en_US -f UTF-8 en_US.UTF-8
10+
localedef --prefix=$INSTALL -v -c -i es_ES -f UTF-8 es_ES.UTF-8
11+
localedef --prefix=$INSTALL -v -c -i fr_FR -f UTF-8 fr_FR.UTF-8
12+
localedef --prefix=$INSTALL -v -c -i ru_RU -f UTF-8 ru_RU.UTF-8
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description=Generate locale archive if not already there
3+
DefaultDependencies=no
4+
ConditionPathExists=!/storage/.config/locale/locale-archive
5+
After=userconfig.service
6+
7+
[Service]
8+
Type=oneshot
9+
ExecStart=/bin/sh -c "/usr/bin/locale-gen-archive &> /dev/null"
10+
RemainAfterExit=yes
11+
12+
[Install]
13+
WantedBy=sysinit.target

0 commit comments

Comments
 (0)