[v2] musl-locales: Add package

Message ID 20220422061052.2577710-1-raj.khem@gmail.com
State Accepted, archived
Commit 5643f9722db250ac9eb4f955b02500420cb29556
Headers show
Series [v2] musl-locales: Add package | expand

Commit Message

Khem Raj April 22, 2022, 6:10 a.m. UTC
This package will provide a limited set of localedata for musl based
systems. It will fill in into images when IMAGE_LINGUAS variable is set
however the choice is limited to the given 13 locales as of now.

e.g.
IMAGE_LINGUAS ?= "de-de fr-fr en-gb"

would work fine

Default locale can be set by exporting LANG=<locale> in /etc/profile or some
such file e.g.

export LANG=de_DE.UTF-8

This will also help in ptest coverage with musl where some test packages
expect locales e.g. pango to name one.

Do not empty out IMAGE_LINGUAS forcibly for musl anymore

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2:
- Fix typo in LICENSE for musl-locales output package
- Do not reset IMAGE_LINGUAS for musl

 meta/conf/distro/include/maintainers.inc   |  1 +
 meta/conf/distro/include/tclibc-musl.inc   |  3 +-
 meta/recipes-core/musl/musl-locales_git.bb | 73 ++++++++++++++++++++++
 3 files changed, 75 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-core/musl/musl-locales_git.bb

Comments

Luca Ceresoli April 22, 2022, 12:19 p.m. UTC | #1
Hi Khem,

Il giorno Thu, 21 Apr 2022 23:10:52 -0700
"Khem Raj" <raj.khem@gmail.com> ha scritto:

> This package will provide a limited set of localedata for musl based
> systems. It will fill in into images when IMAGE_LINGUAS variable is
> set however the choice is limited to the given 13 locales as of now.
> 
> e.g.
> IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
> 
> would work fine
> 
> Default locale can be set by exporting LANG=<locale> in /etc/profile
> or some such file e.g.
> 
> export LANG=de_DE.UTF-8
> 
> This will also help in ptest coverage with musl where some test
> packages expect locales e.g. pango to name one.
> 
> Do not empty out IMAGE_LINGUAS forcibly for musl anymore
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>

This patch is triggering build failures:

https://autobuilder.yoctoproject.org/typhoon/#/builders/23/builds/5401/steps/13/logs/stdio

Best regards.
Khem Raj April 22, 2022, 5:39 p.m. UTC | #2
On Fri, Apr 22, 2022 at 5:19 AM Luca Ceresoli <luca.ceresoli@bootlin.com> wrote:
>
> Hi Khem,
>
> Il giorno Thu, 21 Apr 2022 23:10:52 -0700
> "Khem Raj" <raj.khem@gmail.com> ha scritto:
>
> > This package will provide a limited set of localedata for musl based
> > systems. It will fill in into images when IMAGE_LINGUAS variable is
> > set however the choice is limited to the given 13 locales as of now.
> >
> > e.g.
> > IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
> >
> > would work fine
> >
> > Default locale can be set by exporting LANG=<locale> in /etc/profile
> > or some such file e.g.
> >
> > export LANG=de_DE.UTF-8
> >
> > This will also help in ptest coverage with musl where some test
> > packages expect locales e.g. pango to name one.
> >
> > Do not empty out IMAGE_LINGUAS forcibly for musl anymore
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
>
> This patch is triggering build failures:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/23/builds/5401/steps/13/logs/stdio
>

strange !. I even tried with your master-next branch
poky-contrib/lucaceresoli/master-next
and cherry-picking this patch on top and doing build-appliance-image
build. it does not show
this error. So something is amiss here.

This recipe has COMPATIBLE_HOST = ".*-musl.*"
which means glibc build should not even see it.

> Best regards.
> --
> Luca Ceresoli, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

Patch

diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 8bbcf071603..8efa27324f3 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -519,6 +519,7 @@  RECIPE_MAINTAINER:pn-mtd-utils = "Denys Dmytriyenko <denis@denix.org>"
 RECIPE_MAINTAINER:pn-mtdev = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER:pn-mtools = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER:pn-musl = "Khem Raj <raj.khem@gmail.com>"
+RECIPE_MAINTAINER:pn-musl-locales = "Khem Raj <raj.khem@gmail.com>"
 RECIPE_MAINTAINER:pn-musl-obstack = "Khem Raj <raj.khem@gmail.com>"
 RECIPE_MAINTAINER:pn-musl-utils = "Khem Raj <raj.khem@gmail.com>"
 RECIPE_MAINTAINER:pn-nasm = "Richard Purdie <richard.purdie@linuxfoundation.org>"
diff --git a/meta/conf/distro/include/tclibc-musl.inc b/meta/conf/distro/include/tclibc-musl.inc
index 8badbbb40a6..98d7a801ac8 100644
--- a/meta/conf/distro/include/tclibc-musl.inc
+++ b/meta/conf/distro/include/tclibc-musl.inc
@@ -10,6 +10,7 @@  PREFERRED_PROVIDER_virtual/libc ?= "musl"
 PREFERRED_PROVIDER_virtual/libiconv ?= "musl"
 PREFERRED_PROVIDER_virtual/libintl ?= "musl"
 PREFERRED_PROVIDER_virtual/crypt ?= "musl"
