File cdrtools.spec of Package schily-libs

#
# spec file for package cdrtools
#
# 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 http://bugs.opensuse.org/
#


Name:           cdrtools
Version:        3.02~a09
Release:        0
%define rver	3.02a09
Summary:        Tools for recording CD/DVD/BluRay media
License:        CDDL-1.0 and GPL-2.0 and GPL-2.0+ and BSD-2-Clause and BSD-3-Clause and HPND and ISC
Group:          Productivity/Multimedia/CD/Record
Url:            http://cdrtools.sourceforge.net/private/cdrecord.html

Source:         http://downloads.sf.net/cdrtools/cdrtools-%rver.tar.bz2
Source1:        cdrecord.easy
Source2:        cdrecord.secure
Source3:        cdrecord.paranoid
Source4:        cdda2wav.easy
Source5:        cdda2wav.secure
Source6:        cdda2wav.paranoid
Source7:        pre_checkin.sh
Patch1:         gcc48wa.diff
# Honor https://en.opensuse.org/openSUSE:Packaging_Patches_guidelines#Upstream_policy
# and submit patches upstream FIRST (cc to the bspkg maintainer perhaps).
Patch10:        fix_chrp_boot.patch
Patch11:        large_mac_iso.patch
Patch12:        fix_junk_in_partition.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  fdupes
BuildRequires:  libcap-devel
BuildRequires:  libscg-devel
BuildRequires:  libschily-devel >= %version
%if 0%{?suse_version} >= 1220
BuildRequires:  makedepend
%else
# makedepend was formerly included in xorg-x11-util-devel
BuildRequires:  xorg-x11-util-devel
%endif
# Requiring version-release is necessary for this rpm to pull in the latest cdrtools.
Requires:       cdda2wav = %version-%release
Requires:       cdrecord = %version-%release
Requires:       mkisofs = %version-%release
Provides:       schily-cdrtools = %version
Obsoletes:      schily-cdrtools < %version
Conflicts:      cdrkit-cdrtools-compat

# 0: completely disable caps in this build
%define with_caps 0
# 0: permission definitions provided through the "permissions" openSUSE package
# 1: provide permission.d files ourselves
%define standalone_permissions 0
%if 0%{?with_caps}
%define caps_cdda2wav %caps(cap_dac_override,cap_sys_admin,cap_sys_nice,cap_net_bind_service,cap_sys_rawio=ep)
%define caps_cdrecord %caps(cap_sys_resource,cap_dac_override,cap_sys_admin,cap_sys_nice,cap_net_bind_service,cap_ipc_lock,cap_sys_rawio=ep)
%define caps_readcd   %caps(cap_dac_override,cap_sys_admin,cap_net_bind_service,cap_sys_rawio=ep)
%else
%define caps_cdda2wav %nil
%define caps_cdrecord %nil
%define caps_readcd   %nil
%endif

%description
Cdrtools is a set of command line programs for writing to
CD/DVD/BluRay media. It will install the original cdrtools binaries.
This is the original version from Joerg Schilling. Built from clean
sources without patches.

%package -n btcflash
Summary:        Firmware flash utility for BTC DRW1008 DVD±RW recorder
License:        CDDL-1.0
Group:          Hardware/Other

%description -n btcflash
Btcflash is used to read update the Firmware for a BTC DRW1008
DVD+/-RW recorder. Be very careful when writing firmware as this
program does not check for the correctness of the target device.
Build from clean sources without patches.

%package -n cdda2wav
Summary:        A CD Digital Audio Extraction tool
License:        CDDL-1.0
Group:          Productivity/Multimedia/CD/Grabbers
Requires(post): permissions

%description -n cdda2wav
cdda2wav can retrieve CDDA audio tracks from CDROM drives that are
capable of reading audio data digitally to the host via SCSI.

%package -n cdrecord
Summary:        A CD/DVD/BD recording program
License:        CDDL-1.0
Group:          Productivity/Multimedia/CD/Record
Requires(post): permissions

%description -n cdrecord
cdrecord is a program to record data or audio Compact Discs on an
Orange Book CD recorder, to write DVD media on a DVD recorder or to
write BluRay media on a BluRay recorder.

%package -n mkisofs
Summary:        A program to generate an ISO-9660/Joliet/HFS/UDF hybrid filesystem
License:        GPL-2.0
Group:          Productivity/Multimedia/CD/Record
Requires:       zisofs-tools

