9c9db9d
# Review bug: https://bugzilla.redhat.com/479723
9c9db9d
32eb1d5
%global gitver      2.7.0
a94947b
%global cachedir    %{_localstatedir}/cache/%{name}
a602a24
%global filterdir   %{_libexecdir}/%{name}/filters
a94947b
%global scriptdir   %{_localstatedir}/www/cgi-bin
a94947b
%global cgitdata    %{_datadir}/%{name}
9c9db9d
8b04e6e
%global syntax_highlight 1
8b04e6e
8b04e6e
%if 0%{?rhel} && 0%{?rhel} <= 5
8b04e6e
# On el5, manual actions are needed to make syntax highlighting work
8b04e6e
%global syntax_highlight 0
8b04e6e
%endif
8b04e6e
8b04e6e
# Temporarily -- in epel-7-ppc64 is not highlight package currently, #1117261
8b04e6e
%if 0%{?rhel} == 7
8b04e6e
%ifarch ppc64
8b04e6e
%global syntax_highlight 0
8b04e6e
%endif
8b04e6e
%endif
8b04e6e
a94947b
%global make_cgit \
9c9db9d
export CFLAGS="%{optflags}" \
836c846
export LDFLAGS="%{?__global_ldflags}" \
9c9db9d
make V=1 %{?_smp_mflags} \\\
9c9db9d
     DESTDIR=%{buildroot} \\\
9c9db9d
     INSTALL="install -p"  \\\
9c9db9d
     CACHE_ROOT=%{cachedir} \\\
9c9db9d
     CGIT_SCRIPT_PATH=%{scriptdir} \\\
9c9db9d
     CGIT_SCRIPT_NAME=cgit \\\
593cd4b
     CGIT_DATA_PATH=%{cgitdata} \\\
a602a24
     docdir=%{docdir} \\\
f7db80f
     filterdir=%{filterdir} \\\
f7db80f
     prefix=%{_prefix}
9c9db9d
9c9db9d
Name:           cgit
32eb1d5
Version:        0.12
32eb1d5
Release:        1%{?dist}
a94947b
Summary:        A fast web interface for git
9c9db9d
9c9db9d
Group:          Development/Tools
9c9db9d
License:        GPLv2
e40abfe
URL:            http://git.zx2c4.com/cgit/
e40abfe
Source0:        http://git.zx2c4.com/cgit/snapshot/%{name}-%{version}.tar.xz
f017a6c
Source1:        http://www.kernel.org/pub/software/scm/git//git-%{gitver}.tar.xz
9c9db9d
Source2:        cgitrc
18e201b
Source3:        README.SELinux
8b04e6e
8b04e6e
%if %{syntax_highlight}
8b04e6e
# On all but RHEL5 highlight is version 3.
0133e5a
Patch1:         cgit-0.9.1-highlightv3.patch
1f090cf
BuildRequires:  highlight
0133e5a
%endif
9c9db9d
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
9c9db9d
593cd4b
BuildRequires:  asciidoc
593cd4b
%if 0%{?rhel} && 0%{?rhel} <= 5
593cd4b
# These are missing asciidoc requirements
593cd4b
BuildRequires:  docbook-style-xsl libxslt
593cd4b
%endif
7e88cbe
%if 0%{?fedora} || 0%{?rhel} >= 6
9c9db9d
BuildRequires:  libcurl-devel
9c9db9d
%else
9c9db9d
BuildRequires:  curl-devel
9c9db9d
%endif
9c9db9d
BuildRequires:  openssl-devel
591edd3
BuildRequires:  lua-devel
d552c46
8cc47a6
%if 0%{?fedora}
d552c46
# just to be able to install httpd configuration correctly, FC21+
d552c46
Requires:       httpd-filesystem
8cc47a6
Requires:       webserver
8cc47a6
%else
3c7b26b
Requires:       httpd
8cc47a6
%endif
d552c46
9c9db9d
9c9db9d
%description
a94947b
Cgit is a fast web interface for git.  It uses caching to increase performance.
9c9db9d
9c9db9d
%prep
9c9db9d
%setup -q -a 1
8b04e6e
%if %{syntax_highlight}
0133e5a
%patch1 -p1
0133e5a
%endif
9c9db9d
9c9db9d
# setup the git dir
9c9db9d
rm -rf git
9c9db9d
mv git-%{gitver} git
9248f75
sed -i 's|^\(CFLAGS = \).*|\1%{optflags}|' git/Makefile
9c9db9d
a9267ec
# I tried to use matchpathcon, but we would need to require
a9267ec
# selinux-policy-targeted probably.
a9267ec
a9267ec
build_dist=%{?fedora:fedora}%{?rhel:rhel}
a9267ec
build_ver=%{?fedora}%{?rhel}
a9267ec
a9267ec
cgit_context=git_content_t
a9267ec
case "$build_dist-$build_ver" in
a9267ec
    fedora-19|fedora-20|rhel-6|rhel-7)
