Merge pull request #34645 from dtzWill/feature/musl

musl-cross, native-musl, cross fixes, oh my!
This commit is contained in:
John Ericson 2018-02-13 15:29:10 -05:00 committed by GitHub
commit a267ae4b24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
152 changed files with 2774 additions and 303 deletions

View File

@ -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;

View File

@ -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 <endian.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
@@ -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 <unistd.h>
+#include <stdint.h>
#include <stdlib.h>
-#include <endian.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
@@ -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

View File

@ -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 = ''

View File

@ -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"

View File

@ -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

View File

@ -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 ''

View File

@ -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 <stdint.h>' 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
];

View File

@ -0,0 +1,65 @@
From d6e0cb60270e8653bda3f339e3a07ce2cd2d6eb0 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
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 <fpu_control.h>
+#include <fenv.h>
#endif
#include "glucose/mtl/IntTypes.h"
--
2.14.2

View File

@ -0,0 +1,65 @@
From 7f1016ceab9b0f57a935bd51ca6df3d18439b472 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
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 <fpu_control.h>
+#include <fenv.h>
#endif
#include "mtl/IntTypes.h"
--
2.14.2

View File

@ -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 <stdint.h>" 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

View File

@ -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/;

View File

@ -0,0 +1,65 @@
From 7f1016ceab9b0f57a935bd51ca6df3d18439b472 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
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 <fpu_control.h>
+#include <fenv.h>
#endif
#include "mtl/IntTypes.h"
--
2.14.2

View File

@ -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 = ''

View File

@ -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 ''

View File

@ -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".

View File

@ -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"

View File

@ -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"

View File

@ -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;

View File

@ -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;

View File

@ -0,0 +1,43 @@
commit 4c38abe0967bad78dd6baa61c86923e4d4b346d3
Author: Ben Gamari <ben@smart-cactus.org>
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,

View File

@ -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;

View File

@ -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" ];

View File

@ -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" ];

View File

@ -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 < ${

View File

@ -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' )
'';

View File

@ -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

View File

@ -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

View File

@ -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 ])
@ -129,14 +141,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

View File

@ -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

View File

@ -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 ++

View File

@ -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 = {
homepage = http://savannah.nongnu.org/projects/attr/;
description = "Library and tools for manipulating extended attributes";

View File

@ -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__ */

View File

@ -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}";

View File

@ -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;

View File

@ -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";

View File

@ -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; {

View File

@ -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}
'';
})

View File

@ -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

View File

@ -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 '<xlocale.h>' '<locale.h>'"
else null; # won't find locale_t on darwin

View File

@ -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 ];

View File

@ -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;
})

View File

@ -0,0 +1,13 @@
--- libdaemon-0.14.orig/examples/testd.c
+++ libdaemon-0.14/examples/testd.c
@@ -21,9 +21,9 @@
#include <signal.h>
#include <errno.h>
#include <string.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
-#include <sys/unistd.h>
#include <sys/select.h>
#include <libdaemon/dfork.h>

View File

@ -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 ];
};
}

View File

@ -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" ];

View File

@ -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

View File

@ -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}";

View File

@ -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" ];

View File

@ -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 ];

View File

@ -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 <libhashkit/common.h>
+#include <limits.h>
-#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 <libhashkit/common.h>
+#include <limits.h>
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 <algorithm>
#include <stdexcept>
-#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

View File

@ -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";

View File

@ -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 <sys/time.h>
#include <net/if.h>
-#if (__GLIBC__)
#include <netinet/if_ether.h>
#include <net/if_arp.h>
-#else
-#include <linux/if_arp.h>
-#include <linux/if_ether.h>
-#endif
#if (HAVE_PACKET_SOCKET)
#ifndef SOL_PACKET
#define SOL_PACKET 263
#endif /* SOL_PACKET */
-#if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1
#include <netpacket/packet.h>
#include <net/ethernet.h> /* the L2 protocols */
-#else
-#include <asm/types.h>
-#include <linux/if_packet.h>
-#include <linux/if_ether.h> /* The L2 protocols */
-#endif
#endif /* HAVE_PACKET_SOCKET */
#include "../include/libnet.h"

View File

@ -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 <nwmcsween@gmail.com>
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 <nwmcsween@gmail.com>
Date: Fri, 3 Apr 2015 22:04:46 +0000
Signed-off-by: Nathan McSween <nwmcsween@gmail.com>
---
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 <stdint.h>
#include <sys/socket.h> /* for sa_family_t */
#include <linux/netlink.h>
#include <libnfnetlink/linux_nfnetlink.h>
@@ -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 <stdint.h>
#include <linux/types.h>
#include <libnfnetlink/linux_nfnetlink_compat.h>
@@ -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 <stdint.h>
+
/* 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 <unistd.h>
+#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -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 <stdint.h>
+
+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 <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -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 <unistd.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
@@ -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 <stdint.h>
#include <linux/types.h>
#include <linux/rtnetlink.h>
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;
};

View File

@ -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 = ''

View File

@ -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 <sys/cdefs.h>
#include <features.h>
__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 <sys/cdefs.h>
#include <features.h>
/* 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 <sys/cdefs.h>
#include <features.h>
#include <rpc/rpc.h>

View File

@ -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;

View File

@ -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 <sys/cdefs.h>
#include <features.h>
#include <rpc/rpc.h>
#include <rpcsvc/nis_tags.h>
@@ -56,6 +57,34 @@
* <kukuk@suse.de>
*/
+#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

