From 75041aa1e1651841073473399397bcbfc10b0134 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+orbitalquark@users.noreply.github.com> Date: Sun, 13 Sep 2020 00:11:18 -0400 Subject: Switch back to Scintilla default (4.x), Scinterm, and Scintillua. Scintilla LongTerm3 maintenance is ending with upcoming Scintilla 5. Textadept now requires a C++17 compiler. Also updated Docker image. --- README.md | 33 ++++++++++------------ docs/manual.md | 39 ++++++++++---------------- init.lua | 1 - src/Makefile | 79 +++++++++++++++++++++++++++++------------------------ src/scintilla.patch | 21 -------------- src/textadept.c | 3 ++ 6 files changed, 76 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index 7267c97a..f339cd4f 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,10 @@ Manual and exhaustive API documentation. ## Compile Textadept is a bit unusual in that building it is only supported on Linux and -BSD. The application is cross-compiled for Windows and macOS from Linux. While -it is certainly possible to compile Textadept natively on those platforms, it is -simply not supported in any official capacity. +BSD, or within a [Docker][] [image][]. The application is cross-compiled for +Windows and macOS from Linux. While it is certainly possible to compile +Textadept natively on those platforms, it is simply not supported in any +official capacity. Textadept is built from its *src/* directory and binaries are placed in the application's root directory. The general procedure is to have Textadept build @@ -79,16 +80,13 @@ meaning you do not have to install it; it can run from its current location. General Requirements: -* [GNU C compiler][] (*gcc*) 4.9+ (circa early 2014) -* [libstdc++][] version 4.9+ +* [GNU C compiler][] (*gcc*) 7.1+ (circa mid-2017) * [GNU Make][] (*make*) * [GTK][] 2.24+ development libraries for the GUI version * [ncurses][](w) development libraries (wide character support) for the terminal version -* [MinGW][] or [mingw-w64][] 4.9+ (circa early 2014) when cross-compiling for - Windows. -* [OSX cross toolchain][] _with GCC_ 4.9+ (not Clang) when cross-compiling for - macOS. +* [mingw-w64][] 5.0+ with GCC 7.1+ when cross-compiling for Windows. +* [OSX cross toolchain][] with [Clang][] 4.0+ when cross-compiling for macOS. * _**OR**_ * [Docker][] @@ -109,21 +107,20 @@ Command |Description `make osx` |Cross-compiles Textadept for macOS `make osx-curses` |Cross-compiles the terminal version for macOS -When building within Docker, the relevant [container image][] is -`textadept/build:v1.0`. +When building within Docker, the relevant container [image][] is +`ghcr.io/orbitalquark/textadept-build:v1.0`. For more information on compiling Textadept, please see the [manual][]. +[Docker]: https://www.docker.com/ +[image]: https://github.com/users/orbitalquark/packages/container/textadept-build [GNU C compiler]: https://gcc.gnu.org -[libstdc++]: https://gcc.gnu.org [GNU Make]: https://www.gnu.org/software/make/ [GTK]: https://www.gtk.org [ncurses]: https://invisible-island.net/ncurses/ncurses.html -[MinGW]: https://mingw.org [mingw-w64]: https://mingw-w64.org/ [OSX cross toolchain]: https://github.com/tpoechtrager/osxcross -[Docker]: https://www.docker.com/ -[container image]: https://hub.docker.com/repository/docker/textadept/build +[Clang]: https://clang.llvm.org/ [manual]: https://foicica.com/textadept/manual.html#Compiling ## Contribute @@ -131,11 +128,11 @@ For more information on compiling Textadept, please see the [manual][]. Your [donation][] or purchase of the [book][] helps fund Textadept's continuous development. -Textadept is 100% [open source][]. Feel free to discuss features, report bugs, -and submit patches either to the [mailing list][], or to me personally +Textadept is [open source][]. Feel free to discuss features, report bugs, and +submit patches either to the [mailing list][], or to me personally (mitchell.att.foicica.com). [donation]: https://gum.co/textadept [book]: https://foicica.com/textadept/media.html#Book -[open source]: https://foicica.com/hg/textadept +[open source]: https://github.com/orbitalquark/textadept [mailing list]: http://foicica.com/lists diff --git a/docs/manual.md b/docs/manual.md index 01a6d1c0..61802db0 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -174,8 +174,8 @@ implementation of curses like [ncurses][](w). Most Linux and BSD systems either already have these dependencies installed, or they are readily available from a package manager. -Windows XP and Mac OSX 10.6 (Snow Leopard) are the minimum required operating -systems. Linux and BSD have no defined minimum. +Windows XP and Mac OSX 10.7 (Lion) are the minimum required operating systems. +Linux and BSD have no defined minimum. [GTK]: https://gtk.org [ncurses]: https://invisible-island.net/ncurses/ncurses.html @@ -1583,8 +1583,7 @@ for Windows from Linux should also be easily obtainable. Linux requirements: -* [GNU C compiler][] (*gcc*) 4.9+ (circa early 2014) -* [libstdc++][] version 4.9+ +* [GNU C compiler][] (*gcc*) 7.1+ (circa mid-2017) * [GNU Make][] (*make*) * [GTK][] 2.24+ development libraries for the GUI version * [ncurses][](w) development libraries (wide character support) for the terminal @@ -1598,8 +1597,7 @@ Linux requirements: BSD requirements: -* [GNU C compiler][] (*gcc*) 4.9+ (circa early 2014) -* [libstdc++][] version 4.9+ +* [GNU C compiler][] (*gcc*) 7.1+ or [Clang][] 4.0+ * [GNU Make][] (*gmake*) * [pkg-config][] * [libiconv][] @@ -1609,7 +1607,7 @@ BSD requirements: Windows cross-compiling requirements: -* [MinGW][] or [mingw-w64][] 4.9+ (circa early 2014) +* [mingw-w64][] 5.0+ with GCC 7.1+ * _**OR**_ * [Docker][] @@ -1618,26 +1616,22 @@ the `gcc-mingw-w64` and `g++-mingw-w64` packages. macOS cross-compiling requirements: -* [OSX cross toolchain][] with GCC 4.9+ (not Clang) +* [OSX cross toolchain][] with [Clang][] 4.0+ * _**OR**_ * [Docker][] -**Note:** make sure you run `./build_binutils.sh` before `./build_gcc.sh`. macOS -SDK tarballs like *MacOSX10.5.tar.gz* can be found readily on the internet. - -**Warning:** building a macOS cross toolchain can easily take 30 minutes or -more and ultimately consume nearly 3.5GB of disk space. +**Note:** Textadept's *src/Dockerfile* contains an example of how to build an +OSX cross toolchain. [Docker]: https://www.docker.com/ [image]: https://hub.docker.com/repository/docker/textadept/build [GNU C compiler]: https://gcc.gnu.org -[libstdc++]: https://gcc.gnu.org [GNU Make]: https://www.gnu.org/software/make/ +[Clang]: https://clang.llvm.org/ [pkg-config]: https://www.freedesktop.org/wiki/Software/pkg-config/ [libiconv]: https://www.gnu.org/software/libiconv/ [GTK]: https://www.gtk.org/download/linux.php [ncurses]: https://invisible-island.net/ncurses/#download_ncurses -[MinGW]: http://mingw.org [mingw-w64]: http://mingw-w64.org/ [OSX cross toolchain]: https://github.com/tpoechtrager/osxcross @@ -1684,21 +1678,18 @@ you will have to run something like: make CFLAGS="-I/usr/local/include" \ CXXFLAGS="-I/usr/local/include -L/usr/local/lib" -**Windows note:** the MinGW cross compiler's name prefix is assumed to be -"i686-w64-mingw32-". If this is not the case on your system, you will have to -specify your system's MinGW name prefix using the `CROSS` variable. For example: +Also, if you want to compile with Clang, you will have to run something like: - make CROSS=i586-mingw32-msvc- win32-deps - make CROSS=i586-mingw32-msvc- win32 + make CC=cc CXX=c++ ##### Compiling using Docker You can use [Docker][] to build Textadept for Windows, macOS, or Linux. The [image][] required to do so is about 2.5GB in size. For example: - localhost$ docker pull textadept/build:v1.0 + localhost$ docker pull ghcr.io/orbitalquark/textadept-build:v1.0 localhost$ docker run -t -i -v /path/to/textadept:/ta -w /ta/src \ - textadept/build:v1.0 + ghcr.io/orbitalquark/textadept-build:v1.0 container# make deps container# make container# exit @@ -1714,14 +1705,14 @@ the previous table, though the install commands are meaningless. error like `//libstdc++.so.6: version 'GLIBCXX_' not found`, then try compiling with the following flags: - container# make CXXFLAGS="-0s -std=c++11 -static-libstdc++" + container# make CXXFLAGS="-0s -std=c++17 -static-libstdc++" If you still get an error, this time like `//libc.so.6: version 'GLIBC_' not found`, then you will have to compile Textadept manually without Docker. [Docker]: https://www.docker.com/ -[image]: https://hub.docker.com/repository/docker/textadept/build +[image]: https://github.com/users/orbitalquark/packages/container/textadept-build -------------------------------------------------------------------------------- ### Appendix diff --git a/init.lua b/init.lua index 134e7a39..8a282cc8 100644 --- a/init.lua +++ b/init.lua @@ -337,7 +337,6 @@ events.connect(events.BUFFER_NEW, function() local SETDIRECTPOINTER = _SCINTILLA.properties.doc_pointer[2] local SETLUASTATE = _SCINTILLA.functions.change_lexer_state[1] local LOADLEXERLIBRARY = _SCINTILLA.functions.load_lexer_library[1] - buffer.lexer_language = 'lpeg' buffer:private_lexer_call(SETDIRECTFUNCTION, buffer.direct_function) buffer:private_lexer_call(SETDIRECTPOINTER, buffer.direct_pointer) buffer:private_lexer_call(SETLUASTATE, _LUA) diff --git a/src/Makefile b/src/Makefile index dacd6d54..1f7ff2ed 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,7 +3,7 @@ CC = gcc CFLAGS = -Os CXX = g++ -CXXFLAGS = -Os -std=c++11 +CXXFLAGS = -Os -std=c++17 MAKE = make ifeq (win, $(findstring win, $(MAKECMDGOALS))) # Cross-compile for Win32. @@ -38,9 +38,9 @@ else ifeq (osx, $(findstring osx, $(MAKECMDGOALS))) # Cross-compile for macOS. CC = cc CXX = c++ - CROSS = x86_64-apple-darwin14- + CROSS = x86_64-apple-darwin17- CFLAGS += -mdynamic-no-pic - CXXFLAGS += -mdynamic-no-pic -stdlib=libc++ + CXXFLAGS += -mdynamic-no-pic -stdlib=libc++ -Wno-register LUA_CFLAGS = -DLUA_USE_MACOSX LDFLAGS = -liconv ifeq (, $(findstring curses, $(MAKECMDGOALS))) @@ -107,7 +107,7 @@ WGET = wget -O $@ # Scintilla. -sci_flags = -pedantic $(plat_flag) -DSCI_LEXER -DLPEG_LEXER -DNDEBUG \ +sci_flags = -pedantic $(plat_flag) -DSCI_LEXER -DSCI_EMPTYCATALOGUE -DNDEBUG \ -Iscintilla/include -Iscintilla/src -Iscintilla/lexlib -Wall sci_objs = AutoComplete.o CallTip.o CaseConvert.o CaseFolder.o Catalogue.o \ @@ -175,8 +175,9 @@ $(sci_objs): %.o: scintilla/src/%.cxx $(CROSS)$(CXX) -c $(CXXFLAGS) $(sci_flags) $< -o $@ $(sci_lex_objs): %.o: scintilla/lexlib/%.cxx $(CROSS)$(CXX) -c $(CXXFLAGS) $(sci_flags) $< -o $@ -$(sci_lexer_objs): scintilla/lexers/LexLPeg.cxx - $(CROSS)$(CXX) -c $(CXXFLAGS) $(LUA_CFLAGS) $(sci_flags) $< -o $@ +$(sci_lexer_objs): LexLPeg.cxx + $(CROSS)$(CXX) -c $(CXXFLAGS) $(LUA_CFLAGS) $(sci_flags) -DNO_SCITE -DNO_DLL \ + $< -o $@ $(sci_gtk_objs): %.o: scintilla/gtk/%.cxx $(CROSS)$(CXX) -c $(CXXFLAGS) $(sci_flags) $(GTK_CFLAGS) $< -o $@ scintilla-marshal.o: scintilla/gtk/scintilla-marshal.c @@ -212,7 +213,7 @@ $(textadept_curses_objs): \ ta_flags += -Iscintilla/curses -Itermkey -Icdk $(CURSES_CFLAGS) loslib.o: LUA_CFLAGS += -DGTK $(GLIB_CFLAGS) gtdialog.o: gtdialog_flags += $(GTK_CFLAGS) -gtdialog-curses.o: gtdialog_flags += -Icdk $(CURSES_CFLAGS) +gtdialog-curses.o: gtdialog_flags += -I. -Icdk $(CURSES_CFLAGS) # Executables. @@ -305,7 +306,7 @@ osxapp_libs = libatk-1.0.0.dylib libcairo.2.dylib libexpat.1.dylib \ libpixman-1.0.dylib libpng16.16.dylib charset.alias \ gdk-pixbuf-2.0 gtk-2.0 -release-all: release win32-release osx-release modules-release +release-all: release win32-release osx-release #modules-release ifneq (, $(shell hg summary 2>/dev/null)) archive = hg archive -X ".hg*" $(1) @@ -316,12 +317,8 @@ endif $(basedir).linux: ; $(call archive,$@) release: $(basedir).linux make deps clean docs sign-deps - PKG_CONFIG_PATH=/opt/gtk64/lib/pkgconfig make -j4 CFLAGS="$(CFLAGS) -m64" \ - CXXFLAGS="$(CXXFLAGS) -m64 -static-libstdc++" - make -j4 CFLAGS="$(CFLAGS) -m64" \ - CXXFLAGS="$(CXXFLAGS) -m64 -static-libstdc++" \ - CURSES_CFLAGS=-I/opt/ncursesw64/include/ncursesw \ - CURSES_LIBS="-L/opt/ncursesw64/lib -lncursesw" curses + make -j4 CXXFLAGS="$(CXXFLAGS) -static-libstdc++" + make -j4 CXXFLAGS="$(CXXFLAGS) -static-libstdc++" curses cp -rL ../docs ../lexers ../textadept* $< && cp *.asc $