mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[build] Link against libdom
Segfault is expected.
This commit is contained in:
parent
79fdb363b3
commit
e2761c74fc
@ -70,7 +70,11 @@ INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
|
||||
DBLATEX = @DBLATEX@
|
||||
LIBCSS_CFLAGS = @LIBCSS_CFLAGS@
|
||||
LIBCSS_LIBS = @LIBCSS_LIBS@
|
||||
LIBDIR = @LIBDIR@
|
||||
LIBDOM_CFLAGS = @LIBDOM_CFLAGS@
|
||||
LIBDOM_LIBS = @LIBDOM_LIBS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LOCALEDIR = @LOCALEDIR@
|
||||
LUA_CFLAGS = @LUA_CFLAGS@
|
||||
@ -145,6 +149,7 @@ CONFIG_IPV6 = @CONFIG_IPV6@
|
||||
CONFIG_DBLATEX = @CONFIG_DBLATEX@
|
||||
CONFIG_LEDS = @CONFIG_LEDS@
|
||||
CONFIG_LIBCSS = @CONFIG_LIBCSS@
|
||||
CONFIG_LIBDOM = @CONFIG_LIBDOM@
|
||||
CONFIG_LZMA = @CONFIG_LZMA@
|
||||
CONFIG_MAILCAP = @CONFIG_MAILCAP@
|
||||
CONFIG_MANUAL = @CONFIG_MANUAL@
|
||||
|
22
configure.ac
22
configure.ac
@ -879,13 +879,33 @@ CONFIG_LIBCSS=
|
||||
if test "x$CONFIG_XML" = xyes; then
|
||||
LIBCSS_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libcss)"
|
||||
LIBCSS_LIBS="$($PKG_CONFIG $pkg_config_static --libs libcss)"
|
||||
LIBS="$LIBS $LIBCSS_LIBS"
|
||||
LIBS="$LIBCSS_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $LIBCSS_CFLAGS"
|
||||
CONFIG_LIBCSS=yes
|
||||
EL_CONFIG(CONFIG_LIBCSS, [libcss])
|
||||
AC_SUBST(LIBCSS_CFLAGS)
|
||||
AC_SUBST(LIBCSS_LIBS)
|
||||
AC_SUBST(CONFIG_LIBCSS)
|
||||
fi
|
||||
|
||||
# ===================================================================
|
||||
# Check for libdom
|
||||
# ===================================================================
|
||||
|
||||
CONFIG_LIBDOM=
|
||||
|
||||
if test "x$CONFIG_XML" = xyes; then
|
||||
LIBDOM_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libdom)"
|
||||
LIBDOM_LIBS="$($PKG_CONFIG $pkg_config_static --libs libdom)"
|
||||
LIBS="$LIBDOM_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $LIBDOM_CFLAGS"
|
||||
CONFIG_LIBDOM=yes
|
||||
EL_CONFIG(CONFIG_LIBDOM, [libdom])
|
||||
AC_SUBST(LIBDOM_CFLAGS)
|
||||
AC_SUBST(LIBDOM_LIBS)
|
||||
AC_SUBST(CONFIG_LIBDOM)
|
||||
fi
|
||||
|
||||
# ===================================================================
|
||||
# Check for Guile, optional even if installed.
|
||||
# ===================================================================
|
||||
|
@ -414,6 +414,14 @@ if conf_data.get('CONFIG_ECMASCRIPT_SMJS') or conf_data.get('CONFIG_QUICKJS') or
|
||||
conf_data.set('CONFIG_LIBCSS', true)
|
||||
endif
|
||||
|
||||
conf_data.set('CONFIG_LIBDOM', false)
|
||||
|
||||
if conf_data.get('CONFIG_ECMASCRIPT_SMJS') or conf_data.get('CONFIG_QUICKJS') or conf_data.get('CONFIG_MUJS')
|
||||
cssdeps = dependency('libdom', static: st, version: '>=0.4.1')
|
||||
deps += cssdeps
|
||||
conf_data.set('CONFIG_LIBDOM', true)
|
||||
endif
|
||||
|
||||
if conf_data.get('CONFIG_SCRIPTING_LUA')
|
||||
luadeps = dependency(luapkg, static: st)
|
||||
deps += luadeps
|
||||
|
@ -4,6 +4,8 @@ INCLUDES += $(SPIDERMONKEY_CFLAGS) $(MUJS_CFLAGS)
|
||||
|
||||
SUBDIRS-$(CONFIG_ECMASCRIPT_SMJS) += spidermonkey
|
||||
|
||||
SUBDIRS-$(CONFIG_LIBDOM) += libdom
|
||||
|
||||
SUBDIRS-$(CONFIG_MUJS) += mujs
|
||||
|
||||
SUBDIRS-$(CONFIG_QUICKJS) += quickjs
|
||||
|
@ -841,6 +841,7 @@ free_document(void *doc)
|
||||
delete docu;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_LIBDOM
|
||||
void *
|
||||
document_parse(struct document *document)
|
||||
{
|
||||
@ -871,6 +872,7 @@ document_parse(struct document *document)
|
||||
|
||||
return (void *)docu;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
delayed_goto(void *data)
|
||||
|
7
src/ecmascript/libdom/Makefile
Normal file
7
src/ecmascript/libdom/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
top_builddir=../../..
|
||||
include $(top_builddir)/Makefile.config
|
||||
INCLUDES += $(LIBDOM_CFLAGS)
|
||||
|
||||
OBJS = parse.o
|
||||
|
||||
include $(top_srcdir)/Makefile.lib
|
2
src/ecmascript/libdom/meson.build
Normal file
2
src/ecmascript/libdom/meson.build
Normal file
@ -0,0 +1,2 @@
|
||||
srcs += files('parse.c')
|
||||
|
73
src/ecmascript/libdom/parse.c
Normal file
73
src/ecmascript/libdom/parse.c
Normal file
@ -0,0 +1,73 @@
|
||||
/* Parse document. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef CONFIG_LIBDOM
|
||||
#include <dom/dom.h>
|
||||
#include <dom/bindings/hubbub/parser.h>
|
||||
#endif
|
||||
|
||||
#include "elinks.h"
|
||||
|
||||
#include "cache/cache.h"
|
||||
#include "document/document.h"
|
||||
|
||||
void *
|
||||
document_parse(struct document *document)
|
||||
{
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||
#endif
|
||||
struct cache_entry *cached = document->cached;
|
||||
struct fragment *f = get_cache_fragment(cached);
|
||||
const char *encoding;
|
||||
dom_hubbub_parser *parser = NULL;
|
||||
dom_hubbub_error error;
|
||||
dom_hubbub_parser_params params;
|
||||
dom_document *doc;
|
||||
|
||||
if (!f || !f->length) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
params.enc = NULL;
|
||||
params.fix_enc = true;
|
||||
params.enable_script = false;
|
||||
params.msg = NULL;
|
||||
params.script = NULL;
|
||||
params.ctx = NULL;
|
||||
params.daf = NULL;
|
||||
|
||||
/* Create Hubbub parser */
|
||||
error = dom_hubbub_parser_create(¶ms, &parser, &doc);
|
||||
if (error != DOM_HUBBUB_OK) {
|
||||
fprintf(stderr, "Can't create Hubbub Parser\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Parse */
|
||||
error = dom_hubbub_parser_parse_chunk(parser, f->data, f->length);
|
||||
if (error != DOM_HUBBUB_OK) {
|
||||
dom_hubbub_parser_destroy(parser);
|
||||
fprintf(stderr, "Parsing errors occur\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Done parsing file */
|
||||
error = dom_hubbub_parser_completed(parser);
|
||||
if (error != DOM_HUBBUB_OK) {
|
||||
dom_hubbub_parser_destroy(parser);
|
||||
fprintf(stderr, "Parsing error when construct DOM\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Finished with parser */
|
||||
dom_hubbub_parser_destroy(parser);
|
||||
|
||||
return doc;
|
||||
}
|
@ -25,3 +25,7 @@ if conf_data.get('CONFIG_QUICKJS')
|
||||
subdir('quickjs')
|
||||
srcs += files('css2xpath.cpp', 'ecmascript.cpp', 'localstorage-db.cpp', 'quickjs.cpp')
|
||||
endif
|
||||
|
||||
if conf_data.get('CONFIG_LIBDOM')
|
||||
subdir('libdom')
|
||||
endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user