From b5b7586ac82433d1690a2348e316b461dc1d8b6f Mon Sep 17 00:00:00 2001
Package: v86d
Version: 0.1.5-1
From: Guillem Jover <guillem@hadrons.org>
Date: Sat, 5 Jul 2008 17:50:58 +0300
Debbug: 489415
Status: applied
Subject: [PATCH] Use external libx86 instead of embedded lrmi and x86emu

---
 Makefile                 |   27 ++++-----------------------
 README                   |    3 ---
 configure                |   17 -----------------
 debian/control           |    2 +-
 debian/lintian-overrides |    2 --
 debian/rules             |    2 +-
 v86_lrmi.c               |    2 +-
 7 files changed, 7 insertions(+), 48 deletions(-)
 delete mode 100644 debian/lintian-overrides

diff --git a/Makefile b/Makefile
index 84da0c5..f7083dd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 config_opt = $(shell if [ -e config.h -a -n "`egrep '^\#define[[:space:]]+$(1)([[:space:]]+|$$)' config.h 2>/dev/null`" ]; then echo true ; fi)
 
-.PHONY: clean install install_testvbe x86emu lrmi
+.PHONY: clean install install_testvbe
 
 INSTALL = install
 KDIR   ?= /lib/modules/$(shell uname -r)/source
@@ -12,19 +12,8 @@ endif
 CFLAGS ?= -Wall -g -O2
 CFLAGS += -I$(KDIR)/include
 
-ifeq ($(call config_opt,CONFIG_X86EMU),true)
-	CFLAGS += -Ilibs/x86emu
-	LDFLAGS += -Llibs/x86emu
-	LDLIBS += -lx86emu
-	V86OBJS = v86_x86emu.o v86_mem.o
-	V86LIB = x86emu
-else
-	CFLAGS += -Ilibs/lrmi-0.10
-	LDFLAGS += -Llibs/lrmi-0.10 -static
-	LDLIBS += -llrmi
-	V86OBJS = v86_lrmi.o
-	V86LIB = lrmi
-endif
+LDLIBS += -lx86
+V86OBJS = v86_lrmi.o
 
 DEBUG_BUILD =
 DEBUG_INSTALL =
@@ -34,7 +23,7 @@ ifeq ($(call config_opt,CONFIG_DEBUG),true)
 	DEBUG_INSTALL += install_testvbe
 endif
 
-all: $(V86LIB) v86d $(DEBUG_BUILD)
+all: v86d $(DEBUG_BUILD)
 
 %.o: %.c v86.h
 	$(CC) $(CFLAGS) -c -o $@ $<
@@ -45,16 +34,8 @@ v86d: v86.o v86_common.o $(V86OBJS)
 testvbe: testvbe.o v86_common.o $(V86OBJS)
 	$(CC) $(LDFLAGS) $+ $(LDLIBS) -o $@
 
-x86emu:
-	make -w -C libs/x86emu
-
-lrmi:
-	make -e -w -C libs/lrmi-0.10 liblrmi.a
-
 clean:
 	rm -rf *.o v86d testvbe
-	$(MAKE) -w -C libs/lrmi-0.10 clean
-	$(MAKE) -w -C libs/x86emu clean
 
 distclean: clean
 	rm -rf config.h
diff --git a/README b/README
index 178c004..c1b02f8 100644
--- a/README
+++ b/README
@@ -38,9 +38,6 @@ software-emulated environment (x86emu) or a virtualized
 environment (vm86) supported by the CPU.  On other arches
 or 64-bit systems, the code is always run by x86emu.
 
-To choose the x86emu backend on a x86 system, run ./configure
---with-x86emu.
-
 4. Installation & Usage
 -----------------------
 To configure, build and install v86d with the default settings,
diff --git a/configure b/configure
index cbbd6b3..3a6b926 100755
--- a/configure
+++ b/configure
@@ -17,23 +17,6 @@ copt_debug_desc="Use additional debugging features"
 copt_debug_type="bool"
 copt_debug_def=n
 
-copt_x86emu=CONFIG_X86EMU
-copt_x86emu_desc="Use x86emu for BIOS calls"
-copt_x86emu_type="bool"
-copt_x86emu_def=auto
-copt_x86emu_test()
-{
-	local m=`uname -m`
-	if [ "$m" = "i686" -o "$m" = "i586" -o "$m" = "i486" -o "$m" = "i386" ]; then
-		echo "n";
-	elif [ "$m" = "x86_64" ]; then
-		echo "y";
-	else
-		echo "It looks like your architecture '$m' isn't supported by this version of v86d." >&2
-		exit 1
-	fi
-}
-
 options=`set | grep '^copt_' | sed -re 's/copt_([^_=]+)[_=].*/\1/' | uniq`
 
 write_conf()
diff --git a/debian/control b/debian/control
index bd03e0f..7526dfd 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: v86d
 Section: utils
 Priority: optional
 Maintainer: Evgeni Golov <sargentd@die-welt.net>
-Build-Depends: debhelper (>= 5)
+Build-Depends: debhelper (>= 5), libx86-dev
 Standards-Version: 3.8.0
 Homepage: http://dev.gentoo.org/~spock/projects/uvesafb/
 
diff --git a/debian/lintian-overrides b/debian/lintian-overrides
deleted file mode 100644
index 57e25ba..0000000
--- a/debian/lintian-overrides
+++ /dev/null
@@ -1,2 +0,0 @@
-# v86d is called by the kernel at a time, when some libs may be unavailable
-v86d binary: statically-linked-binary
diff --git a/debian/rules b/debian/rules
index a701a42..69c2763 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,7 +6,7 @@
 config: config-stamp
 config-stamp: configure
 	dh_testdir
-	./configure --with-x86emu
+	./configure --default
 	# Debian's klibc has no UVESAFB support yet, as soon 2.6.26
 	# enters unstable and klibc is rebuilt against it, we can
 	# enable the following option:
diff --git a/v86_lrmi.c b/v86_lrmi.c
index 61f6bf5..ea5fafe 100644
--- a/v86_lrmi.c
+++ b/v86_lrmi.c
@@ -1,5 +1,5 @@
 #include <string.h>
-#include <lrmi.h>
+#include <libx86.h>
 #include "v86.h"
 
 /* Memory access functions */
-- 
1.5.6