a9267ec
        cgit_context=httpd_git_content_t
a9267ec
        ;;
a9267ec
    rhel-5|-)
a9267ec
        cgit_context=httpd_sys_content_t
a9267ec
        ;;
a9267ec
esac
a9267ec
a9267ec
sed -e "s|@CGIT_CONTEXT@|$cgit_context|g" \
18e201b
    %{SOURCE3} > README.SELinux
18e201b
18e201b
cat > httpd.conf <
18e201b
Alias /cgit-data /usr/share/cgit
18e201b
ScriptAlias /cgit /var/www/cgi-bin/cgit
18e201b
%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7
18e201b
<Directory "/usr/share/cgit">
18e201b
    Require all granted
18e201b
</Directory>
18e201b
%endif
18e201b
EOF
18e201b
a9267ec
9c9db9d
%build
9c9db9d
%{make_cgit}
9c9db9d
593cd4b
# Something in the a2x chain doesn't like running in parallel. :/
593cd4b
%{make_cgit} -j1 doc-man doc-html
593cd4b
8b04e6e
%if %{syntax_highlight}
1f090cf
# el5 highlight doesn't know --print-style
1f090cf
highlight --print-style --style-outfile=stdout >> cgit.css
1f090cf
%endif
1f090cf
9c9db9d
9c9db9d
%install
9c9db9d
rm -rf %{buildroot}
593cd4b
%{make_cgit} install install-man
9c9db9d
install -d -m0755 %{buildroot}%{_sysconfdir}/httpd/conf.d
9c9db9d
install -p -m0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/cgitrc
18e201b
install -p -m0644 httpd.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/cgit.conf
9c9db9d
install -d -m0755 %{buildroot}%{cachedir}
9c9db9d
a94947b
9c9db9d
%clean
9c9db9d
rm -rf %{buildroot}
9c9db9d
9c9db9d
9c9db9d
%files
9c9db9d
%defattr(-,root,root,-)
593cd4b
%doc COPYING README* *.html
9c9db9d
%config(noreplace) %{_sysconfdir}/cgitrc
9c9db9d
%config(noreplace) %{_sysconfdir}/httpd/conf.d/cgit.conf
9c9db9d
%dir %attr(-,apache,root) %{cachedir}
9c9db9d
%{cgitdata}
a602a24
%{filterdir}
9c9db9d
%{scriptdir}/*
593cd4b
%{_mandir}/man*/*
9c9db9d
9c9db9d
9c9db9d
%changelog
32eb1d5
* Sat Jan 16 2016 Kevin Fenzi <kevin@scrye.com> - 0.12-1
32eb1d5
- Update to 0.12. Fixes bug #1298912
32eb1d5
- Fixes CVE-2016-1899 CVE-2016-1900 CVE-2016-1901
32eb1d5
8cc47a6
* Sat Sep 05 2015 Kevin Fenzi <kevin@scrye.com> 0.11.2-3
8cc47a6
- Fix up logic around webserver and httpd.
8cc47a6
- On Fedora require webserver and httpd-filesystem
8cc47a6
- On EPEL require httpd.
8cc47a6
11f4cd7
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.11.2-2
11f4cd7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
11f4cd7
6b1d161
* Sat Mar 14 2015 Kevin Fenzi <kevin@scrye.com> 0.11.2-1
6b1d161
- Update to 0.11.2
6b1d161
9248f75
* Tue Mar 10 2015 Kevin Fenzi <kevin@scrye.com> 0.11.1-1
9248f75
- Update to 0.11.1
9248f75
09f7552
* Mon Feb 16 2015 Kevin Fenzi <kevin@scrye.com> 0.11.0-1
09f7552
- Update to 0.11.0
09f7552
d552c46
* Mon Feb 09 2015 Pavel Raiskup <praiskup@redhat.com> - 0.10.2-5
d552c46
- require "any" 'webserver' instead of concrete 'httpd' (#1138599)
d552c46
44c7db8
* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.2-4
44c7db8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
44c7db8
8b04e6e
* Tue Jul 08 2014 Pavel Raiskup <praiskup@redhat.com> - 0.10.2-3
8b04e6e
- currently epel-7-ppc64 does not have highlight package (#1117261)
8b04e6e
18e201b
* Tue Jul 08 2014 Pavel Raiskup <praiskup@redhat.com> - 0.10.2-2
a9267ec
- install README.SELinux documentation again (#1036123)
18e201b
- generate cgit.conf for httpd >= 2.4 when needed
a9267ec
f017a6c
* Tue Jul 01 2014 Kevin Fenzi <kevin@scrye.com> 0.10.2-1
f017a6c
- Update to 0.10.2. Fixes bug #1114970
f017a6c
d0b0c57
* Wed Jun 11 2014 Kevin Fenzi <kevin@scrye.com> 0.10.1-4
d0b0c57
- Add patch to fix raw patch handling
d0b0c57
0084c70
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.1-3
0084c70
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
0084c70
1f090cf
* Thu Mar 20 2014 Ville Skyttä <ville.skytta@iki.fi> - 0.10.1-2
1f090cf
- Include highlight styles in cgit.css
1f090cf
591edd3
* Thu Feb 27 2014 Kevin Fenzi <kevin@scrye.com> 0.10.1-1
591edd3
- Update to 0.10.1
591edd3
- Correctly enable lua filters. 
591edd3
f7db80f
* Wed Feb 19 2014 Kevin Fenzi <kevin@scrye.com> 0.10-1
f7db80f
- Update to 0.10
f7db80f
e8ca97b
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.2-2
e8ca97b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
e8ca97b
0cb92fb
* Mon May 27 2013 Todd Zullinger <tmz@pobox.com> - 0.9.2-1
0cb92fb
- Update to 0.9.2, fixes CVE-2013-2117
0cb92fb
9aaef07
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.1-4
9aaef07
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
9aaef07
836c846
* Wed Nov 21 2012 Kevin Fenzi <kevin@scrye.com> 0.9.1-3
836c846
- Fixed ldflags. Fixes bug 878611
836c846
0133e5a
* Sat Nov 17 2012 Kevin Fenzi <kevin@scrye.com> 0.9.1-2
0133e5a
- Add patch to use correct version of highlight for all branches except epel5
0133e5a
e40abfe
* Thu Nov 15 2012 Kevin Fenzi <kevin@scrye.com> 0.9.1-1
e40abfe
- Update to 0.9.1
e40abfe
- Fixes bug #870714 - CVE-2012-4548
e40abfe
- Fixes bug #820733 - CVE-2012-4465
e40abfe
22a6465
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.0.2-4
22a6465
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
22a6465
2a8cd42
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.0.2-3
2a8cd42
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
2a8cd42
e92f127
* Fri Jul 22 2011 Todd Zullinger <tmz@pobox.com> - 0.9.0.2-2
e92f127
- Fix potential XSS vulnerability in rename hint
e92f127
c7cf646
* Thu Jul 21 2011 Todd Zullinger <tmz@pobox.com> - 0.9.0.2-1
c7cf646
- Update to 0.9.0.2
c7cf646
a94947b
* Sun Mar 06 2011 Todd Zullinger <tmz@pobox.com> - 0.9-1
a94947b
- Update to 0.9
a94947b
- Fixes: CVE-2011-1027
a94947b
  http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1027
593cd4b
- Generate and install man page and html docs
7e88cbe
- Use libcurl-devel on RHEL >= 6
a602a24
- Include example filter scripts
2f0e005
- Update example cgitrc
a94947b
abc359a
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.2.1-5
abc359a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
abc359a
637b845
* Mon Sep 27 2010 Todd Zullinger <tmz@pobox.com> - 0.8.2.1-4
637b845
- Appy upstream git patch for CVE-2010-2542 (#618108)
637b845
d6e9b1c
* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 0.8.2.1-3
d6e9b1c
- rebuilt with new openssl
d6e9b1c
99cd6f2
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.2.1-2
99cd6f2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
99cd6f2
39fe829
* Sun Mar 15 2009 Todd Zullinger <tmz@pobox.com> - 0.8.2.1-1
39fe829
- Update to 0.8.2.1
39fe829
45a6845
* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.2-2
45a6845
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
45a6845
8585ea8
* Sun Feb 01 2009 Todd Zullinger <tmz@pobox.com> - 0.8.2-1
8585ea8
- Update to 0.8.2
8585ea8
- Drop upstreamed Makefile patch
8585ea8
0541f93
* Sun Jan 18 2009 Todd Zullinger <tmz@pobox.com> - 0.8.1-2
0541f93
- Rebuild with new openssl
0541f93
9c9db9d
* Mon Jan 12 2009 Todd Zullinger <tmz@pobox.com> - 0.8.1-1
9c9db9d
- Initial package