92794d0
Name:		icecream
92794d0
Version:	0.8.0
1dbccc9
Release:	7.20071101svn%{?dist}
92794d0
Summary:	Distributed compiler
92794d0
92794d0
Group:		Development/Tools
92794d0
License:	GPLv2
92794d0
URL:		http://en.opensuse.org/Icecream
92794d0
# The source was pulled from upstream's SVN repository:
92794d0
# svn export -r 731514 svn://anonsvn.kde.org/home/kde/trunk/icecream icecream-0.8.0
92794d0
# tar -czvf icecream-0.8.0.tar.gz icecream-0.8.0
92794d0
Source0:	icecream-0.8.0.tar.gz
8d4b890
Source1:	icecream.sh.in
8d4b890
Source2:	icecream.csh.in
30e4dae
Source3:	icecream.fc
30e4dae
Source4:	icecream.te
30e4dae
Source5:	icecream.if
30e4dae
Source6:	initscript-iceccd
30e4dae
Source7:	initscript-scheduler
92794d0
Patch0:		icecream-rename-scheduler.patch
30e4dae
Patch1:		icecream-cleanup-conffile.patch
92794d0
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
92794d0
92794d0
BuildRequires:	automake autoconf libtool symlinks
92794d0
# To build manpages from KDE-style Docbook sources:
1dbccc9
BuildRequires:	kdelibs3 kdelibs3-devel
30e4dae
# For SELinux protection:
30e4dae
BuildRequires:	checkpolicy selinux-policy-devel hardlink
30e4dae
%define selinux_policyver %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp) 
30e4dae
%if "%{selinux_policyver}" != ""
30e4dae
Requires:	selinux-policy >= %{selinux_policyver}
30e4dae
%endif
30e4dae
%define selinux_variants mls strict targeted 
92794d0
92794d0
%bcond_without	fedora
92794d0
BuildRequires:	fedora-usermgmt-devel
92794d0
%{?FE_USERADD_REQ}
30e4dae
Requires(post):		chkconfig policycoreutils
30e4dae
Requires(preun):	chkconfig initscripts policycoreutils 
30e4dae
Requires(postun):	initscripts policycoreutils
92794d0
92794d0
Provides:	group(icecream) = 44
92794d0
Provides:	user(icecream)  = 44
92794d0
30e4dae
92794d0
# description copied from Debian icecc package
92794d0
%description
92794d0
Icecream is a distributed compile system. It allows parallel compiling by
92794d0
distributing the compile jobs to several nodes of a compile network running the
92794d0
icecc daemon. The icecc scheduler routes the jobs and provides status and
92794d0
statistics information to the icecc monitor. Each compile node can accept one
92794d0
or more compile jobs depending on the number of processors and the settings of
92794d0
the daemon. Link jobs and other jobs which cannot be distributed are executed
92794d0
locally on the node where the compilation is started.
92794d0
92794d0
%package	devel
92794d0
Summary:	Development files for %{name}
92794d0
Group:		Development/Libraries
92794d0
Requires:	%{name} = %{version}-%{release}
92794d0
92794d0
%description	devel
92794d0
This package contains development files for %{name}.
92794d0
92794d0
%prep
92794d0
%setup -q
92794d0
%patch0 -p0
92794d0
%patch1 -p0
92794d0
make -f Makefile.cvs
8d4b890
sed -e 's|@LIBDIR@|%{_libdir}|g' %{SOURCE1} > icecream.sh
8d4b890
sed -e 's|@LIBDIR@|%{_libdir}|g' %{SOURCE2} > icecream.csh
30e4dae
mkdir SELinux
30e4dae
cp -p %{SOURCE3} %{SOURCE4} %{SOURCE5} SELinux
30e4dae
mkdir fedora
30e4dae
cp -p %{SOURCE6} %{SOURCE7} fedora
92794d0
92794d0
%build
92794d0
%configure --disable-static --enable-shared
92794d0
make %{?_smp_mflags}
92794d0
pushd doc
92794d0
for i in man-*.docbook; do
92794d0
	meinproc --stylesheet %{_datadir}/apps/ksgmltools2/customization/kde-man.xsl $i
