File wimlib.spec of Package wimlib

%define realname wimlib
%define realver  1.13.3
%define srcext   tar.gz

%define so_ver   15

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1%{?dist}
License:       GPL-3.0+
Group:         System/Filesystems
URL:           https://wimlib.net
Summary:       Tools for creating, extracting, and modifying Windows Imaging (WIM) archives

# Install-time parameters
Provides:      %{name}-utils = %{version}-%{release}
Provides:      mkwinpeimg    = %{version}-%{release}
Provides:      wimappend     = %{version}-%{release}
Provides:      wimapply      = %{version}-%{release}
Provides:      wimcapture    = %{version}-%{release}
Provides:      wimdelete     = %{version}-%{release}
Provides:      wimdir        = %{version}-%{release}
Provides:      wimexport     = %{version}-%{release}
Provides:      wimextract    = %{version}-%{release}
Provides:      wiminfo       = %{version}-%{release}
Provides:      wimjoin       = %{version}-%{release}
Provides:      wimlib-imagex = %{version}-%{release}
Provides:      wimmount      = %{version}-%{release}
Provides:      wimmountrw    = %{version}-%{release}
Provides:      wimoptimize   = %{version}-%{release}
Provides:      wimsplit      = %{version}-%{release}
Provides:      wimunmount    = %{version}-%{release}
Provides:      wimupdate     = %{version}-%{release}
Provides:      wimverify     = %{version}-%{release}

# Build-time parameters
BuildRequires: pkg-config
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(libntfs-3g) >= 2011.4.12
BuildRequires: pkgconfig(fuse)
BuildRequires: nasm
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://wimlib.net/downloads/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
wimlib is an open source, cross-platform library for creating, extracting, and
modifying Windows Imaging (WIM) archives. WIM is a file archiving format,
somewhat comparable to ZIP (and many other file archiving formats); but unlike
ZIP, it allows storing various Windows-specific metadata, allows storing
multiple "images" in a single archive, automatically deduplicates all file
contents, and supports optional solid compression to get a better compression
ratio. wimlib and its command-line frontend wimlib-imagex provide a free and
cross-platform alternative to Microsoft's WIMGAPI, ImageX, and DISM.

Among other things, wimlib:

  * Provides fast and reliable file archiving on Windows and on UNIX-like
    systems such as Mac OS X and Linux.
  * Allows users of non-Windows operating systems to read and write Windows
    Imaging (WIM) files.
  * Supports correct archiving of files on Windows-style filesystems such
    as NTFS without making common mistakes such as not properly handling ACLs,
    file attributes, links, and named data streams.
  * Allows deployment of Windows operating systems from non-Windows operating
    systems such as Linux.
  * Provides independent, high quality open source compressors and decompressors
    for several compression formats used by Microsoft which are not as well
    known as more open formats, and are prone to be re-used in different
    applications and file formats (not just WIM).

wimlib is distributed either as a source tarball (for UNIX/Linux), or as
ready-to-use binaries (for Windows XP and later). The software consists of
a C library along with the wimlib-imagex command-line frontend and its
associated documentation. 

%package -n libwim%{?so_ver}
License:       GPL-3.0+ or LGPL-3.0+
Group:         System/Libraries
Summary:       Library for creating, extracting, and modifying Windows Imaging (WIM) archives

%description -n libwim%{?so_ver}
wimlib is an open source, cross-platform library for creating, extracting, and
modifying Windows Imaging (WIM) archives. WIM is a file archiving format,
somewhat comparable to ZIP (and many other file archiving formats); but unlike
ZIP, it allows storing various Windows-specific metadata, allows storing
multiple "images" in a single archive, automatically deduplicates all file
contents, and supports optional solid compression to get a better compression
ratio.

This package provides a shared library.

%package -n libwim-devel
License:       GPL-3.0+ or LGPL-3.0+
Group:         Development/Libraries/C and C++
Summary:       Stuff to build software against libwim%{?so_ver}

Requires:      libwim%{?so_ver} = %{version}-%{release}
Provides:      libwim%{?so_ver}-devel = %{version}-%{release}
Provides:      %{realname}-devel = %{version}-%{release}
Obsoletes:     libwim%{?so_ver}-devel < %{version}-%{release}
Obsoletes:     %{realname}-devel < %{version}-%{release}

%description -n libwim-devel
wimlib is an open source, cross-platform library for creating, extracting, and
modifying Windows Imaging (WIM) archives. WIM is a file archiving format,
somewhat comparable to ZIP (and many other file archiving formats); but unlike
ZIP, it allows storing various Windows-specific metadata, allows storing
multiple "images" in a single archive, automatically deduplicates all file
contents, and supports optional solid compression to get a better compression
ratio.

This package provides headers and libraries required to build software
using %{realname}

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}

%build
%configure \
%ifarch x86_64
  --enable-ssse3-sha1 \
%endif
  --disable-assertions \
  \
  CFLAGS="%{optflags} %{?gcc_lto}" \
  LDFLAGS="-Wl,--strip-all -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -Wl,-z,relro %{?gcc_lto}"
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=%{buildroot}
[ "%{buildroot}" != "/" ] && sed -ri '1 s|^#!.+$|#!/bin/bash|' %{buildroot}%{_bindir}/mkwinpeimg

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc COPYING COPYING.CC0 COPYING.GPLv3 NEWS README
%{_bindir}/*
%{_mandir}/man1/*

%files -n libwim%{?so_ver}
%defattr(-,root,root)
%doc COPYING COPYING.CC0 COPYING.GPLv3 COPYING.LGPLv3 NEWS README
%{_libdir}/libwim.so.%{?so_ver}*

%files -n libwim-devel
%defattr(-,root,root)
%doc COPYING COPYING.CC0 COPYING.GPLv3 COPYING.LGPLv3 NEWS README
%{_includedir}/wimlib.h
%{_libdir}/pkgconfig/wimlib.pc
%{_libdir}/libwim.so
%{_libdir}/libwim.a
%exclude %{_libdir}/libwim.la

%post   -n libwim%{?so_ver} -p /sbin/ldconfig
%postun -n libwim%{?so_ver} -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by