at 17.09-beta 520 lines 16 kB view raw
1/* This file defines the composition for Lua packages. It has 2 been factored out of all-packages.nix because there are many of 3 them. Also, because most Nix expressions for Lua packages are 4 trivial, most are actually defined here. I.e. there's no function 5 for each package in a separate file: the call to the function would 6 be almost as must code as the function itself. */ 7 8{ fetchurl, fetchzip, stdenv, lua, callPackage, unzip, zziplib, pkgconfig, libtool 9, pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat, cairo 10, perl, gtk2, python, glib, gobjectIntrospection, libevent, zlib, autoreconfHook 11, fetchFromGitHub, libmpack 12}: 13 14let 15 isLua51 = lua.luaversion == "5.1"; 16 isLua52 = lua.luaversion == "5.2"; 17 18 platformString = 19 if stdenv.isDarwin then "macosx" 20 else if stdenv.isFreeBSD then "freebsd" 21 else if stdenv.isLinux then "linux" 22 else if stdenv.isSunOS then "solaris" 23 else throw "unsupported platform"; 24 25 self = _self; 26 _self = with self; { 27 inherit lua; 28 inherit (stdenv.lib) maintainers; 29 30 # helper functions for dealing with LUA_PATH and LUA_CPATH 31 getPath = lib : type : "${lib}/lib/lua/${lua.luaversion}/?.${type};${lib}/share/lua/${lua.luaversion}/?.${type}"; 32 getLuaPath = lib : getPath lib "lua"; 33 getLuaCPath = lib : getPath lib "so"; 34 35 #define build lua package function 36 buildLuaPackage = callPackage ../development/lua-modules/generic lua; 37 38 luarocks = callPackage ../development/tools/misc/luarocks { 39 inherit lua; 40 }; 41 42 luabitop = buildLuaPackage rec { 43 version = "1.0.2"; 44 name = "bitop-${version}"; 45 src = fetchurl { 46 url = "http://bitop.luajit.org/download/LuaBitOp-${version}.tar.gz"; 47 sha256 = "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj"; 48 }; 49 50 buildFlags = stdenv.lib.optionalString stdenv.isDarwin "macosx"; 51 52 postPatch = stdenv.lib.optionalString stdenv.isDarwin '' 53 substituteInPlace Makefile --replace 10.4 10.5 54 ''; 55 56 preBuild = '' 57 makeFlagsArray=( 58 ${stdenv.lib.optionalString stdenv.cc.isClang "CC=$CC"} 59 INCLUDES="-I${lua}/include" 60 LUA="${lua}/bin/lua"); 61 ''; 62 63 installPhase = '' 64 mkdir -p $out/lib/lua/${lua.luaversion} 65 install -p bit.so $out/lib/lua/${lua.luaversion} 66 ''; 67 68 meta = { 69 homepage = "http://bitop.luajit.org"; 70 maintainers = with maintainers; [ flosse ]; 71 }; 72 }; 73 74 luacheck = buildLuaPackage rec { 75 pname = "luacheck"; 76 version = "0.20.0"; 77 name = "${pname}${version}"; 78 79 src = fetchFromGitHub { 80 owner = "mpeterv"; 81 repo = "luacheck"; 82 rev = "${version}"; 83 sha256 = "0ahfkmqcjhlb7r99bswy1sly6d7p4pyw5f4x4fxnxzjhbq0c5qcs"; 84 }; 85 86 propagatedBuildInputs = [ lua ]; 87 88 installPhase = '' 89 ${lua}/bin/lua install.lua $out 90 ''; 91 92 meta = with stdenv.lib; { 93 description = "A tool for linting and static analysis of Lua code"; 94 homepage = https://github.com/mpeterv/luacheck; 95 license = licenses.mit; 96 platforms = platforms.unix; 97 }; 98 }; 99 100 luaevent = buildLuaPackage rec { 101 version = "0.4.3"; 102 name = "luaevent-${version}"; 103 disabled = isLua52; 104 105 src = fetchzip { 106 url = "https://github.com/harningt/luaevent/archive/v${version}.tar.gz"; 107 sha256 = "1c1n2zqx5rwfwkqaq1jj8gvx1vswvbihj2sy445w28icz1xfhpik"; 108 }; 109 110 preBuild = '' 111 makeFlagsArray=( 112 INSTALL_DIR_LUA="$out/share/lua/${lua.luaversion}" 113 INSTALL_DIR_BIN="$out/lib/lua/${lua.luaversion}" 114 LUA_INC_DIR="${lua}/include" 115 ); 116 ''; 117 118 buildInputs = [ libevent ]; 119 120 propagatedBuildInputs = [ luasocket ]; 121 122 meta = with stdenv.lib; { 123 homepage = http://luaforge.net/projects/luaevent/; 124 description = "Binding of libevent to Lua"; 125 license = licenses.mit; 126 maintainers = [ maintainers.koral ]; 127 }; 128 }; 129 130 luaexpat = buildLuaPackage rec { 131 version = "1.3.0"; 132 name = "expat-${version}"; 133 isLibrary = true; 134 src = fetchurl { 135 url = "https://matthewwild.co.uk/projects/luaexpat/luaexpat-${version}.tar.gz"; 136 sha256 = "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h"; 137 }; 138 139 buildInputs = [ expat ]; 140 141 preConfigure = stdenv.lib.optionalString stdenv.isDarwin '' 142 substituteInPlace Makefile \ 143 --replace '-shared' '-bundle -undefined dynamic_lookup -all_load' 144 ''; 145 146 preBuild = '' 147 makeFlagsArray=( 148 LUA_LDIR="$out/share/lua/${lua.luaversion}" 149 LUA_INC="-I${lua}/include" LUA_CDIR="$out/lib/lua/${lua.luaversion}" 150 EXPAT_INC="-I${expat.dev}/include"); 151 ''; 152 153 meta = { 154 homepage = "http://matthewwild.co.uk/projects/luaexpat"; 155 platforms = stdenv.lib.platforms.unix; 156 maintainers = [ stdenv.lib.maintainers.flosse ]; 157 }; 158 }; 159 160 luafilesystem = buildLuaPackage rec { 161 name = "filesystem-1.6.2"; 162 src = fetchzip { 163 url = "https://github.com/keplerproject/luafilesystem/archive/v1_6_2.tar.gz"; 164 sha256 = "134azkxw84xp9g5qmzjsmcva629jm7plwcmjxkdzdg05vyd7kig1"; 165 }; 166 preConfigure = "substituteInPlace config --replace 'CC= gcc' '';" 167 + stdenv.lib.optionalString stdenv.isDarwin '' 168 substituteInPlace config \ 169 --replace 'LIB_OPTION= -shared' '###' \ 170 --replace '#LIB_OPTION= -bundle' 'LIB_OPTION= -bundle' 171 substituteInPlace Makefile --replace '10.3' '10.5' 172 ''; 173 meta = { 174 homepage = "https://github.com/keplerproject/luafilesystem"; 175 platforms = stdenv.lib.platforms.unix; 176 maintainers = with maintainers; [ flosse ]; 177 }; 178 }; 179 180 luaposix = buildLuaPackage rec { 181 name = "posix-${version}"; 182 version = "33.4.0"; 183 src = fetchurl { 184 url = "https://github.com/luaposix/luaposix/archive/release-v${version}.tar.gz"; 185 sha256 = "e66262f5b7fe1c32c65f17a5ef5ffb31c4d1877019b4870a5d373e2ab6526a21"; 186 }; 187 buildInputs = [ perl ]; 188 meta = { 189 description = "Lua bindings for POSIX API"; 190 homepage = "https://github.com/luaposix/luaposix"; 191 platforms = stdenv.lib.platforms.unix; 192 }; 193 }; 194 195 lpty = buildLuaPackage rec { 196 name = "lpty-${version}"; 197 version = "1.1.1"; 198 src = fetchurl { 199 url = "http://www.tset.de/downloads/lpty-1.1-1.tar.gz"; 200 sha256 = "0d4ffda654dcf37dd8c99bcd100d0ee0dde7782cbd0ba9200ef8711c5cab02f1"; 201 }; 202 meta = { 203 homepage = "http://www.tset.de/lpty"; 204 platforms = stdenv.lib.platforms.linux; 205 license = stdenv.lib.licenses.mit; 206 }; 207 preBuild = '' 208 makeFlagsArray=( 209 INST_LIBDIR="$out/lib/lua/${lua.luaversion}" 210 INST_LUADIR="$out/share/lua/${lua.luaversion}" 211 LUA_BINDIR="${lua}/bin" 212 LUA_INCDIR="-I${lua}/include" 213 LUA_LIBDIR="-L${lua}/lib" 214 ); 215 ''; 216 }; 217 218 luasec = buildLuaPackage rec { 219 name = "sec-0.6"; 220 src = fetchFromGitHub { 221 owner = "brunoos"; 222 repo = "luasec"; 223 rev = "lua${name}"; 224 sha256 = "0wv8l7f7na7kw5xn8mjik2wpxbizl7zvvp5s7fcwvz9kl5jdpk5b"; 225 }; 226 227 buildInputs = [ openssl ]; 228 229 preBuild = '' 230 makeFlagsArray=( 231 ${platformString} 232 LUAPATH="$out/lib/lua/${lua.luaversion}" 233 LUACPATH="$out/lib/lua/${lua.luaversion}" 234 INC_PATH="-I${lua}/include" 235 LIB_PATH="-L$out/lib"); 236 ''; 237 238 meta = { 239 homepage = "https://github.com/brunoos/luasec"; 240 platforms = stdenv.lib.platforms.unix; 241 maintainers = [ stdenv.lib.maintainers.flosse ]; 242 }; 243 }; 244 245 luasocket = buildLuaPackage rec { 246 name = "socket-${version}"; 247 version = "3.0-rc1"; 248 src = fetchurl { 249 url = "https://github.com/diegonehab/luasocket/archive/v${version}.tar.gz"; 250 sha256 = "0j8jx8bjicvp9khs26xjya8c495wrpb7parxfnabdqa5nnsxjrwb"; 251 }; 252 253 patchPhase = stdenv.lib.optionalString stdenv.isDarwin '' 254 substituteInPlace src/makefile --replace gcc cc \ 255 --replace 10.3 10.5 256 ''; 257 258 preBuild = '' 259 makeFlagsArray=( 260 LUAV=${lua.luaversion} 261 PLAT=${platformString} 262 prefix=$out 263 ); 264 ''; 265 266 meta = with stdenv.lib; { 267 homepage = "http://w3.impa.br/~diego/software/luasocket/"; 268 platforms = with platforms; darwin ++ linux ++ freebsd ++ illumos; 269 maintainers = with maintainers; [ mornfall ]; 270 }; 271 }; 272 273 luazip = buildLuaPackage rec { 274 name = "zip-${version}"; 275 version = "1.2.3"; 276 src = fetchzip { 277 url = "https://github.com/luaforge/luazip/archive/0b8f5c958e170b1b49f05bc267bc0351ad4dfc44.zip"; 278 sha256 = "0zrrwhmzny5zbpx91bjbl77gzkvvdi3qhhviliggp0aj8w3faxsr"; 279 }; 280 buildInputs = [ unzip zziplib ]; 281 patches = [ ../development/lua-modules/zip.patch ]; 282 # does not currently work under lua 5.2 283 disabled = isLua52; 284 meta = { 285 homepage = "https://github.com/luaforge/luazip"; 286 platforms = stdenv.lib.platforms.linux; 287 license = stdenv.lib.licenses.mit; 288 }; 289 }; 290 291 luazlib = buildLuaPackage rec { 292 name = "zlib-${version}"; 293 version = "1.1"; 294 295 src = fetchzip { 296 url = "https://github.com/brimworks/lua-zlib/archive/v${version}.tar.gz"; 297 sha256 = "1520lk4xpf094xn2zallqgqhs0zb4w61l49knv9y8pmhkdkxzzgy"; 298 }; 299 300 buildInputs = [ zlib ]; 301 302 preConfigure = "substituteInPlace Makefile --replace gcc cc --replace '-llua' ''"; 303 304 preBuild = '' 305 makeFlagsArray=( 306 ${platformString} 307 LUAPATH="$out/share/lua/${lua.luaversion}" 308 LUACPATH="$out/lib/lua/${lua.luaversion}" 309 INCDIR="-I${lua}/include" 310 LIBDIR="-L${lua}/lib"); 311 ''; 312 313 preInstall = "mkdir -p $out/lib/lua/${lua.luaversion}"; 314 315 meta = with stdenv.lib; { 316 homepage = https://github.com/brimworks/lua-zlib; 317 platforms = platforms.unix; 318 license = licenses.mit; 319 maintainers = [ maintainers.koral ]; 320 }; 321 }; 322 323 324 luastdlib = buildLuaPackage { 325 name = "stdlib"; 326 src = fetchzip { 327 url = "https://github.com/lua-stdlib/lua-stdlib/archive/release.zip"; 328 sha256 = "0636absdfjx8ybglwydmqxwfwmqz1c4b9s5mhxlgm4ci18lw3hms"; 329 }; 330 buildInputs = [ autoreconfHook unzip ]; 331 meta = { 332 homepage = "https://github.com/lua-stdlib/lua-stdlib/"; 333 platforms = stdenv.lib.platforms.linux; 334 license = stdenv.lib.licenses.mit; 335 }; 336 }; 337 338 lrexlib = buildLuaPackage rec { 339 name = "lrexlib-${version}"; 340 version = "2.8.0"; 341 src = fetchzip { 342 url = "https://github.com/rrthomas/lrexlib/archive/rel-2-8-0.zip"; 343 sha256 = "1c62ny41b1ih6iddw5qn81gr6dqwfffzdp7q6m8x09zzcdz78zhr"; 344 }; 345 buildInputs = [ unzip luastdlib pcre luarocks oniguruma gnulib tre glibc ]; 346 347 buildPhase = let 348 luaVariable = ''LUA_PATH="${luastdlib}/share/lua/${lua.luaversion}/?/init.lua;${luastdlib}/share/lua/${lua.luaversion}/?.lua"''; 349 350 pcreVariable = "PCRE_DIR=${pcre.out} PCRE_INCDIR=${pcre.dev}/include"; 351 onigVariable = "ONIG_DIR=${oniguruma}"; 352 gnuVariable = "GNU_INCDIR=${gnulib}/lib"; 353 treVariable = "TRE_DIR=${tre}"; 354 posixVariable = "POSIX_DIR=${glibc.dev}"; 355 in '' 356 sed -e 's@$(LUAROCKS) $(LUAROCKS_COMMAND) $$i;@$(LUAROCKS) $(LUAROCKS_COMMAND) $$i ${pcreVariable} ${onigVariable} ${gnuVariable} ${treVariable} ${posixVariable};@' -i Makefile 357 ${luaVariable} make 358 ''; 359 360 installPhase = '' 361 mkdir -pv $out; 362 cp -r luarocks/lib $out; 363 ''; 364 365 meta = { 366 homepage = "https://github.com/lua-stdlib/lua-stdlib/"; 367 platforms = stdenv.lib.platforms.linux; 368 license = stdenv.lib.licenses.mit; 369 }; 370 }; 371 372 luasqlite3 = buildLuaPackage rec { 373 name = "sqlite3-${version}"; 374 version = "2.1.1"; 375 src = fetchzip { 376 url = "https://github.com/LuaDist/luasql-sqlite3/archive/2acdb6cb256e63e5b5a0ddd72c4639d8c0feb52d.zip"; 377 sha256 = "17zsa0jzciildil9k4lb0rjn9s1nj80dy16pzx9bxqyi75pjf2d4"; 378 }; 379 380 buildInputs = [ unzip sqlite ]; 381 382 patches = [ ../development/lua-modules/luasql.patch ]; 383 384 meta = { 385 homepage = "https://github.com/LuaDist/luasql-sqlite3"; 386 platforms = stdenv.lib.platforms.linux; 387 license = stdenv.lib.licenses.mit; 388 }; 389 }; 390 391 lpeg = buildLuaPackage rec { 392 name = "lpeg-${version}"; 393 version = "0.12"; 394 src = fetchurl { 395 url = "http://www.inf.puc-rio.br/~roberto/lpeg/${name}.tar.gz"; 396 sha256 = "0xlbfw1w7l65a5qhnx5sfw327hkq1zcj8xmg4glfw6fj9ha4b9gg"; 397 }; 398 buildInputs = [ unzip ]; 399 400 preBuild = '' 401 makeFlagsArray=(CC=$CC); 402 ''; 403 404 buildFlags = platformString; 405 406 installPhase = '' 407 mkdir -p $out/lib/lua/${lua.luaversion} 408 install -p lpeg.so $out/lib/lua/${lua.luaversion} 409 install -p re.lua $out/lib/lua/${lua.luaversion} 410 ''; 411 412 meta = { 413 homepage = "http://www.inf.puc-rio.br/~roberto/lpeg/"; 414 platforms = stdenv.lib.platforms.all; 415 license = stdenv.lib.licenses.mit; 416 }; 417 }; 418 419 cjson = buildLuaPackage rec { 420 name = "cjson-${version}"; 421 version = "2.1.0"; 422 src = fetchurl { 423 url = "http://www.kyne.com.au/~mark/software/download/lua-cjson-2.1.0.tar.gz"; 424 sha256 = "0y67yqlsivbhshg8ma535llz90r4zag9xqza5jx0q7lkap6nkg2i"; 425 }; 426 preBuild = '' 427 sed -i "s|/usr/local|$out|" Makefile 428 ''; 429 makeFlags = [ "LUA_VERSION=${lua.luaversion}" ]; 430 postInstall = '' 431 rm -rf $out/share/lua/${lua.luaversion}/cjson/tests 432 ''; 433 installTargets = "install install-extra"; 434 meta = { 435 description = "Lua C extension module for JSON support"; 436 license = stdenv.lib.licenses.mit; 437 }; 438 }; 439 440 lgi = stdenv.mkDerivation rec { 441 name = "lgi-${version}"; 442 version = "0.9.1"; 443 444 src = fetchFromGitHub { 445 owner = "pavouk"; 446 repo = "lgi"; 447 rev = version; 448 sha256 = "09pbapjhyc3sn0jgx747shqr9286wqfzw02h43p4pk8fv2b766b9"; 449 }; 450 451 meta = with stdenv.lib; { 452 description = "GObject-introspection based dynamic Lua binding to GObject based libraries"; 453 homepage = https://github.com/pavouk/lgi; 454 license = "custom"; 455 maintainers = with maintainers; [ lovek323 rasendubi ]; 456 platforms = platforms.unix; 457 }; 458 459 buildInputs = [ glib gobjectIntrospection lua pkgconfig ]; 460 461 makeFlags = [ "LUA_VERSION=${lua.luaversion}" ]; 462 463 preBuild = '' 464 sed -i "s|/usr/local|$out|" lgi/Makefile 465 ''; 466 }; 467 468 mpack = buildLuaPackage rec { 469 name = "lua-mpack-${libmpack.version}"; 470 src = libmpack.src; 471 sourceRoot = "libmpack-${libmpack.rev}-src/binding/lua"; 472 buildInputs = [ libmpack ]; #libtool lua pkgconfig ]; 473 dontBuild = true; 474 preInstall = '' 475 mkdir -p $out/lib/lua/${lua.luaversion} 476 ''; 477 NIX_CFLAGS_COMPILE = "-Wno-error -fpic"; 478 installFlags = [ 479 "USE_SYSTEM_LUA=yes" 480 "LUA_VERSION_MAJ_MIN=" 481 "LUA_CMOD_INSTALLDIR=$$out/lib/lua/${lua.luaversion}" 482 ]; 483 meta = { 484 description = "Simple implementation of msgpack in C Lua 5.1"; 485 homepage = "https://github.com/tarruda/libmpack"; 486 platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin; 487 license = stdenv.lib.licenses.mit; 488 # gcc -llua fails with luajit 489 broken = (builtins.parseDrvName lua.name).name != "lua"; 490 }; 491 }; 492 493 vicious = stdenv.mkDerivation rec { 494 name = "vicious-${version}"; 495 version = "2.2.0"; 496 497 src = fetchFromGitHub { 498 owner = "Mic92"; 499 repo = "vicious"; 500 rev = "v${version}"; 501 sha256 = "0dhy0vklrhqrnmxb9pyqbfvkwwy86lwysk93pzg1j1zwprx366fj"; 502 }; 503 504 meta = with stdenv.lib; { 505 description = "Vicious widgets for window managers"; 506 homepage = https://github.com/Mic92/vicious; 507 license = licenses.gpl2; 508 maintainers = with maintainers; [ makefu mic92 ]; 509 platforms = platforms.linux; 510 }; 511 512 buildInputs = [ lua ]; 513 installPhase = '' 514 mkdir -p $out/lib/lua/${lua.luaversion}/ 515 cp -r . $out/lib/lua/${lua.luaversion}/vicious/ 516 printf "package.path = '$out/lib/lua/${lua.luaversion}/?/init.lua;' .. package.path\nreturn require((...) .. '.init')\n" > $out/lib/lua/${lua.luaversion}/vicious.lua 517 ''; 518 }; 519 520}; in self