commit:     60c042fa6d30842870a81da6090fc39960304a27
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  5 21:36:33 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Jul  5 21:37:01 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=60c042fa

app-emulation/dosemu: workaround ld.gold linking bug #618366

Reported-by: Martin Väth
Bug: https://bugs.gentoo.org/618366
Bug: https://sourceware.org/PR21518
Package-Manager: Portage-2.3.6, Repoman-2.3.2

 .../dosemu/dosemu-1.4.1_pre20130107-r4.ebuild      | 103 +++++++++++++++++++++
 .../dosemu-1.4.1_pre20130107-fix-inline.patch      |  14 +++
 .../dosemu-1.4.1_pre20130107-ia16-ldflags.patch    |  45 +++++++++
 3 files changed, 162 insertions(+)

diff --git a/app-emulation/dosemu/dosemu-1.4.1_pre20130107-r4.ebuild 
b/app-emulation/dosemu/dosemu-1.4.1_pre20130107-r4.ebuild
new file mode 100644
index 00000000000..67e228d9794
--- /dev/null
+++ b/app-emulation/dosemu/dosemu-1.4.1_pre20130107-r4.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools eutils flag-o-matic pax-utils toolchain-funcs
+
+P_FD="dosemu-freedos-1.0-bin"
+COMMIT="15cfb41ff20a052769d753c3262c57ecb050ad71"
+
+DESCRIPTION="DOS Emulator"
+HOMEPAGE="http://www.dosemu.org/";
+SRC_URI="mirror://sourceforge/dosemu/${P_FD}.tgz
+       
https://sourceforge.net/code-snapshots/git/d/do/dosemu/code.git/dosemu-code-${COMMIT}.zip
 -> ${P}.zip"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE="X svga gpm debug alsa sndfile fluidsynth"
+
+RDEPEND="X? ( x11-libs/libX11
+               x11-libs/libXxf86vm
+               x11-libs/libXau
+               x11-libs/libXext
+               x11-libs/libXdmcp
+               x11-apps/xset
+               x11-apps/xlsfonts
+               x11-apps/bdftopcf
+               x11-apps/mkfontdir )
+       svga? ( media-libs/svgalib )
+       gpm? ( sys-libs/gpm )
+       alsa? ( media-libs/alsa-lib )
+       sndfile? ( media-libs/libsndfile )
+       fluidsynth? ( media-sound/fluidsynth
+               media-sound/fluid-soundfont )
+       media-libs/libsdl
+       >=sys-libs/slang-1.4"
+
+DEPEND="${RDEPEND}
+       X? ( x11-proto/xf86dgaproto )
+       >=sys-devel/autoconf-2.57"
+
+S="${WORKDIR}/${PN}-code-${COMMIT}"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-fortify.patch
+       "${FILESDIR}"/${PN}-1.4.1_pre20091009-dash.patch
+       "${FILESDIR}"/${P}-no-glibc.patch
+       "${FILESDIR}"/${P}-flex-2.6.3.patch
+       "${FILESDIR}"/${P}-ia16-ldflags.patch
+       "${FILESDIR}"/${P}-fix-inline.patch
+)
+
+src_prepare() {
+       default
+
+       # Has problems with -O3 on some systems
+       replace-flags -O[3-9] -O2
+
+       # This one is from media-sound/fluid-soundfont (bug #479534)
+       sed 
"s,/usr/share/soundfonts/default.sf2,${EPREFIX}/usr/share/sounds/sf2/FluidR3_GM.sf2,"\
+               -i src/plugin/fluidsynth/mid_o_flus.c || die
+
+       eautoreconf
+}
+
+src_configure() {
+       # workaround binutils ld.gold bug #618366
+       local nopie_flag=
+       if tc-enables-pie; then
+               if gcc-specs-pie; then
+                       # before gcc got upstream support for '-no-pie'
+                       nopie_flag=-nopie
+               else
+                       nopie_flag=-no-pie
+               fi
+       fi
+
+       econf $(use_with X x) \
+               $(use_with svga svgalib) \
+               $(use_enable debug) \
+               $(use_with gpm) \
+               $(use_with alsa) \
+               $(use_with sndfile) \
+               $(use_with fluidsynth) \
+               --with-fdtarball="${DISTDIR}"/${P_FD}.tgz \
+               --sysconfdir="${EPREFIX}"/etc/dosemu/ \
+               --with-docdir="${EPREFIX}"/usr/share/doc/${PF} \
+               IA16_LDFLAGS_EXTRA=${nopie_flag}
+}
+
+src_compile() {
+       emake AR=$(tc-getAR)
+}
+
+src_install() {
+       default
+
+       # r - randmmap: dosemu tries to get address mapping
+       #     exactly where asked, loops otherwise.
+       # m - allow RWX mapping: as it's an emulator / code loader
+       pax-mark -mr "${ED}/usr/bin/dosemu.bin"
+}

