##
##  rt.spec -- OpenPKG RPM Specification
##  Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
##  Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
##  Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
##
##  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.
##

%define       V_real 2-0-15
%define       V_here 2.0.15

#   package information
Name:         rt
Summary:      Request Tracker
URL:          http://www.fsck.com/projects/rt/
Vendor:       Fsck
Packager:     The OpenPKG Project
Distribution: OpenPKG [JUNK]
Group:        Database
License:      GPL
Version:      %{V_here}
Release:      20021005

#   list of sources
Source0:      http://www.fsck.com/pub/rt/release/rt-%{V_real}.tar.gz

#   build information
Prefix:       %{l_prefix}
BuildRoot:    %{l_buildroot}
BuildPreReq:  OpenPKG, openpkg >= 20020206
PreReq:       OpenPKG, openpkg >= 20020206, perl, mysql, apache
AutoReq:      no
AutoReqProv:  no

%description
    RT is an industrial-grade ticketing system. It lets a group of
    people intelligently and efficiently manage requests submitted by a
    community of users. RT is used by systems administrators, customer
    support staffs, NOCs, developers and even marketing departments at
    over a thousand sites around the world.

%prep
    %setup -q -n rt-%{V_real}

%build
    %{l_shtool} subst \
        -e 's;^\(PERL *= *\).*;\1%{l_prefix}/bin/perl;g' \
        -e 's;^\(BIN_OWNER *= *\).*;\1%{l_musr};g' \
        -e 's;^\(RTGROUP *= *\).*;\1%{l_mgrp};g' \
        -e 's;^\(LIBS_OWNER *= *\).*;\1%{l_musr};g' \
        -e 's;^\(LIBS_GROUP *= *\).*;\1%{l_mgrp};g' \
        -e 's;^\(RT_PATH *= *\).*;\1%{l_prefix}/share/rt;g' \
        -e 's;^\(RT_LIB_PATH *= *\).*;\1%{l_prefix}/share/rt;g' \
        -e 's;^\(RT_ETC_PATH *= *\).*;\1%{l_prefix}/etc/rt;g' \
        -e 's;^\(RT_BIN_PATH *= *\).*;\1%{l_prefix}/bin;g' \
        -e 's;^\(RT_MAN_PATH *= *\).*;\1%{l_prefix}/man;g' \
        -e 's;^\(MASON_LOCAL_HTML_PATH *= *\).*;\1%{l_prefix}/share/rt/mason;g' \
        -e 's;^\(MASON_DATA_PATH *= *\).*;\1%{l_prefix}/var/rt/mason-data;g' \
        -e 's;^\(MASON_SESSION_PATH *= *\).*;\1%{l_prefix}/var/rt/mason-session;g' \
        -e 's;^\(RT_LOG_PATH *= *\).*;\1%{l_prefix}/var/rt/log;g' \
        -e 's;^\(RT_MODPERL_HANDLER *= *\).*;\1%{l_prefix}/cgi/rt/webmux.pl;g' \
        -e 's;^\(RT_FASTCGI_HANDLER *= *\).*;\1%{l_prefix}/cgi/rt/mason_handler.fcgi;g' \
        -e 's;^\(RT_SPEEDYCGI_HANDLER *= *\).*;\1%{l_prefix}/cgi/rt/mason_handler.scgi;g' \
        -e 's;^\(DB_TYPE *= *\).*;\1mysql;g' \
        -e 's;^\(DB_HOST *= *\).*;\1localhost;g' \
        -e 's;^\(DB_PORT *= *\).*;\1;g' \
        -e 's;^\(DB_HOME *= *\).*;\1%{l_prefix};g' \
        -e 's;^\(DB_DBA *= *\).*;\1root;g' \
        -e 's;^\(DB_DBA_PASSWORD *= *\).*;\1XXX;g' \
        -e 's;^\(DB_RT_HOST *= *\).*;\1localhost;g' \
        -e 's;^\(DB_DATABASE *= *\).*;\1RT;g' \
        -e 's;^\(DB_RT_USER *= *\).*;\1RT;g' \
        -e 's;^\(DB_RT_PASS *= *\).*;\1XXX;g' \
        -e 's;^\(WEB_USER *= *\).*;\1%{l_nusr};g' \
        -e 's;^\(WEB_GROUP *= *\).*;\1%{l_ngrp};g' \
        -e 's;chown;true;g' \
        -e 's;chgrp;true;g' \
        -e 's;mkdir -p;%{l_shtool} mkdir -p;g' \
        Makefile
    %{l_make} %{l_mflags}

%install
    rm -rf $RPM_BUILD_ROOT
    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean
    rm -rf $RPM_BUILD_ROOT

