File wodim.spec of Package wodim

#
# spec file for package wodim
#
# Copyright (c) 2014 SUSE LINUX Products 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:           wodim
Version:        1.1.11
Release:        0
Summary:        Tool for Writing CDRs
License:        GPL-2.0
Group:          Productivity/Multimedia/CD/Record

Url:            http://cdrkit.org/
Source0:        http://cdrkit.org/releases/cdrkit-%{version}.tar.gz
Source1:        scan_scsi.linux
Source2:        cdinfo.c
Source5:        README.SUSE
# PATCH-FIX-OPENSUSE cdrkit-1.1.9-cmake.patch --
Patch0:         cdrkit-1.1.9-cmake.patch
# PATCH-FIX-OPENSUSE genisoimage-multi-extent.patch --
Patch1:         genisoimage-multi-extent.patch
# PATCH-FIX-OPENSUSE cdrkit-1.1.9-zlib-check.patch -- Fix cmake scripts to detect zlib-devel
Patch2:         cdrkit-1.1.9-zlib-check.patch
# PATCH-FIX-OPENSUSE cdrkit-1.1.9-fix-buffer-overflows.patch -- Fix buffer overflow warnings
Patch3:         cdrkit-1.1.9-fix-buffer-overflows.patch
# PATCH-FIX-UPSTREAM icedax.1_macro_warning_fix.patch asterios.dramis@gmail.com -- Fix rpmlint warning "manual-page-warning: macro `wav,' not defined" (already fixed upstream)
Patch4:         icedax.1_macro_warning_fix.patch
# PATCH-FIX-OPENSUSE genisoimage-multi-extent.patch-fix-bnc615177 --
Patch5:         genisoimage-multi-extent-fix-bnc615177.patch
# PATCH-FIX-OPENSUSE cdrkit-pie.diff lnussel@suse.de -- wodim must be pie as users may set suid bit on it
Patch6:         cdrkit-pie.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  file-devel
BuildRequires:  gcc-c++
BuildRequires:  libbz2-devel
BuildRequires:  libcap-devel
BuildRequires:  perl
BuildRequires:  zlib-devel
Requires:       permissions
Requires(post): permissions
Requires(post): /bin/cp

%description
wodim is used to record data or audio CDs on a CD-Recorder or to write
DVD media on a DVD-Recorder.

%package -n cdrkit-devel-static
Summary:        Tool for Writing CDRs - Files Mandatory for Development
Group:          Development/Libraries/Other
Provides:       wodim-devel = %{version}
Obsoletes:      wodim-devel < %{version}

%description -n cdrkit-devel-static
This package contains cdrkit libraries mandatory for development.

%package -n genisoimage
Summary:        A Program for Creating CDs in Linux
Group:          Productivity/Multimedia/CD/Record
Recommends:     zisofs-tools

%description -n genisoimage
Genisoimage is a pre-mastering program that generates an iso9660
filesystem. It takes a snapshot of a given directory tree, and
generates a binary image which corresponds to an iso9660 filesystem
that can be written to a block device.

%package -n icedax
Summary:        A CD-Audio Grabbing tool
Group:          Productivity/Multimedia/CD/Grabbers
Requires:       vorbis-tools
# A handful of cdrtools programs, such as cdda2ogg(1),
# exist in icedax as well.
Conflicts:      cdda2wav

%description -n icedax
The common CD-audio grabbing tool for Linux. The sources are now
contained in the wodim source archive.

%package -n cdrkit-cdrtools-compat
Summary:        Tool for Writing CDRs - cdrtools Compatibility Package
Group:          Productivity/Multimedia/CD/Record
Requires:       genisoimage = %{version}-%{release}
Requires:       icedax = %{version}-%{release}
Requires:       wodim = %{version}-%{release}
Conflicts:      cdda2wav
Conflicts:      cdrecord
Conflicts:      mkisofs

%description -n cdrkit-cdrtools-compat
This package contains these symlinks:
cdrecord -> wodim
mkisofs -> genisoimage
cdda2wav -> icedax
Install this package if you want to use the cdrkit programs
using cdrtools program names.

%prep
%setup -q -n cdrkit-%{version}
%patch0
%patch1
%patch2
%patch3 -p1
%patch4
%patch5
%patch6 -p1
# Fix perl path
find . -type f -print0 | xargs -0 perl -pi -e 's#/usr/local/bin/perl#/usr/bin/perl#g'
# Fix permissions (no executables in doc files)
chmod 644 doc/icedax/tracknames.pl misc/burnstuff misc/rc.pp
# Rename in order to not conflict with doc/genisoimage/README when added in genisoimage rpm doc files
mv genisoimage/diag/README genisoimage/diag/README.diag

