diff options
-rw-r--r-- | README.md | 33 | ||||
-rw-r--r-- | docs/manual.md | 39 | ||||
-rw-r--r-- | init.lua | 1 | ||||
-rw-r--r-- | src/Makefile | 79 | ||||
-rw-r--r-- | src/scintilla.patch | 21 | ||||
-rw-r--r-- | src/textadept.c | 3 |
6 files changed, 76 insertions, 100 deletions
@@ -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 `/<path>/libstdc++.so.6: version 'GLIBCXX_<version>' 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 `/<path>/libc.so.6: version 'GLIBC_<version>' 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 @@ -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 $</src tar czf $<.tgz $< && rm -rf $< && gpg --batch -ab $<.tgz $(basedir).win32: ; $(call archive,$@) @@ -338,10 +335,8 @@ win32-release: $(basedir).win32 $(basedir).macOS: ; mkdir $@ && cp ../scripts/osx/ta $@ osx-release: $(basedir).macOS make clean osx-deps - make CROSS=x86_64-apple-darwin9- CC=gcc CXX=g++ \ - CXXFLAGS="-Os -std=c++11 -mdynamic-no-pic" -j4 osx - make CROSS=x86_64-apple-darwin9- CC=gcc CXX=g++ \ - CXXFLAGS="-Os -std=c++11 -mdynamic-no-pic" -j4 osx-curses + make -j4 osx + make -j4 osx-curses make osx-app && mv $(osxapp) $< zip -r $<.zip $< && rm -rf $< && gpg --batch -ab $<.zip $(basedir).modules: @@ -364,23 +359,29 @@ osx-app: ../textadept ../textadept-curses ../scripts/osx/textadept_osx # External dependencies. -base_deps = scintilla ../lexers lua lualibs gtdialog cdk +base_deps = scintilla scinterm scintillua lua lualibs gtdialog cdk deps: $(base_deps) termkey win32-deps: $(base_deps) win32gtk win32curses osx-deps: $(base_deps) gtkosx termkey +root_url = https://github.com/orbitalquark ifndef NIGHTLY - #gtdialog_url = http://foicica.com/gtdialog/download/$@ - gtdialog_url = http://foicica.com/hg/gtdialog/archive/$@ + scinterm_url = $(root_url)/scinterm/archive/$@ + scintillua_url = $(root_url)/scintillua/archive/$@ + gtdialog_url = $(root_url)/gtdialog/archive/$@ else - gtdialog_url = http://foicica.com/hg/gtdialog/archive/tip.zip + scinterm_url = $(root_url)/scinterm/archive/default.zip + scintillua_url = $(root_url)/scintillua/archive/default.zip + gtdialog_url = $(root_url)/gtdialog/archive/default.zip endif -scintilla_zip = 0c74cd397b6b.zip +scintilla_tgz = scintilla445.tgz +scinterm_zip = 9e2ffa159299899c9345aea15c17ba1941953871.zip +scintillua_zip = e8fe6d18063af4193e817c7e2da8e6f8ccce4aec.zip lua_tgz = lua-5.3.5.tar.gz lpeg_tgz = lpeg-1.0.2.tar.gz lfs_zip = v1_7_0_2.zip -gtdialog_zip = 243e2b811d53.zip +gtdialog_zip = 4958d06ca50bfe622c821342da38a1c22249e574.zip cdk_tgz = cdk-5.0-20150928.tgz termkey_tgz = libtermkey-0.20.tar.gz win32gtk_zip = win32gtk-2.24.32.zip @@ -389,16 +390,22 @@ pdcurses_zip = PDCurses-3.9.zip gtkosx_tgz = gtkosx-2.24.31.tar.gz cloc = cloc-1.60.pl -$(scintilla_zip): ; $(WGET) http://foicica.com/hg/scintilla/archive/$@ -scintilla: scintilla.patch | $(scintilla_zip) +$(scintilla_tgz): ; $(WGET) https://www.scintilla.org/$@ +scintilla: scintilla.patch | $(scintilla_tgz) if [ -d $@/.hg ]; then \ - hg --cwd $@ update -C LongTerm3; \ + hg --cwd $@ update -C; \ else \ if [ -d $@ ]; then rm -r $@; fi; \ - mkdir $@ && unzip -d $@ $| && mv $@/*/* $@; \ + tar xzf $|; \ fi for patch in $^; do echo Applying $$patch; patch -d $@ -N -p1 < $$patch; done -../lexers: | scintilla ; ln -s src/$|/lexlua $@ +$(scinterm_zip): ; $(WGET) $(scinterm_url) -O $@ +scinterm: scintilla/curses +scintilla/curses: | $(scinterm_zip) ; unzip -d $@ -j $| "*/*.cxx" "*/*.h" +$(scintillua_zip): ; $(WGET) $(scintillua_url) -O $@ +scintillua: ../lexers LexLPeg.cxx +../lexers: | $(scintillua_zip) ; unzip -d $@ -j $| "*/lexers/*" -x "*/themes/*" +LexLPeg.cxx: | $(scintillua_zip) ; unzip -j $| "*/*.cxx" "*/*.h" $(lua_tgz): ; $(WGET) http://www.lua.org/ftp/$@ $(lpeg_tgz): ; $(WGET) http://www.inf.puc-rio.br/~roberto/lpeg/$@ $(lfs_zip): ; $(WGET) http://github.com/keplerproject/luafilesystem/archive/$@ @@ -412,8 +419,8 @@ lua/src/lib/lpeg: | $(lpeg_tgz) lua/src/lib/lfs: | $(lfs_zip) if [ -d $@ ]; then rm -r $@; fi mkdir -p $@ && unzip -d $(dir $@) -j $| "*/src/*.c" "*/src/*.h" -$(gtdialog_zip): ; $(WGET) $(gtdialog_url) -gtdialog: | $(gtdialog_zip) ; unzip -d $@ -j $| +$(gtdialog_zip): ; $(WGET) $(gtdialog_url) -O $@ +gtdialog: | $(gtdialog_zip) ; unzip -d $@ -j $| "*/*.c" "*/*.h" $(cdk_tgz): ; $(WGET) http://invisible-mirror.net/archives/cdk/$@ cdk: cdk.patch | $(cdk_tgz) if [ -d $@ ]; then rm -r $@; fi @@ -442,16 +449,16 @@ win32curses: pdcurses.patch | $(win32curses_zip) $(pdcurses_zip) $(gtkosx_tgz): ; $(WGET) http://foicica.com/textadept/download/$@ gtkosx: | $(gtkosx_tgz) ; mkdir $@ && tar xzf $| -C $@ && mv $@/*/* $@ $(cloc): ; $(WGET) http://prdownloads.sourceforge.net/cloc/$@ -sign-deps: | $(scintilla_tgz) $(lua_tgz) $(lpeg_tgz) $(lfs_zip) \ - $(gtdialog_zip) $(cdk_tgz) $(termkey_tgz) $(win32gtk_zip) \ - $(win32curses_zip) $(pdcurses_zip) $(gtkosx_tgz) +sign-deps: | $(scintilla_tgz) $(scinterm_zip) $(scintillua_zip) $(lua_tgz) \ + $(lpeg_tgz) $(lfs_zip) $(gtdialog_zip) $(cdk_tgz) $(termkey_tgz) \ + $(win32gtk_zip) $(win32curses_zip) $(pdcurses_zip) $(gtkosx_tgz) @for file in $|; do gpg --batch -ab $$file; done verify-deps: | $(wildcard $(basename $(wildcard *.asc))) @for file in $|; do echo "$$file"; gpg --verify $$file.asc || return 1; done clean-deps: - rm -rf scintilla ../lexers lua gtdialog cdk termkey win32gtk win32curses \ - gtkosx + rm -rf scintilla ../lexers LexLPeg.cxx lua gtdialog cdk termkey win32gtk \ + win32curses gtkosx # Count lines of code. diff --git a/src/scintilla.patch b/src/scintilla.patch index 9a525ae0..5a4541b2 100644 --- a/src/scintilla.patch +++ b/src/scintilla.patch @@ -1,30 +1,9 @@ Scintilla changes: -Only link the LPeg lexer. - Hijack SCI_LOADLEXERLIBRARY for programmatically setting input method. This is helpful on newer versions of macOS, where changing the input method is flaky. ---- a/src/Catalogue.cxx Fri Dec 06 16:19:52 2013 +1100 -+++ b/src/Catalogue.cxx Sun Dec 15 21:21:20 2013 -0500 -@@ -74,6 +74,7 @@ - // Shorten the code that declares a lexer and ensures it is linked in by calling a method. - #define LINK_LEXER(lexer) extern LexerModule lexer; Catalogue::AddLexerModule(&lexer); - -+#if 0 - //++Autogenerated -- run scripts/LexGen.py to regenerate - //**\(\tLINK_LEXER(\*);\n\) - LINK_LEXER(lmA68k); -@@ -187,6 +188,8 @@ - LINK_LEXER(lmYAML); - - //--Autogenerated -- end of automatically generated section -+#endif -+ LINK_LEXER(lmLPeg); - - return 1; - } diff -r 6e368ee248e4 gtk/ScintillaGTK.cxx --- a/gtk/ScintillaGTK.cxx Fri Oct 26 11:06:34 2018 -0400 +++ b/gtk/ScintillaGTK.cxx Sun Nov 25 00:20:58 2018 -0500 diff --git a/src/textadept.c b/src/textadept.c index e9c812fc..0c68ab53 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -52,6 +52,7 @@ #include "lualib.h" #include "lauxlib.h" #include "Scintilla.h" +#include "LexLPeg.h" #if GTK #include "ScintillaWidget.h" #elif CURSES @@ -1413,6 +1414,7 @@ static void new_buffer(sptr_t doc) { //#elif CURSES // TODO: tabs #endif + SS(focused_view, SCI_SETILEXER, 0, (sptr_t)CreateLexer(NULL)); lua_pushdoc(lua, doc), lua_setglobal(lua, "buffer"); if (!initing) emit(lua, "buffer_new", -1); } @@ -2359,6 +2361,7 @@ static void new_window() { mvwin(scintilla_get_window(command_entry), LINES - 2, 0); dummy_view = scintilla_new(NULL, NULL); #endif + SS(command_entry, SCI_SETILEXER, 0, (sptr_t)CreateLexer(NULL)); register_command_entry_doc(); } |