guix/guix.spec
2016-12-31 10:48:21 +00:00

153 lines
4.7 KiB
RPMSpec

#
# spec file for package guix
#
# Copyright (c) 2016 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/
#
# if there is systemd present, systemd_requires is defined
%define systemd_present %{defined systemd_requires}
%define guile guile-2.0.9.tar.xz
%define guix_builder_group guixbuild
Name: guix
Version: 0.12.0
Release: 0
Summary: GNU Package manager
License: GPL-3.0
Group: System/Packages
Url: http://www.gnu.org/software/guix/
Source0: ftp://alpha.gnu.org/gnu/guix/%{name}-%{version}.tar.gz
Source1: ftp://alpha.gnu.org/gnu/guix/%{name}-%{version}.tar.gz.sig
Source2: %{name}.keyring
# source file renamed - this would lead to 3 same file names
# http://alpha.gnu.org/gnu/guix/bootstrap/i686-linux/20131110/%%{guile}
Source3: i686-linux-%{guile}
# http://alpha.gnu.org/gnu/guix/bootstrap/x86_64-linux/20131110/%%{guile}
Source4: x86_64-linux-%{guile}
# http://alpha.gnu.org/gnu/guix/bootstrap/mips64el-linux/20131110/%%{guile}
Source5: mips64el-linux-%{guile}
# http://alpha.gnu.org/gnu/guix/bootstrap/armhf-linux/20150101/guile-2.0.11.tar.xz
Source6: armhf-linux-guile-2.0.11.tar.xz
Source10: guix-rpmlintrc
BuildRequires: emacs-nox
BuildRequires: gcc-c++
BuildRequires: gnutls-guile
BuildRequires: guile-json
BuildRequires: libgcrypt-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(bzip2)
BuildRequires: pkgconfig(gnutls)
BuildRequires: pkgconfig(guile-2.0) >= 2.0.7
BuildRequires: pkgconfig(sqlite3)
Requires: gnutls-guile
Requires: guile
Requires: libgcrypt-devel
Requires(pre): %{install_info_prereq}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: %ix86 x86_64 %arm
%{?systemd_requires}
%if %{systemd_present}
BuildRequires: systemd-rpm-macros
%endif
%description
Purely functional package manager and a distribution thereof.
%prep
%setup -q
# install service file to _unitdir
sed -i 's@\$(libdir)/systemd/system@%{_unitdir}@' Makefile.in
mkdir -p gnu/packages/bootstrap/{i686,x86_64,mips64el,armhf}-linux
cp %{SOURCE3} gnu/packages/bootstrap/i686-linux/%{guile}
cp %{SOURCE4} gnu/packages/bootstrap/x86_64-linux/%{guile}
cp %{SOURCE5} gnu/packages/bootstrap/mips64el-linux/%{guile}
cp %{SOURCE6} gnu/packages/bootstrap/armhf-linux/guile-2.0.11.tar.xz
%build
%configure \
--disable-silent-rules
make %{?_smp_mflags}
%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
%find_lang %{name}
%find_lang guix-packages
rm %{buildroot}%{_infodir}/dir
install -d -m 0755 %{buildroot}/gnu
install -d -m 0755 %{buildroot}/gnu/store
%if ! %{systemd_present}
rm -rvf %{buildroot}%{_unitdir}
%else
# if systemd is used, upstart files are not needed
rm -rvf %{buildroot}%{_libdir}/upstart
%endif
ln -sf /usr/sbin/service %{buildroot}%{_sbindir}/rcguix-daemon
%pre
%{_sbindir}/groupadd -r %{guix_builder_group} >/dev/null 2>/dev/null || :
for i in `seq 1 5`; do
%{_sbindir}/useradd -r -o -g %{guix_builder_group} -G %{guix_builder_group} \
-u $((60+$i)) -c "Guix builder $i" -s /sbin/nologin \
-d %{_localstatedir}/empty guix-builder$i 2> /dev/null || :
done
%if %{systemd_present}
%service_add_pre guix-daemon.service
%preun
%service_del_preun guix-daemon.service
%endif
%post
%install_info --info-dir=%{_infodir} %{_infodir}/guix.info.gz
%if %{systemd_present}
%service_add_post guix-daemon.service
%endif
%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/guix.info.gz
%if %{systemd_present}
%service_del_postun guix-daemon.service
%endif
%files -f %{name}.lang -f guix-packages.lang
%defattr(-,root,root)
%doc COPYING README
# bash completion script is not configuration file but who would argue
# with RPM lint :b
%{_sysconfdir}/bash_completion.d/guix
%{_datadir}/guile
%{_datadir}/guix
%{_datadir}/zsh
%{_datadir}/emacs/site-lisp/guix*
%{_bindir}/guix*
%{_sbindir}/*guix*
%{_libexecdir}/guix
%{_libexecdir}/guix-authenticate
%if !0%{?systemd_present}
%{_libdir}/upstart
%endif
%{_infodir}/guix*
%{_infodir}/images
%if %{systemd_present}
%{_unitdir}/guix*.service
%endif
%{_mandir}/man1/guix*
%attr(755,root,root) %dir /gnu
%attr(775,root,%{guix_builder_group}) %dir /gnu/store
%changelog