%build
export CFLAGS="%{optflags} -fno-strict-aliasing -DPIC -fPIC"
export CXXFLAGS="$CFLAGS"

mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=%{_prefix}
# -DCMAKE_POSITION_INDEPENDENT_CODE=ON
make VERBOSE=1 MANDIR=share/man %{?_smp_mflags}
gcc %{optflags} %{S:2} -o cdinfo
cd ..

%install
b="%buildroot"
cd build
make install DESTDIR="%buildroot"
cd ..

# Fix perl version requirement
perl -pi -e 's#^require v5.8.1;##g' %{buildroot}%{_bindir}/dirsplit

# Install additional programs
install -pm 0755 build/cdinfo \
	         icedax/cdda2mp3.new \
                 icedax/inf2cdtext.pl \
                 %{S:1} \
                 %{buildroot}%{_bindir}
install -pm 0755 3rd-party/geteltorito/geteltorito.pl %{buildroot}%{_bindir}/geteltorito

# Compatibility symlinks
ln -sf wodim %{buildroot}%{_bindir}/cdrecord
ln -sf wodim %{buildroot}%{_bindir}/dvdrecord
ln -sf readom %{buildroot}%{_bindir}/readcd
ln -sf icedax %{buildroot}%{_bindir}/cdda2wav
ln -sf genisoimage %{buildroot}%{_bindir}/mkhybrid
ln -sf genisoimage %{buildroot}%{_bindir}/mkisofs
ln -sf wodim.1%{ext_man} %{buildroot}%{_mandir}/man1/cdrecord.1%{ext_man}
ln -sf readom.1%{ext_man} %{buildroot}%{_mandir}/man1/readcd.1%{ext_man}
ln -sf icedax.1%{ext_man} %{buildroot}%{_mandir}/man1/cdda2wav.1%{ext_man}
ln -sf genisoimage.1%{ext_man} %{buildroot}%{_mandir}/man1/mkisofs.1%{ext_man}

# Do not squat on cdrtools names in genisoimage package
# (do it in cdrkit-cdrtools-compat, which conflicts anyway)
mkdir -p "$b/%_libexecdir/genisoimage"
for i in devdump iso{debug,dump,info,vfy}; do
	mv "$b/%_bindir/$i" "$b/%_libexecdir/genisoimage/"
	ln -s "%_libexecdir/genisoimage/$i" "$b/%_bindir/"
	mv "$b/%_mandir/man1/$i.1" "$b/%_mandir/man1/genisoimage-$i.1"
	ln -s "genisoimage-$i.1%ext_man" "$b/%_mandir/man1/$i.1%ext_man"
done

# Other symlinks
ln -sf icedax %{buildroot}%{_bindir}/list_audio_tracks
ln -sf cdda2ogg.1%{ext_man} %{buildroot}%{_mandir}/man1/cdda2mp3.1%{ext_man}

# Install libraries
cd build
install -dm 0755 %{buildroot}%{_libdir}
install -pm 0644 \
                 librols/librols.a \
                 libusal/libusal.a \
                 %{buildroot}%{_libdir}
cd ..

