diff options
author | 2020-09-04 20:56:12 -0400 | |
---|---|---|
committer | 2020-09-04 20:56:12 -0400 | |
commit | 65abfec720806e641c64471104d592aaafed26f7 (patch) | |
tree | 88a3ef110e4b879ddf5aa5ed64725c9db520c6bd | |
parent | affc6c91f7e26b0ba76a82c4eea94926cf46afb0 (diff) | |
download | textadept-65abfec720806e641c64471104d592aaafed26f7.tar.gz textadept-65abfec720806e641c64471104d592aaafed26f7.zip |
Added support for building with Docker and dropped automated Linux i386 builds.
Also tweaked Makefile with basic git support for an eventual migration to
a new build service.
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | doc/index.html | 11 | ||||
-rw-r--r-- | doc/manual.md | 64 | ||||
-rw-r--r-- | src/Dockerfile | 25 | ||||
-rw-r--r-- | src/Makefile | 56 | ||||
-rw-r--r-- | src/luadoc.patch (renamed from modules/lua/luadoc.patch) | 37 |
6 files changed, 136 insertions, 64 deletions
@@ -89,6 +89,8 @@ General Requirements: Windows. * [OSX cross toolchain][] _with GCC_ 4.9+ (not Clang) when cross-compiling for macOS. +* _**OR**_ +* [Docker][] The following table provides a brief list of `make` rules for building Textadept on Linux and BSD. (On BSD, substitute `make` with `gmake`.) @@ -107,6 +109,9 @@ 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`. + For more information on compiling Textadept, please see the [manual][]. [GNU C compiler]: https://gcc.gnu.org @@ -117,6 +122,8 @@ For more information on compiling Textadept, please see the [manual][]. [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 [manual]: https://foicica.com/textadept/manual.html#Compiling ## Contribute diff --git a/doc/index.html b/doc/index.html index 2c92d73b..6b4afaad 100644 --- a/doc/index.html +++ b/doc/index.html @@ -78,13 +78,10 @@ <h2>Nightly<a href="#nightly">*</a> Builds</h2> <ul> - <li><a href="download/textadept_NIGHTLY.win32.zip">Win32</a></li> - <li><a href="download/textadept_NIGHTLY.osx.zip">Mac OSX</a></li> - <li><a href="download/textadept_NIGHTLY.i386.tgz">Linux</a></li> - <li> - <a href="download/textadept_NIGHTLY.x86_64.tgz">Linux x86_64</a> - </li> - <li><a href="download/textadept_NIGHTLY.modules.zip">Modules</a></li> + <li><a href="download/textadept_nightly.win32.zip">Win32</a></li> + <li><a href="download/textadept_nightly.macOS.zip">macOS</a></li> + <li><a href="download/textadept_nightly.linux.tgz">Linux</a></li> + <li><a href="download/textadept_nightly.modules.zip">Modules</a></li> </ul> </div> diff --git a/doc/manual.md b/doc/manual.md index 0c1ec03c..d4061b39 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -343,10 +343,11 @@ you need Textadept to see. For example: **Linux Note:** providing a single binary that runs on all Linux systems proves challenging, since the versions of software installed vary widely from -distribution to distribution. If you get an error like: +distribution to distribution. If you get errors like: - error while loading shared libraries: <lib>: cannot open shared object - file: No such file or directory + * `/<path>/libc.so.6: version 'GLIBC_<version>' not found` + * `error while loading shared libraries: <lib>: cannot open shared object + file: No such file or directory` you will need to [compile](#Compiling) Textadept manually for your system, which is a very straightforward and easy process. @@ -1569,9 +1570,10 @@ editing Lua code. For example, in your *~/.textadept/init.lua*: -------------------------------------------------------------------------------- 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. ### Requirements @@ -1587,10 +1589,12 @@ Linux requirements: * [GTK][] 2.24+ development libraries for the GUI version * [ncurses][](w) development libraries (wide character support) for the terminal version +* _**OR**_ +* [Docker][] **Note:** on Ubuntu for example, these dependencies would be provided by the -`build-essential`, `libgtk2.0-dev`, `libncurses5-dev`, and `libncursesw5-dev` -packages. +`build-essential`, `libgtk2.0-dev`, `libncurses5-dev`, `libncursesw5-dev`, and +`docker.io` packages. BSD requirements: @@ -1606,20 +1610,26 @@ BSD requirements: Windows cross-compiling requirements: * [MinGW][] or [mingw-w64][] 4.9+ (circa early 2014) +* _**OR**_ +* [Docker][] -**Note:** on Ubuntu for example, this dependency would be provided by the -`gcc-mingw-w64` and `g++-mingw-w64` packages. +**Note:** on Ubuntu for example, the compiler dependency would be provided by +the `gcc-mingw-w64` and `g++-mingw-w64` packages. macOS cross-compiling requirements: * [OSX cross toolchain][] with GCC 4.9+ (not Clang) +* _**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 an macOS cross toolchain can easily take 30 minutes or +**Warning:** building a macOS cross toolchain can easily take 30 minutes or more and ultimately consume nearly 3.5GB of disk space. +[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/ @@ -1681,6 +1691,38 @@ specify your system's MinGW name prefix using the `CROSS` variable. For example: make CROSS=i586-mingw32-msvc- win32-deps make CROSS=i586-mingw32-msvc- win32 +#### 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 run -t -i -v /path/to/textadept:/ta -w /ta/src \ + textadept/build:v1.0 + container# make deps + container# make + container# exit + +If you prefer to build your own Docker image instead of pulling one, you can +run `docker build .` from Textadept's *src/* directory, which contains the +relevant *Dockerfile*. + +You can issue within the container any of the build commands given in +the previous table, though the install commands are meaningless. + +**Linux note:** if, when running one of the Linux binaries produced, you get an +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++" + +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 + -------------------------------------------------------------------------------- ## Appendix -------------------------------------------------------------------------------- diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100644 index 00000000..d565ed74 --- /dev/null +++ b/src/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:bionic +LABEL maintainer="textadept" + +RUN echo "Fetching packages" \ + && apt-get update \ + && DEBIAN_FRONTEND="noninteractive" apt-get install -y -q --no-install-recommends \ + build-essential ca-certificates curl git gnupg mercurial unzip wget zip \ + mingw-w64 \ + clang cmake libssl-dev libxml2-dev llvm-dev lzma-dev uuid-dev \ + libmpc-dev libmpfr-dev libgmp-dev \ + libgtk2.0-dev libncurses5-dev libncursesw5-dev \ + luadoc discount \ + && apt-get clean + +COPY luadoc.patch / +RUN echo "Patching LuaDoc" && cd /usr/share/lua/5.1 && patch -p0 < /luadoc.patch + +RUN echo "Building osxcross" \ + && wget https://github.com/tpoechtrager/osxcross/archive/748108aec4e3ceb672990df8164a11b0ac6084f7.zip \ + && unzip *.zip && mv osxcross-* /opt/osxcross && rm *.zip \ + && wget https://www.dropbox.com/s/yfbesd249w10lpc/MacOSX10.10.sdk.tar.xz \ + && mv MacOSX* /opt/osxcross/tarballs \ + && cd /opt/osxcross && UNATTENDED=1 SDK_VERSION="10.10" OSX_VERSION_MIN="10.6" ./build.sh +RUN echo "Cleaning up" && rm -rf /opt/osxcross/build /opt/osxcross/tarballs/MacOSX* +ENV PATH="$PATH:/opt/osxcross/target/bin" diff --git a/src/Makefile b/src/Makefile index 0f7f5776..c10c0a06 100644 --- a/src/Makefile +++ b/src/Makefile @@ -36,9 +36,11 @@ ifeq (win, $(findstring win, $(MAKECMDGOALS))) endif else ifeq (osx, $(findstring osx, $(MAKECMDGOALS))) # Cross-compile for macOS. - CROSS = x86_64-apple-darwin9- + CC = cc + CXX = c++ + CROSS = x86_64-apple-darwin14- CFLAGS += -mdynamic-no-pic - CXXFLAGS += -mdynamic-no-pic + CXXFLAGS += -mdynamic-no-pic -stdlib=libc++ LUA_CFLAGS = -DLUA_USE_MACOSX LDFLAGS = -liconv ifeq (, $(findstring curses, $(MAKECMDGOALS))) @@ -287,7 +289,7 @@ luadoc: ../modules ../core ../lexers/lexer.lua | ../modules/lua/lua.luadoc ifndef NIGHTLY basedir = textadept_$(version) else - basedir = textadept_NIGHTLY_$(shell date +"%F") + basedir = textadept_nightly_$(shell date +"%F") endif osxapp = Textadept.app osxapp_bin = $(osxapp)/Contents/MacOS @@ -303,30 +305,26 @@ 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 release64 win32-release osx-release modules-release +release-all: release win32-release osx-release modules-release -$(basedir).i386: ; hg archive $@ -X ".hg*" -release: $(basedir).i386 +ifneq (, $(shell hg summary 2>/dev/null)) + archive = hg archive -X ".hg*" $(1) +else + archive = cd ../ && git archive HEAD --prefix src/$(1)/ | tar -xf - +endif + +$(basedir).linux: ; $(call archive,$@) +release: $(basedir).linux make deps clean doc sign-deps - PKG_CONFIG_PATH=/opt/gtk/lib/pkgconfig make -j4 \ - LDFLAGS="$(LDFLAGS) -static-libstdc++" - make -j4 LDFLAGS="$(LDFLAGS) -static-libstdc++" \ - CURSES_CFLAGS=-I/opt/ncursesw/include/ncursesw \ - CURSES_LIBS="-L/opt/ncursesw/lib -lncursesw" curses - cp -rL ../doc ../lexers ../textadept* $< && cp *.asc $</src - tar czf /tmp/$<.tgz $< && rm -rf $< && gpg --batch -ab /tmp/$<.tgz -$(basedir).x86_64: ; hg archive $@ -X ".hg*" -release64: $(basedir).x86_64 - make clean PKG_CONFIG_PATH=/opt/gtk64/lib/pkgconfig make -j4 CFLAGS="$(CFLAGS) -m64" \ - CXXFLAGS="$(CXXFLAGS) -m64 -static-libstdc++" || return 0 + 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 || return 0 + CURSES_LIBS="-L/opt/ncursesw64/lib -lncursesw" curses cp -rL ../doc ../lexers ../textadept* $< && cp *.asc $</src - tar czf /tmp/$<.tgz $< && rm -rf $< && gpg --batch -ab /tmp/$<.tgz -$(basedir).win32: ; hg archive $@ -X ".hg*" + tar czf $<.tgz $< && rm -rf $< && gpg --batch -ab $<.tgz +$(basedir).win32: ; $(call archive,$@) win32-release: $(basedir).win32 make -j4 clean win32-deps cp win32gtk/bin/*.dll $< && cp -r win32gtk/etc \ @@ -336,25 +334,27 @@ win32-release: $(basedir).win32 make -j4 win32-curses cp -rL ../doc ../lexers ../textadept* $< cp *.asc $</src - zip -r /tmp/$<.zip $< && rm -rf $< && gpg --batch -ab /tmp/$<.zip -$(basedir).osx: ; mkdir $@ && cp ../scripts/osx/ta $@ -osx-release: $(basedir).osx + zip -r $<.zip $< && rm -rf $< && gpg --batch -ab $<.zip +$(basedir).macOS: ; mkdir $@ && cp ../scripts/osx/ta $@ +osx-release: $(basedir).macOS make clean osx-deps - make -j4 osx - make -j4 osx-curses + 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 osx-app && mv $(osxapp) $< - zip -r /tmp/$<.zip $< && rm -rf $< && gpg --batch -ab /tmp/$<.zip + zip -r $<.zip $< && rm -rf $< && gpg --batch -ab $<.zip $(basedir).modules: mkdir -p $@/modules hg archive -R /home/mitchell/code/textadept_modules/ -r tip $@/modules modules-release: $(basedir).modules - zip -r /tmp/$<.zip $< && rm -r $< && gpg --batch -ab /tmp/$<.zip + zip -r $<.zip $< && rm -r $< && gpg --batch -ab $<.zip osx-app: ../textadept ../textadept-curses ../scripts/osx/textadept_osx mkdir -p $(osxapp_bin) $(osxapp_res) cp Info.plist $(osxapp_bin)/../ cp $^ $(osxapp_bin)/ - hg archive $(osxapp_res) -X ".hg*" + $(call archive,$(osxapp_res)) cp -rL ../doc ../lexers $(osxapp_res) && cp *.asc $(osxapp_res)/src mv $(osxapp_res)/core/images/textadept.icns $(osxapp_res)/ cp -r gtkosx/etc gtkosx/share $(osxapp_res)/ && mkdir $(osxapp_res)/lib/ diff --git a/modules/lua/luadoc.patch b/src/luadoc.patch index 175b5942..e0dae6a2 100644 --- a/modules/lua/luadoc.patch +++ b/src/luadoc.patch @@ -1,22 +1,23 @@ +Preserve some formatting for Lua API documentation in Textadept. --- luadoc/util.lua.orig 2012-02-10 13:34:46.166184400 -0500 +++ luadoc/util.lua 2012-02-10 13:36:59.847551200 -0500 @@ -29,8 +29,8 @@ - -- @see string.gsub
-
- function trim_comment (s)
-- s = string.gsub(s, "%-%-+(.*)$", "%1")
-- return trim(s)
-+ s = string.gsub(s, "%-%-+ ?(.*)$", "%1")
-+ return s
- end
-
- -------------------------------------------------------------------------------
+ -- @see string.gsub + + function trim_comment (s) +- s = string.gsub(s, "%-%-+(.*)$", "%1") +- return trim(s) ++ s = string.gsub(s, "%-%-+ ?(.*)$", "%1") ++ return s + end + + ------------------------------------------------------------------------------- @@ -52,7 +52,7 @@ - if str1 == nil or string.len(str1) == 0 then
- return str2
- else
-- return str1 .. " " .. str2
-+ return str1 .. "\n" .. str2
- end
- end
-
+ if str1 == nil or string.len(str1) == 0 then + return str2 + else +- return str1 .. " " .. str2 ++ return str1 .. "\n" .. str2 + end + end + |