about summary refs log tree commit diff
path: root/pkgs/development/libraries/libx86
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2015-05-18 01:40:26 +0300
committerBjørn Forsman <bjorn.forsman@gmail.com>2015-06-15 17:49:35 +0200
commit5a5a5ade0fcc9317a7c75bde424aab3f32065e30 (patch)
treee0f8d6e1ce962eb751d9d2493c1e7f16b0074d4a /pkgs/development/libraries/libx86
parentdbf1e0fb53090bb888b0b759c5676329551dc77e (diff)
downloadnixlib-5a5a5ade0fcc9317a7c75bde424aab3f32065e30.tar
nixlib-5a5a5ade0fcc9317a7c75bde424aab3f32065e30.tar.gz
nixlib-5a5a5ade0fcc9317a7c75bde424aab3f32065e30.tar.bz2
nixlib-5a5a5ade0fcc9317a7c75bde424aab3f32065e30.tar.lz
nixlib-5a5a5ade0fcc9317a7c75bde424aab3f32065e30.tar.xz
nixlib-5a5a5ade0fcc9317a7c75bde424aab3f32065e30.tar.zst
nixlib-5a5a5ade0fcc9317a7c75bde424aab3f32065e30.zip
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
Diffstat (limited to 'pkgs/development/libraries/libx86')
-rw-r--r--pkgs/development/libraries/libx86/default.nix4
-rw-r--r--pkgs/development/libraries/libx86/non-x86.patch38
2 files changed, 40 insertions, 2 deletions
diff --git a/pkgs/development/libraries/libx86/default.nix b/pkgs/development/libraries/libx86/default.nix
index 09cc623cbb19..011e936548a8 100644
--- a/pkgs/development/libraries/libx86/default.nix
+++ b/pkgs/development/libraries/libx86/default.nix
@@ -12,13 +12,13 @@ rec {
   inherit buildInputs;
 
   phaseNames = ["doPatch" "fixX86Def" "killUsr" "doMakeInstall"];
-  patches = [./constants.patch];
+  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.system == "x86_64-linux" ) [ "BACKEND=x86emu" ]; 
+  ] ++ 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__))@'
diff --git a/pkgs/development/libraries/libx86/non-x86.patch b/pkgs/development/libraries/libx86/non-x86.patch
new file mode 100644
index 000000000000..0d41cd737f01
--- /dev/null
+++ b/pkgs/development/libraries/libx86/non-x86.patch
@@ -0,0 +1,38 @@
+diff -Naur libx86-1.1+ds1.orig/Makefile libx86-1.1+ds1/Makefile
+--- libx86-1.1+ds1.orig/Makefile	2008-05-19 12:28:59.000000000 +0300
++++ libx86-1.1+ds1/Makefile	2012-02-20 01:32:03.750068423 +0200
+@@ -5,6 +5,7 @@
+ ifeq ($(BACKEND),x86emu)
+ 	OBJECTS += thunk.o x86emu/decode.o x86emu/debug.o x86emu/fpu.o \
+ 	x86emu/ops.o x86emu/ops2.o x86emu/prim_ops.o x86emu/sys.o
++	CFLAGS += -DX86EMU
+ else
+ 	OBJECTS += lrmi.o
+ endif
+diff -Naur libx86-1.1+ds1.orig/thunk.c libx86-1.1+ds1/thunk.c
+--- libx86-1.1+ds1.orig/thunk.c	2008-04-03 03:48:00.000000000 +0300
++++ libx86-1.1+ds1/thunk.c	2012-02-20 01:12:56.468820192 +0200
+@@ -32,6 +32,7 @@
+ #define TRUE 1
+ #define FALSE 0
+ 
++#ifndef X86EMU
+ #define __BUILDIO(bwl,bw,type) \
+ static inline void out##bwl##_local(unsigned long port, unsigned type value) {        __asm__ __volatile__("out" #bwl " %" #bw "0, %w1" : : "a"(value), "Nd"(port)); \
+ }\
+@@ -44,6 +45,15 @@
+ __BUILDIO(b,b,char)
+ __BUILDIO(w,w,short)
+ __BUILDIO(l,,int)
++#else
++/* use libc functions */
++#define inb_local inb
++#define inw_local inw
++#define inl_local inl
++#define outb_local outb
++#define outw_local outw
++#define outl_local outl
++#endif /* X86EMU */
+ 
+ 
+ char *mmap_addr = SHMERRORPTR;