diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index b1036b80c4d..0729cc7ef29 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -26,7 +26,8 @@ rec {
libc =
/**/ if final.isDarwin then "libSystem"
else if final.isMinGW then "msvcrt"
- else if final.isLinux then "glibc"
+ else if final.isMusl then "musl"
+ else if final.isLinux /* default */ then "glibc"
# TODO(@Ericson2314) think more about other operating systems
else "native/impure";
extensions = {
diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix
index 5fc36c5b056..f5562e28a09 100644
--- a/lib/systems/examples.nix
+++ b/lib/systems/examples.nix
@@ -13,7 +13,6 @@ rec {
config = "armv5tel-unknown-linux-gnueabi";
arch = "armv5tel";
float = "soft";
- libc = "glibc";
platform = platforms.sheevaplug;
};
@@ -22,7 +21,6 @@ rec {
arch = "armv6l";
float = "hard";
fpu = "vfp";
- libc = "glibc";
platform = platforms.raspberrypi;
};
@@ -31,14 +29,12 @@ rec {
arch = "armv7-a";
float = "hard";
fpu = "vfpv3-d16";
- libc = "glibc";
platform = platforms.armv7l-hf-multiplatform;
};
aarch64-multiplatform = rec {
config = "aarch64-unknown-linux-gnu";
arch = "aarch64";
- libc = "glibc";
platform = platforms.aarch64-multiplatform;
};
@@ -51,7 +47,6 @@ rec {
arch = "armv5tel";
config = "armv5tel-unknown-linux-gnueabi";
float = "soft";
- libc = "glibc";
platform = platforms.pogoplug4;
};
@@ -59,10 +54,20 @@ rec {
config = "mips64el-unknown-linux-gnu";
arch = "mips";
float = "hard";
- libc = "glibc";
platform = platforms.fuloong2f_n32;
};
+ muslpi = raspberryPi // {
+ config = "armv6l-unknown-linux-musleabihf";
+ };
+
+ aarch64-multiplatform-musl = aarch64-multiplatform // {
+ config = "aarch64-unknown-linux-musl";
+ };
+
+ musl64 = { config = "x86_64-unknown-linux-musl"; };
+ musl32 = { config = "i686-unknown-linux-musl"; };
+
#
# Darwin
#
diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix
index 3f0335a0adf..0fce5254dcb 100644
--- a/lib/systems/inspect.nix
+++ b/lib/systems/inspect.nix
@@ -33,6 +33,8 @@ rec {
Windows = { kernel = kernels.windows; };
Cygwin = { kernel = kernels.windows; abi = abis.cygnus; };
MinGW = { kernel = kernels.windows; abi = abis.gnu; };
+
+ Musl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf ];
};
matchAnyAttrs = patterns:
diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix
index 37a8c848c5d..95759b93ae0 100644
--- a/lib/systems/parse.nix
+++ b/lib/systems/parse.nix
@@ -180,6 +180,9 @@ rec {
androideabi = {};
gnueabi = {};
gnueabihf = {};
+ musleabi = {};
+ musleabihf = {};
+ musl = {};
unknown = {};
};
diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix
index 282fb0994b5..58a7afa7679 100644
--- a/lib/systems/platforms.nix
+++ b/lib/systems/platforms.nix
@@ -2,7 +2,6 @@
rec {
pcBase = {
name = "pc";
- kernelHeadersBaseConfig = "defconfig";
kernelBaseConfig = "defconfig";
# Build whatever possible as a module, if not stated in the extra config.
kernelAutoModules = true;
@@ -30,7 +29,6 @@ rec {
};
kernelMajor = "2.6";
- kernelHeadersBaseConfig = "multi_v5_defconfig";
kernelBaseConfig = "multi_v5_defconfig";
kernelArch = "arm";
kernelAutoModules = false;
@@ -54,7 +52,6 @@ rec {
sheevaplug = {
name = "sheevaplug";
kernelMajor = "2.6";
- kernelHeadersBaseConfig = "multi_v5_defconfig";
kernelBaseConfig = "multi_v5_defconfig";
kernelArch = "arm";
kernelAutoModules = false;
@@ -168,7 +165,6 @@ rec {
raspberrypi = {
name = "raspberrypi";
kernelMajor = "2.6";
- kernelHeadersBaseConfig = "bcm2835_defconfig";
kernelBaseConfig = "bcmrpi_defconfig";
kernelDTB = true;
kernelArch = "arm";
@@ -347,7 +343,6 @@ rec {
utilite = {
name = "utilite";
kernelMajor = "2.6";
- kernelHeadersBaseConfig = "multi_v7_defconfig";
kernelBaseConfig = "multi_v7_defconfig";
kernelArch = "arm";
kernelAutoModules = false;
@@ -379,13 +374,11 @@ rec {
# patch.
kernelBaseConfig = "guruplug_defconfig";
- #kernelHeadersBaseConfig = "guruplug_defconfig";
};
fuloong2f_n32 = {
name = "fuloong2f_n32";
kernelMajor = "2.6";
- kernelHeadersBaseConfig = "fuloong2e_defconfig";
kernelBaseConfig = "lemote2f_defconfig";
kernelArch = "mips";
kernelAutoModules = false;
@@ -471,7 +464,6 @@ rec {
armv7l-hf-multiplatform = {
name = "armv7l-hf-multiplatform";
kernelMajor = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc.
- kernelHeadersBaseConfig = "multi_v7_defconfig";
kernelBaseConfig = "multi_v7_defconfig";
kernelArch = "arm";
kernelDTB = true;
@@ -517,7 +509,6 @@ rec {
aarch64-multiplatform = {
name = "aarch64-multiplatform";
kernelMajor = "2.6"; # Using "2.6" enables 2.6 kernel syscalls in glibc.
- kernelHeadersBaseConfig = "defconfig";
kernelBaseConfig = "defconfig";
kernelArch = "arm64";
kernelDTB = true;
diff --git a/nixos/doc/manual/release-notes/rl-1803.xml b/nixos/doc/manual/release-notes/rl-1803.xml
index 244611d7b47..2494e487da1 100644
--- a/nixos/doc/manual/release-notes/rl-1803.xml
+++ b/nixos/doc/manual/release-notes/rl-1803.xml
@@ -143,6 +143,17 @@ following incompatible changes:
here.
+
+
+ The openssh package
+ now includes Kerberos support by default;
+ the openssh_with_kerberos package
+ is now a deprecated alias.
+ If you do not want Kerberos support,
+ you can do openssh.override { withKerboros = false; }.
+ Note, this also applies to the openssh_hpn package.
+
+
cc-wrapper has been split in two; there is now also a bintools-wrapper.
diff --git a/nixos/modules/services/networking/radvd.nix b/nixos/modules/services/networking/radvd.nix
index 0199502163a..85d7f9e4a41 100644
--- a/nixos/modules/services/networking/radvd.nix
+++ b/nixos/modules/services/networking/radvd.nix
@@ -59,24 +59,11 @@ in
systemd.services.radvd =
{ description = "IPv6 Router Advertisement Daemon";
-
wantedBy = [ "multi-user.target" ];
-
after = [ "network.target" ];
-
- path = [ pkgs.radvd ];
-
- preStart = ''
- mkdir -m 755 -p /run/radvd
- chown radvd /run/radvd
- '';
-
serviceConfig =
- { ExecStart = "@${pkgs.radvd}/sbin/radvd radvd"
- + " -p /run/radvd/radvd.pid -m syslog -u radvd -C ${confFile}";
+ { ExecStart = "@${pkgs.radvd}/bin/radvd radvd -n -u radvd -C ${confFile}";
Restart = "always";
- Type = "forking";
- PIDFile = "/run/radvd/radvd.pid";
};
};
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index 9d2cea3ad16..051c5539381 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -700,7 +700,6 @@ in
systemd.additionalUpstreamSystemUnits = [
"systemd-networkd.service" "systemd-networkd-wait-online.service"
- "org.freedesktop.network1.busname"
];
systemd.network.units = mapAttrs' (n: v: nameValuePair "${n}.link" (linkToUnit n v)) cfg.links
diff --git a/nixos/modules/system/boot/resolved.nix b/nixos/modules/system/boot/resolved.nix
index 2147d43c4f1..4d9de020c84 100644
--- a/nixos/modules/system/boot/resolved.nix
+++ b/nixos/modules/system/boot/resolved.nix
@@ -126,7 +126,7 @@ in
config = mkIf cfg.enable {
systemd.additionalUpstreamSystemUnits = [
- "systemd-resolved.service" "org.freedesktop.resolve1.busname"
+ "systemd-resolved.service"
];
systemd.services.systemd-resolved = {
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index dd9ba710448..aff46ea861a 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -14,7 +14,6 @@ let
upstreamSystemUnits =
[ # Targets.
"basic.target"
- "busnames.target"
"sysinit.target"
"sockets.target"
"exit.target"
@@ -47,6 +46,7 @@ let
# Consoles.
"getty.target"
+ "getty-pre.target"
"getty@.service"
"serial-getty@.service"
"console-getty.service"
@@ -63,10 +63,7 @@ let
"systemd-logind.service"
"autovt@.service"
"systemd-user-sessions.service"
- "dbus-org.freedesktop.login1.service"
"dbus-org.freedesktop.machine1.service"
- "org.freedesktop.login1.busname"
- "org.freedesktop.machine1.busname"
"user@.service"
# Journal.
@@ -99,7 +96,6 @@ let
"swap.target"
"dev-hugepages.mount"
"dev-mqueue.mount"
- "proc-sys-fs-binfmt_misc.mount"
"sys-fs-fuse-connections.mount"
"sys-kernel-config.mount"
"sys-kernel-debug.mount"
@@ -155,19 +151,16 @@ let
"systemd-tmpfiles-setup-dev.service"
# Misc.
- "org.freedesktop.systemd1.busname"
"systemd-sysctl.service"
"dbus-org.freedesktop.timedate1.service"
"dbus-org.freedesktop.locale1.service"
"dbus-org.freedesktop.hostname1.service"
- "org.freedesktop.timedate1.busname"
- "org.freedesktop.locale1.busname"
- "org.freedesktop.hostname1.busname"
"systemd-timedated.service"
"systemd-localed.service"
"systemd-hostnamed.service"
"systemd-binfmt.service"
"systemd-exit.service"
+ "systemd-update-done.service"
]
++ cfg.additionalUpstreamSystemUnits;
@@ -182,7 +175,6 @@ let
upstreamUserUnits =
[ "basic.target"
"bluetooth.target"
- "busnames.target"
"default.target"
"exit.target"
"graphical-session-pre.target"
@@ -789,8 +781,7 @@ in
# Keep a persistent journal. Note that systemd-tmpfiles will
# set proper ownership/permissions.
- # FIXME: revert to 0700 with systemd v233.
- mkdir -m 0750 -p /var/log/journal
+ mkdir -m 0700 -p /var/log/journal
'';
users.extraUsers.systemd-network.uid = config.ids.uids.systemd-network;
@@ -887,7 +878,7 @@ in
systemd.targets.local-fs.unitConfig.X-StopOnReconfiguration = true;
systemd.targets.remote-fs.unitConfig.X-StopOnReconfiguration = true;
systemd.targets.network-online.wantedBy = [ "multi-user.target" ];
- systemd.services.systemd-binfmt.wants = [ "proc-sys-fs-binfmt_misc.automount" ];
+ systemd.services.systemd-binfmt.wants = [ "proc-sys-fs-binfmt_misc.mount" ];
# Don't bother with certain units in containers.
systemd.services.systemd-remount-fs.unitConfig.ConditionVirtualization = "!container";
diff --git a/pkgs/applications/audio/cdparanoia/default.nix b/pkgs/applications/audio/cdparanoia/default.nix
index 34dba5e206f..d4d302f07d2 100644
--- a/pkgs/applications/audio/cdparanoia/default.nix
+++ b/pkgs/applications/audio/cdparanoia/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
url = "https://trac.macports.org/export/70964/trunk/dports/audio/cdparanoia/files/patch-paranoia_paranoia.c.10.4.diff";
sha256 = "17l2qhn8sh4jy6ryy5si6ll6dndcm0r537rlmk4a6a8vkn852vad";
})
- ];
+ ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./utils.patch;
buildInputs = stdenv.lib.optional stdenv.isAarch64 autoreconfHook;
diff --git a/pkgs/applications/audio/cdparanoia/utils.patch b/pkgs/applications/audio/cdparanoia/utils.patch
new file mode 100644
index 00000000000..338e5303dcd
--- /dev/null
+++ b/pkgs/applications/audio/cdparanoia/utils.patch
@@ -0,0 +1,68 @@
+diff --git cdparanoia-III-10.2/interface/utils.h cdparanoia-III-10.2/interface/utils.h
+index c9647da..68c1a3a 100644
+--- cdparanoia-III-10.2/interface/utils.h
++++ cdparanoia-III-10.2/interface/utils.h
+@@ -1,4 +1,6 @@
+-#include
++#include
++#include
++#include
+ #include
+ #include
+ #include
+@@ -14,15 +16,15 @@ static inline int bigendianp(void){
+ }
+
+ static inline int32_t swap32(int32_t x){
+- return((((u_int32_t)x & 0x000000ffU) << 24) |
+- (((u_int32_t)x & 0x0000ff00U) << 8) |
+- (((u_int32_t)x & 0x00ff0000U) >> 8) |
+- (((u_int32_t)x & 0xff000000U) >> 24));
++ return((((uint32_t)x & 0x000000ffU) << 24) |
++ (((uint32_t)x & 0x0000ff00U) << 8) |
++ (((uint32_t)x & 0x00ff0000U) >> 8) |
++ (((uint32_t)x & 0xff000000U) >> 24));
+ }
+
+ static inline int16_t swap16(int16_t x){
+- return((((u_int16_t)x & 0x00ffU) << 8) |
+- (((u_int16_t)x & 0xff00U) >> 8));
++ return((((uint16_t)x & 0x00ffU) << 8) |
++ (((uint16_t)x & 0xff00U) >> 8));
+ }
+
+ #if BYTE_ORDER == LITTLE_ENDIAN
+diff --git cdparanoia-III-10.2/utils.h cdparanoia-III-10.2/utils.h
+index 10dce58..6211ce3 100644
+--- cdparanoia-III-10.2/utils.h
++++ cdparanoia-III-10.2/utils.h
+@@ -1,5 +1,6 @@
++#include
++#include
+ #include
+-#include
+ #include
+ #include
+ #include
+@@ -18,15 +19,15 @@ static inline int bigendianp(void){
+ }
+
+ static inline int32_t swap32(int32_t x){
+- return((((u_int32_t)x & 0x000000ffU) << 24) |
+- (((u_int32_t)x & 0x0000ff00U) << 8) |
+- (((u_int32_t)x & 0x00ff0000U) >> 8) |
+- (((u_int32_t)x & 0xff000000U) >> 24));
++ return((((uint32_t)x & 0x000000ffU) << 24) |
++ (((uint32_t)x & 0x0000ff00U) << 8) |
++ (((uint32_t)x & 0x00ff0000U) >> 8) |
++ (((uint32_t)x & 0xff000000U) >> 24));
+ }
+
+ static inline int16_t swap16(int16_t x){
+- return((((u_int16_t)x & 0x00ffU) << 8) |
+- (((u_int16_t)x & 0xff00U) >> 8));
++ return((((uint16_t)x & 0x00ffU) << 8) |
++ (((uint16_t)x & 0xff00U) >> 8));
+ }
+
+ #if BYTE_ORDER == LITTLE_ENDIAN
diff --git a/pkgs/applications/editors/kakoune/default.nix b/pkgs/applications/editors/kakoune/default.nix
index 067aff5ee69..dae30c5ac0c 100644
--- a/pkgs/applications/editors/kakoune/default.nix
+++ b/pkgs/applications/editors/kakoune/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, ncurses, boost, asciidoc, docbook_xsl, libxslt }:
+{ stdenv, fetchFromGitHub, ncurses, boost, asciidoc, docbook_xsl, libxslt, pkgconfig }:
with stdenv.lib;
@@ -11,6 +11,7 @@ stdenv.mkDerivation rec {
rev = "7482d117cc85523e840dff595134dcb9cdc62207";
sha256 = "08j611y192n9vln9i94ldlvz3k0sg79dkmfc0b1vczrmaxhpgpfh";
};
+ nativeBuildInputs = [ pkgconfig ];
buildInputs = [ ncurses boost asciidoc docbook_xsl libxslt ];
postPatch = ''
diff --git a/pkgs/applications/misc/xterm/default.nix b/pkgs/applications/misc/xterm/default.nix
index 838043881e4..d807e8eb9ed 100644
--- a/pkgs/applications/misc/xterm/default.nix
+++ b/pkgs/applications/misc/xterm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, xorg, ncurses, freetype, fontconfig, pkgconfig, makeWrapper
+{ stdenv, fetchurl, fetchpatch, xorg, ncurses, freetype, fontconfig, pkgconfig, makeWrapper
, enableDecLocator ? true
}:
@@ -20,7 +20,12 @@ stdenv.mkDerivation rec {
patches = [
./sixel-256.support.patch
- ];
+ ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl
+ (fetchpatch {
+ name = "posix-ptys.patch";
+ url = "https://git.alpinelinux.org/cgit/aports/plain/community/xterm/posix-ptys.patch?id=3aa532e77875fa1db18c7fcb938b16647031bcc1";
+ sha256 = "0czgnsxkkmkrk1idw69qxbprh0jb4sw3c24zpnqq2v76jkl7zvlr";
+ });
configureFlags = [
"--enable-wide-chars"
diff --git a/pkgs/applications/networking/browsers/w3m/default.nix b/pkgs/applications/networking/browsers/w3m/default.nix
index 83819761e9b..c71ccdf8a0d 100644
--- a/pkgs/applications/networking/browsers/w3m/default.nix
+++ b/pkgs/applications/networking/browsers/w3m/default.nix
@@ -53,8 +53,12 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" ];
- configureFlags = "--with-ssl=${openssl.dev} --with-gc=${boehmgc.dev}"
- + optionalString graphicsSupport " --enable-image=${optionalString x11Support "x11,"}fb";
+ configureFlags =
+ [ "--with-ssl=${openssl.dev}" "--with-gc=${boehmgc.dev}" ]
+ ++ optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+ "ac_cv_func_setpgrp_void=yes"
+ ]
+ ++ optional graphicsSupport "--enable-image=${optionalString x11Support "x11,"}fb";
preConfigure = ''
substituteInPlace ./configure --replace "/lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib /lib64 /usr/lib64" /no-such-path
diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix
index 5556a58ec56..84e10fb18bc 100644
--- a/pkgs/applications/networking/sniffers/wireshark/default.nix
+++ b/pkgs/applications/networking/sniffers/wireshark/default.nix
@@ -40,7 +40,13 @@ in stdenv.mkDerivation {
++ optionals stdenv.isLinux [ libcap libnl ]
++ optionals stdenv.isDarwin [ SystemConfiguration ApplicationServices gmp ];
- patches = [ ./wireshark-lookup-dumpcap-in-path.patch ];
+ patches = [ ./wireshark-lookup-dumpcap-in-path.patch ]
+ # https://code.wireshark.org/review/#/c/23728/
+ ++ stdenv.lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
+ name = "fix-timeout.patch";
+ url = "https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commitdiff_plain;h=8b5b843fcbc3e03e0fc45f3caf8cf5fc477e8613;hp=94af9724d140fd132896b650d10c4d060788e4f0";
+ sha256 = "1g2dm7lwsnanwp68b9xr9swspx7hfj4v3z44sz3yrfmynygk8zlv";
+ });
postInstall = optionalString (withQt || withGtk) ''
${optionalString withGtk ''
diff --git a/pkgs/applications/science/logic/avy/default.nix b/pkgs/applications/science/logic/avy/default.nix
index 379224c73f8..218006e15d5 100644
--- a/pkgs/applications/science/logic/avy/default.nix
+++ b/pkgs/applications/science/logic/avy/default.nix
@@ -12,7 +12,25 @@ stdenv.mkDerivation rec {
};
buildInputs = [ cmake zlib boost.out boost.dev ];
- NIX_CFLAGS_COMPILE = [ "-Wno-narrowing" ];
+ NIX_CFLAGS_COMPILE = [ "-Wno-narrowing" ]
+ # Squelch endless stream of warnings on same few things
+ ++ stdenv.lib.optionals stdenv.cc.isClang [
+ "-Wno-empty-body"
+ "-Wno-tautological-compare"
+ "-Wc++11-compat-deprecated-writable-strings"
+ "-Wno-deprecated"
+ ];
+
+ prePatch = ''
+ sed -i -e '1i#include ' abc/src/bdd/dsd/dsd.h
+ substituteInPlace abc/src/bdd/dsd/dsd.h --replace \
+ '((Child = Dsd_NodeReadDec(Node,Index))>=0);' \
+ '((intptr_t)(Child = Dsd_NodeReadDec(Node,Index))>=0);'
+
+ patch -p1 -d minisat -i ${./minisat-fenv.patch}
+ patch -p1 -d glucose -i ${./glucose-fenv.patch}
+ '';
+
patches =
[ ./0001-no-static-boost-libs.patch
];
diff --git a/pkgs/applications/science/logic/avy/glucose-fenv.patch b/pkgs/applications/science/logic/avy/glucose-fenv.patch
new file mode 100644
index 00000000000..dd19f7ec80e
--- /dev/null
+++ b/pkgs/applications/science/logic/avy/glucose-fenv.patch
@@ -0,0 +1,65 @@
+From d6e0cb60270e8653bda3f339e3a07ce2cd2d6eb0 Mon Sep 17 00:00:00 2001
+From: Will Dietz
+Date: Tue, 17 Oct 2017 23:01:36 -0500
+Subject: [PATCH] glucose: use fenv to set double precision
+
+---
+ core/Main.cc | 8 ++++++--
+ simp/Main.cc | 8 ++++++--
+ utils/System.h | 2 +-
+ 3 files changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/core/Main.cc b/core/Main.cc
+index c96aadd..994132b 100644
+--- a/core/Main.cc
++++ b/core/Main.cc
+@@ -96,8 +96,12 @@ int main(int argc, char** argv)
+ // printf("This is MiniSat 2.0 beta\n");
+
+ #if defined(__linux__)
+- fpu_control_t oldcw, newcw;
+- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
++ fenv_t fenv;
++
++ fegetenv(&fenv);
++ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */
++ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */
++ fesetenv(&fenv);
+ printf("c WARNING: for repeatability, setting FPU to use double precision\n");
+ #endif
+ // Extra options:
+diff --git a/simp/Main.cc b/simp/Main.cc
+index 4f4772d..70c2e4b 100644
+--- a/simp/Main.cc
++++ b/simp/Main.cc
+@@ -97,8 +97,12 @@ int main(int argc, char** argv)
+
+
+ #if defined(__linux__)
+- fpu_control_t oldcw, newcw;
+- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
++ fenv_t fenv;
++
++ fegetenv(&fenv);
++ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */
++ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */
++ fesetenv(&fenv);
+ printf("WARNING: for repeatability, setting FPU to use double precision\n");
+ #endif
+ // Extra options:
+diff --git a/utils/System.h b/utils/System.h
+index 004d498..a768e99 100644
+--- a/utils/System.h
++++ b/utils/System.h
+@@ -22,7 +22,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
+ #define Glucose_System_h
+
+ #if defined(__linux__)
+-#include
++#include
+ #endif
+
+ #include "glucose/mtl/IntTypes.h"
+--
+2.14.2
+
diff --git a/pkgs/applications/science/logic/avy/minisat-fenv.patch b/pkgs/applications/science/logic/avy/minisat-fenv.patch
new file mode 100644
index 00000000000..686d5a1c5b4
--- /dev/null
+++ b/pkgs/applications/science/logic/avy/minisat-fenv.patch
@@ -0,0 +1,65 @@
+From 7f1016ceab9b0f57a935bd51ca6df3d18439b472 Mon Sep 17 00:00:00 2001
+From: Will Dietz
+Date: Tue, 17 Oct 2017 22:57:02 -0500
+Subject: [PATCH] use fenv instead of non-standard fpu_control
+
+---
+ core/Main.cc | 8 ++++++--
+ simp/Main.cc | 8 ++++++--
+ utils/System.h | 2 +-
+ 3 files changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/core/Main.cc b/core/Main.cc
+index 2b0d97b..8ad95fb 100644
+--- a/core/Main.cc
++++ b/core/Main.cc
+@@ -78,8 +78,12 @@ int main(int argc, char** argv)
+ // printf("This is MiniSat 2.0 beta\n");
+
+ #if defined(__linux__)
+- fpu_control_t oldcw, newcw;
+- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
++ fenv_t fenv;
++
++ fegetenv(&fenv);
++ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */
++ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */
++ fesetenv(&fenv);
+ printf("WARNING: for repeatability, setting FPU to use double precision\n");
+ #endif
+ // Extra options:
+diff --git a/simp/Main.cc b/simp/Main.cc
+index 2804d7f..39bfb71 100644
+--- a/simp/Main.cc
++++ b/simp/Main.cc
+@@ -79,8 +79,12 @@ int main(int argc, char** argv)
+ // printf("This is MiniSat 2.0 beta\n");
+
+ #if defined(__linux__)
+- fpu_control_t oldcw, newcw;
+- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
++ fenv_t fenv;
++
++ fegetenv(&fenv);
++ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */
++ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */
++ fesetenv(&fenv);
+ printf("WARNING: for repeatability, setting FPU to use double precision\n");
+ #endif
+ // Extra options:
+diff --git a/utils/System.h b/utils/System.h
+index 1758192..c0ad13a 100644
+--- a/utils/System.h
++++ b/utils/System.h
+@@ -22,7 +22,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
+ #define Minisat_System_h
+
+ #if defined(__linux__)
+-#include
++#include
+ #endif
+
+ #include "mtl/IntTypes.h"
+--
+2.14.2
+
diff --git a/pkgs/applications/science/logic/boolector/default.nix b/pkgs/applications/science/logic/boolector/default.nix
index 2b40995b743..aa815e48db4 100644
--- a/pkgs/applications/science/logic/boolector/default.nix
+++ b/pkgs/applications/science/logic/boolector/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, writeShellScriptBin }:
stdenv.mkDerivation rec {
name = "boolector-${version}";
@@ -8,6 +8,24 @@ stdenv.mkDerivation rec {
sha256 = "0mdf7hwix237pvknvrpazcx6s3ininj5k7vhysqjqgxa7lxgq045";
};
+ prePatch =
+ let
+ lingelingPatch = writeShellScriptBin "lingeling-patch" ''
+ sed -i -e "1i#include " lingeling/lglib.h
+
+ ${crossFix}/bin/crossFix lingeling
+ '';
+ crossFix = writeShellScriptBin "crossFix" ''
+ # substituteInPlace not available here
+ sed -i $1/makefile.in \
+ -e 's@ar rc@$(AR) rc@' \
+ -e 's@ranlib@$(RANLIB)@'
+ '';
+ in ''
+ sed -i -e 's@mv lingeling\* lingeling@\0 \&\& ${lingelingPatch}/bin/lingeling-patch@' makefile
+ sed -i -e 's@mv boolector\* boolector@\0 \&\& ${crossFix}/bin/crossFix boolector@' makefile
+ '';
+
installPhase = ''
mkdir $out
mv boolector/bin $out
diff --git a/pkgs/applications/science/logic/cvc4/default.nix b/pkgs/applications/science/logic/cvc4/default.nix
index 6b213226635..403eff216f5 100644
--- a/pkgs/applications/science/logic/cvc4/default.nix
+++ b/pkgs/applications/science/logic/cvc4/default.nix
@@ -22,10 +22,17 @@ stdenv.mkDerivation rec {
"--with-boost=${boost.dev}"
];
+ prePatch = ''
+ patch -p1 -i ${./minisat-fenv.patch} -d src/prop/minisat
+ patch -p1 -i ${./minisat-fenv.patch} -d src/prop/bvminisat
+ '';
+
preConfigure = ''
patchShebangs ./src/
'';
+ enableParallelBuilding = true;
+
meta = with stdenv.lib; {
description = "A high-performance theorem prover and SMT solver";
homepage = http://cvc4.cs.nyu.edu/web/;
diff --git a/pkgs/applications/science/logic/cvc4/minisat-fenv.patch b/pkgs/applications/science/logic/cvc4/minisat-fenv.patch
new file mode 100644
index 00000000000..686d5a1c5b4
--- /dev/null
+++ b/pkgs/applications/science/logic/cvc4/minisat-fenv.patch
@@ -0,0 +1,65 @@
+From 7f1016ceab9b0f57a935bd51ca6df3d18439b472 Mon Sep 17 00:00:00 2001
+From: Will Dietz
+Date: Tue, 17 Oct 2017 22:57:02 -0500
+Subject: [PATCH] use fenv instead of non-standard fpu_control
+
+---
+ core/Main.cc | 8 ++++++--
+ simp/Main.cc | 8 ++++++--
+ utils/System.h | 2 +-
+ 3 files changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/core/Main.cc b/core/Main.cc
+index 2b0d97b..8ad95fb 100644
+--- a/core/Main.cc
++++ b/core/Main.cc
+@@ -78,8 +78,12 @@ int main(int argc, char** argv)
+ // printf("This is MiniSat 2.0 beta\n");
+
+ #if defined(__linux__)
+- fpu_control_t oldcw, newcw;
+- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
++ fenv_t fenv;
++
++ fegetenv(&fenv);
++ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */
++ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */
++ fesetenv(&fenv);
+ printf("WARNING: for repeatability, setting FPU to use double precision\n");
+ #endif
+ // Extra options:
+diff --git a/simp/Main.cc b/simp/Main.cc
+index 2804d7f..39bfb71 100644
+--- a/simp/Main.cc
++++ b/simp/Main.cc
+@@ -79,8 +79,12 @@ int main(int argc, char** argv)
+ // printf("This is MiniSat 2.0 beta\n");
+
+ #if defined(__linux__)
+- fpu_control_t oldcw, newcw;
+- _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
++ fenv_t fenv;
++
++ fegetenv(&fenv);
++ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */
++ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */
++ fesetenv(&fenv);
+ printf("WARNING: for repeatability, setting FPU to use double precision\n");
+ #endif
+ // Extra options:
+diff --git a/utils/System.h b/utils/System.h
+index 1758192..c0ad13a 100644
+--- a/utils/System.h
++++ b/utils/System.h
+@@ -22,7 +22,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
+ #define Minisat_System_h
+
+ #if defined(__linux__)
+-#include
++#include
+ #endif
+
+ #include "mtl/IntTypes.h"
+--
+2.14.2
+
diff --git a/pkgs/applications/science/logic/picosat/default.nix b/pkgs/applications/science/logic/picosat/default.nix
index e026cfad218..db252f97916 100644
--- a/pkgs/applications/science/logic/picosat/default.nix
+++ b/pkgs/applications/science/logic/picosat/default.nix
@@ -9,6 +9,14 @@ stdenv.mkDerivation rec {
sha256 = "0m578rpa5rdn08d10kr4lbsdwp4402hpavrz6n7n53xs517rn5hm";
};
+ prePatch = ''
+ substituteInPlace picosat.c --replace "sys/unistd.h" "unistd.h"
+
+ substituteInPlace makefile.in \
+ --replace 'ar rc' '$(AR) rc' \
+ --replace 'ranlib' '$(RANLIB)'
+ '';
+
configurePhase = "./configure.sh --shared --trace";
installPhase = ''
diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix
index 8b64e2d375b..afb3716f04c 100644
--- a/pkgs/applications/version-management/git-and-tools/git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git/default.nix
@@ -57,7 +57,10 @@ stdenv.mkDerivation {
makeFlags = "prefix=\${out} PERL_PATH=${perl}/bin/perl SHELL_PATH=${stdenv.shell} "
+ (if pythonSupport then "PYTHON_PATH=${python}/bin/python" else "NO_PYTHON=1")
+ (if stdenv.isSunOS then " INSTALL=install NO_INET_NTOP= NO_INET_PTON=" else "")
- + (if stdenv.isDarwin then " NO_APPLE_COMMON_CRYPTO=1" else " sysconfdir=/etc/ ");
+ + (if stdenv.isDarwin then " NO_APPLE_COMMON_CRYPTO=1" else " sysconfdir=/etc/ ")
+ # XXX: USE_PCRE2 might be useful in general, look into it
+ # XXX other alpine options?
+ + (if stdenv.hostPlatform.isMusl then "NO_SYS_POLL_H=1 NO_GETTEXT=YesPlease" else "");
# build git-credential-osxkeychain if darwin
postBuild = stdenv.lib.optionalString stdenv.isDarwin ''
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix
index bb0e6b82aa5..48fd8665cb4 100644
--- a/pkgs/build-support/bintools-wrapper/default.nix
+++ b/pkgs/build-support/bintools-wrapper/default.nix
@@ -51,6 +51,7 @@ let
# shell glob that ought to match it.
dynamicLinker =
/**/ if libc == null then null
+ else if targetPlatform.libc == "musl" then "${libc_lib}/lib/ld-musl-*"
else if targetPlatform.system == "i686-linux" then "${libc_lib}/lib/ld-linux.so.2"
else if targetPlatform.system == "x86_64-linux" then "${libc_lib}/lib/ld-linux-x86-64.so.2"
# ARM with a wildcard, which can be "" or "-armhf".
diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index 0105a159877..36adfd075df 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -169,7 +169,7 @@ let version = "4.8.5";
# To keep ABI compatibility with upstream mingw-w64
"--enable-fully-dynamic-string"
] else
- optionals (targetPlatform.libc == "uclibc") [
+ optionals (targetPlatform.libc == "uclibc" || targetPlatform.libc == "musl") [
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
"--disable-libgomp"
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index 1b1492686d0..c436da678fd 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -160,7 +160,7 @@ let version = "4.9.4";
# To keep ABI compatibility with upstream mingw-w64
"--enable-fully-dynamic-string"
] else
- optionals (targetPlatform.libc == "uclibc") [
+ optionals (targetPlatform.libc == "uclibc" || targetPlatform.libc == "musl") [
# libsanitizer requires netrom/netrom.h which is not
# available in uclibc.
"--disable-libsanitizer"
diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix
index 0636ce7381a..b9ca8696d4e 100644
--- a/pkgs/development/compilers/gcc/5/default.nix
+++ b/pkgs/development/compilers/gcc/5/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, targetPackages, fetchurl, noSysDirs
+{ stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
, langC ? true, langCC ? true, langFortran ? false
, langObjC ? targetPlatform.isDarwin
, langObjCpp ? targetPlatform.isDarwin
@@ -74,7 +74,11 @@ let version = "5.5.0";
# This could be applied unconditionally but I don't want to cause a full
# Linux rebuild.
- ++ optional stdenv.cc.isClang ./libcxx38-and-above.patch;
+ ++ optional stdenv.cc.isClang ./libcxx38-and-above.patch
+ ++ optional stdenv.hostPlatform.isMusl (fetchpatch {
+ url = https://raw.githubusercontent.com/richfelker/musl-cross-make/e84b1bd1fc12a3def33111ca6df522cd6e5ec361/patches/gcc-5.3.0/0001-musl.diff;
+ sha256 = "0pppbf8myi2kjhm3z3479ihn1cm60kycfv60gj8yy1bs0pl1qcfm";
+ });
javaEcj = fetchurl {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@@ -160,7 +164,7 @@ let version = "5.5.0";
# To keep ABI compatibility with upstream mingw-w64
"--enable-fully-dynamic-string"
] else
- optionals (targetPlatform.libc == "uclibc") [
+ optionals (targetPlatform.libc == "uclibc" || targetPlatform.libc == "musl") [
# libsanitizer requires netrom/netrom.h which is not
# available in uclibc.
"--disable-libsanitizer"
@@ -258,15 +262,22 @@ stdenv.mkDerivation ({
let
libc = if libcCross != null then libcCross else stdenv.cc.libc;
in
- '' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..."
+ (
+ '' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
do
- grep -q LIBC_DYNAMIC_LINKER "$header" || continue
+ grep -q _DYNAMIC_LINKER "$header" || continue
echo " fixing \`$header'..."
sed -i "$header" \
- -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g'
+ -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
+ -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
done
''
+ + stdenv.lib.optionalString (targetPlatform.libc == "musl")
+ ''
+ sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
+ ''
+ )
else null;
# TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild,
@@ -396,6 +407,7 @@ stdenv.mkDerivation ({
# On Illumos/Solaris GNU as is preferred
"--with-gnu-as" "--without-gnu-ld"
]
+ ++ optional (targetPlatform == hostPlatform && targetPlatform.libc == "musl") "--disable-libsanitizer"
;
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix
index 2614e96e1b7..df0c1578dae 100644
--- a/pkgs/development/compilers/gcc/6/default.nix
+++ b/pkgs/development/compilers/gcc/6/default.nix
@@ -142,6 +142,9 @@ let version = "6.4.0";
"--disable-shared"
"--disable-libatomic" # libatomic requires libc
"--disable-decimal-float" # libdecnumber requires libc
+ # maybe only needed on musl, PATH_MAX
+ # https://github.com/richfelker/musl-cross-make/blob/0867cdf300618d1e3e87a0a939fa4427207ad9d7/litecross/Makefile#L62
+ "--disable-libmpx"
] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include")
@@ -158,13 +161,15 @@ let version = "6.4.0";
# To keep ABI compatibility with upstream mingw-w64
"--enable-fully-dynamic-string"
] else
- optionals (targetPlatform.libc == "uclibc") [
+ optionals (targetPlatform.libc == "uclibc" || targetPlatform.libc == "musl") [
# libsanitizer requires netrom/netrom.h which is not
# available in uclibc.
"--disable-libsanitizer"
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
"--disable-libgomp"
+ # musl at least, disable: https://git.buildroot.net/buildroot/commit/?id=873d4019f7fb00f6a80592224236b3ba7d657865
+ "--disable-libmpx"
] ++ [
"--enable-threads=posix"
"--enable-nls"
@@ -257,15 +262,22 @@ stdenv.mkDerivation ({
let
libc = if libcCross != null then libcCross else stdenv.cc.libc;
in
- '' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..."
+ (
+ '' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
do
- grep -q LIBC_DYNAMIC_LINKER "$header" || continue
+ grep -q _DYNAMIC_LINKER "$header" || continue
echo " fixing \`$header'..."
sed -i "$header" \
- -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g'
+ -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
+ -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
done
''
+ + stdenv.lib.optionalString (targetPlatform.libc == "musl")
+ ''
+ sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
+ ''
+ )
else null;
# TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild,
@@ -399,6 +411,7 @@ stdenv.mkDerivation ({
# On Illumos/Solaris GNU as is preferred
"--with-gnu-as" "--without-gnu-ld"
]
+ ++ optional (targetPlatform == hostPlatform && targetPlatform.libc == "musl") "--disable-libsanitizer"
;
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
diff --git a/pkgs/development/compilers/gcc/6/fix-objdump-check.patch b/pkgs/development/compilers/gcc/6/fix-objdump-check.patch
new file mode 100644
index 00000000000..f9adbe9eb1c
--- /dev/null
+++ b/pkgs/development/compilers/gcc/6/fix-objdump-check.patch
@@ -0,0 +1,43 @@
+commit 4c38abe0967bad78dd6baa61c86923e4d4b346d3
+Author: Ben Gamari
+Date: Sun Nov 5 13:14:19 2017 -0500
+
+ Fix it
+
+diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
+index dd06a58..f4435b8 100644
+--- a/config/gcc-plugin.m4
++++ b/config/gcc-plugin.m4
+@@ -13,6 +13,32 @@ dnl the same distribution terms as the rest of that program.
+ # Sets the shell variables enable_plugin and pluginlibs.
+ AC_DEFUN([GCC_ENABLE_PLUGINS],
+ [# Check for plugin support
++
++ # Figure out what objdump we will be using.
++ AS_VAR_SET_IF(gcc_cv_objdump,, [
++ if test -f $gcc_cv_binutils_srcdir/configure.ac \
++ && test -f ../binutils/Makefile \
++ && test x$build = x$host; then
++ # Single tree build which includes binutils.
++ gcc_cv_objdump=../binutils/objdump$build_exeext
++ elif test -x objdump$build_exeext; then
++ gcc_cv_objdump=./objdump$build_exeext
++ elif ( set dummy $OBJDUMP_FOR_TARGET; test -x $[2] ); then
++ gcc_cv_objdump="$OBJDUMP_FOR_TARGET"
++ else
++ AC_PATH_PROG(gcc_cv_objdump, $OBJDUMP_FOR_TARGET)
++ fi])
++
++ AC_MSG_CHECKING(what objdump to use)
++ if test "$gcc_cv_objdump" = ../binutils/objdump$build_exeext; then
++ # Single tree build which includes binutils.
++ AC_MSG_RESULT(newly built objdump)
++ elif test x$gcc_cv_objdump = x; then
++ AC_MSG_RESULT(not found)
++ else
++ AC_MSG_RESULT($gcc_cv_objdump)
++ fi
++
+ AC_ARG_ENABLE(plugin,
+ [AS_HELP_STRING([--enable-plugin], [enable plugin support])],
+ enable_plugin=$enableval,
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix
index 0e5f69c2726..42ac766d2cc 100644
--- a/pkgs/development/compilers/gcc/7/default.nix
+++ b/pkgs/development/compilers/gcc/7/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, targetPackages, fetchurl, noSysDirs
+{ stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
, langC ? true, langCC ? true, langFortran ? false
, langObjC ? targetPlatform.isDarwin
, langObjCpp ? targetPlatform.isDarwin
@@ -67,6 +67,10 @@ let version = "7.3.0";
[ ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch
+ ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
+ url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02";
+ sha256 = "0mrvxsdwip2p3l17dscpc1x8vhdsciqw1z5q9i6p5g9yg1cqnmgs";
+ })
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
# target libraries and tools.
++ optional langAda ../gnat-cflags.patch
@@ -156,7 +160,7 @@ let version = "7.3.0";
# To keep ABI compatibility with upstream mingw-w64
"--enable-fully-dynamic-string"
] else
- optionals (targetPlatform.libc == "uclibc") [
+ optionals (targetPlatform.libc == "uclibc" || targetPlatform.libc == "musl") [
# libsanitizer requires netrom/netrom.h which is not
# available in uclibc.
"--disable-libsanitizer"
@@ -254,15 +258,22 @@ stdenv.mkDerivation ({
let
libc = if libcCross != null then libcCross else stdenv.cc.libc;
in
- '' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..."
+ (
+ '' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
do
- grep -q LIBC_DYNAMIC_LINKER "$header" || continue
+ grep -q _DYNAMIC_LINKER "$header" || continue
echo " fixing \`$header'..."
sed -i "$header" \
- -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g'
+ -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
+ -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
done
''
+ + stdenv.lib.optionalString (hostPlatform.libc == "musl")
+ ''
+ sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
+ ''
+ )
else null;
# TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild,
@@ -392,6 +403,7 @@ stdenv.mkDerivation ({
# On Illumos/Solaris GNU as is preferred
"--with-gnu-as" "--without-gnu-ld"
]
+ ++ optional (targetPlatform == hostPlatform && targetPlatform.libc == "musl") "--disable-libsanitizer"
;
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
diff --git a/pkgs/development/compilers/go/1.8.nix b/pkgs/development/compilers/go/1.8.nix
index e23d742b0c3..7775a17a646 100644
--- a/pkgs/development/compilers/go/1.8.nix
+++ b/pkgs/development/compilers/go/1.8.nix
@@ -38,7 +38,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ perl which pkgconfig patch makeWrapper ]
++ optionals stdenv.isLinux [ procps ];
buildInputs = [ cacert pcre ]
- ++ optionals stdenv.isLinux [ stdenv.glibc.out stdenv.glibc.static ];
+ ++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
+ ++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
propagatedBuildInputs = optionals stdenv.isDarwin [ Security Foundation ];
hardeningDisable = [ "all" ];
diff --git a/pkgs/development/compilers/go/1.9.nix b/pkgs/development/compilers/go/1.9.nix
index 56091791d71..f1017d4a48c 100644
--- a/pkgs/development/compilers/go/1.9.nix
+++ b/pkgs/development/compilers/go/1.9.nix
@@ -38,7 +38,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ perl which pkgconfig patch makeWrapper ]
++ optionals stdenv.isLinux [ procps ];
buildInputs = [ cacert pcre ]
- ++ optionals stdenv.isLinux [ stdenv.glibc.out stdenv.glibc.static ];
+ ++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
+ ++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
propagatedBuildInputs = optionals stdenv.isDarwin [ Security Foundation ];
hardeningDisable = [ "all" ];
diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix
index 17a25889e64..ceaa45fe8d7 100644
--- a/pkgs/development/compilers/llvm/4/llvm.nix
+++ b/pkgs/development/compilers/llvm/4/llvm.nix
@@ -65,7 +65,7 @@ in stdenv.mkDerivation (rec {
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
patch -p1 < ./llvm-outputs.patch
''
- + stdenv.lib.optionalString (stdenv ? glibc) ''
+ + ''
(
cd projects/compiler-rt
patch -p1 < ${
diff --git a/pkgs/development/compilers/zig/default.nix b/pkgs/development/compilers/zig/default.nix
index 6f0c6d19e45..cffc683f9e7 100644
--- a/pkgs/development/compilers/zig/default.nix
+++ b/pkgs/development/compilers/zig/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, llvmPackages_5, llvm_5 }:
+{ stdenv, fetchFromGitHub, cmake, llvmPackages }:
stdenv.mkDerivation rec {
version = "0.1.1";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
sha256 = "01yqjyi25f99bfmxxwyh45k7j84z0zg7n9jl8gg0draf96mzdh06";
};
- buildInputs = [ cmake llvmPackages_5.clang-unwrapped llvm_5 ];
+ buildInputs = [ cmake llvmPackages.clang-unwrapped llvmPackages.llvm ];
cmakeFlags = [
"-DZIG_LIBC_INCLUDE_DIR=${stdenv.cc.libc_dev}/include"
diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix
index 2320d6a8752..edec2724d84 100644
--- a/pkgs/development/haskell-modules/configuration-nix.nix
+++ b/pkgs/development/haskell-modules/configuration-nix.nix
@@ -258,7 +258,7 @@ self: super: builtins.intersectAttrs super {
}
);
- llvm-hs = super.llvm-hs.override { llvm-config = pkgs.llvm_5; };
+ llvm-hs = super.llvm-hs.override { llvm-config = pkgs.llvm; };
# Needs help finding LLVM.
spaceprobe = addBuildTool super.spaceprobe self.llvmPackages.llvm;
diff --git a/pkgs/development/interpreters/lua-5/5.1.nix b/pkgs/development/interpreters/lua-5/5.1.nix
index 1981c15c5f3..1c4fcd2811d 100644
--- a/pkgs/development/interpreters/lua-5/5.1.nix
+++ b/pkgs/development/interpreters/lua-5/5.1.nix
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2" LDFLAGS="" CC="$CC" )
installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.5.1.5.dylib" INSTALL_DATA='cp -d' )
'' else ''
- makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=linux CFLAGS="-DLUA_USE_LINUX -O2 -fPIC" LDFLAGS="-fPIC" )
+ makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=linux CFLAGS="-DLUA_USE_LINUX -O2 -fPIC" LDFLAGS="-fPIC" CC="$CC" AR="$AR q" RANLIB="$RANLIB" )
installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.a liblua.so liblua.so.5.1 liblua.so.5.1.5" INSTALL_DATA='cp -d' )
'';
diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix
index 1cb739b4d29..61f17a959bd 100644
--- a/pkgs/development/interpreters/python/cpython/2.7/default.nix
+++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, hostPlatform, fetchurl
+{ stdenv, hostPlatform, buildPlatform, buildPackages, fetchurl
, bzip2
, gdbm
, fetchpatch
@@ -88,7 +88,6 @@ let
# only works for GCC and Apple Clang. This makes distutils to call C++
# compiler when needed.
./python-2.7-distutils-C++.patch
-
];
preConfigure = ''
@@ -117,6 +116,28 @@ let
"ac_cv_func_bind_textdomain_codeset=yes"
] ++ optionals stdenv.isDarwin [
"--disable-toolbox-glue"
+ ] ++ optionals (hostPlatform != buildPlatform) [
+ "PYTHON_FOR_BUILD=${getBin buildPackages.python}/bin/python"
+ "ac_cv_buggy_getaddrinfo=no"
+ # Assume little-endian IEEE 754 floating point when cross compiling
+ "ac_cv_little_endian_double=yes"
+ "ac_cv_big_endian_double=no"
+ "ac_cv_mixed_endian_double=no"
+ "ac_cv_x87_double_rounding=yes"
+ "ac_cv_tanh_preserves_zero_sign=yes"
+ # Generally assume that things are present and work
+ "ac_cv_posix_semaphores_enabled=yes"
+ "ac_cv_broken_sem_getvalue=no"
+ "ac_cv_wchar_t_signed=yes"
+ "ac_cv_rshift_extends_sign=yes"
+ "ac_cv_broken_nice=no"
+ "ac_cv_broken_poll=no"
+ "ac_cv_working_tzset=yes"
+ "ac_cv_have_long_long_format=yes"
+ "ac_cv_have_size_t_format=yes"
+ "ac_cv_computed_gotos=yes"
+ "ac_cv_file__dev_ptmx=yes"
+ "ac_cv_file__dev_ptc=yes"
];
postConfigure = if hostPlatform.isCygwin then ''
@@ -131,6 +152,9 @@ let
++ [ db gdbm ncurses sqlite readline ]
++ optionals x11Support [ tcl tk xlibsWrapper libX11 ]
++ optionals stdenv.isDarwin ([ CF ] ++ optional (configd != null) configd);
+ nativeBuildInputs =
+ optionals (hostPlatform != buildPlatform)
+ [ buildPackages.stdenv.cc buildPackages.python ];
mkPaths = paths: {
C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths;
@@ -144,7 +168,7 @@ in stdenv.mkDerivation {
name = "python-${version}";
pythonVersion = majorVersion;
- inherit majorVersion version src patches buildInputs
+ inherit majorVersion version src patches buildInputs nativeBuildInputs
preConfigure configureFlags;
LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
@@ -187,7 +211,8 @@ in stdenv.mkDerivation {
# Determinism: Windows installers were not deterministic.
# We're also not interested in building Windows installers.
find "$out" -name 'wininst*.exe' | xargs -r rm -f
-
+ '' + optionalString (stdenv.hostPlatform == stdenv.buildPlatform)
+ ''
# Determinism: rebuild all bytecode
# We exclude lib2to3 because that's Python 2 code which fails
# We rebuild three times, once for each optimization level
diff --git a/pkgs/development/interpreters/python/cpython/3.6/default.nix b/pkgs/development/interpreters/python/cpython/3.6/default.nix
index f48f2c19026..fb58d0871ec 100644
--- a/pkgs/development/interpreters/python/cpython/3.6/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.6/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch
+{ stdenv, fetchurl, fetchpatch, buildPackages
, glibc
, bzip2
, expat
@@ -39,12 +39,15 @@ let
++ optionals x11Support [ tcl tk libX11 xproto ]
++ optionals stdenv.isDarwin [ CF configd ];
+ nativeBuildInputs =
+ optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.python3;
+
in stdenv.mkDerivation {
name = "python3-${version}";
pythonVersion = majorVersion;
inherit majorVersion version;
- inherit buildInputs;
+ inherit buildInputs nativeBuildInputs;
src = fetchurl {
url = "https://www.python.org/ftp/python/${majorVersion}.${minorVersion}/Python-${version}.tar.xz";
@@ -87,6 +90,27 @@ in stdenv.mkDerivation {
"--without-ensurepip"
"--with-system-expat"
"--with-system-ffi"
+ ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "ac_cv_buggy_getaddrinfo=no"
+ # Assume little-endian IEEE 754 floating point when cross compiling
+ "ac_cv_little_endian_double=yes"
+ "ac_cv_big_endian_double=no"
+ "ac_cv_mixed_endian_double=no"
+ "ac_cv_x87_double_rounding=yes"
+ "ac_cv_tanh_preserves_zero_sign=yes"
+ # Generally assume that things are present and work
+ "ac_cv_posix_semaphores_enabled=yes"
+ "ac_cv_broken_sem_getvalue=no"
+ "ac_cv_wchar_t_signed=yes"
+ "ac_cv_rshift_extends_sign=yes"
+ "ac_cv_broken_nice=no"
+ "ac_cv_broken_poll=no"
+ "ac_cv_working_tzset=yes"
+ "ac_cv_have_long_long_format=yes"
+ "ac_cv_have_size_t_format=yes"
+ "ac_cv_computed_gotos=yes"
+ "ac_cv_file__dev_ptmx=yes"
+ "ac_cv_file__dev_ptc=yes"
];
preConfigure = ''
@@ -139,7 +163,7 @@ in stdenv.mkDerivation {
for i in $out/lib/python${majorVersion}/_sysconfigdata*.py $out/lib/python${majorVersion}/config-${majorVersion}m*/Makefile; do
sed -i $i -e "s|-I/nix/store/[^ ']*||g" -e "s|-L/nix/store/[^ ']*||g" -e "s|$TMPDIR|/no-such-path|g"
done
-
+ '' + optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
# Determinism: rebuild all bytecode
# We exclude lib2to3 because that's Python 2 code which fails
# We rebuild three times, once for each optimization level
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index 279f38f7591..a53df02f9b9 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, lib, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub
+{ stdenv, buildPackages, lib
+, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub
, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison
, autoconf, darwin ? null
, buildEnv, bundler, bundix, Foundation
@@ -22,6 +23,12 @@ let
# Contains the ruby version heuristics
rubyVersion = import ./ruby-version.nix { inherit lib; };
+ # Needed during postInstall
+ buildRuby =
+ if stdenv.hostPlatform == stdenv.buildPlatform
+ then "$out/bin/ruby"
+ else "${buildPackages.ruby}/bin/ruby";
+
generic = { version, sha256 }: let
ver = version;
tag = ver.gitTag;
@@ -30,7 +37,8 @@ let
isRuby25 = ver.majMin == "2.5";
baseruby = self.override { useRailsExpress = false; };
self = lib.makeOverridable (
- { stdenv, lib, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub
+ { stdenv, buildPackages, lib
+ , fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub
, useRailsExpress ? true
, zlib, zlibSupport ? true
, openssl, opensslSupport ? true
@@ -65,9 +73,13 @@ let
unpackdir rubySrc;
# Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
- NROFF = "${groff}/bin/nroff";
+ NROFF = if docSupport then "${groff}/bin/nroff" else null;
- nativeBuildInputs = ops useRailsExpress [ autoreconfHook bison ];
+ nativeBuildInputs =
+ ops useRailsExpress [ autoreconfHook bison ]
+ ++ ops (stdenv.buildPlatform != stdenv.hostPlatform) [
+ buildPackages.ruby
+ ];
buildInputs =
(op fiddleSupport libffi)
++ (ops cursesSupport [ ncurses readline ])
@@ -120,14 +132,16 @@ let
"--with-out-ext=tk"
# on yosemite, "generating encdb.h" will hang for a very long time without this flag
"--with-setjmp-type=setjmp"
- ];
+ ]
+ ++ op (stdenv.hostPlatform != stdenv.buildPlatform)
+ "--with-baseruby=${buildRuby}";
installFlags = stdenv.lib.optionalString docSupport "install-doc";
# Bundler tries to create this directory
postInstall = ''
# Update rubygems
pushd rubygems
- $out/bin/ruby setup.rb
+ ${buildRuby} setup.rb
popd
# Remove unnecessary groff reference from runtime closure, since it's big
diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix
index e10d62bb98d..82051854799 100644
--- a/pkgs/development/libraries/SDL/default.nix
+++ b/pkgs/development/libraries/SDL/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, pkgconfig, audiofile, libcap
+{ stdenv, fetchurl, fetchpatch, pkgconfig, audiofile, libcap, libiconv
, openglSupport ? false, mesa_noglu, mesa_glu
, alsaSupport ? true, alsaLib
, x11Support ? hostPlatform == buildPlatform, libXext, libICE, libXrandr
@@ -40,7 +40,8 @@ stdenv.mkDerivation rec {
buildInputs = let
notMingw = !hostPlatform.isMinGW;
in optional notMingw audiofile
- ++ optionals stdenv.isDarwin [ OpenGL CoreAudio CoreServices AudioUnit Kernel ];
+ ++ optionals stdenv.isDarwin [ OpenGL CoreAudio CoreServices AudioUnit Kernel ]
+ ++ [ libiconv ];
# XXX: By default, SDL wants to dlopen() PulseAudio, in which case
# we must arrange to add it to its RPATH; however, `patchelf' seems
diff --git a/pkgs/development/libraries/SDL2/default.nix b/pkgs/development/libraries/SDL2/default.nix
index d75aea726e1..6b6c9599c28 100644
--- a/pkgs/development/libraries/SDL2/default.nix
+++ b/pkgs/development/libraries/SDL2/default.nix
@@ -8,6 +8,7 @@
, ibusSupport ? false, ibus
, pulseaudioSupport ? true, libpulseaudio
, AudioUnit, Cocoa, CoreAudio, CoreServices, ForceFeedback, OpenGL
+, libiconv
}:
# OSS is no longer supported, for it's much crappier than ALSA and
@@ -41,7 +42,8 @@ stdenv.mkDerivation rec {
# Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
propagatedBuildInputs = lib.optionals x11Support [ libICE libXi libXScrnSaver libXcursor libXinerama libXext libXrandr libXxf86vm ] ++
lib.optionals waylandSupport [ wayland wayland-protocols libxkbcommon ] ++
- lib.optional pulseaudioSupport libpulseaudio;
+ lib.optional pulseaudioSupport libpulseaudio
+ ++ [ libiconv ];
buildInputs = [ audiofile ] ++
lib.optional openglSupport mesa_noglu ++
diff --git a/pkgs/development/libraries/attr/default.nix b/pkgs/development/libraries/attr/default.nix
index dd23fcb7389..0bfeaf81a81 100644
--- a/pkgs/development/libraries/attr/default.nix
+++ b/pkgs/development/libraries/attr/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gettext }:
+{ stdenv, fetchurl, gettext, hostPlatform }:
stdenv.mkDerivation rec {
name = "attr-2.4.47";
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
installTargets = [ "install" "install-lib" "install-dev" ];
+ patches = if (hostPlatform.libc == "musl") then [ ./fix-headers-musl.patch ] else null;
+
meta = with stdenv.lib; {
homepage = "http://savannah.nongnu.org/projects/attr/";
description = "Library and tools for manipulating extended attributes";
diff --git a/pkgs/development/libraries/attr/fix-headers-musl.patch b/pkgs/development/libraries/attr/fix-headers-musl.patch
new file mode 100644
index 00000000000..e969f640eee
--- /dev/null
+++ b/pkgs/development/libraries/attr/fix-headers-musl.patch
@@ -0,0 +1,54 @@
+--- attr-2.4.47/include/xattr.h
++++ attr-2.4.47/include/xattr.h
+@@ -31,33 +31,37 @@
+ #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
+
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ extern int setxattr (const char *__path, const char *__name,
+- const void *__value, size_t __size, int __flags) __THROW;
++ const void *__value, size_t __size, int __flags);
+ extern int lsetxattr (const char *__path, const char *__name,
+- const void *__value, size_t __size, int __flags) __THROW;
++ const void *__value, size_t __size, int __flags);
+ extern int fsetxattr (int __filedes, const char *__name,
+- const void *__value, size_t __size, int __flags) __THROW;
++ const void *__value, size_t __size, int __flags);
+
+ extern ssize_t getxattr (const char *__path, const char *__name,
+- void *__value, size_t __size) __THROW;
++ void *__value, size_t __size);
+ extern ssize_t lgetxattr (const char *__path, const char *__name,
+- void *__value, size_t __size) __THROW;
++ void *__value, size_t __size);
+ extern ssize_t fgetxattr (int __filedes, const char *__name,
+- void *__value, size_t __size) __THROW;
++ void *__value, size_t __size);
+
+ extern ssize_t listxattr (const char *__path, char *__list,
+- size_t __size) __THROW;
++ size_t __size);
+ extern ssize_t llistxattr (const char *__path, char *__list,
+- size_t __size) __THROW;
++ size_t __size);
+ extern ssize_t flistxattr (int __filedes, char *__list,
+- size_t __size) __THROW;
++ size_t __size);
+
+-extern int removexattr (const char *__path, const char *__name) __THROW;
+-extern int lremovexattr (const char *__path, const char *__name) __THROW;
+-extern int fremovexattr (int __filedes, const char *__name) __THROW;
++extern int removexattr (const char *__path, const char *__name);
++extern int lremovexattr (const char *__path, const char *__name);
++extern int fremovexattr (int __filedes, const char *__name);
+
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
+
+ #endif /* __XATTR_H__ */
diff --git a/pkgs/development/libraries/aws-sdk-cpp/default.nix b/pkgs/development/libraries/aws-sdk-cpp/default.nix
index 47d9e7dba4c..26511c22d0b 100644
--- a/pkgs/development/libraries/aws-sdk-cpp/default.nix
+++ b/pkgs/development/libraries/aws-sdk-cpp/default.nix
@@ -33,6 +33,7 @@ in stdenv.mkDerivation rec {
cmakeFlags =
lib.optional (!customMemoryManagement) "-DCUSTOM_MEMORY_MANAGEMENT=0"
+ ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "-DENABLE_TESTING=OFF"
++ lib.optional (apis != ["*"])
"-DBUILD_ONLY=${lib.concatStringsSep ";" apis}";
diff --git a/pkgs/development/libraries/boehm-gc/default.nix b/pkgs/development/libraries/boehm-gc/default.nix
index f3c58a93872..c1bcb46bae6 100644
--- a/pkgs/development/libraries/boehm-gc/default.nix
+++ b/pkgs/development/libraries/boehm-gc/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, pkgconfig, libatomic_ops, enableLargeConfig ? false
+{ lib, stdenv, fetchurl, fetchpatch, pkgconfig, libatomic_ops, enableLargeConfig ? false
, buildPlatform, hostPlatform
}:
@@ -20,9 +20,19 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" "doc" ];
separateDebugInfo = stdenv.isLinux;
+ preConfigure = stdenv.lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
+ export NIX_CFLAGS_COMPILE+="-D_GNU_SOURCE -DUSE_MMAP -DHAVE_DL_ITERATE_PHDR"
+ '';
+
+ patches = [ (fetchpatch {
+ url = "https://raw.githubusercontent.com/gentoo/musl/85b6a600996bdd71162b357e9ba93d8559342432/dev-libs/boehm-gc/files/boehm-gc-7.6.0-sys_select.patch";
+ sha256 = "1gydwlklvci30f5dpp5ccw2p2qpph5y41r55wx9idamjlq66fbb3";
+ }) ];
+
configureFlags =
[ "--enable-cplusplus" ]
- ++ lib.optional enableLargeConfig "--enable-large-config";
+ ++ lib.optional enableLargeConfig "--enable-large-config"
+ ++ lib.optional (stdenv.hostPlatform.libc == "musl") "--disable-static";
doCheck = true; # not cross;
diff --git a/pkgs/development/libraries/fftw/default.nix b/pkgs/development/libraries/fftw/default.nix
index 36c824c7528..70120997107 100644
--- a/pkgs/development/libraries/fftw/default.nix
+++ b/pkgs/development/libraries/fftw/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
# all x86_64 have sse2
# however, not all float sizes fit
++ optional (stdenv.isx86_64 && (precision == "single" || precision == "double") ) "--enable-sse2"
- ++ optional stdenv.cc.isGNU "--enable-openmp"
+ ++ optional (stdenv.cc.isGNU && !stdenv.hostPlatform.isMusl) "--enable-openmp"
# doc generation causes Fortran wrapper generation which hard-codes gcc
++ optional (!withDoc) "--disable-doc";
diff --git a/pkgs/development/libraries/gamin/default.nix b/pkgs/development/libraries/gamin/default.nix
index e6b1875a9e0..2dd32b6f110 100644
--- a/pkgs/development/libraries/gamin/default.nix
+++ b/pkgs/development/libraries/gamin/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python, pkgconfig, glib }:
+{ stdenv, fetchurl, fetchpatch, python, pkgconfig, glib }:
stdenv.mkDerivation (rec {
name = "gamin-0.1.10";
@@ -18,7 +18,12 @@ stdenv.mkDerivation (rec {
patches = [ ./deadlock.patch ]
++ map fetchurl (import ./debian-patches.nix)
- ++ stdenv.lib.optional stdenv.cc.isClang ./returnval.patch;
+ ++ stdenv.lib.optional stdenv.cc.isClang ./returnval.patch
+ ++ stdenv.lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
+ name = "fix-pthread-mutex.patch";
+ url = "https://git.alpinelinux.org/cgit/aports/plain/main/gamin/fix-pthread-mutex.patch?h=3.4-stable&id=a1a836b089573752c1b0da7d144c0948b04e8ea8";
+ sha256 = "13igdbqsxb3sz0h417k6ifmq2n4siwqspj6slhc7fdl5wd1fxmdz";
+ });
meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix
index b17d4effb1e..d40733adf87 100644
--- a/pkgs/development/libraries/glibc/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -222,6 +222,6 @@ stdenv.mkDerivation ({
# To avoid a dependency on the build system 'bash'.
preFixup = ''
- rm $bin/bin/{ldd,tzselect,catchsegv,xtrace}
+ rm -f $bin/bin/{ldd,tzselect,catchsegv,xtrace}
'';
})
diff --git a/pkgs/development/libraries/glibc/locales.nix b/pkgs/development/libraries/glibc/locales.nix
index debd7b39c86..7090c5cecee 100644
--- a/pkgs/development/libraries/glibc/locales.nix
+++ b/pkgs/development/libraries/glibc/locales.nix
@@ -6,7 +6,7 @@
https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/SUPPORTED
*/
-{ stdenv, callPackage, writeText
+{ stdenv, buildPackages, callPackage, writeText
, allLocales ? true, locales ? [ "en_US.UTF-8/UTF-8" ]
}:
@@ -26,7 +26,7 @@ callPackage ./common.nix { inherit stdenv; } {
# $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
buildPhase =
''
- mkdir -p $TMPDIR/"${stdenv.cc.libc.out}/lib/locale"
+ mkdir -p $TMPDIR/"${buildPackages.stdenv.cc.libc.out}/lib/locale"
# Hack to allow building of the locales (needed since glibc-2.12)
sed -i -e 's,^$(rtld-prefix) $(common-objpfx)locale/localedef,localedef --prefix='$TMPDIR',' ../glibc-2*/localedata/Makefile
diff --git a/pkgs/development/libraries/icu/base.nix b/pkgs/development/libraries/icu/base.nix
index 6d9a9725cc2..2c8392c8bac 100644
--- a/pkgs/development/libraries/icu/base.nix
+++ b/pkgs/development/libraries/icu/base.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
'';
# https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
- postPatch = if stdenv ? glibc
+ postPatch = if (stdenv.hostPlatform.libc == "glibc" || stdenv.hostPlatform.libc == "musl")
then "substituteInPlace i18n/digitlst.cpp --replace '' ''"
else null; # won't find locale_t on darwin
diff --git a/pkgs/development/libraries/libbfd/default.nix b/pkgs/development/libraries/libbfd/default.nix
index 5bcf243155b..018239a3e77 100644
--- a/pkgs/development/libraries/libbfd/default.nix
+++ b/pkgs/development/libraries/libbfd/default.nix
@@ -1,5 +1,5 @@
{ stdenv
-, fetchurl, autoreconfHook264, bison, binutils-raw
+, fetchurl, fetchpatch, gnu-config, autoreconfHook264, bison, binutils-raw
, libiberty, zlib
}:
@@ -11,6 +11,10 @@ stdenv.mkDerivation rec {
patches = binutils-raw.bintools.patches ++ [
../../tools/misc/binutils/build-components-separately.patch
+ (fetchpatch {
+ url = "https://raw.githubusercontent.com/mxe/mxe/e1d4c144ee1994f70f86cf7fd8168fe69bd629c6/src/bfd-1-disable-subdir-doc.patch";
+ sha256 = "0pzb3i74d1r7lhjan376h59a7kirw15j7swwm8pz3zy9lkdqkj6q";
+ })
];
# We just want to build libbfd
@@ -18,6 +22,14 @@ stdenv.mkDerivation rec {
cd bfd
'';
+ postAutoreconf = ''
+ echo "Updating config.guess and config.sub from ${gnu-config}"
+ cp -f ${gnu-config}/config.{guess,sub} ../
+ '';
+
+ # We update these ourselves
+ dontUpdateAutotoolsGnuConfigScripts = true;
+
nativeBuildInputs = [ autoreconfHook264 bison ];
buildInputs = [ libiberty zlib ];
diff --git a/pkgs/development/libraries/libclc/default.nix b/pkgs/development/libraries/libclc/default.nix
index bd9130e3f50..a83a3c672c0 100644
--- a/pkgs/development/libraries/libclc/default.nix
+++ b/pkgs/development/libraries/libclc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, python2, llvmPackages }:
+{ stdenv, fetchFromGitHub, python, llvmPackages }:
let
llvm = llvmPackages.llvm;
@@ -15,7 +15,8 @@ stdenv.mkDerivation {
sha256 = "10fqrlnqlknh58x7pfsbg9r07fblfg2mgq2m4fr1jbb836ncn3wh";
};
- buildInputs = [ python2 llvm clang ];
+ nativeBuildInputs = [ python ];
+ buildInputs = [ llvm clang ];
postPatch = ''
sed -i 's,llvm_clang =.*,llvm_clang = "${clang}/bin/clang",' configure.py
@@ -23,7 +24,7 @@ stdenv.mkDerivation {
'';
configurePhase = ''
- ${python2.interpreter} ./configure.py --prefix=$out
+ ${python.interpreter} ./configure.py --prefix=$out
'';
meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/libdaemon/default.nix b/pkgs/development/libraries/libdaemon/default.nix
index af832a70a73..59e576fd392 100644
--- a/pkgs/development/libraries/libdaemon/default.nix
+++ b/pkgs/development/libraries/libdaemon/default.nix
@@ -1,6 +1,6 @@
{stdenv, fetchurl}:
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (rec {
name = "libdaemon-0.14";
src = fetchurl {
@@ -24,4 +24,8 @@ stdenv.mkDerivation rec {
platforms = stdenv.lib.platforms.unix;
maintainers = [ ];
};
-}
+} // stdenv.lib.optionalAttrs stdenv.hostPlatform.isMusl {
+ # This patch should be applied unconditionally, but doing so will cause mass rebuild.
+ patches = ./fix-includes.patch;
+})
+
diff --git a/pkgs/development/libraries/libdaemon/fix-includes.patch b/pkgs/development/libraries/libdaemon/fix-includes.patch
new file mode 100644
index 00000000000..51c5133afed
--- /dev/null
+++ b/pkgs/development/libraries/libdaemon/fix-includes.patch
@@ -0,0 +1,13 @@
+--- libdaemon-0.14.orig/examples/testd.c
++++ libdaemon-0.14/examples/testd.c
+@@ -21,9 +21,9 @@
+ #include
+ #include
+ #include
++#include
+ #include
+ #include
+-#include
+ #include
+
+ #include
diff --git a/pkgs/development/libraries/libexecinfo/default.nix b/pkgs/development/libraries/libexecinfo/default.nix
new file mode 100644
index 00000000000..a61d51aa6b7
--- /dev/null
+++ b/pkgs/development/libraries/libexecinfo/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation rec {
+ name = "libexecinfo-${version}";
+ version = "1.1";
+
+ src = fetchurl {
+ url = "http://distcache.freebsd.org/local-distfiles/itetcu/${name}.tar.bz2";
+ sha256 = "07wvlpc1jk1sj4k5w53ml6wagh0zm9kv2l1jngv8xb7xww9ik8n9";
+ };
+
+ patches = [
+ (fetchpatch {
+ name = "10-execinfo.patch";
+ url = https://git.alpinelinux.org/cgit/aports/plain/main/libexecinfo/10-execinfo.patch?id=730cdcef6901750f4029d4c3b8639ce02ee3ead1;
+ sha256 = "0lnphrad4vspyljnvmm62dyxj98vgp3wabj4w3vfzfph7j8piw7g";
+ })
+ (fetchpatch {
+ name = "20-define-gnu-source.patch";
+ url = https://git.alpinelinux.org/cgit/aports/plain/main/libexecinfo/20-define-gnu-source.patch?id=730cdcef6901750f4029d4c3b8639ce02ee3ead1;
+ sha256 = "1mp8mc639b0h2s69m5z6s2h3q3n1zl298j9j0plzj7f979j76302";
+ })
+ (fetchpatch {
+ name = "30-linux-makefile.patch";
+ url = https://git.alpinelinux.org/cgit/aports/plain/main/libexecinfo/30-linux-makefile.patch?id=730cdcef6901750f4029d4c3b8639ce02ee3ead1;
+ sha256 = "1jwjz22z5cjy5h2bfghn62yl9ar8jiqhdvbwrcfavv17ihbhwcaf";
+ })
+ ];
+
+ makeFlags = [ "CC:=$(CC)" "AR:=$(AR)" ];
+
+ patchFlags = "-p0";
+
+ installPhase = ''
+ install -Dm644 execinfo.h stacktraverse.h -t $out/include
+ install -Dm755 libexecinfo.{a,so.1} -t $out/lib
+ ln -s $out/lib/libexecinfo.so{.1,}
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Quick-n-dirty BSD licensed clone of the GNU libc backtrace facility";
+ license = licenses.bsd2;
+ homepage = https://www.freshports.org/devel/libexecinfo;
+ maintainers = with maintainers; [ dtzWill ];
+ };
+}
diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix
index e48db6c9928..1339be451c2 100644
--- a/pkgs/development/libraries/libffi/default.nix
+++ b/pkgs/development/libraries/libffi/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, dejagnu, doCheck ? false
+{ stdenv, fetchurl, fetchpatch, dejagnu, doCheck ? false
, buildPlatform, hostPlatform
}:
@@ -10,11 +10,28 @@ stdenv.mkDerivation rec {
sha256 = "0dya49bnhianl0r65m65xndz6ls2jn1xngyn72gd28ls3n7bnvnh";
};
- patches = stdenv.lib.optional stdenv.isCygwin ./3.2.1-cygwin.patch ++
- stdenv.lib.optional stdenv.isAarch64 (fetchurl {
+ patches = stdenv.lib.optional stdenv.isCygwin ./3.2.1-cygwin.patch
+ ++ stdenv.lib.optional stdenv.isAarch64 (fetchpatch {
url = https://src.fedoraproject.org/rpms/libffi/raw/ccffc1700abfadb0969495a6e51b964117fc03f6/f/libffi-aarch64-rhbz1174037.patch;
sha256 = "1vpirrgny43hp0885rswgv3xski8hg7791vskpbg3wdjdpb20wbc";
- });
+ })
+ ++ stdenv.lib.optional hostPlatform.isMusl (fetchpatch {
+ name = "gnu-linux-define.patch";
+ url = "https://git.alpinelinux.org/cgit/aports/plain/main/libffi/gnu-linux-define.patch?id=bb024fd8ec6f27a76d88396c9f7c5c4b5800d580";
+ sha256 = "11pvy3xkhyvnjfyy293v51f1xjy3x0azrahv1nw9y9mw8bifa2j2";
+ })
+ ++ stdenv.lib.optionals stdenv.isMips [
+ (fetchpatch {
+ name = "0001-mips-Use-compiler-internal-define-for-linux.patch";
+ url = "http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-support/libffi/libffi/0001-mips-Use-compiler-internal-define-for-linux.patch?id=318e33a708378652edcf61ce7d9d7f3a07743000";
+ sha256 = "1gc53lw90p6hc0cmhj3csrwincfz7va5ss995ksw5gm0yrr9mrvb";
+ })
+ (fetchpatch {
+ name = "0001-mips-fix-MIPS-softfloat-build-issue.patch";
+ url = "http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-support/libffi/libffi/0001-mips-fix-MIPS-softfloat-build-issue.patch?id=318e33a708378652edcf61ce7d9d7f3a07743000";
+ sha256 = "0l8xgdciqalg4z9rcwyk87h8fdxpfv4hfqxwsy2agpnpszl5jjdq";
+ })
+ ];
outputs = [ "out" "dev" "man" "info" ];
diff --git a/pkgs/development/libraries/libgpg-error/default.nix b/pkgs/development/libraries/libgpg-error/default.nix
index 9faf7a40458..e6cb62330c4 100644
--- a/pkgs/development/libraries/libgpg-error/default.nix
+++ b/pkgs/development/libraries/libgpg-error/default.nix
@@ -9,7 +9,11 @@ stdenv.mkDerivation rec {
sha256 = "1li95ni122fzinzlmxbln63nmgij63irxfvi52ws4zfbzv3am4sg";
};
- postPatch = "sed '/BUILD_TIMESTAMP=/s/=.*/=1970-01-01T00:01+0000/' -i ./configure";
+ postPatch = ''
+ sed '/BUILD_TIMESTAMP=/s/=.*/=1970-01-01T00:01+0000/' -i ./configure
+ '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+ ln -s lock-obj-pub.x86_64-pc-linux-musl.h src/syscfg/lock-obj-pub.linux-musl.h
+ '';
outputs = [ "out" "dev" "info" ];
outputBin = "dev"; # deps want just the lib, most likely
diff --git a/pkgs/development/libraries/libiconv/default.nix b/pkgs/development/libraries/libiconv/default.nix
index 89946512410..21abf7f8c07 100644
--- a/pkgs/development/libraries/libiconv/default.nix
+++ b/pkgs/development/libraries/libiconv/default.nix
@@ -2,7 +2,7 @@
, buildPlatform, hostPlatform
}:
-assert !stdenv.isLinux || hostPlatform != buildPlatform; # TODO: improve on cross
+# assert !stdenv.isLinux || hostPlatform != buildPlatform; # TODO: improve on cross
stdenv.mkDerivation rec {
name = "libiconv-${version}";
diff --git a/pkgs/development/libraries/libidn/default.nix b/pkgs/development/libraries/libidn/default.nix
index df92693de5a..147d6bac2f9 100644
--- a/pkgs/development/libraries/libidn/default.nix
+++ b/pkgs/development/libraries/libidn/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
outputs = [ "bin" "dev" "out" "info" "devdoc" ];
- doCheck = (stdenv.buildPlatform == stdenv.hostPlatform) && !stdenv.isDarwin;
+ doCheck = !stdenv.isDarwin && !stdenv.hostPlatform.isMusl;
hardeningDisable = [ "format" ];
diff --git a/pkgs/development/libraries/libmemcached/default.nix b/pkgs/development/libraries/libmemcached/default.nix
index 086ba8f32d2..6d895290e2c 100644
--- a/pkgs/development/libraries/libmemcached/default.nix
+++ b/pkgs/development/libraries/libmemcached/default.nix
@@ -17,7 +17,8 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional stdenv.isDarwin (fetchpatch {
url = "https://raw.githubusercontent.com/Homebrew/homebrew/bfd4a0a4626b61c2511fdf573bcbbc6bbe86340e/Library/Formula/libmemcached.rb";
sha256 = "1gjf3vd7hiyzxjvlg2zfc3y2j0lyr6nhbws4xb5dmin3csyp8qb8";
- });
+ })
+ ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./musl-fixes.patch;
buildInputs = [ libevent ];
propagatedBuildInputs = [ cyrus_sasl ];
diff --git a/pkgs/development/libraries/libmemcached/musl-fixes.patch b/pkgs/development/libraries/libmemcached/musl-fixes.patch
new file mode 100644
index 00000000000..eb2a6bc980e
--- /dev/null
+++ b/pkgs/development/libraries/libmemcached/musl-fixes.patch
@@ -0,0 +1,58 @@
+diff --git a/libhashkit/fnv_64.cc b/libhashkit/fnv_64.cc
+index 68e4dd0..64656b7 100644
+--- a/libhashkit/fnv_64.cc
++++ b/libhashkit/fnv_64.cc
+@@ -37,8 +37,9 @@
+
+
+ #include
++#include
+
+-#if __WORDSIZE == 64 && defined(HAVE_FNV64_HASH)
++#if (LONG_BITS == 64) && defined(HAVE_FNV64_HASH)
+
+ /* FNV hash'es lifted from Dustin Sallings work */
+ static uint64_t FNV_64_INIT= 0xcbf29ce484222325;
+diff --git a/libhashkit/has.cc b/libhashkit/has.cc
+index 843e32e..4153e5e 100644
+--- a/libhashkit/has.cc
++++ b/libhashkit/has.cc
+@@ -37,6 +37,7 @@
+
+
+ #include
++#include
+
+ bool libhashkit_has_algorithm(const hashkit_hash_algorithm_t algo)
+ {
+@@ -44,7 +45,7 @@ bool libhashkit_has_algorithm(const hashkit_hash_algorithm_t algo)
+ {
+ case HASHKIT_HASH_FNV1_64:
+ case HASHKIT_HASH_FNV1A_64:
+-#if __WORDSIZE == 64 && defined(HAVE_FNV64_HASH)
++#if (LONG_BITS == 64) && defined(HAVE_FNV64_HASH)
+ return true;
+ #else
+ return false;
+diff --git a/libtest/cmdline.cc b/libtest/cmdline.cc
+index 29a22de..161c646 100644
+--- a/libtest/cmdline.cc
++++ b/libtest/cmdline.cc
+@@ -61,7 +61,7 @@ using namespace libtest;
+ #include
+ #include
+
+-#ifndef __USE_GNU
++#ifndef _GNU_SOURCE
+ static char **environ= NULL;
+ #endif
+
+@@ -201,7 +201,7 @@ Application::error_t Application::run(const char *args[])
+
+ fatal_assert(posix_spawnattr_setsigmask(&spawnattr, &mask) == 0);
+
+-#if defined(POSIX_SPAWN_USEVFORK) || defined(__linux__)
++#if defined(POSIX_SPAWN_USEVFORK) || defined(__GLIBC__)
+ // Use USEVFORK on linux
+ flags |= POSIX_SPAWN_USEVFORK;
+ #endif
diff --git a/pkgs/development/libraries/libmpc/default.nix b/pkgs/development/libraries/libmpc/default.nix
index 97366d24c36..106f6fe6c37 100644
--- a/pkgs/development/libraries/libmpc/default.nix
+++ b/pkgs/development/libraries/libmpc/default.nix
@@ -1,23 +1,20 @@
{ stdenv, fetchurl
, gmp, mpfr
-, buildPlatform, hostPlatform
}:
let
- version = "1.0.3";
+ version = "1.1.0";
in
stdenv.mkDerivation rec {
name = "libmpc-${version}"; # to avoid clash with the MPD client
src = fetchurl {
- url = "https://ftp.gnu.org/gnu/mpc/mpc-${version}.tar.gz";
- sha256 = "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1";
+ url = "mirror://gnu/mpc/mpc-${version}.tar.gz";
+ sha256 = "0biwnhjm3rx3hc0rfpvyniky4lpzsvdcwhmcn7f0h4iw2hwcb1b9";
};
buildInputs = [ gmp mpfr ];
- CFLAGS = "-I${gmp.dev}/include";
-
doCheck = true; # not cross;
meta = {
diff --git a/pkgs/development/libraries/libnet/default.nix b/pkgs/development/libraries/libnet/default.nix
index a93c16d784d..f642ad5ccfa 100644
--- a/pkgs/development/libraries/libnet/default.nix
+++ b/pkgs/development/libraries/libnet/default.nix
@@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
sha256 = "0qsapqa7dzq9f6lb19kzilif0pj82b64fjv5bq086hflb9w81hvj";
};
+ patches = [ ./fix-includes.patch ];
+
meta = with stdenv.lib; {
homepage = https://github.com/sam-github/libnet;
description = "Portable framework for low-level network packet construction";
diff --git a/pkgs/development/libraries/libnet/fix-includes.patch b/pkgs/development/libraries/libnet/fix-includes.patch
new file mode 100644
index 00000000000..5eb86bc37b7
--- /dev/null
+++ b/pkgs/development/libraries/libnet/fix-includes.patch
@@ -0,0 +1,29 @@
+--- libnet-1.1.6.orig/src/libnet_link_linux.c
++++ libnet-1.1.6/src/libnet_link_linux.c
+@@ -30,26 +30,15 @@
+ #include
+
+ #include
+-#if (__GLIBC__)
+ #include
+ #include
+-#else
+-#include
+-#include
+-#endif
+
+ #if (HAVE_PACKET_SOCKET)
+ #ifndef SOL_PACKET
+ #define SOL_PACKET 263
+ #endif /* SOL_PACKET */
+-#if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1
+ #include
+ #include /* the L2 protocols */
+-#else
+-#include
+-#include
+-#include /* The L2 protocols */
+-#endif
+ #endif /* HAVE_PACKET_SOCKET */
+
+ #include "../include/libnet.h"
diff --git a/pkgs/development/libraries/libnfnetlink/Use-stdlib-uint-instead-of-u_int.patch b/pkgs/development/libraries/libnfnetlink/Use-stdlib-uint-instead-of-u_int.patch
new file mode 100644
index 00000000000..074bef42b97
--- /dev/null
+++ b/pkgs/development/libraries/libnfnetlink/Use-stdlib-uint-instead-of-u_int.patch
@@ -0,0 +1,499 @@
+From patchwork Fri Apr 3 22:04:46 2015
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: Use stdlib uint* instead of u_int*
+From: Nathan McSween
+X-Patchwork-Id: 458131
+X-Patchwork-Delegate: pablo@netfilter.org
+Message-Id: <1428098686-17843-1-git-send-email-nwmcsween@gmail.com>
+To: netfilter-devel@vger.kernel.org
+Cc: Nathan McSween
+Date: Fri, 3 Apr 2015 22:04:46 +0000
+
+Signed-off-by: Nathan McSween
+---
+ include/libnfnetlink/libnfnetlink.h | 25 +++++-----
+ include/libnfnetlink/linux_nfnetlink.h | 11 +++--
+ include/libnfnetlink/linux_nfnetlink_compat.h | 6 ++-
+ src/iftable.c | 9 ++--
+ src/iftable.h | 6 ++-
+ src/libnfnetlink.c | 71 ++++++++++++++-------------
+ src/rtnl.c | 5 +-
+ src/rtnl.h | 3 +-
+ 8 files changed, 73 insertions(+), 63 deletions(-)
+
+diff --git a/include/libnfnetlink/libnfnetlink.h b/include/libnfnetlink/libnfnetlink.h
+index 1d8c49d..cd0be3d 100644
+--- a/include/libnfnetlink/libnfnetlink.h
++++ b/include/libnfnetlink/libnfnetlink.h
+@@ -15,6 +15,7 @@
+ #define aligned_u64 unsigned long long __attribute__((aligned(8)))
+ #endif
+
++#include
+ #include /* for sa_family_t */
+ #include
+ #include
+@@ -55,7 +56,7 @@ struct nfnlhdr {
+ struct nfnl_callback {
+ int (*call)(struct nlmsghdr *nlh, struct nfattr *nfa[], void *data);
+ void *data;
+- u_int16_t attr_count;
++ uint16_t attr_count;
+ };
+
+ struct nfnl_handle;
+@@ -69,7 +70,7 @@ extern struct nfnl_handle *nfnl_open(void);
+ extern int nfnl_close(struct nfnl_handle *);
+
+ extern struct nfnl_subsys_handle *nfnl_subsys_open(struct nfnl_handle *,
+- u_int8_t, u_int8_t,
++ uint8_t, uint8_t,
+ unsigned int);
+ extern void nfnl_subsys_close(struct nfnl_subsys_handle *);
+
+@@ -88,8 +89,8 @@ extern int nfnl_sendiov(const struct nfnl_handle *nfnlh,
+ const struct iovec *iov, unsigned int num,
+ unsigned int flags);
+ extern void nfnl_fill_hdr(struct nfnl_subsys_handle *, struct nlmsghdr *,
+- unsigned int, u_int8_t, u_int16_t, u_int16_t,
+- u_int16_t);
++ unsigned int, uint8_t, uint16_t, uint16_t,
++ uint16_t);
+ extern __attribute__((deprecated)) int
+ nfnl_talk(struct nfnl_handle *, struct nlmsghdr *, pid_t,
+ unsigned, struct nlmsghdr *,
+@@ -103,8 +104,8 @@ nfnl_listen(struct nfnl_handle *,
+ /* receiving */
+ extern ssize_t nfnl_recv(const struct nfnl_handle *h, unsigned char *buf, size_t len);
+ extern int nfnl_callback_register(struct nfnl_subsys_handle *,
+- u_int8_t type, struct nfnl_callback *cb);
+-extern int nfnl_callback_unregister(struct nfnl_subsys_handle *, u_int8_t type);
++ uint8_t type, struct nfnl_callback *cb);
++extern int nfnl_callback_unregister(struct nfnl_subsys_handle *, uint8_t type);
+ extern int nfnl_handle_packet(struct nfnl_handle *, char *buf, int len);
+
+ /* parsing */
+@@ -180,12 +181,12 @@ extern int nfnl_query(struct nfnl_handle *h, struct nlmsghdr *nlh);
+
+ /* nfnl attribute handling functions */
+ extern int nfnl_addattr_l(struct nlmsghdr *, int, int, const void *, int);
+-extern int nfnl_addattr8(struct nlmsghdr *, int, int, u_int8_t);
+-extern int nfnl_addattr16(struct nlmsghdr *, int, int, u_int16_t);
+-extern int nfnl_addattr32(struct nlmsghdr *, int, int, u_int32_t);
++extern int nfnl_addattr8(struct nlmsghdr *, int, int, uint8_t);
++extern int nfnl_addattr16(struct nlmsghdr *, int, int, uint16_t);
++extern int nfnl_addattr32(struct nlmsghdr *, int, int, uint32_t);
+ extern int nfnl_nfa_addattr_l(struct nfattr *, int, int, const void *, int);
+-extern int nfnl_nfa_addattr16(struct nfattr *, int, int, u_int16_t);
+-extern int nfnl_nfa_addattr32(struct nfattr *, int, int, u_int32_t);
++extern int nfnl_nfa_addattr16(struct nfattr *, int, int, uint16_t);
++extern int nfnl_nfa_addattr32(struct nfattr *, int, int, uint32_t);
+ extern int nfnl_parse_attr(struct nfattr **, int, struct nfattr *, int);
+ #define nfnl_parse_nested(tb, max, nfa) \
+ nfnl_parse_attr((tb), (max), NFA_DATA((nfa)), NFA_PAYLOAD((nfa)))
+@@ -197,7 +198,7 @@ extern int nfnl_parse_attr(struct nfattr **, int, struct nfattr *, int);
+ ({ (tail)->nfa_len = (void *) NLMSG_TAIL(nlh) - (void *) tail; })
+
+ extern void nfnl_build_nfa_iovec(struct iovec *iov, struct nfattr *nfa,
+- u_int16_t type, u_int32_t len,
++ uint16_t type, uint32_t len,
+ unsigned char *val);
+ extern unsigned int nfnl_rcvbufsiz(const struct nfnl_handle *h,
+ unsigned int size);
+diff --git a/include/libnfnetlink/linux_nfnetlink.h b/include/libnfnetlink/linux_nfnetlink.h
+index 76a8550..7b843c6 100644
+--- a/include/libnfnetlink/linux_nfnetlink.h
++++ b/include/libnfnetlink/linux_nfnetlink.h
+@@ -1,5 +1,6 @@
+ #ifndef _NFNETLINK_H
+ #define _NFNETLINK_H
++#include
+ #include
+ #include
+
+@@ -25,9 +26,9 @@ enum nfnetlink_groups {
+ /* General form of address family dependent message.
+ */
+ struct nfgenmsg {
+- u_int8_t nfgen_family; /* AF_xxx */
+- u_int8_t version; /* nfnetlink version */
+- u_int16_t res_id; /* resource id */
++ uint8_t nfgen_family; /* AF_xxx */
++ uint8_t version; /* nfnetlink version */
++ uint16_t res_id; /* resource id */
+ };
+
+ #define NFNETLINK_V0 0
+@@ -59,7 +60,7 @@ struct nfnl_callback
+ int (*call)(struct sock *nl, struct sk_buff *skb,
+ struct nlmsghdr *nlh, struct nlattr *cda[]);
+ const struct nla_policy *policy; /* netlink attribute policy */
+- const u_int16_t attr_count; /* number of nlattr's */
++ const uint16_t attr_count; /* number of nlattr's */
+ };
+
+ struct nfnetlink_subsystem
+@@ -76,7 +77,7 @@ extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
+ extern int nfnetlink_has_listeners(unsigned int group);
+ extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
+ int echo);
+-extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
++extern int nfnetlink_unicast(struct sk_buff *skb, uint32_t pid, int flags);
+
+ #define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
+ MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
+diff --git a/include/libnfnetlink/linux_nfnetlink_compat.h b/include/libnfnetlink/linux_nfnetlink_compat.h
+index e145176..cd094fc 100644
+--- a/include/libnfnetlink/linux_nfnetlink_compat.h
++++ b/include/libnfnetlink/linux_nfnetlink_compat.h
+@@ -3,6 +3,8 @@
+ #ifndef __KERNEL__
+ /* Old nfnetlink macros for userspace */
+
++#include
++
+ /* nfnetlink groups: Up to 32 maximum */
+ #define NF_NETLINK_CONNTRACK_NEW 0x00000001
+ #define NF_NETLINK_CONNTRACK_UPDATE 0x00000002
+@@ -20,8 +22,8 @@
+
+ struct nfattr
+ {
+- u_int16_t nfa_len;
+- u_int16_t nfa_type; /* we use 15 bits for the type, and the highest
++ uint16_t nfa_len;
++ uint16_t nfa_type; /* we use 15 bits for the type, and the highest
+ * bit to indicate whether the payload is nested */
+ };
+
+diff --git a/src/iftable.c b/src/iftable.c
+index 5976ed8..3411c4c 100644
+--- a/src/iftable.c
++++ b/src/iftable.c
+@@ -9,6 +9,7 @@
+ /* IFINDEX handling */
+
+ #include
++#include
+ #include
+ #include
+ #include
+@@ -27,10 +28,10 @@
+ struct ifindex_node {
+ struct list_head head;
+
+- u_int32_t index;
+- u_int32_t type;
+- u_int32_t alen;
+- u_int32_t flags;
++ uint32_t index;
++ uint32_t type;
++ uint32_t alen;
++ uint32_t flags;
+ char addr[8];
+ char name[16];
+ };
+diff --git a/src/iftable.h b/src/iftable.h
+index 8df7f24..0cc5335 100644
+--- a/src/iftable.h
++++ b/src/iftable.h
+@@ -1,8 +1,10 @@
+ #ifndef _IFTABLE_H
+ #define _IFTABLE_H
+
+-int iftable_delete(u_int32_t dst, u_int32_t mask, u_int32_t gw, u_int32_t oif);
+-int iftable_insert(u_int32_t dst, u_int32_t mask, u_int32_t gw, u_int32_t oif);
++#include
++
++int iftable_delete(uint32_t dst, uint32_t mask, uint32_t gw, uint32_t oif);
++int iftable_insert(uint32_t dst, uint32_t mask, uint32_t gw, uint32_t oif);
+
+ int iftable_init(void);
+ void iftable_fini(void);
+diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c
+index 398b7d7..b8958dc 100644
+--- a/src/libnfnetlink.c
++++ b/src/libnfnetlink.c
+@@ -36,6 +36,7 @@
+ * minor cleanups
+ */
+
++#include
+ #include
+ #include
+ #include
+@@ -72,9 +73,9 @@
+
+ struct nfnl_subsys_handle {
+ struct nfnl_handle *nfnlh;
+- u_int32_t subscriptions;
+- u_int8_t subsys_id;
+- u_int8_t cb_count;
++ uint32_t subscriptions;
++ uint8_t subsys_id;
++ uint8_t cb_count;
+ struct nfnl_callback *cb; /* array of callbacks */
+ };
+
+@@ -86,11 +87,11 @@ struct nfnl_handle {
+ int fd;
+ struct sockaddr_nl local;
+ struct sockaddr_nl peer;
+- u_int32_t subscriptions;
+- u_int32_t seq;
+- u_int32_t dump;
+- u_int32_t rcv_buffer_size; /* for nfnl_catch */
+- u_int32_t flags;
++ uint32_t subscriptions;
++ uint32_t seq;
++ uint32_t dump;
++ uint32_t rcv_buffer_size; /* for nfnl_catch */
++ uint32_t flags;
+ struct nlmsghdr *last_nlhdr;
+ struct nfnl_subsys_handle subsys[NFNL_MAX_SUBSYS+1];
+ };
+@@ -145,7 +146,7 @@ unsigned int nfnl_portid(const struct nfnl_handle *h)
+ static int recalc_rebind_subscriptions(struct nfnl_handle *nfnlh)
+ {
+ int i, err;
+- u_int32_t new_subscriptions = nfnlh->subscriptions;
++ uint32_t new_subscriptions = nfnlh->subscriptions;
+
+ for (i = 0; i < NFNL_MAX_SUBSYS; i++)
+ new_subscriptions |= nfnlh->subsys[i].subscriptions;
+@@ -273,8 +274,8 @@ void nfnl_set_rcv_buffer_size(struct nfnl_handle *h, unsigned int size)
+ * a valid address that points to a nfnl_subsys_handle structure is returned.
+ */
+ struct nfnl_subsys_handle *
+-nfnl_subsys_open(struct nfnl_handle *nfnlh, u_int8_t subsys_id,
+- u_int8_t cb_count, u_int32_t subscriptions)
++nfnl_subsys_open(struct nfnl_handle *nfnlh, uint8_t subsys_id,
++ uint8_t cb_count, uint32_t subscriptions)
+ {
+ struct nfnl_subsys_handle *ssh;
+
+@@ -435,10 +436,10 @@ int nfnl_sendiov(const struct nfnl_handle *nfnlh, const struct iovec *iov,
+ */
+ void nfnl_fill_hdr(struct nfnl_subsys_handle *ssh,
+ struct nlmsghdr *nlh, unsigned int len,
+- u_int8_t family,
+- u_int16_t res_id,
+- u_int16_t msg_type,
+- u_int16_t msg_flags)
++ uint8_t family,
++ uint16_t res_id,
++ uint16_t msg_type,
++ uint16_t msg_flags)
+ {
+ assert(ssh);
+ assert(nlh);
+@@ -849,14 +850,14 @@ int nfnl_nfa_addattr_l(struct nfattr *nfa, int maxlen, int type,
+ }
+
+ /**
+- * nfnl_addattr8 - Add u_int8_t attribute to nlmsghdr
++ * nfnl_addattr8 - Add uint8_t attribute to nlmsghdr
+ *
+ * @n: netlink message header to which attribute is to be added
+ * @maxlen: maximum length of netlink message header
+ * @type: type of new attribute
+ * @data: content of new attribute
+ */
+-int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data)
++int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, uint8_t data)
+ {
+ assert(n);
+ assert(maxlen > 0);
+@@ -866,7 +867,7 @@ int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data)
+ }
+
+ /**
+- * nfnl_nfa_addattr16 - Add u_int16_t attribute to struct nfattr
++ * nfnl_nfa_addattr16 - Add uint16_t attribute to struct nfattr
+ *
+ * @nfa: struct nfattr
+ * @maxlen: maximal length of nfattr buffer
+@@ -875,7 +876,7 @@ int nfnl_addattr8(struct nlmsghdr *n, int maxlen, int type, u_int8_t data)
+ *
+ */
+ int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type,
+- u_int16_t data)
++ uint16_t data)
+ {
+ assert(nfa);
+ assert(maxlen > 0);
+@@ -885,7 +886,7 @@ int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type,
+ }
+
+ /**
+- * nfnl_addattr16 - Add u_int16_t attribute to nlmsghdr
++ * nfnl_addattr16 - Add uint16_t attribute to nlmsghdr
+ *
+ * @n: netlink message header to which attribute is to be added
+ * @maxlen: maximum length of netlink message header
+@@ -894,7 +895,7 @@ int nfnl_nfa_addattr16(struct nfattr *nfa, int maxlen, int type,
+ *
+ */
+ int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type,
+- u_int16_t data)
++ uint16_t data)
+ {
+ assert(n);
+ assert(maxlen > 0);
+@@ -904,7 +905,7 @@ int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type,
+ }
+
+ /**
+- * nfnl_nfa_addattr32 - Add u_int32_t attribute to struct nfattr
++ * nfnl_nfa_addattr32 - Add uint32_t attribute to struct nfattr
+ *
+ * @nfa: struct nfattr
+ * @maxlen: maximal length of nfattr buffer
+@@ -913,7 +914,7 @@ int nfnl_addattr16(struct nlmsghdr *n, int maxlen, int type,
+ *
+ */
+ int nfnl_nfa_addattr32(struct nfattr *nfa, int maxlen, int type,
+- u_int32_t data)
++ uint32_t data)
+ {
+ assert(nfa);
+ assert(maxlen > 0);
+@@ -923,7 +924,7 @@ int nfnl_nfa_addattr32(struct nfattr *nfa, int maxlen, int type,
+ }
+
+ /**
+- * nfnl_addattr32 - Add u_int32_t attribute to nlmsghdr
++ * nfnl_addattr32 - Add uint32_t attribute to nlmsghdr
+ *
+ * @n: netlink message header to which attribute is to be added
+ * @maxlen: maximum length of netlink message header
+@@ -932,7 +933,7 @@ int nfnl_nfa_addattr32(struct nfattr *nfa, int maxlen, int type,
+ *
+ */
+ int nfnl_addattr32(struct nlmsghdr *n, int maxlen, int type,
+- u_int32_t data)
++ uint32_t data)
+ {
+ assert(n);
+ assert(maxlen > 0);
+@@ -980,7 +981,7 @@ int nfnl_parse_attr(struct nfattr *tb[], int max, struct nfattr *nfa, int len)
+ *
+ */
+ void nfnl_build_nfa_iovec(struct iovec *iov, struct nfattr *nfa,
+- u_int16_t type, u_int32_t len, unsigned char *val)
++ uint16_t type, uint32_t len, unsigned char *val)
+ {
+ assert(iov);
+ assert(nfa);
+@@ -1115,7 +1116,7 @@ struct nlmsghdr *nfnl_get_msg_next(struct nfnl_handle *h,
+ * appropiately.
+ */
+ int nfnl_callback_register(struct nfnl_subsys_handle *ssh,
+- u_int8_t type, struct nfnl_callback *cb)
++ uint8_t type, struct nfnl_callback *cb)
+ {
+ assert(ssh);
+ assert(cb);
+@@ -1138,7 +1139,7 @@ int nfnl_callback_register(struct nfnl_subsys_handle *ssh,
+ * On sucess, 0 is returned. On error, -1 is returned and errno is
+ * set appropiately.
+ */
+-int nfnl_callback_unregister(struct nfnl_subsys_handle *ssh, u_int8_t type)
++int nfnl_callback_unregister(struct nfnl_subsys_handle *ssh, uint8_t type)
+ {
+ assert(ssh);
+
+@@ -1161,8 +1162,8 @@ int nfnl_check_attributes(const struct nfnl_handle *h,
+ assert(nfa);
+
+ int min_len;
+- u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
+- u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
++ uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
++ uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
+ const struct nfnl_subsys_handle *ssh;
+ struct nfnl_callback *cb;
+
+@@ -1212,8 +1213,8 @@ static int __nfnl_handle_msg(struct nfnl_handle *h, struct nlmsghdr *nlh,
+ int len)
+ {
+ struct nfnl_subsys_handle *ssh;
+- u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
+- u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
++ uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
++ uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
+ int err = 0;
+
+ if (subsys_id > NFNL_MAX_SUBSYS)
+@@ -1243,7 +1244,7 @@ int nfnl_handle_packet(struct nfnl_handle *h, char *buf, int len)
+ {
+
+ while (len >= NLMSG_SPACE(0)) {
+- u_int32_t rlen;
++ uint32_t rlen;
+ struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
+
+ if (nlh->nlmsg_len < sizeof(struct nlmsghdr)
+@@ -1285,8 +1286,8 @@ static int nfnl_is_error(struct nfnl_handle *h, struct nlmsghdr *nlh)
+ static int nfnl_step(struct nfnl_handle *h, struct nlmsghdr *nlh)
+ {
+ struct nfnl_subsys_handle *ssh;
+- u_int8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
+- u_int8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
++ uint8_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
++ uint8_t subsys_id = NFNL_SUBSYS_ID(nlh->nlmsg_type);
+
+ /* Is this an error message? */
+ if (nfnl_is_error(h, nlh)) {
+diff --git a/src/rtnl.c b/src/rtnl.c
+index 7b4ac7d..34802fe 100644
+--- a/src/rtnl.c
++++ b/src/rtnl.c
+@@ -11,6 +11,7 @@
+ /* rtnetlink - routing table netlink interface */
+
+ #include
++#include
+ #include
+ #include
+ #include
+@@ -30,7 +31,7 @@
+ #define rtnl_log(x, ...)
+
+ static inline struct rtnl_handler *
+-find_handler(struct rtnl_handle *rtnl_handle, u_int16_t type)
++find_handler(struct rtnl_handle *rtnl_handle, uint16_t type)
+ {
+ struct rtnl_handler *h;
+ for (h = rtnl_handle->handlers; h; h = h->next) {
+@@ -41,7 +42,7 @@ find_handler(struct rtnl_handle *rtnl_handle, u_int16_t type)
+ }
+
+ static int call_handler(struct rtnl_handle *rtnl_handle,
+- u_int16_t type,
++ uint16_t type,
+ struct nlmsghdr *hdr)
+ {
+ struct rtnl_handler *h = find_handler(rtnl_handle, type);
+diff --git a/src/rtnl.h b/src/rtnl.h
+index 0c403dc..9858ae5 100644
+--- a/src/rtnl.h
++++ b/src/rtnl.h
+@@ -1,13 +1,14 @@
+ #ifndef _RTNL_H
+ #define _RTNL_H
+
++#include
+ #include
+ #include
+
+ struct rtnl_handler {
+ struct rtnl_handler *next;
+
+- u_int16_t nlmsg_type;
++ uint16_t nlmsg_type;
+ int (*handlefn)(struct nlmsghdr *h, void *arg);
+ void *arg;
+ };
diff --git a/pkgs/development/libraries/libnfnetlink/default.nix b/pkgs/development/libraries/libnfnetlink/default.nix
index be60612a4ff..5395b5b2e99 100644
--- a/pkgs/development/libraries/libnfnetlink/default.nix
+++ b/pkgs/development/libraries/libnfnetlink/default.nix
@@ -8,6 +8,10 @@ stdenv.mkDerivation rec {
sha256 = "06mm2x4b01k3m7wnrxblk9j0mybyr4pfz28ml7944xhjx6fy2w7j";
};
+ patches = [
+ ./Use-stdlib-uint-instead-of-u_int.patch
+ ];
+
meta = {
description = "Low-level library for netfilter related kernel/userspace communication";
longDescription = ''
diff --git a/pkgs/development/libraries/libnsl/cdefs.patch b/pkgs/development/libraries/libnsl/cdefs.patch
new file mode 100644
index 00000000000..dbbe800a347
--- /dev/null
+++ b/pkgs/development/libraries/libnsl/cdefs.patch
@@ -0,0 +1,30 @@
+--- a/src/rpcsvc/nislib.h
++++ b/src/rpcsvc/nislib.h
+@@ -19,6 +19,7 @@
+ #ifndef __RPCSVC_NISLIB_H__
+ #define __RPCSVC_NISLIB_H__
+
++#include
+ #include
+
+ __BEGIN_DECLS
+--- a/src/rpcsvc/ypclnt.h
++++ b/src/rpcsvc/ypclnt.h
+@@ -20,6 +20,7 @@
+ #ifndef __RPCSVC_YPCLNT_H__
+ #define __RPCSVC_YPCLNT_H__
+
++#include
+ #include
+
+ /* Some defines */
+--- a/src/rpcsvc/ypupd.h
++++ b/src/rpcsvc/ypupd.h
+@@ -33,6 +33,7 @@
+ #ifndef __RPCSVC_YPUPD_H__
+ #define __RPCSVC_YPUPD_H__
+
++#include
+ #include
+
+ #include
diff --git a/pkgs/development/libraries/libnsl/default.nix b/pkgs/development/libraries/libnsl/default.nix
index d4af280c3cd..9e8a46b2e6b 100644
--- a/pkgs/development/libraries/libnsl/default.nix
+++ b/pkgs/development/libraries/libnsl/default.nix
@@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ autoreconfHook pkgconfig ];
buildInputs = [ libtirpc ];
+ patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [ ./cdefs.patch ./nis_h.patch ];
+
meta = with stdenv.lib; {
description = "Client interface library for NIS(YP) and NIS+";
homepage = https://github.com/thkukuk/libnsl;
diff --git a/pkgs/development/libraries/libnsl/nis_h.patch b/pkgs/development/libraries/libnsl/nis_h.patch
new file mode 100644
index 00000000000..199259df2e8
--- /dev/null
+++ b/pkgs/development/libraries/libnsl/nis_h.patch
@@ -0,0 +1,45 @@
+--- a/src/rpcsvc/nis.h
++++ b/src/rpcsvc/nis.h
+@@ -32,6 +32,7 @@
+ #ifndef _RPCSVC_NIS_H
+ #define _RPCSVC_NIS_H 1
+
++#include
+ #include
+ #include
+ #include
+@@ -56,6 +57,34 @@
+ *
+ */
+
++#ifndef rawmemchr
++#define rawmemchr(s,c) memchr((s),(size_t)-1,(c))
++#endif
++
++#ifndef __asprintf
++#define __asprintf asprintf
++#endif
++
++#ifndef __mempcpy
++#define __mempcpy mempcpy
++#endif
++
++#ifndef __strtok_r
++#define __strtok_r strtok_r
++#endif
++
++#ifndef __always_inline
++#define __always_inline __attribute__((__always_inline__))
++#endif
++
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(exp) ({ \
++typeof (exp) _rc; \
++ do { \
++ _rc = (exp); \
++ } while (_rc == -1 && errno == EINTR); \
++ _rc; })
++#endif
+
+ #ifndef __nis_object_h
+ #define __nis_object_h
diff --git a/pkgs/development/libraries/libunistring/default.nix b/pkgs/development/libraries/libunistring/default.nix
index e1b8c04b4ce..8d1f5115bdf 100644
--- a/pkgs/development/libraries/libunistring/default.nix
+++ b/pkgs/development/libraries/libunistring/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
"--with-libiconv-prefix=${libiconv}"
];
- doCheck = true;
+ doCheck = !stdenv.hostPlatform.isMusl;
enableParallelBuilding = true;
diff --git a/pkgs/development/libraries/libunwind/backtrace-only-with-glibc.patch b/pkgs/development/libraries/libunwind/backtrace-only-with-glibc.patch
new file mode 100644
index 00000000000..5fcaa72c0c0
--- /dev/null
+++ b/pkgs/development/libraries/libunwind/backtrace-only-with-glibc.patch
@@ -0,0 +1,45 @@
+From 04437142399662b576bd55a85485c6dcc14d0812 Mon Sep 17 00:00:00 2001
+From: Khem Raj
+Date: Thu, 31 Dec 2015 06:44:07 +0000
+Subject: [PATCH] backtrace: Use only with glibc and uclibc
+
+backtrace API is glibc specific not linux specific
+so make it behave so.
+
+Signed-off-by: Khem Raj
+---
+Upstream-Status: Pending
+
+ tests/test-coredump-unwind.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c
+index 5254708..8767b42 100644
+--- a/tests/test-coredump-unwind.c
++++ b/tests/test-coredump-unwind.c
+@@ -57,7 +57,9 @@
+ #include
+
+ /* For SIGSEGV handler code */
++#ifdef __GLIBC__
+ #include
++#endif
+ #include
+
+ #include
+@@ -238,11 +240,11 @@ void handle_sigsegv(int sig, siginfo_t *info, void *ucontext)
+ ip);
+
+ {
++#ifdef __GLIBC__
+ /* glibc extension */
+ void *array[50];
+ int size;
+ size = backtrace(array, 50);
+-#ifdef __linux__
+ backtrace_symbols_fd(array, size, 2);
+ #endif
+ }
+--
+2.6.4
+
diff --git a/pkgs/development/libraries/libunwind/default.nix b/pkgs/development/libraries/libunwind/default.nix
index 8565bc75ff9..6afdac3fdf5 100644
--- a/pkgs/development/libraries/libunwind/default.nix
+++ b/pkgs/development/libraries/libunwind/default.nix
@@ -11,6 +11,7 @@ stdenv.mkDerivation rec {
patches = [
./version-1.2.1.patch
+ ./backtrace-only-with-glibc.patch
];
nativeBuildInputs = [ autoreconfHook ];
diff --git a/pkgs/development/libraries/libusb/default.nix b/pkgs/development/libraries/libusb/default.nix
index 1fd3cb39bbf..4704a1e5c33 100644
--- a/pkgs/development/libraries/libusb/default.nix
+++ b/pkgs/development/libraries/libusb/default.nix
@@ -14,6 +14,8 @@ stdenv.mkDerivation {
sha256 = "0nn5icrfm9lkhzw1xjvaks9bq3w6mjg86ggv3fn7kgi4nfvg8kj0";
};
+ patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ./fix-headers.patch;
+
meta = {
platforms = stdenv.lib.platforms.unix;
};
diff --git a/pkgs/development/libraries/libusb/fix-headers.patch b/pkgs/development/libraries/libusb/fix-headers.patch
new file mode 100644
index 00000000000..ea9cbc34978
--- /dev/null
+++ b/pkgs/development/libraries/libusb/fix-headers.patch
@@ -0,0 +1,10 @@
+--- libusb-compat-0.1.5.orig/libusb/usb.h
++++ libusb-compat-0.1.5/libusb/usb.h
+@@ -25,6 +25,7 @@
+ #ifndef __USB_H__
+ #define __USB_H__
+
++#include
+ #include
+ #include
+ #include
diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix
index b19f4a2953f..c4f3ff1efdd 100644
--- a/pkgs/development/libraries/libxml2/default.nix
+++ b/pkgs/development/libraries/libxml2/default.nix
@@ -36,7 +36,8 @@ in stdenv.mkDerivation rec {
enableParallelBuilding = true;
- doCheck = (stdenv.hostPlatform == stdenv.buildPlatform) && !stdenv.isDarwin;
+ doCheck = (stdenv.hostPlatform == stdenv.buildPlatform) && !stdenv.isDarwin &&
+ hostPlatform.libc != "musl";
crossAttrs = lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
# creating the DLL is broken ATM
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 8df248e3e46..fa3336c4cea 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -92,7 +92,7 @@ stdenv.mkDerivation {
patches = [
./glx_ro_text_segm.patch # fix for grsecurity/PaX
./symlink-drivers.patch
- ];
+ ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl ./musl-fixes.patch;
outputs = [ "out" "dev" "drivers" "osmesa" ];
diff --git a/pkgs/development/libraries/mesa/musl-fixes.patch b/pkgs/development/libraries/mesa/musl-fixes.patch
new file mode 100644
index 00000000000..60140d445ae
--- /dev/null
+++ b/pkgs/development/libraries/mesa/musl-fixes.patch
@@ -0,0 +1,22 @@
+--- ./src/gallium/winsys/svga/drm/vmw_screen.h.orig
++++ ./src/gallium/winsys/svga/drm/vmw_screen.h
+@@ -34,7 +34,7 @@
+ #ifndef VMW_SCREEN_H_
+ #define VMW_SCREEN_H_
+
+-
++#include
+ #include "pipe/p_compiler.h"
+ #include "pipe/p_state.h"
+
+--- a/src/util/u_endian.h.orig 2016-11-04 12:16:00.480356454 +0100
++++ b/src/util/u_endian.h 2016-11-04 12:16:11.984347944 +0100
+@@ -27,7 +27,7 @@
+ #ifndef U_ENDIAN_H
+ #define U_ENDIAN_H
+
+-#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__)
++#if defined(__linux__) || defined(ANDROID) || defined(__CYGWIN__)
+ #include
+
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
diff --git a/pkgs/development/libraries/mpfr/default.nix b/pkgs/development/libraries/mpfr/default.nix
index fe364f22f9a..4aac5a92709 100644
--- a/pkgs/development/libraries/mpfr/default.nix
+++ b/pkgs/development/libraries/mpfr/default.nix
@@ -1,17 +1,15 @@
{ stdenv, fetchurl, gmp
-, buildPlatform, hostPlatform
+, hostPlatform
}:
stdenv.mkDerivation rec {
- name = "mpfr-3.1.3";
+ name = "mpfr-3.1.6";
src = fetchurl {
- url = "mirror://gnu/mpfr/${name}.tar.bz2";
- sha256 = "1z8akfw9wbmq91vrx04bw86mmnxw2sw5qm5cr8ix5b3w2mcv8fzn";
+ url = "mirror://gnu/mpfr/${name}.tar.xz";
+ sha256 = "0l598h9klpgkz2bp0rxiqb90mkqh9f2f81n5rpy191j00hdaqqks";
};
- patches = [ ./upstream.patch ];
-
outputs = [ "out" "dev" "doc" "info" ];
# mpfr.h requires gmp.h
diff --git a/pkgs/development/libraries/nettle/generic.nix b/pkgs/development/libraries/nettle/generic.nix
index 9633dacd68f..3af93469cf1 100644
--- a/pkgs/development/libraries/nettle/generic.nix
+++ b/pkgs/development/libraries/nettle/generic.nix
@@ -1,4 +1,4 @@
-{ stdenv, gmp, gnum4
+{ stdenv, buildPackages, gmp, gnum4
# Version specific args
, version, src
@@ -12,7 +12,8 @@ stdenv.mkDerivation (rec {
outputs = [ "out" "dev" ];
outputBin = "dev";
- buildInputs = [ gnum4 ];
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ nativeBuildInputs = [ gnum4 ];
propagatedBuildInputs = [ gmp ];
doCheck = (stdenv.system != "i686-cygwin" && !stdenv.isDarwin);
diff --git a/pkgs/development/libraries/npth/default.nix b/pkgs/development/libraries/npth/default.nix
index dc4f4926e9d..a600938cdbb 100644
--- a/pkgs/development/libraries/npth/default.nix
+++ b/pkgs/development/libraries/npth/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
sha256 = "1hmkkp6vzyrh8v01c2ynzf9vwikyagp7p1lxhbnr4ysk3w66jji9";
};
+ doCheck = true;
+
meta = with stdenv.lib; {
description = "The New GNU Portable Threads Library";
longDescription = ''
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 775e6056dff..af6a540b97c 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -24,6 +24,12 @@ let
++ optional (versionOlder version "1.0.2" && hostPlatform.isDarwin)
./darwin-arch.patch;
+ postPatch = if (versionAtLeast version "1.1.0" && stdenv.hostPlatform.isMusl) then ''
+ substituteInPlace crypto/async/arch/async_posix.h \
+ --replace '!defined(__ANDROID__) && !defined(__OpenBSD__)' \
+ '!defined(__ANDROID__) && !defined(__OpenBSD__) && 0'
+ '' else null;
+
outputs = [ "bin" "dev" "out" "man" ];
setOutputFlags = false;
separateDebugInfo = hostPlatform.isLinux;
@@ -49,6 +55,10 @@ let
# TODO(@Ericson2314): Make unconditional on mass rebuild
${if buildPlatform != hostPlatform then "configurePlatforms" else null} = [];
+ preConfigure = ''
+ patchShebangs Configure
+ '';
+
configureFlags = [
"shared"
"--libdir=lib"
diff --git a/pkgs/development/libraries/pixman/default.nix b/pkgs/development/libraries/pixman/default.nix
index dc378711d36..6b891bdb38c 100644
--- a/pkgs/development/libraries/pixman/default.nix
+++ b/pkgs/development/libraries/pixman/default.nix
@@ -1,16 +1,25 @@
-{ fetchurl, stdenv, pkgconfig, libpng, glib /*just passthru*/ }:
+{ stdenv, fetchurl, fetchpatch, autoconf, automake, libtool, pkgconfig, libpng, glib /*just passthru*/ }:
stdenv.mkDerivation rec {
- name = "pixman-0.34.0";
+ name = "pixman-${version}";
+ version = "0.34.0";
src = fetchurl {
url = "mirror://xorg/individual/lib/${name}.tar.bz2";
sha256 = "184lazwdpv67zrlxxswpxrdap85wminh1gmq1i5lcz6iycw39fir";
};
- patches = [];
+ patches = stdenv.lib.optionals stdenv.cc.isClang [
+ (fetchpatch {
+ name = "builtin-shuffle.patch";
+ url = https://patchwork.freedesktop.org/patch/177506/raw;
+ sha256 = "0rvraq93769dy2im2m022rz99fcdxprgc2fbmasnddcwrqy1x3xr";
+ })
+ ];
+
+ nativeBuildInputs = [ pkgconfig ]
+ ++ stdenv.lib.optionals stdenv.cc.isClang [ autoconf automake libtool ];
- nativeBuildInputs = [ pkgconfig ];
buildInputs = stdenv.lib.optional doCheck libpng;
configureFlags = stdenv.lib.optional stdenv.isArm "--disable-arm-iwmmxt";
diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix
index b0d8b2d89bc..6bf9bcb954c 100644
--- a/pkgs/development/libraries/polkit/default.nix
+++ b/pkgs/development/libraries/polkit/default.nix
@@ -37,7 +37,15 @@ stdenv.mkDerivation rec {
url = "http://src.fedoraproject.org/cgit/rpms/polkit.git/plain/polkit-0.113-itstool.patch?id=fa6fd575804de92886c95d3bc2b7eb2abcd13760";
sha256 = "0bxmjwp8ahy1y5g1l0kxmld0l3mlvb2l0i5n1qabia3d5iyjkyfh";
})
- ];
+ ]
+ # Could be applied uncondtionally but don't want to trigger rebuild
+ # https://bugs.freedesktop.org/show_bug.cgi?id=50145
+ ++ stdenv.lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
+ name = "netgroup-optional.patch";
+ url = "https://bugs.freedesktop.org/attachment.cgi?id=118753";
+ sha256 = "1zq51dhmqi9zi86bj9dq4i4pxlxm41k3k4a091j07bd78cjba038";
+ });
+
outputs = [ "bin" "dev" "out" ]; # small man pages in $bin
diff --git a/pkgs/development/libraries/qt-4.x/4.8/clang-5-darwin.patch b/pkgs/development/libraries/qt-4.x/4.8/clang-5-darwin.patch
new file mode 100644
index 00000000000..7b181f3ad89
--- /dev/null
+++ b/pkgs/development/libraries/qt-4.x/4.8/clang-5-darwin.patch
@@ -0,0 +1,13 @@
+diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm
+index 204d685..e05179e 100644
+--- a/src/gui/text/qfontengine_coretext.mm
++++ b/src/gui/text/qfontengine_coretext.mm
+@@ -886,7 +886,7 @@ void QCoreTextFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, gl
+
+ QFixed QCoreTextFontEngine::emSquareSize() const
+ {
+- return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));
++ return QFixed(int(CTFontGetUnitsPerEm(ctfont)));
+ }
+
+ QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const
diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix
index 488306fc1ce..46f24a08b5e 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -68,6 +68,7 @@ stdenv.mkDerivation rec {
[ ./glib-2.32.patch
./libressl.patch
./parallel-configure.patch
+ ./clang-5-darwin.patch
./qt-4.8.7-unixmake-darwin.patch
(substituteAll {
src = ./dlopen-absolute-paths.diff;
@@ -106,7 +107,13 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional stdenv.isAarch64 (fetchpatch {
url = "https://src.fedoraproject.org/rpms/qt/raw/ecf530486e0fb7fe31bad26805cde61115562b2b/f/qt-aarch64.patch";
sha256 = "1fbjh78nmafqmj7yk67qwjbhl3f6ylkp6x33b1dqxfw9gld8b3gl";
- });
+ })
+ ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
+ ./qt-musl.patch
+ ./qt-musl-iconv-no-bom.patch
+ ./patch-qthread-stacksize.diff
+ ./qsettings-recursive-global-mutex.patch
+ ];
preConfigure = ''
export LD_LIBRARY_PATH="`pwd`/lib:$LD_LIBRARY_PATH"
diff --git a/pkgs/development/libraries/qt-4.x/4.8/patch-qthread-stacksize.diff b/pkgs/development/libraries/qt-4.x/4.8/patch-qthread-stacksize.diff
new file mode 100644
index 00000000000..53a4c70ac3a
--- /dev/null
+++ b/pkgs/development/libraries/qt-4.x/4.8/patch-qthread-stacksize.diff
@@ -0,0 +1,54 @@
+--- a/src/corelib/thread/qthread_unix.cpp.orig 2015-11-23 19:05:40.000000000 +0100
++++ b/src/corelib/thread/qthread_unix.cpp 2015-11-24 11:22:31.000000000 +0100
+@@ -79,6 +79,7 @@
+ #endif
+
++#include // getrlimit/setrlimit
+ #if defined(Q_OS_MAC)
+ # ifdef qDebug
+ # define old_qDebug qDebug
+ # undef qDebug
+@@ -649,6 +650,43 @@
+ #endif // QT_HAS_THREAD_PRIORITY_SCHEDULING
+
+
++ if (d->stackSize == 0) {
++ // Fix the default (too small) stack size for threads on OS X,
++ // which also affects the thread pool.
++ // See also:
++ // https://bugreports.qt.io/browse/QTBUG-2568
++ // This fix can also be found in Chromium:
++ // https://chromium.googlesource.com/chromium/src.git/+/master/base/threading/platform_thread_mac.mm#186
++
++ // The Mac OS X default for a pthread stack size is 512kB.
++ // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses
++ // DEFAULT_STACK_SIZE for this purpose.
++ //
++ // 512kB isn't quite generous enough for some deeply recursive threads that
++ // otherwise request the default stack size by specifying 0. Here, adopt
++ // glibc's behavior as on Linux, which is to use the current stack size
++ // limit (ulimit -s) as the default stack size. See
++ // glibc-2.11.1/nptl/nptl-init.c's __pthread_initialize_minimal_internal. To
++ // avoid setting the limit below the Mac OS X default or the minimum usable
++ // stack size, these values are also considered. If any of these values
++ // can't be determined, or if stack size is unlimited (ulimit -s unlimited),
++ // stack_size is left at 0 to get the system default.
++ //
++ // Mac OS X normally only applies ulimit -s to the main thread stack. On
++ // contemporary OS X and Linux systems alike, this value is generally 8MB
++ // or in that neighborhood.
++ size_t default_stack_size = 0;
++ struct rlimit stack_rlimit;
++ if (pthread_attr_getstacksize(&attr, &default_stack_size) == 0 &&
++ getrlimit(RLIMIT_STACK, &stack_rlimit) == 0 &&
++ stack_rlimit.rlim_cur != RLIM_INFINITY) {
++ default_stack_size =
++ std::max(std::max(default_stack_size,
++ static_cast(PTHREAD_STACK_MIN)),
++ static_cast(stack_rlimit.rlim_cur));
++ }
++ d->stackSize = default_stack_size;
++ }
+ if (d->stackSize > 0) {
+ #if defined(_POSIX_THREAD_ATTR_STACKSIZE) && (_POSIX_THREAD_ATTR_STACKSIZE-0 > 0)
+ int code = pthread_attr_setstacksize(&attr, d->stackSize);
diff --git a/pkgs/development/libraries/qt-4.x/4.8/qsettings-recursive-global-mutex.patch b/pkgs/development/libraries/qt-4.x/4.8/qsettings-recursive-global-mutex.patch
new file mode 100644
index 00000000000..229123c54f7
--- /dev/null
+++ b/pkgs/development/libraries/qt-4.x/4.8/qsettings-recursive-global-mutex.patch
@@ -0,0 +1,17 @@
+Calling qsettings before constructing qapplications causes a dead-lock.
+
+http://sourceforge.net/tracker/?func=detail&aid=3168620&group_id=4932&atid=104932
+http://developer.qt.nokia.com/forums/viewthread/10365
+
+
+--- ./src/corelib/io/qsettings.cpp.orig
++++ ./src/corelib/io/qsettings.cpp
+@@ -122,7 +122,7 @@
+ Q_GLOBAL_STATIC(ConfFileCache, unusedCacheFunc)
+ Q_GLOBAL_STATIC(PathHash, pathHashFunc)
+ Q_GLOBAL_STATIC(CustomFormatVector, customFormatVectorFunc)
+-Q_GLOBAL_STATIC(QMutex, globalMutex)
++Q_GLOBAL_STATIC_WITH_ARGS(QMutex, globalMutex, (QMutex::Recursive))
+ static QSettings::Format globalDefaultFormat = QSettings::NativeFormat;
+
+ #ifndef Q_OS_WIN
diff --git a/pkgs/development/libraries/qt-4.x/4.8/qt-musl-iconv-no-bom.patch b/pkgs/development/libraries/qt-4.x/4.8/qt-musl-iconv-no-bom.patch
new file mode 100644
index 00000000000..35380ad6714
--- /dev/null
+++ b/pkgs/development/libraries/qt-4.x/4.8/qt-musl-iconv-no-bom.patch
@@ -0,0 +1,11 @@
+--- qt-everywhere-opensource-src-4.8.5/src/corelib/codecs/qiconvcodec.cpp.orig
++++ qt-everywhere-opensource-src-4.8.5/src/corelib/codecs/qiconvcodec.cpp
+@@ -62,7 +62,7 @@
+ #elif defined(Q_OS_AIX)
+ # define NO_BOM
+ # define UTF16 "UCS-2"
+-#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC)
++#elif defined(Q_OS_FREEBSD) || defined(Q_OS_MAC) || (defined(Q_OS_LINUX) && !defined(__GLIBC__))
+ # define NO_BOM
+ # if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ # define UTF16 "UTF-16BE"
diff --git a/pkgs/development/libraries/qt-4.x/4.8/qt-musl.patch b/pkgs/development/libraries/qt-4.x/4.8/qt-musl.patch
new file mode 100644
index 00000000000..90b9ccda08c
--- /dev/null
+++ b/pkgs/development/libraries/qt-4.x/4.8/qt-musl.patch
@@ -0,0 +1,14 @@
+--- qt-everywhere-opensource-src-4.8.5/mkspecs/linux-g++/qplatformdefs.h.orig
++++ qt-everywhere-opensource-src-4.8.5/mkspecs/linux-g++/qplatformdefs.h
+@@ -86,11 +86,7 @@
+
+ #undef QT_SOCKLEN_T
+
+-#if defined(__GLIBC__) && (__GLIBC__ >= 2)
+ #define QT_SOCKLEN_T socklen_t
+-#else
+-#define QT_SOCKLEN_T int
+-#endif
+
+ #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
+ #define QT_SNPRINTF ::snprintf
diff --git a/pkgs/development/libraries/qt-5/5.10/qtbase-darwin.patch b/pkgs/development/libraries/qt-5/5.10/qtbase-darwin.patch
index e85a284f3bb..fa389fe55c2 100644
--- a/pkgs/development/libraries/qt-5/5.10/qtbase-darwin.patch
+++ b/pkgs/development/libraries/qt-5/5.10/qtbase-darwin.patch
@@ -1,3 +1,16 @@
+diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+index 66baf16..89794ef 100644
+--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
++++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+@@ -830,7 +830,7 @@ void QCoreTextFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, gl
+
+ QFixed QCoreTextFontEngine::emSquareSize() const
+ {
+- return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));
++ return QFixed(int(CTFontGetUnitsPerEm(ctfont)));
+ }
+
+ QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 341d3bccf2..3368234c26 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase-darwin.patch b/pkgs/development/libraries/qt-5/5.9/qtbase-darwin.patch
index 875fba12e2f..1c3a9b05cb2 100644
--- a/pkgs/development/libraries/qt-5/5.9/qtbase-darwin.patch
+++ b/pkgs/development/libraries/qt-5/5.9/qtbase-darwin.patch
@@ -1,3 +1,16 @@
+diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+index 66baf16..89794ef 100644
+--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
++++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+@@ -830,7 +830,7 @@ void QCoreTextFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, gl
+
+ QFixed QCoreTextFontEngine::emSquareSize() const
+ {
+- return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));
++ return QFixed(int(CTFontGetUnitsPerEm(ctfont)));
+ }
+
+ QFontEngine *QCoreTextFontEngine::cloneWithSize(qreal pixelSize) const
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 341d3bc..3368234 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix
index 42eaf71942e..07d2a04c5e2 100644
--- a/pkgs/development/libraries/science/math/openblas/default.nix
+++ b/pkgs/development/libraries/science/math/openblas/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran, perl, which, config, coreutils
+{ stdenv, fetchurl, fetchpatch, gfortran, perl, which, config, coreutils
# Most packages depending on openblas expect integer width to match
# pointer width, but some expect to use 32-bit integers always
# (for compatibility with reference BLAS).
@@ -115,9 +115,16 @@ stdenv.mkDerivation {
"NUM_THREADS=64"
"INTERFACE64=${if blas64 then "1" else "0"}"
"NO_STATIC=1"
- ]
+ ] ++ stdenv.lib.optional (stdenv.hostPlatform.libc == "musl") "NO_AFFINITY=1"
++ mapAttrsToList (var: val: var + "=" + val) config;
+ patches = stdenv.lib.optional (stdenv.hostPlatform.libc != "glibc")
+ # https://github.com/xianyi/OpenBLAS/pull/1247
+ (fetchpatch {
+ url = "https://github.com/xianyi/OpenBLAS/commit/88a35ff457f55e527e0e8a503a0dc61976c1846d.patch";
+ sha256 = "1a3qrhvl5hp06c53fjqghq4zgf6ls7narm06l0shcvs57hznh09n";
+ });
+
doCheck = true;
checkTarget = "tests";
diff --git a/pkgs/development/libraries/stfl/default.nix b/pkgs/development/libraries/stfl/default.nix
index 1430c3aa9c2..8a8680a498a 100644
--- a/pkgs/development/libraries/stfl/default.nix
+++ b/pkgs/development/libraries/stfl/default.nix
@@ -13,8 +13,9 @@ stdenv.mkDerivation rec {
buildPhase = ''
sed -i s/gcc/cc/g Makefile
sed -i s%ncursesw/ncurses.h%ncurses.h% stfl_internals.h
- '' + ( stdenv.lib.optionalString stdenv.isDarwin ''
+ '' + stdenv.lib.optionalString (stdenv.hostPlatform.libc != "glibc") ''
sed -i 's/LDLIBS += -lncursesw/LDLIBS += -lncursesw -liconv/' Makefile
+ '' + ( stdenv.lib.optionalString stdenv.isDarwin ''
sed -i s/-soname/-install_name/ Makefile
'' ) + ''
make
diff --git a/pkgs/development/libraries/tbb/default.nix b/pkgs/development/libraries/tbb/default.nix
index 13b1970866e..182fbb35d49 100644
--- a/pkgs/development/libraries/tbb/default.nix
+++ b/pkgs/development/libraries/tbb/default.nix
@@ -16,6 +16,8 @@ with stdenv.lib; stdenv.mkDerivation rec {
optional (stdver != null) "stdver=${stdver}"
);
+ patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ./glibc-struct-mallinfo.patch;
+
installPhase = ''
mkdir -p $out/{lib,share/doc}
cp "build/"*release*"/"*${stdenv.hostPlatform.extensions.sharedLibrary}* $out/lib/
diff --git a/pkgs/development/libraries/tbb/glibc-struct-mallinfo.patch b/pkgs/development/libraries/tbb/glibc-struct-mallinfo.patch
new file mode 100644
index 00000000000..64056ecb146
--- /dev/null
+++ b/pkgs/development/libraries/tbb/glibc-struct-mallinfo.patch
@@ -0,0 +1,43 @@
+From b577153a10c98f4e13405dc93ea2ab1a7b990e07 Mon Sep 17 00:00:00 2001
+From: David Huffman
+Date: Wed, 6 Jan 2016 07:09:30 -0500
+Subject: [PATCH] hard-code glibc's definition of struct mallinfo
+
+---
+ src/tbbmalloc/proxy.h | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/src/tbbmalloc/proxy.h b/src/tbbmalloc/proxy.h
+index 781cadc..e1ea1ae 100644
+--- a/src/tbbmalloc/proxy.h
++++ b/src/tbbmalloc/proxy.h
+@@ -32,6 +32,26 @@
+
+ #include
+
++// The following definition was taken from /usr/include/malloc.h as provided by
++// the glibc-devel-2.19-17.4.x86_64 package on openSUSE Leap 42.1; it is
++// made available under the GNU Lesser General Public License v2.1 or later.
++// See .
++//
++// Copyright (C) 1996-2014 Free Software Foundation, Inc.
++struct mallinfo
++{
++ int arena; /* non-mmapped space allocated from system */
++ int ordblks; /* number of free chunks */
++ int smblks; /* number of fastbin blocks */
++ int hblks; /* number of mmapped regions */
++ int hblkhd; /* space in mmapped regions */
++ int usmblks; /* maximum total allocated space */
++ int fsmblks; /* space available in freed fastbin blocks */
++ int uordblks; /* total allocated space */
++ int fordblks; /* total free space */
++ int keepcost; /* top-most, releasable (via malloc_trim) space */
++};
++
+ extern "C" {
+ void * scalable_malloc(size_t size);
+ void * scalable_calloc(size_t nobj, size_t size);
+--
+2.6.2
+
diff --git a/pkgs/development/libraries/ti-rpc/default.nix b/pkgs/development/libraries/ti-rpc/default.nix
index 0156c64306c..d34a6dca783 100644
--- a/pkgs/development/libraries/ti-rpc/default.nix
+++ b/pkgs/development/libraries/ti-rpc/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, autoreconfHook, libkrb5 }:
+{ fetchurl, fetchpatch, stdenv, autoreconfHook, libkrb5 }:
stdenv.mkDerivation rec {
name = "libtirpc-1.0.2";
@@ -8,6 +8,12 @@ stdenv.mkDerivation rec {
sha256 = "1xchbxy0xql7yl7z4n1icj8r7dmly46i22fvm00vdjq64zlmqg3j";
};
+ patches = stdenv.lib.optional stdenv.hostPlatform.isMusl
+ (fetchpatch {
+ url = "https://raw.githubusercontent.com/openembedded/openembedded-core/2be873301420ec6ca2c70d899b7c49a7e2b0954d/meta/recipes-extended/libtirpc/libtirpc/0001-replace-__bzero-with-memset-API.patch";
+ sha256 = "1jmbn0j2bnjp0j9z5vzz5xiwyv3kd28w5pixbqsy2lz6q8nii7cf";
+ });
+
postPatch = ''
sed '1i#include ' -i src/xdr_sizeof.c
'';
diff --git a/pkgs/development/libraries/webkitgtk/2.4.nix b/pkgs/development/libraries/webkitgtk/2.4.nix
index 6669b562400..18d20bf9c78 100644
--- a/pkgs/development/libraries/webkitgtk/2.4.nix
+++ b/pkgs/development/libraries/webkitgtk/2.4.nix
@@ -53,6 +53,8 @@ stdenv.mkDerivation rec {
./quartz-webcore.patch
./libc++.patch
./plugin-none.patch
+ ] ++ optionals stdenv.hostPlatform.isMusl [
+ ./fix-execinfo.patch
];
configureFlags = with stdenv.lib; [
diff --git a/pkgs/development/libraries/webkitgtk/fix-execinfo.patch b/pkgs/development/libraries/webkitgtk/fix-execinfo.patch
new file mode 100644
index 00000000000..eb825312f3b
--- /dev/null
+++ b/pkgs/development/libraries/webkitgtk/fix-execinfo.patch
@@ -0,0 +1,20 @@
+--- webkitgtk-2.2.0.orig/Source/WTF/wtf/Assertions.cpp
++++ webkitgtk-2.2.0/Source/WTF/wtf/Assertions.cpp
+@@ -64,7 +64,7 @@
+ #include
+ #endif
+
+-#if OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))
++#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__))
+ #include
+ #include
+ #include
+@@ -242,7 +242,7 @@
+
+ void WTFGetBacktrace(void** stack, int* size)
+ {
+-#if OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))
++#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__))
+ *size = backtrace(stack, *size);
+ #elif OS(WINDOWS) && !OS(WINCE)
+ // The CaptureStackBackTrace function is available in XP, but it is not defined
diff --git a/pkgs/development/libraries/webrtc-audio-processing/default.nix b/pkgs/development/libraries/webrtc-audio-processing/default.nix
index f5d49290484..b5a3aed91d9 100644
--- a/pkgs/development/libraries/webrtc-audio-processing/default.nix
+++ b/pkgs/development/libraries/webrtc-audio-processing/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
# signal_processing/filter_ar_fast_q12_armv7.S:88: Error: selected processor does not support `sbfx r11,r6,#12,#16' in ARM mode
patchPhase = stdenv.lib.optionalString stdenv.isArm ''
substituteInPlace configure --replace 'armv7*|armv8*' 'disabled'
+ '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+ substituteInPlace webrtc/base/checks.cc --replace 'defined(__UCLIBC__)' 1
'';
meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/aiohttp/default.nix b/pkgs/development/python-modules/aiohttp/default.nix
index bea839f49e3..f831679294a 100644
--- a/pkgs/development/python-modules/aiohttp/default.nix
+++ b/pkgs/development/python-modules/aiohttp/default.nix
@@ -9,7 +9,6 @@
, idna-ssl
, pytest
, gunicorn
-, pytest-raisesregexp
, pytest-mock
}:
@@ -24,7 +23,7 @@ buildPythonPackage rec {
disabled = pythonOlder "3.4";
- checkInputs = [ pytest gunicorn pytest-raisesregexp pytest-mock ];
+ checkInputs = [ pytest gunicorn pytest-mock ];
propagatedBuildInputs = [ async-timeout chardet multidict yarl ]
++ lib.optional (pythonOlder "3.7") idna-ssl;
diff --git a/pkgs/development/python-modules/async_timeout/default.nix b/pkgs/development/python-modules/async_timeout/default.nix
index 650517d44d9..53010a2a031 100644
--- a/pkgs/development/python-modules/async_timeout/default.nix
+++ b/pkgs/development/python-modules/async_timeout/default.nix
@@ -1,22 +1,19 @@
{ lib
-, fetchurl
+, fetchPypi
, buildPythonPackage
, pytestrunner
, pythonOlder
}:
-let
+buildPythonPackage rec {
pname = "async-timeout";
version = "2.0.0";
-in buildPythonPackage rec {
- name = "${pname}-${version}";
- src = fetchurl {
- url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${name}.tar.gz";
+ src = fetchPypi {
+ inherit pname version;
sha256 = "c17d8ac2d735d59aa62737d76f2787a6c938f5a944ecf768a8c0ab70b0dea566";
};
- buildInputs = [ pytestrunner ];
# Circular dependency on aiohttp
doCheck = false;
@@ -27,4 +24,4 @@ in buildPythonPackage rec {
homepage = https://github.com/aio-libs/async_timeout/;
license = lib.licenses.asl20;
};
-}
\ No newline at end of file
+}
diff --git a/pkgs/development/python-modules/cffi/default.nix b/pkgs/development/python-modules/cffi/default.nix
index 28d4a36aca7..5e186a8f2f8 100644
--- a/pkgs/development/python-modules/cffi/default.nix
+++ b/pkgs/development/python-modules/cffi/default.nix
@@ -32,6 +32,7 @@ if isPyPy then null else buildPythonPackage rec {
# The tests use -Werror but with python3.6 clang detects some unreachable code.
NIX_CFLAGS_COMPILE = stdenv.lib.optionals stdenv.cc.isClang [ "-Wno-unused-command-line-argument" "-Wno-unreachable-code" ];
+ doCheck = !stdenv.hostPlatform.isMusl; # TODO: Investigate
checkPhase = ''
py.test
'';
diff --git a/pkgs/development/python-modules/chardet/default.nix b/pkgs/development/python-modules/chardet/default.nix
index 7e50dca4066..1f452fb461a 100644
--- a/pkgs/development/python-modules/chardet/default.nix
+++ b/pkgs/development/python-modules/chardet/default.nix
@@ -2,7 +2,6 @@
, pytest, pytestrunner, hypothesis }:
buildPythonPackage rec {
- name = "${pname}-${version}";
pname = "chardet";
version = "3.0.4";
@@ -11,7 +10,7 @@ buildPythonPackage rec {
sha256 = "1bpalpia6r5x1kknbk11p1fzph56fmmnp405ds8icksd3knr5aw4";
};
- buildInputs = [ pytest pytestrunner hypothesis ];
+ checkInputs = [ pytest pytestrunner hypothesis ];
meta = with stdenv.lib; {
homepage = https://github.com/chardet/chardet;
diff --git a/pkgs/development/python-modules/multidict/default.nix b/pkgs/development/python-modules/multidict/default.nix
index 7eaa0962b44..38facc96658 100644
--- a/pkgs/development/python-modules/multidict/default.nix
+++ b/pkgs/development/python-modules/multidict/default.nix
@@ -1,8 +1,7 @@
{ lib
, fetchPypi
, buildPythonPackage
-, cython
-, pytest, psutil, pytestrunner
+, pytest, pytestrunner
, isPy3k
}:
@@ -15,8 +14,7 @@ buildPythonPackage rec {
sha256 = "0liazqlyk2nmr82nhiw2z72j7bjqxaisifkj476msw140d4i4i7v";
};
- buildInputs = [ cython ];
- checkInputs = [ pytest psutil pytestrunner ];
+ checkInputs = [ pytest pytestrunner ];
disabled = !isPy3k;
diff --git a/pkgs/development/python-modules/pytest-xdist/default.nix b/pkgs/development/python-modules/pytest-xdist/default.nix
index d671fd9654a..596ce38ed0a 100644
--- a/pkgs/development/python-modules/pytest-xdist/default.nix
+++ b/pkgs/development/python-modules/pytest-xdist/default.nix
@@ -1,7 +1,6 @@
{ stdenv, fetchPypi, buildPythonPackage, isPy3k, execnet, pytest, setuptools_scm, pytest-forked }:
buildPythonPackage rec {
- name = "${pname}-${version}";
pname = "pytest-xdist";
version = "1.22.0";
@@ -10,21 +9,19 @@ buildPythonPackage rec {
sha256 = "65228a859191f2c74ee68c127317eefe35eedd3d43fc1431f19240663b0cafcd";
};
- buildInputs = [ pytest setuptools_scm pytest-forked];
+ nativeBuildInputs = [ setuptools_scm ];
+ buildInputs = [ pytest pytest-forked ];
propagatedBuildInputs = [ execnet ];
- postPatch = ''
- rm testing/acceptance_test.py testing/test_remote.py testing/test_slavemanage.py
- '';
-
checkPhase = ''
- py.test testing
+ # Excluded tests access file system
+ py.test testing -k "not test_distribution_rsyncdirs_example \
+ and not test_rsync_popen_with_path \
+ and not test_popen_rsync_subdir \
+ and not test_init_rsync_roots \
+ and not test_rsyncignore"
'';
- # Only test on 3.x
- # INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'getconsumer'
- doCheck = isPy3k;
-
meta = with stdenv.lib; {
description = "py.test xdist plugin for distributed testing and loop-on-failing modes";
homepage = https://github.com/pytest-dev/pytest-xdist;
diff --git a/pkgs/development/python-modules/testtools/default.nix b/pkgs/development/python-modules/testtools/default.nix
index eb6a6694b05..1a99378a541 100644
--- a/pkgs/development/python-modules/testtools/default.nix
+++ b/pkgs/development/python-modules/testtools/default.nix
@@ -4,33 +4,26 @@
, pbr
, python_mimeparse
, extras
-, lxml
, unittest2
, traceback2
-, isPy3k
-, fixtures
-, pyrsistent
+, testscenarios
}:
-
-
buildPythonPackage rec {
pname = "testtools";
version = "2.3.0";
- # Python 2 only judging from SyntaxError
-# disabled = isPy3k;
-
src = fetchPypi {
inherit pname version;
sha256 = "5827ec6cf8233e0f29f51025addd713ca010061204fdea77484a2934690a0559";
};
- propagatedBuildInputs = [ pbr python_mimeparse extras lxml unittest2 pyrsistent ];
+ propagatedBuildInputs = [ pbr python_mimeparse extras unittest2 ];
buildInputs = [ traceback2 ];
- # No tests in archive
+ # testscenarios has a circular dependency on testtools
doCheck = false;
+ checkInputs = [ testscenarios ];
# testtools 2.0.0 and up has a circular run-time dependency on futures
postPatch = ''
@@ -42,4 +35,4 @@ buildPythonPackage rec {
homepage = https://pypi.python.org/pypi/testtools;
license = lib.licenses.mit;
};
-}
\ No newline at end of file
+}
diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix
index fed88561cf9..97c02cd9cc1 100644
--- a/pkgs/development/tools/build-managers/cmake/default.nix
+++ b/pkgs/development/tools/build-managers/cmake/default.nix
@@ -83,11 +83,25 @@ stdenv.mkDerivation rec {
configureFlags = [ "--docdir=share/doc/${name}" ]
++ (if useSharedLibraries then [ "--no-system-jsoncpp" "--system-libs" ] else [ "--no-system-libs" ]) # FIXME: cleanup
++ optional (useQt4 || withQt5) "--qt-gui"
- ++ optionals (!useNcurses) [ "--" "-DBUILD_CursesDialog=OFF" ];
+ ++ ["--"]
+ ++ optionals (!useNcurses) [ "-DBUILD_CursesDialog=OFF" ]
+ ++ optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+ "-DCMAKE_CXX_COMPILER=${stdenv.cc.targetPrefix}c++"
+ "-DCMAKE_C_COMPILER=${stdenv.cc.targetPrefix}cc"
+ "-DCMAKE_AR=${getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar"
+ "-DCMAKE_RANLIB=${getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib"
+ "-DCMAKE_STRIP=${getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip"
+ # TODO: Why are ar and friends not provided by the bintools wrapper?
+ ];
dontUseCmakeConfigure = true;
enableParallelBuilding = true;
+ # This isn't an autoconf configure script; triples are passed via
+ # CMAKE_SYSTEM_NAME, etc.
+ configurePlatforms = [ ];
+
+
meta = with stdenv.lib; {
homepage = http://www.cmake.org/;
description = "Cross-Platform Makefile Generator";
diff --git a/pkgs/development/tools/build-managers/cmake/setup-hook.sh b/pkgs/development/tools/build-managers/cmake/setup-hook.sh
index a0f1cf00814..c796c31cb70 100755
--- a/pkgs/development/tools/build-managers/cmake/setup-hook.sh
+++ b/pkgs/development/tools/build-managers/cmake/setup-hook.sh
@@ -33,7 +33,15 @@ cmakeConfigurePhase() {
# By now it supports linux builds only. We should set the proper
# CMAKE_SYSTEM_NAME otherwise.
# http://www.cmake.org/Wiki/CMake_Cross_Compiling
- cmakeFlags="-DCMAKE_CXX_COMPILER=$crossConfig-g++ -DCMAKE_C_COMPILER=$crossConfig-gcc $cmakeFlags"
+ #
+ # Unfortunately cmake seems to expect absolute paths for ar, ranlib, and
+ # strip. Otherwise they are taken to be relative to the source root of
+ # the package being built.
+ cmakeFlags="-DCMAKE_CXX_COMPILER=$crossConfig-c++ $cmakeFlags"
+ cmakeFlags="-DCMAKE_C_COMPILER=$crossConfig-cc $cmakeFlags"
+ cmakeFlags="-DCMAKE_AR=$(command -v $crossConfig-ar) $cmakeFlags"
+ cmakeFlags="-DCMAKE_RANLIB=$(command -v $crossConfig-ranlib) $cmakeFlags"
+ cmakeFlags="-DCMAKE_STRIP=$(command -v $crossConfig-strip) $cmakeFlags"
fi
# This installs shared libraries with a fully-specified install
diff --git a/pkgs/development/tools/build-managers/gnumake/4.2/default.nix b/pkgs/development/tools/build-managers/gnumake/4.2/default.nix
index 7914d8ebb4f..e175205143f 100644
--- a/pkgs/development/tools/build-managers/gnumake/4.2/default.nix
+++ b/pkgs/development/tools/build-managers/gnumake/4.2/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation {
./pselect.patch
];
- nativeBuildInputs = [ pkgconfig ];
+ nativeBuildInputs = stdenv.lib.optionals guileSupport [ pkgconfig ];
buildInputs = stdenv.lib.optionals guileSupport [ guile ];
configureFlags = stdenv.lib.optional guileSupport "--with-guile";
diff --git a/pkgs/development/tools/misc/autoconf/default.nix b/pkgs/development/tools/misc/autoconf/default.nix
index 472f437978b..579dea33df4 100644
--- a/pkgs/development/tools/misc/autoconf/default.nix
+++ b/pkgs/development/tools/misc/autoconf/default.nix
@@ -8,7 +8,8 @@ stdenv.mkDerivation rec {
sha256 = "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4";
};
- buildInputs = [ m4 perl ];
+ nativeBuildInputs = [ m4 perl ];
+ buildInputs = [ m4 ];
# Work around a known issue in Cygwin. See
# http://thread.gmane.org/gmane.comp.sysutils.autoconf.bugs/6822 for
diff --git a/pkgs/development/tools/misc/autogen/default.nix b/pkgs/development/tools/misc/autogen/default.nix
index 28034f9d549..77944297a97 100644
--- a/pkgs/development/tools/misc/autogen/default.nix
+++ b/pkgs/development/tools/misc/autogen/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, which, pkgconfig, perl, guile, libxml2 }:
+{ stdenv, buildPackages, fetchurl, which, pkgconfig, texinfo, perl, guile, libxml2 }:
stdenv.mkDerivation rec {
name = "autogen-${version}";
@@ -11,8 +11,21 @@ stdenv.mkDerivation rec {
outputs = [ "bin" "dev" "lib" "out" "man" "info" ];
- nativeBuildInputs = [ which pkgconfig perl ];
- buildInputs = [ guile libxml2 ];
+ nativeBuildInputs = [ which pkgconfig perl ]
+ # autogen needs a build autogen when cross-compiling
+ ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ buildPackages.autogen buildPackages.texinfo ];
+ buildInputs = [
+ guile libxml2
+ ];
+
+ configureFlags = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+ "--with-libxml2=${libxml2.dev}"
+ "--with-libxml2-cflags=-I${libxml2.dev}/include/libxml2"
+ # the configure check for regcomp wants to run a host program
+ "libopts_cv_with_libregex=yes"
+ #"MAKEINFO=${buildPackages.texinfo}/bin/makeinfo"
+ ];
postPatch = ''
# Fix a broken sed expression used for detecting the minor
diff --git a/pkgs/development/tools/misc/lsof/default.nix b/pkgs/development/tools/misc/lsof/default.nix
index aa6bd003ed3..224e0aba6ef 100644
--- a/pkgs/development/tools/misc/lsof/default.nix
+++ b/pkgs/development/tools/misc/lsof/default.nix
@@ -30,6 +30,10 @@ stdenv.mkDerivation rec {
patches = [ ./dfile.patch ];
+ postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+ substituteInPlace dialects/linux/dlsof.h --replace "defined(__UCLIBC__)" 1
+ '';
+
# Stop build scripts from searching global include paths
LSOF_INCLUDE = "${stdenv.cc.libc}/include";
configurePhase = "LINUX_CONF_CC=$CC_FOR_BUILD LSOF_CC=$CC LSOF_AR=\"$AR cr\" LSOF_RANLIB=$RANLIB ./Configure -n ${dialect}";
diff --git a/pkgs/development/tools/misc/patchelf/unstable.nix b/pkgs/development/tools/misc/patchelf/unstable.nix
index 62647879865..de68a4066d7 100644
--- a/pkgs/development/tools/misc/patchelf/unstable.nix
+++ b/pkgs/development/tools/misc/patchelf/unstable.nix
@@ -10,6 +10,12 @@ stdenv.mkDerivation rec {
sha256 = "1f1s8q3as3nrhcc1a8qc2z7imm644jfz44msn9sfv4mdynp2m2yb";
};
+ # Drop test that fails on musl (?)
+ postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+ substituteInPlace tests/Makefile.am \
+ --replace "set-rpath-library.sh" ""
+ '';
+
setupHook = [ ./setup-hook.sh ];
nativeBuildInputs = [ autoreconfHook ];
diff --git a/pkgs/games/2048-in-terminal/default.nix b/pkgs/games/2048-in-terminal/default.nix
index 288c852b11e..5d91bc04114 100644
--- a/pkgs/games/2048-in-terminal/default.nix
+++ b/pkgs/games/2048-in-terminal/default.nix
@@ -13,6 +13,10 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses ];
+ prePatch = ''
+ sed -i '1i#include \n' save.c
+ '';
+
enableParallelBuilding = true;
preInstall = ''
diff --git a/pkgs/games/armagetronad/default.nix b/pkgs/games/armagetronad/default.nix
index 21f545100b3..0fb75b3d345 100644
--- a/pkgs/games/armagetronad/default.nix
+++ b/pkgs/games/armagetronad/default.nix
@@ -15,6 +15,8 @@ stdenv.mkDerivation {
NIX_LDFLAGS = [ "-lSDL_image" ];
+ enableParallelBuilding = true;
+
configureFlags = [ "--disable-etc" ];
buildInputs = [ SDL SDL_image libxml2 libjpeg libpng mesa zlib ];
diff --git a/pkgs/os-specific/darwin/apple-source-releases/ICU/clang-5.patch b/pkgs/os-specific/darwin/apple-source-releases/ICU/clang-5.patch
new file mode 100644
index 00000000000..fd9df812940
--- /dev/null
+++ b/pkgs/os-specific/darwin/apple-source-releases/ICU/clang-5.patch
@@ -0,0 +1,22 @@
+diff --git a/icuSources/i18n/ucoleitr.cpp b/icuSources/i18n/ucoleitr.cpp
+index ecc94c9..936452f 100644
+--- a/icuSources/i18n/ucoleitr.cpp
++++ b/icuSources/i18n/ucoleitr.cpp
+@@ -320,7 +320,7 @@ ucol_nextProcessed(UCollationElements *elems,
+ int32_t *ixHigh,
+ UErrorCode *status)
+ {
+- return (UCollationPCE::UCollationPCE(elems)).nextProcessed(ixLow, ixHigh, status);
++ return (UCollationPCE(elems)).nextProcessed(ixLow, ixHigh, status);
+ }
+
+
+@@ -384,7 +384,7 @@ ucol_previousProcessed(UCollationElements *elems,
+ int32_t *ixHigh,
+ UErrorCode *status)
+ {
+- return (UCollationPCE::UCollationPCE(elems)).previousProcessed(ixLow, ixHigh, status);
++ return (UCollationPCE(elems)).previousProcessed(ixLow, ixHigh, status);
+ }
+
+ U_NAMESPACE_BEGIN
diff --git a/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix b/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
index 2d098418f03..eef26f4b79a 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
@@ -3,6 +3,8 @@
appleDerivation {
nativeBuildInputs = [ cctools ];
+ patches = [ ./clang-5.patch ];
+
postPatch = ''
substituteInPlace makefile \
--replace /usr/bin/ "" \
diff --git a/pkgs/os-specific/linux/apparmor/default.nix b/pkgs/os-specific/linux/apparmor/default.nix
index 29e1357d38a..0bb5561e957 100644
--- a/pkgs/os-specific/linux/apparmor/default.nix
+++ b/pkgs/os-specific/linux/apparmor/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, makeWrapper, autoreconfHook
+{ stdenv, fetchurl, fetchpatch, makeWrapper, autoreconfHook
, pkgconfig, which
, flex, bison
, linuxHeaders ? stdenv.cc.libc.linuxHeaders
@@ -35,6 +35,27 @@ let
substituteInPlace ./common/Make.rules --replace "/usr/share/man" "share/man"
'';
+ # use 'if c then x else null' to avoid rebuilding
+ # patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [
+ patches = if stdenv.hostPlatform.isMusl then [
+ (fetchpatch {
+ url = "https://git.alpinelinux.org/cgit/aports/plain/testing/apparmor/0002-Provide-missing-secure_getenv-and-scandirat-function.patch?id=74b8427cc21f04e32030d047ae92caa618105b53";
+ name = "0002-Provide-missing-secure_getenv-and-scandirat-function.patch";
+ sha256 = "0pj1bzifghxwxlc39j8hyy17dkjr9fk64kkj94ayymyprz4i4nac";
+ })
+ (fetchpatch {
+ url = "https://git.alpinelinux.org/cgit/aports/plain/testing/apparmor/0003-Added-missing-typedef-definitions-on-parser.patch?id=74b8427cc21f04e32030d047ae92caa618105b53";
+ name = "0003-Added-missing-typedef-definitions-on-parser.patch";
+ sha256 = "0yyaqz8jlmn1bm37arggprqz0njb4lhjni2d9c8qfqj0kll0bam0";
+ })
+ (fetchpatch {
+ url = "https://git.alpinelinux.org/cgit/aports/plain/testing/apparmor/0007-Do-not-build-install-vim-file-with-utils-package.patch?id=74b8427cc21f04e32030d047ae92caa618105b53";
+ name = "0007-Do-not-build-install-vim-file-with-utils-package.patch";
+ sha256 = "1m4dx901biqgnr4w4wz8a2z9r9dxyw7wv6m6mqglqwf2lxinqmp4";
+ })
+ # (alpine patches {1,4,5,6,8} are needed for apparmor 2.11, but not 2.12)
+ ] else null;
+
# FIXME: convert these to a single multiple-outputs package?
libapparmor = stdenv.mkDerivation {
@@ -63,6 +84,8 @@ let
substituteInPlace ./libraries/libapparmor/src/Makefile.am --replace "/usr/include/netinet/in.h" "${stdenv.cc.libc.dev}/include/netinet/in.h"
substituteInPlace ./libraries/libapparmor/src/Makefile.in --replace "/usr/include/netinet/in.h" "${stdenv.cc.libc.dev}/include/netinet/in.h"
'';
+ inherit patches;
+
postPatch = "cd ./libraries/libapparmor";
configureFlags = "--with-python --with-perl";
@@ -90,6 +113,7 @@ let
];
prePatch = prePatchCommon;
+ inherit patches;
postPatch = "cd ./utils";
makeFlags = ''LANGS='';
installFlags = ''DESTDIR=$(out) BINDIR=$(out)/bin VIM_INSTALL_PATH=$(out)/share PYPREFIX='';
@@ -145,6 +169,7 @@ let
## techdoc.pdf still doesn't build ...
substituteInPlace ./parser/Makefile --replace "manpages htmlmanpages pdf" "manpages htmlmanpages"
'';
+ inherit patches;
postPatch = "cd ./parser";
makeFlags = ''LANGS= USE_SYSTEM=1 INCLUDEDIR=${libapparmor}/include'';
installFlags = ''DESTDIR=$(out) DISTRO=unknown'';
diff --git a/pkgs/os-specific/linux/audit/default.nix b/pkgs/os-specific/linux/audit/default.nix
index 4adc321d930..390bab849c2 100644
--- a/pkgs/os-specific/linux/audit/default.nix
+++ b/pkgs/os-specific/linux/audit/default.nix
@@ -1,5 +1,5 @@
{
- stdenv, buildPackages, fetchurl,
+ stdenv, buildPackages, fetchurl, fetchpatch,
enablePython ? false, python ? null,
}:
@@ -27,6 +27,22 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
+ patches = stdenv.lib.optional stdenv.hostPlatform.isMusl [
+ (fetchpatch {
+ url = "https://git.alpinelinux.org/cgit/aports/plain/main/audit/0002-auparse-remove-use-of-rawmemchr.patch?id=3e57180fdf3f90c30a25aea44f57846efc93a696";
+ name = "0002-auparse-remove-use-of-rawmemchr.patch";
+ sha256 = "1caaqbfgb2rq3ria5bz4n8x30ihgihln6w9w9a46k62ba0wh9rkz";
+ })
+ (fetchpatch {
+ url = "https://git.alpinelinux.org/cgit/aports/plain/main/audit/0003-all-get-rid-of-strndupa.patch?id=3e57180fdf3f90c30a25aea44f57846efc93a696";
+ name = "0003-all-get-rid-of-strndupa.patch";
+ sha256 = "1ddrm6a0ijrf7caw1wpw2kkbjp2lkxkmc16v51j5j7dvdalc6591";
+ })
+ ];
+
+ prePatch = ''
+ sed -i 's,#include ,#include \n#include ,' audisp/audispd.c
+ '';
meta = {
description = "Audit Library";
homepage = http://people.redhat.com/sgrubb/audit/;
diff --git a/pkgs/os-specific/linux/bcc/default.nix b/pkgs/os-specific/linux/bcc/default.nix
index 23e8c1ca7d7..6725cec750a 100644
--- a/pkgs/os-specific/linux/bcc/default.nix
+++ b/pkgs/os-specific/linux/bcc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchpatch, makeWrapper, cmake, llvmPackages_5, kernel
+{ stdenv, fetchFromGitHub, fetchpatch, makeWrapper, cmake, llvmPackages, kernel
, flex, bison, elfutils, python, pythonPackages, luajit, netperf, iperf, libelf }:
stdenv.mkDerivation rec {
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
};
buildInputs = [
- llvmPackages_5.llvm llvmPackages_5.clang-unwrapped kernel
+ llvmPackages.llvm llvmPackages.clang-unwrapped kernel
elfutils python pythonPackages.netaddr luajit netperf iperf
];
diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix
index a8d5ab48ac2..c83a526b246 100644
--- a/pkgs/os-specific/linux/busybox/default.nix
+++ b/pkgs/os-specific/linux/busybox/default.nix
@@ -1,11 +1,13 @@
{ stdenv, lib, buildPackages, fetchurl, fetchpatch
, enableStatic ? false
, enableMinimal ? false
-, useMusl ? false, musl
+, useMusl ? stdenv.hostPlatform.libc == "musl", musl
, extraConfig ? ""
, buildPlatform, hostPlatform
}:
+assert stdenv.hostPlatform.libc == "musl" -> useMusl;
+
let
configParser = ''
function parseconfig {
@@ -24,6 +26,10 @@ let
}
'';
+ libcConfig = lib.optionalString useMusl ''
+ CONFIG_FEATURE_UTMP n
+ CONFIG_FEATURE_WTMP n
+ '';
in
stdenv.mkDerivation rec {
@@ -67,8 +73,12 @@ stdenv.mkDerivation rec {
# Set paths for console fonts.
CONFIG_DEFAULT_SETFONT_DIR "/etc/kbd"
+ # Bump from 4KB, much faster I/O
+ CONFIG_FEATURE_COPYBUF_KB 64
+
${extraConfig}
CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.targetPrefix}"
+ ${libcConfig}
EOF
make oldconfig
@@ -77,7 +87,7 @@ stdenv.mkDerivation rec {
'';
postConfigure = lib.optionalString useMusl ''
- makeFlagsArray+=("CC=${stdenv.cc.targetPrefix}gcc -isystem ${musl}/include -B${musl}/lib -L${musl}/lib")
+ makeFlagsArray+=("CC=${stdenv.cc.targetPrefix}cc -isystem ${musl.dev}/include -B${musl}/lib -L${musl}/lib")
'';
depsBuildBuild = [ buildPackages.stdenv.cc ];
diff --git a/pkgs/os-specific/linux/iproute/default.nix b/pkgs/os-specific/linux/iproute/default.nix
index 793c9db603b..269c59f5e6f 100644
--- a/pkgs/os-specific/linux/iproute/default.nix
+++ b/pkgs/os-specific/linux/iproute/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, lib, flex, bison, db, iptables, pkgconfig }:
+{ fetchurl, stdenv, lib, flex, bash, bison, db, iptables, pkgconfig }:
stdenv.mkDerivation rec {
name = "iproute2-${version}";
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
preConfigure = ''
patchShebangs ./configure
sed -e '/ARPDDIR/d' -i Makefile
+ # Don't build netem tools--they're not installed and require HOSTCC
+ substituteInPlace Makefile --replace " netem " " "
'';
makeFlags = [
@@ -37,6 +39,10 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
+ postInstall = ''
+ PATH=${bash}/bin:$PATH patchShebangs $out/sbin
+ '';
+
meta = with stdenv.lib; {
homepage = https://wiki.linuxfoundation.org/networking/iproute2;
description = "A collection of utilities for controlling TCP/IP networking and traffic control in Linux";
diff --git a/pkgs/os-specific/linux/iputils/default.nix b/pkgs/os-specific/linux/iputils/default.nix
index dd5770744bf..a7fbcce3175 100644
--- a/pkgs/os-specific/linux/iputils/default.nix
+++ b/pkgs/os-specific/linux/iputils/default.nix
@@ -4,8 +4,6 @@
, libidn, nettle
, SGMLSpm, libgcrypt }:
-assert stdenv ? glibc;
-
let
time = "20161105";
in
@@ -23,11 +21,12 @@ stdenv.mkDerivation rec {
-i doc/Makefile
'';
- makeFlags = "USE_GNUTLS=no";
+ # Disable idn usage w/musl: https://github.com/iputils/iputils/pull/111
+ makeFlags = [ "USE_GNUTLS=no" ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "USE_IDN=no";
buildInputs = [
- libsysfs opensp openssl libcap docbook_sgml_dtd_31 SGMLSpm libgcrypt libidn nettle
- ];
+ libsysfs opensp openssl libcap docbook_sgml_dtd_31 SGMLSpm libgcrypt nettle
+ ] ++ stdenv.lib.optional (!stdenv.hostPlatform.isMusl) libidn;
buildFlags = "man all ninfod";
diff --git a/pkgs/os-specific/linux/kernel-headers/4.4.nix b/pkgs/os-specific/linux/kernel-headers/4.4.nix
deleted file mode 100644
index e8e041f48eb..00000000000
--- a/pkgs/os-specific/linux/kernel-headers/4.4.nix
+++ /dev/null
@@ -1,61 +0,0 @@
-{ stdenvNoCC, lib, buildPackages
-, buildPlatform, hostPlatform
-, fetchurl, perl
-}:
-
-assert hostPlatform.isLinux;
-
-let
- version = "4.4.10";
- inherit (hostPlatform.platform) kernelHeadersBaseConfig;
-in
-
-stdenvNoCC.mkDerivation {
- name = "linux-headers-${version}";
-
- src = fetchurl {
- url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
- sha256 = "1kpjvvd9q9wwr3314q5ymvxii4dv2d27295bzly225wlc552xhja";
- };
-
- targetConfig = if hostPlatform != buildPlatform then hostPlatform.config else null;
-
- platform = hostPlatform.platform.kernelArch;
-
- # It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc.
- # We do this so we have a build->build, not build->host, C compiler.
- depsBuildBuild = [ buildPackages.stdenv.cc ];
- nativeBuildInputs = [ perl ];
-
- extraIncludeDirs = lib.optional hostPlatform.isPowerPC ["ppc"];
-
- buildPhase = ''
- if test -n "$targetConfig"; then
- export ARCH=$platform
- fi
- make ${kernelHeadersBaseConfig} SHELL=bash
- make mrproper headers_check SHELL=bash
- '';
-
- installPhase = ''
- make INSTALL_HDR_PATH=$out headers_install
-
- # Some builds (e.g. KVM) want a kernel.release.
- mkdir -p $out/include/config
- echo "${version}-default" > $out/include/config/kernel.release
- '';
-
- # !!! hacky
- fixupPhase = ''
- ln -s asm $out/include/asm-$platform
- if test "$platform" = "i386" -o "$platform" = "x86_64"; then
- ln -s asm $out/include/asm-x86
- fi
- '';
-
- meta = with lib; {
- description = "Header files and scripts for Linux kernel";
- license = licenses.gpl2;
- platforms = platforms.linux;
- };
-}
diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix
new file mode 100644
index 00000000000..b95013ab26d
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel-headers/default.nix
@@ -0,0 +1,67 @@
+{ stdenvNoCC, lib, buildPackages
+, buildPlatform, hostPlatform
+, fetchurl, perl
+}:
+
+assert hostPlatform.isLinux;
+
+let
+ common = { version, sha256, patches ? null }: stdenvNoCC.mkDerivation {
+ name = "linux-headers-${version}";
+
+ src = fetchurl {
+ url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
+ inherit sha256;
+ };
+
+ ARCH = hostPlatform.platform.kernelArch;
+
+ # It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc.
+ # We do this so we have a build->build, not build->host, C compiler.
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+ nativeBuildInputs = [ perl ];
+
+ extraIncludeDirs = lib.optional hostPlatform.isPowerPC ["ppc"];
+
+ # "patches" array defaults to 'null' to avoid changing hash
+ # and causing mass rebuild
+ inherit patches;
+
+ buildPhase = ''
+ make mrproper headers_check SHELL=bash
+ '';
+
+ installPhase = ''
+ make INSTALL_HDR_PATH=$out headers_install
+
+ # Some builds (e.g. KVM) want a kernel.release.
+ mkdir -p $out/include/config
+ echo "${version}-default" > $out/include/config/kernel.release
+ '';
+
+ # !!! hacky
+ fixupPhase = ''
+ ln -s asm $out/include/asm-$platform
+ if test "$platform" = "i386" -o "$platform" = "x86_64"; then
+ ln -s asm $out/include/asm-x86
+ fi
+ '';
+
+ meta = with lib; {
+ description = "Header files and scripts for Linux kernel";
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ };
+ };
+in {
+
+ linuxHeaders_4_4 = common {
+ version = "4.4.10";
+ sha256 = "1kpjvvd9q9wwr3314q5ymvxii4dv2d27295bzly225wlc552xhja";
+ };
+
+ linuxHeaders_4_15 = common {
+ version = "4.15";
+ sha256 = "0sd7l9n9h7vf9c6gd6ciji28hawda60yj0llh17my06m0s4lf9js";
+ };
+}
diff --git a/pkgs/os-specific/linux/kexectools/default.nix b/pkgs/os-specific/linux/kexectools/default.nix
index 021353c4709..c4c5b7cc3b9 100644
--- a/pkgs/os-specific/linux/kexectools/default.nix
+++ b/pkgs/os-specific/linux/kexectools/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, zlib }:
+{ stdenv, buildPackages, fetchurl, zlib }:
stdenv.mkDerivation rec {
name = "kexec-tools-${version}";
@@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" "pic" "relro" ];
+ configureFlags = [ "BUILD_CC=${buildPackages.stdenv.cc.targetPrefix}cc" ];
+ nativeBuildInputs = [ buildPackages.stdenv.cc ];
buildInputs = [ zlib ];
meta = with stdenv.lib; {
diff --git a/pkgs/os-specific/linux/libcap/default.nix b/pkgs/os-specific/linux/libcap/default.nix
index 17cd40e427b..f00d6272902 100644
--- a/pkgs/os-specific/linux/libcap/default.nix
+++ b/pkgs/os-specific/linux/libcap/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, attr, perl, pam ? null }:
+{ stdenv, buildPackages, fetchurl, attr, perl, pam ? null }:
assert pam != null -> stdenv.isLinux;
stdenv.mkDerivation rec {
@@ -13,6 +13,7 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" "lib" "man" "doc" ]
++ stdenv.lib.optional (pam != null) "pam";
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ perl ];
buildInputs = [ pam ];
@@ -22,6 +23,8 @@ stdenv.mkDerivation rec {
makeFlags = [
"lib=lib"
(stdenv.lib.optional (pam != null) "PAM_CAP=yes")
+ "BUILD_CC=$(CC_FOR_BUILD)"
+ "CC:=$(CC)"
];
prePatch = ''
diff --git a/pkgs/os-specific/linux/libnl/default.nix b/pkgs/os-specific/linux/libnl/default.nix
index 81a3af54628..f66df8163ff 100644
--- a/pkgs/os-specific/linux/libnl/default.nix
+++ b/pkgs/os-specific/linux/libnl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchFromGitHub, autoreconfHook, bison, flex, pkgconfig }:
+{ stdenv, lib, fetchFromGitHub, fetchpatch, autoreconfHook, bison, flex, pkgconfig }:
let version = "3.3.0"; in
stdenv.mkDerivation {
@@ -13,6 +13,12 @@ stdenv.mkDerivation {
outputs = [ "bin" "dev" "out" "man" ];
+ patches = stdenv.lib.optional stdenv.hostPlatform.isMusl
+ (fetchpatch {
+ url = "https://raw.githubusercontent.com/gentoo/musl/48d2a28710ae40877fd3e178ead1fb1bb0baa62c/dev-libs/libnl/files/libnl-3.3.0_rc1-musl.patch";
+ sha256 = "0dd7xxikib201i99k2if066hh7gwf2i4ffckrjplq6lr206jn00r";
+ });
+
nativeBuildInputs = [ autoreconfHook bison flex pkgconfig ];
meta = with lib; {
diff --git a/pkgs/os-specific/linux/lm-sensors/default.nix b/pkgs/os-specific/linux/lm-sensors/default.nix
index 25b64499838..4f35d546538 100644
--- a/pkgs/os-specific/linux/lm-sensors/default.nix
+++ b/pkgs/os-specific/linux/lm-sensors/default.nix
@@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
buildInputs = [ bison flex which perl ]
++ stdenv.lib.optional sensord rrdtool;
+ patches = [ ./musl-fix-includes.patch ];
+
preBuild = ''
makeFlagsArray=(PREFIX=$out ETCDIR=$out/etc
${stdenv.lib.optionalString sensord "PROG_EXTRA=sensord"})
diff --git a/pkgs/os-specific/linux/lm-sensors/musl-fix-includes.patch b/pkgs/os-specific/linux/lm-sensors/musl-fix-includes.patch
new file mode 100644
index 00000000000..501f2dd762c
--- /dev/null
+++ b/pkgs/os-specific/linux/lm-sensors/musl-fix-includes.patch
@@ -0,0 +1,62 @@
+--- lm_sensors-3.3.4.orig/prog/dump/isadump.c
++++ lm_sensors-3.3.4/prog/dump/isadump.c
+@@ -36,13 +36,7 @@
+ #include "util.h"
+ #include "superio.h"
+
+-
+-/* To keep glibc2 happy */
+-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
+ #include
+-#else
+-#include
+-#endif
+
+ #ifdef __powerpc__
+ unsigned long isa_io_base = 0; /* XXX for now */
+--- lm_sensors-3.3.4.orig/prog/dump/isaset.c
++++ lm_sensors-3.3.4/prog/dump/isaset.c
+@@ -32,13 +32,7 @@
+ #include
+ #include "util.h"
+
+-
+-/* To keep glibc2 happy */
+-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
+ #include
+-#else
+-#include
+-#endif
+
+ #ifdef __powerpc__
+ unsigned long isa_io_base = 0; /* XXX for now */
+--- lm_sensors-3.3.4.orig/prog/dump/superio.c
++++ lm_sensors-3.3.4/prog/dump/superio.c
+@@ -20,12 +20,7 @@
+ */
+
+ #include
+-
+-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
+ #include
+-#else
+-#include
+-#endif
+
+ #include "superio.h"
+
+--- lm_sensors-3.3.4.orig/prog/dump/util.c
++++ lm_sensors-3.3.4/prog/dump/util.c
+@@ -11,12 +11,7 @@
+ #include
+ #include "util.h"
+
+-/* To keep glibc2 happy */
+-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
+ #include
+-#else
+-#include
+-#endif
+
+ /* Return 1 if we should continue, 0 if we should abort */
+ int user_ack(int def)
diff --git a/pkgs/os-specific/linux/lvm2/default.nix b/pkgs/os-specific/linux/lvm2/default.nix
index d6c1504fdf4..bd84e121a7d 100644
--- a/pkgs/os-specific/linux/lvm2/default.nix
+++ b/pkgs/os-specific/linux/lvm2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, systemd, libudev, utillinux, coreutils, libuuid
+{ stdenv, fetchurl, fetchpatch, pkgconfig, systemd, libudev, utillinux, coreutils, libuuid
, thin-provisioning-tools, enable_dmeventd ? false }:
let
@@ -41,6 +41,23 @@ stdenv.mkDerivation {
enableParallelBuilding = true;
#patches = [ ./purity.patch ];
+ patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [
+ (fetchpatch {
+ name = "fix-stdio-usage.patch";
+ url = "https://git.alpinelinux.org/cgit/aports/plain/main/lvm2/fix-stdio-usage.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50";
+ sha256 = "0m6wr6qrvxqi2d2h054cnv974jq1v65lqxy05g1znz946ga73k3p";
+ })
+ (fetchpatch {
+ name = "mallinfo.patch";
+ url = "https://git.alpinelinux.org/cgit/aports/plain/main/lvm2/mallinfo.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50";
+ sha256 = "0g6wlqi215i5s30bnbkn8w7axrs27y3bnygbpbnf64wwx7rxxlj0";
+ })
+ (fetchpatch {
+ name = "mlockall-default-config.patch";
+ url = "https://git.alpinelinux.org/cgit/aports/plain/main/lvm2/mlockall-default-config.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50";
+ sha256 = "1ivbj3sphgf8n1ykfiv5rbw7s8dgnj5jcr9jl2v8cwf28lkacw5l";
+ })
+ ];
# To prevent make install from failing.
preInstall = "installFlags=\"OWNER= GROUP= confdir=$out/etc\"";
diff --git a/pkgs/os-specific/linux/musl/default.nix b/pkgs/os-specific/linux/musl/default.nix
index aaef5315b0f..f74ac9c41ee 100644
--- a/pkgs/os-specific/linux/musl/default.nix
+++ b/pkgs/os-specific/linux/musl/default.nix
@@ -1,11 +1,29 @@
-{ stdenv, fetchurl, fetchpatch }:
+{ 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";
+ sha256 = "16l3dqnfq0f20rzbkhc38v74nqcsh9n3f343bpczqq8b1rz6vfrh";
+ };
+ queue_h = fetchurl {
+ url = "http://git.alpinelinux.org/cgit/aports/plain/main/libc-dev/sys-queue.h";
+ sha256 = "12qm82id7zys92a1qh2l1qf2wqgq6jr4qlbjmqyfffz3s3nhfd61";
+ };
+ tree_h = fetchurl {
+ 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";
};
@@ -23,15 +41,40 @@ stdenv.mkDerivation rec {
"--enable-shared"
"--enable-static"
"CFLAGS=-fstack-protector-strong"
+ # Fix cycle between outputs
+ "--disable-wrapper"
];
+ outputs = [ "out" "dev" ];
+
+ patches = [ ./few-more-uapi-fixes.patch ];
+
dontDisableStatic = true;
+ dontStrip = true;
+
+ postInstall =
+ ''
+ # Not sure why, but link in all but scsi directory as that's what uclibc/glibc do.
+ # Apparently glibc provides scsi itself?
+ (cd $dev/include && ln -s $(ls -d ${linuxHeaders}/include/* | grep -v "scsi$") .)
+ '' +
+ ''
+ mkdir -p $out/bin
+ # Create 'ldd' symlink, builtin
+ ln -s $out/lib/libc.so $out/bin/ldd
+ '' + 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
+ '';
+
+ passthru.linuxHeaders = linuxHeaders;
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 ];
};
}
diff --git a/pkgs/os-specific/linux/musl/few-more-uapi-fixes.patch b/pkgs/os-specific/linux/musl/few-more-uapi-fixes.patch
new file mode 100644
index 00000000000..f84ca2c5aec
--- /dev/null
+++ b/pkgs/os-specific/linux/musl/few-more-uapi-fixes.patch
@@ -0,0 +1,71 @@
+http://www.openwall.com/lists/musl/2018/01/06/3
+
+Date: Sat, 6 Jan 2018 23:32:52 +0100
+From: Hauke Mehrtens
+To: musl@...ts.openwall.com
+Cc: felix.janda@...teo.de,
+ Hauke Mehrtens
+Subject: [PATCH v2] Add additional uapi guards for Linux kernel header files
+
+With Linux kernel 4.16 it will be possible to guard more parts of the
+Linux header files from a libc. Make use of this in musl to guard all
+the structures and other definitions from the Linux header files which
+are also defined by the header files provided by musl. This will make
+musl compile with the unmodified Linux kernel user space headers.
+
+This extends the definitions done in commit 04983f227238 ("make
+netinet/in.h suppress clashing definitions from kernel headers")
+
+The needed patches were recently accepted into the netdev tree and will be integrated in Linux 4.16:
+https://patchwork.ozlabs.org/patch/854342/
+https://patchwork.ozlabs.org/patch/855293/
+---
+ include/net/if.h | 7 +++++++
+ include/netinet/if_ether.h | 1 +
+ include/sys/xattr.h | 2 ++
+ 3 files changed, 10 insertions(+)
+
+diff --git a/include/net/if.h b/include/net/if.h
+index 2f2fcc10..0ee48cd7 100644
+--- a/include/net/if.h
++++ b/include/net/if.h
+@@ -125,6 +125,13 @@ struct ifconf {
+ #define ifc_req ifc_ifcu.ifcu_req
+ #define _IOT_ifconf _IOT(_IOTS(struct ifconf),1,0,0,0,0)
+
++#define __UAPI_DEF_IF_IFCONF 0
++#define __UAPI_DEF_IF_IFMAP 0
++#define __UAPI_DEF_IF_IFNAMSIZ 0
++#define __UAPI_DEF_IF_IFREQ 0
++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
++#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 0
++
+ #endif
+
+ #ifdef __cplusplus
+diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
+index d9a131aa..c2c6e944 100644
+--- a/include/netinet/if_ether.h
++++ b/include/netinet/if_ether.h
+@@ -133,5 +133,6 @@ do { \
+ (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \
+ } while(0)
+
++#define __UAPI_DEF_ETHHDR 0
+
+ #endif
+diff --git a/include/sys/xattr.h b/include/sys/xattr.h
+index 6479fcc6..52e3dd89 100644
+--- a/include/sys/xattr.h
++++ b/include/sys/xattr.h
+@@ -24,6 +24,8 @@ int removexattr(const char *, const char *);
+ int lremovexattr(const char *, const char *);
+ int fremovexattr(int, const char *);
+
++#define __UAPI_DEF_XATTR 0
++
+ #ifdef __cplusplus
+ }
+ #endif
+--
+2.11.0
diff --git a/pkgs/os-specific/linux/musl/fts.nix b/pkgs/os-specific/linux/musl/fts.nix
new file mode 100644
index 00000000000..083541e5e93
--- /dev/null
+++ b/pkgs/os-specific/linux/musl/fts.nix
@@ -0,0 +1,14 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig }:
+
+stdenv.mkDerivation rec {
+ name = "musl-fts-${version}";
+ version = "2017-01-13";
+ src = fetchFromGitHub {
+ owner = "pullmoll";
+ repo = "musl-fts";
+ rev = "0bde52df588e8969879a2cae51c3a4774ec62472";
+ sha256 = "1q8cpzisziysrs08b89wj0rm4p6dsyl177cclpfa0f7spjm3jg03";
+ };
+
+ nativeBuildInputs = [ autoreconfHook pkgconfig ];
+}
diff --git a/pkgs/os-specific/linux/musl/getconf.nix b/pkgs/os-specific/linux/musl/getconf.nix
new file mode 100644
index 00000000000..dbfaca296bf
--- /dev/null
+++ b/pkgs/os-specific/linux/musl/getconf.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+ name = "musl-getconf";
+ src = fetchurl {
+ url = "https://raw.githubusercontent.com/alpinelinux/aports/48b16204aeeda5bc1f87e49c6b8e23d9abb07c73/main/musl/getconf.c";
+ sha256 = "0z14ml5343p5gapxw9fnbn2r72r7v2gk8662iifjrblh6sxhqzfq";
+ };
+
+ unpackPhase = ":";
+
+ buildPhase = ''$CC $src -o getconf'';
+ installPhase = ''
+ mkdir -p $out/bin
+ cp getconf $out/bin/
+ '';
+}
+
+
diff --git a/pkgs/os-specific/linux/musl/getent.nix b/pkgs/os-specific/linux/musl/getent.nix
new file mode 100644
index 00000000000..6eed17a76b0
--- /dev/null
+++ b/pkgs/os-specific/linux/musl/getent.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+ name = "musl-getent";
+ src = fetchurl {
+ url = "https://raw.githubusercontent.com/alpinelinux/aports/89a718d88ec7466e721f3bbe9ede5ffe58061d78/main/musl/getent.c";
+ sha256 = "0b4jqnsmv1hjgcz7db3vd61k682aphl59c3yhwya2q7mkc6g48xk";
+ };
+
+ unpackPhase = ":";
+
+ buildPhase = ''$CC $src -o getent'';
+ installPhase = ''
+ mkdir -p $out/bin
+ cp getent $out/bin/
+ '';
+}
+
diff --git a/pkgs/os-specific/linux/numactl/default.nix b/pkgs/os-specific/linux/numactl/default.nix
index a5ed242e323..9928897ae4d 100644
--- a/pkgs/os-specific/linux/numactl/default.nix
+++ b/pkgs/os-specific/linux/numactl/default.nix
@@ -1,15 +1,28 @@
-{ stdenv, fetchurl, autoreconfHook }:
+{ stdenv, fetchFromGitHub, fetchpatch, autoreconfHook }:
stdenv.mkDerivation rec {
- name = "numactl-2.0.10";
+ name = "numactl-${version}";
+ version = "2.0.11";
- src = fetchurl {
- url = "ftp://oss.sgi.com/www/projects/libnuma/download/${name}.tar.gz";
- sha256 = "0qfv2ks6d3gm0mw5sj4cbhsd7cbsb7qm58xvchl2wfzifkzcinnv";
+ src = fetchFromGitHub {
+ owner = "numactl";
+ repo = "numactl";
+ rev = "v${version}";
+ sha256 = "0bcffqawwbyrnza8np0whii25mfd0dria35zal9v3l55xcrya3j9";
};
nativeBuildInputs = [ autoreconfHook ];
+ patches = [
+ (fetchpatch {
+ url = https://raw.githubusercontent.com/gentoo/gentoo/b64d15e731e3d6a7671f0ec6c34a20203cf2609d/sys-process/numactl/files/numactl-2.0.11-sysmacros.patch;
+ sha256 = "05277kv3x12n2xlh3fgnmxclxfc384mkwb0v9pd91046khj6h843";
+ })
+ ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
+ url = https://git.alpinelinux.org/cgit/aports/plain/testing/numactl/musl.patch?id=0592b128c71c3e70d493bc7a13caed0d7fae91dd;
+ sha256 = "080b0sygmg7104qbbh1amh3b322yyiajwi2d3d0vayffgva0720v";
+ });
+
meta = with stdenv.lib; {
description = "Library and tools for non-uniform memory access (NUMA) machines";
homepage = http://oss.sgi.com/projects/libnuma/;
diff --git a/pkgs/os-specific/linux/pam/default.nix b/pkgs/os-specific/linux/pam/default.nix
index 3de7916bff6..5f92dfcc839 100644
--- a/pkgs/os-specific/linux/pam/default.nix
+++ b/pkgs/os-specific/linux/pam/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, flex, cracklib }:
+{ stdenv, buildPackages, hostPlatform, fetchurl, fetchpatch, flex, cracklib }:
stdenv.mkDerivation rec {
name = "linux-pam-${version}";
@@ -9,8 +9,24 @@ stdenv.mkDerivation rec {
sha256 = "1fyi04d5nsh8ivd0rn2y0z83ylgc0licz7kifbb6xxi2ylgfs6i4";
};
+ patches = stdenv.lib.optionals (hostPlatform.libc == "musl") [
+ (fetchpatch {
+ url = "https://git.alpinelinux.org/cgit/aports/plain/main/linux-pam/fix-compat.patch?id=05a62bda8ec255d7049a2bd4cf0fdc4b32bdb2cc";
+ sha256 = "1h5yp5h2mqp1fcwiwwklyfpa69a3i03ya32pivs60fd7g5bqa7sf";
+ })
+ (fetchpatch {
+ url = "https://git.alpinelinux.org/cgit/aports/plain/main/linux-pam/libpam-fix-build-with-eglibc-2.16.patch?id=05a62bda8ec255d7049a2bd4cf0fdc4b32bdb2cc";
+ sha256 = "1ib6shhvgzinjsc603k2x1lxh9dic6qq449fnk110gc359m23j81";
+ })
+ (fetchpatch {
+ url = "https://git.alpinelinux.org/cgit/aports/plain/main/linux-pam/musl-fix-pam_exec.patch?id=05a62bda8ec255d7049a2bd4cf0fdc4b32bdb2cc";
+ sha256 = "04dx6s9d8cxl40r7m7dc4si47ds4niaqm7902y1d6wcjvs11vrf0";
+ })
+ ];
+
outputs = [ "out" "doc" "man" /* "modules" */ ];
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ flex ];
buildInputs = [ cracklib ];
@@ -20,7 +36,7 @@ stdenv.mkDerivation rec {
crossAttrs = {
propagatedBuildInputs = [ flex.crossDrv cracklib.crossDrv ];
preConfigure = preConfigure + ''
- ar x ${flex.crossDrv}/lib/libfl.a
+ $crossConfig-ar x ${flex.crossDrv}/lib/libfl.a
mv libyywrap.o libyywrap-target.o
ar x ${flex}/lib/libfl.a
mv libyywrap.o libyywrap-host.o
@@ -46,6 +62,12 @@ stdenv.mkDerivation rec {
preConfigure = ''
configureFlags="$configureFlags --includedir=$out/include/security"
+ '' + stdenv.lib.optionalString (hostPlatform.libc == "musl") ''
+ # export ac_cv_search_crypt=no
+ # (taken from Alpine linux, apparently insecure but also doesn't build O:))
+ # disable insecure modules
+ # sed -e 's/pam_rhosts//g' -i modules/Makefile.am
+ sed -e 's/pam_rhosts//g' -i modules/Makefile.in
'';
meta = {
diff --git a/pkgs/os-specific/linux/shadow/default.nix b/pkgs/os-specific/linux/shadow/default.nix
index 64d7a694fc1..8875d7ec4b3 100644
--- a/pkgs/os-specific/linux/shadow/default.nix
+++ b/pkgs/os-specific/linux/shadow/default.nix
@@ -9,7 +9,7 @@ let
glibc =
if hostPlatform != buildPlatform
then glibcCross
- else assert stdenv ? glibc; stdenv.glibc;
+ else assert hostPlatform.libc == "glibc"; stdenv.cc.libc;
dots_in_usernames = fetchpatch {
url = http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/shadow/files/shadow-4.1.3-dots-in-usernames.patch;
@@ -60,9 +60,10 @@ stdenv.mkDerivation rec {
configureFlags="$configureFlags --with-xml-catalog=$PWD/xmlcatalog ";
'';
- configureFlags = " --enable-man ";
+ configureFlags = " --enable-man "
+ + stdenv.lib.optionalString (hostPlatform.libc != "glibc") " --disable-nscd ";
- preBuild = assert glibc != null;
+ preBuild = stdenv.lib.optionalString (hostPlatform.libc == "glibc")
''
substituteInPlace lib/nscd.c --replace /usr/sbin/nscd ${glibc.bin}/bin/nscd
'';
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index aeda85584e7..9085b1703c0 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -1,194 +1,225 @@
{ stdenv, fetchFromGitHub, fetchpatch, pkgconfig, intltool, gperf, libcap, kmod
, zlib, xz, pam, acl, cryptsetup, libuuid, m4, utillinux, libffi
-, glib, kbd, libxslt, coreutils, libgcrypt, libgpgerror, libapparmor, audit, lz4
-, kexectools, libmicrohttpd, linuxHeaders ? stdenv.cc.libc.linuxHeaders, libseccomp
-, iptables, gnu-efi
+, glib, kbd, libxslt, coreutils, libgcrypt, libgpgerror, libidn2, libapparmor
+, audit, lz4, bzip2, kexectools, libmicrohttpd
+, linuxHeaders ? stdenv.cc.libc.linuxHeaders
+, libseccomp, iptables, gnu-efi
, autoreconfHook, gettext, docbook_xsl, docbook_xml_dtd_42, docbook_xml_dtd_45
+, ninja, meson, python3Packages, glibcLocales
+, patchelf
+, getent
}:
assert stdenv.isLinux;
-stdenv.mkDerivation rec {
- version = "234";
- name = "systemd-${version}";
+let
+ pythonLxmlEnv = python3Packages.python.withPackages ( ps: with ps; [ python3Packages.lxml ]);
- src = fetchFromGitHub {
- owner = "nixos";
- repo = "systemd";
- rev = "eef5613fda5";
- sha256 = "0wgh5y319v56hcs82mhs58ipb100cz4x41vz3kh4bq1n7sx88cdz";
- };
+in
- outputs = [ "out" "lib" "man" "dev" ];
+ stdenv.mkDerivation rec {
+ version = "237";
+ name = "systemd-${version}";
- nativeBuildInputs =
- [ pkgconfig intltool gperf libxslt
- /* FIXME: we may be able to prevent the following dependencies
- by generating an autoconf'd tarball, but that's probably not
- worth it. */
- autoreconfHook gettext docbook_xsl docbook_xml_dtd_42 docbook_xml_dtd_45
- ];
- buildInputs =
- [ linuxHeaders libcap kmod xz pam acl
- /* cryptsetup */ libuuid m4 glib libgcrypt libgpgerror
- libmicrohttpd kexectools libseccomp libffi audit lz4 libapparmor
- iptables gnu-efi
- ];
+ src = fetchFromGitHub {
+ owner = "NixOS";
+ repo = "systemd";
+ rev = "1e8830dfa77a7dc6976509f4a6edb7e012c50792";
+ sha256 = "1cw1k0i68azmzpqzi3r8jm6mbi2wqlql78fhcg0vvnv1ly8bf7vq";
+ };
- configureFlags =
- [ "--localstatedir=/var"
- "--sysconfdir=/etc"
- "--with-rootprefix=$(out)"
- "--with-kbd-loadkeys=${kbd}/bin/loadkeys"
- "--with-kbd-setfont=${kbd}/bin/setfont"
- "--with-rootprefix=$(out)"
- "--with-dbuspolicydir=$(out)/etc/dbus-1/system.d"
- "--with-dbussystemservicedir=$(out)/share/dbus-1/system-services"
- "--with-dbussessionservicedir=$(out)/share/dbus-1/services"
- "--with-tty-gid=3" # tty in NixOS has gid 3
- "--disable-tests"
+ outputs = [ "out" "lib" "man" "dev" ];
- "--enable-lz4"
- "--enable-hostnamed"
- "--enable-networkd"
- "--disable-sysusers"
- "--enable-timedated"
- "--enable-timesyncd"
- "--disable-firstboot"
- "--enable-localed"
- "--enable-resolved"
- "--disable-split-usr"
- "--disable-libcurl"
- "--disable-libidn"
- "--disable-quotacheck"
- "--disable-ldconfig"
- "--disable-smack"
+ nativeBuildInputs =
+ [ pkgconfig intltool gperf libxslt gettext docbook_xsl docbook_xml_dtd_42 docbook_xml_dtd_45
+ ninja meson
+ coreutils # meson calls date, stat etc.
+ pythonLxmlEnv glibcLocales
+ patchelf getent
+ ];
+ buildInputs =
+ [ linuxHeaders libcap kmod xz pam acl
+ /* cryptsetup */ libuuid m4 glib libgcrypt libgpgerror libidn2
+ libmicrohttpd kexectools libseccomp libffi audit lz4 bzip2 libapparmor
+ iptables gnu-efi
+ ];
- (if stdenv.isArm then "--disable-gnuefi" else "--enable-gnuefi")
- "--with-efi-libdir=${gnu-efi}/lib"
- "--with-efi-includedir=${gnu-efi}/include"
- "--with-efi-ldsdir=${gnu-efi}/lib"
+ #dontAddPrefix = true;
- "--with-sysvinit-path="
- "--with-sysvrcnd-path="
- "--with-rc-local-script-path-stop=/etc/halt.local"
- ];
+ mesonFlags = [
+ "-Dloadkeys-path=${kbd}/bin/loadkeys"
+ "-Dsetfont-path=${kbd}/bin/setfont"
+ "-Dtty-gid=3" # tty in NixOS has gid 3
+ # "-Dtests=" # TODO
+ "-Dlz4=true"
+ "-Dhostnamed=true"
+ "-Dnetworkd=true"
+ "-Dsysusers=false"
+ "-Dtimedated=true"
+ "-Dtimesyncd=true"
+ "-Dfirstboot=false"
+ "-Dlocaled=true"
+ "-Dresolve=true"
+ "-Dsplit-usr=false"
+ "-Dlibcurl=false"
+ "-Dlibidn=false"
+ "-Dlibidn2=true"
+ "-Dquotacheck=false"
+ "-Dldconfig=false"
+ "-Dsmack=true"
+ "-Dsystem-uid-max=499" #TODO: debug why awking around in /etc/login.defs doesn't work
+ "-Dsystem-gid-max=499"
+ # "-Dtime-epoch=1"
- hardeningDisable = [ "stackprotector" ];
+ (if stdenv.isArm then "-Dgnu-efi=false" else "-Dgnu-efi=true")
+ "-Defi-libdir=${gnu-efi}/lib"
+ "-Defi-includedir=${gnu-efi}/include/efi"
+ "-Defi-ldsdir=${gnu-efi}/lib"
- patches = [
- # TODO: Remove this patch when we have a systemd version
- # with https://github.com/systemd/systemd/pull/6678
- (fetchpatch {
- url = "https://github.com/systemd/systemd/commit/58a78ae77063eddfcd23ea272bd2e0ddc9ea3ff7.patch";
- sha256 = "0g3pvqigs69mciw6lj3zg12dmxnhwxndwxdjg78af52xrp0djfg8";
- })
- ];
+ "-Dsysvinit-path="
+ "-Dsysvrcnd-path="
+ ];
- preConfigure =
- ''
- unset RANLIB
+ preConfigure =
+ ''
+ mesonFlagsArray+=(-Dntp-servers="0.nixos.pool.ntp.org 1.nixos.pool.ntp.org 2.nixos.pool.ntp.org 3.nixos.pool.ntp.org")
+ mesonFlagsArray+=(-Ddbuspolicydir=$out/etc/dbus-1/system.d)
+ mesonFlagsArray+=(-Ddbussessionservicedir=$out/share/dbus-1/services)
+ mesonFlagsArray+=(-Ddbussystemservicedir=$out/share/dbus-1/system-services)
+ mesonFlagsArray+=(-Dpamconfdir=$out/etc/pam.d)
+ mesonFlagsArray+=(-Dsysconfdir=$out/etc)
+ mesonFlagsArray+=(-Drootprefix=$out)
+ mesonFlagsArray+=(-Dlibdir=$lib/lib)
+ mesonFlagsArray+=(-Drootlibdir=$lib/lib)
+ mesonFlagsArray+=(-Dmandir=$man/lib)
+ mesonFlagsArray+=(-Dincludedir=$dev/include)
+ mesonFlagsArray+=(-Dpkgconfiglibdir=$dev/lib/pkgconfig)
+ mesonFlagsArray+=(-Dpkgconfigdatadir=$dev/share/pkgconfig)
- ./autogen.sh
+ # FIXME: Why aren't includedir and libdir picked up from mesonFlags while other options are?
+ substituteInPlace meson.build \
+ --replace "includedir = join_paths(prefixdir, get_option('includedir'))" \
+ "includedir = '$dev/include'" \
+ --replace "libdir = join_paths(prefixdir, get_option('libdir'))" \
+ "libdir = '$lib/lib'"
- # FIXME: patch this in systemd properly (and send upstream).
- for i in src/remount-fs/remount-fs.c src/core/mount.c src/core/swap.c src/fsck/fsck.c units/emergency.service.in units/rescue.service.in src/journal/cat.c src/core/shutdown.c src/nspawn/nspawn.c src/shared/generator.c; do
- test -e $i
- substituteInPlace $i \
- --replace /usr/bin/getent ${stdenv.glibc.bin}/bin/getent \
- --replace /bin/mount ${utillinux.bin}/bin/mount \
- --replace /bin/umount ${utillinux.bin}/bin/umount \
- --replace /sbin/swapon ${utillinux.bin}/sbin/swapon \
- --replace /sbin/swapoff ${utillinux.bin}/sbin/swapoff \
- --replace /sbin/fsck ${utillinux.bin}/sbin/fsck \
- --replace /bin/echo ${coreutils}/bin/echo \
- --replace /bin/cat ${coreutils}/bin/cat \
- --replace /sbin/sulogin ${utillinux.bin}/sbin/sulogin \
- --replace /usr/lib/systemd/systemd-fsck $out/lib/systemd/systemd-fsck \
- --replace /bin/plymouth /run/current-system/sw/bin/plymouth # To avoid dependency
- done
+ export LC_ALL="en_US.UTF-8";
+ # FIXME: patch this in systemd properly (and send upstream).
+ # already fixed in f00929ad622c978f8ad83590a15a765b4beecac9: (u)mount
+ for i in src/remount-fs/remount-fs.c src/core/mount.c src/core/swap.c src/fsck/fsck.c units/emergency.service.in units/rescue.service.in src/journal/cat.c src/core/shutdown.c src/nspawn/nspawn.c src/shared/generator.c; do
+ test -e $i
+ substituteInPlace $i \
+ --replace /usr/bin/getent ${getent}/bin/getent \
+ --replace /sbin/swapon ${utillinux.bin}/sbin/swapon \
+ --replace /sbin/swapoff ${utillinux.bin}/sbin/swapoff \
+ --replace /sbin/fsck ${utillinux.bin}/sbin/fsck \
+ --replace /bin/echo ${coreutils}/bin/echo \
+ --replace /bin/cat ${coreutils}/bin/cat \
+ --replace /sbin/sulogin ${utillinux.bin}/sbin/sulogin \
+ --replace /usr/lib/systemd/systemd-fsck $out/lib/systemd/systemd-fsck \
+ --replace /bin/plymouth /run/current-system/sw/bin/plymouth # To avoid dependency
+ done
- substituteInPlace src/journal/catalog.c \
- --replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/
+ for i in tools/xml_helper.py tools/make-directive-index.py tools/make-man-index.py test/sys-script.py; do
+ substituteInPlace $i \
+ --replace "#!/usr/bin/env python" "#!${pythonLxmlEnv}/bin/python"
+ done
- configureFlagsArray+=("--with-ntp-servers=0.nixos.pool.ntp.org 1.nixos.pool.ntp.org 2.nixos.pool.ntp.org 3.nixos.pool.ntp.org")
+ for i in src/basic/generate-gperfs.py src/resolve/generate-dns_type-gperf.py src/test/generate-sym-test.py ; do
+ substituteInPlace $i \
+ --replace "#!/usr/bin/env python" "#!${python3Packages.python}/bin/python"
+ done
+
+ substituteInPlace src/journal/catalog.c \
+ --replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/
+ '';
+
+ # These defines are overridden by CFLAGS and would trigger annoying
+ # warning messages
+ postConfigure = ''
+ substituteInPlace config.h \
+ --replace "POLKIT_AGENT_BINARY_PATH" "_POLKIT_AGENT_BINARY_PATH" \
+ --replace "SYSTEMD_BINARY_PATH" "_SYSTEMD_BINARY_PATH" \
+ --replace "SYSTEMD_CGROUP_AGENT_PATH" "_SYSTEMD_CGROUP_AGENT_PATH"
'';
- PYTHON_BINARY = "${coreutils}/bin/env python"; # don't want a build time dependency on Python
+ hardeningDisable = [ "stackprotector" ];
- NIX_CFLAGS_COMPILE =
- [ # Can't say ${polkit.bin}/bin/pkttyagent here because that would
- # lead to a cyclic dependency.
- "-UPOLKIT_AGENT_BINARY_PATH" "-DPOLKIT_AGENT_BINARY_PATH=\"/run/current-system/sw/bin/pkttyagent\""
- "-fno-stack-protector"
+ NIX_CFLAGS_COMPILE =
+ [ # Can't say ${polkit.bin}/bin/pkttyagent here because that would
+ # lead to a cyclic dependency.
+ "-UPOLKIT_AGENT_BINARY_PATH" "-DPOLKIT_AGENT_BINARY_PATH=\"/run/current-system/sw/bin/pkttyagent\""
- # Set the release_agent on /sys/fs/cgroup/systemd to the
- # currently running systemd (/run/current-system/systemd) so
- # that we don't use an obsolete/garbage-collected release agent.
- "-USYSTEMD_CGROUP_AGENT_PATH" "-DSYSTEMD_CGROUP_AGENT_PATH=\"/run/current-system/systemd/lib/systemd/systemd-cgroups-agent\""
+ # Set the release_agent on /sys/fs/cgroup/systemd to the
+ # currently running systemd (/run/current-system/systemd) so
+ # that we don't use an obsolete/garbage-collected release agent.
+ "-USYSTEMD_CGROUP_AGENT_PATH" "-DSYSTEMD_CGROUP_AGENT_PATH=\"/run/current-system/systemd/lib/systemd/systemd-cgroups-agent\""
- "-USYSTEMD_BINARY_PATH" "-DSYSTEMD_BINARY_PATH=\"/run/current-system/systemd/lib/systemd/systemd\""
- ];
+ "-USYSTEMD_BINARY_PATH" "-DSYSTEMD_BINARY_PATH=\"/run/current-system/systemd/lib/systemd/systemd\""
+ ];
- installFlags =
- [ "localstatedir=$(TMPDIR)/var"
- "sysconfdir=$(out)/etc"
- "sysvinitdir=$(TMPDIR)/etc/init.d"
- "pamconfdir=$(out)/etc/pam.d"
- ];
+ postInstall =
+ ''
+ # sysinit.target: Don't depend on
+ # systemd-tmpfiles-setup.service. This interferes with NixOps's
+ # send-keys feature (since sshd.service depends indirectly on
+ # sysinit.target).
+ mv $out/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service $out/lib/systemd/system/multi-user.target.wants/
- postInstall =
- ''
- # sysinit.target: Don't depend on
- # systemd-tmpfiles-setup.service. This interferes with NixOps's
- # send-keys feature (since sshd.service depends indirectly on
- # sysinit.target).
- mv $out/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service $out/lib/systemd/system/multi-user.target.wants/
+ mkdir -p $out/example/systemd
+ mv $out/lib/{modules-load.d,binfmt.d,sysctl.d,tmpfiles.d} $out/example
+ mv $out/lib/systemd/{system,user} $out/example/systemd
- mkdir -p $out/example/systemd
- mv $out/lib/{modules-load.d,binfmt.d,sysctl.d,tmpfiles.d} $out/example
- mv $out/lib/systemd/{system,user} $out/example/systemd
+ rm -rf $out/etc/systemd/system
- rm -rf $out/etc/systemd/system
+ # Install SysV compatibility commands.
+ mkdir -p $out/sbin
+ ln -s $out/lib/systemd/systemd $out/sbin/telinit
+ for i in init halt poweroff runlevel reboot shutdown; do
+ ln -s $out/bin/systemctl $out/sbin/$i
+ done
- # Install SysV compatibility commands.
- mkdir -p $out/sbin
- ln -s $out/lib/systemd/systemd $out/sbin/telinit
- for i in init halt poweroff runlevel reboot shutdown; do
- ln -s $out/bin/systemctl $out/sbin/$i
+ # Fix reference to /bin/false in the D-Bus services.
+ for i in $out/share/dbus-1/system-services/*.service; do
+ substituteInPlace $i --replace /bin/false ${coreutils}/bin/false
+ done
+
+ rm -rf $out/etc/rpm
+
+ # "kernel-install" shouldn't be used on NixOS.
+ find $out -name "*kernel-install*" -exec rm {} \;
+
+ # Keep only libudev and libsystemd in the lib output.
+ mkdir -p $out/lib
+ mv $lib/lib/security $lib/lib/libnss* $out/lib/
+ ''; # */
+
+ enableParallelBuilding = true;
+
+ # The rpath to the shared systemd library is not added by meson. The
+ # functionality was removed by a nixpkgs patch because it would overwrite
+ # the existing rpath.
+ postFixup = ''
+ sharedLib=libsystemd-shared-${version}.so
+ for prog in `find $out -type f -executable`; do
+ (patchelf --print-needed $prog | grep $sharedLib > /dev/null) && (
+ patchelf --set-rpath `patchelf --print-rpath $prog`:"$out/lib/systemd" $prog
+ ) || true
done
+ '';
- # Fix reference to /bin/false in the D-Bus services.
- for i in $out/share/dbus-1/system-services/*.service; do
- substituteInPlace $i --replace /bin/false ${coreutils}/bin/false
- done
+ # The interface version prevents NixOS from switching to an
+ # incompatible systemd at runtime. (Switching across reboots is
+ # fine, of course.) It should be increased whenever systemd changes
+ # in a backwards-incompatible way. If the interface version of two
+ # systemd builds is the same, then we can switch between them at
+ # runtime; otherwise we can't and we need to reboot.
+ passthru.interfaceVersion = 2;
- rm -rf $out/etc/rpm
-
- rm $lib/lib/*.la
-
- # "kernel-install" shouldn't be used on NixOS.
- find $out -name "*kernel-install*" -exec rm {} \;
-
- # Keep only libudev and libsystemd in the lib output.
- mkdir -p $out/lib
- mv $lib/lib/security $lib/lib/libnss* $out/lib/
- ''; # */
-
- enableParallelBuilding = true;
-
- # The interface version prevents NixOS from switching to an
- # incompatible systemd at runtime. (Switching across reboots is
- # fine, of course.) It should be increased whenever systemd changes
- # in a backwards-incompatible way. If the interface version of two
- # systemd builds is the same, then we can switch between them at
- # runtime; otherwise we can't and we need to reboot.
- passthru.interfaceVersion = 2;
-
- meta = {
- homepage = http://www.freedesktop.org/wiki/Software/systemd;
- description = "A system and service manager for Linux";
- platforms = stdenv.lib.platforms.linux;
- maintainers = [ stdenv.lib.maintainers.eelco ];
- };
+ meta = {
+ homepage = http://www.freedesktop.org/wiki/Software/systemd;
+ description = "A system and service manager for Linux";
+ platforms = stdenv.lib.platforms.linux;
+ maintainers = [ stdenv.lib.maintainers.eelco ];
+ };
}
diff --git a/pkgs/servers/monitoring/net-snmp/default.nix b/pkgs/servers/monitoring/net-snmp/default.nix
index 1d0b5fb8336..77dcfa43c43 100644
--- a/pkgs/servers/monitoring/net-snmp/default.nix
+++ b/pkgs/servers/monitoring/net-snmp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook, file, openssl, perl, unzip }:
+{ stdenv, fetchurl, fetchpatch, autoreconfHook, file, openssl, perl, unzip }:
stdenv.mkDerivation rec {
name = "net-snmp-5.7.3";
@@ -8,6 +8,19 @@ stdenv.mkDerivation rec {
sha256 = "0gkss3zclm23zwpqfhddca8278id7pk6qx1mydpimdrrcndwgpz8";
};
+ patches =
+ let fetchAlpinePatch = name: sha256: fetchpatch {
+ url = "https://git.alpinelinux.org/cgit/aports/plain/main/net-snmp/${name}?id=f25d3fb08341b60b6ccef424399f060dfcf3f1a5";
+ inherit name sha256;
+ };
+ in [
+ (fetchAlpinePatch "CVE-2015-5621.patch" "05098jyvd9ddr5q26z7scbbvk1bk6x4agpjm6pyprvpc1zpi0y09")
+ (fetchAlpinePatch "fix-Makefile-PL.patch" "14ilnkj3cr6mpi242hrmmmv8nv4dj0fdgn42qfk9aa7scwsc0lc7")
+ (fetchAlpinePatch "fix-includes.patch" "0zpkbb6k366qpq4dax5wknwprhwnhighcp402mlm7950d39zfa3m")
+ (fetchAlpinePatch "netsnmp-swinst-crash.patch" "0gh164wy6zfiwiszh58fsvr25k0ns14r3099664qykgpmickkqid")
+ (fetchAlpinePatch "remove-U64-typedef.patch" "1msxyhcqkvhqa03dwb50288g7f6nbrcd9cs036m9xc8jdgjb8k8j")
+ ];
+
preConfigure =
''
perlversion=$(perl -e 'use Config; print $Config{version};')
diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix
index 85ee3ddcf74..2f102b58f14 100644
--- a/pkgs/servers/pulseaudio/default.nix
+++ b/pkgs/servers/pulseaudio/default.nix
@@ -43,7 +43,12 @@ stdenv.mkDerivation rec {
sha256 = "0sf92knqkvqmfhrbz4vlsagzqlps72wycpmln5dygicg07a0a8q7";
};
- patches = [ ./caps-fix.patch ];
+ patches = [ ./caps-fix.patch ]
+ ++ stdenv.lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
+ name = "padsp-fix.patch";
+ url = "https://git.alpinelinux.org/cgit/aports/plain/testing/pulseaudio/0001-padsp-Make-it-compile-on-musl.patch?id=167be02bf4618a90328e2b234f6a63a5dc05f244";
+ sha256 = "0gf4w25zi123ghk0njapysvrlljkc3hyanacgiswfnnm1i8sab1q";
+ });
outputs = [ "out" "dev" ];
diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix
index 88d2ae3d68a..b8ee85d65e7 100644
--- a/pkgs/servers/sql/mariadb/default.nix
+++ b/pkgs/servers/sql/mariadb/default.nix
@@ -62,6 +62,7 @@ common = rec { # attributes common to both builds
"-DPLUGIN_AUTH_GSSAPI_CLIENT=NO"
]
++ optional stdenv.isDarwin "-DCURSES_LIBRARY=${ncurses.out}/lib/libncurses.dylib"
+ ++ optional stdenv.hostPlatform.isMusl "-DWITHOUT_TOKUDB=1" # mariadb docs say disable this for musl
;
preConfigure = ''
diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix
index 1a721e90a8d..02a620cee53 100644
--- a/pkgs/servers/sql/postgresql/default.nix
+++ b/pkgs/servers/sql/postgresql/default.nix
@@ -69,7 +69,7 @@ let
fi
'';
- postFixup = lib.optionalString (!stdenv.isDarwin)
+ postFixup = lib.optionalString (!stdenv.isDarwin && stdenv.hostPlatform.libc == "glibc")
''
# initdb needs access to "locale" command from glibc.
wrapProgram $out/bin/initdb --prefix PATH ":" ${glibc.bin}/bin
diff --git a/pkgs/servers/squid/4.nix b/pkgs/servers/squid/4.nix
index 4a4502a6939..777e910038a 100644
--- a/pkgs/servers/squid/4.nix
+++ b/pkgs/servers/squid/4.nix
@@ -27,9 +27,7 @@ stdenv.mkDerivation rec {
"--enable-removal-policies=lru,heap"
"--enable-delay-pools"
"--enable-x-accelerator-vary"
- ] ++ stdenv.lib.optionals stdenv.isLinux [
- "--enable-linux-netfilter"
- ];
+ ] ++ stdenv.lib.optional (stdenv.isLinux && !stdenv.hostPlatform.isMusl) "--enable-linux-netfilter";
meta = with stdenv.lib; {
description = "A caching proxy for the Web supporting HTTP, HTTPS, FTP, and more";
diff --git a/pkgs/servers/squid/default.nix b/pkgs/servers/squid/default.nix
index 95f4233df10..8d39fbbcef4 100644
--- a/pkgs/servers/squid/default.nix
+++ b/pkgs/servers/squid/default.nix
@@ -36,9 +36,7 @@ stdenv.mkDerivation rec {
"--enable-removal-policies=lru,heap"
"--enable-delay-pools"
"--enable-x-accelerator-vary"
- ] ++ stdenv.lib.optionals stdenv.isLinux [
- "--enable-linux-netfilter"
- ];
+ ] ++ stdenv.lib.optional (stdenv.isLinux && !stdenv.hostPlatform.isMusl) "--enable-linux-netfilter";
meta = with stdenv.lib; {
description = "A caching proxy for the Web supporting HTTP, HTTPS, FTP, and more";
diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix
index f56d22d7b7e..c6466598195 100644
--- a/pkgs/servers/x11/xorg/overrides.nix
+++ b/pkgs/servers/x11/xorg/overrides.nix
@@ -493,6 +493,9 @@ in
args.udev
];
patches = commonPatches;
+ prePatch = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+ export CFLAGS+=" -D__uid_t=uid_t -D__gid_t=gid_t"
+ '';
configureFlags = [
"--enable-kdrive" # not built by default
"--enable-xephyr"
diff --git a/pkgs/shells/bash/4.4.nix b/pkgs/shells/bash/4.4.nix
index 5635c6a73be..63c7fbc7a0e 100644
--- a/pkgs/shells/bash/4.4.nix
+++ b/pkgs/shells/bash/4.4.nix
@@ -1,5 +1,5 @@
{ stdenv, buildPackages
-, fetchurl, readline70 ? null, texinfo ? null, binutils ? null, bison
+, fetchurl, readline70 ? null, texinfo ? null, binutils ? null, bison, autoconf
, buildPlatform, hostPlatform
, interactive ? false
}:
@@ -51,7 +51,12 @@ stdenv.mkDerivation rec {
patchFlags = "-p0";
- patches = upstreamPatches;
+ patches = upstreamPatches
+ # https://lists.gnu.org/archive/html/bug-bash/2016-10/msg00006.html
+ ++ optional (hostPlatform.libc == "musl") (fetchurl {
+ url = "https://lists.gnu.org/archive/html/bug-bash/2016-10/patchJxugOXrY2y.patch";
+ sha256 = "1m4v9imidb1cc1h91f2na0b8y9kc5c5fgmpvy9apcyv2kbdcghg1";
+ });
postPatch = optionalString hostPlatform.isCygwin "patch -p2 < ${./cygwin-bash-4.4.11-2.src.patch}";
@@ -65,13 +70,17 @@ stdenv.mkDerivation rec {
"bash_cv_dev_stdin=present"
"bash_cv_dev_fd=standard"
"bash_cv_termcap_lib=libncurses"
+ ] ++ optionals (hostPlatform.libc == "musl") [
+ "--without-bash-malloc"
+ "--disable-nls"
];
# Note: Bison is needed because the patches above modify parse.y.
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [bison]
++ optional (texinfo != null) texinfo
- ++ optional hostPlatform.isDarwin binutils;
+ ++ optional hostPlatform.isDarwin binutils
+ ++ optional (hostPlatform.libc == "musl") autoconf;
buildInputs = optional interactive readline70;
@@ -86,7 +95,7 @@ stdenv.mkDerivation rec {
postInstall = ''
ln -s bash "$out/bin/sh"
- rm $out/lib/bash/Makefile.inc
+ rm -f $out/lib/bash/Makefile.inc
'';
postFixup = if interactive
@@ -96,7 +105,7 @@ stdenv.mkDerivation rec {
''
# most space is taken by locale data
else ''
- rm -r "$out/share" "$out/bin/bashbug"
+ rm -rf "$out/share" "$out/bin/bashbug"
'';
meta = with stdenv.lib; {
diff --git a/pkgs/shells/fish/default.nix b/pkgs/shells/fish/default.nix
index 490832d31d8..d6c107e9953 100644
--- a/pkgs/shells/fish/default.nix
+++ b/pkgs/shells/fish/default.nix
@@ -1,6 +1,6 @@
{ stdenv, fetchurl, coreutils, utillinux,
nettools, kbd, bc, which, gnused, gnugrep,
- groff, man-db, glibc, libiconv, pcre2,
+ groff, man-db, getent, libiconv, pcre2,
gettext, ncurses, python3
, writeText
@@ -142,7 +142,7 @@ let
sed -e "s| ul| ${utillinux}/bin/ul|" \
-i "$out/share/fish/functions/__fish_print_help.fish"
for cur in $out/share/fish/functions/*.fish; do
- sed -e "s|/usr/bin/getent|${glibc.bin}/bin/getent|" \
+ sed -e "s|/usr/bin/getent|${getent}/bin/getent|" \
-i "$cur"
done
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix
index f7d2c49a66d..3090b6283e9 100644
--- a/pkgs/stdenv/adapters.nix
+++ b/pkgs/stdenv/adapters.nix
@@ -94,7 +94,7 @@ rec {
# without proper `file` command, libtool sometimes fails
# to recognize 64-bit DLLs
++ stdenv.lib.optional (hostPlatform.config == "x86_64-w64-mingw32") pkgs.file
- ++ stdenv.lib.optional hostPlatform.isAarch64 pkgs.updateAutotoolsGnuConfigScriptsHook
+ ++ stdenv.lib.optional (hostPlatform.isAarch64 || hostPlatform.libc == "musl") pkgs.updateAutotoolsGnuConfigScriptsHook
;
crossConfig = hostPlatform.config;
diff --git a/pkgs/stdenv/linux/bootstrap-files/aarch64-musl.nix b/pkgs/stdenv/linux/bootstrap-files/aarch64-musl.nix
new file mode 100644
index 00000000000..ff0eec893f2
--- /dev/null
+++ b/pkgs/stdenv/linux/bootstrap-files/aarch64-musl.nix
@@ -0,0 +1,11 @@
+{
+ busybox = import {
+ url = https://wdtz.org/files/wjzsj9cmdkc70f78yh072483x8656nci-stdenv-bootstrap-tools-aarch64-unknown-linux-musl/on-server/busybox;
+ sha256 = "01s6bwq84wyrjh3rdsgxni9gkzp7ss8rghg0cmp8zd87l79y8y4g";
+ executable = true;
+ };
+ bootstrapTools = import {
+ url = https://wdtz.org/files/wjzsj9cmdkc70f78yh072483x8656nci-stdenv-bootstrap-tools-aarch64-unknown-linux-musl/on-server/bootstrap-tools.tar.xz;
+ sha256 = "0pbqrw9z4ifkijpfpx15l2dzi00rq8c5zg9ghimz5qgr5dx7f7cl";
+ };
+}
diff --git a/pkgs/stdenv/linux/bootstrap-files/armv6l-musl.nix b/pkgs/stdenv/linux/bootstrap-files/armv6l-musl.nix
new file mode 100644
index 00000000000..45ac0d5f9ac
--- /dev/null
+++ b/pkgs/stdenv/linux/bootstrap-files/armv6l-musl.nix
@@ -0,0 +1,11 @@
+{
+ busybox = import {
+ url = https://wdtz.org/files/xmz441m69qrlfdw47l2k10zf87fsya6r-stdenv-bootstrap-tools-armv6l-unknown-linux-musleabihf/on-server/busybox;
+ sha256 = "01d0hp1xgrriiy9w0sd9vbqzwxnpwiyah80pi4vrpcmbwji36j1i";
+ executable = true;
+ };
+ bootstrapTools = import {
+ url = https://wdtz.org/files/xmz441m69qrlfdw47l2k10zf87fsya6r-stdenv-bootstrap-tools-armv6l-unknown-linux-musleabihf/on-server/bootstrap-tools.tar.xz;
+ sha256 = "1r9mz9w8y5jd7gfwfsrvs20qarzxy7bvrp5dlm41hnx6z617if1h";
+ };
+}
diff --git a/pkgs/stdenv/linux/bootstrap-files/x86_64-musl.nix b/pkgs/stdenv/linux/bootstrap-files/x86_64-musl.nix
new file mode 100644
index 00000000000..12093f34000
--- /dev/null
+++ b/pkgs/stdenv/linux/bootstrap-files/x86_64-musl.nix
@@ -0,0 +1,11 @@
+{
+ busybox = import {
+ url = https://wdtz.org/files/030q34q7fk6jdfxkgcqp5rzr4yhw3pgx-stdenv-bootstrap-tools-x86_64-unknown-linux-musl/on-server/busybox;
+ sha256 = "16lzrwwvdk6q3g08gs45pldz0rh6xpln2343xr444960h6wqxl5v";
+ executable = true;
+ };
+ bootstrapTools = import {
+ url = https://wdtz.org/files/030q34q7fk6jdfxkgcqp5rzr4yhw3pgx-stdenv-bootstrap-tools-x86_64-unknown-linux-musl/on-server/bootstrap-tools.tar.xz;
+ sha256 = "0ly0wj8wzbikn2j8sn727vikk90bq36drh98qvfx1kkh5k5azm2j";
+ };
+}
diff --git a/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix b/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix
new file mode 100644
index 00000000000..6118585d545
--- /dev/null
+++ b/pkgs/stdenv/linux/bootstrap-tools-musl/default.nix
@@ -0,0 +1,18 @@
+{ system, bootstrapFiles }:
+
+derivation {
+ name = "bootstrap-tools";
+
+ builder = bootstrapFiles.busybox;
+
+ args = [ "ash" "-e" ./scripts/unpack-bootstrap-tools.sh ];
+
+ tarball = bootstrapFiles.bootstrapTools;
+
+ inherit system;
+
+ # Needed by the GCC wrapper.
+ langC = true;
+ langCC = true;
+ isGNU = true;
+}
diff --git a/pkgs/stdenv/linux/bootstrap-tools-musl/scripts/unpack-bootstrap-tools.sh b/pkgs/stdenv/linux/bootstrap-tools-musl/scripts/unpack-bootstrap-tools.sh
new file mode 100644
index 00000000000..8b5070dc6d6
--- /dev/null
+++ b/pkgs/stdenv/linux/bootstrap-tools-musl/scripts/unpack-bootstrap-tools.sh
@@ -0,0 +1,64 @@
+# Unpack the bootstrap tools tarball.
+echo Unpacking the bootstrap tools...
+$builder mkdir $out
+< $tarball $builder unxz | $builder tar x -C $out
+
+# Set the ELF interpreter / RPATH in the bootstrap binaries.
+echo Patching the bootstrap tools...
+
+if test -f $out/lib/ld.so.?; then
+ # MIPS case
+ LD_BINARY=$out/lib/ld.so.?
+else
+ # i686, x86_64 and armv5tel
+ LD_BINARY=$out/lib/ld-*so.?
+fi
+
+# On x86_64, ld-linux-x86-64.so.2 barfs on patchelf'ed programs. So
+# use a copy of patchelf.
+LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/cp $out/bin/patchelf .
+
+for i in $out/bin/* $out/libexec/gcc/*/*/*; do
+ if [ -L "$i" ]; then continue; fi
+ if [ -z "${i##*/liblto*}" ]; then continue; fi
+ echo patching "$i"
+ LD_LIBRARY_PATH=$out/lib $LD_BINARY \
+ ./patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath "$i"
+done
+
+for i in $out/lib/libiconv*.so $out/lib/libpcre* $out/lib/libc.so; do
+ if [ -L "$i" ]; then continue; fi
+ echo patching "$i"
+ $out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
+done
+
+export PATH=$out/bin
+
+# Fix the libc linker script.
+#cat $out/lib/libc.so | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $out/lib/libc.so.tmp
+#mv $out/lib/libc.so.tmp $out/lib/libc.so
+#cat $out/lib/libpthread.so | sed "s|/nix/store/e*-[^/]*/|$out/|g" > $out/lib/libpthread.so.tmp
+#mv $out/lib/libpthread.so.tmp $out/lib/libpthread.so
+
+# Provide some additional symlinks.
+ln -s bash $out/bin/sh
+ln -s bzip2 $out/bin/bunzip2
+
+# Provide a gunzip script.
+cat > $out/bin/gunzip < $out/bin/egrep
+echo "exec $out/bin/grep -E \"\$@\"" >> $out/bin/egrep
+echo "#! $out/bin/sh" > $out/bin/fgrep
+echo "exec $out/bin/grep -F \"\$@\"" >> $out/bin/fgrep
+
+# Provide xz (actually only xz -d will work).
+echo "#! $out/bin/sh" > $out/bin/xz
+echo "exec $builder unxz \"\$@\"" >> $out/bin/xz
+
+chmod +x $out/bin/egrep $out/bin/fgrep $out/bin/xz
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 858323e5cc5..249f788c17a 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -6,16 +6,28 @@
{ lib
, localSystem, crossSystem, config, overlays
-, bootstrapFiles ? { # switch
- "i686-linux" = import ./bootstrap-files/i686.nix;
- "x86_64-linux" = import ./bootstrap-files/x86_64.nix;
- "armv5tel-linux" = import ./bootstrap-files/armv5tel.nix;
- "armv6l-linux" = import ./bootstrap-files/armv6l.nix;
- "armv7l-linux" = import ./bootstrap-files/armv7l.nix;
- "aarch64-linux" = import ./bootstrap-files/aarch64.nix;
- "mips64el-linux" = import ./bootstrap-files/loongson2f.nix;
- }.${localSystem.system}
- or (abort "unsupported platform for the pure Linux stdenv")
+, bootstrapFiles ?
+ let table = {
+ "glibc" = {
+ "i686-linux" = import ./bootstrap-files/i686.nix;
+ "x86_64-linux" = import ./bootstrap-files/x86_64.nix;
+ "armv5tel-linux" = import ./bootstrap-files/armv5tel.nix;
+ "armv6l-linux" = import ./bootstrap-files/armv6l.nix;
+ "armv7l-linux" = import ./bootstrap-files/armv7l.nix;
+ "aarch64-linux" = import ./bootstrap-files/aarch64.nix;
+ "mips64el-linux" = import ./bootstrap-files/loongson2f.nix;
+ };
+ "musl" = {
+ "aarch64-linux" = import ./bootstrap-files/aarch64-musl.nix;
+ "armv6l-linux" = import ./bootstrap-files/armv6l-musl.nix;
+ "x86_64-linux" = import ./bootstrap-files/x86_64-musl.nix;
+ };
+ };
+ archLookupTable = table.${localSystem.libc}
+ or (abort "unsupported libc for the pure Linux stdenv");
+ files = archLookupTable.${localSystem.system}
+ or (abort "unsupported platform for the pure Linux stdenv");
+ in files
}:
assert crossSystem == null;
@@ -40,7 +52,9 @@ let
# Download and unpack the bootstrap tools (coreutils, GCC, Glibc, ...).
- bootstrapTools = import ./bootstrap-tools { inherit system bootstrapFiles; };
+ bootstrapTools = import (if localSystem.libc == "musl" then ./bootstrap-tools-musl else ./bootstrap-tools) { inherit system bootstrapFiles; };
+
+ getLibc = stage: stage.${localSystem.libc};
# This function builds the various standard environments used during
@@ -82,7 +96,7 @@ let
cc = prevStage.gcc-unwrapped;
bintools = prevStage.binutils;
isGNU = true;
- libc = prevStage.glibc;
+ libc = getLibc prevStage;
inherit (prevStage) coreutils gnugrep;
name = name;
stdenvNoCC = prevStage.ccWrapperStdenv;
@@ -95,6 +109,7 @@ let
# stdenv.glibc is used by GCC build to figure out the system-level
# /usr/include directory.
+ # TODO: Remove this!
inherit (prevStage) glibc;
};
overrides = self: super: (overrides self super) // { fetchurl = thisStdenv.fetchurlBoot; };
@@ -113,7 +128,8 @@ in
__raw = true;
gcc-unwrapped = null;
- glibc = null;
+ glibc = assert false; null;
+ musl = assert false; null;
binutils = null;
coreutils = null;
gnugrep = null;
@@ -135,12 +151,15 @@ in
# will search the Glibc headers before the GCC headers). So
# create a dummy Glibc here, which will be used in the stdenv of
# stage1.
- glibc = self.stdenv.mkDerivation {
- name = "bootstrap-glibc";
+ ${localSystem.libc} = self.stdenv.mkDerivation {
+ name = "bootstrap-${localSystem.libc}";
buildCommand = ''
mkdir -p $out
ln -s ${bootstrapTools}/lib $out/lib
+ '' + lib.optionalString (localSystem.libc == "glibc") ''
ln -s ${bootstrapTools}/include-glibc $out/include
+ '' + lib.optionalString (localSystem.libc == "musl") ''
+ ln -s ${bootstrapTools}/include-libc $out/include
'';
};
gcc-unwrapped = bootstrapTools;
@@ -148,7 +167,7 @@ in
nativeTools = false;
nativeLibc = false;
buildPackages = { };
- libc = self.glibc;
+ libc = getLibc self;
inherit (self) stdenvNoCC coreutils gnugrep;
bintools = bootstrapTools;
name = "bootstrap-binutils-wrapper";
@@ -177,7 +196,9 @@ in
binutils = super.binutils_nogold;
inherit (prevStage)
ccWrapperStdenv
- glibc gcc-unwrapped coreutils gnugrep;
+ gcc-unwrapped coreutils gnugrep;
+
+ ${localSystem.libc} = getLibc prevStage;
# A threaded perl build needs glibc/libpthread_nonshared.a,
# which is not included in bootstrapTools, so disable threading.
@@ -203,7 +224,7 @@ in
binutils = prevStage.binutils.override {
# Rewrap the binutils with the new glibc, so both the next
# stage's wrappers use it.
- libc = self.glibc;
+ libc = getLibc self;
};
};
})
@@ -218,8 +239,9 @@ in
overrides = self: super: rec {
inherit (prevStage)
ccWrapperStdenv
- binutils glibc coreutils gnugrep
+ binutils coreutils gnugrep
perl patchelf linuxHeaders gnum4 bison;
+ ${localSystem.libc} = getLibc prevStage;
# Link GCC statically against GMP etc. This makes sense because
# these builds of the libraries are only used by GCC, so it
# reduces the size of the stdenv closure.
@@ -247,8 +269,8 @@ in
# because gcc (since JAR support) already depends on zlib, and
# then if we already have a zlib we want to use that for the
# other purposes (binutils and top-level pkgs) too.
- inherit (prevStage) gettext gnum4 bison gmp perl glibc zlib linuxHeaders;
-
+ inherit (prevStage) gettext gnum4 bison gmp perl zlib linuxHeaders;
+ ${localSystem.libc} = getLibc prevStage;
binutils = super.binutils.override {
# Don't use stdenv's shell but our own
shell = self.bash + "/bin/bash";
@@ -267,7 +289,7 @@ in
};
cc = prevStage.gcc-unwrapped;
bintools = self.binutils;
- libc = self.glibc;
+ libc = getLibc self;
inherit (self) stdenvNoCC coreutils gnugrep;
name = "";
shell = self.bash + "/bin/bash";
@@ -314,7 +336,9 @@ in
inherit (prevStage.stdenv) fetchurlBoot;
extraAttrs = {
+ # TODO: remove this!
inherit (prevStage) glibc;
+
inherit platform bootstrapTools;
shellPackage = prevStage.bash;
};
@@ -332,18 +356,20 @@ in
++ lib.optional (gawk.libsigsegv != null) gawk.libsigsegv
)
# More complicated cases
- ++ [
- glibc.out glibc.dev glibc.bin/*propagated from .dev*/ linuxHeaders
+ ++ (map (x: getOutput x (getLibc prevStage)) [ "out" "dev" "bin" ] )
+ ++ [ /*propagated from .dev*/ linuxHeaders
binutils gcc gcc.cc gcc.cc.lib gcc.expand-response-params
]
+ ++ lib.optional (localSystem.libc == "musl") libiconv
++ lib.optionals localSystem.isAarch64
[ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ];
overrides = self: super: {
inherit (prevStage)
gzip bzip2 xz bash coreutils diffutils findutils gawk
- glibc gnumake gnused gnutar gnugrep gnupatch patchelf
+ gnumake gnused gnutar gnugrep gnupatch patchelf
attr acl paxctl zlib pcre;
+ ${localSystem.libc} = getLibc prevStage;
} // lib.optionalAttrs (super.targetPlatform == localSystem) {
# Need to get rid of these when cross-compiling.
inherit (prevStage) binutils binutils-raw;
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
index ac1d57a2275..d08be79e6c5 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
@@ -7,10 +7,14 @@ let
};
in with (import ../../../lib).systems.examples; {
- armv5tel = make sheevaplug;
- scaleway = make scaleway-c1;
- pogoplug4 = make pogoplug4;
- armv6l = make raspberryPi;
- armv7l = make armv7l-hf-multiplatform;
- aarch64 = make aarch64-multiplatform;
+ armv5tel = make sheevaplug;
+ scaleway = make scaleway-c1;
+ pogoplug4 = make pogoplug4;
+ armv6l = make raspberryPi;
+ armv7l = make armv7l-hf-multiplatform;
+ aarch64 = make aarch64-multiplatform;
+ x86_64-musl = make musl64;
+ i686-musl = make musl32;
+ armv6l-musl = make muslpi;
+ aarch64-musl = make aarch64-multiplatform-musl;
}
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index f51a39d5820..86801e3f044 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -4,9 +4,7 @@
let
pkgs = import ../../.. { inherit localSystem crossSystem; };
- glibc = if pkgs.hostPlatform != pkgs.buildPlatform
- then pkgs.glibcCross
- else pkgs.glibc;
+ libc = pkgs.stdenv.cc.libc;
in with pkgs; rec {
@@ -46,29 +44,30 @@ in with pkgs; rec {
set -x
mkdir -p $out/bin $out/lib $out/libexec
+ '' + (if (hostPlatform.libc == "glibc") then ''
# Copy what we need of Glibc.
- cp -d ${glibc.out}/lib/ld*.so* $out/lib
- cp -d ${glibc.out}/lib/libc*.so* $out/lib
- cp -d ${glibc.out}/lib/libc_nonshared.a $out/lib
- cp -d ${glibc.out}/lib/libm*.so* $out/lib
- cp -d ${glibc.out}/lib/libdl*.so* $out/lib
- cp -d ${glibc.out}/lib/librt*.so* $out/lib
- cp -d ${glibc.out}/lib/libpthread*.so* $out/lib
- cp -d ${glibc.out}/lib/libnsl*.so* $out/lib
- cp -d ${glibc.out}/lib/libutil*.so* $out/lib
- cp -d ${glibc.out}/lib/libnss*.so* $out/lib
- cp -d ${glibc.out}/lib/libresolv*.so* $out/lib
- cp -d ${glibc.out}/lib/crt?.o $out/lib
+ cp -d ${libc.out}/lib/ld*.so* $out/lib
+ cp -d ${libc.out}/lib/libc*.so* $out/lib
+ cp -d ${libc.out}/lib/libc_nonshared.a $out/lib
+ cp -d ${libc.out}/lib/libm*.so* $out/lib
+ cp -d ${libc.out}/lib/libdl*.so* $out/lib
+ cp -d ${libc.out}/lib/librt*.so* $out/lib
+ cp -d ${libc.out}/lib/libpthread*.so* $out/lib
+ cp -d ${libc.out}/lib/libnsl*.so* $out/lib
+ cp -d ${libc.out}/lib/libutil*.so* $out/lib
+ cp -d ${libc.out}/lib/libnss*.so* $out/lib
+ cp -d ${libc.out}/lib/libresolv*.so* $out/lib
+ cp -d ${libc.out}/lib/crt?.o $out/lib
- cp -rL ${glibc.dev}/include $out
+ cp -rL ${libc.dev}/include $out
chmod -R u+w "$out"
- # glibc can contain linker scripts: find them, copy their deps,
+ # libc can contain linker scripts: find them, copy their deps,
# and get rid of absolute paths (nuke-refs would make them useless)
local lScripts=$(grep --files-with-matches --max-count=1 'GNU ld script' -R "$out/lib")
- cp -d -t "$out/lib/" $(cat $lScripts | tr " " "\n" | grep -F '${glibc.out}' | sort -u)
+ cp -d -t "$out/lib/" $(cat $lScripts | tr " " "\n" | grep -F '${libc.out}' | sort -u)
for f in $lScripts; do
- substituteInPlace "$f" --replace '${glibc.out}/lib/' ""
+ substituteInPlace "$f" --replace '${libc.out}/lib/' ""
done
# Hopefully we won't need these.
@@ -76,7 +75,18 @@ in with pkgs; rec {
find $out/include -name .install -exec rm {} \;
find $out/include -name ..install.cmd -exec rm {} \;
mv $out/include $out/include-glibc
+ '' else if (hostPlatform.libc == "musl") then ''
+ # Copy what we need from musl
+ cp ${libc.out}/lib/* $out/lib
+ cp -rL ${libc.dev}/include $out
+ chmod -R u+w "$out"
+ rm -rf $out/include/mtd $out/include/rdma $out/include/sound $out/include/video
+ find $out/include -name .install -exec rm {} \;
+ find $out/include -name ..install.cmd -exec rm {} \;
+ mv $out/include $out/include-libc
+ '' else throw "unsupported libc for bootstrap tools")
+ + ''
# Copy coreutils, bash, etc.
cp ${coreutilsMinimal.out}/bin/* $out/bin
(cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users)
@@ -115,7 +125,7 @@ in with pkgs; rec {
cp -rd ${gcc.cc.out}/libexec/* $out/libexec
chmod -R u+w $out/libexec
rm -rf $out/libexec/gcc/*/*/plugin
- mkdir $out/include
+ mkdir -p $out/include
cp -rd ${gcc.cc.out}/include/c++ $out/include
chmod -R u+w $out/include
rm -rf $out/include/c++/*/ext/pb_ds
@@ -126,6 +136,8 @@ in with pkgs; rec {
cp -d ${libmpc.out}/lib/libmpc*.so* $out/lib
cp -d ${zlib.out}/lib/libz.so* $out/lib
cp -d ${libelf}/lib/libelf.so* $out/lib
+ '' + lib.optionalString (hostPlatform.libc == "musl") ''
+ cp -d ${libiconv.out}/lib/libiconv*.so* $out/lib
'' + lib.optionalString (hostPlatform != buildPlatform) ''
# These needed for cross but not native tools because the stdenv
@@ -161,7 +173,7 @@ in with pkgs; rec {
mv $out/.pack $out/pack
mkdir $out/on-server
- tar cvfJ $out/on-server/bootstrap-tools.tar.xz --hard-dereference --sort=name --numeric-owner --owner=0 --group=0 --mtime=@1 -C $out/pack .
+ XZ_OPT=-9 tar cvJf $out/on-server/bootstrap-tools.tar.xz --hard-dereference --sort=name --numeric-owner --owner=0 --group=0 --mtime=@1 -C $out/pack .
cp ${busyboxMinimal}/bin/busybox $out/on-server
chmod u+w $out/on-server/busybox
nuke-refs $out/on-server/busybox
@@ -189,10 +201,17 @@ in with pkgs; rec {
bootstrapTools = runCommand "bootstrap-tools.tar.xz" {} "cp ${build}/on-server/bootstrap-tools.tar.xz $out";
};
- bootstrapTools = import ./bootstrap-tools {
- inherit (hostPlatform) system;
- inherit bootstrapFiles;
- };
+ bootstrapTools = if (hostPlatform.libc == "glibc") then
+ import ./bootstrap-tools {
+ inherit (hostPlatform) system;
+ inherit bootstrapFiles;
+ }
+ else if (hostPlatform.libc == "musl") then
+ import ./bootstrap-tools-musl {
+ inherit (hostPlatform) system;
+ inherit bootstrapFiles;
+ }
+ else throw "unsupported libc";
test = derivation {
name = "test-bootstrap-tools";
@@ -215,10 +234,17 @@ in with pkgs; rec {
grep --version
gcc --version
+ '' + lib.optionalString (hostPlatform.libc == "glibc") ''
ldlinux=$(echo ${bootstrapTools}/lib/ld-linux*.so.?)
export CPP="cpp -idirafter ${bootstrapTools}/include-glibc -B${bootstrapTools}"
export CC="gcc -idirafter ${bootstrapTools}/include-glibc -B${bootstrapTools} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${bootstrapTools}/lib"
export CXX="g++ -idirafter ${bootstrapTools}/include-glibc -B${bootstrapTools} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${bootstrapTools}/lib"
+ '' + lib.optionalString (hostPlatform.libc == "musl") ''
+ ldmusl=$(echo ${bootstrapTools}/lib/ld-musl*.so.?)
+ export CPP="cpp -idirafter ${bootstrapTools}/include-libc -B${bootstrapTools}"
+ export CC="gcc -idirafter ${bootstrapTools}/include-libc -B${bootstrapTools} -Wl,-dynamic-linker,$ldmusl -Wl,-rpath,${bootstrapTools}/lib"
+ export CXX="g++ -idirafter ${bootstrapTools}/include-libc -B${bootstrapTools} -Wl,-dynamic-linker,$ldmusl -Wl,-rpath,${bootstrapTools}/lib"
+ '' + ''
echo '#include ' >> foo.c
echo '#include ' >> foo.c
diff --git a/pkgs/tools/compression/xz/default.nix b/pkgs/tools/compression/xz/default.nix
index 05cc672ab15..8d02e926e57 100644
--- a/pkgs/tools/compression/xz/default.nix
+++ b/pkgs/tools/compression/xz/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
doCheck = true;
# In stdenv-linux, prevent a dependency on bootstrap-tools.
- preConfigure = "unset CONFIG_SHELL";
+ preConfigure = "CONFIG_SHELL=/bin/sh";
postInstall = "rm -rf $out/share/doc";
diff --git a/pkgs/tools/misc/findutils/default.nix b/pkgs/tools/misc/findutils/default.nix
index 4eef3f7a9d5..f79720289bf 100644
--- a/pkgs/tools/misc/findutils/default.nix
+++ b/pkgs/tools/misc/findutils/default.nix
@@ -21,6 +21,7 @@ stdenv.mkDerivation rec {
doCheck
= !hostPlatform.isDarwin
&& !(hostPlatform.libc == "glibc" && hostPlatform.isi686)
+ && (hostPlatform.libc != "musl")
&& hostPlatform == buildPlatform;
outputs = [ "out" "info" ];
diff --git a/pkgs/tools/misc/man-db/default.nix b/pkgs/tools/misc/man-db/default.nix
index d0cb9a22336..eadb736aeeb 100644
--- a/pkgs/tools/misc/man-db/default.nix
+++ b/pkgs/tools/misc/man-db/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, libpipeline, db, groff, makeWrapper }:
+{ stdenv, fetchurl, pkgconfig, libpipeline, db, groff, libiconv, makeWrapper, buildPackages }:
stdenv.mkDerivation rec {
name = "man-db-2.7.5";
@@ -11,8 +11,10 @@ stdenv.mkDerivation rec {
outputs = [ "out" "doc" ];
outputMan = "out"; # users will want `man man` to work
- nativeBuildInputs = [ pkgconfig makeWrapper ];
- buildInputs = [ libpipeline db groff ];
+ nativeBuildInputs = [ pkgconfig makeWrapper groff ]
+ ++ stdenv.lib.optionals doCheck checkInputs;
+ buildInputs = [ libpipeline db groff ]; # (Yes, 'groff' is both native and build input)
+ checkInputs = [ libiconv /* for 'iconv' binary */ ];
postPatch = ''
substituteInPlace src/man_db.conf.in \
@@ -41,6 +43,18 @@ stdenv.mkDerivation rec {
done
'';
+ postFixup = stdenv.lib.optionalString (buildPackages.groff != groff) ''
+ # Check to make sure none of the outputs depend on build-time-only groff:
+ for outName in $outputs; do
+ out=''${!outName}
+ echo "Checking $outName(=$out) for references to build-time groff..."
+ if grep -r '${buildPackages.groff}' $out; then
+ echo "Found an erroneous dependency on groff ^^^" >&2
+ exit 1
+ fi
+ done
+ '';
+
enableParallelBuilding = true;
doCheck = true;
diff --git a/pkgs/tools/misc/screen/default.nix b/pkgs/tools/misc/screen/default.nix
index 156db640acd..1753f52ab1b 100644
--- a/pkgs/tools/misc/screen/default.nix
+++ b/pkgs/tools/misc/screen/default.nix
@@ -16,6 +16,13 @@ stdenv.mkDerivation rec {
"--enable-colors256"
];
+ patches = stdenv.lib.optional stdenv.hostPlatform.isMusl
+ (fetchpatch {
+ url = https://gist.githubusercontent.com/yujinakayama/4608863/raw/76b9f89af5e5a2e97d9a0f36aac989fb56cf1447/gistfile1.diff;
+ sha256 = "0f9bf83p8zdxaa1pr75jyf5g8xr3r8kv7cyzzbpraa1q4j15ss1p";
+ stripLen = 1;
+ });
+
buildInputs = [ ncurses ] ++ stdenv.lib.optional stdenv.isLinux pam
++ stdenv.lib.optional stdenv.isDarwin utmp;
diff --git a/pkgs/tools/networking/inetutils/default.nix b/pkgs/tools/networking/inetutils/default.nix
index ad058174cff..c5ecb5eb6da 100644
--- a/pkgs/tools/networking/inetutils/default.nix
+++ b/pkgs/tools/networking/inetutils/default.nix
@@ -15,7 +15,13 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses /* for `talk' */ perl /* for `whois' */ help2man ];
- configureFlags = "--with-ncurses-include-dir=${ncurses.dev}/include";
+ configureFlags = [ "--with-ncurses-include-dir=${ncurses.dev}/include" ]
+ ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [ # Musl doesn't define rcmd
+ "--disable-rcp"
+ "--disable-rsh"
+ "--disable-rlogin"
+ "--disable-rexec"
+ ];
# Test fails with "UNIX socket name too long", probably because our
# $TMPDIR is too long.
@@ -25,7 +31,7 @@ stdenv.mkDerivation rec {
postInstall = ''
# XXX: These programs are normally installed setuid but since it
# fails, they end up being non-executable, hence this hack.
- chmod +x $out/bin/{ping,ping6,rcp,rlogin,rsh,traceroute}
+ chmod +x $out/bin/{ping,ping6,${stdenv.lib.optionalString (!stdenv.hostPlatform.isMusl) ''rcp,rlogin,rsh,''}traceroute}
'';
meta = {
diff --git a/pkgs/tools/networking/iperf/3.nix b/pkgs/tools/networking/iperf/3.nix
index d69b52a5001..b9e47ecd7f9 100644
--- a/pkgs/tools/networking/iperf/3.nix
+++ b/pkgs/tools/networking/iperf/3.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, openssl }:
+{ stdenv, fetchurl, openssl, fetchpatch }:
stdenv.mkDerivation rec {
name = "iperf-3.3";
@@ -10,6 +10,23 @@ stdenv.mkDerivation rec {
buildInputs = [ openssl ];
+ preConfigure = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+ NIX_CFLAGS_COMPILE+=" -D_GNU_SOURCE"
+ '';
+
+ patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [
+ (fetchpatch {
+ url = "http://git.alpinelinux.org/cgit/aports/plain/main/iperf3/build-fixes.patch";
+ name = "fix-musl-build.patch";
+ sha256 = "0zvfjnqdldh6rc6qggyb310swdnl9qk0m3z1kklnqzgjsh8dskvl";
+ })
+ (fetchpatch {
+ url = "http://git.alpinelinux.org/cgit/aports/plain/main/iperf3/remove-pg-flags.patch";
+ name = "remove-pg-flags.patch";
+ sha256 = "0lnczhass24kgq59drgdipnhjnw4l1cy6gqza7f2ah1qr4q104rm";
+ })
+];
+
postInstall = ''
ln -s iperf3 $out/bin/iperf
'';
diff --git a/pkgs/tools/networking/openntpd/default.nix b/pkgs/tools/networking/openntpd/default.nix
index 7e1c257ec4b..d63df830d0e 100644
--- a/pkgs/tools/networking/openntpd/default.nix
+++ b/pkgs/tools/networking/openntpd/default.nix
@@ -12,6 +12,11 @@ stdenv.mkDerivation rec {
sha256 = "1g6hi03ylhv47sbar3xxgsrar8schqfwn4glckh6m6lni67ndq85";
};
+ prePatch = ''
+ sed -i '20i#include ' src/ntpd.h
+ sed -i '19i#include ' src/log.c
+ '';
+
configureFlags = [
"--with-privsep-path=${privsepPath}"
"--with-privsep-user=${privsepUser}"
diff --git a/pkgs/tools/networking/ppp/default.nix b/pkgs/tools/networking/ppp/default.nix
index d07770260ff..570e85c3281 100644
--- a/pkgs/tools/networking/ppp/default.nix
+++ b/pkgs/tools/networking/ppp/default.nix
@@ -23,6 +23,7 @@ stdenv.mkDerivation rec {
url = "https://anonscm.debian.org/git/collab-maint/pkg-ppp.git/plain/debian/patches/rc_mksid-no-buffer-overflow?h=debian/2.4.7-1%2b4";
sha256 = "1dk00j7bg9nfgskw39fagnwv1xgsmyv0xnkd6n1v5gy0psw0lvqh";
})
+ ./musl-fix-headers.patch
];
buildInputs = [ libpcap ];
diff --git a/pkgs/tools/networking/ppp/musl-fix-headers.patch b/pkgs/tools/networking/ppp/musl-fix-headers.patch
new file mode 100644
index 00000000000..d24f6289684
--- /dev/null
+++ b/pkgs/tools/networking/ppp/musl-fix-headers.patch
@@ -0,0 +1,137 @@
+diff --git a/include/net/ppp_defs.h b/include/net/ppp_defs.h
+index b06eda5..dafa36c 100644
+--- a/include/net/ppp_defs.h
++++ b/include/net/ppp_defs.h
+@@ -38,6 +38,8 @@
+ #ifndef _PPP_DEFS_H_
+ #define _PPP_DEFS_H_
+
++#include
++
+ /*
+ * The basic PPP frame.
+ */
+diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux
+index a74c914..7acd2cf 100644
+--- a/pppd/Makefile.linux
++++ b/pppd/Makefile.linux
+@@ -126,7 +126,7 @@ LIBS += -lcrypt
+ endif
+
+ ifdef USE_LIBUTIL
+-CFLAGS += -DHAVE_LOGWTMP=1
++#CFLAGS += -DHAVE_LOGWTMP=1
+ LIBS += -lutil
+ endif
+
+diff --git a/pppd/magic.h b/pppd/magic.h
+index c81213b..305aece 100644
+--- a/pppd/magic.h
++++ b/pppd/magic.h
+@@ -42,6 +42,8 @@
+ * $Id: magic.h,v 1.5 2003/06/11 23:56:26 paulus Exp $
+ */
+
++#include
++
+ void magic_init __P((void)); /* Initialize the magic number generator */
+ u_int32_t magic __P((void)); /* Returns the next magic number */
+
+diff --git a/pppd/plugins/rp-pppoe/if.c b/pppd/plugins/rp-pppoe/if.c
+index 91e9a57..9c0fac3 100644
+--- a/pppd/plugins/rp-pppoe/if.c
++++ b/pppd/plugins/rp-pppoe/if.c
+@@ -30,10 +30,6 @@ static char const RCSID[] =
+ #include
+ #endif
+
+-#ifdef HAVE_NET_ETHERNET_H
+-#include
+-#endif
+-
+ #ifdef HAVE_ASM_TYPES_H
+ #include
+ #endif
+diff --git a/pppd/plugins/rp-pppoe/plugin.c b/pppd/plugins/rp-pppoe/plugin.c
+index a8c2bb4..ca34d79 100644
+--- a/pppd/plugins/rp-pppoe/plugin.c
++++ b/pppd/plugins/rp-pppoe/plugin.c
+@@ -46,7 +46,6 @@ static char const RCSID[] =
+ #include
+ #include
+ #include
+-#include
+ #include
+ #include
+ #include
+diff --git a/pppd/plugins/rp-pppoe/pppoe-discovery.c b/pppd/plugins/rp-pppoe/pppoe-discovery.c
+index 3d3bf4e..b5f82d3 100644
+--- a/pppd/plugins/rp-pppoe/pppoe-discovery.c
++++ b/pppd/plugins/rp-pppoe/pppoe-discovery.c
+@@ -27,10 +27,6 @@
+ #include
+ #endif
+
+-#ifdef HAVE_NET_ETHERNET_H
+-#include
+-#endif
+-
+ #ifdef HAVE_ASM_TYPES_H
+ #include
+ #endif
+@@ -55,6 +51,8 @@ void die(int status)
+ exit(status);
+ }
+
++#define error(x...) fprintf(stderr, x)
++
+ /* Initialize frame types to RFC 2516 values. Some broken peers apparently
+ use different frame types... sigh... */
+
+diff --git a/pppd/plugins/rp-pppoe/pppoe.h b/pppd/plugins/rp-pppoe/pppoe.h
+index 9ab2eee..4d68147 100644
+--- a/pppd/plugins/rp-pppoe/pppoe.h
++++ b/pppd/plugins/rp-pppoe/pppoe.h
+@@ -86,18 +86,6 @@ typedef unsigned long UINT32_t;
+
+ #include
+
+-#ifdef HAVE_NETINET_IF_ETHER_H
+-#include
+-
+-#ifdef HAVE_SYS_SOCKET_H
+-#include
+-#endif
+-#ifndef HAVE_SYS_DLPI_H
+-#include
+-#endif
+-#endif
+-
+-
+
+ /* Ethernet frame types according to RFC 2516 */
+ #define ETH_PPPOE_DISCOVERY 0x8863
+diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c
+index 6d71530..86d224e 100644
+--- a/pppd/sys-linux.c
++++ b/pppd/sys-linux.c
+@@ -102,19 +102,11 @@
+ #define MAX_ADDR_LEN 7
+ #endif
+
+-#if __GLIBC__ >= 2
+ #include /* glibc 2 conflicts with linux/types.h */
+ #include
+ #include
+ #include
+ #include
+-#else
+-#include
+-#include
+-#include
+-#include
+-#include
+-#endif
+ #include
+ #include
+
diff --git a/pkgs/tools/networking/siege/default.nix b/pkgs/tools/networking/siege/default.nix
index 93fc28b48bf..cac3e3e6361 100644
--- a/pkgs/tools/networking/siege/default.nix
+++ b/pkgs/tools/networking/siege/default.nix
@@ -12,6 +12,10 @@ stdenv.mkDerivation rec {
buildInputs = [ openssl zlib ];
+ prePatch = ''
+ sed -i -e 's/u_int32_t/uint32_t/g' -e '1i#include ' src/hash.c
+ '';
+
configureFlags = [
"--with-ssl=${openssl.dev}"
"--with-zlib=${zlib.dev}"
diff --git a/pkgs/tools/networking/unbound/default.nix b/pkgs/tools/networking/unbound/default.nix
index 614447cd5ec..cc2f994d0d5 100644
--- a/pkgs/tools/networking/unbound/default.nix
+++ b/pkgs/tools/networking/unbound/default.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
installFlags = [ "configfile=\${out}/etc/unbound/unbound.conf" ];
- preFixup = stdenv.lib.optionalString stdenv.isLinux
+ preFixup = stdenv.lib.optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) # XXX: revisit
# Build libunbound again, but only against nettle instead of openssl.
# This avoids gnutls.out -> unbound.lib -> openssl.out.
# There was some problem with this on Darwin; let's not complicate non-Linux.
diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix
index 106dd1c7fbf..21b333f3231 100644
--- a/pkgs/tools/package-management/nix/default.nix
+++ b/pkgs/tools/package-management/nix/default.nix
@@ -2,7 +2,7 @@
, pkgconfig, boehmgc, perlPackages, libsodium, aws-sdk-cpp, brotli
, autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook5_xsl
, libseccomp, busybox-sandbox-shell
-, hostPlatform
+, hostPlatform, buildPlatform
, storeDir ? "/nix/store"
, stateDir ? "/nix/var"
, confDir ? "/etc"
@@ -24,10 +24,10 @@ let
nativeBuildInputs =
[ pkgconfig ]
- ++ lib.optionals (!is20) [ perl ]
+ ++ lib.optionals (!is20) [ curl perl ]
++ lib.optionals fromGit [ autoreconfHook autoconf-archive bison flex libxml2 libxslt docbook5 docbook5_xsl ];
- buildInputs = [ curl openssl sqlite xz ]
+ buildInputs = [ curl openssl sqlite xz bzip2 ]
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
++ lib.optionals fromGit [ brotli ] # Since 1.12
++ lib.optional stdenv.isLinux libseccomp
@@ -39,15 +39,6 @@ let
propagatedBuildInputs = [ boehmgc ];
- # Note: bzip2 is not passed as a build input, because the unpack phase
- # would end up using the wrong bzip2 when cross-compiling.
- # XXX: The right thing would be to reinstate `--with-bzip2' in Nix.
- postUnpack =
- '' export CPATH="${bzip2.dev}/include"
- export LIBRARY_PATH="${bzip2.out}/lib"
- export CXXFLAGS="-Wno-error=reserved-user-defined-literal"
- '';
-
configureFlags =
[ "--with-store-dir=${storeDir}"
"--localstatedir=${stateDir}"
@@ -61,40 +52,22 @@ let
"--with-www-curl=${perlPackages.WWWCurl}/${perl.libPrefix}"
] ++ lib.optionals (is20 && stdenv.isLinux) [
"--with-sandbox-shell=${sh}/bin/busybox"
- ];
+ ]
+ ++ lib.optional (
+ hostPlatform != buildPlatform && hostPlatform ? nix && hostPlatform.nix ? system
+ ) ''--with-system=${hostPlatform.nix.system}'';
makeFlags = "profiledir=$(out)/etc/profile.d";
installFlags = "sysconfdir=$(out)/etc";
- doInstallCheck = true;
+ doInstallCheck = true; # not cross
# socket path becomes too long otherwise
preInstallCheck = lib.optional stdenv.isDarwin "export TMPDIR=/tmp";
separateDebugInfo = stdenv.isLinux;
- crossAttrs = {
- postUnpack =
- '' export CPATH="${bzip2.crossDrv}/include"
- export NIX_CROSS_LDFLAGS="-L${bzip2.crossDrv}/lib -rpath-link ${bzip2.crossDrv}/lib $NIX_CROSS_LDFLAGS"
- '';
-
- configureFlags =
- ''
- --with-store-dir=${storeDir} --localstatedir=${stateDir}
- --with-dbi=${perlPackages.DBI}/${perl.libPrefix}
- --with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix}
- --with-www-curl=${perlPackages.WWWCurl}/${perl.libPrefix}
- --disable-init-state
- --enable-gc
- '' + stdenv.lib.optionalString (
- hostPlatform ? nix && hostPlatform.nix ? system
- ) ''--with-system=${hostPlatform.nix.system}'';
-
- doInstallCheck = false;
- };
-
enableParallelBuilding = true;
meta = {
diff --git a/pkgs/tools/security/sudo/default.nix b/pkgs/tools/security/sudo/default.nix
index 5192f57582c..1edd5b60926 100644
--- a/pkgs/tools/security/sudo/default.nix
+++ b/pkgs/tools/security/sudo/default.nix
@@ -28,6 +28,7 @@ stdenv.mkDerivation rec {
"--with-logpath=/var/log/sudo.log"
"--with-iologdir=/var/log/sudo-io"
"--with-sendmail=${sendmailPath}"
+ "--enable-tmpfiles.d=no"
] ++ stdenv.lib.optional withInsults [
"--with-insults"
"--with-all-insults"
diff --git a/pkgs/tools/system/smartmontools/default.nix b/pkgs/tools/system/smartmontools/default.nix
index 5fa55b275fe..e5b2d54e585 100644
--- a/pkgs/tools/system/smartmontools/default.nix
+++ b/pkgs/tools/system/smartmontools/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, autoreconfHook
+{ stdenv, fetchurl, fetchpatch, autoreconfHook
, IOKit ? null , ApplicationServices ? null }:
let
@@ -20,7 +20,14 @@ in stdenv.mkDerivation rec {
sha256 = "0m1hllbb78rr6cxkbalmz1gqkl0psgq8rrmv4gwcmz34n07kvx2i";
};
- patches = [ ./smartmontools.patch ];
+ patches = [ ./smartmontools.patch ]
+ # https://www.smartmontools.org/changeset/4603
+ ++ stdenv.lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
+ name = "musl-canonicalize_file_name.patch";
+ url = "https://www.smartmontools.org/changeset/4603?format=diff&new=4603";
+ sha256 = "06s9pcd95snjkrbfrsjby2lln3lnwjd21bgabmvr4p7fx19b75zp";
+ stripLen = 2;
+ });
postPatch = "cp -v ${driverdb} drivedb.h";
nativeBuildInputs = [ autoreconfHook ];
diff --git a/pkgs/tools/text/agrep/default.nix b/pkgs/tools/text/agrep/default.nix
index 5d6eed458c0..10d3a47cc85 100644
--- a/pkgs/tools/text/agrep/default.nix
+++ b/pkgs/tools/text/agrep/default.nix
@@ -12,6 +12,10 @@ stdenv.mkDerivation rec {
sha256 = "14addnwspdf2mxpqyrw8b84bb2257y43g5ccy4ipgrr91fmxq2sk";
};
+ # Related: https://github.com/Wikinaut/agrep/pull/11
+ prePatch = stdenv.lib.optionalString (stdenv.hostPlatform.isMusl || stdenv.isDarwin) ''
+ sed -i '1i#include ' checkfil.c newmgrep.c recursiv.c
+ '';
installPhase = ''
install -Dm 555 agrep -t "$out/bin"
install -Dm 444 docs/* -t "$out/doc"
diff --git a/pkgs/tools/text/gnupatch/default.nix b/pkgs/tools/text/gnupatch/default.nix
index dfdb25438cf..3840811a3e3 100644
--- a/pkgs/tools/text/gnupatch/default.nix
+++ b/pkgs/tools/text/gnupatch/default.nix
@@ -4,11 +4,11 @@
}:
stdenv.mkDerivation rec {
- name = "patch-2.7.5";
+ name = "patch-2.7.6";
src = fetchurl {
url = "mirror://gnu/patch/${name}.tar.xz";
- sha256 = "16d2r9kpivaak948mxzc0bai45mqfw73m113wrkmbffnalv1b5gx";
+ sha256 = "1zfqy4rdcy279vwn2z1kbv19dcfw25d2aqy9nzvdkq5bjzd0nqdc";
};
buildInputs = stdenv.lib.optional doCheck ed;
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
"ac_cv_func_strnlen_working=yes"
];
- doCheck = true; # not cross;
+ doCheck = hostPlatform.libc != "musl"; # not cross;
meta = {
description = "GNU Patch, a program to apply differences to files";
diff --git a/pkgs/tools/text/groff/default.nix b/pkgs/tools/text/groff/default.nix
index b11f3cb4b8c..6d01c42f93d 100644
--- a/pkgs/tools/text/groff/default.nix
+++ b/pkgs/tools/text/groff/default.nix
@@ -2,6 +2,7 @@
, ghostscript #for postscript and html output
, psutils, netpbm #for html output
, buildPackages
+, autoreconfHook
}:
stdenv.mkDerivation rec {
@@ -17,6 +18,8 @@ stdenv.mkDerivation rec {
enableParallelBuilding = false;
+ patches = [ ./look-for-ar.patch ];
+
postPatch = stdenv.lib.optionalString (psutils != null) ''
substituteInPlace src/preproc/html/pre-html.cpp \
--replace "psselect" "${psutils}/bin/psselect"
@@ -32,6 +35,7 @@ stdenv.mkDerivation rec {
'';
buildInputs = [ ghostscript psutils netpbm perl ];
+ nativeBuildInputs = [ autoreconfHook ];
# Builds running without a chroot environment may detect the presence
# of /usr/X11 in the host system, leading to an impure build of the
@@ -42,6 +46,8 @@ stdenv.mkDerivation rec {
"--without-x"
] ++ stdenv.lib.optionals (ghostscript != null) [
"--with-gs=${ghostscript}/bin/gs"
+ ] ++ stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+ "ac_cv_path_PERL=${perl}/bin/perl"
];
doCheck = true;
diff --git a/pkgs/tools/text/groff/look-for-ar.patch b/pkgs/tools/text/groff/look-for-ar.patch
new file mode 100644
index 00000000000..3b4d09c260f
--- /dev/null
+++ b/pkgs/tools/text/groff/look-for-ar.patch
@@ -0,0 +1,39 @@
+commit 988a001f969262089579958827652da00fda096f
+Author: Ben Gamari
+Date: Tue Oct 17 16:15:20 2017 -0400
+
+ Look for AR
+
+diff --git a/Makefile.in b/Makefile.in
+index bc156ce..cc02126 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -464,7 +464,7 @@ INSTALL_SCRIPT=@INSTALL_SCRIPT@
+ INSTALL_DATA=@INSTALL_DATA@
+ INSTALL_INFO=@INSTALL_INFO@
+ LN_S=@LN_S@
+-AR=ar
++AR=@AR@
+ ETAGS=etags
+ ETAGSFLAGS=
+ # Flag that tells etags to assume C++.
+diff --git a/configure.ac b/configure.ac
+index c779165..6d53f5e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -45,6 +45,7 @@ AC_PREREQ([2.62])
+
+ AC_CONFIG_HEADERS([src/include/config.h:src/include/config.hin])
+ AC_CONFIG_SRCDIR([src/roff/groff/groff.cpp])
++AC_CONFIG_MACRO_DIR([m4])
+
+ AC_USE_SYSTEM_EXTENSIONS
+
+@@ -73,6 +74,7 @@ GROFF_PROG_YACC
+ GROFF_DOC_CHECK
+ GROFF_MAKEINFO
+ AC_PROG_RANLIB
++AC_CHECK_TOOL([AR], [ar], [ar])
+ GROFF_INSTALL_SH
+ GROFF_INSTALL_INFO
+ AC_PROG_INSTALL
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 3e216d7391a..15f103b4c51 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5435,8 +5435,6 @@ with pkgs;
platform = {
name = "ben_nanonote";
kernelMajor = "2.6";
- # It's not a bcm47xx processor, but for the headers this should work
- kernelHeadersBaseConfig = "bcm47xx_defconfig";
kernelArch = "mips";
};
gcc = {
@@ -5747,9 +5745,7 @@ with pkgs;
'';
});
- crystal = callPackage ../development/compilers/crystal {
- llvm = llvm_5;
- };
+ crystal = callPackage ../development/compilers/crystal { };
devpi-client = callPackage ../development/tools/devpi-client {};
@@ -5848,6 +5844,7 @@ with pkgs;
libcCross1 =
if targetPlatform.libc == "msvcrt" then targetPackages.windows.mingw_w64_headers
else if targetPlatform.libc == "libSystem" then darwin.xcode
+ else if targetPlatform.libc == "musl" then musl
else null;
binutils1 = wrapBintoolsWith {
bintools = binutils-unwrapped;
@@ -6387,7 +6384,7 @@ with pkgs;
llvm_35 = llvmPackages_35.llvm;
llvm_34 = llvmPackages_34.llvm;
- llvmPackages = recurseIntoAttrs llvmPackages_4;
+ llvmPackages = recurseIntoAttrs llvmPackages_5;
llvmPackagesSelf = llvmPackages_34.override {
stdenv = libcxxStdenv;
@@ -6413,7 +6410,11 @@ with pkgs;
inherit (stdenvAdapters) overrideCC;
};
- llvmPackages_4 = callPackage ../development/compilers/llvm/4 ({
+ llvmPackages_4 = callPackage ../development/compilers/llvm/4 {
+ inherit (stdenvAdapters) overrideCC;
+ };
+
+ llvmPackages_5 = callPackage ../development/compilers/llvm/5 ({
inherit (stdenvAdapters) overrideCC;
} // stdenv.lib.optionalAttrs stdenv.isDarwin {
cmake = cmake.override {
@@ -6424,10 +6425,6 @@ with pkgs;
python2 = callPackage ../development/interpreters/python/cpython/2.7/boot.nix { inherit (darwin) CF configd; };
});
- llvmPackages_5 = callPackage ../development/compilers/llvm/5 {
- inherit (stdenvAdapters) overrideCC;
- };
-
manticore = callPackage ../development/compilers/manticore { };
mentorToolchains = recurseIntoAttrs (
@@ -8106,7 +8103,6 @@ with pkgs;
ycmd = callPackage ../development/tools/misc/ycmd {
inherit (darwin.apple_sdk.frameworks) Cocoa;
- llvmPackages = llvmPackages_5;
python = python2;
};
@@ -8747,20 +8743,25 @@ 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";
libcCross = assert targetPlatform != buildPlatform; libcCrossChooser targetPlatform.libc;
- # Only supported on Linux
- glibcLocales = if stdenv.isLinux then callPackage ../development/libraries/glibc/locales.nix { } else null;
+ # Only supported on Linux, using glibc
+ glibcLocales = if hostPlatform.libc == "glibc" then callPackage ../development/libraries/glibc/locales.nix { } else null;
glibcInfo = callPackage ../development/libraries/glibc/info.nix { };
@@ -9371,9 +9372,7 @@ with pkgs;
libchop = callPackage ../development/libraries/libchop { };
- libclc = callPackage ../development/libraries/libclc {
- llvmPackages = llvmPackages_5;
- };
+ libclc = callPackage ../development/libraries/libclc { };
libcli = callPackage ../development/libraries/libcli { };
@@ -9486,6 +9485,8 @@ with pkgs;
libetpan = callPackage ../development/libraries/libetpan { };
+ libexecinfo = callPackage ../development/libraries/libexecinfo { };
+
libfaketime = callPackage ../development/libraries/libfaketime { };
libfakekey = callPackage ../development/libraries/libfakekey { };
@@ -9762,7 +9763,7 @@ with pkgs;
};
# On non-GNU systems we need GNU Gettext for libintl.
- libintlOrEmpty = stdenv.lib.optional (!stdenv.isLinux) gettext;
+ libintlOrEmpty = stdenv.lib.optional (!stdenv.isLinux || hostPlatform.libc != "glibc") gettext;
libid3tag = callPackage ../development/libraries/libid3tag {
gperf = gperf_3_0;
@@ -10270,8 +10271,6 @@ with pkgs;
# makes it slower, but during runtime we link against just mesa_drivers
# through /run/opengl-driver*, which is overriden according to config.grsecurity
# grsecEnabled = true; # no more support in nixpkgs ATM
-
- llvmPackages = llvmPackages_5;
});
mesa_glu = mesaDarwinOr (callPackage ../development/libraries/mesa-glu { });
@@ -12566,11 +12565,12 @@ with pkgs;
};
xorg = recurseIntoAttrs (lib.callPackagesWith pkgs ../servers/x11/xorg/default.nix {
- inherit clangStdenv fetchurl fetchgit fetchpatch stdenv pkgconfig intltool freetype fontconfig
+ inherit clangStdenv fetchurl fetchgit fetchpatch stdenv intltool freetype fontconfig
libxslt expat libpng zlib perl mesa_drivers spice_protocol libunwind
dbus libuuid openssl gperf m4 libevdev tradcpp libinput mcpp makeWrapper autoreconfHook
- autoconf automake libtool xmlto asciidoc flex bison mtdev pixman
+ autoconf automake libtool mtdev pixman
cairo epoxy;
+ inherit (buildPackages) pkgconfig xmlto asciidoc flex bison;
inherit (darwin) apple_sdk cf-private libobjc;
bootstrap_cmds = if stdenv.isDarwin then darwin.bootstrap_cmds else null;
mesa = mesa_noglu;
@@ -12914,8 +12914,9 @@ with pkgs;
lkl = callPackage ../applications/virtualization/lkl { };
- linuxHeaders_4_4 = callPackage ../os-specific/linux/kernel-headers/4.4.nix { };
- linuxHeaders = linuxHeaders_4_4;
+ inherit (callPackages ../os-specific/linux/kernel-headers { })
+ linuxHeaders_4_4 linuxHeaders_4_15;
+ linuxHeaders = if hostPlatform.isMusl then linuxHeaders_4_15 else linuxHeaders_4_4;
kernelPatches = callPackage ../os-specific/linux/kernel/patches.nix { };
@@ -13344,6 +13345,17 @@ with pkgs;
multipath-tools = callPackage ../os-specific/linux/multipath-tools { };
musl = callPackage ../os-specific/linux/musl { };
+ musl-fts = callPackage ../os-specific/linux/musl/fts.nix { };
+ musl-getconf = callPackage ../os-specific/linux/musl/getconf.nix { };
+ musl-getent = callPackage ../os-specific/linux/musl/getent.nix { };
+ getent =
+ if hostPlatform.isMusl then musl-getent
+ # This may not be right on other platforms, but preserves existing behavior
+ else /* if hostPlatform.libc == "glibc" then */ glibc.bin;
+
+ getconf =
+ if hostPlatform.isMusl then musl-getconf
+ else lib.getBin stdenv.cc.libc;
nettools = callPackage ../os-specific/linux/net-tools { };
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index dda41afacea..9f2c93498ea 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -15080,6 +15080,8 @@ let self = _self // overrides; _self = with self; {
meta = {
description = "Line wrapping module with support for multibyte, fullwidth, and combining characters and languages without whitespaces between words";
license = with stdenv.lib.licenses; [ artistic1 gpl2 ];
+ # bogus use of glibc, pretty sure, think this is what we have glibcLocales for?
+ broken = stdenv.hostPlatform.libc != "glibc";
};
};
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 33a64866027..5608cd85ef2 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -230,7 +230,7 @@ in {
diff-match-patch = callPackage ../development/python-modules/diff-match-patch { };
globus-sdk = callPackage ../development/python-modules/globus-sdk { };
-
+
gssapi = callPackage ../development/python-modules/gssapi { };
h5py = callPackage ../development/python-modules/h5py {
@@ -254,7 +254,7 @@ in {
};
mwoauth = callPackage ../development/python-modules/mwoauth { };
-
+
neuron = pkgs.neuron.override {
inherit python;
};
@@ -359,7 +359,7 @@ in {
};
pytest-tornado = callPackage ../development/python-modules/pytest-tornado { };
-
+
python-sql = callPackage ../development/python-modules/python-sql { };
python-stdnum = callPackage ../development/python-modules/python-stdnum { };
@@ -9727,7 +9727,7 @@ in {
locustio = callPackage ../development/python-modules/locustio { };
- llvmlite = callPackage ../development/python-modules/llvmlite {llvm=pkgs.llvm_5;};
+ llvmlite = callPackage ../development/python-modules/llvmlite { llvm = pkgs.llvm; };
lockfile = buildPythonPackage rec {
pname = "lockfile";
@@ -14685,6 +14685,7 @@ in {
substituteInPlace "setup.cfg" \
--replace "/usr/local/include" "${pkgs.sqlite.dev}/include" \
--replace "/usr/local/lib" "${pkgs.sqlite.out}/lib"
+ ${stdenv.lib.optionalString (!stdenv.isDarwin) ''export LDSHARED="$CC -pthread -shared"''}
'';
meta = {
diff --git a/pkgs/top-level/release-cross.nix b/pkgs/top-level/release-cross.nix
index 8e1213f2344..61cf865371d 100644
--- a/pkgs/top-level/release-cross.nix
+++ b/pkgs/top-level/release-cross.nix
@@ -125,6 +125,17 @@ in
android = mapTestOnCross lib.systems.examples.aarch64-multiplatform (linuxCommon // {
});
+ x86_64-musl = mapTestOnCross lib.systems.examples.musl64 linuxCommon;
+ rpi-musl = mapTestOnCross lib.systems.examples.muslpi (linuxCommon // {
+ vim = nativePlatforms;
+ unzip = nativePlatforms;
+ ddrescue = nativePlatforms;
+ lynx = nativePlatforms;
+ patchelf = nativePlatforms;
+ buildPackages.binutils = nativePlatforms;
+ mpg123 = nativePlatforms;
+ });
+
/* Cross-built bootstrap tools for every supported platform */
bootstrapTools = let
tools = import ../stdenv/linux/make-bootstrap-tools-cross.nix { system = "x86_64-linux"; };