commit:     d332eb47396f2afcd46f59a3aeec3c962f860552
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  9 23:05:10 2020 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Feb  9 23:05:10 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d332eb47

dev-libs/libx86emu: Port to EAPI 7

Closes: https://bugs.gentoo.org/684466
Closes: https://bugs.gentoo.org/706558
Package-Manager: Portage-2.3.88, Repoman-2.3.20
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 .../files/libx86emu-1.1-fix-makefile.patch         | 82 ++++++++++++++++++++++
 .../files/libx86emu-1.1-gcc10-fno-common.patch     | 13 ++++
 dev-libs/libx86emu/libx86emu-1.1.ebuild            | 28 +++-----
 3 files changed, 104 insertions(+), 19 deletions(-)

diff --git a/dev-libs/libx86emu/files/libx86emu-1.1-fix-makefile.patch 
b/dev-libs/libx86emu/files/libx86emu-1.1-fix-makefile.patch
new file mode 100644
index 00000000000..6e565340e67
--- /dev/null
+++ b/dev-libs/libx86emu/files/libx86emu-1.1-fix-makefile.patch
@@ -0,0 +1,82 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1,15 +1,4 @@
+-ARCH  := $(shell uname -m)
+-ifneq ($(filter i386 i486 i586 i686, $(ARCH)),)
+-ARCH  := i386
+-endif
+-
+-CC    = gcc
+-CFLAGS        = -g -O2 -fPIC -fomit-frame-pointer -Wall
+-ifneq ($(filter x86_64, $(ARCH)),)
+-LIBDIR        = /usr/lib64
+-else
+-LIBDIR        = /usr/lib
+-endif
++CFLAGS        += -fPIC -Wall
+ LIBX86        = libx86emu
+ 
+ VERSION               := $(shell cat VERSION)
+@@ -24,9 +13,6 @@
+ 
+ .PHONY: all shared install test clean
+ 
+-%.o: %.c
+-      $(CC) -c $(CFLAGS) $<
+-
+ all: shared
+ 
+ shared: $(LIB_NAME)
+@@ -38,13 +24,15 @@
+       install -m 644 -D include/x86emu.h $(DESTDIR)/usr/include/x86emu.h
+ 
+ $(LIB_NAME): .depend $(OBJS)
+-      $(CC) -shared -Wl,-soname,$(LIB_SONAME) $(OBJS) -o $(LIB_NAME)
++      $(CC) $(LDFLAGS) -shared -Wl,-soname,$(LIB_SONAME) $(OBJS) -o 
$(LIB_NAME)
++      ln -snf $(LIB_NAME) $(LIB_SONAME)
++      ln -snf $(LIB_SONAME) $(LIBX86).so
+ 
+-test:
+-      make -C test
++check:
++      $(MAKE) -C test
+ 
+ clean:
+-      make -C test clean
++      $(MAKE) -C test clean
+       rm -f *.o *~ include/*~ *.so.* .depend
+ 
+ ifneq "$(MAKECMDGOALS)" "clean"
+--- a/test/Makefile
++++ b/test/Makefile
+@@ -1,9 +1,10 @@
+-CC         = gcc
+-CFLAGS     = -g -Wall -fomit-frame-pointer -O2
++CFLAGS         += -fPIC -Wall
++CPPFLAGS += -I../include
+ TST_FILES  = $(wildcard *.tst)
+ INIT_FILES = $(addsuffix .init,$(basename $(wildcard *.tst)))
+ RES_FILES  = $(addsuffix .result,$(basename $(wildcard *.tst)))
+ TEST_OPTS  = --verbose --show code,regs,data,acc,io,ints,attr,time
++LDLIBS = -L.. -lx86emu
+ 
+ .PHONY: all test clean
+ .SECONDARY: $(INIT_FILES)
+@@ -12,13 +13,12 @@
+ 
+ all: x86test
+       @./prepare_test *.tst
+-      @./x86test $(TEST_OPTS) *.init
++      @LD_LIBRARY_PATH=.. ./x86test $(TEST_OPTS) *.init
+ 
+-x86test: x86test.c
+-      $(CC) $(CFLAGS) $< -lx86emu -o $@
++x86test: x86test.o
+ 
+-%.result: %.init
+-      @./x86test $(TEST_OPTS) $<
++%.result: %.init x86test
++      @LD_LIBRARY_PATH=.. ./x86test $(TEST_OPTS) $<
+ 
+ %.init: %.tst
+       @./prepare_test $<

diff --git a/dev-libs/libx86emu/files/libx86emu-1.1-gcc10-fno-common.patch 
b/dev-libs/libx86emu/files/libx86emu-1.1-gcc10-fno-common.patch
new file mode 100644
index 00000000000..8d69e874523
--- /dev/null
+++ b/dev-libs/libx86emu/files/libx86emu-1.1-gcc10-fno-common.patch
@@ -0,0 +1,13 @@
+--- a/include/ops.h
++++ b/include/ops.h
+@@ -39,8 +39,8 @@
+ #ifndef __X86EMU_OPS_H
+ #define __X86EMU_OPS_H
+ 
+-void (*x86emu_optab[0x100])(u8 op1) L_SYM;
+-void (*x86emu_optab2[0x100])(u8 op2) L_SYM;
++extern void (*x86emu_optab[0x100])(u8 op1) L_SYM;
++extern void (*x86emu_optab2[0x100])(u8 op2) L_SYM;
+ 
+ void decode_cond(int type) L_SYM;
+ 

diff --git a/dev-libs/libx86emu/libx86emu-1.1.ebuild 
b/dev-libs/libx86emu/libx86emu-1.1.ebuild
index b8392b9291f..21c131149a9 100644
--- a/dev-libs/libx86emu/libx86emu-1.1.ebuild
+++ b/dev-libs/libx86emu/libx86emu-1.1.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=4
+EAPI=7
 
-inherit multilib rpm toolchain-funcs
+inherit rpm toolchain-funcs
 
 DESCRIPTION="A library for emulating x86"
 HOMEPAGE="https://www.opensuse.org/";
@@ -12,24 +12,14 @@ 
SRC_URI="https://download.opensuse.org/source/factory/repo/oss/suse/src/${P}-9.8
 LICENSE="HPND"
 SLOT="0"
 KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
-IUSE=""
 
-src_prepare() {
-       sed -i \
-               -e 's:$(CC) -shared:& $(LDFLAGS):' \
-               Makefile || die
-}
-
-src_compile() {
-       emake CC="$(tc-getCC)" CFLAGS="${CFLAGS} -fPIC -Wall"
-}
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.1-fix-makefile.patch
+       "${FILESDIR}"/${PN}-1.1-gcc10-fno-common.patch
+)
 
-src_test() {
-       ln -sf libx86emu.so.1.1 libx86emu.so || die
-       ln -sf libx86emu.so.1.1 libx86emu.so.1 || die
-       emake \
-               CC="$(tc-getCC)" \
-               CFLAGS="${CFLAGS} ${LDFLAGS} -Wl,-rpath,${S} -fPIC -Wall 
-I../include/ -L../" test
+src_configure() {
+       tc-export CC
 }
 
 src_install() {

Reply via email to