File snipl.spec of Package snipl

#
# spec file for package snipl
#
# Copyright (c) 2015 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.2.3.1
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:  libnet-devel
BuildRequires:  unzip
%if 0%{?suse_version} >= 1130
BuildRequires:  libnet-devel
BuildRequires:  libtool
%endif
ExclusiveArch:  s390 s390x x86_64
Source:         %name-%{version}.tar.gz
Source1:        hwmcaapi-2.12.0-12.s390x.rpm
Source2:        hwmcaapi-devel-2.12.0-12.s390x.rpm
Source3:        hwmcaapi-devel-2.12.0-12.s390.rpm
Source4:        dmsvsma.x
Source5:        Z125-5589-05.txt
Source6:        hwmcaapi.x86_64.zip
Source99:       hwmcaapi.download
Patch1:         snipl-0.2.3.1-hwmcaapidir.patch
Patch2:         snipl-enable-x86_64-arch.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.


Authors:
--------
    IBM

%prep
%setup
%patch1 -p1
%patch2 -p1

cp -p %SOURCE5 .
( mkdir hwmcaapi
  cd hwmcaapi
  rpm2cpio %SOURCE1 | cpio -idmv "./usr/share/doc/*"
  %ifarch s390x
    rpm2cpio %SOURCE2 | cpio -idmv
  %endif
  %ifarch s390
    rpm2cpio %SOURCE3 | cpio -idmv
  %endif
  %ifarch x86_64
    rpm2cpio %SOURCE2 | cpio -idmv "./usr/include/*"
    mkdir -p usr/lib64
    cd usr/lib64/
    unzip %SOURCE6 libhwmcaapi.so
    cd -
  %endif
)

dos2unix -o README.snipl

%build
CFLAGS="$RPM_OPT_FLAGS" make DMSVSMA_DIR=$RPM_SOURCE_DIR HWMCAAPI_DIR=$(pwd)/hwmcaapi

%install
make install DMSVSMA_DIR=$RPM_SOURCE_DIR PREFIX=$RPM_BUILD_ROOT/usr LIB_STRING=%_lib HWMCAAPI_DIR=$(pwd)/hwmcaapi

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

%clean
rm -fr $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc LICENSE README.snipl Z125-5589-05.txt
##%%doc LICENSE README.snipl SUSE_NonWarranted_hwmcaapi_tool_License-2011-07.txt
%_libdir/*.so*
%_libdir/stonith/plugins/stonith2/*.so
/usr/bin/*
%doc %_mandir/man8/*

%changelog
openSUSE Build Service is sponsored by