Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/maintainers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
dochang = "Desmond O. Chang <dochang@gmail.com>";
doublec = "Chris Double <chris.double@double.co.nz>";
drewkett = "Andrew Burkett <burkett.andrew@gmail.com>";
dvc94ch = "David Craven <david@craven.ch>";
ebzzry = "Rommel Martinez <ebzzry@gmail.com>";
ederoyd46 = "Matthew Brown <matt@ederoyd.co.uk>";
eduarrrd = "Eduard Bachmakov <e.bachmakov@gmail.com>";
Expand Down
6 changes: 4 additions & 2 deletions pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ stdenv.mkDerivation {
# The dynamic linker has different names on different Linux platforms.
dynamicLinker =
if !nativeLibc then
(if stdenv.system == "i686-linux" then "ld-linux.so.2" else
(if libc.isMusl or false then libc.dynamicLinker else
if stdenv.system == "i686-linux" then "ld-linux.so.2" else
if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
# ARM with a wildcard, which can be "" or "-armhf".
if stdenv.isArm then "ld-linux*.so.3" else
Expand All @@ -265,7 +266,8 @@ stdenv.mkDerivation {
# the style in the gcc-cross-wrapper, but to keep a stable stdenv now I
# do this sufficient if/else.
dynamicLinker =
(if stdenv.cross.arch == "arm" then "ld-linux.so.3" else
(if stdenv.cross.libc == "musl" then muslCross.dynamicLinker else
if stdenv.cross.arch == "arm" then "ld-linux.so.3" else
if stdenv.cross.arch == "mips" then "ld.so.1" else
if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform");
Expand Down
5 changes: 4 additions & 1 deletion pkgs/development/compilers/gcc/6/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ let version = "6.1.0";
else (if cross.libc == "uclibc" then
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
" --disable-libgomp" else "") +
" --disable-libgomp"
else if cross.libc == "musl" then
" --disable-libsanitizer"
else "") +
" --enable-threads=posix" +
" --enable-nls" +
" --disable-decimal-float") # No final libdecnumber (it may work only in 386)
Expand Down
27 changes: 27 additions & 0 deletions pkgs/development/compilers/gcc/libgcc.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ stdenv, gcc, glibc }:

stdenv.mkDerivation rec {
name = "libgcc-${version}";
version = gcc.cc.version;
arch = "x86_64-unknown-linux-gnu";
path = "${gcc.cc}/lib/gcc/${arch}/${version}";

buildCommand = ''
mkdir -p "$out/lib"

cp -r ${path}/libgcc.a $out/lib
cp -r ${path}/crtbegin.o $out/lib
cp -r ${path}/crtbeginS.o $out/lib
cp -r ${path}/crtbeginT.o $out/lib
cp -r ${path}/crtendS.o $out/lib
cp -r ${path}/crtend.o $out/lib

cp -r ${path}/crtfastmath.o $out/lib
cp -r ${path}/crtprec32.o $out/lib
cp -r ${path}/crtprec80.o $out/lib
cp -r ${path}/crtprec64.o $out/lib
cp -r ${path}/libgcc_eh.a $out/lib

cp -r ${glibc.out}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so
'';
}
5 changes: 1 addition & 4 deletions pkgs/os-specific/linux/busybox/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{ stdenv, fetchurl, musl
{ stdenv, fetchurl
, enableStatic ? false
, enableMinimal ? false
, useMusl ? false
, extraConfig ? ""
}:

Expand Down Expand Up @@ -61,8 +60,6 @@ stdenv.mkDerivation rec {
EOF

make oldconfig
'' + stdenv.lib.optionalString useMusl ''
makeFlagsArray+=("CC=gcc -isystem ${musl}/include -B${musl}/lib -L${musl}/lib")
'';

crossAttrs = {
Expand Down
31 changes: 23 additions & 8 deletions pkgs/os-specific/linux/musl/default.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
{ stdenv, fetchurl }:
{ stdenv, fetchurl, cross ? null, gccCross ? null }:

stdenv.mkDerivation rec {
name = "musl-${version}";
version = "1.1.11";
name = "musl-${version}${stdenv.lib.optionalString (cross != null) ''-${cross.arch}''}";
version = "1.1.14";

src = fetchurl {
url = "http://www.musl-libc.org/releases/${name}.tar.gz";
sha256 = "0grmmah3d9wajii26010plpinv3cbiq3kfqsblgn84kv3fjnv7mv";
url = "http://www.musl-libc.org/releases/musl-${version}.tar.gz";
sha256 = "1ddral87srzk741cqbfrx9aygnh8fpgfv7mjvbain2d6hh6c1xim";
};

enableParallelBuilding = true;
buildInputs = stdenv.lib.optional (gccCross != null) gccCross;
CROSS_COMPILE = stdenv.lib.optionalString (cross != null) "${cross.config}-";

preConfigure = ''
configureFlagsArray+=("--syslibdir=$out/lib")
${stdenv.lib.optionalString (gccCross != null) ''export CC="${cross.config}-gcc"''}
'';

configureFlags = [
"--enable-shared"
"--enable-static"
];
"--disable-gcc-wrapper"
] ++ stdenv.lib.optional (cross != null) "--target=${cross.arch}";

outputs = ["dev" "out"];
enableParallelBuilding = true;
dontDisableStatic = true;
dontSetConfigureCross = true;
dontStrip = true;
dontCrossStrip = true;

passthru = {
# isMusl can be dropped when/if providing the dynamicLinker
# name through the libc is adopted
isMusl = true;
dynamicLinker = "libc.so";
};

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 ];
maintainers = with stdenv.lib.maintainers; [ dvc94ch thoughtpolice ];
};
}
2 changes: 1 addition & 1 deletion pkgs/stdenv/linux/make-bootstrap-tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rec {
tarMinimal = gnutar.override { acl = null; };

busyboxMinimal = busybox.override {
useMusl = true;
stdenv = muslStdenv;
enableStatic = true;
enableMinimal = true;
extraConfig = ''
Expand Down
8 changes: 8 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4199,6 +4199,8 @@ in

gcc = gcc5;

libgcc = callPackage ../development/compilers/gcc/libgcc.nix {};

wrapCCMulti = cc:
if system == "x86_64-linux" then lowPrio (
let
Expand Down Expand Up @@ -7117,6 +7119,7 @@ in

# We can choose:
libcCrossChooser = name: if name == "glibc" then glibcCross
else if name == "musl" then muslCross
else if name == "uclibc" then uclibcCross
else if name == "msvcrt" then windows.mingw_w64
else if name == "libSystem" then darwin.xcode
Expand Down Expand Up @@ -11127,6 +11130,11 @@ in
multipath-tools = callPackage ../os-specific/linux/multipath-tools { };

musl = callPackage ../os-specific/linux/musl { };
muslStdenv = overrideCC stdenv (gcc.override { libc = musl; });
muslCross = forceNativeDrv (musl.override {
gccCross = gccCrossStageStatic;
cross = assert crossSystem != null; crossSystem;
});

nettools = callPackage ../os-specific/linux/net-tools { };

Expand Down