@@ -1,50 +1,54 @@
1−{ stdenv, fetchurl, fetchpatch, boehmgc, zlib, sqlite, pcre }:
1+{ stdenv, fetchurl, fetchpatch, boehmgc, zlib, sqlite, pcre, cmake, pkgconfig
2+, git, apacheHttpd, apr, aprutil, mariadb, mbedtls, openssl, pkgs, gtk2
3+}:
24
35stdenv.mkDerivation rec {
46 name = "neko-${version}";
5− version = "2.0.0";
7+ version = "2.1.0";
68
79 src = fetchurl {
8− url = "http://nekovm.org/_media/neko-${version}.tar.gz";
9− sha256 = "1lcm1ahbklfpd5lnqjwmvyj2vr85jbq57hszk5jgq0x6yx6p3927";
10+ url = "http://nekovm.org/media/neko-${version}-src.tar.gz";
11+ sha256 = "15ng9ad0jspnhj38csli1pvsv3nxm75f0nlps7i10194jvzdb4qc";
1012 };
1113
12− patches = stdenv.lib.singleton (fetchpatch {
13− url = "https://github.com/HaxeFoundation/neko/commit/"
14− + "ccc78c29deab7971e1369f4fe3dedd14cf9f3128.patch";
15− sha256 = "1nya50rzai15hmpq2azganjxzgrfydf30glfwirgw6q8z7z3wpkq";
16− });
17−
18− prePatch = with stdenv.lib; let
19− libs = concatStringsSep "," (map (lib: "\"${lib.dev}/include\"") buildInputs);
20− in ''
21− sed -i -e '/^search_includes/,/^}/c \
22− search_includes = function(_) { return $array(${libs}) }
23− ' src/tools/install.neko
24− sed -i -e '/allocated = strdup/s|"[^"]*"|"'"$out/lib/neko:$out/bin"'"|' \
25− vm/load.c
26− # temporarily, fixed in 1.8.3
27− sed -i -e 's/^#if defined(_64BITS)/& || defined(__x86_64__)/' vm/neko.h
28−
29− for disabled_mod in mod_neko{,2} mod_tora{,2} mysql ui; do
30− sed -i -e '/^libs/,/^}/{/^\s*'"$disabled_mod"'\s*=>/,/^\s*}/d}' \
31− src/tools/install.neko
32− done
14+ # Patches backported with reference to https://github.com/HaxeFoundation/neko/issues/131
15+ # They can probably be removed when bumping to next version
16+ patches = [
17+ (fetchpatch {
18+ url = "https://github.com/HaxeFoundation/neko/commit/"
19+ + "a8c71ad97faaccff6c6e9e09eba2d5efd022f8dc.patch";
20+ sha256 = "0mnx15cdjs8mnl01mhc9z2gpzh4d1q0ygqnjackrqxz6x235ydyp";
21+ })
22+ (fetchpatch {
23+ url = "https://github.com/HaxeFoundation/neko/commit/"
24+ + "fe87462d9c7a6ee27e28f5be5e4fc0ac87b34574.patch";
25+ sha256 = "1jbmq6j32vg3qv20dbh82cp54886lgrh7gkcqins8a2y4l4dl3sc";
26+ })
27+ ];
28+
29+ buildInputs =
30+ [ boehmgc zlib sqlite pcre cmake pkgconfig git apacheHttpd apr aprutil
31+ mariadb.client mbedtls openssl ]
32+ ++ stdenv.lib.optional stdenv.isLinux gtk2
33+ ++ stdenv.lib.optionals stdenv.isDarwin [ pkgs.darwin.apple_sdk.frameworks.Security
34+ pkgs.darwin.apple_sdk.frameworks.Carbon];
35+ cmakeFlags = [ "-DRUN_LDCONFIG=OFF" ];
36+ prePatch = ''
37+ sed -i -e '/allocated = strdup/s|"[^"]*"|"'"$out/lib/neko:$out/bin"'"|' vm/load.c
3338 '';
3439
35− makeFlags = "INSTALL_PREFIX=$(out)";
36− buildInputs = [ boehmgc zlib sqlite pcre ];
37− dontStrip = true;
38−
39− preInstall = ''
40− install -vd "$out/lib" "$out/bin"
40+ checkPhase = ''
41+ bin/neko bin/test.n
4142 '';
4243
43− meta = {
44+ dontStrip = true;
45+
46+ meta = with stdenv.lib; {
4447 description = "A high-level dynamically typed programming language";
4548 homepage = http://nekovm.org;
46− license = stdenv.lib.licenses.lgpl21;
47− maintainers = [ stdenv.lib.maintainers.marcweber ];
48− platforms = stdenv.lib.platforms.linux;
49+ license = licenses.lgpl21;
50+ maintainers = [ maintainers.marcweber ];
51+ platforms = platforms.linux ++ platforms.darwin;
4952 };
5053}
54+