##
##  cvsweb.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package information
Name:         cvsweb
Summary:      CVS Repository Web-Browsing
URL:          http://www.freebsd.org/projects/cvsweb.html
Vendor:       Bill Fenner, Henner Zeller, Akinori MUSHA
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        PLUS
Group:        SCM
License:      BSD
Version:      3.0.6
Release:      20080101

#   list of sources
Source0:      http://people.freebsd.org/~scop/cvsweb/cvsweb-%{version}.tar.gz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101
PreReq:       OpenPKG, openpkg >= 20160101, rcs, perl
PreReq:       perl-sys, perl-www, cvs, gzip, tar, infozip

%description
    cvsweb is a WWW CGI script that allows remote users to browse a CVS
    repository tree via web. It can display the revision history of a
    file, as well as diffs between revisions and downloading the whole
    file.

%track
    prog cvsweb = {
        version   = %{version}
        url       = http://people.freebsd.org/~scop/cvsweb/
        regex     = cvsweb-(__VER__)\.tar\.gz
    }

%prep
    %setup -q

%build
    %{l_shtool} subst \
        -e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;' \
        -e 's;/usr/local/etc/cvsweb/cvsweb.conf;%{l_prefix}/etc/cvsweb/cvsweb.conf;' \
        cvsweb.cgi
    %{l_shtool} subst \
        -e 's;/bin /usr/bin /usr/local/bin;%{l_prefix}/bin /bin /usr/bin;g' \
        -e 's;/usr/local/etc/apache/mime\.types;%{l_prefix}/etc/apache/mime.types;g' \
        cvsweb.conf

%install
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/cgi \
        $RPM_BUILD_ROOT%{l_prefix}/etc/cvsweb \
        $RPM_BUILD_ROOT%{l_prefix}/share/cvsweb
    %{l_shtool} install -c -m 755 \
        cvsweb.cgi $RPM_BUILD_ROOT%{l_prefix}/cgi/cvsweb
    %{l_shtool} install -c -m 644 \
        cvsweb.conf $RPM_BUILD_ROOT%{l_prefix}/etc/cvsweb/cvsweb.conf
    %{l_shtool} install -c -m 644 \
        icons/miniback.gif $RPM_BUILD_ROOT%{l_prefix}/share/cvsweb/back.gif
    %{l_shtool} install -c -m 644 \
        icons/minidir.gif $RPM_BUILD_ROOT%{l_prefix}/share/cvsweb/dir.gif
    %{l_shtool} install -c -m 644 \
        icons/minitext.gif $RPM_BUILD_ROOT%{l_prefix}/share/cvsweb/text.gif
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
        %{l_files_std} \
        '%config %{l_prefix}/etc/cvsweb/cvsweb.conf'

%files -f files

%clean

