%define _docdir %{_defaultdocdir}

Summary: A text-based Web browser.
Summary(ja): テキストベースのウェブブラウザ
Name: lynx
Version: 2.8.6
Release: 2%{?_dist_release}
License: GPL
Group: Applications/Internet
URL: http://lynx.isc.org/
# Source0: http://lynx.isc.org/current/lynx2.8.5dev.7.tar.bz2
Source0: http://lynx.isc.org/current/lynx2.8.6.tar.bz2
Source1: lynx.cfg.ja
# Patch0: lynx2-8-3-redhat.patch
Patch0: lynx2-8-6-redhat.patch
Patch1: lynx2-8-6-telnet.patch
Patch2: lynx-284-i18ncfg.patch
Patch3: lynx2-8-6-vine.patch
Requires: indexhtml
Provides: webclient
BuildRequires: openssl-devel, ncurses-devel, slang-devel, zlib-devel
Buildroot: %{_tmppath}/%{name}-root
Vendor: Project Vine
Distribution: Vine Linux

%description
Lynx is a text-based Web browser. Lynx does not display any images,
but it does support frames, tables and most other HTML tags. Lynx's
advantage over graphical browsers is its speed--Lynx starts and exits
quickly and swiftly displays Web pages.

Install lynx if you would like to try this fast, non-graphical browser
(you may learn to appreciate its strengths).

%description -l ja
lynx はテキストベースのウェブブラウザである。lynx は何のイメージも
表示しないがフレーム、テーブルそして他の HTML タグをサポートする。
グラフィカルなブラウザに対する lynx のアドバンテージはスピードである。
lynx はウェブページを表示するのにすばやく即座に開始したり終了したりする。

この速い、グラフィカルでないブラウザを試したければインストールしなさい。
(その長所のよさがわかるであろう)

%prep
%setup -q -n lynx2-8-6
%patch0 -p0
%patch1 -p0 -b .telnet
# %patch2 -p1 -b .i18ncfg
%patch3 -p0 -b .vine
perl -pi -e "s,^HELPFILE:.*,HELPFILE:file://localhost%{_docdir}/lynx-%{version}/lynx_help/lynx_help_main.html,g" lynx.cfg
perl -pi -e "s,^DEFAULT_INDEX_FILE:.*,DEFAULT_INDEX_FILE:http://www.google.com/,g" lynx.cfg

%build
export CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS"
%configure --libdir=/etc \
	--with-screen=slang --enable-warnings \
	--enable-default-colors --enable-externs \
	--enable-internal-links --enable-nsl-fork \
	--enable-persistent-cookies --enable-prettysrc \
	--disable-font-switch --enable-source-cache \
	--enable-kbd-layout --with-zlib \
	--enable-charset-choice --enable-file-upload \
	--enable-cgi-links --enable-read-eta \
	--enable-addrlist-page --enable-cjk \
	--enable-justify-elts --enable-scrollbar \
	--enable-libjs --enable-cgi-links --enable-nls \
	--with-ssl=/usr
make

%install
rm -rf %{buildroot}
%makeinstall mandir=%{buildroot}%{_mandir}/man1 libdir=%{buildroot}/etc
# Install Lang dependent resources
install -m444 %{SOURCE1} %{buildroot}/etc/lynx.cfg.ja

mkdir -p %{buildroot}%{_sysconfdir}/X11/applnk/Internet
cat > %{buildroot}%{_sysconfdir}/X11/applnk/Internet/lynx.desktop <<EOF
[Desktop Entry]
Name=Lynx
Name[ja]=Lynx
Type=Application
Comment=Text based WWW browser
Comment[ja]=テキストベースWWWブラウザ
Exec=lynx
Terminal=true
EOF

%{find_lang} %{name}

# compress huge files in docs
gzip --best --force docs/CHANGES2*
# eliminate executable bit in %doc
find samples/ -type f -perm +111 | xargs chmod -x

%clean
rm -rf %{buildroot}