View File

@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
"--with-libiconv-prefix=${libiconv}"
];
doCheck = true;
doCheck = !stdenv.hostPlatform.isMusl;
enableParallelBuilding = true;

View File

@ -0,0 +1,45 @@
From 04437142399662b576bd55a85485c6dcc14d0812 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem at gmail.com>
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 <raj.khem at gmail.com>
---
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 <grp.h>
/* For SIGSEGV handler code */
+#ifdef __GLIBC__
#include <execinfo.h>
+#endif
#include <sys/ucontext.h>
#include <libunwind-coredump.h>
@@ -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

View File

@ -11,6 +11,7 @@ stdenv.mkDerivation rec {
patches = [
./version-1.2.1.patch
./backtrace-only-with-glibc.patch
];
nativeBuildInputs = [ autoreconfHook ];

View File

@ -14,6 +14,8 @@ stdenv.mkDerivation {
sha256 = "0nn5icrfm9lkhzw1xjvaks9bq3w6mjg86ggv3fn7kgi4nfvg8kj0";
};
patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ./fix-headers.patch;
meta = {
platforms = stdenv.lib.platforms.unix;
};

View File

@ -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 <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>

View File

@ -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

View File

@ -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" ];

View File

@ -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 <sys/stat.h>
#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 <endian.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN

View File

@ -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);

View File

@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
sha256 = "1hmkkp6vzyrh8v01c2ynzf9vwikyagp7p1lxhbnr4ysk3w66jji9";
};
doCheck = true;
meta = with stdenv.lib; {
description = "The New GNU Portable Threads Library";
longDescription = ''

View File

@ -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"

View File

@ -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

View File

@ -106,7 +106,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"

View File

@ -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 <sys/resource.h> // 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<size_t>(PTHREAD_STACK_MIN)),
+ static_cast<size_t>(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);

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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";

View File

@ -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

View File

@ -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/

View File

@ -0,0 +1,43 @@
From b577153a10c98f4e13405dc93ea2ab1a7b990e07 Mon Sep 17 00:00:00 2001
From: David Huffman <storedbox+alpine@outlook.com>
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 <stddef.h>
+// 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 <https://www.gnu.org/licenses>.
+//
+// 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

View File

@ -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 <stdint.h>' -i src/xdr_sizeof.c
'';

View File

@ -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; [

View File

@ -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 <windows.h>
#endif
-#if OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))
+#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__))
#include <cxxabi.h>
#include <dlfcn.h>
#include <execinfo.h>
@@ -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

View File

@ -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; {

View File

@ -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
'';

View File

@ -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";

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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}";

View File

@ -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 ];

View File

@ -13,6 +13,10 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses ];
prePatch = ''
sed -i '1i#include <fcntl.h>\n' save.c
'';
enableParallelBuilding = true;
preInstall = ''

View File

@ -15,6 +15,8 @@ stdenv.mkDerivation {
NIX_LDFLAGS = [ "-lSDL_image" ];
enableParallelBuilding = true;
configureFlags = [ "--disable-etc" ];
buildInputs = [ SDL SDL_image libxml2 libjpeg libpng mesa zlib ];

View File

@ -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'';

View File

@ -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 <sys/poll.h>,#include <poll.h>\n#include <limits.h>,' audisp/audispd.c
'';
meta = {
description = "Audit Library";
homepage = http://people.redhat.com/sgrubb/audit/;

View File

@ -87,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 ];

View File

@ -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";

View File

@ -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";

View File

@ -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;
};
}

View File

@ -0,0 +1,76 @@
{ stdenvNoCC, lib, buildPackages
, buildPlatform, hostPlatform
, fetchurl, perl
}:
assert hostPlatform.isLinux;
with hostPlatform.platform.kernelHeadersBaseConfig;
let
inherit (hostPlatform.platform) kernelHeadersBaseConfig;
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;
};
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"];
# "patches" array defaults to 'null' to avoid changing hash
# and causing mass rebuild
inherit patches;
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;
};
};
in {
linuxHeaders_4_4 = common {
version = "4.4.10";
sha256 = "1kpjvvd9q9wwr3314q5ymvxii4dv2d27295bzly225wlc552xhja";
};
linuxHeaders_4_15 = common {
version = "4.15";
sha256 = "0sd7l9n9h7vf9c6gd6ciji28hawda60yj0llh17my06m0s4lf9js";
};
}

View File

@ -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; {

View File

@ -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 = ''

View File

@ -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; {

Some files were not shown because too many files have changed in this diff Show More