File snipl.spec of Package snipl

#
# spec file for package snipl
#
# Copyright (c) 2023 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/
#


Name:           snipl
URL:            http://www.ibm.com/developerworks/linux/linux390/snipl.html
Version:        0.3.1.0
Release:        0
Summary:        Simple Network IPL
License:        CPL-1.0 AND NonFree
Group:          System/Management

BuildRequires:  dos2unix
BuildRequires:  glib2-devel
BuildRequires:  libglue-devel
BuildRequires:  libnet-devel
BuildRequires:  libnsl-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libtool

%define api_ver 2.13.1-27
%ifarch %{ix86}
%define api_arch i686
%else
%define api_arch %{_arch}
%endif

ExclusiveArch:  s390 s390x x86_64

Source:         %name-%{version}.tar.gz
Source1:        hwmcaapi-rpms-%{api_ver}.tbz
Source2:        Z125-5589-05.txt
Source99:       hwmcaapi.download

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
snIPL - simple network IPL (Linux Image Control for LPAR / VM) - is
a command line tool which serves as remote Linux image control using
basic Support Element (SE) functions or basic z/VM system management
functions on one or more images.

%prep
%autosetup

cp -p %SOURCE2 .
mkdir hwmcaapi
pushd hwmcaapi
tar -O -xvf %SOURCE1 hwmcaapi-%{api_ver}.%{api_arch}.rpm  | \
       rpm2cpio | cpio -idmv "./usr/share/doc/*"
tar -O -xvf %SOURCE1 hwmcaapi-devel-%{api_ver}.%{api_arch}.rpm  | \
       rpm2cpio | cpio -idmv
popd

dos2unix -o README.snipl

%build

export CFLAGS="%{optflags} $(pkg-config --libs libnsl)"
make HWMCAAPI_DIR="$PWD/hwmcaapi"

%install

make install PREFIX="%{buildroot}/%{_prefix}" \
	LIB_STRING="%{_lib}" HWMCAAPI_DIR="$PWD/hwmcaapi"

cp -a hwmcaapi/%{_libdir}/*.so* $RPM_BUILD_ROOT/%{_libdir}
rm -f "%{buildroot}/%{_libdir}/stonith/plugins/stonith2"/*.la
rm -f "%{buildroot}/%{_libdir}/stonith/plugins/stonith2"/*.a

%files
%defattr(-,root,root)
%doc README.snipl
%license LICENSE Z125-5589-05.txt
%{_libdir}/*.so*
%{_libdir}/stonith/plugins/stonith2/*.so
%{_bindir}/*
%doc %{_mandir}/man8/*%{ext_man}

%changelog
openSUSE Build Service is sponsored by