commit:     4cecf6573056a9e6f6637e1acffbbe7bcb213eb9
Author:     Matoro Mahri <matoro_gentoo <AT> matoro <DOT> tk>
AuthorDate: Wed May  8 14:52:44 2024 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Wed May  8 19:26:14 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4cecf657

app-emulation/hercules-sdl: new package, add 4.7.0

Closes: https://bugs.gentoo.org/711068
Signed-off-by: Matoro Mahri <matoro_gentoo <AT> matoro.tk>
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 app-emulation/hercules-sdl/Manifest                |   1 +
 app-emulation/hercules-sdl/files/gen_hashes.sh     |  24 ++
 .../hercules-sdl/files/hercules-3.13-htmldir.patch |  25 ++
 .../files/hercules-3.13-posix-test.patch           |  29 ++
 .../files/hercules-3.13-unbundle-libltdl.patch     | 379 +++++++++++++++++++++
 .../files/hercules-3.13-user-install.patch         |  21 ++
 .../files/hercules-sdl-4.4.1-htmldir.patch         |  29 ++
 .../hercules-sdl-4.4.1-unbundle-libltdl.patch      | 179 ++++++++++
 .../hercules-sdl/hercules-sdl-4.7.0.ebuild         |  85 +++++
 app-emulation/hercules-sdl/metadata.xml            |  18 +
 10 files changed, 790 insertions(+)

diff --git a/app-emulation/hercules-sdl/Manifest 
b/app-emulation/hercules-sdl/Manifest
new file mode 100644
index 000000000000..ef0e4456cb66
--- /dev/null
+++ b/app-emulation/hercules-sdl/Manifest
@@ -0,0 +1 @@
+DIST hercules-sdl-4.7.tar.gz 25439384 BLAKE2B 
78a8d2df947c80e23d0e956a25a4f009dd32b09f2834cc06373f685badf9f1e657bf0f4e4408c7085371c46085718998076f3a6063caf80c9161b1fa7caa91eb
 SHA512 
9d7060c4e2687358b9547b59b47362d642cbf2bf009085fdd41e485170d0f81029ee3d04d12b905a3a266cd26a9087e92c231c3f4600c32a8535a6140656b7b0