%description -n mkisofs
mkisofs is effectively a pre-mastering program to generate an
ISO-9660/JOLIET/HFS/UDF hybrid filesystem.

%prep
%autosetup -n cdrtools-3.02 -p1

%build
#
# We want to prefer the files from /usr/include, but gcc blatantly ignores
# -I arguments pointing to system paths. (CFLAGS=-I%_includedir is therefore
# out of the question.)
#
rm -Rf include/schily/*.h libscg/scg/*.h
cp -a "%_includedir/schily"/*.h include/schily/
cp -a "%_includedir/scg"/*.h libscg/scg/

#
# (this is a noninteractive build; nobody will read the warnings
# or care about the pause, so use GMAKE_NOWARN.)
#
# To enable verbosity, use with CC=cc LDCC=cc DYNLD=cc.
#
# Note that specifying -fPIE/-pie here conflicts with the generation
# of shared objects, which is why we build those separately
# in schily-libs.spec instead.
#
# Not fully parallel safe, so stick to default.
#
gmake GMAKE_NOWARN=true RUNPATH="" \
	CCCC=cc LDCC="cc -L%_libdir" DYNLD=cc \
	COPTX="%optflags -fno-strict-aliasing -fno-omit-frame-pointer \
		-fPIE -ggdb -finput-charset=ISO-8859-1" \
	LDOPTX="-pie -Wl,-pie -ggdb" RUNPATH=""

%install
b="%buildroot"
# D'oh… not parallel safe
gmake GMAKE_NOWARN=true RUNPATH="" \
	DESTDIR="$b" INS_BASE="%_prefix" install -j1

# Devel files not used and/or already provided by libschily-devel, libscg-devel
rm -Rf "$b/%_includedir" "$b/%_prefix/lib"/*.a "$b/%_prefix/lib/profiled" \
	"$b/%_mandir/man5"/makefiles.5* \
	"$b/%_mandir/man5"/makerules.5* \
	"$b/%_mandir/man3"/*.3*

%if %standalone_permissions
mkdir -p "$b/%_sysconfdir/permissions.d/"
install -pm 0644 "%_sourcedir"/{cdrecord,cdda2wav}.{easy,secure,paranoid} \
	"$b/%_sysconfdir/permissions.d/"
%endif

#
# pushd "$b/%_prefix"
# test -d "./%_lib" || mv -T ./lib "./%_lib"
# popd


# Needed by cdda2wav (see cdda2wav.c)
ln -sf cdda2wav "$b/%_bindir/list_audio_tracks"

# Remove documentation (will be added in %_datadir/doc/packages/*)
rm -Rf "$b/%_datadir/doc"/*

# Install additional programs
install -pm 0755 cdda2wav/{cdda2mp3.new,inf2cdtext.pl,pitchplay,readmult,tracknames.pl} \
	mkisofs/hdisk.pl "$b/%_bindir/"

# Fix perl path
perl -pi -e 's#/usr/local/bin/perl#%_bindir/perl#g' "$b/%_bindir/tracknames.pl"

# Rename in order to not conflict with mkisofs/README in rpm doc section
mv mkisofs/diag/README mkisofs/diag/README.diag

%fdupes -s %buildroot/%_prefix

%if 0%{?suse_version} >= 1120
%verifyscript -n cdrecord
%{verify_permissions -e %_bindir/cdrecord -e %_bindir/readcd}

%verifyscript -n cdda2wav
%{verify_permissions -e %_bindir/cdda2wav}

%endif

%post -n cdrecord
%if 0%{?set_permissions:1} > 0
%set_permissions %_bindir/cdrecord %_bindir/readcd
%else
%run_permissions
%endif
true

%post -n cdda2wav
%if 0%{?set_permissions:1} > 0
%set_permissions %_bindir/cdda2wav
%else
%run_permissions
%endif
true

%files
%defattr(-,root,root)
%doc ABOUT AN* CDDL.Schily.txt COPYING Changelog Changelog.1 GPL-2.0.txt
%doc LGPL-2.1.txt README.linux-shm READMEs/README.linux

%files -n btcflash
%defattr(-,root,root)
%doc CDDL.Schily.txt COPYING
%_bindir/btcflash
%doc %_mandir/man1/btcflash.1%ext_man

%files -n cdda2wav
%defattr(-,root,root)
%doc CDDL.Schily.txt
%doc cdda2wav/Changelog cdda2wav/FAQ cdda2wav/Frontends cdda2wav/HOWTOUSE
%doc cdda2wav/NEEDED cdda2wav/README cdda2wav/THANKS cdda2wav/TODO
%doc cdda2wav/tracknames.txt
%doc libparanoia/README.paranoia
%_bindir/cdda2mp3
%_bindir/cdda2mp3.new
%_bindir/cdda2ogg
%if 0%{?suse_version} >= 1140
%attr(0755,root,root) %caps_cdda2wav %verify(not mode caps) %_bindir/cdda2wav
%else
%attr(0755,root,root) %caps_cdda2wav %verify(not mode) %_bindir/cdda2wav
%endif
%_bindir/inf2cdtext.pl
%_bindir/list_audio_tracks
%_bindir/pitchplay
%_bindir/readmult
%_bindir/tracknames.pl
%doc %_mandir/man1/cdda2mp3.1%ext_man
%doc %_mandir/man1/cdda2ogg.1%ext_man
%doc %_mandir/man1/cdda2wav.1%ext_man
%if %standalone_permissions
%config %_sysconfdir/permissions.d/cdda2wav.*
%endif

%files -n cdrecord
%defattr(-,root,root)
%doc CDDL.Schily.txt START
%doc cdrecord/COPYING cdrecord/README cdrecord/README.ATAPI
%doc cdrecord/README.DiskT@2 cdrecord/README.WORM cdrecord/README.audio
%doc cdrecord/README.cdplus cdrecord/README.cdrw cdrecord/README.cdtext
%doc cdrecord/README.clone cdrecord/README.copy cdrecord/README.multi
%doc cdrecord/README.parallel cdrecord/README.raw cdrecord/README.rscsi
%doc cdrecord/README.sony cdrecord/README.verify cdrecord/README.volmgt
%doc rscsi/default-rscsi.sample
%config %_sysconfdir/default/cdrecord
%config %_sysconfdir/default/rscsi
%if %standalone_permissions
%config %_sysconfdir/permissions.d/cdrecord.*
%endif
%if 0%{?suse_version} >= 1140
%verify(not mode caps) %caps_cdrecord %attr(0755,root,root) %_bindir/cdrecord
%verify(not mode caps) %caps_readcd %attr(0755,root,root) %_bindir/readcd
%else
%verify(not mode) %caps_cdrecord %attr(0755,root,root) %_bindir/cdrecord
%verify(not mode) %caps_readcd %attr(0755,root,root) %_bindir/readcd
%endif
%_bindir/scgcheck
%_bindir/scgskeleton
%_sbindir/rscsi
%doc %_mandir/man1/cdrecord.1%ext_man
%doc %_mandir/man1/readcd.1%ext_man
%doc %_mandir/man1/rscsi.1%ext_man
%doc %_mandir/man1/scgcheck.1%ext_man
%doc %_mandir/man1/scgskeleton.1%ext_man

%files -n mkisofs
%defattr(-,root,root)
%doc CDDL.Schily.txt GPL-2.0.txt
%doc mkisofs/COPYING mkisofs/ChangeLog mkisofs/ChangeLog.mkhybrid
%doc mkisofs/README mkisofs/README.* mkisofs/RELEASE mkisofs/TODO
%doc mkisofs/diag/README.diag
%_bindir/devdump
%_bindir/hdisk.pl
%_bindir/isodebug
%_bindir/isodump
%_bindir/isoinfo
%_bindir/isovfy
%_bindir/mkhybrid
%_bindir/mkisofs
# Hardcoded paths in executable. Needs fixing. This is in /usr/lib/siconv instead for now
# %%_libdir/siconv/
%_prefix/lib/siconv/
%doc %_mandir/man8/devdump.8%ext_man
%doc %_mandir/man8/isodebug.8%ext_man
%doc %_mandir/man8/isodump.8%ext_man
%doc %_mandir/man8/isoinfo.8%ext_man
%doc %_mandir/man8/isovfy.8%ext_man
%doc %_mandir/man8/mkhybrid.8%ext_man
%doc %_mandir/man8/mkisofs.8%ext_man

%changelog
openSUSE Build Service is sponsored by