w3m: new package at v0.5.3 (#21641)

This commit is contained in:
ronin-gw 2021-02-25 21:42:26 +09:00 committed by GitHub
parent a8808b473a
commit f9f5f8676e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 154 additions and 0 deletions

View File

@ -0,0 +1,20 @@
--- w3m-0.5.3/main.c.orig 2011-01-04 18:42:19.000000000 +0900
+++ w3m-0.5.3/main.c 2021-02-05 12:59:06.251334053 +0900
@@ -311,7 +311,7 @@ wrap_GC_warn_proc(char *msg, GC_word arg
lock = 0;
}
}
- else if (orig_GC_warn_proc)
+ else if (orig_GC_warn_proc = GC_get_warn_proc())
orig_GC_warn_proc(msg, arg);
else
fprintf(stderr, msg, (unsigned long)arg);
@@ -833,7 +833,7 @@ main(int argc, char **argv, char **envp)
mySignal(SIGPIPE, SigPipe);
#endif
- orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc);
+ GC_set_warn_proc(wrap_GC_warn_proc);
err_msg = Strnew();
if (load_argc == 0) {
/* no URL specified */

View File

@ -0,0 +1,58 @@
--- w3m-0.5.3/istream.c.orig 2021-02-05 13:19:44.023053158 +0900
+++ w3m-0.5.3/istream.c 2021-02-05 13:19:53.380179220 +0900
@@ -22,8 +22,8 @@
static void basic_close(int *handle);
static int basic_read(int *handle, char *buf, int len);
-static void file_close(struct file_handle *handle);
-static int file_read(struct file_handle *handle, char *buf, int len);
+static void file_close(struct w3m_file_handle *handle);
+static int file_read(struct w3m_file_handle *handle, char *buf, int len);
static int str_read(Str handle, char *buf, int len);
@@ -114,7 +114,7 @@ newFileStream(FILE * f, void (*closep) (
stream = New(union input_stream);
init_base_stream(&stream->base, STREAM_BUF_SIZE);
stream->file.type = IST_FILE;
- stream->file.handle = New(struct file_handle);
+ stream->file.handle = New(struct w3m_file_handle);
stream->file.handle->f = f;
if (closep)
stream->file.handle->close = closep;
@@ -658,13 +658,13 @@ basic_read(int *handle, char *buf, int l
}
static void
-file_close(struct file_handle *handle)
+file_close(struct w3m_file_handle *handle)
{
handle->close(handle->f);
}
static int
-file_read(struct file_handle *handle, char *buf, int len)
+file_read(struct w3m_file_handle *handle, char *buf, int len)
{
return fread(buf, 1, len, handle->f);
}
--- w3m-0.5.3/istream.h.orig 2021-02-05 13:19:44.023053158 +0900
+++ w3m-0.5.3/istream.h 2021-02-05 13:19:53.380179220 +0900
@@ -20,7 +20,7 @@ struct stream_buffer {
typedef struct stream_buffer *StreamBuffer;
-struct file_handle {
+struct w3m_file_handle {
FILE *f;
void (*close) ();
};
@@ -53,7 +53,7 @@ struct base_stream {
struct file_stream {
struct stream_buffer stream;
- struct file_handle *handle;
+ struct w3m_file_handle *handle;
char type;
char iseos;
int (*read) ();

View File

@ -0,0 +1,76 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class W3m(AutotoolsPackage):
"""
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.
"""
homepage = "http://w3m.sourceforge.net/index.en.html"
url = "https://downloads.sourceforge.net/project/w3m/w3m/w3m-0.5.3/w3m-0.5.3.tar.gz"
maintainers = ['ronin_gw']
version('0.5.3', sha256='e994d263f2fd2c22febfbe45103526e00145a7674a0fda79c822b97c2770a9e3')
# mandatory dependency
depends_on('bdw-gc')
# termlib
variant('termlib', default='ncurses', description='select termlib',
values=('ncurses', 'termcap', 'none'), multi=False)
depends_on('termcap', when='termlib=termcap')
depends_on('ncurses+termlib', when='termlib=ncurses')
# https support
variant('https', default=True, description='support https protocol')
depends_on('openssl@:1.0.2u', when='+https')
# X11 support
variant('image', default=True, description='enable image')
depends_on('libx11', when='+image')
# inline image support
variant('imagelib', default='imlib2', description='select imagelib',
values=('gdk-pixbuf', 'imlib2'), multi=False)
depends_on('gdk-pixbuf@2:+x11', when='imagelib=gdk-pixbuf +image')
depends_on('imlib2@1.0.5:', when='imagelib=imlib2 +image')
# fix for modern libraries
patch('fix_redef.patch')
patch('fix_gc.patch')
def _add_arg_for_variant(self, args, variant, choices):
for avail_lib in choices:
if self.spec.variants[variant].value == avail_lib:
args.append('--with-{0}={1}'.format(variant, avail_lib))
return
def configure_args(self):
args = []
self._add_arg_for_variant(args, 'termlib', ('termcap', 'ncurses'))
if '+image' in self.spec:
args.append('--enable-image')
self._add_arg_for_variant(args, 'imagelib', ('gdk-pixbuf', 'imlib2'))
return args
def setup_build_environment(self, env):
if self.spec.variants['termlib'].value == 'ncurses':
env.append_flags('LDFLAGS', '-ltinfo')
env.append_flags('LDFLAGS', '-lncurses')
if '+image' in self.spec:
env.append_flags('LDFLAGS', '-lX11')
# parallel build causes build failure
def build(self, spec, prefix):
make(parallel=False)