Upgrading to musl 1.1.5

Title: Upgrading to musl 1.1.5
Author: Anthony G. Basile <blueness@gentoo.org>
Content-Type: text/plain
Posted: 2014-10-22
Revision: 1
News-Item-Format: 1.0
Display-If-Installed: sys-libs/musl

Versions 1.1.4 and above of musl provide Native Language Support (nls).  Up
till now, Gentoo musl stages have used GNU gettext to provide nls via libintl.so
and linked applications against it.  Beginning with musl-1.1.5 we are switching
to nls provided by musl.  Since musl is experimental, you are better off starting
with a new stage3 dated later than 2014-10-20.  However, if you wish to upgrade
an existing system, you can proceed as follows:

1. Remove any references to -lintl from /etc/portage/package.env and
/etc/portage/env/*.  If you did not modify these from the original stage3
then you can just do `rm -rf /etc/portage/package.env /etc/portage/env`

2. Update your system, except for musl:

    emerge --exclude musl -uvNDq world

3. Remove the libintl header belonging to gettext:

    rm -f /usr/include/libintl.h

4. Now you can update musl without a file collision:

    emerge -1q =sys-libs/musl-1.1.5

5. We need to turn USE=nls off in gettext:

    echo "=sys-devel/gettext-0.19.3" >> /etc/portage/package.accept_keywords
    echo "sys-devel/gettext -nls" >> /etc/portage/package.use
    emerge -1 gettext

6. Rebuild any packages that might be linking against libintl.so:

    USE=-nls emerge -uvDNq world

7. The previous step probably missed some executables, so find them all:

    for i in /bin/* /sbin/ /usr/bin/* /usr/sbin/* ; do
        readelf -d $i 2>&1 | grep -q libintl.so && echo $i

You can identify what packages these belong to uing `equery b <exe>`  Rebuild
those packages.

8. At this point you can remove /usr/lib/libintl.so*.  To be safe, check that
all your coreutils utilities (like mv, cp, ls, etc.) really aren't linking
against libintl.so as described in the previous step and then mv that library
out of the dynamic linker's search path.

9. While not strictly necessary, you can rebuild your entire system to make
sure everything links nicely against the new libc.so: emerge -evq world