nixpkgs/pkgs/applications/editors/textadept/default.nix

159 lines
5.4 KiB
Nix
Raw Normal View History

{ stdenv, fetchhg, fetchurl, fetchzip, gtk2, glib, pkgconfig, unzip, ncurses, zip }:
2015-06-02 19:31:57 +02:00
let
2016-06-22 06:58:50 +02:00
# Textadept requires a whole bunch of external dependencies.
# The build system expects to be able to download them with wget.
# This expression gets Nix to fetch them instead.
2015-06-02 19:31:57 +02:00
cached_url = url: sha256: fetchurl {
inherit sha256 url;
};
2016-06-22 06:58:50 +02:00
get_url = url: sha256: let
store_path = cached_url url sha256;
in ''
local_path=$(basename ${store_path} | sed -e 's@^[0-9a-z]\+-@@')
# Copy the file from the Nix store and remove the hash part.
cp ${store_path} $local_path
# Update its access and modified times.
touch $local_path
2015-06-02 19:31:57 +02:00
'';
2016-06-22 06:58:50 +02:00
2015-06-02 19:31:57 +02:00
cached_url_zip = url: sha256: fetchzip {
inherit sha256 url;
};
2016-06-22 06:58:50 +02:00
get_url_zip = url: sha256: let
store_path = cached_url_zip url sha256;
in ''
(
build_dir=$PWD
cd $TMPDIR
local_path=$(basename ${store_path} .zip | sed -e 's/^[a-z0-9]*-//')
cp -r ${store_path} $local_path
chmod u+rwX -R $local_path
zip -r $build_dir/$local_path.zip $local_path
touch $local_path
)
2015-06-02 19:31:57 +02:00
'';
2016-06-22 06:58:50 +02:00
# These lists are taken from the Makefile.
2016-10-05 06:00:20 +02:00
scintilla_tgz = "scintilla367.tgz";
tre_zip = "cdce45e8dd7a3b36954022b4a4d3570e1ac5a4f8.zip";
2016-06-22 06:58:50 +02:00
scinterm_zip = "scinterm_1.8.zip";
2016-10-05 06:00:20 +02:00
scintillua_zip = "scintillua_3.6.7-1.zip";
lua_tgz = "lua-5.3.3.tar.gz";
2016-06-22 06:58:50 +02:00
lpeg_tgz = "lpeg-1.0.0.tar.gz";
lfs_zip = "v_1_6_3.zip";
lspawn_zip = "lspawn_1.5.zip";
luajit_tgz = "LuaJIT-2.0.3.tar.gz";
libluajit_tgz = "libluajit_2.0.3.x86_64.tgz";
2016-10-05 06:00:20 +02:00
gtdialog_zip = "gtdialog_1.3.zip";
2016-06-22 06:58:50 +02:00
cdk_tgz = "cdk-5.0-20150928.tgz";
termkey_tgz = "libtermkey-0.17.tar.gz";
bombay_zip = "bombay.zip";
scinterm_url = "http://foicica.com/scinterm/download/" + scinterm_zip;
2016-10-05 06:00:20 +02:00
tre_url = "https://github.com/laurikari/tre/archive/" + tre_zip;
2016-06-22 06:58:50 +02:00
scintillua_url = "http://foicica.com/scintillua/download/" + scintillua_zip;
gtdialog_url = "http://foicica.com/gtdialog/download/" + gtdialog_zip;
lspawn_url = "http://foicica.com/lspawn/download/" + lspawn_zip;
scintilla_url = "http://prdownloads.sourceforge.net/scintilla/" + scintilla_tgz;
lua_url = "http://www.lua.org/ftp/" + lua_tgz;
lpeg_url = "http://www.inf.puc-rio.br/~roberto/lpeg/" + lpeg_tgz;
lfs_url = "https://github.com/keplerproject/luafilesystem/archive/" + lfs_zip;
luajit_url = "http://luajit.org/download/" + luajit_tgz;
libluajit_url = "http://foicica.com/textadept/download/" + libluajit_tgz;
cdk_url = "http://invisible-mirror.net/archives/cdk/" + cdk_tgz;
bombay_url = "http://foicica.com/hg/bombay/archive/tip.zip";
termkey_url = "http://www.leonerd.org.uk/code/libtermkey/" + termkey_tgz;
2016-10-05 06:00:20 +02:00
get_scintilla = get_url scintilla_url "0rh1xgd06qcnj4l0vi8g4i94vi63s76366b8hhqky3iqdjgwsxpi";
get_tre = get_url tre_url "0mw8npwk5nnhc33352j4akannhpx77kqvfam8jdq1n4yf8js1gi7";
2016-06-22 06:58:50 +02:00
get_scinterm = get_url scinterm_url "02ax6cjpxylfz7iqp1cjmsl323in066a38yklmsyzdl3w7761nxi";
2016-10-05 06:00:20 +02:00
get_scintillua = get_url scintillua_url "0fhyjrkfj2cvxnql65687nx1d0sfyg5lbrxmylyzhnfh4s4jnwmq";
get_lua = get_url lua_url "18mcfbbmjyp8f2l9yy7n6dzk066nq6man0kpwly4bppphilc04si";
2016-06-22 06:58:50 +02:00
get_lpeg = get_url lpeg_url "13mz18s359wlkwm9d9iqlyyrrwjc6iqfpa99ai0icam2b3khl68h";
get_lfs = get_url_zip lfs_url "1hxcnqj53540ysyw8fzax7f09pl98b8f55s712gsglcdxp2g2pri";
get_lspawn = get_url lspawn_url "09c6v9irblay2kv1n7i59pyj9g4xb43c6rfa7ba5m353lymcwwqi";
get_luajit = get_url luajit_url "0ydxpqkmsn2c341j4r2v6r5r0ig3kbwv3i9jran3iv81s6r6rgjm";
get_libluajit = get_url libluajit_url "1nhvcdjpqrhd5qbihdm3bxpw84irfvnw2vmfqnsy253ay3dxzrgy";
get_gtdialog = get_url gtdialog_url "0nvcldyhj8abr8jny9pbyfjwg8qfp9f2h508vjmrvr5c5fqdbbm0";
get_cdk = get_url cdk_url "0j74l874y33i26y5kjg3pf1vswyjif8k93pqhi0iqykpbxfsg382";
get_bombay = get_url_zip bombay_url "05fnh1imxdb4sb076fzqywqszp31whdbkzmpkqxc8q2r1m5vj3hg"
+ "mv tip.zip bombay.zip\n";
get_termkey = get_url termkey_url "12gkrv1ldwk945qbpprnyawh0jz7rmqh18fyndbxiajyxmj97538";
get_deps = get_scintilla
2016-10-05 06:00:20 +02:00
+ get_tre
2016-06-22 06:58:50 +02:00
+ get_scinterm
+ get_scintillua
+ get_lua
+ get_lpeg
+ get_lfs
+ get_lspawn
+ get_luajit
+ get_libluajit
+ get_gtdialog
+ get_cdk
+ get_bombay
+ get_termkey;
2015-06-02 19:31:57 +02:00
in
2016-06-22 06:58:50 +02:00
stdenv.mkDerivation rec {
2016-10-05 06:00:20 +02:00
version = "9.0";
2015-06-02 19:31:57 +02:00
name = "textadept-${version}";
2016-06-22 06:58:50 +02:00
buildInputs = [
gtk2 glib pkgconfig unzip ncurses zip
2016-06-22 06:58:50 +02:00
];
2015-06-02 19:31:57 +02:00
src = fetchhg {
url = http://foicica.com/hg/textadept;
rev = "textadept_${version}";
2016-10-05 06:00:20 +02:00
sha256 = "1fkxblf2db4i0kbfww94xwps7nbn88qc4fwghrm4dcszcq32jlfi";
2015-06-02 19:31:57 +02:00
};
2016-06-22 06:58:50 +02:00
2015-06-02 19:31:57 +02:00
preConfigure = ''
cd src
2016-06-22 06:58:50 +02:00
# Make a dummy wget.
2015-06-02 19:31:57 +02:00
mkdir wget
echo '#! ${stdenv.shell}' > wget/wget
chmod a+x wget/wget
export PATH="$PATH:$PWD/wget"
2016-06-22 06:58:50 +02:00
${get_deps}
# Let the build system do whatever setup it needs to do with these files.
2015-06-02 19:31:57 +02:00
make deps
'';
2016-06-22 06:58:50 +02:00
2015-06-02 19:31:57 +02:00
postBuild = ''
make curses
'';
2016-06-22 06:58:50 +02:00
2015-06-02 19:31:57 +02:00
postInstall = ''
make curses install PREFIX=$out MAKECMDGOALS=curses
'';
2016-06-22 06:58:50 +02:00
makeFlags = [
"PREFIX=$(out)"
];
meta = with stdenv.lib; {
2015-06-02 19:31:57 +02:00
description = "An extensible text editor based on Scintilla with Lua scripting";
2016-06-22 06:58:50 +02:00
homepage = http://foicica.com/textadept;
license = licenses.mit;
maintainers = with maintainers; [ raskin mirrexagon ];
platforms = platforms.linux;
2015-06-02 19:31:57 +02:00
};
}