%files -f %{name}.lang
%defattr(-,root,root)
%doc docs README INSTALLATION samples
%doc test lynx.hlp lynx_help
%doc COPYING CHANGES PROBLEMS
%config(missingok) %{_sysconfdir}/X11/applnk/Internet/lynx.desktop
%{_bindir}/lynx
%{_mandir}/*/*
%config %{_sysconfdir}/lynx.cfg
#%lang(ja) %config %{_sysconfdir}/lynx.cfg.ja

%changelog
* Sun Feb 06 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.8.6-2
- rebuild with openssl-1.0.0c

* Sat Jul 26 2008 Shu KONNO <owa@bg.wakwak.com> 2.8.6-1vl5
- applied new versioning policy and spec in utf-8

* Mon Dec 25 2006 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.8.6-0vl3
- rebuild for Vine 4.0/VineSeed (0vl2 is exist in Plus 3.x)

* Sun Dec 17 2006 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.8.6-0vl2
- rebuild for Vine 4.0/VineSeed
- update patch3

* Mon Dec 11 2006 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.8.6-0vl1
- new upstream release with security fix (CVE-2005-3120)

* Tue Jan 08 2002 Toru Sagami <sagami@vinelinux.org> 2.8.5-0vl1
- 2.8.5dev.7.tar.gz2
- BuildRequires: slang-devel, zlib-devel

* Fri Dec 28 2001 Toru Sagami <sagami@vinelinux.org>
- 2.8.4pre.5.tar.bz2

* Mon Sep 03 2001 Toru Sagami <sagami@vinelinux.org>
- 2.8.4-7vl5: eliminate executable bit in %%doc

* Mon Jul 16 2001 <sagami@vinelinux.org>
- 2.8.4-7vl4: updated to 2.8.4pre.5
- rebuilt with openssl-0.9.6b
- compress huge CHANGES* files in docs/

* Sun Jul 08 2001 <sagami@vinelinux.org>
- 2.8.4-7vl3: updated to 2.8.4pre.3
- %%{find_lang}, added some documents
- use ja.po derived from source

* Wed Jan 31 2001 sagami@vinelinux.org
- fixed: default index.html location

* Fri Jan 12 2001 Toru Sagami <czs14350@mb.infoweb.ne.jp>
- 2.8.4-7vl1: based on Rawhide 2.8.4-7

* Mon Sep 6 1999 Norihito Ohmori <ohmori@flatout.org>
- ja.po typo fix

* Wed Aug 25 1999 Norihito Ohmori <ohmori@flatout.org>
- Help file position in lynx.cfg bug fix.

* Tue Jul 20 1999 Norihito Ohmori <ohmori@flatout.org>
- ja.po fix

* Mon Jun 28 1999 Norihito Ohmori <ohmori@flatout.org>
- added ja.po (imcomplete).
- use kterm in lynx.wmconfig
- added Japanese summary and description
- change for Vine
- change default CHARSET to Japanese(EUC).

* Tue Jun 15 1999 Bill Nottingham <notting@redhat.com>
- update to 2.8.2

* Mon Mar 29 1999 Bill Nottingham <notting@redhat.com>
- apply some update patches from the lynx folks
- set user's TEMP dir to their home dir to avoid /tmp races

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 10)

* Wed Feb 24 1999 Bill Nottingham <notting@redhat.com>
- return of wmconfig

* Mon Nov 30 1998 Bill Nottingham <notting@redhat.com>
- create cookie file 0600

* Fri Nov  6 1998 Bill Nottingham <notting@redhat.com>
- update to 2.8.1rel2

* Thu Oct 29 1998 Bill Nottingham <notting@redhat.com>
- build for Raw Hide (slang-1.2.2)

* Sat Oct 10 1998 Cristian Gafton <gafton@redhat.com>
- 2.8.1pre9
- strip binaries

* Mon Oct 05 1998 Cristian Gafton <gafton@redhat.com>
- updated to lynx2.8.1pre.7.tar.gz

* Fri May 08 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Mon May 04 1998 Cristian Gafton <gafton@redhat.com>
- upgraded to 2.8rel3
- fixed mailto: buffer overflow (used Alan's patch)

* Fri Mar 20 1998 Cristian Gafton <gafton@redhat.com>
- updated to 2.8
- added buildroot

* Tue Jan 13 1998 Erik Troan <ewt@redhat.com>
- updated to 2.7.2
- enabled lynxcgi

* Thu Oct 23 1997 Donnie Barnes <djb@redhat.com>
- updated from 2.6 to 2.7.1
- moved /usr/lib/lynx.cfg to /etc/lynx.cfg
- build with slang instead of ncurses
- made default startup file be file:/usr/doc/HTML/index.html

