1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-18 23:37:09 +00:00
termux-packages/packages/w3m/build.sh
Henrik Grimler fee131542c w3m: fix fdsan error when run on android 11
The file descriptor sanitizer keeps track of opened file descriptors
and kills programs that closes fds multiple times, or fails to close
fds.  In w3m's case a fd for a tty was obtained and saved in the ttyf
variable, but when the tty was later closed is was done using the tty
variable and not the obtained ttyf.  To my current understanding this
can lead to undesired behaviour when using multiple threads, as
another thread might write to or read from ttyf after it has been
closed.

Error looks like
fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0xb6c8800c

This commit fixes [1]. See also fdsan docs [2] and issue opened in the
android bug tracker [3].

[1] https://github.com/termux/termux-packages/issues/6410
[2] https://android.googlesource.com/platform/bionic/+/master/docs/fdsan.md
[3] https://issuetracker.google.com/issues/184380442
2021-04-05 15:46:59 +02:00

31 lines
1.4 KiB
Bash

TERMUX_PKG_HOMEPAGE=http://w3m.sourceforge.net/
TERMUX_PKG_DESCRIPTION="Text based Web browser and pager"
TERMUX_PKG_LICENSE="BSD"
TERMUX_PKG_MAINTAINER="@termux"
_MAJOR_VERSION=0.5.3
_MINOR_VERSION=20190105
TERMUX_PKG_VERSION=${_MAJOR_VERSION}.${_MINOR_VERSION}
TERMUX_PKG_REVISION=6
# The upstream w3m project is dead, but every linux distribution uses
# this maintained fork in debian:
TERMUX_PKG_SRCURL=https://github.com/tats/w3m/archive/v${_MAJOR_VERSION}+git${_MINOR_VERSION}.tar.gz
TERMUX_PKG_SHA256=0467bb5429b75749205a3f57b9f5e8abba49929272aeab6fce94ff17953f0784
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_DEPENDS="libgc, ncurses, openssl, zlib"
TERMUX_PKG_SUGGESTS="perl"
# ac_cv_func_bcopy=yes to avoid w3m defining it's own bcopy function, which
# breaks 64-bit builds where NDK headers define bcopy as a macro:
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="ac_cv_func_setpgrp_void=yes ac_cv_func_bcopy=yes"
#Overwrite the default /usr/bin/firefox with termux-open-url as default external browser. That way, pressing "M" on a URL will open a link in Androids default Browser.
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-browser=termux-open-url"
#Overwrite the default editor to just vi, as the default was /usr/bin/vi.
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --with-editor=nano"
# Build w3mimg with X11/imlib2.
# w3mimgdisplay is in w3m-img subpackage.
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --enable-image=x11 --with-imagelib=imlib2"
# For Makefile.in.patch:
export TERMUX_PKG_BUILDER_DIR