diff --git a/app-emulation/hercules-sdl/files/gen_hashes.sh 
b/app-emulation/hercules-sdl/files/gen_hashes.sh
new file mode 100644
index 000000000000..bb499392a4a5
--- /dev/null
+++ b/app-emulation/hercules-sdl/files/gen_hashes.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+[[ -z "${1}" ]] && exit 1
+[[ "${1}" =~ [0-9]+\.[0-9]+\.[0-9]+ ]] || exit 1
+
+CLONEDIR="$(mktemp -d)"
+for f in "hyperion" "crypto" "decNumber" "SoftFloat" "telnet"
+do
+    git -C "${CLONEDIR}" clone --tags 
"https://github.com/SDL-Hercules-390/${f}";
+done
+
+VERSIONARR=( ${1//./ })
+VERSIONTAG="Release_${VERSIONARR[0]}.${VERSIONARR[1]}"
+[[ "${VERSIONARR[2]}" == "0" ]] || VERSIONTAG=".${VERSIONARR[2]}"
+RELEASEDATE="$(git -C "${CLONEDIR}/hyperion" show -s --format="%ci" 
"${VERSIONTAG}")"
+
+echo
+for f in "crypto" "decNumber" "SoftFloat" "telnet"
+do
+    echo -n "${f,,}: "
+    git -C "${CLONEDIR}/${f}" rev-list -n 1 --first-parent 
--before="${RELEASEDATE}" master
+done
+
+rm -rf "${CLONEDIR}"

diff --git a/app-emulation/hercules-sdl/files/hercules-3.13-htmldir.patch 
b/app-emulation/hercules-sdl/files/hercules-3.13-htmldir.patch
new file mode 100644
index 000000000000..962611b87edd
--- /dev/null
+++ b/app-emulation/hercules-sdl/files/hercules-3.13-htmldir.patch
@@ -0,0 +1,25 @@
+--- a/html/Makefile.am
++++ b/html/Makefile.am
+@@ -1,4 +1,4 @@
+-dist_pkgdata_DATA =   cckddasd.html fishgui.html  hercconf.html hercfaq.html  
   \
++dist_html_DATA =   cckddasd.html fishgui.html  hercconf.html hercfaq.html     
\
+         hercinst.html herclic.html  hercload.html hercmsca.html hercmscf.html 
 \
+         hercmscp.html hercmsct.html hercmscu.html hercmsda.html hercmsdc.html 
\
+         hercmsdg.html hercmsdi.html hercmsdl.html hercmsds.html hercmsdt.html 
\
+@@ -12,7 +12,7 @@
+ 
+ include_sources = include/header.htmlpart include/footer.htmlpart
+ 
+-include_pkgdatadir = $(pkgdatadir)/include
++include_pkgdatadir = $(htmldir)/include
+ 
+ dist_include_pkgdata_DATA = $(include_sources)
+ 
+@@ -33,6 +33,6 @@
+         images/interruptu.gif images/redu.gif images/waitonu.gif \
+         images/loadd.gif images/restartd.gif
+ 
+-images_pkgdatadir = $(pkgdatadir)/images
++images_pkgdatadir = $(htmldir)/images
+ 
+ dist_images_pkgdata_DATA = $(images_sources)

diff --git a/app-emulation/hercules-sdl/files/hercules-3.13-posix-test.patch 
b/app-emulation/hercules-sdl/files/hercules-3.13-posix-test.patch
new file mode 100644
index 000000000000..abee4b0cc5ed
--- /dev/null
+++ b/app-emulation/hercules-sdl/files/hercules-3.13-posix-test.patch
@@ -0,0 +1,29 @@
+https://github.com/rbowler/spinhawk/pull/106
+
+From 9a9f7182069b8fe0483383c177882218244bad16 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vap...@gentoo.org>
+Date: Thu, 18 Nov 2021 02:32:02 -0500
+Subject: [PATCH] avoid bashism in test call
+
+POSIX test only supports =, not ==.
+---
+ autoconf/hercules.m4 | 2 +-
+ configure.ac         | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index f12d47058562..8dd420af8d13 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -562,7 +562,7 @@ AC_CHECK_DECLS( SIOCADDRT,            
[hc_cv_have_siocaddrt=yes],           [hc_
+ AC_CHECK_DECLS( SIOCDELRT,            [hc_cv_have_siocdelrt=yes],           
[hc_cv_have_siocdelrt=no],           [#include <linux/sockios.h>] )
+ AC_CHECK_DECLS( SIOCDIFADDR,          [hc_cv_have_siocdifaddr=yes],         
[hc_cv_have_siocdifaddr=no],         [#include <linux/sockios.h>] )
+ 
+-if test "$hc_cv_have_sys_mtio_h" == "yes"; then
++if test "$hc_cv_have_sys_mtio_h" = "yes"; then
+     AC_CHECK_DECLS( MTEWARN,          [hc_cv_have_mtewarn=yes],             
[hc_cv_have_mtewarn=no],             [#include <sys/mtio.h>] )
+ else
+     hc_cv_have_mtewarn=no
+-- 
+2.33.0
+

diff --git 
a/app-emulation/hercules-sdl/files/hercules-3.13-unbundle-libltdl.patch 
b/app-emulation/hercules-sdl/files/hercules-3.13-unbundle-libltdl.patch
new file mode 100644
index 000000000000..c96831d96ad2
--- /dev/null
+++ b/app-emulation/hercules-sdl/files/hercules-3.13-unbundle-libltdl.patch
@@ -0,0 +1,379 @@
+--- a/bootstrap.c
++++ b/bootstrap.c
+@@ -11,7 +11,7 @@
+ #include "hstdinc.h"
+ #include "hercules.h"
+ #if defined(HDL_USE_LIBTOOL)
+-#include "ltdl.h"
++#include <ltdl.h>
+ #endif
+ 
+ #if !defined( _MSVC_ )
+--- a/configure.ac
++++ b/configure.ac
+@@ -12,7 +12,7 @@
+ AC_REVISION($Revision$)          # (the version of this configure.ac)
+ AC_CONFIG_AUX_DIR(autoconf)             # (directory containing auxillary 
build tools)
+ AM_INIT_AUTOMAKE(hercules,3.13)         # (the version of our software 
package)
+-AM_CONFIG_HEADER(config.h)              # (the file the resulting configure 
script will produce)
++AC_CONFIG_HEADERS(config.h)              # (the file the resulting configure 
script will produce)
+ AM_MAINTAINER_MODE()
+ AC_CANONICAL_HOST()                     # (sets $host_cpu, $host_vendor, and 
$host_os)
+ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+@@ -38,154 +38,8 @@
+ modexecdir='$(libdir)/$(PACKAGE)'
+ AC_SUBST(modexecdir)
+ 
+-
+-# 
-----------------------------------------------------------------------------
+-#
+-#  AC_LIBTOOL_DLOPEN
+-#
+-#       Enable checking for dlopen support. This macro should be used if the
+-#       package makes use of the '-dlopen' and '-dlpreopen' flags, otherwise
+-#       libtool will assume that the system does not support dlopening. The
+-#       macro must be called before AC_PROG_LIBTOOL.
+-#
+-# 
-----------------------------------------------------------------------------
+-
+-AC_LIBTOOL_DLOPEN()                     # (we need libtool's dlopen support)
+-
+-
+-# 
-----------------------------------------------------------------------------
+-#
+-#  AC_LIBTOOL_WIN32_DLL
+-#
+-#       This macro should be used if the package has been ported to build
+-#       clean dlls on win32 platforms. Usually this means that any library
+-#       data items are exported with __declspec(dllexport) and imported with
+-#       __declspec(dllimport). If this macro is not used, libtool will assume
+-#       that the package libraries are not dll clean and will build only 
static
+-#       libraries on win32 hosts.
+-#
+-#       This macro must be called before AC_PROG_LIBTOOL, and provision must
+-#       be made to pass '-no-undefined' to libtool in link mode from the 
package
+-#       Makefile. Naturally, if you pass '-no-undefined', you must ensure that
+-#       all the library symbols really are defined at link time!
+-#
+-# 
-----------------------------------------------------------------------------
+-
+-AC_LIBTOOL_WIN32_DLL()                  # (we need Win32 support in libtool)
+-
+-
+-# 
-----------------------------------------------------------------------------
+-#  See: 'AC_PROG_LIBTOOL' below.
+-# 
-----------------------------------------------------------------------------
+-
+-AC_DISABLE_STATIC()                     # (forces libtool to build shared
+-
+-                                        #  libraries instead of static ones)
+-# 
-----------------------------------------------------------------------------
+-#  AC_PROG_LIBTOOL
+-#
+-#       Add support for the '--enable-shared' and '--disable-shared'
+-#       configure flags. By default, this macro turns on shared libraries
+-#       if they are available, and also enables static libraries if they
+-#       don't conflict with the shared libraries. You can modify these
+-#       defaults by calling either the AC_DISABLE_SHARED or AC_DISABLE_STATIC
+-#       macros.
+-#
+-#       Hercules REQUIRES shared libraries (i.e. DLLs), so we do indeed use
+-#       the AC_DISABLE_STATIC macro above.
+-#
+-# 
-----------------------------------------------------------------------------
+-
+-AC_PROG_LIBTOOL()                       # (we build libtool for ourselves)
+-
+-
+-# 
-----------------------------------------------------------------------------
+-#
+-#  AC_LIB_LTDL
+-#
+-#       Even though libltdl is installed together with libtool, you may wish
+-#       to include libltdl in the distribution of your package, for the 
convenience
+-#       of users of your package that don't have libtool or libltdl installed.
+-#
+-#       The most simplistic way to add libltdl to your package is to copy the
+-#       source files, 'ltdl.c' and 'ltdl.h', to a source directory withing 
your
+-#       package and to build and link them along with the rest of your 
sources.
+-#
+-#       To do this, you must add a call to the 'AC_LIB_LTDL' macro to your 
package's
+-#       'configure.in' to perform the required configure time checks in order 
that
+-#       'ltdl.o' is built correctly.
+-#
+-#       This method does have its problems though: if you try to link the 
package
+-#       binaries with an installed libltdl, or a library which depends on 
libltdl,
+-#       you may have problems with duplicate symbol definitions.
+-#
+-#       In order to enable this flavor of libltdl, you should add the line
+-#       'AC_LIBLTDL_CONVENIENCE' to your `configure.in', before 
'AC_PROG_LIBTOOL'.
+-#
+-#       In order to select the installable version of libltdl, you should add 
a
+-#       call of the macro 'AC_LIBLTDL_INSTALLABLE' to your 'configure.in' 
before
+-#       'AC_PROG_LIBTOOL'. This macro will check whether libltdl is already
+-#       installed and, if not, request the libltdl embedded in your package 
to be
+-#       built and installed.
+-#
+-#       Whatever macro you use, it is up to you to ensure that your 
'configure.in'
+-#       will configure libltdl, using 'AC_CONFIG_SUBDIRS', and that your 
'Makefile's
+-#       will start sub-makes within libltdl's directory, using automake's 
SUBDIRS,
+-#       for example. Both macros define the shell variables LIBLTDL, to the 
link flag
+-#       that you should use to link with libltdl, and LTDLINCL, to the 
preprocessor
+-#       flag that you should use to compile with programs that include 
'ltdl.h'. It
+-#       is up to you to use 'AC_SUBST' to ensure that this variable will be 
available
+-#       in 'Makefile's, or add them to variables that are 'AC_SUBST'ed by 
default,
+-#       such as LIBS and CPPFLAGS.
+-#
+-#       So, when you want to link a program with libltdl, be it a convenience,
+-#       installed or installable library, just compile with '$(LTDLINCL)' and 
link
+-#       it with '$(LIBLTDL)', using libtool.
+-#
+-#       You should probably also add 'AC_LIBTOOL_DLOPEN' to your 
'configure.in' before
+-#       'AC_PROG_LIBTOOL', otherwise libtool will assume no dlopening 
mechanism is
+-#       supported, and revert to dlpreopening, which is probably not what you 
want.
+-#
+-#       The following example shows you how to embed the convenience libltdl
+-#       in your package. In order to use the installable variant just replace
+-#       'AC_LIBLTDL_CONVENIENCE' with 'AC_LIBLTDL_INSTALLABLE'. We assume 
that libltdl
+-#       was embedded using 'libtoolize --ltdl':
+-#
+-#           configure.in:
+-#
+-#               ...
+-#               dnl Enable building of the convenience library
+-#               dnl and set LIBLTDL accordingly
+-#               AC_LIBLTDL_CONVENIENCE
+-#               dnl Substitute LTDLINCL and LIBLTDL in the Makefiles
+-#               AC_SUBST(LTDLINCL)
+-#               AC_SUBST(LIBLTDL)
+-#               dnl Check for dlopen support
+-#               AC_LIBTOOL_DLOPEN
+-#               dnl Configure libtool
+-#               AC_PROG_LIBTOOL
+-#               dnl Configure libltdl
+-#               AC_CONFIG_SUBDIRS(libltdl)
+-#               ...
+-#
+-#           Makefile.am:
+-#
+-#               ...
+-#               SUBDIRS = libltdl
+-#
+-#               INCLUDES = $(LTDLINCL)
+-#
+-#               myprog_LDFLAGS = -export-dynamic
+-#               # The quotes around -dlopen below fool automake <= 1.4 into 
accepting it
+-#               myprog_LDADD = $(LIBLTDL) "-dlopen" self "-dlopen" foo1.la
+-#               myprog_DEPENDENCIES = $(LIBLTDL) foo1.la
+-#               ...
+-#
+-# 
-----------------------------------------------------------------------------
+-
+-AC_LIB_LTDL()                           # (we need the ltdl libtool library)
+-AC_SUBST([LIBTOOL_DEPS])                # (see PROGRAMMING NOTE above)
+-
++LT_PREREQ([2.2.6])
++LT_INIT([dlopen win32-dll disable-static])
+ 
+ # 
-----------------------------------------------------------------------------
+ # (See comments in the 'AC_CHECK_LIB' Libraries section further below)
+--- a/crypto/Makefile.am
++++ b/crypto/Makefile.am
+@@ -23,7 +23,6 @@
+ 
+ if OPTION_DYNAMIC_LOAD
+   DYNSRC         =
+-  LTDL           = ../ltdl.c
+ 
+   DYNMOD_LD_FLAGS = -module         \
+                    -no-undefined   \
+@@ -31,7 +30,7 @@
+                    -export-dynamic \
+                    -avoid-version
+ 
+-  DYNMOD_LD_ADD   = $(LDADD)
++  DYNMOD_LD_ADD   = $(LDADD) -lltdl
+ 
+   LIB_LD_FLAGS    = -export-dynamic  \
+                    $(XSTATIC)       \
+@@ -39,7 +38,6 @@
+                    -avoid-version
+ else
+   DYNSRC         = $(dyndev_SRC)
+-  LTDL           =
+   DYNMOD_LD_FLAGS =
+   DYNMOD_LD_ADD =
+   LIB_LD_FLAGS    = $(XSTATIC)    \
+--- a/decNumber/Makefile.am
++++ b/decNumber/Makefile.am
+@@ -37,13 +37,13 @@
+ endif
+ 
+ if OPTION_DYNAMIC_LOAD
+-  LTDL         = ../ltdl.c
++  LIB_LD_ADD      = -lltdl
+   LIB_LD_FLAGS    = -export-dynamic  \
+                  $(XSTATIC)       \
+                  -no-undefined    \
+                  -avoid-version
+ else
+-  LTDL         =
++  LIB_LD_ADD      =
+   LIB_LD_FLAGS    = $(XSTATIC)    \
+                  -no-undefined \
+                  -avoid-version
+@@ -56,7 +56,7 @@
+ 
+   libdecNumber_la_SOURCES = $(decNumber_SRC)
+   libdecNumber_la_LDFLAGS = $(LIB_LD_FLAGS)
+-  libdecNumber_la_LIBADD  = $(LDADD)
++  libdecNumber_la_LIBADD  = $(LDADD) $(LIB_LD_ADD)
+ 
+ noinst_HEADERS = decContext.h      \
+                decDPD.h          \
+--- a/fillfnam.c
++++ b/fillfnam.c
+@@ -5,6 +5,8 @@
+ #include "hercules.h"
+ #include "fillfnam.h"
+ 
++#include <dirent.h>
++
+ /* On Solaris 2.9 (SunOS 5.9) and earlier, there is no scandir
+    and alphasort function. In this case fillfnam does nothing
+    and the tab command is effectively a no-operation */
+--- a/herclin.c
++++ b/herclin.c
+@@ -26,7 +26,7 @@
+ /* This must be included if HDL uses the   */
+ /* libtool ltdl convenience library        */
+ 
+-#include "ltdl.h"
++#include <ltdl.h>
+ #endif
+ 
+ 
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -98,7 +98,7 @@
+ 
+ if OPTION_DYNAMIC_LOAD
+   DYNSRC         =
+-  LTDL           = ltdl.c
++  LIB_LD_ADD     = -lltdl
+ 
+   DYNMOD_LD_FLAGS = -module         \
+                    -no-undefined    \
+@@ -109,7 +109,8 @@
+   DYNMOD_LD_ADD   = libherc.la    \
+                    libhercs.la    \
+                    libhercu.la    \
+-                   $(LDADD)
++                   $(LDADD)       \
++                   $(LIB_LD_ADD)
+ 
+   LIB_LD_FLAGS    = -export-dynamic  \
+                    $(XSTATIC)        \
+@@ -117,7 +118,6 @@
+                    -avoid-version
+ else
+   DYNSRC         = $(dyndev_SRC)
+-  LTDL           =
+   DYNMOD_LD_FLAGS =
+   DYNMOD_LD_ADD =
+   LIB_LD_FLAGS    = $(XSTATIC)    \
+@@ -295,12 +295,11 @@
+                         memrchr.c    \
+                         parser.c     \
+                         pttrace.c    \
+-                        $(FTHREADS)  \
+-                        $(LTDL)
++                        $(FTHREADS)
+ 
+   libhercu_la_LDFLAGS = $(LIB_LD_FLAGS)
+ 
+-  libhercu_la_LIBADD  = $(LDADD) libhercs.la
++  libhercu_la_LIBADD  = $(LDADD) libhercs.la $(LIB_LD_ADD)
+ 
+ #
+ # Core Hercules (shared) library
+@@ -372,8 +371,7 @@
+                              memrchr.c        \
+                              $(dynamic_SRC)   \
+                              $(extra_SRC)     \
+-                             $(dyndev_SRC)    \
+-                             ltdl.c
++                             $(dyndev_SRC)
+ 
+   libherc_la_LDFLAGS = $(LIB_LD_FLAGS)
+ 
+@@ -383,7 +381,8 @@
+                       libhercd.la     \
+                       decNumber/libdecNumber.la \
+                       softfloat/libsoftfloat.la \
+-                      $(LDADD)
++                      $(LDADD) \
++                      $(LIB_LD_ADD)
+ 
+ #
+ # THIS is the hercules executable.
+@@ -440,7 +439,7 @@
+   hercules_SOURCES      = bootstrap.c  \
+                           hdlmain.c
+ 
+-  hercules_LDADD        = libherc.la libhercs.la $(LDADD)
++  hercules_LDADD        = libherc.la libhercs.la $(LDADD) $(LIB_LD_ADD)
+ 
+   hercules_LDFLAGS      = $(HLDFLAGS)
+ 
+@@ -656,7 +655,6 @@
+                  hdl.h          \
+                  crypto.h       \
+                  sockdev.h      \
+-                 ltdl.h         \
+                  herc_getopt.h  \
+                  service.h      \
+                  chsc.h         \
+--- a/softfloat/Makefile.am
++++ b/softfloat/Makefile.am
+@@ -22,13 +22,11 @@
+ endif
+ 
+ if OPTION_DYNAMIC_LOAD
+-  LTDL         = ../ltdl.c
+   LIB_LD_FLAGS    = -export-dynamic  \
+                  $(XSTATIC)       \
+                  -no-undefined    \
+                  -avoid-version
+ else
+-  LTDL         =
+   LIB_LD_FLAGS    = $(XSTATIC)    \
+                  -no-undefined \
+                  -avoid-version
+--- a/autoconf/hercules.m4
++++ b/autoconf/hercules.m4
+@@ -270,7 +270,7 @@
+ 
+     else
+ 
+-        if test $(./libtool --features | fgrep "enable shared libraries" | wc 
-l) -ne 1; then
++        if test "$enable_shared" != "yes"; then
+ 
+             #  Libtool doesn't support shared libraries,
+             #  and thus our wrapper kludge is not needed.
+@@ -280,11 +280,11 @@
+                 }
+ DUPGETOPT2
+ 
+-            ./libtool --mode=compile ${CC-cc} conftest1.c -c -o conftest1.lo 
> /dev/null 2>&1
+-            ./libtool --mode=compile ${CC-cc} conftest2.c -c -o conftest2.lo 
> /dev/null 2>&1
++            libtool --mode=compile ${CC-cc} conftest1.c -c -o conftest1.lo > 
/dev/null 2>&1
++            libtool --mode=compile ${CC-cc} conftest2.c -c -o conftest2.lo > 
/dev/null 2>&1
+ 
+-            ./libtool --mode=link ${CC-cc} -shared -rpath /lib -no-undefined 
conftest1.lo                 -o libconftest1.la > /dev/null 2>&1
+-            ./libtool --mode=link ${CC-cc} -shared -rpath /lib -no-undefined 
conftest2.lo libconftest1.la -o libconftest2.la > /dev/null 2>&1
++            libtool --mode=link ${CC-cc} -shared -rpath /lib -no-undefined 
conftest1.lo                 -o libconftest1.la > /dev/null 2>&1
++            libtool --mode=link ${CC-cc} -shared -rpath /lib -no-undefined 
conftest2.lo libconftest1.la -o libconftest2.la > /dev/null 2>&1
+ 
+             if test $? = 0; then
+ 

diff --git a/app-emulation/hercules-sdl/files/hercules-3.13-user-install.patch 
b/app-emulation/hercules-sdl/files/hercules-3.13-user-install.patch
new file mode 100644
index 000000000000..bcde1181e873
--- /dev/null
+++ b/app-emulation/hercules-sdl/files/hercules-3.13-user-install.patch
@@ -0,0 +1,21 @@
+the ebuild will handle these, so no need to do it directly which will fail when
+building as non-root.
+
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -730,15 +730,6 @@ endif
+       (cd $(DESTDIR)$(bindir); @LN_S@ ./dasdcopy$(EXEEXT) cfba2fba$(EXEEXT))
+       rm -f $(DESTDIR)$(bindir)/cckd2ckd$(EXEEXT)
+       (cd $(DESTDIR)$(bindir); @LN_S@ ./dasdcopy$(EXEEXT) cckd2ckd$(EXEEXT))
+-if SETUID_HERCIFC
+-      chown root $(DESTDIR)$(bindir)/hercifc
+-if HERCIFC_GROUPSET
+-      chgrp $(HERCIFC_GROUPNAME) $(DESTDIR)$(bindir)/hercifc
+-endif
+-      chmod 0750 $(DESTDIR)$(bindir)/hercifc
+-      chmod +s   $(DESTDIR)$(bindir)/hercifc
+-      rm                             hercifc
+-endif
+ 
+ uninstall-local:
+ 

diff --git a/app-emulation/hercules-sdl/files/hercules-sdl-4.4.1-htmldir.patch 
b/app-emulation/hercules-sdl/files/hercules-sdl-4.4.1-htmldir.patch
new file mode 100644
index 000000000000..50b30cca91dd
--- /dev/null
+++ b/app-emulation/hercules-sdl/files/hercules-sdl-4.4.1-htmldir.patch
@@ -0,0 +1,29 @@
+diff --git a/html/Makefile.am b/html/Makefile.am
+index b4d21d0..1e5af4c 100644
+--- a/html/Makefile.am
++++ b/html/Makefile.am
+@@ -1,5 +1,5 @@
+ 
+-dist_pkgdata_DATA =   \
++dist_html_DATA =   \
+     cckddasd.html     \
+     fishgui.html      \
+     hercconf.html     \
+@@ -62,7 +62,7 @@ include_sources =           \
+     include/footer.htmlpart \
+     include/header.htmlpart
+ 
+-include_pkgdatadir = $(pkgdatadir)/include
++include_pkgdatadir = $(htmldir)/include
+ 
+ dist_include_pkgdata_DATA = $(include_sources)
+ 
+@@ -120,7 +120,7 @@ images_sources =                        \
+     images/waitoffu.gif                 \
+     images/waitonu.gif
+ 
+-images_pkgdatadir = $(pkgdatadir)/images
++images_pkgdatadir = $(htmldir)/images
+ 
+ dist_images_pkgdata_DATA = $(images_sources)
+ 

diff --git 
a/app-emulation/hercules-sdl/files/hercules-sdl-4.4.1-unbundle-libltdl.patch 
b/app-emulation/hercules-sdl/files/hercules-sdl-4.4.1-unbundle-libltdl.patch
new file mode 100644
index 000000000000..e5bb86fbebcf
--- /dev/null
+++ b/app-emulation/hercules-sdl/files/hercules-sdl-4.4.1-unbundle-libltdl.patch
@@ -0,0 +1,179 @@
+diff --git a/autoconf/hercules.m4 b/autoconf/hercules.m4
+index cb962f5..31d641c 100755
+--- a/autoconf/hercules.m4
++++ b/autoconf/hercules.m4
+@@ -263,7 +263,7 @@ AC_DEFUN([_HC_CHECK_NEED_GETOPT_WRAPPER],
+ 
+     else
+ 
+-        if test $(libtool --features | fgrep "enable shared libraries" | wc 
-l) -ne 1; then
++        if test "$enable_shared" != "yes"; then
+ 
+             #  Libtool doesn't support shared libraries,
+             #  and thus our wrapper kludge is not needed.
+diff --git a/configure.ac b/configure.ac
+index c657251..af23407 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -325,41 +325,6 @@ fi
+ modexecdir='$(libdir)/$(PACKAGE)'
+ AC_SUBST(modexecdir)
+ 
+-
+-# 
-----------------------------------------------------------------------------
+-#
+-#  AC_LIBTOOL_DLOPEN
+-#
+-#       Enable checking for dlopen support. This macro should be used if the
+-#       package makes use of the '-dlopen' and '-dlpreopen' flags, otherwise
+-#       libtool will assume that the system does not support dlopening. The
+-#       macro must be called before AC_PROG_LIBTOOL.
+-#
+-# 
-----------------------------------------------------------------------------
+-
+-AC_LIBTOOL_DLOPEN()                     # (we need libtool's dlopen support)
+-
+-
+-# 
-----------------------------------------------------------------------------
+-#
+-#  AC_LIBTOOL_WIN32_DLL
+-#
+-#       This macro should be used if the package has been ported to build
+-#       clean dlls on win32 platforms. Usually this means that any library
+-#       data items are exported with __declspec(dllexport) and imported with
+-#       __declspec(dllimport). If this macro is not used, libtool will assume
+-#       that the package libraries are not dll clean and will build only 
static
+-#       libraries on win32 hosts.
+-#
+-#       This macro must be called before AC_PROG_LIBTOOL, and provision must
+-#       be made to pass '-no-undefined' to libtool in link mode from the 
package
+-#       Makefile. Naturally, if you pass '-no-undefined', you must ensure that
+-#       all the library symbols really are defined at link time!
+-#
+-# 
-----------------------------------------------------------------------------
+-
+-AC_LIBTOOL_WIN32_DLL()                  # (we need Win32 support in libtool)
+-
+ # 
-----------------------------------------------------------------------------
+ #  This is a hack:
+ #
+@@ -395,117 +360,8 @@ case $host_os in
+       ;;
+ esac
+ 
+-# 
-----------------------------------------------------------------------------
+-#  See: 'AC_PROG_LIBTOOL' below.
+-# 
-----------------------------------------------------------------------------
+-
+-AC_DISABLE_STATIC()                     # (forces libtool to build shared
+-                                        #  libraries instead of static ones)
+-
+-# 
-----------------------------------------------------------------------------
+-#  AC_PROG_LIBTOOL
+-#
+-#       Add support for the '--enable-shared' and '--disable-shared'
+-#       configure flags. By default, this macro turns on shared libraries
+-#       if they are available, and also enables static libraries if they
+-#       don't conflict with the shared libraries. You can modify these
+-#       defaults by calling either the AC_DISABLE_SHARED or AC_DISABLE_STATIC
+-#       macros.
+-#
+-#       Hercules REQUIRES shared libraries (i.e. DLLs), so we do indeed use
+-#       the AC_DISABLE_STATIC macro above.
+-#
+-# 
-----------------------------------------------------------------------------
+-
+-AC_PROG_LIBTOOL()                       # (we build libtool for ourselves)
+-
+-
+-# 
-----------------------------------------------------------------------------
+-#
+-#  AC_LIB_LTDL
+-#
+-#       Even though libltdl is installed together with libtool, you may wish
+-#       to include libltdl in the distribution of your package, for the 
convenience
+-#       of users of your package that don't have libtool or libltdl installed.
+-#
+-#       The most simplistic way to add libltdl to your package is to copy the
+-#       source files, 'ltdl.c' and 'ltdl.h', to a source directory withing 
your
+-#       package and to build and link them along with the rest of your 
sources.
+-#
+-#       To do this, you must add a call to the 'AC_LIB_LTDL' macro to your 
package's
+-#       'configure.in' to perform the required configure time checks in order 
that
+-#       'ltdl.o' is built correctly.
+-#
+-#       This method does have its problems though: if you try to link the 
package
+-#       binaries with an installed libltdl, or a library which depends on 
libltdl,
+-#       you may have problems with duplicate symbol definitions.
+-#
+-#       In order to enable this flavor of libltdl, you should add the line
+-#       'AC_LIBLTDL_CONVENIENCE' to your `configure.in', before 
'AC_PROG_LIBTOOL'.
+-#
+-#       In order to select the installable version of libltdl, you should add 
a
+-#       call of the macro 'AC_LIBLTDL_INSTALLABLE' to your 'configure.in' 
before
+-#       'AC_PROG_LIBTOOL'. This macro will check whether libltdl is already
+-#       installed and, if not, request the libltdl embedded in your package 
to be
+-#       built and installed.
+-#
+-#       Whatever macro you use, it is up to you to ensure that your 
'configure.in'
+-#       will configure libltdl, using 'AC_CONFIG_SUBDIRS', and that your 
'Makefile's
+-#       will start sub-makes within libltdl's directory, using automake's 
SUBDIRS,
+-#       for example. Both macros define the shell variables LIBLTDL, to the 
link flag
+-#       that you should use to link with libltdl, and LTDLINCL, to the 
preprocessor
+-#       flag that you should use to compile with programs that include 
'ltdl.h'. It
+-#       is up to you to use 'AC_SUBST' to ensure that this variable will be 
available
+-#       in 'Makefile's, or add them to variables that are 'AC_SUBST'ed by 
default,
+-#       such as LIBS and CPPFLAGS.
+-#
+-#       So, when you want to link a program with libltdl, be it a convenience,
+-#       installed or installable library, just compile with '$(LTDLINCL)' and 
link
+-#       it with '$(LIBLTDL)', using libtool.
+-#
+-#       You should probably also add 'AC_LIBTOOL_DLOPEN' to your 
'configure.in' before
+-#       'AC_PROG_LIBTOOL', otherwise libtool will assume no dlopening 
mechanism is
+-#       supported, and revert to dlpreopening, which is probably not what you 
want.
+-#
+-#       The following example shows you how to embed the convenience libltdl
+-#       in your package. In order to use the installable variant just replace
+-#       'AC_LIBLTDL_CONVENIENCE' with 'AC_LIBLTDL_INSTALLABLE'. We assume 
that libltdl
+-#       was embedded using 'libtoolize --ltdl':
+-#
+-#           configure.in:
+-#
+-#               ...
+-#               dnl Enable building of the convenience library
+-#               dnl and set LIBLTDL accordingly
+-#               AC_LIBLTDL_CONVENIENCE
+-#               dnl Substitute LTDLINCL and LIBLTDL in the Makefiles
+-#               AC_SUBST(LTDLINCL)
+-#               AC_SUBST(LIBLTDL)
+-#               dnl Check for dlopen support
+-#               AC_LIBTOOL_DLOPEN
+-#               dnl Configure libtool
+-#               AC_PROG_LIBTOOL
+-#               dnl Configure libltdl
+-#               AC_CONFIG_SUBDIRS(libltdl)
+-#               ...
+-#
+-#           Makefile.am:
+-#
+-#               ...
+-#               SUBDIRS = libltdl
+-#
+-#               INCLUDES = $(LTDLINCL)
+-#
+-#               myprog_LDFLAGS = -export-dynamic
+-#               # The quotes around -dlopen below fool automake <= 1.4 into 
accepting it
+-#               myprog_LDADD = $(LIBLTDL) "-dlopen" self "-dlopen" foo1.la
+-#               myprog_DEPENDENCIES = $(LIBLTDL) foo1.la
+-#               ...
+-#
+-# 
-----------------------------------------------------------------------------
+-
+-AC_LIB_LTDL()                           # (we need the ltdl libtool library)
+-AC_SUBST([LIBTOOL_DEPS])                # (see PROGRAMMING NOTE above)
++LT_PREREQ([2.2.6])
++LT_INIT([dlopen win32-dll disable-static])
+ 
+ # 
-----------------------------------------------------------------------------
+ # (See comments in the 'AC_CHECK_LIB' Libraries section further below)

diff --git a/app-emulation/hercules-sdl/hercules-sdl-4.7.0.ebuild 
b/app-emulation/hercules-sdl/hercules-sdl-4.7.0.ebuild
new file mode 100644
index 000000000000..336396af8692
--- /dev/null
+++ b/app-emulation/hercules-sdl/hercules-sdl-4.7.0.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools fcaps
+
+DESCRIPTION="The SoftDevLabs (SDL) version of the Hercules 4.x Hyperion 
Emulator"
+HOMEPAGE="https://sdl-hercules-390.github.io/html/";
+SRC_URI="https://github.com/SDL-Hercules-390/hyperion/archive/refs/tags/Release_${PV/.0/}.tar.gz
 -> ${P/.0/}.tar.gz"
+
+S="${WORKDIR}/hyperion-Release_${PV/.0/}"
+LICENSE="QPL-1.0"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc64"
+# In theory USE=object-rexx and USE=regina-rexx are not mutually-exclusive.
+# In practice they functionally are as the Gentoo packages conflict, and
+# additionally Hercules only supports calling out to one of them at runtime,
+# controlled by the HREXX_PACKAGE environment variable.
+IUSE="bzip2 debug object-rexx regina-rexx test"
+RESTRICT="!test? ( test )"
+FILECAPS=(
+       -M 755 cap_sys_nice\=eip usr/bin/hercules --
+       -M 755 cap_sys_nice\=eip usr/bin/herclin --
+       -M 755 cap_net_admin+ep usr/bin/hercifc
+)
+
+RDEPEND="
+       dev-libs/libltdl
+       net-libs/libnsl:0
+       sys-libs/zlib
+       bzip2? ( app-arch/bzip2 )
+       object-rexx? ( dev-lang/oorexx )
+       regina-rexx? ( dev-lang/regina-rexx )"
+DEPEND="${RDEPEND}
+       ~app-emulation/hercules-sdl-crypto-${PV}
+       ~app-emulation/hercules-sdl-decnumber-${PV}
+       ~app-emulation/hercules-sdl-softfloat-${PV}
+       ~app-emulation/hercules-sdl-telnet-${PV}"
+# Neither package support needs to be compiled-in for tests,
+# but the "rexx" command needs to be available
+BDEPEND="${RDEPEND}
+       test? ( || ( dev-lang/regina-rexx dev-lang/oorexx ) )"
+
+PATCHES=( "${FILESDIR}/${PN}-4.4.1-htmldir.patch" )
+
+src_prepare() {
+       rm -rf crypto decNumber SoftFloat telnet || die
+       sed -i 's#/lib${hc_cv_pkg_lib_subdir}#/lib#g' configure.ac || die
+       sed -i 's#_pkgname}${hc_cv_pkg_lib_suffix}#_pkgname}#g' configure.ac || 
die
+
+       default
+       eautoreconf
+}
+
+src_configure() {
+       local -x ac_cv_lib_bz2_BZ2_bzBuffToBuffDecompress=$(usex bzip2)
+       econf \
+               $(use_enable bzip2 cckd-bzip2) \
+               $(use_enable bzip2 het-bzip2) \
+               $(use_enable object-rexx) \
+               $(use_enable regina-rexx) \
+               $(use_enable debug) \
+               --enable-custom="Gentoo ${PF}.ebuild" \
+               --disable-optimization \
+               --disable-setuid-hercifc \
+               --disable-capabilities \
+               --enable-ipv6 \
+               --enable-enhanced-configincludes \
+               --disable-fthreads \
+               --enable-shared \
+               --enable-automatic-operator \
+               --enable-extpkgs="${SYSROOT}/usr/$(get_libdir)/${PN}"
+}
+
+src_install() {
+       default
+       dodoc RELEASE.NOTES
+
+       insinto /usr/share/hercules
+       doins hercules.cnf
+
+       # No static archives.  Have to leave .la files for modules. #720342
+       find "${ED}/usr/$(get_libdir)" -name "*.la" -delete || die
+}

diff --git a/app-emulation/hercules-sdl/metadata.xml 
b/app-emulation/hercules-sdl/metadata.xml
new file mode 100644
index 000000000000..ff52771dbab6
--- /dev/null
+++ b/app-emulation/hercules-sdl/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="project">
+               <email>s...@gentoo.org</email>
+               <name>s390 architecture team</name>
+       </maintainer>
+       <longdescription>
+               This version of Hercules 4.x Hyperion is a SoftDevLabs 
maintained version of the Hercules emulator containing fixes made by David B. 
Trout and others for bugs that may still exist in the original hercules-390 
version of Hercules 4.0 Hyperion, as well as enhancements and improvements to 
the overall functionality above and beyond what is provided by the hercules-390 
version of Hercules.
+       </longdescription>
+       <use>
+               <flag name="object-rexx">Enable REXX support via Open Object 
Rexx (<pkg>dev-lang/oorexx</pkg>)</flag>
+               <flag name="regina-rexx">Enable REXX support via Regina Rexx 
(<pkg>dev-lang/regina-rexx</pkg>)</flag>
+       </use>
+       <upstream>
+               <remote-id type="github">SDL-Hercules-390/hyperion</remote-id>
+       </upstream>
+</pkgmetadata>


Reply via email to