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

Name:           snipl
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
BuildRequires:  libnet
%define api_ver 2.13.1-27
%ifarch %{ix86}
%define api_arch i686
%define api_arch %{_arch}
ExclusiveArch:  s390 s390x x86_64
Source:         %name-%{version}.tar.gz
Source1:        hwmcaapi-rpms-%{api_ver}.tbz
Source2:        Z125-5589-05.txt
Patch1:         snipl-
Patch2:         snipl-sles15-openssl11.patch

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

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.

%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

dos2unix -o README.snipl

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

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

%doc LICENSE README.snipl Z125-5589-05.txt
%doc %{_mandir}/man8/*%{ext_man}

openSUSE Build Service is sponsored by