92794d0
	manfile=${i#man-}
92794d0
	manfile=${manfile%.docbook}
92794d0
	mv manpage.troff $manfile
92794d0
done
92794d0
popd
30e4dae
pushd SELinux
30e4dae
for selinuxvariant in %{selinux_variants}; do
30e4dae
	make NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile
30e4dae
	mv icecream.pp icecream.pp.${selinuxvariant}
30e4dae
	make NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile clean
30e4dae
done
30e4dae
popd
92794d0
92794d0
%install
92794d0
rm -rf %{buildroot}
92794d0
make install DESTDIR=%{buildroot}
92794d0
rm -f %{buildroot}/%{_libdir}/libicecc.la
92794d0
92794d0
# move the symlinks elsewhere
92794d0
mkdir -p %{buildroot}/%{_libdir}/icecc/bin
92794d0
for i in cc gcc c++ g++; do
92794d0
	ln -s %{buildroot}/%{_bindir}/icecc %{buildroot}/%{_libdir}/icecc/bin/$i
92794d0
	rm -f %{buildroot}/%{_bindir}/$i
92794d0
done
92794d0
92794d0
# relativize the symlinks
92794d0
symlinks -cs %{buildroot}/%{_libdir}/icecc/bin
92794d0
92794d0
# install manpages
92794d0
mkdir -p %{buildroot}/%{_mandir}/man{1,7,8}
92794d0
mv doc/scheduler.1 doc/icecc-scheduler.1
92794d0
for i in doc/*.1 doc/*.7; do
92794d0
	install -m 644 $i %{buildroot}/%{_mandir}/man${i##*.}
92794d0
done
92794d0
92794d0
# install config file and initscripts
92794d0
install -D -m 644 suse/sysconfig.icecream %{buildroot}/%{_sysconfdir}/sysconfig/icecream
92794d0
install -D -m 755 fedora/initscript-iceccd %{buildroot}/%{_sysconfdir}/rc.d/init.d/iceccd
92794d0
install -D -m 755 fedora/initscript-scheduler \
92794d0
	%{buildroot}/%{_sysconfdir}/rc.d/init.d/icecc-scheduler
8d4b890
install -d -m 755 %{buildroot}/%{_sysconfdir}/profile.d
8d4b890
install -p -m 644 icecream.sh icecream.csh %{buildroot}/%{_sysconfdir}/profile.d
92794d0
92794d0
# create default working dir
92794d0
mkdir -p %{buildroot}/%{_localstatedir}/cache/icecream
92794d0
30e4dae
for selinuxvariant in %{selinux_variants}; do
30e4dae
	install -d %{buildroot}/%{_datadir}/selinux/${selinuxvariant}
30e4dae
	install -p -m 644 -D SELinux/icecream.pp.${selinuxvariant} \
30e4dae
		 %{buildroot}/%{_datadir}/selinux/${selinuxvariant}/icecream.pp
30e4dae
done
30e4dae
# Hardlink identical policy module packages together
30e4dae
/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
30e4dae
92794d0
%pre
92794d0
# https://fedoraproject.org/wiki/PackageUserRegistry
92794d0
%__fe_groupadd 44 -r icecream &>/dev/null || :
92794d0
%__fe_useradd  44 -r -s /sbin/nologin -d %{_localstatedir}/cache/icecream -M \
30e4dae
	-c 'Icecream distributed compiler' -g icecream icecream &>/dev/null ||:
92794d0
92794d0
%post
92794d0
/sbin/ldconfig
30e4dae
# if [ "$1" -le 1 ]; then # First install
30e4dae
for selinuxvariant in %{selinux_variants}; do
30e4dae
	semodule -s ${selinuxvariant} -i \
30e4dae
		%{_datadir}/selinux/${selinuxvariant}/icecream.pp 2>/dev/null ||:
30e4dae
done
30e4dae
fixfiles -R %{name} restore ||:
30e4dae
restorecon -R %{_localstatedir}/cache/icecream ||:
30e4dae
restorecon %{_localstatedir}/log/iceccd ||:
30e4dae
semanage port -a -t iceccd_port_t -p tcp 10245 2>/dev/null ||:
30e4dae
semanage port -a -t icecc_scheduler_port_t -p tcp 8765 2>/dev/null ||:
30e4dae
semanage port -a -t icecc_scheduler_port_t -p udp 8765 2>/dev/null ||:
30e4dae
# fi
92794d0
/sbin/chkconfig --add iceccd
92794d0
/sbin/chkconfig --add icecc-scheduler
30e4dae
exit 0
92794d0
92794d0
%preun
30e4dae
if [ "$1" -eq 0 ]; then # Final removal
92794d0
	/sbin/service iceccd stop > /dev/null 2>&1
92794d0
	/sbin/service icecc-scheduler stop > /dev/null 2>&1
92794d0
	/sbin/chkconfig --del iceccd
92794d0
	/sbin/chkconfig --del icecc-scheduler
30e4dae
#	rm -rf %{_localstatedir}/cache/icecream
30e4dae
	semanage port -d -t iceccd_port_t -p tcp 10245 2>/dev/null ||:
30e4dae
	semanage port -d -t icecc_scheduler_port_t -p tcp 8765 2>/dev/null ||:
30e4dae
	semanage port -d -t icecc_scheduler_port_t -p udp 8765 2>/dev/null ||:
30e4dae
	for selinuxvariant in %{selinux_variants}; do
30e4dae
		semodule -s ${selinuxvariant} -r icecream 2>/dev/null ||:
30e4dae
	done
92794d0
fi
92794d0
exit 0
92794d0
92794d0
%postun
92794d0
/sbin/ldconfig
30e4dae
if [ "$1" -ge 1 ]; then # Upgrade
92794d0
	/sbin/service iceccd condrestart > /dev/null 2>&1
92794d0
	/sbin/service icecc-scheduler condrestart > /dev/null 2>&1
92794d0
fi
92794d0
exit 0
92794d0
92794d0
%clean
92794d0
rm -rf %{buildroot}
92794d0
92794d0
%files
92794d0
%defattr(-,root,root,-)
92794d0
%doc COPYING ChangeLog README BENCH NEWS TODO
92794d0
%{_bindir}/icecc
92794d0
%{_libdir}/icecc/bin/cc
92794d0
%{_libdir}/icecc/bin/gcc
92794d0
%{_libdir}/icecc/bin/c++
92794d0
%{_libdir}/icecc/bin/g++
92794d0
%{_libdir}/icecc/icecc-create-env
92794d0
%{_libdir}/libicecc.so.*
92794d0
%{_sbindir}/iceccd
92794d0
%{_sbindir}/icecc-scheduler
92794d0
%{_mandir}/man*/*
92794d0
%config(noreplace) %{_sysconfdir}/sysconfig/icecream
8d4b890
%config(noreplace) %{_sysconfdir}/profile.d/icecream.*sh
92794d0
%{_sysconfdir}/rc.d/init.d/iceccd
92794d0
%{_sysconfdir}/rc.d/init.d/icecc-scheduler
92794d0
%{_localstatedir}/cache/icecream
30e4dae
%{_datadir}/selinux/*/icecream.pp
92794d0
92794d0
%files devel
92794d0
%{_includedir}/icecc/*.h
92794d0
%{_libdir}/libicecc.so
92794d0
%{_libdir}/pkgconfig/icecc.pc
92794d0
92794d0
%changelog
1dbccc9
* Tue Jan  8 2008 Michal Schmidt <mschmidt@redhat.com> - 0.8.0-7.20071101svn
1dbccc9
- Build fix. meinproc is now in kdelibs3. BuildRequire that instead of kdelibs.
1dbccc9
4570b12
* Thu Nov 29 2007 Michal Schmidt <mschmidt@redhat.com> - 0.8.0-6.20071101svn
4570b12
- Rewritten the profile scripts to make icecream work together with ccache.
4570b12
89116ae
* Tue Nov 27 2007 Michal Schmidt <mschmidt@redhat.com> - 0.8.0-5.20071101svn
89116ae
- SELinux: Allow iceccd to contact the scheduler via UDP.
89116ae
- Don't add icecream to PATH in the profile scripts if ccache is installed
89116ae
  to avoid recursive invocations (bz #377761).
89116ae
30e4dae
* Tue Nov 20 2007 Michal Schmidt <mschmidt@redhat.com> - 0.8.0-4.20071101svn
30e4dae
- Add a SELinux policy for iceccd
30e4dae
- Initscripts as sources instead of patches in the .spec file
30e4dae
- Don't touch /var/log/iceccd in the initscript. Let iceccd create it.
30e4dae
8d4b890
* Mon Nov 12 2007 Michal Schmidt <mschmidt@redhat.com> - 0.8.0-3.20071101svn
8d4b890
- Add icecc to $PATH using scripts in profile.d
8d4b890
92794d0
* Tue Nov  6 2007 Michal Schmidt <mschmidt@redhat.com> - 0.8.0-2.20071101svn
92794d0
- Use the _datadir macro instead of hardcoded /usr/share
92794d0
92794d0
* Thu Nov 01 2007 Michal Schmidt <mschmidt@redhat.com> - 0.8.0-1.20071101svn
92794d0
- Initial package for Fedora.