+PREFERRED_PROVIDER_virtual/libc-locale ?= "musl-locales"
 PREFERRED_PROVIDER_virtual/nativesdk-libintl ?= "nativesdk-glibc"
 PREFERRED_PROVIDER_virtual/nativesdk-libiconv ?= "nativesdk-glibc"
 
@@ -19,8 +20,6 @@  DISTRO_FEATURES_BACKFILL_CONSIDERED += "ldconfig"
 
 CXXFLAGS += "-fvisibility-inlines-hidden"
 
-IMAGE_LINGUAS = ""
-
 LIBC_DEPENDENCIES = "\
     musl \
     musl-dbg \
diff --git a/meta/recipes-core/musl/musl-locales_git.bb b/meta/recipes-core/musl/musl-locales_git.bb
new file mode 100644
index 00000000000..99e71092e7d
--- /dev/null
+++ b/meta/recipes-core/musl/musl-locales_git.bb
@@ -0,0 +1,73 @@ 
+# Copyright (C) 2022 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+#
+SUMMARY = "Locales support for musl"
+HOMEPAGE = "https://gitlab.com/rilian-la-te/musl-locales"
+LICENSE = "MIT & LGPL-3.0-or-later"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=cf5713fba707073020b1db2acaa73e78 \
+                    file://LICENSE.MIT;md5=a4f1c6864a83ddf4b754cdab7d593523"
+
+SRC_URI = "git://gitlab.com/rilian-la-te/musl-locales;protocol=https;branch=master"
+
+PV = "1.0+git${SRCPV}"
+SRCREV = "1101fb2bcdd189cd9415b8bd1c775eb43527d25c"
+
+S = "${WORKDIR}/git"
+
+DEPENDS = "virtual/libintl"
+
+PROVIDES = "virtual/libc-locale"
+
+inherit cmake gettext
+
+EXTRA_OECMAKE = ""
+#
+# We will skip parsing for non-musl systems
+#
+COMPATIBLE_HOST = ".*-musl.*"
+
+# only locale binaries are under GPL-3.0-or-later others are MIT
+LICENSE:${PN} = "LGPL-3.0-or-later"
+LICENSE:locale-base-ch-de = "MIT"
+LICENSE:locale-base-de-ch = "MIT"
+LICENSE:locale-base-de-de = "MIT"
+LICENSE:locale-base-en-gb = "MIT"
+LICENSE:locale-base-en-us = "MIT"
+LICENSE:locale-base-es-es = "MIT"
+LICENSE:locale-base-fr-fr = "MIT"
+LICENSE:locale-base-it-it = "MIT"
+LICENSE:locale-base-nb-no = "MIT"
+LICENSE:locale-base-nl-nl = "MIT"
+LICENSE:locale-base-pt-br = "MIT"
+LICENSE:locale-base-ru-ru = "MIT"
+LICENSE:locale-base-sv-se = "MIT"
+
+PACKAGES =+ "locale-base-ch-de \
+             locale-base-de-ch \
+             locale-base-de-de \
+             locale-base-en-gb \
+             locale-base-en-us \
+             locale-base-es-es \
+             locale-base-fr-fr \
+             locale-base-it-it \
+             locale-base-nb-no \
+             locale-base-nl-nl \
+             locale-base-pt-br \
+             locale-base-ru-ru \
+             locale-base-sv-se \
+             "
+FILES:locale-base-ch-de += "${datadir}/i18n/locales/musl/ch_DE.UTF-8"
+FILES:locale-base-de-ch += "${datadir}/i18n/locales/musl/de_CH.UTF-8"
+FILES:locale-base-de-de += "${datadir}/i18n/locales/musl/de_DE.UTF-8"
+FILES:locale-base-en-gb += "${datadir}/i18n/locales/musl/en_GB.UTF-8"
+FILES:locale-base-en-us += "${datadir}/i18n/locales/musl/en_US.UTF-8"
+FILES:locale-base-es-es += "${datadir}/i18n/locales/musl/es_ES.UTF-8"
+FILES:locale-base-fr-fr += "${datadir}/i18n/locales/musl/fr_FR.UTF-8"
+FILES:locale-base-it-it += "${datadir}/i18n/locales/musl/it_IT.UTF-8"
+FILES:locale-base-nb-no += "${datadir}/i18n/locales/musl/nb_NO.UTF-8"
+FILES:locale-base-nl-nl += "${datadir}/i18n/locales/musl/nl_NL.UTF-8"
+FILES:locale-base-pt-br += "${datadir}/i18n/locales/musl/pt_BR.UTF-8"
+FILES:locale-base-ru-ru += "${datadir}/i18n/locales/musl/ru_RU.UTF-8"
+FILES:locale-base-sv-se += "${datadir}/i18n/locales/musl/sv_SE.UTF-8"
+
+UPSTREAM_CHECK_COMMITS = "1"