aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2023-04-14 20:42:03 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2023-04-14 20:42:03 +0300
commit030e0f5859698638a33d3a34c0659871d1dc7333 (patch)
tree4be596a4c481e7fcc70a358a2ad34934ea4f7e12
parentba0875373d2250e3a6d63d5269ff1a4a89a280ed (diff)
downloadsciteco-030e0f5859698638a33d3a34c0659871d1dc7333.tar.gz
allow disabling Lexilla (Lexer) support by specifying --without-lexilla
* This does not make sense for most SciTECO builds, but only when you want to optimize for size as the lexers take up 50% of the compressed binary size. Without Lexilla, it should be possible get it compiled in about 500kb. * It can be useful for instance when building for embedded distributions. * When Lexilla is disabled, symbols-scilexer.c is also not generated (we assume that the Lexilla sources are not available and it also doesn't serve any purpose). * Consequently, most of the lexer configuration scripts are also not installed under --without-lexilla.
-rw-r--r--INSTALL2
-rw-r--r--configure.ac8
-rw-r--r--lib/Makefile.am162
-rw-r--r--src/Makefile.am11
-rw-r--r--src/symbols.c7
5 files changed, 104 insertions, 86 deletions
diff --git a/INSTALL b/INSTALL
index 2623f8a..4302df9 100644
--- a/INSTALL
+++ b/INSTALL
@@ -49,7 +49,7 @@ installed by the user manually:
* When choosing the Curses interface:
* Scinterm (v3.1 or later):
http://foicica.com/scinterm/
- * Lexilla (v5.0.0 or later):
+ * Lexilla (v5.0.0 or later, optional):
https://www.scintilla.org/Lexilla.html
On Ubuntu, you can install all dependencies you could possibly need
diff --git a/configure.ac b/configure.ac
index 3f50576..4ee824c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -196,8 +196,12 @@ AC_ARG_WITH(lexilla,
AS_HELP_STRING([--with-lexilla=PATH],
[Specify Lexilla's path [default=./contrib/lexilla]]),
[LEXILLA_PATH=$withval], [LEXILLA_PATH=./contrib/lexilla])
-LEXILLA_PATH=`canonicalize $LEXILLA_PATH`
-AC_SUBST(LEXILLA_PATH)
+AM_CONDITIONAL(LEXILLA, [test x$LEXILLA_PATH != xno])
+if [[ x$LEXILLA_PATH != xno ]]; then
+ LEXILLA_PATH=`canonicalize $LEXILLA_PATH`
+ AC_SUBST(LEXILLA_PATH)
+ AC_DEFINE(HAVE_LEXILLA, 1, [Building with Lexilla (Lexer) support])
+fi
CPPFLAGS="$CPPFLAGS -I$LEXILLA_PATH/include"
diff --git a/lib/Makefile.am b/lib/Makefile.am
index c528636..06bee14 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -13,87 +13,91 @@ dist_colorscheme_DATA = colors/terminal.tes \
lexerdir = $(scitecolibdir)/lexers
+# This lexer is responsible for styling
+# womanpages and is thus useful even when omitting
+# the syntax highlighting lexers.
+dist_lexer_DATA = lexers/woman.tes
+
+if LEXILLA
+
# Lexer configurations for language
# syntax highlighting.
# This list must be extended when adding
# a new lexer configuration:
-dist_lexer_DATA = lexers/verilog.tes \
- lexers/php.tes \
- lexers/pascal.tes \
- lexers/rebol.tes \
- lexers/flagship.tes \
- lexers/vhdl.tes \
- lexers/ave.tes \
- lexers/go.tes \
- lexers/f95.tes \
- lexers/lisp.tes \
- lexers/ada.tes \
- lexers/d.tes \
- lexers/octave.tes \
- lexers/mako.tes \
- lexers/lout.tes \
- lexers/lua.tes \
- lexers/tal.tes \
- lexers/systemverilog.tes \
- lexers/matlab.tes \
- lexers/flash.tes \
- lexers/make.tes \
- lexers/eiffel.tes \
- lexers/swift.tes \
- lexers/r.tes \
- lexers/vala.tes \
- lexers/purebasic.tes \
- lexers/scheme.tes \
- lexers/docbook.tes \
- lexers/cobol.tes \
- lexers/powerpro.tes \
- lexers/tcl.tes \
- lexers/cmake.tes \
- lexers/freebasic.tes \
- lexers/xml.tes \
- lexers/asl.tes \
- lexers/c.tes \
- lexers/cpp.tes \
- lexers/gob.tes \
- lexers/devicetree.tes \
- lexers/test.tes \
- lexers/kix.tes \
- lexers/baan.tes \
- lexers/js.tes \
- lexers/spice.tes \
- lexers/idl.tes \
- lexers/ch.tes \
- lexers/vb.tes \
- lexers/awk.tes \
- lexers/diff.tes \
- lexers/gap.tes \
- lexers/mmixal.tes \
- lexers/pike.tes \
- lexers/asm.tes \
- lexers/vxml.tes \
- lexers/cs.tes \
- lexers/abaqus.tes \
- lexers/java.tes \
- lexers/avs.tes \
- lexers/f77.tes \
- lexers/batch.tes \
- lexers/specman.tes \
- lexers/rc.tes \
- lexers/tacl.tes \
- lexers/bash.tes \
- lexers/oscript.tes \
- lexers/html.tes \
- lexers/perl.tes \
- lexers/inno.tes \
- lexers/pov.tes \
- lexers/rust.tes \
- lexers/blitzbasic.tes \
- lexers/caml.tes \
- lexers/python.tes \
- lexers/yaml.tes \
- lexers/markdown.tes
+dist_lexer_DATA += lexers/verilog.tes \
+ lexers/php.tes \
+ lexers/pascal.tes \
+ lexers/rebol.tes \
+ lexers/flagship.tes \
+ lexers/vhdl.tes \
+ lexers/ave.tes \
+ lexers/go.tes \
+ lexers/f95.tes \
+ lexers/lisp.tes \
+ lexers/ada.tes \
+ lexers/d.tes \
+ lexers/octave.tes \
+ lexers/mako.tes \
+ lexers/lout.tes \
+ lexers/lua.tes \
+ lexers/tal.tes \
+ lexers/systemverilog.tes \
+ lexers/matlab.tes \
+ lexers/flash.tes \
+ lexers/make.tes \
+ lexers/eiffel.tes \
+ lexers/swift.tes \
+ lexers/r.tes \
+ lexers/vala.tes \
+ lexers/purebasic.tes \
+ lexers/scheme.tes \
+ lexers/docbook.tes \
+ lexers/cobol.tes \
+ lexers/powerpro.tes \
+ lexers/tcl.tes \
+ lexers/cmake.tes \
+ lexers/freebasic.tes \
+ lexers/xml.tes \
+ lexers/asl.tes \
+ lexers/c.tes \
+ lexers/cpp.tes \
+ lexers/gob.tes \
+ lexers/devicetree.tes \
+ lexers/test.tes \
+ lexers/kix.tes \
+ lexers/baan.tes \
+ lexers/js.tes \
+ lexers/spice.tes \
+ lexers/idl.tes \
+ lexers/ch.tes \
+ lexers/vb.tes \
+ lexers/awk.tes \
+ lexers/diff.tes \
+ lexers/gap.tes \
+ lexers/mmixal.tes \
+ lexers/pike.tes \
+ lexers/asm.tes \
+ lexers/vxml.tes \
+ lexers/cs.tes \
+ lexers/abaqus.tes \
+ lexers/java.tes \
+ lexers/avs.tes \
+ lexers/f77.tes \
+ lexers/batch.tes \
+ lexers/specman.tes \
+ lexers/rc.tes \
+ lexers/tacl.tes \
+ lexers/bash.tes \
+ lexers/oscript.tes \
+ lexers/html.tes \
+ lexers/perl.tes \
+ lexers/inno.tes \
+ lexers/pov.tes \
+ lexers/rust.tes \
+ lexers/blitzbasic.tes \
+ lexers/caml.tes \
+ lexers/python.tes \
+ lexers/yaml.tes \
+ lexers/markdown.tes
-# This lexer is responsible for styling
-# womanpages and is thus useful even when omitting
-# the syntax highlighting lexers.
-dist_lexer_DATA += lexers/woman.tes
+endif
diff --git a/src/Makefile.am b/src/Makefile.am
index ab6e35f..f1f073e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -68,8 +68,10 @@ sciteco_minimal_SOURCES =
symbols-scintilla.c symbols-scilexer.c : sciteco-minimal$(EXEEXT)
endif
sciteco_minimal_LDADD = libsciteco-base.la \
- @SCINTILLA_PATH@/bin/scintilla.a \
- @LEXILLA_PATH@/bin/liblexilla.a
+ @SCINTILLA_PATH@/bin/scintilla.a
+if LEXILLA
+sciteco_minimal_LDADD += @LEXILLA_PATH@/bin/liblexilla.a
+endif
# Scintilla is unfortunately still written in C++, so we must force
# Automake to use the C++ linker when linking the binaries.
# The following hack is actually advocated in the Automake manual.
@@ -77,7 +79,10 @@ nodist_EXTRA_sciteco_minimal_SOURCES = fuck-this-shit.cpp
bin_PROGRAMS = sciteco
sciteco_SOURCES =
-nodist_sciteco_SOURCES = symbols-scintilla.c symbols-scilexer.c
+nodist_sciteco_SOURCES = symbols-scintilla.c
+if LEXILLA
+nodist_sciteco_SOURCES += symbols-scilexer.c
+endif
sciteco_LDADD = $(sciteco_minimal_LDADD)
# see above
nodist_EXTRA_sciteco_SOURCES = fuck-this-shit.cpp
diff --git a/src/symbols.c b/src/symbols.c
index 39703e8..ce7a7f6 100644
--- a/src/symbols.c
+++ b/src/symbols.c
@@ -25,7 +25,9 @@
#include <glib.h>
#include <Scintilla.h>
+#ifdef HAVE_LEXILLA
#include <Lexilla.h>
+#endif
#include "sciteco.h"
#include "string-utils.h"
@@ -319,6 +321,7 @@ teco_state_scintilla_lparam_done(teco_machine_main_t *ctx, const teco_string_t *
sptr_t lParam = 0;
+#ifdef HAVE_LEXILLA
if (ctx->scintilla.iMessage == SCI_SETILEXER) {
if (teco_string_contains(str, '\0')) {
g_set_error_literal(error, TECO_ERROR, TECO_ERROR_FAILED,
@@ -333,7 +336,9 @@ teco_state_scintilla_lparam_done(teco_machine_main_t *ctx, const teco_string_t *
"Lexilla lexer \"%s\" not found.", lexer);
return NULL;
}
- } else if (str->len > 0) {
+ } else
+#endif
+ if (str->len > 0) {
/*
* NOTE: There may even be messages that read strings
* with embedded nulls.