File star.spec of Package star

#
# spec file for package star
#
# Copyright (c) 2012 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:           star
BuildRequires:  autoconf
BuildRequires:  e2fsprogs-devel
BuildRequires:  libacl-devel
BuildRequires:  libselinux-devel
%ifarch ppc64
BuildRequires:  libtool
%endif
Provides:       rmt
Version:        1.5final
Release:        0
%define upver 1.5
Source:         ftp://ftp.berlios.de/pub/star/alpha/star-%{upver}.tar.bz2
Source1:        README-FIRST
Source2:        tests.tar.bz2
Patch0:         star-configuration.diff
Patch2:         star-no_fsync.diff
Patch5:         rmt-move.diff
Patch6:         star-selinux.patch
Patch7:         star-lock.diff
Patch8:         star-getline.diff
Patch9:         star-fexecve.diff
Patch10:        star-1.5.1-bufferoverflow.patch
Url:            http://cdrecord.berlios.de/old/private/star.html
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Summary:        POSIX.1-2001-Compliant Tar Implementation
License:        CDDL-1.0
Group:          Productivity/Archiving/Backup

%description
Star is a tar like archiver. TAR stands for Tape ARchiver. Star is the
fastest known implementation of a tar archiver.

Features:

- FIFO to keep the tape streaming.

- remote tape support.

- accurate sparse files (if the OS supports it).

- pattern matcher to archive and extract a subset of files.

- user tailorable interface for comparing tar archives against file
   trees.

- path names up to 1024 Bytes may be archived.

- stores and restores all 3 file times (even creation time). With
POSIX.1-2001 the times are in nanosecond granularity.



Authors:
--------
    Joerg Schilling <schilling@fokus.gmd.de>

%prep
#%setup -b 2 -n tests
#%setup -b 0 -n star-1.5
%setup -q -T -b 2 -n tests -b 0 -n star-1.5
%patch0 -p1
%patch2 -p1
%patch5 -p1
%patch6
%patch7
%patch8
%patch9
%patch10 -p1

%build
# bugzilla#134113: incompatible license and unused: SKH: removed
# upstream
# rm include/unls.h
# Autoconf does not handle inline comments correctly: Split comments and
# variables into separate lines.
mv conf/xconfig.h.in conf/xconfig.h.in.orig
sed -e 's|\(#.*\)\(/\*.*\*/\)|\2\n\1|g' \
	conf/xconfig.h.in.orig >conf/xconfig.h.in
#ln -sf i586-linux-gcc.rul RULES/i586-linux-cc.rul
#ln -s i586-linux-cc.rul RULES/x86_64-linux-cc.rul
ln -s i586-linux-cc.rul RULES/s390x-linux-cc.rul
ln -s i586-linux-cc.rul RULES/ppc64-linux-cc.rul
#ln -s i586-linux-gcc.rul RULES/x86_64-linux-gcc.rul
ln -s i586-linux-gcc.rul RULES/s390x-linux-gcc.rul
ln -s i586-linux-gcc.rul RULES/ppc64-linux-gcc.rul
ln -s armv4l-linux-gcc.rul RULES/armv5tel-linux-gcc.rul
ln -s armv4l-linux-gcc.rul RULES/armv7l-linux-gcc.rul
cd conf
%ifarch ppc64
cp /usr/share/libtool/config/config.* .
%endif
autoconf
%define star_cflags $RPM_OPT_FLAGS -g -W -Wall -Wpointer-arith -Wformat-security
cp %{SOURCE1} .
make all MAKEPROG=gmake MANDIR=share/man COPTX="%{star_cflags}" CPPOPTX="-DNO_FSYNC"

%install
make install MAKEPROG=gmake INS_BASE=$RPM_BUILD_ROOT/usr MANDIR=share/man \
		COPTX="%{star_cflags}" CPPOPTX="-DNO_FSYNC"
mkdir -p $RPM_BUILD_ROOT/etc/default
mkdir $RPM_BUILD_ROOT/sbin
install -m 644 rmt/rmt.dfl $RPM_BUILD_ROOT/etc/default/rmt
mv $RPM_BUILD_ROOT/usr/etc/default/{rmt,star} $RPM_BUILD_ROOT/etc/default
#mv $RPM_BUILD_ROOT/usr/bin/star_fat $RPM_BUILD_ROOT/usr/bin/star
mkdir -p $RPM_BUILD_ROOT/%{_docdir}/{star,rmt}
mv $RPM_BUILD_ROOT/usr/share/doc/star/* $RPM_BUILD_ROOT/%{_docdir}/star
mv $RPM_BUILD_ROOT/usr/share/doc/rmt/* $RPM_BUILD_ROOT/%{_docdir}/rmt
# if we put these as files-to-install in %doc in the filelist, docdir is 
# deleted and recreated. it's either all in %install or all in %files
install AN* BUILD COMPILE INSTALL PORTING README Changelog CDDL.Schily.txt CDDL.Sun.txt README.* TODO $RPM_BUILD_ROOT/%{_docdir}/star/
rm -f $RPM_BUILD_ROOT/usr/bin/ustar
rm -f $RPM_BUILD_ROOT/usr/bin/tar
ln -sf ./star $RPM_BUILD_ROOT/usr/bin/ustar
rm -rf $RPM_BUILD_ROOT/%{_prefix}/{lib,include,bin/mt} \
       $RPM_BUILD_ROOT%{_mandir}/man[35] \
       $RPM_BUILD_ROOT%{_mandir}/man1/{gnutar,scpio,smt,spax,suntar}.1 \
       $RPM_BUILD_ROOT/usr/bin/{spax,gnutar,scpio,suntar,star_sym}
# Run test suite?
(
   [ -r /proc/config.gz ] \
   && eval "$(zcat /proc/config.gz \
	| sed -e 's/^# \(.*\) is not set/\1=n/')"
    if [ "$CONFIG_EXT2_FS" == y -a \
	 "$CONFIG_EXT2_FS_POSIX_ACL"  == y -a \
	 "$CONFIG_EXT2_FS_XATTR_USER" == y ] ; then
	cd %_builddir/tests
	export PATH=$RPM_BUILD_ROOT/usr/bin:$PATH
	make
    else
	echo "Test suite skipped: requires a kernel with the " \
	     "CONFIG_EXT2_FS_POSIX_ACL and CONFIG_EXT2_FS_XATTR_USER features."
    fi
)
mv $RPM_BUILD_ROOT/usr/sbin/rmt $RPM_BUILD_ROOT/sbin
ln -sf ../sbin/rmt $RPM_BUILD_ROOT/etc/rmt

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-, root, root)
%dir %{_docdir}/star
%docdir %{_docdir}/star
%attr(644,root,root) %{_docdir}/star/*
%dir %{_docdir}/rmt
%docdir %{_docdir}/rmt
%attr(644,root,root) %{_docdir}/rmt/*
%config(noreplace) %attr(644, root, root) /etc/default/rmt
%config(noreplace) %attr(644, root, root) /etc/default/star
/usr/bin/smt
/usr/bin/star
/usr/bin/ustar
/usr/bin/tartest
/sbin/rmt
/etc/rmt
/usr/share/man/man1/match.1.gz
/usr/share/man/man1/rmt.1.gz
/usr/share/man/man1/star.1.gz
/usr/share/man/man1/tartest.1.gz

%changelog