# Compiling ## Requirements Unfortunately, the requirements for building Textadept are not quite as minimal as running it. ### Linux and BSD Linux systems need the GTK+ development libraries. Your package manager should allow you to install them. For Debian-based distributions like Ubuntu, the package is typically called `libgtk2.0-dev`. Otherwise, compile and install GTK from the [GTK+ website][]. Additionally you will need the [GNU C compiler][] (`gcc`) and [GNU Make][] (`make`). Both should be available for your Linux distribution through its package manager. For example, Ubuntu includes these tools in the `build-essential` package. If you would like to compile the terminal version of Textadept, you will need the ncurses and CDK development libraries. Similarly, they should be available from your package manager. For Debian-based distributions like Ubuntu, the packages are typically called `libncurses5-dev` and `libcdk5-dev`. Otherwise, compile and install them from their [respective][] [websites][]. [GTK+ website]: http://www.gtk.org/download/linux.html [GNU C compiler]: http://gcc.gnu.org [GNU Make]: http://www.gnu.org/software/make/ [respective]: http://invisible-island.net/ncurses/#download_ncurses [websites]: http://invisible-island.net/cdk/#download ### Windows Compiling Textadept on Windows is no longer supported. If you wish to do so however, you need a C compiler that supports the C99 standard (Microsoft's does not) and the [GTK+ for Windows bundle][] (2.24 is recommended). The preferred way to compile for Windows is cross-compiling from Linux. To do so, in addition to the GTK bundle mentioned above, you need [MinGW][] with the Windows header files. They should be available from your package manager. [GTK+ for Windows bundle]: http://www.gtk.org/download/win32.html [MinGW]: http://mingw.org ### Mac OSX Compiling Textadept on Mac OSX is no longer supported. The preferred way is cross-compiling from Linux. To do so, you will need my [GTK+ for OSX bundle][] and the [Apple Crosscompiler][] binaries. [GTK+ for OSX bundle]: download/gtkosx-2.24.9.zip [Apple Crosscompiler]: https://launchpad.net/~flosoft/+archive/cross-apple ## Compiling Make sure you downloaded the `textadept_x.x.src.zip` (regardless of what platform you are on) and not a platform-specific binary package. ### Linux and BSD For Linux systems, simply run `make` in the `src/` directory. The `textadept` and `textadeptjit` executables are created in the root directory. Make a symlink from them to `/usr/bin/` or elsewhere in your `PATH`. ### Cross Compiling for Windows When cross-compiling from within Linux, first unzip the GTK+ for Windows bundle into a new `src/win32gtk` directory. Then, depending on your MingW installation, either run `make win32`, modify the `CROSS` variable in the `win32` block of `src/Makefile` and run `make win32`, or run `make CROSS=i486-mingw32- win32` to build `../textadept.exe` and `../textadeptjit.exe`. Please note that a `lua51.dll` is produced for _only_ the `textadeptjit.exe` because limitations on external Lua library loading do not allow statically linking LuaJIT to Textadept. ### Cross Compiling for Mac OSX When cross-compiling from within Linux, first unzip the GTK+ for OSX bundle into a new `src/gtkosx` directory. Then run `make` to build `../textadept.osx` and `../textadeptjit.osx`. At this point it is recommended to build a new `Textadept.app` from an existing one. Download the most recent app and replace `Contents/MacOS/textadept.osx` and `Contents/MacOS/textadeptjit.osx` with your own versions. #### Compiling on OSX (Legacy) [XCode][] is needed for Mac OSX as well as [jhbuild][]. After building `meta-gtk-osx-bootstrap` and `meta-gtk-osx-core`, you need to build `meta-gtk-osx-themes`. Note that the entire compiling process can easily take 30 minutes or more and ultimately consume nearly 1GB of disk space. After using `jhbuild`, GTK is in `~/gtk` so make a symlink from `~/gtk/inst` to `src/gtkosx` in Textadept. Then open `src/Makefile` and uncomment the `Darwin` block. Finally, run `make osx` to build `../textadept.osx` and `../textadeptjit.osx`. Note: to build a GTK+ for OSX bundle, the following needs to be run from the `src` directory before zipping up `gtkosx/include` and `gtkosx/lib`: sed -i -e 's|libdir=/Users/username/gtk/inst/lib|libdir=${prefix}/lib|;' \ gtkosx/lib/pkgconfig/*.pc where `username` is replaced with your username. [XCode]: http://developer.apple.com/TOOLS/xcode/ [jhbuild]: http://sourceforge.net/apps/trac/gtk-osx/wiki/Build ### Notes on LuaJIT [LuaJIT][] is a Just-In-Time Compiler for Lua and can boost the speed of Lua programs. I have noticed that syntax highlighting can be up to 2 times faster with LuaJIT than with vanilla Lua. This difference is largely unnoticable on modern computers and usually only discernable when initially loading large files. Other than syntax highlighting, LuaJIT offers no real benefit performance-wise to justify it being Textadept's default runtime. LuaJIT's [ffi library][], however, appears to be useful for interfacing with external, non-Lua, libraries. [LuaJIT]: http://luajit.org [ffi library]: http://luajit.org/ext_ffi.html