File snipl.spec of Package snipl

#
# spec file for package snipl
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name:           snipl
Url:            http://www.ibm.com/developerworks/linux/linux390/snipl.html
Version:        0.3.0.0
Release:        0
Summary:        Simple Network IPL
License:        CPL-1.0 and SUSE-NonFree
Group:          System/Management
BuildRequires:  dos2unix
BuildRequires:  glib2-devel
BuildRequires:  libglue-devel
BuildRequires:  libopenssl-devel
%if 0%{?suse_version} >= 1130
BuildRequires:  libnet-devel
BuildRequires:  libnsl-devel
BuildRequires:  libtool
%else
BuildRequires:  libnet
%endif
%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
Patch1:         snipl-0.3.0.0-hwmcaapidir.patch
Patch2:         snipl-sles15-openssl11.patch

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
%setup
%patch1 -p1
%patch2 -p1

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 LICENSE README.snipl Z125-5589-05.txt
%{_libdir}/*.so*
%{_libdir}/stonith/plugins/stonith2/*.so
%{_bindir}/*
%doc %{_mandir}/man8/*%{ext_man}

%changelog