File hercules.spec of Package hercules

#
# spec file for package hercules
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%global halias hyperion
Name:           hercules
Version:        4.4
Release:        0
Summary:        Hercules Hyperion (4.x) IBM Mainframe Emulator
License:        QPL-1.0
Group:          System/Emulators/Other
URL:            https://sdl-hercules-390.github.io
Source:         %{halias}-%{version}.tar.xz
Patch0:         skip_setcap_run.diff
# test suite requirement
BuildRequires:  Regina-REXX
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  cmake
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  libbz2-devel
BuildRequires:  libcap-devel
BuildRequires:  libcap-progs
BuildRequires:  libltdl7
BuildRequires:  libtool
BuildRequires:  zlib-devel

%description
Hercules is an emulator for the IBM System/370, ESA/390, and
z/Architecture series of mainframe computers. It is capable of running
any IBM operating system and applications that a real system will run,
as long as the hardwre needed is emulated. Hercules can emulate FBA and
CKD DASD, tape, printer, card reader, card punch, channel-to-channel
adapter, and printer-keyboard and 3270 terminal devices.

This is the SoftDevLabs(SDL) version of the Hercules Hyperion (4.x),
containing changes to address bugs and add new features and functionality.

Additional info at:
https://sdl-hercules-390.github.io/

%package doc
Summary:        Documentation files for %{name}
Group:          Documentation/Other
Requires:       %{name} = %{version}
BuildArch:      noarch

%description doc
This package provides HTML documentation for Hercules Hyperion SDL.

%prep
%setup -q -n %{halias}-%{version}
%patch0 -p1

%build
%configure \
  --with-gnu-ld=yes \
  --docdir=%{_docdir}/%{name} \
  --htmldir=%{_docdir}/%{name} \
  --enable-cckd-bzip2 \
  --enable-het-bzip2 \
  --enable-optimization="%{optflags}" \
  --enable-multi-cpu=yes \
  --enable-capabilities \
  --enable-setuid-hercifc=no

%make_build

%check
%make_build check

%install
%make_install

# Removing libtool files for plugins breaks their on-demand loading,
# so keep them, and remove the rest
rm -f %{buildroot}/%{_libdir}/*.la

# Remove Windows batch files
find %{buildroot} -type f -name "*.cmd" -delete -print

# move html docs to a proper place
mkdir -p %{buildroot}%{_docdir}/%{name}/html
find %{buildroot}%{_datadir}/%{name} -type f \( -name "*.html" -o -name "*.css" \)  -exec mv -t  %{buildroot}%{_docdir}/%{name}/html/ '{}' \+
mv %{buildroot}%{_datadir}/%{name}/{images,include} -t %{buildroot}%{_docdir}/%{name}/html/

install -D -p -m 0644 hercules.cnf \
  %{buildroot}%{_sysconfdir}/%{name}/sample.cnf

# capabilities(7) and system group are used to somewhat confine binaries that would otherwise
# have to be setuid for full functionality.
# That requires modifying permissions.local (example in the README.SUSE), specific group creation,
# and manual run of 'chkstat --system' by the user.
%pre
getent group hercules >/dev/null || groupadd -r hercules

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%license COPYRIGHT
%{_bindir}/*
%{_libdir}/%{name}
%{_libdir}/*.so
%{_mandir}/man1/*
%{_mandir}/man4/*
%{_datadir}/%{name}
%dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/%{name}/sample.cnf

%files doc
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/*

%changelog
openSUSE Build Service is sponsored by