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

View file

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