##
##  w3m.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.
##

#   package information
Name:         w3m
Summary:      Interactive Full-Screen Client for HTTP/HTTPS/FTP Protocols
URL:          http://w3m.sourceforge.net/
Vendor:       Akinori Ito
Packager:     The OpenPKG Project
Distribution: OpenPKG [BASE]
Group:        Web
License:      BSD
Version:      0.3.2.2
Release:      20030102

#   list of sources
Source0:      http://osdn.dl.sourceforge.net/sourceforge/w3m/w3m-%{version}.tar.gz
Patch0:       w3m-ssl.patch

#   build information
Prefix:       %{l_prefix}
BuildRoot:    %{l_buildroot}
BuildPreReq:  OpenPKG, openpkg >= 20020206, ncurses, openssl, make, zlib
PreReq:       OpenPKG, openpkg >= 20020206, ncurses
AutoReq:      no
AutoReqProv:  no

%description
    W3M is a text-based web browser as well as a pager like `more'
    or `less'. With w3m you can browse web pages through a terminal
    emulator window (xterm, rxvt or something like that). Moreover, w3m
    can be used as a text formatting tool which typesets HTML into plain
    text.

%prep
    %setup -q
    %patch0 -p0

%build
    ( echo "# Configuration at `hostname`"
      echo "def_bindir='%{l_prefix}/bin'"
      echo "def_libdir='%{l_prefix}/libexec/w3m'"
      echo "def_helpdir='%{l_prefix}/share/w3m'"
      echo "pref_lang=2"
      echo "lynx_key=n"
      echo "ftppass_hostnamegen=n"
      echo "show_params=n"
      echo "use_nntp=n"
      echo "ansi_color=n"
      echo "use_color=y"
      echo "use_menu=y"
      echo "use_mouse=y"
      echo "use_cookie=y"
      echo "use_ssl=y"
      echo "dmodel=5"
      echo "customized=y"
      echo "use_ssl_verify=n"
      echo "dcc='%{l_cc}'"
      echo "dcflags='%{l_cflags -O} -I%{l_prefix}/include -I%{l_prefix}/include/openssl -I.'"
      echo "dldflags='-L%{l_prefix}/lib'"
      echo "dtermlib='-lncurses'"
    ) >config.param
    echo "2" | ./configure -yes
    %{l_shtool} subst -e 's;-L ; ;' config.h
    %{l_make} %{l_mflags}

%install
    rm -rf $RPM_BUILD_ROOT
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/bin \
        $RPM_BUILD_ROOT%{l_prefix}/share/w3m \
        $RPM_BUILD_ROOT%{l_prefix}/libexec/w3m
    %{l_shtool} install -c -s -m 755 w3m $RPM_BUILD_ROOT%{l_prefix}/bin/
    %{l_shtool} install -c -s -m 755 \
        w3mbookmark w3mhelperpanel \
        $RPM_BUILD_ROOT%{l_prefix}/libexec/w3m/
    %{l_shtool} install -c -m 755 \
        scripts/dirlist.cgi $RPM_BUILD_ROOT%{l_prefix}/libexec/w3m/
    %{l_shtool} install -c -m 644 w3mhelp-w3m_en.html \
        $RPM_BUILD_ROOT%{l_prefix}/share/w3m/w3mhelp.html
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean
    rm -rf $RPM_BUILD_ROOT