diff --git 
a/app-emulation/dosemu/files/dosemu-1.4.1_pre20130107-fix-inline.patch 
b/app-emulation/dosemu/files/dosemu-1.4.1_pre20130107-fix-inline.patch
new file mode 100644
index 00000000000..9a515941b81
--- /dev/null
+++ b/app-emulation/dosemu/files/dosemu-1.4.1_pre20130107-fix-inline.patch
@@ -0,0 +1,14 @@
+diff --git a/src/dosext/sound/sound.c b/src/dosext/sound/sound.c
+index f33f78f..f429362 100644
+--- a/src/dosext/sound/sound.c
++++ b/src/dosext/sound/sound.c
+@@ -173,3 +173,3 @@ void sb_cms_write (ioport_t port, Bit8u value);
+ 
+-inline void sb_mixer_register_write (Bit8u value);
++static inline void sb_mixer_register_write (Bit8u value);
+ void sb_mixer_data_write (Bit8u value);
+@@ -840,3 +840,3 @@ void sb_cms_write (ioport_t port, Bit8u value)
+ 
+-inline void sb_mixer_register_write (Bit8u value)
++static inline void sb_mixer_register_write (Bit8u value)
+ {

diff --git 
a/app-emulation/dosemu/files/dosemu-1.4.1_pre20130107-ia16-ldflags.patch 
b/app-emulation/dosemu/files/dosemu-1.4.1_pre20130107-ia16-ldflags.patch
new file mode 100644
index 00000000000..0e2393cc274
--- /dev/null
+++ b/app-emulation/dosemu/files/dosemu-1.4.1_pre20130107-ia16-ldflags.patch
@@ -0,0 +1,45 @@
+Add a @IA16_LDFLAGS_EXTRA@ environment variable
+to be able to pass through -no-pie.
+
+It's a workaround for binutils ld.gold bug:
+https://bugs.gentoo.org/618366
+diff --git a/Makefile.conf.in b/Makefile.conf.in
+index cd4b34d..cc29931 100644
+--- a/Makefile.conf.in
++++ b/Makefile.conf.in
+@@ -55,2 +55,4 @@ ALL_LDFLAGS:=@DOSEMU_LDFLAGS@ ${LDFLAGS}
+ DOSBIN_LDFLAGS:=@DOSBIN_LDFLAGS@
++# flags to "link" 16-bit .com files
++IA16_LDFLAGS:=-Wl,-Ttext,0x100,-e,_start16,--oformat,binary -nostdlib -s 
@IA16_LDFLAGS_EXTRA@
+ LIBS:=@LIBS@
+diff --git a/configure.ac b/configure.ac
+index 0f06f57..a86208e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -604,2 +604,3 @@ AC_SUBST(X_LIBS)
+ AC_SUBST(X_CFLAGS)
++AC_SUBST(IA16_LDFLAGS_EXTRA)
+ 
+diff --git a/src/commands/Makefile b/src/commands/Makefile
+index 3139b85..c5c4607 100644
+--- a/src/commands/Makefile
++++ b/src/commands/Makefile
+@@ -56,3 +56,3 @@ dosbin: $(COM1) $(COM2) $(SYS)
+ $(D)/%.sys: %.o
+-      $(LD) $(ALL_LDFLAGS) -Wl,-Ttext,0,-e,_start16,--oformat,binary 
-nostdlib -s -o $@ $<
++      $(LD) $(ALL_LDFLAGS) $(IA16_LDFLAGS) -o $@ $<
+       chmod -x $@ 
+@@ -60,3 +60,3 @@ $(D)/%.sys: %.o
+ $(D)/%.com: %.o
+-      $(LD) $(ALL_LDFLAGS) -Wl,-Ttext,100,-e,_start16,--oformat,binary 
-nostdlib -s -o $@ $<
++      $(LD) $(ALL_LDFLAGS) $(IA16_LDFLAGS) -o $@ $<
+       chmod -x $@
+diff --git a/src/plugin/commands/Makefile b/src/plugin/commands/Makefile
+index 48f49d5..d3a5667 100644
+--- a/src/plugin/commands/Makefile
++++ b/src/plugin/commands/Makefile
+@@ -57,3 +57,3 @@ $(STUBFULL): $(D)/generic.com ./mkcomstub
+ $(D)/%.com: %.o
+-      $(LD) $(ALL_LDFLAGS) -Wl,-Ttext,0x100,-e,_start16,--oformat,binary 
-nostdlib -s -o $@ $<
++      $(LD) $(ALL_LDFLAGS) $(IA16_LDFLAGS) -o $@ $<
+       chmod -x $@

Reply via email to