##
##  blosxom.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:         blosxom
Summary:      The Zen of Blogging
URL:          http://www.blosxom.com/
Vendor:       Rael Dornfest
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        CMS
License:      GPL
Version:      2.0
Release:      20080101

#   list of sources
Source0:      http://www.blosxom.com/downloads/blosxom.zip
Source1:      http://www.blosxom.com/downloads/blosxom_flavour_sampler.zip
Source2:      http://daringfireball.net/projects/downloads/SmartyPants_1.5.1.zip
Source3:      http://www.blosxom.com/downloads/plugins/rss10
Source4:      http://www.blosxom.com/downloads/plugins/atomfeed
Source5:      http://www.blosxom.com/downloads/plugins/google_sitesearch
Source6:      http://fletcher.freeshell.org/downloads/antispam
Source7:      http://fletcher.freeshell.org/downloads/breadcrumbs
Source8:      http://fletcher.freeshell.org/downloads/find
Source9:      http://fletcher.freeshell.org/downloads/menu
Source10:     http://fletcher.freeshell.org/downloads/writeback
Source11:     http://www.blosxom.com/downloads/plugins/meta
Source12:     http://my-security.net/bloxsom/directorybrowse.txt
Source13:     http://www.cobblers.net/files/lastmodified
Source14:     http://www.decafbad.com/2003/03/blosxom/multiblosxom
Source15:     http://www.blosxom.com/downloads/plugins/flavourdir
Source16:     http://www.blosxom.com/downloads/plugins/config
Source17:     http://homepage.mac.com/barijaona/download/static_file
Source18:     http://www.grayman.de/files/blosxom/toc
Source19:     http://jclark.org/download/plugins/moreentries
Source20:     http://www.blosxom.com/downloads/plugins/date_fullname
Source21:     http://www.insanum.com/downloads/BlosxomV2/categorytree.gz
Patch0:       blosxom.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, infozip
PreReq:       OpenPKG, openpkg >= 20160101, perl

%description
    Blosxom (pronounced "blossom") is a lightweight yet feature-packed
    weblog application designed from the ground up with simplicity,
    usability, and interoperability in mind. It just uses the filesystem
    for storing the blog entries.

%track
    prog blosxom = {
        disabled
        comment   = "rse: no tracking possible"
        version   = %{version}
        url       = http://www.blosxom.com/
        regex     = blosxom\.zip
    }

%prep
    %setup -q -T -c
    %{l_prefix}/bin/unzip -x %{SOURCE0}
    %{l_prefix}/bin/unzip -x %{SOURCE1}
    %{l_prefix}/bin/unzip -x %{SOURCE2}
    %patch -p0

%build

%install
    #   create installation hierarchy
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/cgi \
        $RPM_BUILD_ROOT%{l_prefix}/libexec/blosxom \
        $RPM_BUILD_ROOT%{l_prefix}/share/blosxom/data \
        $RPM_BUILD_ROOT%{l_prefix}/var/blosxom/state \
        $RPM_BUILD_ROOT%{l_prefix}/var/blosxom/cache

    #   install main program
    %{l_shtool} install -c -m 755 \
        -e 's:#!/usr/bin/perl:#!%{l_prefix}/bin/perl:' \
        -e 's:\(datadir = .\).*\(.;\):\1%{l_prefix}/share/blosxom/data\2:' \
        -e 's:\(plugin_dir = .\).*\(.;\):\1%{l_prefix}/libexec/blosxom\2:' \
        -e 's:\(plugin_state_dir = .\).*\(.;\):\1%{l_prefix}/var/blosxom/state\2:' \
        -e 's:\(static_dir = .\).*\(.;\):\1%{l_prefix}/var/blosxom/cache\2:' \
        -e 's:\(static_password = .\).*\(.;\):\1bloxsom\2:' \
        blosxom.cgi $RPM_BUILD_ROOT%{l_prefix}/cgi/

    #   install default flavours
    %{l_shtool} install -c -m 644 \
        flavours/* $RPM_BUILD_ROOT%{l_prefix}/share/blosxom/data/

    #   install plugins
    %{l_shtool} install -c -m 644 \
        -e 's;package SmartyPants;package smartypants;' \
        SmartyPants*/SmartyPants.pl \
        $RPM_BUILD_ROOT%{l_prefix}/libexec/blosxom/smartypants
    %{l_shtool} install -c -m 644 \
        %{SOURCE rss10} %{SOURCE atomfeed} %{SOURCE google_sitesearch} %{SOURCE antispam} \
        %{SOURCE breadcrumbs} %{SOURCE find} %{SOURCE menu} %{SOURCE writeback} %{SOURCE meta} \
        %{SOURCE lastmodified} %{SOURCE multiblosxom} %{SOURCE flavourdir} %{SOURCE config} \
        %{SOURCE static_file} %{SOURCE toc} %{SOURCE moreentries} %{SOURCE date_fullname} \
        $RPM_BUILD_ROOT%{l_prefix}/libexec/blosxom/
    %{l_shtool} install -c -m 644 \
        %{SOURCE directorybrowse.txt} \
        $RPM_BUILD_ROOT%{l_prefix}/libexec/blosxom/directorybrowse
    %{l_gzip} -d <%{SOURCE categorytree.gz} >categorytree
    %{l_shtool} install -c -m 644 \
        categorytree \
        $RPM_BUILD_ROOT%{l_prefix}/libexec/blosxom/

    #   determine installation files
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
        %{l_files_std} \
        '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/blosxom/*'

%files -f files

%clean