# Install headers
rm -rf %{buildroot}%{_includedir}
mkdir -p %{buildroot}%{_includedir}/cdrkit
cp -a include/*.h %{buildroot}%{_includedir}/cdrkit
cp -a libusal/usal %{buildroot}%{_includedir}/
cp -a libusal/*.h %{buildroot}%{_includedir}/usal/
# it seems to depend on the cmake version if xconfig.h lands in ./ or in ./include/
# I don't know why, a cmake expert should fix that. Work around it for now.
cd build
if test -e xconfig.h; then # old cmake 2.6
	cp -a xconfig.h %{buildroot}%{_includedir}/cdrkit
elif ! test -e include/xconfig.h; then # new cmake 2.8
	echo "error: xconfig.h not found!"
	false
fi
cd ..

# Install config files
install -dm 0755 %{buildroot}%{_sysconfdir}
install -pm 0644 netscsid/netscsid.dfl %{buildroot}%{_sysconfdir}/netscsid.conf
install -pm 0644 wodim/wodim.dfl %{buildroot}%{_sysconfdir}/wodim.conf

# README.SUSE
cp %{S:5} .

# Missing man page. Do symlink like in Debian.
ln -sf wodim.1%{ext_man} %{buildroot}%{_mandir}/man1/netscsid.1%{ext_man}

%fdupes -s %buildroot/%_prefix

%verifyscript
%verify_permissions -e %{_bindir}/wodim

%post
%if 0%{?set_permissions:1} > 0
  %{set_permissions wodim}
%else
  %{run_permissions}
%endif

%files
%defattr(-,root,root,-)
%doc ABOUT COPYING Changelog FAQ FORK START TODO
%doc doc/ANNOUNCEMENTs/ doc/READMEs/ doc/wodim/
%doc misc/burnstuff misc/make_diskt@2.sh misc/rc.pp
%doc README.SUSE
%config(noreplace) %{_sysconfdir}/netscsid.conf
%config(noreplace) %{_sysconfdir}/wodim.conf
%{_bindir}/cdinfo
%{_bindir}/readom
%verify(not mode) %attr(0755,root,root) %{_bindir}/wodim
%attr(0555,root,root) %{_sbindir}/netscsid
%doc %{_mandir}/man1/netscsid.1%{ext_man}
%doc %{_mandir}/man1/readom.1%{ext_man}
%doc %{_mandir}/man1/wodim.1%{ext_man}

%files -n cdrkit-cdrtools-compat
%defattr(-,root,root,-)
%{_bindir}/cdda2wav
%{_bindir}/cdrecord
%{_bindir}/devdump
%{_bindir}/dvdrecord
%{_bindir}/mkhybrid
%{_bindir}/mkisofs
%{_bindir}/isodebug
%{_bindir}/isodump
%{_bindir}/isoinfo
%{_bindir}/isovfy
%{_bindir}/readcd
%doc %{_mandir}/man1/cdda2wav.1%{ext_man}
%doc %{_mandir}/man1/cdrecord.1%{ext_man}
%doc %{_mandir}/man1/devdump.1%{ext_man}
%doc %{_mandir}/man1/isodebug.1%{ext_man}
%doc %{_mandir}/man1/isodump.1%{ext_man}
%doc %{_mandir}/man1/isoinfo.1%{ext_man}
%doc %{_mandir}/man1/isovfy.1%{ext_man}
%doc %{_mandir}/man1/mkisofs.1%{ext_man}
%doc %{_mandir}/man1/readcd.1%{ext_man}

%files -n cdrkit-devel-static
%defattr(-,root,root,-)
%{_includedir}/cdrkit/
%{_includedir}/usal/
%{_libdir}/lib*.a

%files -n genisoimage
%defattr(-,root,root,-)
%doc doc/genisoimage/*
%doc 3rd-party/geteltorito/README.geteltorito genisoimage/diag/README.diag
%{_bindir}/dirsplit
%{_bindir}/genisoimage
%{_bindir}/geteltorito
%_libexecdir/genisoimage/
%doc %{_mandir}/man1/genisoimage-devdump.1%{ext_man}
%doc %{_mandir}/man1/dirsplit.1%{ext_man}
%doc %{_mandir}/man1/genisoimage.1%{ext_man}
%doc %{_mandir}/man1/genisoimage-isodebug.1%{ext_man}
%doc %{_mandir}/man1/genisoimage-isodump.1%{ext_man}
%doc %{_mandir}/man1/genisoimage-isoinfo.1%{ext_man}
%doc %{_mandir}/man1/genisoimage-isovfy.1%{ext_man}
%doc %{_mandir}/man5/genisoimagerc.5%{ext_man}

%files -n icedax
%defattr(-,root,root,-)
%doc doc/icedax/*
%{_bindir}/cdda2mp3
%{_bindir}/cdda2mp3.new
%{_bindir}/cdda2ogg
%{_bindir}/icedax
%{_bindir}/inf2cdtext.pl
%{_bindir}/list_audio_tracks
%{_bindir}/pitchplay
%{_bindir}/readmult
%{_bindir}/scan_scsi.linux
%doc %{_mandir}/man1/cdda2mp3.1%{ext_man}
%doc %{_mandir}/man1/cdda2ogg.1%{ext_man}
%doc %{_mandir}/man1/icedax.1%{ext_man}
%doc %{_mandir}/man1/list_audio_tracks.1%{ext_man}
%doc %{_mandir}/man1/pitchplay.1%{ext_man}
%doc %{_mandir}/man1/readmult.1%{ext_man}

%changelog
openSUSE Build Service is sponsored by