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

Name:           wodim
Version:        1.1.11
Release:        0
Summary:        Tool for Writing CDRs
License:        GPL-2.0
Group:          Productivity/Multimedia/CD/Record

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 -- 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 -- 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

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.

%setup -q -n cdrkit-%{version}
%patch3 -p1
%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/ 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

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

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

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/ \
                 icedax/ \
                 %{S:1} \
install -pm 0755 3rd-party/geteltorito/ %{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"

# 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 \
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!"
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

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

%verify_permissions -e %{_bindir}/wodim

%if 0%{?set_permissions:1} > 0
  %{set_permissions wodim}

%doc doc/ANNOUNCEMENTs/ doc/READMEs/ doc/wodim/
%doc misc/burnstuff misc/ misc/rc.pp
%config(noreplace) %{_sysconfdir}/netscsid.conf
%config(noreplace) %{_sysconfdir}/wodim.conf
%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
%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

%files -n genisoimage
%doc doc/genisoimage/*
%doc 3rd-party/geteltorito/README.geteltorito genisoimage/diag/README.diag
%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
%doc doc/icedax/*
%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}

openSUSE Build Service is sponsored by