lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 17.09-beta 68 lines 2.5 kB view raw
1/* This function builds just the `lib/locale/locale-archive' file from 2 Glibc and nothing else. If `allLocales' is true, all supported 3 locales are included; otherwise, just the locales listed in 4 `locales'. See localedata/SUPPORTED in the Glibc source tree for 5 the list of all supported locales: 6 http://sourceware.org/cgi-bin/cvsweb.cgi/libc/localedata/SUPPORTED?cvsroot=glibc 7*/ 8 9{ stdenv, callPackage, writeText 10, allLocales ? true, locales ? [ "en_US.UTF-8/UTF-8" ] 11}: 12 13callPackage ./common.nix { inherit stdenv; } { 14 name = "glibc-locales"; 15 16 installLocales = true; 17 18 builder = ./locales-builder.sh; 19 20 outputs = [ "out" ]; 21 22 # Awful hack: `localedef' doesn't allow the path to `locale-archive' 23 # to be overriden, but you *can* specify a prefix, i.e. it will use 24 # <prefix>/<path-to-glibc>/lib/locale/locale-archive. So we use 25 # $TMPDIR as a prefix, meaning that the locale-archive is placed in 26 # $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive. 27 buildPhase = 28 '' 29 mkdir -p $TMPDIR/"${stdenv.cc.libc.out}/lib/locale" 30 31 # Hack to allow building of the locales (needed since glibc-2.12) 32 sed -i -e 's,^$(rtld-prefix) $(common-objpfx)locale/localedef,localedef --prefix='$TMPDIR',' ../glibc-2*/localedata/Makefile 33 '' 34 + stdenv.lib.optionalString (!allLocales) '' 35 # Check that all locales to be built are supported 36 echo -n '${stdenv.lib.concatMapStrings (s: s + " \\\n") locales}' \ 37 | sort > locales-to-build.txt 38 cat ../glibc-2*/localedata/SUPPORTED | grep ' \\' \ 39 | sort > locales-supported.txt 40 comm -13 locales-supported.txt locales-to-build.txt \ 41 > locales-unsupported.txt 42 if [[ $(wc -c locales-unsupported.txt) != "0 locales-unsupported.txt" ]]; then 43 cat locales-supported.txt 44 echo "Error: unsupported locales detected:" 45 cat locales-unsupported.txt 46 echo "You should choose from the list above the error." 47 false 48 fi 49 50 echo SUPPORTED-LOCALES='${toString locales}' > ../glibc-2*/localedata/SUPPORTED 51 '' + '' 52 make localedata/install-locales \ 53 localedir=$out/lib/locale \ 54 ''; 55 56 installPhase = 57 '' 58 mkdir -p "$out/lib/locale" 59 cp -v "$TMPDIR/$NIX_STORE/"*"/lib/locale/locale-archive" "$out/lib/locale" 60 ''; 61 62 setupHook = writeText "locales-setup-hook.sh" 63 '' 64 export LOCALE_ARCHIVE=@out@/lib/locale/locale-archive 65 ''; 66 67 meta.description = "Locale information for the GNU C Library"; 68}