1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-24 11:45:18 +03:00
aports/community/w3m/APKBUILD

96 lines
3 KiB
Text

# Contributor: ScrumpyJack <scrumpyjack@st.ilet.to>
# Maintainer: ScrumpyJack <scrumpyjack@st.ilet.to>
pkgname=w3m
_pkgver=0.5.3+git20230121
pkgver=${_pkgver/+git/.}
pkgrel=0
pkgdesc="text-based web & gopher browser, as well as pager"
url="https://github.com/tats/w3m"
license="MIT"
arch="all"
makedepends="imlib2-dev openssl-dev>3 gc-dev ncurses-dev linux-headers"
subpackages="$pkgname-doc $pkgname-perl::noarch $pkgname-image"
source="$pkgname-$pkgver.tar.gz::https://github.com/tats/w3m/archive/v$_pkgver.tar.gz"
builddir="$srcdir/$pkgname-${_pkgver/+/-}"
# secfixes:
# 0.5.3.20230121-r0:
# - CVE-2022-38223
# 0.5.3.20180125-r0:
# - CVE-2018-6196
# - CVE-2018-6197
# - CVE-2018-6198
build() {
PERL=/usr/bin/perl ./configure \
--prefix=/usr \
--libexecdir=/usr/lib \
--enable-image=fb \
--with-ssl \
--disable-nntp \
--disable-dict \
--disable-help-cgi \
--with-imagelib=imlib2 \
--with-termlib=ncurses \
--with-editor="/usr/bin/vi" \
--with-browser="/usr/bin/xdg-open" \
--disable-w3mmailer
make
}
check() {
cd tests
sh run_tests
}
package() {
make DESTDIR="$pkgdir" install
# when ./configure has --disable-help-cgi passed, the (H)elp key
# is hardcoded to open "w3mhelp-w3m_en.html", instead of the
# w3mhelp.cgi script. 'make install' has install-scripts as a
# target, but not install-helpfile, probably ./configure doesn't
# get tested with --disable-help-cgi very often. anyway, we have
# to make install-helpfile or else the (H)elp key won't work.
# additionally, the _en & _ja help files have hyperlinks to each
# other, so install both, unless we want to patch the help file
make DESTDIR="$pkgdir" \
HELP_ALLFILES="w3mhelp-w3m_en.html w3mhelp-w3m_ja.html" \
install-helpfile
# the following 3 Perl scripts have dependencies not found in Alpine
# xface2xpm needs uncompface, w3mdict.cgi needs dictionary client
# multipart.cgi needs NKF (Network Kanji code conversion Filter)
rm "$pkgdir"/usr/lib/w3m/xface2xpm
rm "$pkgdir"/usr/lib/w3m/cgi-bin/w3mdict.cgi
rm "$pkgdir"/usr/lib/w3m/cgi-bin/multipart.cgi
# w3mmail.cgi needs cmd:sendmail (which Alpine has pkgs for), but
# removing it because --disable-w3mmailer causes w3m to use an
# external program (default: /usr/bin/mail) to handle mailto: links
rm "$pkgdir"/usr/lib/w3m/cgi-bin/w3mmail.cgi
install -d "$pkgdir"/usr/share/doc/"$pkgname"
install -d "$pkgdir"/usr/share/licenses/"$pkgname"
local i; for i in doc/*; do
install -m644 "$i" "$pkgdir"/usr/share/doc/"$pkgname"
done
ln -s /usr/share/doc/"$pkgname"/README \
"$pkgdir"/usr/share/licenses/"$pkgname"
}
perl() {
pkgdesc="$pkgdesc (perl helper scripts)"
depends="perl cmd:man" # w3mman needs cmd:man
amove usr/bin/w3mman
amove usr/lib/w3m/cgi-bin/*.cgi
amove usr/share/w3m/*.pl
}
image() {
pkgdesc="$pkgdesc (inline image support)"
install_if="$pkgname=$pkgver-r$pkgrel imlib2"
amove usr/lib/w3m/w3mimgdisplay
}
sha512sums="
f220aabf69cf11ca7560c1519a971bdb1cc0baa443b1b46cd8fca2a4defb614653dd9ba637afbf9315f3b63a349f972436348c2f93d06665573057e4232eab1c w3m-0.5.3.20230121.tar.gz
"