nixpkgs/pkgs/development/libraries/libx86/default.nix
Tuomas Tynkkynen 5a5a5ade0f libx86: Add patch from debian to fix build on ARM
Without this, the build fails even with x86emu:

make LIBRARY=static static
make[1]: Entering directory '/tmp/nix-build-libx86-1.1.drv-0/libx86-1.1'
gcc -O2 -Wall -DDEBUG -g   -c -o x86-common.o x86-common.c
gcc -O2 -Wall -DDEBUG -g   -c -o thunk.o thunk.c
thunk.c: In function 'x_inb':
thunk.c:40:9: error: impossible constraint in 'asm'
         __asm__ __volatile__("in" #bwl " %w1, %" #bw "0" : "=a"(value) : "Nd"(port)); \
         ^
thunk.c:44:1: note: in expansion of macro '__BUILDIO'
 __BUILDIO(b,b,char)
 ^
<builtin>: recipe for target 'thunk.o' failed
make[1]: *** [thunk.o] Error 1
make[1]: Leaving directory '/tmp/nix-build-libx86-1.1.drv-0/libx86-1.1'
Makefile:17: recipe for target 'default' failed
make: *** [default] Error 2
2015-06-15 17:49:35 +02:00

39 lines
994 B
Nix

a :
let
s = import ./src-for-default.nix;
buildInputs = with a; [
];
in
rec {
src = a.fetchUrlFromSrcInfo s;
inherit (s) name;
inherit buildInputs;
phaseNames = ["doPatch" "fixX86Def" "killUsr" "doMakeInstall"];
patches = [./constants.patch ./non-x86.patch];
# using BACKEND=x86emu on 64bit systems fixes:
# http://www.mail-archive.com/suspend-devel@lists.sourceforge.net/msg02355.html
makeFlags = [
"DESTDIR=$out"
] ++ a.stdenv.lib.optionals ( a.stdenv.isx86_64 || a.stdenv.isArm ) [ "BACKEND=x86emu" ];
fixX86Def = a.fullDepEntry (''
sed -i lrmi.c -e 's@defined(__i386__)@(defined(__i386__) || defined(__x86_64__))@'
'') ["doUnpack" "minInit"];
killUsr = a.fullDepEntry (''
sed -e s@/usr@@ -i Makefile
'') ["doUnpack" "minInit"];
meta = {
description = "Real-mode x86 code emulator";
maintainers = [
a.lib.maintainers.raskin
];
platforms = with a.lib.platforms;
linux ++ freebsd ++ netbsd;
};
}