File siege.spec of Package failed_siege

#
# spec file for package siege
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2012 Pascal Bleser <pascal.bleser@opensuse.org>
#
# 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/
#

Name:           siege
Version:        4.1.6
Release:        0
Summary:        HTTP Regression Testing/Benchmarking Utility
License:        GPL-2.0-or-later
Group:          Productivity/Networking/Web/Utilities
URL:            https://www.joedog.org/siege-home/
Source:         http://download.joedog.org/siege/siege-%{version}.tar.gz
BuildRequires:  perl
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(zlib)
%{perl_requires}

%description
Siege is a regression test and benchmark utility. It can stress test a
single URL with a user defined number of simulated users, or it can read
many URLs into memory and stress them simultaneously. The program reports
the total number of hits recorded, bytes transferred, response time,
concurrency, and return status. Siege supports HTTP/1.0 and 1.1 protocols,
GET and POST directives, cookies, transaction logging, and basic
authentication. Its features are configurable on a per user basis. Since
3.0.0 it also supports FTP.

%prep
%setup -q

%build
%configure \
  --sysconfdir="%{_sysconfdir}/%{name}"
make %{?_smp_mflags}

%install
# Some versions of this package don't provide a recursive "install" target
# in src/, causing "make install" to fail. Work around by trying the
# normal make install (which works for compliant tarballs) and falling
# back to a manual install of the expected files into %{buildroot}.
rm -rf %{buildroot}
set -e
if ! make %{?_smp_mflags} install DESTDIR=%{buildroot}; then
  # Create target directories
  install -d -m 0755 %{buildroot}%{_bindir}
  install -d -m 0755 %{buildroot}%{_mandir}/man1
  install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}

  # Install binaries if present
  if [ -f src/siege ]; then
    install -m 0755 src/siege %{buildroot}%{_bindir}/siege
  fi
  if [ -f src/bombardment ]; then
    install -m 0755 src/bombardment %{buildroot}%{_bindir}/bombardment
  fi

  # Install siege2csv script: prefer generated script if present, else
  # convert the .in template into a usable script in bindir
  if [ -f utils/siege2csv ]; then
    install -m 0755 utils/siege2csv %{buildroot}%{_bindir}/siege2csv
  elif [ -f utils/siege2csv.in ]; then
    sed 's|@bindir@|%{_bindir}|g' utils/siege2csv.in > %{buildroot}%{_bindir}/siege2csv || cp utils/siege2csv.in %{buildroot}%{_bindir}/siege2csv
    chmod 0755 %{buildroot}%{_bindir}/siege2csv
  fi

  # Install default config template into bindir as siege.config if present
  if [ -f utils/siege.config.in ]; then
    sed 's|@sysconfdir@|%{_sysconfdir}|g' utils/siege.config.in > %{buildroot}%{_bindir}/siege.config || cp utils/siege.config.in %{buildroot}%{_bindir}/siege.config
    chmod 0644 %{buildroot}%{_bindir}/siege.config
  fi

  # Install manpages if present
  if [ -f doc/bombardment.1 ]; then
    install -m 0644 doc/bombardment.1 %{buildroot}%{_mandir}/man1/bombardment.1
  fi
  if [ -f doc/siege.1 ]; then
    install -m 0644 doc/siege.1 %{buildroot}%{_mandir}/man1/siege.1
  fi
  if [ -f doc/siege2csv.1 ]; then
    install -m 0644 doc/siege2csv.1 %{buildroot}%{_mandir}/man1/siege2csv.1
  fi
fi

%files
%license COPYING
%doc AUTHORS ChangeLog README.md
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/siegerc
%config(noreplace) %{_sysconfdir}/%{name}/urls.txt
%{_bindir}/bombardment
%{_bindir}/siege
%{_bindir}/siege2csv.pl
%{_bindir}/siege.config
%{_mandir}/man1/bombardment.1%{ext_man}
%{_mandir}/man1/siege.1%{ext_man}
%{_mandir}/man1/siege.config.1%{ext_man}
%{_mandir}/man1/siege2csv.1%{ext_man}

%changelog
openSUSE Build Service is sponsored by