muslCross: init

This commit is contained in:
Will Dietz 2018-01-02 20:12:18 -06:00
parent 1d538d51c3
commit af6b756d98
2 changed files with 16 additions and 7 deletions

View File

@ -1,5 +1,8 @@
{ stdenv, fetchurl, linuxHeaders, useBSDCompatHeaders ? true }:
{ stdenv, lib, fetchurl
, buildPackages
, linuxHeaders ? null
, useBSDCompatHeaders ? true
}:
let
cdefs_h = fetchurl {
url = "http://git.alpinelinux.org/cgit/aports/plain/main/libc-dev/sys-cdefs.h";
@ -13,13 +16,14 @@ let
url = "http://git.alpinelinux.org/cgit/aports/plain/main/libc-dev/sys-tree.h";
sha256 = "14igk6k00bnpfw660qhswagyhvr0gfqg4q55dxvaaq7ikfkrir71";
};
in
stdenv.mkDerivation rec {
name = "musl-${version}";
version = "1.1.18";
src = fetchurl {
url = "http://www.musl-libc.org/releases/${name}.tar.gz";
url = "http://www.musl-libc.org/releases/musl-${version}.tar.gz";
sha256 = "0651lnj5spckqjf83nz116s8qhhydgqdy3rkl4icbh5f05fyw5yh";
};
@ -56,7 +60,7 @@ stdenv.mkDerivation rec {
mkdir -p $out/bin
# Create 'ldd' symlink, builtin
ln -s $out/lib/libc.so $out/bin/ldd
'' + stdenv.lib.optionalString useBSDCompatHeaders ''
'' + lib.optionalString useBSDCompatHeaders ''
install -D ${queue_h} $dev/include/sys/queue.h
install -D ${cdefs_h} $dev/include/sys/cdefs.h
install -D ${tree_h} $dev/include/sys/tree.h
@ -67,8 +71,8 @@ stdenv.mkDerivation rec {
meta = {
description = "An efficient, small, quality libc implementation";
homepage = "http://www.musl-libc.org";
license = stdenv.lib.licenses.mit;
platforms = stdenv.lib.platforms.linux;
maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
license = lib.licenses.mit;
platforms = lib.platforms.linux;
maintainers = [ lib.maintainers.thoughtpolice ];
};
}

View File

@ -8741,12 +8741,17 @@ with pkgs;
stdenv = crossLibcStdenv;
};
muslCross = callPackage ../os-specific/linux/musl {
stdenv = crossLibcStdenv;
};
# We can choose:
libcCrossChooser = name:
# libc is hackily often used from the previous stage. This `or`
# hack fixes the hack, *sigh*.
/**/ if name == "glibc" then targetPackages.glibcCross or glibcCross
else if name == "uclibc" then uclibcCross
else if name == "musl" then targetPackages.muslCross or muslCross
else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64
else if name == "libSystem" then darwin.xcode
else throw "Unknown libc";