diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:36 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:47 +0000 |
commit | 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch) | |
tree | b3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/interpreters | |
parent | 4e31070265257dc67d120c27e0f75c2344fdfa9a (diff) | |
parent | abf060725d7614bd3b9f96764262dfbc2f9c2199 (diff) | |
download | nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2 nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip |
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters')
215 files changed, 11744 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/acl2/default.nix b/nixpkgs/pkgs/development/interpreters/acl2/default.nix new file mode 100644 index 000000000000..cc88b32119e7 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/acl2/default.nix @@ -0,0 +1,77 @@ +{ stdenv, fetchFromGitHub, + # perl, which, nettools, + sbcl }: + +let hashes = { + "8.0" = "1x1giy2c1y6krg3kf8pf9wrmvk981shv0pxcwi483yjqm90xng4r"; + "8.1" = "0isi75j94q79x4341rhd94c60228iwvccy71ssnyvh1025m93xcd"; +}; +revs = { + "8.0" = "8.0"; + "8.1" = "8.1"; +}; +in stdenv.mkDerivation rec { + name = "acl2-${version}"; + version = "8.1"; + + src = fetchFromGitHub { + owner = "acl2-devel"; + repo = "acl2-devel"; + rev = revs."${version}"; + sha256 = hashes."${version}"; + }; + + buildInputs = [ sbcl + # which perl nettools + ]; + + enableParallelBuilding = true; + + phases = "unpackPhase installPhase"; + + installSuffix = "acl2"; + + installPhase = '' + mkdir -p $out/share/${installSuffix} + mkdir -p $out/bin + cp -R . $out/share/${installSuffix} + cd $out/share/${installSuffix} + + # make ACL2 image + make LISP=${sbcl}/bin/sbcl + + # The community books don't build properly under Nix yet. + rm -rf books + #make ACL2=$out/share/saved_acl2 USE_QUICKLISP=1 regression-everything + + cp saved_acl2 $out/bin/acl2 + ''; + + meta = { + description = "An interpreter and a prover for a Lisp dialect"; + longDescription = '' + ACL2 is a logic and programming language in which you can model + computer systems, together with a tool to help you prove + properties of those models. "ACL2" denotes "A Computational + Logic for Applicative Common Lisp". + + ACL2 is part of the Boyer-Moore family of provers, for which its + authors have received the 2005 ACM Software System Award. + + NOTE: In nixpkgs, the community books that usually ship with + ACL2 have been removed because it is not currently possible to + build them with Nix. + ''; + homepage = http://www.cs.utexas.edu/users/moore/acl2/; + downloadPage = https://github.com/acl2-devel/acl2-devel/releases; + # There are a bunch of licenses in the community books, but since + # they currently get deleted during the build, we don't mention + # their licenses here. ACL2 proper is released under a BSD + # 3-clause license. + #license = with stdenv.lib.licenses; + #[ free bsd3 mit gpl2 llgpl21 cc0 publicDomain ]; + license = stdenv.lib.licenses.bsd3; + maintainers = with stdenv.lib.maintainers; [ kini raskin ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/angelscript/2.22.nix b/nixpkgs/pkgs/development/interpreters/angelscript/2.22.nix new file mode 100644 index 000000000000..0449572da024 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/angelscript/2.22.nix @@ -0,0 +1,45 @@ +{stdenv, fetchurl, unzip}: +let + s = # Generated upstream information + rec { + baseName="angelscript"; + version = "2.22.2"; + name="${baseName}-${version}"; + url="http://www.angelcode.com/angelscript/sdk/files/angelscript_${version}.zip"; + sha256 = "1pp853lbnz383ilp9wbgc3wv1dn7lpx3idz8dmzda94rckl7sd43"; + }; + buildInputs = [ + unzip + ]; +in +stdenv.mkDerivation { + inherit (s) name version; + inherit buildInputs; + src = fetchurl { + inherit (s) url sha256; + }; + preConfigure = '' + cd angelscript/projects/gnuc + sed -i makefile -e "s@LOCAL = .*@LOCAL = $out@" + export SHARED=1 + export VERSION="${s.version}" + mkdir -p "$out/lib" "$out/bin" "$out/share" "$out/include" + ''; + postBuild = '' + rm ../../lib/* + ''; + postInstall = '' + mkdir -p "$out/share/docs/angelscript" + cp -r ../../../docs/* "$out/share/docs/angelscript" + ''; + meta = { + inherit (s) version; + description = "Light-weight scripting library"; + license = stdenv.lib.licenses.zlib ; + maintainers = [stdenv.lib.maintainers.raskin]; + platforms = stdenv.lib.platforms.linux; + badPlatforms = [ "aarch64-linux" ]; + downloadPage = "http://www.angelcode.com/angelscript/downloads.html"; + homepage="http://www.angelcode.com/angelscript/"; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/angelscript/default.nix b/nixpkgs/pkgs/development/interpreters/angelscript/default.nix new file mode 100644 index 000000000000..01348c753484 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/angelscript/default.nix @@ -0,0 +1,38 @@ +{stdenv, fetchurl, unzip}: +let + s = # Generated upstream information + rec { + baseName="angelscript"; + version = "2.32.0"; + name="${baseName}-${version}"; + url="http://www.angelcode.com/angelscript/sdk/files/angelscript_${version}.zip"; + sha256 = "0675hza06v3grxyqfy70gzm57idmbbm7qvi6bg5vf8m6mpw757dl"; + }; + buildInputs = [ + unzip + ]; +in +stdenv.mkDerivation { + inherit (s) name version; + inherit buildInputs; + src = fetchurl { + inherit (s) url sha256; + }; + preConfigure = '' + cd angelscript/projects/gnuc + export makeFlags="$makeFlags PREFIX=$out" + ''; + postInstall = '' + mkdir -p "$out/share/docs/angelscript" + cp -r ../../../docs/* "$out/share/docs/angelscript" + ''; + meta = { + inherit (s) version; + description = "Light-weight scripting library"; + license = stdenv.lib.licenses.zlib ; + maintainers = [stdenv.lib.maintainers.raskin]; + platforms = stdenv.lib.platforms.linux; + downloadPage = "http://www.angelcode.com/angelscript/downloads.html"; + homepage="http://www.angelcode.com/angelscript/"; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/angelscript/default.upstream b/nixpkgs/pkgs/development/interpreters/angelscript/default.upstream new file mode 100644 index 000000000000..7dbe527b276c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/angelscript/default.upstream @@ -0,0 +1,4 @@ +url http://www.angelcode.com/angelscript/downloads.html +version_link '[.]zip$' +version '.*_([0-9.]+)[.].*' '\1' +do_overwrite () { do_overwrite_just_version ; } diff --git a/nixpkgs/pkgs/development/interpreters/bats/default.nix b/nixpkgs/pkgs/development/interpreters/bats/default.nix new file mode 100644 index 000000000000..85794b09ae0b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/bats/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchzip, gnugrep }: + +stdenv.mkDerivation rec { + name = "bats-${version}"; + version = "1.1.0"; + + src = fetchzip { + url = "https://github.com/bats-core/bats-core/archive/v${version}.tar.gz"; + sha256 = "1kkh0j2alql3xiyhw9wsvcc3xclv52g0ivgyk8h85q9fn3qdqakz"; + }; + + patchPhase = '' + patchShebangs ./install.sh + substituteInPlace ./libexec/bats-core/bats-format-tap-stream --replace grep ${gnugrep}/bin/grep + ''; + + installPhase = "./install.sh $out"; + + meta = with stdenv.lib; { + homepage = https://github.com/bats-core/bats-core; + description = "Bash Automated Testing System"; + maintainers = [ maintainers.lnl7 ]; + license = licenses.mit; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/ceptre/default.nix b/nixpkgs/pkgs/development/interpreters/ceptre/default.nix new file mode 100644 index 000000000000..29d63f1d0048 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ceptre/default.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchgit, mlton }: + +stdenv.mkDerivation rec { + name = "ceptre-2016-11-27"; + + src = fetchgit { + url = https://github.com/chrisamaphone/interactive-lp; + rev = "e436fda2ccd44e9c9d226feced9d204311deacf5"; + sha256 = "174pxfnw3qyn2w8qxmx45fa68iddf106mkfi0kcmyqxzsc9jprh8"; + }; + + nativeBuildInputs = [ mlton ]; + + installPhase = '' + mkdir -p $out/bin + cp ceptre $out/bin + ''; + + meta = with stdenv.lib; { + description = "A linear logic programming language for modeling generative interactive systems"; + homepage = https://github.com/chrisamaphone/interactive-lp; + maintainers = with maintainers; [ pSub ]; + platforms = with platforms; linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/chibi/default.nix b/nixpkgs/pkgs/development/interpreters/chibi/default.nix new file mode 100644 index 000000000000..2ad0bc0285e5 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/chibi/default.nix @@ -0,0 +1,39 @@ +{ stdenv, fetchFromGitHub, makeWrapper }: +let + version = "0.8"; + name = "chibi-scheme-${version}"; +in +stdenv.mkDerivation { + inherit name; + + meta = { + homepage = https://github.com/ashinn/chibi-scheme; + description = "Small Footprint Scheme for use as a C Extension Language"; + platforms = stdenv.lib.platforms.all; + license = stdenv.lib.licenses.bsd3; + maintainers = [ stdenv.lib.maintainers.DerGuteMoritz ]; + }; + + src = fetchFromGitHub { + owner = "ashinn"; + repo = "chibi-scheme"; + rev = version; + sha256 = "0269d5fhaz7nqjb41vh7yz63mp5s4z08fn4sspwc06z32xksigw9"; + }; + + buildInputs = [ makeWrapper ]; + + installPhase = '' + make install PREFIX="$out" + ''; + + fixupPhase = '' + wrapProgram "$out/bin/chibi-scheme" \ + --prefix CHIBI_MODULE_PATH : "$out/share/chibi:$out/lib/chibi" + + for f in chibi-doc chibi-ffi snow-chibi; do + substituteInPlace "$out/bin/$f" \ + --replace "/usr/bin/env chibi-scheme" "$out/bin/chibi-scheme" + done + ''; +} diff --git a/nixpkgs/pkgs/development/interpreters/clips/default.nix b/nixpkgs/pkgs/development/interpreters/clips/default.nix new file mode 100644 index 000000000000..b597ba6fe789 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clips/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + version = "6.30"; + name = "clips-${version}"; + src = fetchurl { + url = "mirror://sourceforge/clipsrules/CLIPS/6.30/clips_core_source_630.tar.Z"; + sha256 = "1r0m59l3mk9cwzq3nmyr5qxrlkzp3njls4hfv8ml85dmqh7n3ysy"; + }; + buildPhase = '' + make -C core -f ../makefiles/makefile.gcc + ''; + installPhase = '' + install -D -t $out/bin core/clips + ''; + meta = with stdenv.lib; { + description = "A Tool for Building Expert Systems"; + homepage = http://www.clipsrules.net/; + longDescription = '' + Developed at NASA's Johnson Space Center from 1985 to 1996, + CLIPS is a rule-based programming language useful for creating + expert systems and other programs where a heuristic solution is + easier to implement and maintain than an algorithmic solution. + ''; + license = licenses.publicDomain; + maintainers = [maintainers.league]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/clisp/bits_ipctypes_to_sys_ipc.patch b/nixpkgs/pkgs/development/interpreters/clisp/bits_ipctypes_to_sys_ipc.patch new file mode 100644 index 000000000000..d6163022830d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clisp/bits_ipctypes_to_sys_ipc.patch @@ -0,0 +1,12 @@ +diff -ru a/modules/bindings/glibc/linux.lisp b/modules/bindings/glibc/linux.lisp +--- a/modules/bindings/glibc/linux.lisp 2008-10-10 16:15:49.000000000 +0300 ++++ b/modules/bindings/glibc/linux.lisp 2012-12-04 01:01:35.000000000 +0200 +@@ -86,7 +86,7 @@ + + (def-c-type __key_t) ; int + +-(c-lines "#include <bits/ipctypes.h>~%") ++(c-lines "#include <sys/ipc.h>~%") + (def-c-type __ipc_pid_t) ; ushort + + ; --------------------------- <sys/types.h> ----------------------------------- diff --git a/nixpkgs/pkgs/development/interpreters/clisp/default.nix b/nixpkgs/pkgs/development/interpreters/clisp/default.nix new file mode 100644 index 000000000000..e6112c5a3343 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clisp/default.nix @@ -0,0 +1,103 @@ +# there are the following linking sets: +# - boot (not installed): without modules, only used when building clisp +# - base (default): contains readline and i18n, regexp and syscalls modules +# by default +# - full: contains base plus modules in withModules +{ stdenv, fetchurl, libsigsegv, gettext, ncurses, readline, libX11 +, libXau, libXt, pcre, zlib, libXpm, xproto, libXext, xextproto +, libffi +, libffcall +, coreutils +# build options +, threadSupport ? (stdenv.isi686 || stdenv.isx86_64) +, x11Support ? (stdenv.isi686 || stdenv.isx86_64) +, dllSupport ? true +, withModules ? [ + "pcre" + "rawsock" + ] + ++ stdenv.lib.optionals stdenv.isLinux [ "bindings/glibc" "zlib" "wildcard" ] + ++ stdenv.lib.optional x11Support "clx/new-clx" +}: + +assert x11Support -> (libX11 != null && libXau != null && libXt != null + && libXpm != null && xproto != null && libXext != null && xextproto != null); + +stdenv.mkDerivation rec { + v = "2.49"; + name = "clisp-${v}"; + + src = fetchurl { + url = "mirror://gnu/clisp/release/${v}/${name}.tar.bz2"; + sha256 = "8132ff353afaa70e6b19367a25ae3d5a43627279c25647c220641fed00f8e890"; + }; + + inherit libsigsegv gettext coreutils; + + ffcallAvailable = stdenv.isLinux && (libffcall != null); + + buildInputs = [libsigsegv] + ++ stdenv.lib.optional (gettext != null) gettext + ++ stdenv.lib.optional (ncurses != null) ncurses + ++ stdenv.lib.optional (pcre != null) pcre + ++ stdenv.lib.optional (zlib != null) zlib + ++ stdenv.lib.optional (readline != null) readline + ++ stdenv.lib.optional (ffcallAvailable && (libffi != null)) libffi + ++ stdenv.lib.optional ffcallAvailable libffcall + ++ stdenv.lib.optionals x11Support [ + libX11 libXau libXt libXpm xproto libXext xextproto + ]; + + patches = [ + ./bits_ipctypes_to_sys_ipc.patch # from Gentoo + # The cfree alias no longer exists since glibc 2.26 + ./remove-cfree-binding.patch + ]; + + # First, replace port 9090 (rather low, can be used) + # with 64237 (much higher, IANA private area, not + # anything rememberable). + # Also remove reference to a type that disappeared from recent glibc + # (seems the correct thing to do, found no reference to any solution) + postPatch = '' + sed -e 's@9090@64237@g' -i tests/socket.tst + sed -i 's@/bin/pwd@${coreutils}&@' src/clisp-link.in + find . -type f | xargs sed -e 's/-lICE/-lXau &/' -i + + substituteInPlace modules/bindings/glibc/linux.lisp --replace "(def-c-type __swblk_t)" "" + ''; + + configureFlags = [ "builddir" ] + ++ stdenv.lib.optional (!dllSupport) "--without-dynamic-modules" + ++ stdenv.lib.optional (readline != null) "--with-readline" + # --with-dynamic-ffi can only exist with --with-ffcall - foreign.d does not compile otherwise + ++ stdenv.lib.optional (ffcallAvailable && (libffi != null)) "--with-dynamic-ffi" + ++ stdenv.lib.optional ffcallAvailable "--with-ffcall" + ++ stdenv.lib.optional (!ffcallAvailable) "--without-ffcall" + ++ builtins.map (x: "--with-module=" + x) withModules + ++ stdenv.lib.optional threadSupport "--with-threads=POSIX_THREADS"; + + preBuild = '' + sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d + cd builddir + ''; + + postInstall = + stdenv.lib.optionalString (withModules != []) + (''./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full'' + + stdenv.lib.concatMapStrings (x: " " + x) withModules); + + NIX_CFLAGS_COMPILE = "-O0 ${stdenv.lib.optionalString (!stdenv.is64bit) "-falign-functions=4"}"; + + # TODO : make mod-check fails + doCheck = false; + + meta = { + description = "ANSI Common Lisp Implementation"; + homepage = http://clisp.cons.org; + maintainers = with stdenv.lib.maintainers; [raskin tohl]; + platforms = stdenv.lib.platforms.unix; + # problems on Darwin: https://github.com/NixOS/nixpkgs/issues/20062 + broken = stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isAarch64; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/clisp/hg.nix b/nixpkgs/pkgs/development/interpreters/clisp/hg.nix new file mode 100644 index 000000000000..47dbf8a225cf --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clisp/hg.nix @@ -0,0 +1,98 @@ +# there are the following linking sets: +# - boot (not installed): without modules, only used when building clisp +# - base (default): contains readline and i18n, regexp and syscalls modules +# by default +# - full: contains base plus modules in withModules +{ stdenv, fetchhg, libsigsegv, gettext, ncurses, readline, libX11 +, libXau, libXt, pcre, zlib, libXpm, xproto, libXext, xextproto +, libffi, libffcall, automake +, coreutils +# build options +, threadSupport ? (stdenv.isi686 || stdenv.isx86_64) +, x11Support ? (stdenv.isi686 || stdenv.isx86_64) +, dllSupport ? true +, withModules ? [ + "pcre" + "rawsock" + ] + ++ stdenv.lib.optionals stdenv.isLinux [ "bindings/glibc" "zlib" ] + ++ stdenv.lib.optional x11Support "clx/new-clx" +}: + +assert x11Support -> (libX11 != null && libXau != null && libXt != null + && libXpm != null && xproto != null && libXext != null && xextproto != null); + +stdenv.mkDerivation rec { + v = "2.50pre20171114"; + name = "clisp-${v}"; + + src = fetchhg { + url = "http://hg.code.sf.net/p/clisp/clisp"; + rev = "36df6dc59b8f"; + sha256 = "1pidiv1m55lvc4ln8vx0ylnnhlj95y6hrfdq96nrj14f4v8fkvmr"; + }; + + inherit libsigsegv gettext coreutils; + + ffcallAvailable = stdenv.isLinux && (libffcall != null); + + nativeBuildInputs = [ automake ]; # sometimes fails otherwise + buildInputs = [libsigsegv] + ++ stdenv.lib.optional (gettext != null) gettext + ++ stdenv.lib.optional (ncurses != null) ncurses + ++ stdenv.lib.optional (pcre != null) pcre + ++ stdenv.lib.optional (zlib != null) zlib + ++ stdenv.lib.optional (readline != null) readline + ++ stdenv.lib.optional (ffcallAvailable && (libffi != null)) libffi + ++ stdenv.lib.optional ffcallAvailable libffcall + ++ stdenv.lib.optionals x11Support [ + libX11 libXau libXt libXpm xproto libXext xextproto + ]; + + # First, replace port 9090 (rather low, can be used) + # with 64237 (much higher, IANA private area, not + # anything rememberable). + # Also remove reference to a type that disappeared from recent glibc + # (seems the correct thing to do, found no reference to any solution) + postPatch = '' + sed -e 's@9090@64237@g' -i tests/socket.tst + sed -i 's@/bin/pwd@${coreutils}&@' src/clisp-link.in + find . -type f | xargs sed -e 's/-lICE/-lXau &/' -i + + substituteInPlace modules/bindings/glibc/linux.lisp --replace "(def-c-type __swblk_t)" "" + ''; + + configureFlags = [ "builddir" ] + ++ stdenv.lib.optional (!dllSupport) "--without-dynamic-modules" + ++ stdenv.lib.optional (readline != null) "--with-readline" + # --with-dynamic-ffi can only exist with --with-ffcall - foreign.d does not compile otherwise + ++ stdenv.lib.optional (ffcallAvailable && (libffi != null)) "--with-dynamic-ffi" + ++ stdenv.lib.optional ffcallAvailable "--with-ffcall" + ++ stdenv.lib.optional (!ffcallAvailable) "--without-ffcall" + ++ builtins.map (x: " --with-module=" + x) withModules + ++ stdenv.lib.optional threadSupport "--with-threads=POSIX_THREADS"; + + preBuild = '' + sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d + sed -i -re '/ cfree /d' -i modules/bindings/glibc/linux.lisp + cd builddir + ''; + + postInstall = + stdenv.lib.optionalString (withModules != []) + (''./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full'' + + stdenv.lib.concatMapStrings (x: " " + x) withModules); + + NIX_CFLAGS_COMPILE = "-O0 ${stdenv.lib.optionalString (!stdenv.is64bit) "-falign-functions=4"}"; + + # TODO : make mod-check fails + doCheck = false; + + meta = { + description = "ANSI Common Lisp Implementation"; + homepage = http://clisp.cons.org; + maintainers = with stdenv.lib.maintainers; [raskin tohl]; + # problems on Darwin: https://github.com/NixOS/nixpkgs/issues/20062 + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/clisp/remove-cfree-binding.patch b/nixpkgs/pkgs/development/interpreters/clisp/remove-cfree-binding.patch new file mode 100644 index 000000000000..4b570c3a4672 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clisp/remove-cfree-binding.patch @@ -0,0 +1,12 @@ +diff --git a/modules/bindings/glibc/linux.lisp b/modules/bindings/glibc/linux.lisp +index c40b4f8..1c8edca 100644 +--- a/modules/bindings/glibc/linux.lisp ++++ b/modules/bindings/glibc/linux.lisp +@@ -648,7 +648,6 @@ + (def-call-out calloc (:arguments (nmemb size_t) (size size_t)) + (:return-type c-pointer)) + (def-call-out free (:arguments (ptr c-pointer)) (:return-type nil)) +-(def-call-out cfree (:arguments (ptr c-pointer)) (:return-type nil)) + (def-call-out valloc (:arguments (size size_t)) (:return-type c-pointer)) + + (def-call-out abort (:arguments) (:return-type nil)) diff --git a/nixpkgs/pkgs/development/interpreters/clojure/clooj.nix b/nixpkgs/pkgs/development/interpreters/clojure/clooj.nix new file mode 100644 index 000000000000..57ced325aad0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojure/clooj.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, jre, makeWrapper }: + +let version = "0.4.4"; in + +stdenv.mkDerivation { + name = "clooj-${version}"; + + jar = fetchurl { + # mirrored as original mediafire.com source does not work without user interaction + url = "https://archive.org/download/clooj-0.4.4-standalone/clooj-0.4.4-standalone.jar"; + sha256 = "0hbc29bg2a86rm3sx9kvj7h7db9j0kbnrb706wsfiyk3zi3bavnd"; + }; + + buildInputs = [ makeWrapper ]; + + phases = "installPhase"; + + installPhase = '' + mkdir -p $out/share/java + ln -s $jar $out/share/java/clooj.jar + makeWrapper ${jre}/bin/java $out/bin/clooj --add-flags "-jar $out/share/java/clooj.jar" + ''; + + meta = { + description = "A lightweight IDE for Clojure"; + homepage = https://github.com/arthuredelstein/clooj; + license = stdenv.lib.licenses.bsd3; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/clojure/default.nix b/nixpkgs/pkgs/development/interpreters/clojure/default.nix new file mode 100644 index 000000000000..001f7c9abee0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojure/default.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchurl, jdk, rlwrap, makeWrapper }: + +stdenv.mkDerivation rec { + name = "clojure-${version}"; + version = "1.10.0.403"; + + src = fetchurl { + url = "https://download.clojure.org/install/clojure-tools-${version}.tar.gz"; + sha256 = "0jsyd0vr1qfqs0dz560hyfya553jhr4m4msf5x0n610yzvbqym4c"; + }; + + buildInputs = [ makeWrapper ]; + + outputs = [ "out" "prefix" ]; + + installPhase = let + binPath = stdenv.lib.makeBinPath [ rlwrap jdk ]; + in '' + mkdir -p $prefix/libexec + cp clojure-tools-${version}.jar $prefix/libexec + cp {,example-}deps.edn $prefix + + substituteInPlace clojure --replace PREFIX $prefix + + install -Dt $out/bin clj clojure + wrapProgram $out/bin/clj --prefix PATH : $out/bin:${binPath} + wrapProgram $out/bin/clojure --prefix PATH : $out/bin:${binPath} + ''; + + meta = with stdenv.lib; { + description = "A Lisp dialect for the JVM"; + homepage = https://clojure.org/; + license = licenses.epl10; + longDescription = '' + Clojure is a dynamic programming language that targets the Java + Virtual Machine. It is designed to be a general-purpose language, + combining the approachability and interactive development of a + scripting language with an efficient and robust infrastructure for + multithreaded programming. Clojure is a compiled language - it + compiles directly to JVM bytecode, yet remains completely + dynamic. Every feature supported by Clojure is supported at + runtime. Clojure provides easy access to the Java frameworks, with + optional type hints and type inference, to ensure that calls to Java + can avoid reflection. + + Clojure is a dialect of Lisp, and shares with Lisp the code-as-data + philosophy and a powerful macro system. Clojure is predominantly a + functional programming language, and features a rich set of immutable, + persistent data structures. When mutable state is needed, Clojure + offers a software transactional memory system and reactive Agent + system that ensure clean, correct, multithreaded designs. + ''; + maintainers = with maintainers; [ the-kenny ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/default.nix b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/default.nix new file mode 100644 index 000000000000..bc2d0e5be5a8 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/default.nix @@ -0,0 +1,257 @@ +{ stdenv, lib, fetchurl, clojure, + nodejs, jre, unzip, nodePackages, + python, openssl, pkgs }: + +let # packageJSON=./package.json; + version = "1.9.0"; + nodeVersion = "10.9.0"; + nodeSources = fetchurl { + url="https://nodejs.org/dist/v${nodeVersion}/node-v${nodeVersion}.tar.gz"; + sha256="0wgawq3wzw07pir73bxz13dggcc1fj0538y7y69n3cc0a2kiplqy"; + }; + lumo-internal-classpath = "LUMO__INTERNAL__CLASSPATH"; + + # as found in cljs/snapshot/lumo/repl.cljs + requireDeps = '' \ + cljs.analyzer \ + cljs.compiler \ + cljs.env \ + cljs.js \ + cljs.reader \ + cljs.repl \ + cljs.source-map \ + cljs.source-map.base64 \ + cljs.source-map.base64-vlq \ + cljs.spec.alpha \ + cljs.spec.gen.alpha \ + cljs.tagged-literals \ + cljs.tools.reader \ + cljs.tools.reader.reader-types \ + cljs.tools.reader.impl.commons \ + cljs.tools.reader.impl.utils \ + clojure.core.rrb-vector \ + clojure.core.rrb-vector.interop \ + clojure.core.rrb-vector.nodes \ + clojure.core.rrb-vector.protocols \ + clojure.core.rrb-vector.rrbt \ + clojure.core.rrb-vector.transients \ + clojure.core.rrb-vector.trees \ + clojure.string \ + clojure.set \ + clojure.walk \ + cognitect.transit \ + fipp.visit \ + fipp.engine \ + fipp.deque \ + lazy-map.core \ + lumo.pprint.data \ + lumo.repl \ + lumo.repl-resources \ + lumo.js-deps \ + lumo.common ''; + + compileClojurescript = (simple: '' + (require '[cljs.build.api :as cljs]) + (cljs/build \"src/cljs/snapshot\" + {:optimizations ${if simple then ":simple" else ":none"} + :main 'lumo.core + :cache-analysis true + :source-map false + :dump-core false + :static-fns true + :optimize-constants false + :npm-deps false + :verbose true + :closure-defines {'cljs.core/*target* \"nodejs\" + 'lumo.core/*lumo-version* \"${version}\"} + :compiler-stats true + :process-shim false + :fn-invoke-direct true + :parallel-build false + :browser-repl false + :target :nodejs + :hashbang false + ;; :libs [ \"src/cljs/bundled\" \"src/js\" ] + :output-dir ${if simple + then ''\"cljstmp\"'' + else ''\"target\"''} + :output-to ${if simple + then ''\"cljstmp/main.js\"'' + else ''\"target/deleteme.js\"'' }}) + ''); + + + cacheToJsons = '' + (import [java.io ByteArrayOutputStream FileInputStream]) + (require '[cognitect.transit :as transit] + '[clojure.edn :as edn] + '[clojure.string :as str]) + + (defn write-transit-json [cache] + (let [out (ByteArrayOutputStream. 1000000) + writer (transit/writer out :json)] + (transit/write writer cache) + (.toString out))) + + (defn process-caches [] + (let [cache-aot-path \"target/cljs/core.cljs.cache.aot.edn\" + cache-aot-edn (edn/read-string (slurp cache-aot-path)) + cache-macros-path \"target/cljs/core\$macros.cljc.cache.json\" + cache-macros-stream (FileInputStream. cache-macros-path) + cache-macros-edn (transit/read (transit/reader cache-macros-stream :json)) + caches [[cache-aot-path cache-aot-edn] + [cache-macros-path cache-macros-edn]]] + (doseq [[path cache-edn] caches] + (doseq [key (keys cache-edn)] + (let [out-path (str/replace path #\"(\.json|\.edn)\$\" + (str \".\" (munge key) \".json\")) + tr-json (write-transit-json (key cache-edn))] + (spit out-path tr-json)))))) + + (process-caches) + ''; + + trimMainJsEnd = '' + (let [string (slurp \"target/main.js\")] + (spit \"target/main.js\" + (subs string 0 (.indexOf string \"cljs.nodejs={};\")))) + ''; + + + cljdeps = import ./deps.nix { inherit pkgs; }; + cljpaths = cljdeps.makePaths {}; + classp = cljdeps.makeClasspaths { + extraClasspaths=["src/js" "src/cljs/bundled" "src/cljs/snapshot"]; + }; + + + getJarPath = jarName: (lib.findFirst (p: p.name == jarName) null cljdeps.packages).path.jar; + +in stdenv.mkDerivation rec { + inherit version; + name = "lumo-${version}"; + + src = fetchurl { + url = "https://github.com/anmonteiro/lumo/archive/${version}.tar.gz"; + sha256 = "1mr3zjslznhv7y3mzvg1pmmvzn10d6di26izz4x8p4nfnshacwgw"; + }; + + + buildInputs = [ nodejs clojure jre unzip python openssl + nodePackages."lumo-build-deps-../interpreters/clojurescript/lumo" ]; + + buildPhase = '' + # Copy over lumo-build-deps environment + rm yarn.lock + cp -rf ${nodePackages."lumo-build-deps-../interpreters/clojurescript/lumo"}/lib/node_modules/lumo-build-deps/* ./ + + # configure clojure-cli + mkdir ./.cpcache + export CLJ_CONFIG=`pwd` + export CLJ_CACHE=`pwd`/.cpcache + + # require more namespaces for cljs-bundle + sed -i "s!ns lumo.core! \ + ns lumo.core \ + (:require ${requireDeps}) \ + (:require-macros [clojure.template :as temp] \ + [cljs.test :as test])!g" \ + ./src/cljs/snapshot/lumo/core.cljs + + # Step 1: compile clojurescript with :none and :simple + ${clojure}/bin/clojure -Scp ${classp} -e "${compileClojurescript true}" + ${clojure}/bin/clojure -Scp ${classp} -e "${compileClojurescript false}" + cp -f cljstmp/main.js target/main.js + ${clojure}/bin/clojure -Scp ${classp} -e "${trimMainJsEnd}" + + # Step 2: sift files + unzip -o ${getJarPath "org.clojure/clojurescript"} -d ./target + unzip -j ${getJarPath "org.clojure/clojure"} "clojure/template.clj" -d ./target/clojure + unzip -o ${getJarPath "org.clojure/google-closure-library"} -d ./target + unzip -o ${getJarPath "org.clojure/google-closure-library-third-party"} -d ./target + unzip -o ${getJarPath "org.clojure/tools.reader"} -d ./target + unzip -o ${getJarPath "org.clojure/test.check"} -d ./target + cp -rf ./src/cljs/bundled/lumo/* ./target/lumo/ + cp -rf ./src/cljs/snapshot/lumo/repl.clj ./target/lumo/ + # cleanup + mv ./target/main.js ./target/main + rm ./target/*\.js + mv ./target/main ./target/main.js + rm ./target/AUTHORS + rm ./target/LICENSE + rm ./target/*.edn + rm ./target/*.md + rm -rf ./target/css + rm -rf ./target/META-INF + rm -rf ./target/com + rm -rf ./target/cljs/build + rm -rf ./target/cljs/repl + rm ./target/cljs/core\.cljs\.cache.aot\.json + rm ./target/cljs/source_map\.clj + rm ./target/cljs/repl\.cljc + rm ./target/cljs/externs\.clj + rm ./target/cljs/closure\.clj + rm ./target/cljs/util\.cljc + rm ./target/cljs/js_deps\.cljc + rm ./target/cljs/analyzer/utils\.clj + rm ./target/cljs/core/macros\.clj + rm ./target/cljs/compiler/api.clj + rm ./target/goog/test_module* + rm ./target/goog/transpile\.js + rm ./target/goog/base_* + find ./target -type f -name '*.class' -delete + find ./target -type d -empty -delete + + # Step 3: generate munged cache jsons + ${clojure}/bin/clojure -Scp ${classp} -e "${cacheToJsons}" + rm ./target/cljs/core\$macros\.cljc\.cache\.json + + + # Step 4: Bunde javascript + NODE_ENV=production node scripts/bundle.js + node scripts/bundleForeign.js + + # Step 5: Backup resources + cp -R target resources_bak + + # Step 6: Package executeable 1st time + # fetch node sources and copy to palce that nexe will find + mkdir -p tmp/${nodeVersion} + cp ${nodeSources} tmp/${nodeVersion}/node-${nodeVersion}.tar.gz + tar -C ./tmp/${nodeVersion} -xf ${nodeSources} + mv ./tmp/${nodeVersion}/node-v${nodeVersion}/* ./tmp/${nodeVersion}/ + rm -rf ${lumo-internal-classpath} + mv target ${lumo-internal-classpath} + node scripts/package.js ${nodeVersion} + rm -rf ${lumo-internal-classpath} + + # Step 7: AOT Macros + sh scripts/aot-bundle-macros.sh + + # Step 8: Package executeable 2nd time + rm -rf ${lumo-internal-classpath} + mv target ${lumo-internal-classpath} + node scripts/package.js ${nodeVersion} + ''; + + dontStrip = true; + + installPhase = '' + mkdir -p $out/bin + cp build/lumo $out/bin + ''; + + meta = { + description = "Fast, cross-platform, standalone ClojureScript environment"; + longDescription = '' + Lumo is a fast, standalone ClojureScript REPL that runs on Node.js and V8. + Thanks to V8's custom startup snapshots, Lumo starts up instantaneously, + making it the fastest Clojure REPL in existence. + ''; + homepage = https://github.com/anmonteiro/lumo; + license = stdenv.lib.licenses.epl10; + maintainers = [ stdenv.lib.maintainers.hlolli ]; + platforms = stdenv.lib.platforms.linux; + }; +} + diff --git a/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/deps.edn b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/deps.edn new file mode 100644 index 000000000000..e1563599a8cc --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/deps.edn @@ -0,0 +1,12 @@ +{:deps + {org.clojure/clojure {:mvn/version "1.10.0-beta5"} + org.clojure/clojurescript {:mvn/version "1.10.439"} + org.clojure/test.check {:mvn/version "0.10.0-alpha3"} + org.clojure/tools.reader {:mvn/version "1.3.2" + :exclusions [org.clojure/clojure org.clojure/clojurescript]} + com.cognitect/transit-cljs {:mvn/version "0.8.256" + :exclusions [org.clojure/clojure org.clojure/clojurescript]} + malabarba/lazy-map {:mvn/version "1.3" + :exclusions [org.clojure/clojure org.clojure/clojurescript]} + fipp {:mvn/version "0.6.14" + :exclusions [org.clojure/clojure org.clojure/clojurescript]}}} diff --git a/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/deps.nix b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/deps.nix new file mode 100644 index 000000000000..3e53c7f98dd7 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/deps.nix @@ -0,0 +1,393 @@ +# generated by clj2nix-1.0.3 +{ pkgs }: + + let repos = [ + "https://repo.clojars.org/" + "https://repo1.maven.org/" + "http://central.maven.org/maven2/" + "http://oss.sonatype.org/content/repositories/releases/" + "http://oss.sonatype.org/content/repositories/public/" + "http://repo.typesafe.com/typesafe/releases/" + ]; + + in rec { + makePaths = {extraClasspaths ? []}: (builtins.map (dep: if builtins.hasAttr "jar" dep.path then dep.path.jar else dep.path) packages) ++ extraClasspaths; + makeClasspaths = {extraClasspaths ? []}: builtins.concatStringsSep ":" (makePaths {inherit extraClasspaths;}); + + packages = [ + { + name = "com.cognitect/transit-java"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "transit-java"; + groupId = "com.cognitect"; + sha512 = "80365a4f244e052b6c4fdfd2fd3b91288835599cb4dd88e0e0dae19883dcda39afee83966810ed81beff342111c3a45a66f5601c443f3ad49904908c43631708"; + version = "0.8.332"; + }; + } + + { + name = "org.clojure/data.json"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "data.json"; + groupId = "org.clojure"; + sha512 = "ce526bef01bedd31b772954d921a61832ae60af06121f29080853f7932326438b33d183240a9cffbe57e00dc3744700220753948da26b8973ee21c30e84227a6"; + version = "0.2.6"; + }; + } + + { + name = "org.clojure/clojure"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "clojure"; + groupId = "org.clojure"; + sha512 = "f7a6b207b1bcbb6523d32ecfdd3c8c25d4d0b0a59c78baf06cdc69ba3c21c5e96b5dac8e9efcb331efd94e10bccbb9b54fca62a4312309db65a1f9d89d9da3f4"; + version = "1.10.0-beta5"; + }; + } + + { + name = "commons-codec/commons-codec"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "commons-codec"; + groupId = "commons-codec"; + sha512 = "8edecc0faf38e8620460909d8191837f34e2bb2ce853677c486c5e79bb79e88d043c3aed69c11f1365c4884827052ee4e1c18ca56e38d1a5bc0ce15c57daeee3"; + version = "1.10"; + }; + } + + { + name = "com.google.errorprone/error_prone_annotations"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "error_prone_annotations"; + groupId = "com.google.errorprone"; + sha512 = "bd2135cc9eb2c652658a2814ec9c565fa3e071d4cff590cbe17b853885c78c9f84c1b7b24ba736f4f30ed8cec60a6af983827fcbed61ff142f27ac808e97fc6b"; + version = "2.1.3"; + }; + } + + { + name = "org.clojure/core.specs.alpha"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "core.specs.alpha"; + groupId = "org.clojure"; + sha512 = "348c0ea0911bc0dcb08655e61b97ba040649b4b46c32a62aa84d0c29c245a8af5c16d44a4fa5455d6ab076f4bb5bbbe1ad3064a7befe583f13aeb9e32a169bf4"; + version = "0.2.44"; + }; + } + + { + name = "org.clojure/spec.alpha"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "spec.alpha"; + groupId = "org.clojure"; + sha512 = "18c97fb2b74c0bc2ff4f6dc722a3edec539f882ee85d0addf22bbf7e6fe02605d63f40c2b8a2905868ccd6f96cfc36a65f5fb70ddac31c6ec93da228a456edbd"; + version = "0.2.176"; + }; + } + + { + name = "org.codehaus.mojo/animal-sniffer-annotations"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "animal-sniffer-annotations"; + groupId = "org.codehaus.mojo"; + sha512 = "9e5e3ea9e06e0ac9463869fd0e08ed38f7042784995a7b50c9bfd7f692a53f0e1430b9e1367dc772d0d4eafe5fd2beabbcc60da5008bd792f9e7ec8436c0f136"; + version = "1.14"; + }; + } + + { + name = "com.googlecode.json-simple/json-simple"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "json-simple"; + groupId = "com.googlecode.json-simple"; + sha512 = "f8798bfbcc8ab8001baf90ce47ec2264234dc1da2d4aa97fdcdc0990472a6b5a5a32f828e776140777d598a99d8a0c0f51c6d0767ae1a829690ab9200ae35742"; + version = "1.1.1"; + }; + } + + { + name = "com.cognitect/transit-cljs"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "transit-cljs"; + groupId = "com.cognitect"; + sha512 = "318b98ddd63629f37b334bb90e625bc31ab6abcf0b1fa80d8e097551658f2d9219b5ee35869a31f2976d7d385da83bea0c07b0d097babcae241ecbd0fe8a7ecd"; + version = "0.8.256"; + }; + } + + { + name = "org.clojure/google-closure-library"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "google-closure-library"; + groupId = "org.clojure"; + sha512 = "75631182ef12f21723fe3eba1003d8cf9b8348a51512961e4e1b87bc24d8f3abb14a70c856f08cdaa5588a2d7c2b1b0c03aeaa3c4c5f2ed745a85f59ceeab83a"; + version = "0.0-20170809-b9c14c6b"; + }; + } + + { + name = "fipp"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "fipp"; + groupId = "fipp"; + sha512 = "155b5bb7045ac7c3a75c638e65464ca1fc90e5b4692328fc2da73b26792178fdbce5ab01ba0397e1986b6162b06b8904712d2c366f32ea43ea5fa2b454a526a5"; + version = "0.6.14"; + }; + } + + { + name = "org.clojure/clojurescript"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "clojurescript"; + groupId = "org.clojure"; + sha512 = "4aec5abdd48aaf95f7a729e11d225a99d02caa3a4ddff3e9e4f8db80dea83ab70a4440691cb372562c8c16e73c2850b22806a2851df3849c852fddd49b57fc58"; + version = "1.10.439"; + }; + } + + { + name = "com.google.jsinterop/jsinterop-annotations"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "jsinterop-annotations"; + groupId = "com.google.jsinterop"; + sha512 = "b6fd98a9167d031f6bff571567d4658fda62c132dc74d47ca85e02c9bb3ce8812b1012c67f4c81501ab0cbd9ccd9cda5dcf32d306e04368ace7a173cecae975d"; + version = "1.0.0"; + }; + } + + { + name = "com.fasterxml.jackson.core/jackson-core"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "jackson-core"; + groupId = "com.fasterxml.jackson.core"; + sha512 = "a1bd6c264b9ab07aad3d0f26b65757e35ff47904ab895bb7f997e3e1fd063129c177ad6f69876907b04ff8a43c6b1770a26f53a811633a29e66a5dce57194f64"; + version = "2.8.7"; + }; + } + + { + name = "malabarba/lazy-map"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "lazy-map"; + groupId = "malabarba"; + sha512 = "ce56d6f03ac344579e15f062cdd4c477c0323da716d4d4106c4edb746959699e0b294b25aacf8ecf1579a6bdd5556a60f4bcb1648d22832984c069a0431c840f"; + version = "1.3"; + }; + } + + { + name = "com.cognitect/transit-js"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "transit-js"; + groupId = "com.cognitect"; + sha512 = "6ca0978e633e41b45ff5a76df79099ba7c4900a8ca9f6acd2a903e4ab10a1ec0c83d4127009df9dac1337debaba01f7ff1d5cced1c2159c05ef94845f73f0623"; + version = "0.8.846"; + }; + } + + { + name = "org.mozilla/rhino"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "rhino"; + groupId = "org.mozilla"; + sha512 = "466e7a76303ea191802b5e7adb3dff64c1d6283a25ce87447296b693b87b166f4cdd191ef7dc130a5739bfa0e4a81b08550f607c84eec167406d9be2225562dc"; + version = "1.7R5"; + }; + } + + { + name = "org.clojure/google-closure-library-third-party"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "google-closure-library-third-party"; + groupId = "org.clojure"; + sha512 = "57fa84fbbca3eb9e612d2842e4476b74f64d13dd076ffca6c9d9e15c4ca8a2f2c56cc19307bcad0ab5b4f9cb0c3e7900ccc845bd570ebc92e2633885ab621f35"; + version = "0.0-20170809-b9c14c6b"; + }; + } + + { + name = "com.google.javascript/closure-compiler-externs"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "closure-compiler-externs"; + groupId = "com.google.javascript"; + sha512 = "1a47c8559144095c0b23a8e40acd7185625cea5a4c103eb75fbacd32d5809d087bfb60aaf57066329649c6017ec5f993756024e767a5b8f84926371ba6183a82"; + version = "v20180805"; + }; + } + + { + name = "org.javassist/javassist"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "javassist"; + groupId = "org.javassist"; + sha512 = "ad65ee383ed83bedecc2073118cb3780b68b18d5fb79a1b2b665ff8529df02446ad11e68f9faaf4f2e980065f5946761a59ada379312cbb22d002625abed6a4f"; + version = "3.18.1-GA"; + }; + } + + { + name = "com.google.guava/guava"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "guava"; + groupId = "com.google.guava"; + sha512 = "429ceeec0350ba98e2b089b8b70ded2ec570c3a684894a7545d10592c1c7be42dacd1fad8b2cb9123aa3612575ce1b56e1bb54923443fc293f8e9adeac2762ee"; + version = "25.1-jre"; + }; + } + + { + name = "org.msgpack/msgpack"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "msgpack"; + groupId = "org.msgpack"; + sha512 = "a2741bed01f9c37ba3dbe6a7ab9ce936d36d4da97c35e215250ac89ac0851fc5948d83975ea6257d5dce1d43b6b5147254ecfb4b33f9bbdc489500b3ff060449"; + version = "0.6.12"; + }; + } + + { + name = "com.google.j2objc/j2objc-annotations"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "j2objc-annotations"; + groupId = "com.google.j2objc"; + sha512 = "a4a0b58ffc2d9f9b516f571bcd0ac14e4d3eec15aacd6320a4a1a12045acce8c6081e8ce922c4e882221cedb2cc266399ab468487ae9a08124d65edc07ae30f0"; + version = "1.1"; + }; + } + + { + name = "com.cognitect/transit-clj"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "transit-clj"; + groupId = "com.cognitect"; + sha512 = "ad838d9e5688c8cebe54972ad0c9a6db428ec1cece8c8b078e8e8d4b0c7870b328239d2bc9dd8fcbedcba56ca0de9afb5a0a843ff5f630dc039118de7eb45eba"; + version = "0.8.309"; + }; + } + + { + name = "args4j/args4j"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "args4j"; + groupId = "args4j"; + sha512 = "5f0651234c8f8b130fddb39fa832c6da47d3e21bc3434307554314c47e672c28d005c64e9effe85d552190cfc27966b1f005740ffd40b4e1bec2cb257d7feedb"; + version = "2.0.26"; + }; + } + + { + name = "org.clojure/core.rrb-vector"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "core.rrb-vector"; + groupId = "org.clojure"; + sha512 = "5f737bf3ca3acf567b2b5c14b5761c8c38e94e1f6168f8cba9f46d2ae41334ae3d68d2c00663827a6214094d96b9767f6803f66ab44b0012c6f2e3c2997b1796"; + version = "0.0.13"; + }; + } + + { + name = "org.checkerframework/checker-qual"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "checker-qual"; + groupId = "org.checkerframework"; + sha512 = "3c38b0b9e0bde464268cff5fdb1894a048240b039093ee3abe5b32976a22737d26b355f8793f630a7f0b319fdb019a6fcd9ee1d5219676f0f10c0b0f496b61b7"; + version = "2.0.0"; + }; + } + + { + name = "org.clojure/tools.reader"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "tools.reader"; + groupId = "org.clojure"; + sha512 = "290a2d98b2eec08a8affc2952006f43c0459c7e5467dc454f5fb5670ea7934fa974e6be19f7e7c91dadcfed62082d0fbcc7788455b7446a2c9c5af02f7fc52b6"; + version = "1.3.2"; + }; + } + + { + name = "com.google.javascript/closure-compiler-unshaded"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "closure-compiler-unshaded"; + groupId = "com.google.javascript"; + sha512 = "4fa7029aabd9ff84255d56004707486726db9c770f43cb10dc44fb53a3254d588a0f47f937f55401d7f319267ec2362c87f5ea709bcfa06f12a66fe22cb8c53d"; + version = "v20180805"; + }; + } + + { + name = "org.clojure/test.check"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "test.check"; + groupId = "org.clojure"; + sha512 = "bf57571a9d31d50cf15b38134f4d7c34d03eb458bc62b30c7a1dbf233e300c67f1fda6673dbd1584a0497cf8875f972e6697e7f13d0c3e70e4254697b1b75cc6"; + version = "0.10.0-alpha3"; + }; + } + + { + name = "com.google.protobuf/protobuf-java"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "protobuf-java"; + groupId = "com.google.protobuf"; + sha512 = "230fc4360b8b2ee10eb73d756c58478b6c779433aa4ca91938404bbfd0ada516d3215664dbe953c96649e33bbef293958e4ad4616671f0c246883196ece92998"; + version = "3.0.2"; + }; + } + + { + name = "com.google.code.findbugs/jsr305"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "jsr305"; + groupId = "com.google.code.findbugs"; + sha512 = "bb09db62919a50fa5b55906013be6ca4fc7acb2e87455fac5eaf9ede2e41ce8bbafc0e5a385a561264ea4cd71bbbd3ef5a45e02d63277a201d06a0ae1636f804"; + version = "3.0.2"; + }; + } + + { + name = "com.google.code.gson/gson"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "gson"; + groupId = "com.google.code.gson"; + sha512 = "c3cdaf66a99e6336abc80ff23374f6b62ac95ab2ae874c9075805e91d849b18e3f620cc202b4978fc92b73d98de96089c8714b1dd096b2ae1958cfa085715f7a"; + version = "2.7"; + }; + } + + ]; + } diff --git a/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/package.json b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/package.json new file mode 100644 index 000000000000..358595ef1eb8 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/package.json @@ -0,0 +1,42 @@ +{ + "name": "lumo-build-deps", + "version": "1.9.0", + "dependencies": { + "@babel/core": "^7.1.5", + "@babel/plugin-external-helpers": "7.0.0", + "@babel/plugin-proposal-class-properties": "^7.1.0", + "@babel/plugin-proposal-object-rest-spread": "^7.0.0", + "@babel/plugin-transform-runtime": "^7.1.0", + "@babel/preset-env": "^7.1.5", + "@babel/preset-stage-2": "7.0.0", + "@babel/runtime": "^7.1.5", + "async-retry": "^1.2.3", + "babel-core": "^7.0.0-bridge.0", + "babel-eslint": "10.0.1", + "babel-jest": "^23.6.0", + "babel-loader": "^8.0.4", + "babel-plugin-transform-flow-strip-types": "6.22.0", + "chalk": "^2.4.1", + "cross-env": "5.2.0", + "death": "^1.1.0", + "flow-bin": "0.85.0", + "google-closure-compiler-js": "20170910.0.1", + "jszip": "github:anmonteiro/jszip#patch-1", + "nexe": "3.0.0-beta.7", + "node-fetch": "^2.2.1", + "paredit.js": "0.3.4", + "posix-getopt": "github:anmonteiro/node-getopt#master", + "prettier": "1.15.1", + "progress": "^2.0.0", + "read-pkg": "^4.0.1", + "rollup": "0.67.0", + "rollup-plugin-babel": "4.0.3", + "rollup-plugin-babel-minify": "6.1.1", + "rollup-plugin-commonjs": "9.2.0", + "rollup-plugin-node-resolve": "3.4.0", + "rollup-plugin-replace": "2.1.0", + "webpack": "^4.25.1", + "webpack-cli": "^3.1.2", + "which-promise": "^1.0.0" + } +} diff --git a/nixpkgs/pkgs/development/interpreters/dart/default.nix b/nixpkgs/pkgs/development/interpreters/dart/default.nix new file mode 100644 index 000000000000..fa8996f0fb56 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/dart/default.nix @@ -0,0 +1,82 @@ +{ stdenv, fetchurl, unzip, version ? "2.0.0" }: + +let + + sources = let + + base = "https://storage.googleapis.com/dart-archive/channels"; + stable = "${base}/stable/release"; + dev = "${base}/dev/release"; + + in { + "1.16.1-x86_64-linux" = fetchurl { + url = "${stable}/${version}/sdk/dartsdk-linux-x64-release.zip"; + sha256 = "01cbnc8hd2wwprmivppmzvld9ps644k16wpgqv31h1596l5p82n2"; + }; + "1.16.1-i686-linux" = fetchurl { + url = "${stable}/${version}/sdk/dartsdk-linux-ia32-release.zip"; + sha256 = "0jfwzc3jbk4n5j9ka59s9bkb25l5g85fl1nf676mvj36swcfykx3"; + }; + "1.24.3-x86_64-linux" = fetchurl { + url = "${stable}/${version}/sdk/dartsdk-linux-x64-release.zip"; + sha256 = "e323c97c35e6bc5d955babfe2e235a5484a82bb1e4870fa24562c8b9b800559b"; + }; + "1.24.3-i686-linux" = fetchurl { + url = "${stable}/${version}/sdk/dartsdk-linux-ia32-release.zip"; + sha256 = "d67b8f8f9186e7d460320e6bce25ab343c014b6af4b2f61369ee83755d4da528"; + }; + "2.0.0-x86_64-linux" = fetchurl { + url = "${stable}/${version}/sdk/dartsdk-linux-x64-release.zip"; + sha256 = "4014a1e8755d2d32cc1573b731a4a53acdf6dfca3e26ee437f63fe768501d336"; + }; + "2.0.0-i686-linux" = fetchurl { + url = "${stable}/${version}/sdk/dartsdk-linux-ia32-release.zip"; + sha256 = "3164a9de70bf11ab5b20af0d51c8b3303f2dce584604dce33bea0040bdc0bbba"; + }; + "2.0.0-dev.26.0-x86_64-linux" = fetchurl { + url = "${dev}/${version}/sdk/dartsdk-linux-x64-release.zip"; + sha256 = "18360489a7914d5df09b34934393e16c7627ba673c1e9ab5cfd11cd1d58fd7df"; + }; + "2.0.0-dev.26.0-i686-linux" = fetchurl { + url = "${dev}/${version}/sdk/dartsdk-linux-ia32-release.zip"; + sha256 = "83ba8b64c76f48d8de4e0eb887e49b7960053f570d27e7ea438cc0bac789955e"; + }; + }; + +in + +stdenv.mkDerivation { + + name = "dart-${version}"; + + nativeBuildInputs = [ + unzip + ]; + + src = sources."${version}-${stdenv.hostPlatform.system}" or (throw "unsupported version/system: ${version}/${stdenv.hostPlatform.system}"); + + installPhase = '' + mkdir -p $out + cp -R * $out/ + echo $libPath + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath $libPath \ + $out/bin/dart + ''; + + libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc ]; + + dontStrip = true; + + meta = { + platforms = [ "i686-linux" "x86_64-linux" ]; + homepage = https://www.dartlang.org/; + description = "Scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps"; + longDescription = '' + Dart is a class-based, single inheritance, object-oriented language + with C-style syntax. It offers compilation to JavaScript, interfaces, + mixins, abstract classes, reified generics, and optional typing. + ''; + license = stdenv.lib.licenses.bsd3; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/dhall/default.nix b/nixpkgs/pkgs/development/interpreters/dhall/default.nix new file mode 100644 index 000000000000..8e1df36e4127 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/dhall/default.nix @@ -0,0 +1,18 @@ +{ haskell, haskellPackages, stdenvNoCC }: + +let + static = haskell.lib.justStaticExecutables haskellPackages.dhall; + +in static.overrideAttrs (old: { + passthru = old.passthru or {} // { + prelude = stdenvNoCC.mkDerivation { + name = "dhall-prelude"; + inherit (old) src; + phases = [ "unpackPhase" "installPhase" ]; + installPhase = '' + mkdir $out + cp -r Prelude/* $out/ + ''; + }; + }; +}) diff --git a/nixpkgs/pkgs/development/interpreters/duktape/default.nix b/nixpkgs/pkgs/development/interpreters/duktape/default.nix new file mode 100644 index 000000000000..2178f859007f --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/duktape/default.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + name = "duktape-${version}"; + version = "2.3.0"; + src = fetchurl { + url = "http://duktape.org/duktape-${version}.tar.xz"; + sha256 = "1s5g8lg0dga6x3rcq328a6hsd2sk2vzwq9zfmskjh5h6n8x2yvpd"; + }; + + buildPhase = '' + make -f Makefile.sharedlibrary + make -f Makefile.cmdline + ''; + installPhase = '' + install -d $out/bin + install -m755 duk $out/bin/ + install -d $out/lib + install -d $out/include + make -f Makefile.sharedlibrary install INSTALL_PREFIX=$out + ''; + enableParallelBuilding = true; + + meta = with stdenv.lib; { + description = "An embeddable Javascript engine, with a focus on portability and compact footprint"; + homepage = "http://duktape.org/"; + downloadPage = "http://duktape.org/download.html"; + license = licenses.mit; + maintainers = [ maintainers.fgaz ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/eff/default.nix b/nixpkgs/pkgs/development/interpreters/eff/default.nix new file mode 100644 index 000000000000..258aebe81727 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/eff/default.nix @@ -0,0 +1,36 @@ +{ stdenv, fetchFromGitHub, which, ocamlPackages }: + +let version = "5.0"; in + +stdenv.mkDerivation { + + name = "eff-${version}"; + + src = fetchFromGitHub { + owner = "matijapretnar"; + repo = "eff"; + rev = "v${version}"; + sha256 = "1fslfj5d7fhj3f7kh558b8mk5wllwyq4rnhfkyd96fpy144sdcka"; + }; + + buildInputs = [ which ] ++ (with ocamlPackages; [ + ocaml findlib ocamlbuild menhir js_of_ocaml js_of_ocaml-ocamlbuild + ]); + + doCheck = true; + checkTarget = "test"; + + meta = with stdenv.lib; { + homepage = http://www.eff-lang.org; + description = "A functional programming language based on algebraic effects and their handlers"; + longDescription = '' + Eff is a functional language with handlers of not only exceptions, + but also of other computational effects such as state or I/O. With + handlers, you can simply implement transactions, redirections, + backtracking, multi-threading, and much more... + ''; + license = licenses.bsd2; + inherit (ocamlPackages.ocaml.meta) platforms; + maintainers = [ maintainers.jirkamarsik ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/elixir/1.3.nix b/nixpkgs/pkgs/development/interpreters/elixir/1.3.nix new file mode 100644 index 000000000000..43d48e2cf7cd --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/1.3.nix @@ -0,0 +1,7 @@ +{ mkDerivation }: + +mkDerivation rec { + version = "1.3.4"; + sha256 = "01qqv1ghvfadcwcr5p88w8j217cgaf094pmpqllij3l0q1yg104l"; + minimumOTPVersion = "18"; +} diff --git a/nixpkgs/pkgs/development/interpreters/elixir/1.4.nix b/nixpkgs/pkgs/development/interpreters/elixir/1.4.nix new file mode 100644 index 000000000000..9ddd9062acd9 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/1.4.nix @@ -0,0 +1,7 @@ +{ mkDerivation }: + +mkDerivation rec { + version = "1.4.5"; + sha256 = "18ivcxmh5bak13k3rjy7jjzin57rgb2nffhwnqb2wl7bpi8mrarw"; + minimumOTPVersion = "18"; +} diff --git a/nixpkgs/pkgs/development/interpreters/elixir/1.5.nix b/nixpkgs/pkgs/development/interpreters/elixir/1.5.nix new file mode 100644 index 000000000000..d32f91275652 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/1.5.nix @@ -0,0 +1,7 @@ +{ mkDerivation }: + +mkDerivation rec { + version = "1.5.3"; + sha256 = "00kgqcn9g6vflc551wniz9pwv7pszyf8v6smpkqs50j3kbliihy5"; + minimumOTPVersion = "18"; +} diff --git a/nixpkgs/pkgs/development/interpreters/elixir/1.6.nix b/nixpkgs/pkgs/development/interpreters/elixir/1.6.nix new file mode 100644 index 000000000000..73afcbd1597e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/1.6.nix @@ -0,0 +1,7 @@ +{ mkDerivation }: + +mkDerivation rec { + version = "1.6.6"; + sha256 = "1wl8rfpw0dxacq4f7xf6wjr8v2ww5691d0cfw9pzw7phd19vazgl"; + minimumOTPVersion = "19"; +} diff --git a/nixpkgs/pkgs/development/interpreters/elixir/1.7.nix b/nixpkgs/pkgs/development/interpreters/elixir/1.7.nix new file mode 100644 index 000000000000..adbbbaff890b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/1.7.nix @@ -0,0 +1,7 @@ +{ mkDerivation }: + +mkDerivation rec { + version = "1.7.4"; + sha256 = "0f8j4pib13kffiihagdwl3xqs3a1ak19qz3z8fpyfxn9dnjiinla"; + minimumOTPVersion = "19"; +} diff --git a/nixpkgs/pkgs/development/interpreters/elixir/generic-builder.nix b/nixpkgs/pkgs/development/interpreters/elixir/generic-builder.nix new file mode 100644 index 000000000000..b4e1cacfe267 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/generic-builder.nix @@ -0,0 +1,81 @@ +{ pkgs, stdenv, fetchFromGitHub, erlang, rebar, makeWrapper, + coreutils, curl, bash, debugInfo ? false }: + +{ baseName ? "elixir" +, version +, minimumOTPVersion +, sha256 ? null +, rev ? "v${version}" +, src ? fetchFromGitHub { inherit rev sha256; owner = "elixir-lang"; repo = "elixir"; } +}: + +let + inherit (stdenv.lib) getVersion versionAtLeast; + +in + assert versionAtLeast (getVersion erlang) minimumOTPVersion; + + stdenv.mkDerivation ({ + name = "${baseName}-${version}"; + + inherit src version; + + buildInputs = [ erlang rebar makeWrapper ]; + + LOCALE_ARCHIVE = stdenv.lib.optionalString stdenv.isLinux + "${pkgs.glibcLocales}/lib/locale/locale-archive"; + LANG = "en_US.UTF-8"; + LC_TYPE = "en_US.UTF-8"; + + setupHook = ./setup-hook.sh; + + inherit debugInfo; + + buildFlags = if debugInfo + then "ERL_COMPILER_OPTIONS=debug_info" + else ""; + + preBuild = '' + # The build process uses ./rebar. Link it to the nixpkgs rebar + rm -vf rebar + ln -s ${rebar}/bin/rebar rebar + + patchShebangs lib/elixir/generate_app.escript || true + + substituteInPlace Makefile \ + --replace "/usr/local" $out + ''; + + postFixup = '' + # Elixir binaries are shell scripts which run erl. Add some stuff + # to PATH so the scripts can run without problems. + + for f in $out/bin/*; do + b=$(basename $f) + if [ "$b" = mix ]; then continue; fi + wrapProgram $f \ + --prefix PATH ":" "${stdenv.lib.makeBinPath [ erlang coreutils curl bash ]}" \ + --set CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt + done + + substituteInPlace $out/bin/mix \ + --replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir" + ''; + + meta = with stdenv.lib; { + homepage = https://elixir-lang.org/; + description = "A functional, meta-programming aware language built on top of the Erlang VM"; + + longDescription = '' + Elixir is a functional, meta-programming aware language built on + top of the Erlang VM. It is a dynamic language with flexible + syntax and macro support that leverages Erlang's abilities to + build concurrent, distributed and fault-tolerant applications + with hot code upgrades. + ''; + + license = licenses.epl10; + platforms = platforms.unix; + maintainers = with maintainers; [ the-kenny havvy couchemar ankhers ]; + }; + }) diff --git a/nixpkgs/pkgs/development/interpreters/elixir/setup-hook.sh b/nixpkgs/pkgs/development/interpreters/elixir/setup-hook.sh new file mode 100644 index 000000000000..501eca3cf02a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/setup-hook.sh @@ -0,0 +1,5 @@ +addErlLibPath() { + addToSearchPath ERL_LIBS $1/lib/elixir/lib +} + +addEnvHooks "$hostOffset" addErlLibPath diff --git a/nixpkgs/pkgs/development/interpreters/erlang/R16B02-basho.nix b/nixpkgs/pkgs/development/interpreters/erlang/R16B02-basho.nix new file mode 100644 index 000000000000..714924514edb --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/R16B02-basho.nix @@ -0,0 +1,65 @@ +{ pkgs, mkDerivation }: + +mkDerivation rec { + baseName = "erlang"; + version = "16B02.basho10"; + + src = pkgs.fetchFromGitHub { + owner = "basho"; + repo = "otp"; + rev = "OTP_R16B02_basho10"; + sha256 = "1s2c3ag9dnp6xmcr27kh95n1w50xly97n1mp8ivc2a3gpv4blqmj"; + }; + + preConfigure = '' + export HOME=$PWD/../ + export LANG=C + export ERL_TOP=$(pwd) + sed -e s@/bin/pwd@pwd@g -i otp_build + sed -e s@"/usr/bin/env escript"@$(pwd)/bootstrap/bin/escript@g -i lib/diameter/bin/diameterc + + ./otp_build autoconf + ''; + + enableHipe = false; + + # Do not install docs, instead use prebuilt versions. + installTargets = "install"; + postInstall = let + manpages = pkgs.fetchurl { + url = "http://www.erlang.org/download/otp_doc_man_R16B02.tar.gz"; + sha256 = "12apxjmmd591y9g9bhr97z5jbd1jarqg7wj0y2sqhl21hc1yp75p"; + }; + in '' + sed -e s@$(pwd)/bootstrap/bin/escript@$out/bin/escript@g -i $out/lib/erlang/lib/diameter-1.4.3/bin/diameterc + + tar xf "${manpages}" -C "$out/lib/erlang" + for i in "$out"/lib/erlang/man/man[0-9]/*.[0-9]; do + prefix="''${i%/*}" + mkdir -p "$out/share/man/''${prefix##*/}" + ln -s "$i" "$out/share/man/''${prefix##*/}/''${i##*/}erl" + done + ''; + + meta = { + homepage = https://github.com/basho/otp/; + description = "Programming language used for massively scalable soft real-time systems, Basho fork"; + + longDescription = '' + Erlang is a programming language used to build massively scalable + soft real-time systems with requirements on high availability. + Some of its uses are in telecoms, banking, e-commerce, computer + telephony and instant messaging. Erlang's runtime system has + built-in support for concurrency, distribution and fault + tolerance. + This version of Erlang is Basho's version, forked from Ericsson's + repository. + ''; + + knownVulnerabilities = [ "CVE-2017-1000385" ]; + + platforms = ["x86_64-linux" "x86_64-darwin"]; + license = pkgs.stdenv.lib.licenses.asl20; + maintainers = with pkgs.stdenv.lib.maintainers; [ mdaiter ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/erlang/R18.nix b/nixpkgs/pkgs/development/interpreters/erlang/R18.nix new file mode 100644 index 000000000000..58b7fd71f0be --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/R18.nix @@ -0,0 +1,34 @@ +{ mkDerivation, fetchpatch }: + +let + rmAndPwdPatch = fetchpatch { + url = "https://github.com/erlang/otp/commit/98b8650d22e94a5ff839170833f691294f6276d0.patch"; + sha256 = "0zjs7as83prgq4d5gaw2cmnajnsprdk8cjl5kklknx0pc2b3hfg5"; + }; + + envAndCpPatch = fetchpatch { + url = "https://github.com/erlang/otp/commit/9f9841eb7327c9fe73e84e197fd2965a97b639cf.patch"; + sha256 = "00fx5wc88ki3z71z5q4xzi9h3whhjw1zblpn09w995ygn07m9qhm"; + }; + + makeOrderingPatch = fetchpatch { + url = "https://github.com/erlang/otp/commit/2f1a37f1011ff9d129bc35a6efa0ab937a2aa0e9.patch"; + sha256 = "0xfa6hzxh9d7qllkyidcgh57xrrx11w65y7s1hyg52alm06l6b9n"; + }; + + makeParallelInstallPatch = fetchpatch { + url ="https://github.com/erlang/otp/commit/de8fe86f67591dd992bae33f7451523dab36e5bd.patch"; + sha256 = "1cj9fjhdng6yllajjm3gkk04ag9bwyb3n70hrb5nk6c292v8a45c"; + }; + +in mkDerivation rec { + version = "18.3.4.8"; + sha256 = "16c0h25hh5yvkv436ks5jbd7qmxzb6ndvk64mr404347a20iib0g"; + + patches = [ + rmAndPwdPatch + envAndCpPatch + makeOrderingPatch + makeParallelInstallPatch + ]; +} diff --git a/nixpkgs/pkgs/development/interpreters/erlang/R19.nix b/nixpkgs/pkgs/development/interpreters/erlang/R19.nix new file mode 100644 index 000000000000..e0d4ecbc95ac --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/R19.nix @@ -0,0 +1,19 @@ +{ mkDerivation, fetchpatch }: + +mkDerivation rec { + version = "19.3.6.11"; + sha256 = "0b02iv8dly1vkc2xnqqi030sdj34h4gji2h4qgilllajr1f868vm"; + + patches = [ + # macOS 10.13 crypto fix from OTP-20.1.2 + (fetchpatch { + name = "darwin-crypto.patch"; + url = "https://github.com/erlang/otp/commit/882c90f72ba4e298aa5a7796661c28053c540a96.patch"; + sha256 = "1gggzpm8ssamz6975z7px0g8qq5i4jqw81j846ikg49c5cxvi0hi"; + }) + ]; + + prePatch = '' + substituteInPlace configure.in --replace '`sw_vers -productVersion`' '10.10' + ''; +} diff --git a/nixpkgs/pkgs/development/interpreters/erlang/R20.nix b/nixpkgs/pkgs/development/interpreters/erlang/R20.nix new file mode 100644 index 000000000000..c408d21d9b31 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/R20.nix @@ -0,0 +1,10 @@ +{ mkDerivation }: + +mkDerivation rec { + version = "20.3.8.9"; + sha256 = "0v2iiyzss8hiih98wvj0gi2qzdmmhh7bvc9p025wlfm4k7r1109a"; + + prePatch = '' + substituteInPlace configure.in --replace '`sw_vers -productVersion`' '10.10' + ''; +} diff --git a/nixpkgs/pkgs/development/interpreters/erlang/R21.nix b/nixpkgs/pkgs/development/interpreters/erlang/R21.nix new file mode 100644 index 000000000000..b787f3f44f54 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/R21.nix @@ -0,0 +1,10 @@ +{ mkDerivation }: + +mkDerivation rec { + version = "21.2"; + sha256 = "0v9smdp2vxkpsz65a6ypwzl12fqdfrsi7k29f5i7af0v27r308cm"; + + prePatch = '' + substituteInPlace configure.in --replace '`sw_vers -productVersion`' '10.10' + ''; +} diff --git a/nixpkgs/pkgs/development/interpreters/erlang/generic-builder.nix b/nixpkgs/pkgs/development/interpreters/erlang/generic-builder.nix new file mode 100644 index 000000000000..0529c9f1e28c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/generic-builder.nix @@ -0,0 +1,149 @@ +{ pkgs, stdenv, fetchFromGitHub, makeWrapper, gawk, gnum4, gnused +, libxml2, libxslt, ncurses, openssl, perl, autoreconfHook +, openjdk ? null # javacSupport +, unixODBC ? null # odbcSupport +, libGLU_combined ? null, wxGTK ? null, wxmac ? null, xorg ? null # wxSupport +, withSystemd ? stdenv.isLinux, systemd # systemd support in epmd +}: + +{ baseName ? "erlang" +, version +, sha256 ? null +, rev ? "OTP-${version}" +, src ? fetchFromGitHub { inherit rev sha256; owner = "erlang"; repo = "otp"; } +, enableHipe ? true +, enableDebugInfo ? false +, enableThreads ? true +, enableSmpSupport ? true +, enableKernelPoll ? true +, javacSupport ? false, javacPackages ? [ openjdk ] +, odbcSupport ? false, odbcPackages ? [ unixODBC ] +, wxSupport ? !stdenv.isDarwin, wxPackages ? [ libGLU_combined wxGTK xorg.libX11 ] +, preUnpack ? "", postUnpack ? "" +, patches ? [], patchPhase ? "", prePatch ? "", postPatch ? "" +, configureFlags ? [], configurePhase ? "", preConfigure ? "", postConfigure ? "" +, buildPhase ? "", preBuild ? "", postBuild ? "" +, installPhase ? "", preInstall ? "", postInstall ? "" +, installTargets ? "install install-docs" +, checkPhase ? "", preCheck ? "", postCheck ? "" +, fixupPhase ? "", preFixup ? "", postFixup ? "" +, meta ? {} +}: + +assert wxSupport -> (if stdenv.isDarwin + then wxmac != null + else libGLU_combined != null && wxGTK != null && xorg != null); + +assert odbcSupport -> unixODBC != null; +assert javacSupport -> openjdk != null; + +let + inherit (stdenv.lib) optional optionals optionalAttrs optionalString; + wxPackages2 = if stdenv.isDarwin then [ wxmac ] else wxPackages; + +in stdenv.mkDerivation ({ + name = "${baseName}-${version}" + + optionalString javacSupport "-javac" + + optionalString odbcSupport "-odbc"; + + inherit src version; + + nativeBuildInputs = [ autoreconfHook makeWrapper perl gnum4 libxslt libxml2 ]; + + buildInputs = [ ncurses openssl ] + ++ optionals wxSupport wxPackages2 + ++ optionals odbcSupport odbcPackages + ++ optionals javacSupport javacPackages + ++ optional withSystemd systemd + ++ optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ Carbon Cocoa ]); + + debugInfo = enableDebugInfo; + + enableParallelBuilding = true; + + # Clang 4 (rightfully) thinks signed comparisons of pointers with NULL are nonsense + prePatch = '' + substituteInPlace lib/wx/c_src/wxe_impl.cpp --replace 'temp > NULL' 'temp != NULL' + + ${prePatch} + ''; + + postPatch = '' + patchShebangs make + + ${postPatch} + ''; + + preConfigure = '' + ./otp_build autoconf + ''; + + configureFlags = [ "--with-ssl=${openssl.dev}" ] + ++ optional enableThreads "--enable-threads" + ++ optional enableSmpSupport "--enable-smp-support" + ++ optional enableKernelPoll "--enable-kernel-poll" + ++ optional enableHipe "--enable-hipe" + ++ optional javacSupport "--with-javac" + ++ optional odbcSupport "--with-odbc=${unixODBC}" + ++ optional wxSupport "--enable-wx" + ++ optional withSystemd "--enable-systemd" + ++ optional stdenv.isDarwin "--enable-darwin-64bit"; + + # install-docs will generate and install manpages and html docs + # (PDFs are generated only when fop is available). + + postInstall = '' + ln -s $out/lib/erlang/lib/erl_interface*/bin/erl_call $out/bin/erl_call + + ${postInstall} + ''; + + # Some erlang bin/ scripts run sed and awk + postFixup = '' + wrapProgram $out/lib/erlang/bin/erl --prefix PATH ":" "${gnused}/bin/" + wrapProgram $out/lib/erlang/bin/start_erl --prefix PATH ":" "${stdenv.lib.makeBinPath [ gnused gawk ]}" + ''; + + setupHook = ./setup-hook.sh; + + meta = with stdenv.lib; ({ + homepage = http://www.erlang.org/; + downloadPage = "http://www.erlang.org/download.html"; + description = "Programming language used for massively scalable soft real-time systems"; + + longDescription = '' + Erlang is a programming language used to build massively scalable + soft real-time systems with requirements on high availability. + Some of its uses are in telecoms, banking, e-commerce, computer + telephony and instant messaging. Erlang's runtime system has + built-in support for concurrency, distribution and fault + tolerance. + ''; + + # aarch64 is supposed to work but started failing in https://hydra.nixos.org/build/83735973 + platforms = subtractLists [ "aarch64-linux" ] platforms.unix; + maintainers = with maintainers; [ the-kenny sjmackenzie couchemar gleber ]; + license = licenses.asl20; + } // meta); +} +// optionalAttrs (preUnpack != "") { inherit preUnpack; } +// optionalAttrs (postUnpack != "") { inherit postUnpack; } +// optionalAttrs (patches != []) { inherit patches; } +// optionalAttrs (patchPhase != "") { inherit patchPhase; } +// optionalAttrs (configureFlags != []) { inherit configureFlags; } +// optionalAttrs (configurePhase != "") { inherit configurePhase; } +// optionalAttrs (preConfigure != "") { inherit preConfigure; } +// optionalAttrs (postConfigure != "") { inherit postConfigure; } +// optionalAttrs (buildPhase != "") { inherit buildPhase; } +// optionalAttrs (preBuild != "") { inherit preBuild; } +// optionalAttrs (postBuild != "") { inherit postBuild; } +// optionalAttrs (checkPhase != "") { inherit checkPhase; } +// optionalAttrs (preCheck != "") { inherit preCheck; } +// optionalAttrs (postCheck != "") { inherit postCheck; } +// optionalAttrs (installPhase != "") { inherit installPhase; } +// optionalAttrs (installTargets != "") { inherit installTargets; } +// optionalAttrs (preInstall != "") { inherit preInstall; } +// optionalAttrs (fixupPhase != "") { inherit fixupPhase; } +// optionalAttrs (preFixup != "") { inherit preFixup; } +// optionalAttrs (postFixup != "") { inherit postFixup; } +) diff --git a/nixpkgs/pkgs/development/interpreters/erlang/setup-hook.sh b/nixpkgs/pkgs/development/interpreters/erlang/setup-hook.sh new file mode 100644 index 000000000000..3962d154ba9f --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/setup-hook.sh @@ -0,0 +1,5 @@ +addErlangLibPath() { + addToSearchPath ERL_LIBS $1/lib/erlang/lib +} + +addEnvHooks "$hostOffset" addErlangLibPath diff --git a/nixpkgs/pkgs/development/interpreters/falcon/default.nix b/nixpkgs/pkgs/development/interpreters/falcon/default.nix new file mode 100644 index 000000000000..857a1e5cd8df --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/falcon/default.nix @@ -0,0 +1,23 @@ +{ stdenv, fetchFromGitHub, cmake, pkgconfig, pcre, zlib, sqlite }: + +stdenv.mkDerivation rec { + name = "falcon-${version}"; + version = "2013-09-19"; + + src = fetchFromGitHub { + owner = "falconpl"; + repo = "falcon"; + rev = "095141903c4ebab928ce803055f9bda363215c37"; + sha256 = "1x3gdcz1gqhi060ngqi0ghryf69v8bn50yrbzfad8bhblvhzzdlf"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ cmake pcre zlib sqlite ]; + + meta = with stdenv.lib; { + description = "Programming language with macros and syntax at once"; + license = licenses.gpl2; + maintainers = with maintainers; [ pSub ]; + platforms = with platforms; linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/gauche/default.nix b/nixpkgs/pkgs/development/interpreters/gauche/default.nix new file mode 100644 index 000000000000..5481c4e7d05a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/gauche/default.nix @@ -0,0 +1,44 @@ +{ stdenv, fetchurl, pkgconfig, texinfo, libiconv, gdbm, openssl, zlib +, mbedtls, cacert +}: + +stdenv.mkDerivation rec { + name = "gauche-${version}"; + version = "0.9.7"; + + src = fetchurl { + url = "mirror://sourceforge/gauche/Gauche-${version}.tgz"; + sha256 = "181nycikma0rwrb1h6mi3kys11f8628pq8g5r3fg5hiz5sabscrd"; + }; + + nativeBuildInputs = [ pkgconfig texinfo ]; + + buildInputs = [ libiconv gdbm openssl zlib mbedtls cacert ]; + + postPatch = '' + patchShebangs . + ''; + + configureFlags = [ + "--with-iconv=${libiconv}" + "--with-dbm=gdbm" + "--with-zlib=${zlib}" + "--with-ca-bundle=$SSL_CERT_FILE" + # TODO: Enable slib + # Current slib in nixpkgs is specialized to Guile + # "--with-slib=${slibGuile}/lib/slib" + ]; + + enableParallelBuilding = true; + + # TODO: Fix tests that fail in sandbox build + doCheck = false; + + meta = with stdenv.lib; { + description = "R7RS Scheme scripting engine"; + homepage = https://practical-scheme.net/gauche/; + maintainers = with maintainers; [ mnacamura ]; + license = licenses.bsd3; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/gnu-apl/default.nix b/nixpkgs/pkgs/development/interpreters/gnu-apl/default.nix new file mode 100644 index 000000000000..f60e5d286140 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/gnu-apl/default.nix @@ -0,0 +1,42 @@ +{ stdenv, fetchurl, readline, gettext, ncurses }: + +stdenv.mkDerivation rec { + name = "gnu-apl-${version}"; + version = "1.7"; + + src = fetchurl { + url = "mirror://gnu/apl/apl-${version}.tar.gz"; + sha256 = "07xq8ddlmz8psvsmwr23gar108ri0lwmw0n6kpxcv8ypas1f5xlg"; + }; + + buildInputs = [ readline gettext ncurses ]; + + # Needed with GCC 7 + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.cc.isGNU "-Wno-error=int-in-bool-context" + + stdenv.lib.optionalString stdenv.cc.isClang "-Wno-error=null-dereference"; + + patchPhase = stdenv.lib.optionalString stdenv.isDarwin '' + substituteInPlace src/LApack.cc --replace "malloc.h" "malloc/malloc.h" + ''; + + postInstall = '' + cp -r support-files/ $out/share/doc/ + find $out/share/doc/support-files -name 'Makefile*' -delete + ''; + + meta = with stdenv.lib; { + description = "Free interpreter for the APL programming language"; + homepage = https://www.gnu.org/software/apl/; + license = licenses.gpl3Plus; + maintainers = [ maintainers.kovirobi ]; + platforms = with platforms; linux ++ darwin; + inherit version; + + longDescription = '' + GNU APL is a free interpreter for the programming language APL, with an + (almost) complete implementation of ISO standard 13751 aka. Programming + Language APL, Extended. GNU APL was written and is being maintained by + Jürgen Sauermann. + ''; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/groovy/default.nix b/nixpkgs/pkgs/development/interpreters/groovy/default.nix new file mode 100644 index 000000000000..dccba8ebb0e4 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/groovy/default.nix @@ -0,0 +1,39 @@ +{ stdenv, fetchurl, unzip, which, makeWrapper, jdk }: + +# at runtime, need jdk + +stdenv.mkDerivation rec { + name = "groovy-${version}"; + version = "2.5.4"; + + src = fetchurl { + url = "http://dl.bintray.com/groovy/maven/apache-groovy-binary-${version}.zip"; + sha256 = "1s661d5kwiafv5i1pq2b7k8b2fd7m2zp3xwcrf4iv1iik033djdj"; + }; + + buildInputs = [ unzip makeWrapper ]; + + installPhase = '' + mkdir -p $out + mkdir -p $out/share/doc/groovy + rm bin/*.bat + mv {bin,conf,grooid,indy,lib} $out + mv {licenses,LICENSE,NOTICE} $out/share/doc/groovy + + sed -i 's#which#${which}/bin/which#g' $out/bin/startGroovy + + for p in grape java2groovy groovy{,doc,c,sh,Console}; do + wrapProgram $out/bin/$p \ + --set JAVA_HOME "${jdk}" \ + --prefix PATH ":" "${jdk}/bin" + done + ''; + + meta = with stdenv.lib; { + description = "An agile dynamic language for the Java Platform"; + homepage = http://groovy-lang.org/; + license = licenses.asl20; + maintainers = with maintainers; [ pSub ]; + platforms = with platforms; unix; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/gtk-server/default.nix b/nixpkgs/pkgs/development/interpreters/gtk-server/default.nix new file mode 100644 index 000000000000..ab295dab4443 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/gtk-server/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchurl, libffcall, gtk2, pkgconfig }: + +stdenv.mkDerivation rec { + v = "2.3.1"; + name = "gtk-server-${v}"; + + src = fetchurl { + url = "mirror://sourceforge/gtk-server/${name}-sr.tar.gz"; + sha256 = "0z8ng5rhxc7fpsj3d50h25wkgcnxjfy030jm8r9w9m729w2c9hxb"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ libffcall gtk2 ]; + + configureOptions = [ "--with-gtk2" ]; + + meta = { + description = "gtk-server for interpreted GUI programming"; + homepage = http://www.gtk-server.org/; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = [stdenv.lib.maintainers.tohl]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/guile/1.8.nix b/nixpkgs/pkgs/development/interpreters/guile/1.8.nix new file mode 100644 index 000000000000..fd270dedefcc --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/1.8.nix @@ -0,0 +1,80 @@ +{ stdenv, buildPackages +, fetchurl, makeWrapper, gawk, pkgconfig +, libtool, readline, gmp +}: + +stdenv.mkDerivation rec { + name = "guile-1.8.8"; + + src = fetchurl { + url = "mirror://gnu/guile/${name}.tar.gz"; + sha256 = "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3"; + }; + + outputs = [ "out" "dev" "info" ]; + setOutputFlags = false; # $dev gets into the library otherwise + + # GCC 4.6 raises a number of set-but-unused warnings. + configureFlags = [ "--disable-error-on-warning" ] + # Guile needs patching to preset results for the configure tests about + # pthreads, which work only in native builds. + ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + "--with-threads=no"; + + depsBuildBuild = [ buildPackages.stdenv.cc ] + ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + buildPackages.buildPackages.guile_1_8; + nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; + buildInputs = [ readline libtool ]; + + propagatedBuildInputs = [ + gmp + + # XXX: These ones aren't normally needed here, but `libguile*.la' has '-l' + # flags for them without corresponding '-L' flags. Adding them here will add + # the needed `-L' flags. As for why the `.la' file lacks the `-L' flags, + # see below. + libtool + ]; + + patches = [ ./cpp-4.5.patch ]; + + preBuild = '' + sed -e '/lt_dlinit/a lt_dladdsearchdir("'$out/lib'");' -i libguile/dynl.c + ''; + + + postInstall = '' + wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" + '' + # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for + # why `--with-libunistring-prefix' and similar options coming from + # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64. + + '' + sed -i "$out/lib/pkgconfig/guile"-*.pc \ + -e "s|-lltdl|-L${libtool.lib}/lib -lltdl|g" + ''; + + # One test fails. + # ERROR: file: "libtest-asmobs", message: "file not found" + # This is fixed here: + # <https://git.savannah.gnu.org/cgit/guile.git/commit/?h=branch_release-1-8&id=a0aa1e5b69d6ef0311aeea8e4b9a94eae18a1aaf>. + doCheck = false; + doInstallCheck = doCheck; + + setupHook = ./setup-hook.sh; + + meta = { + description = "Embeddable Scheme implementation"; + homepage = https://www.gnu.org/software/guile/; + license = stdenv.lib.licenses.lgpl2Plus; + maintainers = [ stdenv.lib.maintainers.ludo ]; + platforms = stdenv.lib.platforms.unix; + + longDescription = '' + GNU Guile is an interpreter for the Scheme programming language, + packaged as a library that can be embedded into programs to make + them extensible. It supports many SRFIs. + ''; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/guile/2.0.nix b/nixpkgs/pkgs/development/interpreters/guile/2.0.nix new file mode 100644 index 000000000000..b65dfb1d4a1e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/2.0.nix @@ -0,0 +1,120 @@ +{ stdenv, buildPackages +, fetchpatch, fetchurl, makeWrapper, gawk, pkgconfig +, libffi, libtool, readline, gmp, boehmgc, libunistring +, coverageAnalysis ? null +}: + +# Do either a coverage analysis build or a standard build. +(if coverageAnalysis != null + then coverageAnalysis + else stdenv.mkDerivation) + +(rec { + name = "guile-2.0.13"; + + src = fetchurl { + url = "mirror://gnu/guile/${name}.tar.xz"; + sha256 = "12yqkr974y91ylgw6jnmci2v90i90s7h9vxa4zk0sai8vjnz4i1p"; + }; + + outputs = [ "out" "dev" "info" ]; + setOutputFlags = false; # $dev gets into the library otherwise + + depsBuildBuild = [ buildPackages.stdenv.cc ] + ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + buildPackages.buildPackages.guile_2_0; + nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; + buildInputs = [ readline libtool libunistring libffi ]; + + propagatedBuildInputs = [ + gmp boehmgc + + # XXX: These ones aren't normally needed here, but `libguile*.la' has '-l' + # flags for them without corresponding '-L' flags. Adding them here will add + # the needed `-L' flags. As for why the `.la' file lacks the `-L' flags, + # see below. + libtool libunistring + ]; + + enableParallelBuilding = true; + + patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ./clang.patch + (fetchpatch { + # Fixes stability issues with 00-repl-server.test + url = "https://git.savannah.gnu.org/cgit/guile.git/patch/?id=2fbde7f02adb8c6585e9baf6e293ee49cd23d4c4"; + sha256 = "0p6c1lmw1iniq03z7x5m65kg3lq543kgvdb4nrxsaxjqf3zhl77v"; + }) + ./riscv.patch + ] ++ + (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch); + + # Explicitly link against libgcc_s, to work around the infamous + # "libgcc_s.so.1 must be installed for pthread_cancel to work". + + # don't have "libgcc_s.so.1" on darwin + LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s"; + + configureFlags = [ "--with-libreadline-prefix" ] + ++ stdenv.lib.optionals stdenv.isSunOS [ + # Make sure the right <gmp.h> is found, and not the incompatible + # /usr/include/mp.h from OpenSolaris. See + # <https://lists.gnu.org/archive/html/hydra-users/2012-08/msg00000.html> + # for details. + "--with-libgmp-prefix=${gmp.dev}" + + # Same for these (?). + "--with-libreadline-prefix=${readline.dev}" + "--with-libunistring-prefix=${libunistring}" + + # See below. + "--without-threads" + ]; + + postInstall = '' + wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" + '' + # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for + # why `--with-libunistring-prefix' and similar options coming from + # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64. + + '' + sed -i "$out/lib/pkgconfig/guile"-*.pc \ + -e "s|-lunistring|-L${libunistring}/lib -lunistring|g ; + s|^Cflags:\(.*\)$|Cflags: -I${libunistring}/include \1|g ; + s|-lltdl|-L${libtool.lib}/lib -lltdl|g ; + s|includedir=$out|includedir=$dev|g + " + ''; + + # make check doesn't work on darwin + # On Linuxes+Hydra the tests are flaky; feel free to investigate deeper. + doCheck = false; + doInstallCheck = doCheck; + + setupHook = ./setup-hook-2.0.sh; + + meta = { + description = "Embeddable Scheme implementation"; + homepage = https://www.gnu.org/software/guile/; + license = stdenv.lib.licenses.lgpl3Plus; + maintainers = with stdenv.lib.maintainers; [ ludo lovek323 ]; + platforms = stdenv.lib.platforms.all; + + longDescription = '' + GNU Guile is an implementation of the Scheme programming language, with + support for many SRFIs, packaged for use in a wide variety of + environments. In addition to implementing the R5RS Scheme standard + and a large subset of R6RS, Guile includes a module system, full access + to POSIX system calls, networking support, multiple threads, dynamic + linking, a foreign function call interface, and powerful string + processing. + ''; + }; +}) + +// + +(stdenv.lib.optionalAttrs (!stdenv.isLinux) { + # Work around <https://bugs.gnu.org/14201>. + SHELL = "/bin/sh"; + CONFIG_SHELL = "/bin/sh"; +}) diff --git a/nixpkgs/pkgs/development/interpreters/guile/clang.patch b/nixpkgs/pkgs/development/interpreters/guile/clang.patch new file mode 100644 index 000000000000..4d0f342b211f --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/clang.patch @@ -0,0 +1,14 @@ +diff --git a/lib/stdint.in.h b/lib/stdint.in.h +index 889bca7..15d39b0 100644 +--- a/lib/stdint.in.h ++++ b/lib/stdint.in.h +@@ -74,7 +74,8 @@ + in <inttypes.h> would reinclude us, skipping our contents because + _@GUARD_PREFIX@_STDINT_H is defined. + The include_next requires a split double-inclusion guard. */ +-# @INCLUDE_NEXT@ @NEXT_STDINT_H@ ++# include <inttypes.h> ++// # @INCLUDE_NEXT@ @NEXT_STDINT_H@ + #endif + + #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H diff --git a/nixpkgs/pkgs/development/interpreters/guile/cpp-4.5.patch b/nixpkgs/pkgs/development/interpreters/guile/cpp-4.5.patch new file mode 100644 index 000000000000..7e7671f0da09 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/cpp-4.5.patch @@ -0,0 +1,24 @@ +Fix doc snarfing with GCC 4.5. +From <http://git.savannah.gnu.org/cgit/guile.git/commit/?h=branch_release-1-8&id=aac41d28358cea594bb30f6e547afb82bb6004a6>. + +diff --git a/scripts/snarf-check-and-output-texi b/scripts/snarf-check-and-output-texi +index ea33e17..8cd42e8 100755 +--- a/scripts/snarf-check-and-output-texi ++++ b/scripts/snarf-check-and-output-texi +@@ -267,6 +267,17 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@" + (set! *file* file) + (set! *line* line)) + ++ ;; newer gccs like to throw around more location markers into the ++ ;; preprocessed source; these (hash . hash) bits are what they translate to ++ ;; in snarfy terms. ++ (('location ('string . file) ('int . line) ('hash . 'hash)) ++ (set! *file* file) ++ (set! *line* line)) ++ ++ (('location ('hash . 'hash) ('string . file) ('int . line) ('hash . 'hash)) ++ (set! *file* file) ++ (set! *line* line)) ++ + (('arglist rest ...) + (set! *args* (do-arglist rest))) diff --git a/nixpkgs/pkgs/development/interpreters/guile/default.nix b/nixpkgs/pkgs/development/interpreters/guile/default.nix new file mode 100644 index 000000000000..1943b10bdcaf --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/default.nix @@ -0,0 +1,109 @@ +{ stdenv, buildPackages +, fetchurl, makeWrapper, gawk, pkgconfig +, libffi, libtool, readline, gmp, boehmgc, libunistring +, coverageAnalysis ? null +}: + +# Do either a coverage analysis build or a standard build. +(if coverageAnalysis != null + then coverageAnalysis + else stdenv.mkDerivation) + +(rec { + name = "guile-${version}"; + version = "2.2.3"; + + src = fetchurl { + url = "mirror://gnu/guile/${name}.tar.xz"; + sha256 = "11j01agvnci2cx32wwpqs9078856yxmvs15gcsz7ganpkj2ahlw3"; + }; + + outputs = [ "out" "dev" "info" ]; + setOutputFlags = false; # $dev gets into the library otherwise + + depsBuildBuild = [ buildPackages.stdenv.cc ] + ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + buildPackages.buildPackages.guile; + nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; + buildInputs = [ readline libtool libunistring libffi ]; + + propagatedBuildInputs = [ + gmp boehmgc + + # XXX: These ones aren't normally needed here, but `libguile*.la' has '-l' + # flags for them without corresponding '-L' flags. Adding them here will add + # the needed `-L' flags. As for why the `.la' file lacks the `-L' flags, + # see below. + libtool libunistring + ]; + + enableParallelBuilding = true; + + patches = [ + ./eai_system.patch + ./riscv.patch + ] ++ + (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch); + + # Explicitly link against libgcc_s, to work around the infamous + # "libgcc_s.so.1 must be installed for pthread_cancel to work". + + # don't have "libgcc_s.so.1" on darwin + LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s"; + + configureFlags = [ "--with-libreadline-prefix=${readline.dev}" ] + ++ stdenv.lib.optionals stdenv.isSunOS [ + # Make sure the right <gmp.h> is found, and not the incompatible + # /usr/include/mp.h from OpenSolaris. See + # <https://lists.gnu.org/archive/html/hydra-users/2012-08/msg00000.html> + # for details. + "--with-libgmp-prefix=${gmp.dev}" + + # Same for these (?). + "--with-libunistring-prefix=${libunistring}" + + # See below. + "--without-threads" + ]; + + postInstall = '' + wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" + '' + # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for + # why `--with-libunistring-prefix' and similar options coming from + # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64. + + '' + sed -i "$out/lib/pkgconfig/guile"-*.pc \ + -e "s|-lunistring|-L${libunistring}/lib -lunistring|g ; + s|^Cflags:\(.*\)$|Cflags: -I${libunistring}/include \1|g ; + s|-lltdl|-L${libtool.lib}/lib -lltdl|g ; + s|includedir=$out|includedir=$dev|g + " + ''; + + # make check doesn't work on darwin + # On Linuxes+Hydra the tests are flaky; feel free to investigate deeper. + doCheck = false; + doInstallCheck = doCheck; + + setupHook = ./setup-hook-2.2.sh; + + meta = { + description = "Embeddable Scheme implementation"; + homepage = https://www.gnu.org/software/guile/; + license = stdenv.lib.licenses.lgpl3Plus; + maintainers = with stdenv.lib.maintainers; [ ludo lovek323 vrthra ]; + platforms = stdenv.lib.platforms.all; + + longDescription = '' + GNU Guile is an implementation of the Scheme programming language, with + support for many SRFIs, packaged for use in a wide variety of + environments. In addition to implementing the R5RS Scheme standard + and a large subset of R6RS, Guile includes a module system, full access + to POSIX system calls, networking support, multiple threads, dynamic + linking, a foreign function call interface, and powerful string + processing. + ''; + }; +}) + diff --git a/nixpkgs/pkgs/development/interpreters/guile/disable-gc-sensitive-tests.patch b/nixpkgs/pkgs/development/interpreters/guile/disable-gc-sensitive-tests.patch new file mode 100644 index 000000000000..076091a702a2 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/disable-gc-sensitive-tests.patch @@ -0,0 +1,25 @@ +This patch disable GC-sensitive tests. This is particularly useful when +compiling with `-O0' (as is done with coverage analysis) since there may +be many false references held on the stack, leading to the failure of +such tests. + +--- a/test-suite/tests/gc.test ++++ b/test-suite/tests/gc.test +@@ -67,6 +67,7 @@ + + (with-test-prefix "gc" + (pass-if "Unused modules are removed" ++ (throw 'unresolved) + (let* ((guard (make-guardian)) + (total 1000)) + +--- a/test-suite/tests/threads.test ++++ b/test-suite/tests/threads.test +@@ -366,6 +366,7 @@ + (not (mutex-owner m)))) + + (pass-if "mutex with owner not retained (bug #27450)" ++ (throw 'unresolved) + (let ((g (make-guardian))) + (g (let ((m (make-mutex))) (lock-mutex m) m)) + diff --git a/nixpkgs/pkgs/development/interpreters/guile/eai_system.patch b/nixpkgs/pkgs/development/interpreters/guile/eai_system.patch new file mode 100644 index 000000000000..b0eb7ac44dae --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/eai_system.patch @@ -0,0 +1,24 @@ +Building nixpkgs in non-chroot, NSS modules may fail +and that will report EAI_SYSTEM in getaddrinfo. +https://bugzilla.novell.com/show_bug.cgi?id=794696 + +Index: guile-2.0.7/test-suite/tests/net-db.test +=================================================================== +--- guile-2.0.7.orig/test-suite/tests/net-db.test ++++ guile-2.0.7/test-suite/tests/net-db.test +@@ -79,6 +79,7 @@ + (and (defined? 'EAI_NODATA) ; GNU extension + (= errcode EAI_NODATA)) + (= errcode EAI_AGAIN) ++ (= errcode EAI_SYSTEM) + (begin + (format #t "unexpected error code: ~a ~s~%" + errcode (gai-strerror errcode)) +@@ -105,6 +106,7 @@ + ;; `EAI_NONAME'.) + (and (or (= errcode EAI_SERVICE) + (= errcode EAI_NONAME) ++ (= errcode EAI_SYSTEM) + (and (defined? 'EAI_NODATA) + (= errcode EAI_NODATA))) + (string? (gai-strerror errcode)))))))) diff --git a/nixpkgs/pkgs/development/interpreters/guile/gcov-file-name.patch b/nixpkgs/pkgs/development/interpreters/guile/gcov-file-name.patch new file mode 100644 index 000000000000..f144296170ed --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/gcov-file-name.patch @@ -0,0 +1,42 @@ +This patch arranges so that we don't end up, with profiling builds, with a +file named `<stdout>.gcov' since that confuses lcov: + + <stdout>:cannot open source file + geninfo: ERROR: cannot read <stdout>.gcov! + +--- guile/libguile/c-tokenize.c 2009-09-13 13:05:15.000000000 +0200 ++++ guile/libguile/c-tokenize.c 2009-10-28 16:24:15.000000000 +0100 +@@ -1,5 +1,5 @@ + +-#line 3 "<stdout>" ++#line 3 "c-tokenize.c" + + #define YY_INT_ALIGNED short int + +@@ -616,7 +616,7 @@ int cookie_was_last = 0; + #define IS_COOKIE cookie_was_last = 1 + #define IS_NOT_COOKIE cookie_was_last = 0 + +-#line 620 "<stdout>" ++#line 620 "c-tokenize.c" + + #define INITIAL 0 + +@@ -799,7 +799,7 @@ YY_DECL + #line 65 "./c-tokenize.lex" + + +-#line 803 "<stdout>" ++#line 803 "c-tokenize.c" + + if ( !(yy_init) ) + { +@@ -1235,7 +1235,7 @@ YY_RULE_SETUP + #line 181 "./c-tokenize.lex" + ECHO; + YY_BREAK +-#line 1239 "<stdout>" ++#line 1239 "c-tokenize.c" + case YY_STATE_EOF(INITIAL): + yyterminate(); + diff --git a/nixpkgs/pkgs/development/interpreters/guile/riscv.patch b/nixpkgs/pkgs/development/interpreters/guile/riscv.patch new file mode 100644 index 000000000000..b835e1613838 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/riscv.patch @@ -0,0 +1,13 @@ +diff --git a/module/system/base/target.scm b/module/system/base/target.scm +index 95ab8d8c9..93616f4a3 100644 +--- a/module/system/base/target.scm ++++ b/module/system/base/target.scm +@@ -86,6 +86,8 @@ + (endianness big)) + ((string=? "aarch64" cpu) + (endianness little)) ++ ((string-match "riscv[1-9][0-9]*" cpu) ++ (endianness little)) + (else + (error "unknown CPU endianness" cpu))))) + diff --git a/nixpkgs/pkgs/development/interpreters/guile/setup-hook-2.0.sh b/nixpkgs/pkgs/development/interpreters/guile/setup-hook-2.0.sh new file mode 100644 index 000000000000..c7fb4f70fc6a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/setup-hook-2.0.sh @@ -0,0 +1,13 @@ +addGuileLibPath () { + if test -d "$1/share/guile/site/2.0" + then + export GUILE_LOAD_PATH="${GUILE_LOAD_PATH}${GUILE_LOAD_PATH:+:}$1/share/guile/site/2.0" + export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH}${GUILE_LOAD_COMPILED_PATH:+:}$1/share/guile/site/2.0" + elif test -d "$1/share/guile/site" + then + export GUILE_LOAD_PATH="${GUILE_LOAD_PATH}${GUILE_LOAD_PATH:+:}$1/share/guile/site" + export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH}${GUILE_LOAD_COMPILED_PATH:+:}$1/share/guile/site" + fi +} + +addEnvHooks "$hostOffset" addGuileLibPath diff --git a/nixpkgs/pkgs/development/interpreters/guile/setup-hook-2.2.sh b/nixpkgs/pkgs/development/interpreters/guile/setup-hook-2.2.sh new file mode 100644 index 000000000000..73e700bde026 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/setup-hook-2.2.sh @@ -0,0 +1,13 @@ +addGuileLibPath () { + if test -d "$1/share/guile/site/2.2" + then + export GUILE_LOAD_PATH="${GUILE_LOAD_PATH}${GUILE_LOAD_PATH:+:}$1/share/guile/site/2.2" + export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH}${GUILE_LOAD_COMPILED_PATH:+:}$1/share/guile/site/2.2" + elif test -d "$1/share/guile/site" + then + export GUILE_LOAD_PATH="${GUILE_LOAD_PATH}${GUILE_LOAD_PATH:+:}$1/share/guile/site" + export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH}${GUILE_LOAD_COMPILED_PATH:+:}$1/share/guile/site" + fi +} + +addEnvHooks "$hostOffset" addGuileLibPath diff --git a/nixpkgs/pkgs/development/interpreters/guile/setup-hook.sh b/nixpkgs/pkgs/development/interpreters/guile/setup-hook.sh new file mode 100644 index 000000000000..bf04fee1e893 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/setup-hook.sh @@ -0,0 +1,8 @@ +addGuileLibPath () { + if test -d "$1/share/guile/site" + then + export GUILE_LOAD_PATH="${GUILE_LOAD_PATH}${GUILE_LOAD_PATH:+:}$1/share/guile/site" + fi +} + +addEnvHooks "$hostOffset" addGuileLibPath diff --git a/nixpkgs/pkgs/development/interpreters/hugs/default.nix b/nixpkgs/pkgs/development/interpreters/hugs/default.nix new file mode 100644 index 000000000000..2177ae22db56 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/hugs/default.nix @@ -0,0 +1,49 @@ +{ stdenv, fetchurl, bison }: + +stdenv.mkDerivation { + + name = "hugs98-200609"; + + src = fetchurl { + url = http://cvs.haskell.org/Hugs/downloads/2006-09/hugs98-Sep2006.tar.gz; + sha256 = "1dj65c39zpy6qqvvrwns2hzj6ipnd4ih655xj7kgyk2nfdvd5x1w"; + }; + + patches = + [ (fetchurl { + url = https://aur.archlinux.org/cgit/aur.git/plain/hsbase_inline.patch?h=hugs; + name = "hsbase_inline.patch"; + sha256 = "1h0sp16d17hlm6gj7zdbgwrjwi2l4q02m8p0wd60dp4gn9i9js0v"; + }) + ]; + + nativeBuildInputs = [ bison ]; + + postUnpack = "find -type f -exec sed -i 's@/bin/cp@cp@' {} +"; + + preConfigure = "unset STRIP"; + + configureFlags = [ + "--enable-char-encoding=utf8" # require that the UTF-8 encoding is always used + "--disable-path-canonicalization" + "--disable-timer" # evaluation timing (for benchmarking Hugs) + "--disable-profiling" # heap profiler + "--disable-stack-dumps" # stack dump on stack overflow + "--enable-large-banner" # multiline startup banner + "--disable-internal-prims" # experimental primitives to access Hugs's innards + "--disable-debug" # include C debugging information (for debugging Hugs) + "--disable-tag" # runtime tag checking (for debugging Hugs) + "--disable-lint" # "lint" flags (for debugging Hugs) + "--disable-only98" # build Hugs to understand Haskell 98 only + "--enable-ffi" + "--enable-pthreads" # build Hugs using POSIX threads C library + ]; + + meta = with stdenv.lib; { + homepage = https://www.haskell.org/hugs; + description = "Haskell interpreter"; + maintainers = with maintainers; [ joachifm ]; + license = licenses.bsd3; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/hy/default.nix b/nixpkgs/pkgs/development/interpreters/hy/default.nix new file mode 100644 index 000000000000..02ce07bdf471 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/hy/default.nix @@ -0,0 +1,27 @@ +{ stdenv, fetchurl, pythonPackages }: + +pythonPackages.buildPythonApplication rec { + name = "hy-${version}"; + version = "0.15.0"; + + src = fetchurl { + url = "mirror://pypi/h/hy/${name}.tar.gz"; + sha256 = "01vzaib1imr00j5d7f7xk44v800h06s3yv9inhlqm6f3b25ywpl1"; + }; + + propagatedBuildInputs = with pythonPackages; [ + appdirs + astor + clint + funcparserlib + rply + ]; + + meta = { + description = "A LISP dialect embedded in Python"; + homepage = http://hylang.org/; + license = stdenv.lib.licenses.mit; + maintainers = [ stdenv.lib.maintainers.nixy ]; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/icon-lang/default.nix b/nixpkgs/pkgs/development/interpreters/icon-lang/default.nix new file mode 100644 index 000000000000..3bec73ea0369 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/icon-lang/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchFromGitHub, libX11, libXt }: + +stdenv.mkDerivation rec { + name = "icon-lang-${version}"; + version = "9.5.1"; + src = fetchFromGitHub { + rev = "39d7438e8d23ccfe20c0af8bbbf61e34d9c715e9"; + owner = "gtownsend"; + repo = "icon"; + sha256 = "1gkvj678ldlr1m5kjhx6zpmq11nls8kxa7pyy64whgakfzrypynw"; + }; + buildInputs = [ libX11 libXt ]; + + configurePhase = '' + make X-Configure name=linux + ''; + + installPhase = '' + make Install dest=$out + ''; + + meta = with stdenv.lib; { + description = ''A very high level general-purpose programming language''; + maintainers = with maintainers; [ vrthra ]; + platforms = platforms.linux; + license = licenses.publicDomain; + homepage = https://www.cs.arizona.edu/icon/; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/io/default.nix b/nixpkgs/pkgs/development/interpreters/io/default.nix new file mode 100644 index 000000000000..6c0568d68134 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/io/default.nix @@ -0,0 +1,52 @@ +{ stdenv, fetchFromGitHub, cmake, zlib, sqlite, gmp, libffi, cairo, + ncurses, freetype, libGLU_combined, libpng, libtiff, libjpeg, readline, libsndfile, + libxml2, freeglut, libsamplerate, pcre, libevent, libedit, yajl, + python3, openssl, glfw, pkgconfig, libpthreadstubs, libXdmcp, libmemcached +}: + +stdenv.mkDerivation { + name = "io-2015.11.11"; + src = fetchFromGitHub { + owner = "stevedekorte"; + repo = "io"; + rev = "1fc725e0a8635e2679cbb20521f4334c25273caa"; + sha256 = "0ll2kd72zy8vf29sy0nnx3awk7nywpwpv21rvninjjaqkygrc0qw"; + }; + + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + zlib sqlite gmp libffi cairo ncurses freetype + libGLU_combined libpng libtiff libjpeg readline libsndfile libxml2 + freeglut libsamplerate pcre libevent libedit yajl + pkgconfig glfw openssl libpthreadstubs libXdmcp + libmemcached python3 + ]; + + preConfigure = '' + # The Addon generation (AsyncRequest and a others checked) seems to have + # trouble with building on Virtual machines. Disabling them until it + # can be fully investigated. + sed -ie \ + "s/add_subdirectory(addons)/#add_subdirectory(addons)/g" \ + CMakeLists.txt + ''; + + # for gcc5; c11 inline semantics breaks the build + NIX_CFLAGS_COMPILE = "-fgnu89-inline"; + + meta = with stdenv.lib; { + description = "Io programming language"; + homepage = http://iolanguage.org/; + license = licenses.bsd3; + + maintainers = with maintainers; [ + raskin + z77z + vrthra + ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/j/default.nix b/nixpkgs/pkgs/development/interpreters/j/default.nix new file mode 100644 index 000000000000..11feb1170c2c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/j/default.nix @@ -0,0 +1,93 @@ +{ stdenv, fetchFromGitHub, readline, libedit, bc }: + +stdenv.mkDerivation rec { + name = "j-${version}"; + version = "807"; + jtype = "release"; + src = fetchFromGitHub { + owner = "jsoftware"; + repo = "jsource"; + rev = "j${version}-${jtype}"; + sha256 = "1qciw2yg9x996zglvj2461qby038x89xcmfb3qyrh3myn8m1nq2n"; + }; + + buildInputs = [ readline libedit bc ]; + bits = if stdenv.is64bit then "64" else "32"; + platform = + if (stdenv.isAarch32 || stdenv.isAarch64) then "raspberry" else + if stdenv.isLinux then "linux" else + if stdenv.isDarwin then "darwin" else + "unknown"; + + doCheck = true; + + buildPhase = '' + export SOURCE_DIR=$(pwd) + export HOME=$TMPDIR + export JLIB=$SOURCE_DIR/jlibrary + + export jbld=$HOME/bld + export jplatform=${platform} + export jmake=$SOURCE_DIR/make + export jgit=$SOURCE_DIR + export JBIN=$jbld/j${bits}/bin + mkdir -p $JBIN + + echo $OUT_DIR + + cd make + + patchShebangs . + sed -i jvars.sh -e " + s@~/git/jsource@$SOURCE_DIR@; + s@~/jbld@$HOME@; + " + + sed -i $JLIB/bin/profile.ijs -e "s@'/usr/share/j/.*'@'$out/share/j'@;" + + # For future versions, watch + # https://github.com/jsoftware/jsource/pull/4 + cp ./jvars.sh $HOME + + echo ' + #define jversion "${version}" + #define jplatform "${platform}" + #define jtype "${jtype}" // release,beta,... + #define jlicense "GPL3" + #define jbuilder "nixpkgs" // website or email + ' > ../jsrc/jversion.h + + ./build_jconsole.sh j${bits} + ./build_libj.sh j${bits} + ''; + + checkPhase = '' + echo 'i. 5' | $JBIN/jconsole | fgrep "0 1 2 3 4" + + # Now run the real tests + cd $SOURCE_DIR/test + for f in *.ijs + do + echo $f + $JBIN/jconsole < $f > /dev/null || echo FAIL && echo PASS + done + ''; + + installPhase = '' + mkdir -p "$out" + cp -r $JBIN "$out/bin" + rm $out/bin/*.txt # Remove logs from the bin folder + + mkdir -p "$out/share/j" + cp -r $JLIB/{addons,system} "$out/share/j" + cp -r $JLIB/bin "$out" + ''; + + meta = with stdenv.lib; { + description = "J programming language, an ASCII-based APL successor"; + maintainers = with maintainers; [ raskin synthetica ]; + platforms = with platforms; linux ++ darwin; + license = licenses.gpl3Plus; + homepage = http://jsoftware.com/; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/jimtcl/default.nix b/nixpkgs/pkgs/development/interpreters/jimtcl/default.nix new file mode 100644 index 000000000000..704e3eb4031a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/jimtcl/default.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchFromGitHub, sqlite, readline, asciidoc, SDL, SDL_gfx }: + +let + makeSDLFlags = map (p: "-I${stdenv.lib.getDev p}/include/SDL"); + +in stdenv.mkDerivation rec { + name = "jimtcl-${version}"; + version = "0.78"; + + src = fetchFromGitHub { + owner = "msteveb"; + repo = "jimtcl"; + rev = version; + sha256 = "1nrjxjfh69i35ig8sxdlal4ydd3cl0x68c05s6svnf1y2i1bl23j"; + }; + + buildInputs = [ + sqlite readline asciidoc SDL SDL_gfx + ]; + + NIX_CFLAGS_COMPILE = makeSDLFlags [ SDL SDL_gfx ]; + + configureFlags = [ + "--with-ext=oo" + "--with-ext=tree" + "--with-ext=binary" + "--with-ext=sqlite3" + "--with-ext=readline" + "--with-ext=sdl" + "--enable-utf8" + "--ipv6" + ]; + + meta = { + description = "An open source small-footprint implementation of the Tcl programming language"; + homepage = http://jim.tcl.tk/; + license = stdenv.lib.licenses.bsd2; + platforms = stdenv.lib.platforms.all; + maintainers = with stdenv.lib.maintainers; [ dbohdan vrthra ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/joker/default.nix b/nixpkgs/pkgs/development/interpreters/joker/default.nix new file mode 100644 index 000000000000..21a7cfba4064 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/joker/default.nix @@ -0,0 +1,31 @@ +{ stdenv, buildGoPackage, fetchFromGitHub }: + +buildGoPackage rec { + name = "joker-${version}"; + version = "0.10.1"; + + goPackagePath = "github.com/candid82/joker"; + + src = fetchFromGitHub { + rev = "v${version}"; + owner = "candid82"; + repo = "joker"; + sha256 = "1c3p61jmlljljbiwsylmfa75pi00y7yj5wabx1rxmpswc41g5mab"; + }; + + preBuild = "go generate ./..."; + + dontInstallSrc = true; + + excludedPackages = "gen"; # Do not install private generators. + + goDeps = ./deps.nix; + + meta = with stdenv.lib; { + homepage = https://github.com/candid82/joker; + description = "A small Clojure interpreter and linter written in Go"; + license = licenses.epl10; + platforms = platforms.all; + maintainers = with maintainers; [ andrestylianos ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/joker/deps.nix b/nixpkgs/pkgs/development/interpreters/joker/deps.nix new file mode 100644 index 000000000000..4eff988796b3 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/joker/deps.nix @@ -0,0 +1,29 @@ +[ + { + goPackagePath = "github.com/chzyer/readline"; + fetch = { + type = "git"; + url = "https://github.com/chzyer/readline"; + rev = "6a4bc7b4feaeff8feb63f87d5fb2cf3e3610a559"; + sha256 = "1ny3rws671sa9bj5phg6k1rprlgzys73kfdr14vxq4wnwz84zbrc"; + }; + } + { + goPackagePath = "github.com/pkg/profile"; + fetch = { + type = "git"; + url = "https://github.com/pkg/profile"; + rev = "5b67d428864e92711fcbd2f8629456121a56d91f"; + sha256 = "0blqmvgqvdbqmh3fp9pfdxc9w1qfshrr0zy9whj0sn372bw64qnr"; + }; + } + { + goPackagePath = "gopkg.in/yaml.v2"; + fetch = { + type = "git"; + url = "https://gopkg.in/yaml.v2"; + rev = "a83829b6f1293c91addabc89d0571c246397bbf4"; + sha256 = "1m4dsmk90sbi17571h6pld44zxz7jc4lrnl4f27dpd1l8g5xvjhh"; + }; + } +] diff --git a/nixpkgs/pkgs/development/interpreters/jruby/default.nix b/nixpkgs/pkgs/development/interpreters/jruby/default.nix new file mode 100644 index 000000000000..cfefa8c95dc5 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/jruby/default.nix @@ -0,0 +1,62 @@ +{ stdenv, callPackage, fetchurl, makeWrapper, jre }: + +let +# The version number here is whatever is reported by the RUBY_VERSION string +rubyVersion = callPackage ../ruby/ruby-version.nix {} "2" "3" "3" ""; +jruby = stdenv.mkDerivation rec { + name = "jruby-${version}"; + + version = "9.2.5.0"; + + src = fetchurl { + url = "https://s3.amazonaws.com/jruby.org/downloads/${version}/jruby-bin-${version}.tar.gz"; + sha256 = "0jgkpp90x4v3izl58r53lg5ndf9pm6q6qgwqvxhkb9zcha00ibgl"; + }; + + buildInputs = [ makeWrapper ]; + + installPhase = '' + mkdir -pv $out/docs + mv * $out + rm $out/bin/*.{bat,dll,exe,sh} + mv $out/COPYING $out/LICENSE* $out/docs + + for i in $out/bin/jruby{,.bash}; do + wrapProgram $i \ + --set JAVA_HOME ${jre} + done + + ln -s $out/bin/jruby $out/bin/ruby + + # Bundler tries to create this directory + mkdir -pv $out/${passthru.gemPath} + mkdir -p $out/nix-support + cat > $out/nix-support/setup-hook <<EOF + addGemPath() { + addToSearchPath GEM_PATH \$1/${passthru.gemPath} + } + + addEnvHooks "$hostOffset" addGemPath + EOF + ''; + + passthru = rec { + rubyEngine = "jruby"; + gemPath = "lib/${rubyEngine}/gems/${rubyVersion.libDir}"; + libPath = "lib/${rubyEngine}/${rubyVersion.libDir}"; + }; + + meta = { + description = "Ruby interpreter written in Java"; + homepage = http://jruby.org/; + license = with stdenv.lib.licenses; [ cpl10 gpl2 lgpl21 ]; + platforms = stdenv.lib.platforms.unix; + }; +}; +in jruby.overrideAttrs (oldAttrs: { + passthru = oldAttrs.passthru // { + devEnv = callPackage ../ruby/dev.nix { + ruby = jruby; + }; + }; +}) diff --git a/nixpkgs/pkgs/development/interpreters/jython/default.nix b/nixpkgs/pkgs/development/interpreters/jython/default.nix new file mode 100644 index 000000000000..e7bcef7bc3e0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/jython/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, makeWrapper, jre }: + +stdenv.mkDerivation rec { + name = "jython-${version}"; + + version = "2.7.1"; + + src = fetchurl { + url = "http://search.maven.org/remotecontent?filepath=org/python/jython-standalone/${version}/jython-standalone-${version}.jar"; + sha256 = "0jwc4ly75cna78blnisv4q8nfcn5s0g4wk7jf4d16j0rfcd0shf4"; + }; + + buildInputs = [ makeWrapper ]; + + unpackPhase = ":"; + + installPhase = '' + mkdir -pv $out/bin + cp $src $out/jython.jar + makeWrapper ${jre}/bin/java $out/bin/jython --add-flags "-jar $out/jython.jar" + ''; + + meta = { + description = "Python interpreter written in Java"; + homepage = http://jython.org/; + license = stdenv.lib.licenses.psfl; + platforms = jre.meta.platforms; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/kona/default.nix b/nixpkgs/pkgs/development/interpreters/kona/default.nix new file mode 100644 index 000000000000..03c836d9251a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/kona/default.nix @@ -0,0 +1,21 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + name = "kona-${version}"; + version = "3.21"; + src = fetchurl { + url = "https://github.com/kevinlawler/kona/archive/Win.${version}-64.tar.gz"; + sha256 = "0c1yf3idqkfq593xgqb25r2ykmfmp83zzh3q7kb8095a069gvri3"; + }; + + makeFlags = "PREFIX=$(out)"; + preInstall = ''mkdir -p "$out/bin"''; + + meta = with stdenv.lib; { + description = "An interpreter of K, APL-like programming language"; + homepage = https://github.com/kevinlawler/kona/; + maintainers = with maintainers; [ raskin ]; + platforms = platforms.all; + license = licenses.isc; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/lfe/1.2.nix b/nixpkgs/pkgs/development/interpreters/lfe/1.2.nix new file mode 100644 index 000000000000..b81acdaa499e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lfe/1.2.nix @@ -0,0 +1,7 @@ +{ mkDerivation }: + +mkDerivation { + version = "1.2.1"; + sha256 = "0j5gjlsk92y14kxgvd80q9vwyhmjkphpzadcswyjxikgahwg1avz"; + maximumOTPVersion = "19"; +} diff --git a/nixpkgs/pkgs/development/interpreters/lfe/generic-builder.nix b/nixpkgs/pkgs/development/interpreters/lfe/generic-builder.nix new file mode 100644 index 000000000000..fb034a471e7c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lfe/generic-builder.nix @@ -0,0 +1,86 @@ +{ stdenv, fetchFromGitHub, erlang, makeWrapper, coreutils, bash, buildRebar3, buildHex }: + +{ baseName ? "lfe" +, version +, maximumOTPVersion +, sha256 ? null +, rev ? version +, src ? fetchFromGitHub { inherit rev sha256; owner = "rvirding"; repo = "lfe"; } +}: + +let + inherit (stdenv.lib) getVersion versionAtLeast splitString head; + + mainVersion = head (splitString "." (getVersion erlang)); + + proper = buildHex { + name = "proper"; + version = "1.1.1-beta"; + + sha256 = "0hnkhs761yjynw9382w8wm4j3x0r7lllzavaq2kh9n7qy3zc1rdx"; + + configurePhase = '' + ${erlang}/bin/escript write_compile_flags include/compile_flags.hrl + ''; + }; + +in +assert versionAtLeast maximumOTPVersion mainVersion; + +buildRebar3 { + name = baseName; + + inherit src version; + + buildInputs = [ erlang makeWrapper ]; + beamDeps = [ proper ]; + patches = [ ./no-test-deps.patch ]; + doCheck = true; + checkTarget = "travis"; + + # These installPhase tricks are based on Elixir's Makefile. + # TODO: Make, upload, and apply a patch. + installPhase = '' + local libdir=$out/lib/lfe + local ebindir=$libdir/ebin + local bindir=$libdir/bin + + rm -Rf $ebindir + install -m755 -d $ebindir + install -m644 _build/default/lib/lfe/ebin/* $ebindir + + install -m755 -d $bindir + + for bin in bin/lfe{,c,doc,script}; do install -m755 $bin $bindir; done + + install -m755 -d $out/bin + for file in $bindir/*; do ln -sf $file $out/bin/; done + ''; + + # Thanks again, Elixir. + postFixup = '' + # LFE binaries are shell scripts which run erl and lfe. + # Add some stuff to PATH so the scripts can run without problems. + for f in $out/bin/*; do + wrapProgram $f \ + --prefix PATH ":" "${stdenv.lib.makeBinPath [ erlang coreutils bash ]}:$out/bin" + substituteInPlace $f --replace "/usr/bin/env" "${coreutils}/bin/env" + done + ''; + + meta = with stdenv.lib; { + description = "The best of Erlang and of Lisp; at the same time!"; + longDescription = '' + LFE, Lisp Flavoured Erlang, is a lisp syntax front-end to the Erlang + compiler. Code produced with it is compatible with "normal" Erlang + code. An LFE evaluator and shell is also included. + ''; + + homepage = "http://lfe.io"; + downloadPage = "https://github.com/rvirding/lfe/releases"; + + license = licenses.asl20; + maintainers = with maintainers; [ yurrriq ankhers ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/lfe/no-test-deps.patch b/nixpkgs/pkgs/development/interpreters/lfe/no-test-deps.patch new file mode 100644 index 000000000000..8c3faf1ff402 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lfe/no-test-deps.patch @@ -0,0 +1,13 @@ +diff --git a/rebar.config b/rebar.config +index 1d5a68e..ca33be7 100644 +--- a/rebar.config ++++ b/rebar.config +@@ -2,7 +2,7 @@ + + {erl_opts, [debug_info]}. + +-{profiles, [{test, [{deps, [proper]}]}]}. ++%% {profiles, [{test, [{deps, [proper]}]}]}. + + {pre_hooks, [{"(linux|darwin|solaris|freebsd|netbsd|openbsd)", ct, + "bin/lfe bin/lfec" diff --git a/nixpkgs/pkgs/development/interpreters/lolcode/default.nix b/nixpkgs/pkgs/development/interpreters/lolcode/default.nix new file mode 100644 index 000000000000..284773fe660f --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lolcode/default.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchurl, pkgconfig, doxygen, cmake, readline }: + +with stdenv.lib; +stdenv.mkDerivation rec { + + name = "lolcode-${version}"; + version = "0.11.2"; + + src = fetchurl { + url = "https://github.com/justinmeza/lci/archive/v${version}.tar.gz"; + sha256 = "1li7ikcrs7wqah7gqkirg0k61n6pm12w7pydin966x1sdn9na46b"; + }; + + nativeBuildInputs = [ pkgconfig cmake doxygen ]; + buildInputs = [ readline ]; + + # Maybe it clashes with lci scientific logic software package... + postInstall = "mv $out/bin/lci $out/bin/lolcode-lci"; + + meta = { + homepage = http://lolcode.org; + description = "An esoteric programming language"; + longDescription = '' + LOLCODE is a funny esoteric programming language, a bit Pascal-like, + whose keywords are LOLspeak. + ''; + license = licenses.gpl3; + maintainers = [ maintainers.AndersonTorres ]; + platforms = stdenv.lib.platforms.unix; + }; + +} diff --git a/nixpkgs/pkgs/development/interpreters/love/0.10.nix b/nixpkgs/pkgs/development/interpreters/love/0.10.nix new file mode 100644 index 000000000000..07ce9347cf70 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/love/0.10.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchFromBitbucket, pkgconfig, SDL2, libGLU_combined, openal, luajit, + libdevil, freetype, physfs, libmodplug, mpg123, libvorbis, libogg, + libtheora, which, autoconf, automake, libtool +}: + +let + pname = "love"; + version = "0.10.2"; +in + +stdenv.mkDerivation rec { + name = "${pname}-${version}"; + src = fetchFromBitbucket { + owner = "rude"; + repo = "love"; + rev = "${version}"; + sha256 = "19yfmlcx6w8yi4ndm5lni8lrsvnn77bxw5py0dc293nzzlaqa9ym"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + SDL2 libGLU_combined openal luajit libdevil freetype physfs libmodplug mpg123 + libvorbis libogg libtheora autoconf which libtool automake + ]; + + preConfigure = "$shell ./platform/unix/automagic"; + + configureFlags = [ + "--with-lua=luajit" + ]; + + NIX_CFLAGS_COMPILE = [ "-DluaL_reg=luaL_Reg" ]; # needed since luajit-2.1.0-beta3 + + meta = { + homepage = http://love2d.org; + description = "A Lua-based 2D game engine/scripting language"; + license = stdenv.lib.licenses.zlib; + platforms = stdenv.lib.platforms.linux; + maintainers = [ stdenv.lib.maintainers.raskin ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/love/0.7.nix b/nixpkgs/pkgs/development/interpreters/love/0.7.nix new file mode 100644 index 000000000000..884225b6483e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/love/0.7.nix @@ -0,0 +1,52 @@ +{ stdenv, fetchurl, pkgconfig +, SDL, libGLU_combined, openal, lua +, libdevil, freetype, physfs +, libmodplug, mpg123, libvorbis, libogg +}: + +stdenv.mkDerivation rec { + name = "love-0.7.2"; + src = fetchurl { + url = "https://bitbucket.org/rude/love/downloads/${name}-linux-src.tar.gz"; + sha256 = "0s7jywkvydlshlgy11ilzngrnybmq5xlgzp2v2dhlffwrfqdqym5"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + SDL libGLU_combined openal lua + libdevil freetype physfs libmodplug mpg123 libvorbis libogg + ]; + + preConfigure = '' + luaoptions="${"''"} lua luajit " + for i in lua luajit-; do + for j in 5 5.0 5.1 5.2 5.3 5.4; do + luaoptions="$luaoptions $i$j " + done + done + luaso="$(echo "${lua}/lib/"lib*.so.*)" + luaso="''${luaso##*/lib}" + luaso="''${luaso%%.so*}" + luaoptions="$luaoptions $luaso" + sed -e "s/${"''"} lua lua.*;/$luaoptions;/" -i configure + + luaincdir="$(echo "${lua}/include"/*/ )" + test -d "$luaincdir" && { + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$luaincdir" + } || true + ''; + + NIX_CFLAGS_COMPILE = '' + -I${SDL.dev}/include/SDL + -I${freetype.dev}include/freetype2 + ''; + + meta = { + homepage = http://love2d.org; + description = "A Lua-based 2D game engine/scripting language"; + license = stdenv.lib.licenses.zlib; + + platforms = stdenv.lib.platforms.linux; + maintainers = [ stdenv.lib.maintainers.raskin ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/love/0.8.nix b/nixpkgs/pkgs/development/interpreters/love/0.8.nix new file mode 100644 index 000000000000..5fbb34bf213a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/love/0.8.nix @@ -0,0 +1,52 @@ +{ stdenv, fetchurl, pkgconfig +, SDL, libGLU_combined, openal, lua +, libdevil, freetype, physfs +, libmodplug, mpg123, libvorbis, libogg +}: + +stdenv.mkDerivation rec { + name = "love-0.8.0"; + src = fetchurl { + url = "https://bitbucket.org/rude/love/downloads/${name}-linux-src.tar.gz"; + sha256 = "1k4fcsa8zzi04ja179bmj24hvqcbm3icfvrvrzyz2gw9qwfclrwi"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + SDL libGLU_combined openal lua + libdevil freetype physfs libmodplug mpg123 libvorbis libogg + ]; + + preConfigure = '' + luaoptions="${"''"} lua luajit " + for i in lua luajit-; do + for j in 5 5.0 5.1 5.2 5.3 5.4; do + luaoptions="$luaoptions $i$j " + done + done + luaso="$(echo "${lua}/lib/"lib*.so.*)" + luaso="''${luaso##*/lib}" + luaso="''${luaso%%.so*}" + luaoptions="$luaoptions $luaso" + sed -e "s/${"''"} lua lua.*;/$luaoptions;/" -i configure + + luaincdir="$(echo "${lua}/include"/*/ )" + test -d "$luaincdir" && { + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$luaincdir" + } || true + ''; + + NIX_CFLAGS_COMPILE = '' + -I${SDL.dev}/include/SDL + -I${freetype.dev}include/freetype2 + ''; + + meta = { + homepage = http://love2d.org; + description = "A Lua-based 2D game engine/scripting language"; + license = stdenv.lib.licenses.zlib; + + platforms = stdenv.lib.platforms.linux; + maintainers = [ stdenv.lib.maintainers.raskin ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/love/0.9.nix b/nixpkgs/pkgs/development/interpreters/love/0.9.nix new file mode 100644 index 000000000000..425239af2242 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/love/0.9.nix @@ -0,0 +1,34 @@ +{ stdenv, fetchurl, pkgconfig +, SDL2, libGLU_combined, openal, luajit +, libdevil, freetype, physfs +, libmodplug, mpg123, libvorbis, libogg +}: + +stdenv.mkDerivation rec { + name = "love-0.9.1"; + src = fetchurl { + url = "https://bitbucket.org/rude/love/downloads/${name}-linux-src.tar.gz"; + sha256 = "1pikd0bzb44r4bf0jbgn78whz1yswpq1n5jc8nf87v42pm30kp84"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + SDL2 libGLU_combined openal luajit + libdevil freetype physfs libmodplug mpg123 libvorbis libogg + ]; + + configureFlags = [ + "--with-lua=luajit" + ]; + + NIX_CFLAGS_COMPILE = [ "-DluaL_reg=luaL_Reg" ]; # needed since luajit-2.1.0-beta3 + + meta = { + homepage = http://love2d.org; + description = "A Lua-based 2D game engine/scripting language"; + license = stdenv.lib.licenses.zlib; + + platforms = stdenv.lib.platforms.linux; + maintainers = [ stdenv.lib.maintainers.raskin ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/love/11.1.nix b/nixpkgs/pkgs/development/interpreters/love/11.1.nix new file mode 100644 index 000000000000..7adaca7b8656 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/love/11.1.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchFromBitbucket, pkgconfig, SDL2, libGLU_combined, openal, luajit, + libdevil, freetype, physfs, libmodplug, mpg123, libvorbis, libogg, + libtheora, which, autoconf, automake, libtool +}: + +let + pname = "love"; + version = "11.2"; +in + +stdenv.mkDerivation rec { + name = "${pname}-${version}"; + src = fetchFromBitbucket { + owner = "rude"; + repo = "love"; + rev = "${version}"; + sha256 = "0q1lsgc1621czrg49nmabq6am9sgxa9syxrwzlksqqr4dyzw4nmf"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + SDL2 libGLU_combined openal luajit libdevil freetype physfs libmodplug mpg123 + libvorbis libogg libtheora autoconf which libtool automake + ]; + + preConfigure = "$shell ./platform/unix/automagic"; + + configureFlags = [ + "--with-lua=luajit" + ]; + + NIX_CFLAGS_COMPILE = [ "-DluaL_reg=luaL_Reg" ]; # needed since luajit-2.1.0-beta3 + + meta = { + homepage = http://love2d.org; + description = "A Lua-based 2D game engine/scripting language"; + license = stdenv.lib.licenses.zlib; + platforms = stdenv.lib.platforms.linux; + maintainers = [ stdenv.lib.maintainers.raskin ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/5.1.0004-Fix-stack-overflow-in-vararg-functions.patch b/nixpkgs/pkgs/development/interpreters/lua-5/5.1.0004-Fix-stack-overflow-in-vararg-functions.patch new file mode 100644 index 000000000000..31d3b8bdee76 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/5.1.0004-Fix-stack-overflow-in-vararg-functions.patch @@ -0,0 +1,21 @@ +From: Enrico Tassi <gareuselesinge@debian.org> +Date: Tue, 26 Aug 2014 16:20:55 +0200 +Subject: Fix stack overflow in vararg functions + +--- + src/ldo.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ldo.c b/src/ldo.c +index d1bf786..30333bf 100644 +--- a/src/ldo.c ++++ b/src/ldo.c +@@ -274,7 +274,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) { + CallInfo *ci; + StkId st, base; + Proto *p = cl->p; +- luaD_checkstack(L, p->maxstacksize); ++ luaD_checkstack(L, p->maxstacksize + p->numparams); + func = restorestack(L, funcr); + if (!p->is_vararg) { /* no varargs? */ + base = func + 1; diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/5.1.darwin.patch b/nixpkgs/pkgs/development/interpreters/lua-5/5.1.darwin.patch new file mode 100644 index 000000000000..b7754da79baf --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/5.1.darwin.patch @@ -0,0 +1,52 @@ +diff --git a/Makefile b/Makefile +index 209a132..9387b09 100644 +--- a/Makefile ++++ b/Makefile +@@ -43,7 +43,7 @@ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + # What to install. + TO_BIN= lua luac + TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp +-TO_LIB= liblua.a ++TO_LIB= liblua.5.1.5.dylib + TO_MAN= lua.1 luac.1 + + # Lua version and release. +@@ -64,6 +64,8 @@ install: dummy + cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) + cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) + cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) ++ ln -s -f liblua.5.1.5.dylib $(INSTALL_LIB)/liblua.5.1.dylib ++ ln -s -f liblua.5.1.dylib $(INSTALL_LIB)/liblua.dylib + + ranlib: + cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB) +diff --git a/src/Makefile b/src/Makefile +index e0d4c9f..4477d7b 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -22,7 +22,7 @@ MYLIBS= + + PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + +-LUA_A= liblua.a ++LUA_A= liblua.5.1.5.dylib + CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ + lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \ + lundump.o lvm.o lzio.o +@@ -48,11 +48,13 @@ o: $(ALL_O) + a: $(ALL_A) + + $(LUA_A): $(CORE_O) $(LIB_O) +- $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files +- $(RANLIB) $@ ++ $(CC) -dynamiclib -install_name $(out)/lib/liblua.5.1.dylib \ ++ -compatibility_version 5.1 -current_version 5.1.5 \ ++ -o liblua.5.1.5.dylib $^ + + $(LUA_T): $(LUA_O) $(LUA_A) +- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) ++ $(CC) -fno-common $(MYLDFLAGS) \ ++ -o $@ $(LUA_O) $(LUA_A) -L. -llua.5.1.5 $(LIBS) + + $(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/5.1.nix b/nixpkgs/pkgs/development/interpreters/lua-5/5.1.nix new file mode 100644 index 000000000000..09af492490cf --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/5.1.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchurl, readline }: + +let + dsoPatch = fetchurl { + url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/lua-arch.patch?h=packages/lua51"; + sha256 = "11fcyb4q55p4p7kdb8yp85xlw8imy14kzamp2khvcyxss4vw8ipw"; + name = "lua-arch.patch"; + }; +in +stdenv.mkDerivation rec { + name = "lua-${version}"; + version = "5.1.5"; + luaversion = "5.1"; + + src = fetchurl { + url = "https://www.lua.org/ftp/${name}.tar.gz"; + sha256 = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333"; + }; + + buildInputs = [ readline ]; + + patches = (if stdenv.isDarwin then [ ./5.1.darwin.patch ] else [ dsoPatch ]) + ++ [ ./5.1.0004-Fix-stack-overflow-in-vararg-functions.patch ]; + + configurePhase = + if stdenv.isDarwin + then '' + makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2" LDFLAGS="" CC="$CC" ) + installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.5.1.5.dylib" INSTALL_DATA='cp -d' ) + '' else '' + makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=linux CFLAGS="-DLUA_USE_LINUX -O2 -fPIC" LDFLAGS="-fPIC" CC="$CC" AR="$AR q" RANLIB="$RANLIB" ) + installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.a liblua.so liblua.so.5.1 liblua.so.5.1.5" INSTALL_DATA='cp -d' ) + ''; + + postInstall = '' + mkdir -p "$out/share/doc/lua" "$out/lib/pkgconfig" + sed <"etc/lua.pc" >"$out/lib/pkgconfig/lua.pc" -e "s|^prefix=.*|prefix=$out|" + mv "doc/"*.{gif,png,css,html} "$out/share/doc/lua/" + rmdir $out/{share,lib}/lua/5.1 $out/{share,lib}/lua + ''; + + meta = { + homepage = http://www.lua.org; + description = "Powerful, fast, lightweight, embeddable scripting language"; + longDescription = '' + Lua combines simple procedural syntax with powerful data + description constructs based on associative arrays and extensible + semantics. Lua is dynamically typed, runs by interpreting bytecode + for a register-based virtual machine, and has automatic memory + management with incremental garbage collection, making it ideal + for configuration, scripting, and rapid prototyping. + ''; + license = stdenv.lib.licenses.mit; + hydraPlatforms = stdenv.lib.platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/5.2.darwin.patch b/nixpkgs/pkgs/development/interpreters/lua-5/5.2.darwin.patch new file mode 100644 index 000000000000..be0e206bbfc7 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/5.2.darwin.patch @@ -0,0 +1,52 @@ +diff --git a/Makefile b/Makefile +index d2c7db4..dc107b3 100644 +--- a/Makefile ++++ b/Makefile +@@ -41,7 +41,7 @@ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + # What to install. + TO_BIN= lua luac + TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp +-TO_LIB= liblua.a ++TO_LIB= liblua.${version}.dylib + TO_MAN= lua.1 luac.1 + + # Lua version and release. +@@ -63,6 +63,8 @@ install: dummy + cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) + cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) + cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) ++ ln -s -f liblua.${version}.dylib $(INSTALL_LIB)/liblua.${luaversion}.dylib ++ ln -s -f liblua.${luaversion}.dylib $(INSTALL_LIB)/liblua.dylib + + uninstall: + cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN) +diff --git a/src/Makefile b/src/Makefile +index 7b4b2b7..25001e5 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -28,7 +28,7 @@ MYOBJS= + + PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris + +-LUA_A= liblua.a ++LUA_A= liblua.${version}.dylib + CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ + lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \ + ltm.o lundump.o lvm.o lzio.o +@@ -56,11 +56,13 @@ o: $(ALL_O) + a: $(ALL_A) + + $(LUA_A): $(BASE_O) +- $(AR) $@ $(BASE_O) +- $(RANLIB) $@ ++ $(CC) -dynamiclib -install_name $(out)/lib/liblua.${version}.dylib \ ++ -compatibility_version ${version} -current_version ${version} \ ++ -o liblua.${version}.dylib $^ + + $(LUA_T): $(LUA_O) $(LUA_A) +- $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) ++ $(CC) -fno-common $(MYLDFLAGS) \ ++ -o $@ $(LUA_O) $(LUA_A) -L. -llua.${version} $(LIBS) + + $(LUAC_T): $(LUAC_O) $(LUA_A) + $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/5.2.nix b/nixpkgs/pkgs/development/interpreters/lua-5/5.2.nix new file mode 100644 index 000000000000..a8badf647c0c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/5.2.nix @@ -0,0 +1,71 @@ +{ stdenv, fetchurl, readline, compat ? false }: + +let + dsoPatch = fetchurl { + url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/liblua.so.patch?h=packages/lua52"; + sha256 = "1by1dy4ql61f5c6njq9ibf9kaqm3y633g2q8j54iyjr4cxvqwqz9"; + name = "lua-arch.patch"; + }; +in +stdenv.mkDerivation rec { + name = "lua-${version}"; + luaversion = "5.2"; + version = "${luaversion}.4"; + + src = fetchurl { + url = "https://www.lua.org/ftp/${name}.tar.gz"; + sha256 = "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"; + }; + + buildInputs = [ readline ]; + + patches = if stdenv.isDarwin then [ ./5.2.darwin.patch ] else [ dsoPatch ]; + + configurePhase = + if stdenv.isDarwin + then '' + makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2 -fPIC${if compat then " -DLUA_COMPAT_ALL" else ""}" LDFLAGS="-fPIC" V=${luaversion} R=${version} CC="$CC" ) + installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.${version}.dylib" INSTALL_DATA='cp -d' ) + '' else '' + makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=linux CFLAGS="-DLUA_USE_LINUX -O2 -fPIC${if compat then " -DLUA_COMPAT_ALL" else ""}" LDFLAGS="-fPIC" V=${luaversion} R=${version} CC="$CC" AR="$AR q" RANLIB="$RANLIB" ) + installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.a liblua.so liblua.so.${luaversion} liblua.so.${version}" INSTALL_DATA='cp -d' ) + ''; + + postInstall = '' + mkdir -p "$out/share/doc/lua" "$out/lib/pkgconfig" + mv "doc/"*.{gif,png,css,html} "$out/share/doc/lua/" + rmdir $out/{share,lib}/lua/${luaversion} $out/{share,lib}/lua + mkdir -p "$out/lib/pkgconfig" + cat >"$out/lib/pkgconfig/lua.pc" <<EOF + prefix=$out + libdir=$out/lib + includedir=$out/include + INSTALL_BIN=$out/bin + INSTALL_INC=$out/include + INSTALL_LIB=$out/lib + INSTALL_MAN=$out/man/man1 + + Name: Lua + Description: An Extensible Extension Language + Version: ${version} + Requires: + Libs: -L$out/lib -llua -lm + Cflags: -I$out/include + EOF + ''; + + meta = { + homepage = http://www.lua.org; + description = "Powerful, fast, lightweight, embeddable scripting language"; + longDescription = '' + Lua combines simple procedural syntax with powerful data + description constructs based on associative arrays and extensible + semantics. Lua is dynamically typed, runs by interpreting bytecode + for a register-based virtual machine, and has automatic memory + management with incremental garbage collection, making it ideal + for configuration, scripting, and rapid prototyping. + ''; + license = stdenv.lib.licenses.mit; + platforms = stdenv.lib.platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/5.3.nix b/nixpkgs/pkgs/development/interpreters/lua-5/5.3.nix new file mode 100644 index 000000000000..eb34391e1993 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/5.3.nix @@ -0,0 +1,71 @@ +{ stdenv, fetchurl, readline, compat ? false }: + +stdenv.mkDerivation rec { + name = "lua-${version}"; + luaversion = "5.3"; + version = "${luaversion}.5"; + + src = fetchurl { + url = "https://www.lua.org/ftp/${name}.tar.gz"; + sha256 = "0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac"; + }; + + buildInputs = [ readline ]; + + patches = if stdenv.isDarwin then [ ./5.2.darwin.patch ] else []; + + configurePhase = + if stdenv.isDarwin + then '' + makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2 -fPIC${if compat then " -DLUA_COMPAT_ALL" else ""}" LDFLAGS="-fPIC" V=${luaversion} R=${version} CC="$CC" ) + installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.${version}.dylib" INSTALL_DATA='cp -d' ) + '' else '' + makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=linux CFLAGS="-DLUA_USE_LINUX -O2 -fPIC${if compat then " -DLUA_COMPAT_ALL" else ""}" LDFLAGS="-fPIC" V=${luaversion} R=${version} CC="$CC" AR="$AR q" RANLIB="$RANLIB" ) + installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.a liblua.so liblua.so.${luaversion} liblua.so.${version}" INSTALL_DATA='cp -d' ) + cat ${./lua-5.3-dso.make} >> src/Makefile + sed -e 's/ALL_T *= */& $(LUA_SO)/' -i src/Makefile + ''; + + postBuild = stdenv.lib.optionalString (! stdenv.isDarwin) '' + ( cd src; make liblua.so "''${makeFlagsArray[@]}" ) + ''; + + postInstall = '' + mkdir -p "$out/share/doc/lua" "$out/lib/pkgconfig" + mv "doc/"*.{gif,png,css,html} "$out/share/doc/lua/" + rmdir $out/{share,lib}/lua/${luaversion} $out/{share,lib}/lua + mkdir -p "$out/lib/pkgconfig" + cat >"$out/lib/pkgconfig/lua.pc" <<EOF + prefix=$out + libdir=$out/lib + includedir=$out/include + INSTALL_BIN=$out/bin + INSTALL_INC=$out/include + INSTALL_LIB=$out/lib + INSTALL_MAN=$out/man/man1 + + Name: Lua + Description: An Extensible Extension Language + Version: ${version} + Requires: + Libs: -L$out/lib -llua -lm + Cflags: -I$out/include + EOF + ln -s "$out/lib/pkgconfig/lua.pc" "$out/lib/pkgconfig/lua${luaversion}.pc" + ''; + + meta = { + homepage = http://www.lua.org; + description = "Powerful, fast, lightweight, embeddable scripting language"; + longDescription = '' + Lua combines simple procedural syntax with powerful data + description constructs based on associative arrays and extensible + semantics. Lua is dynamically typed, runs by interpreting bytecode + for a register-based virtual machine, and has automatic memory + management with incremental garbage collection, making it ideal + for configuration, scripting, and rapid prototyping. + ''; + license = stdenv.lib.licenses.mit; + platforms = stdenv.lib.platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/filesystem.nix b/nixpkgs/pkgs/development/interpreters/lua-5/filesystem.nix new file mode 100644 index 000000000000..7aa41e95cc9b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/filesystem.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchurl, lua5 }: + +stdenv.mkDerivation rec { + version = "1.6.2"; + name = "lua-filesystem-${version}"; + isLibrary = true; + src = fetchurl { + url = "https://github.com/keplerproject/luafilesystem/archive/v1_6_2.tar.gz"; + sha256 = "1n8qdwa20ypbrny99vhkmx8q04zd2jjycdb5196xdhgvqzk10abz"; + }; + + buildInputs = [ lua5 ]; + + preBuild = '' + makeFlagsArray=( + PREFIX=$out + LUA_LIBDIR="$out/lib/lua/${lua5.luaversion}" + LUA_INC="-I${lua5}/include"); + ''; + + meta = { + homepage = https://github.com/keplerproject/luafilesystem; + hydraPlatforms = stdenv.lib.platforms.linux; + maintainers = [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/lua-5.3-dso.make b/nixpkgs/pkgs/development/interpreters/lua-5/lua-5.3-dso.make new file mode 100644 index 000000000000..c70dbc4f9cc2 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/lua-5.3-dso.make @@ -0,0 +1,8 @@ + +LUA_SO=liblua.so + +$(LUA_SO): $(CORE_O) $(LIB_O) + $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS) + ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V) + ln -sf $(LUA_SO).$(R) $(LUA_SO) + diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/sockets.nix b/nixpkgs/pkgs/development/interpreters/lua-5/sockets.nix new file mode 100644 index 000000000000..d8a789e9209e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/sockets.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchurl, lua5 }: + +stdenv.mkDerivation rec { + name = "lua-sockets-${version}"; + version = "2.0.2"; + src = fetchurl { + url = "http://files.luaforge.net/releases/luasocket/luasocket/luasocket-${version}/luasocket-${version}.tar.gz"; + sha256 = "19ichkbc4rxv00ggz8gyf29jibvc2wq9pqjik0ll326rrxswgnag"; + }; + + luaver = lua5.luaversion; + patchPhase = '' + sed -e "s,^INSTALL_TOP_SHARE.*,INSTALL_TOP_SHARE=$out/share/lua/${lua5.luaversion}," \ + -e "s,^INSTALL_TOP_LIB.*,INSTALL_TOP_LIB=$out/lib/lua/${lua5.luaversion}," \ + -i config + ''; + + buildInputs = [ lua5 ]; + + meta = { + homepage = http://w3.impa.br/~diego/software/luasocket/; + hydraPlatforms = stdenv.lib.platforms.linux; + maintainers = [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/zip.nix b/nixpkgs/pkgs/development/interpreters/lua-5/zip.nix new file mode 100644 index 000000000000..295f41aaa2b8 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/zip.nix @@ -0,0 +1,28 @@ +{ pkgs, stdenv, fetchurl, lua5_1, zziplib }: + +stdenv.mkDerivation rec { + version = "1.2.3"; + name = "lua-zip-${version}"; + isLibrary = true; + src = fetchurl { + url = "https://github.com/luaforge/luazip/archive/0b8f5c958e170b1b49f05bc267bc0351ad4dfc44.zip"; + sha256 = "beb9260d606fdd5304aa958d95f0d3c20be7ca0a2cff44e7b75281c138a76a50"; + }; + + buildInputs = [ pkgs.unzip lua5_1 zziplib ]; + + preBuild = '' + makeFlagsArray=( + PREFIX=$out + LUA_LIBDIR="$out/lib/lua/${lua5_1.luaversion}" + LUA_INC="-I${lua5_1}/include"); + ''; + + patches = [ ./zip.patch ]; + + meta = { + homepage = https://github.com/luaforge/luazip; + hydraPlatforms = stdenv.lib.platforms.linux; + license = stdenv.lib.licenses.mit; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/zip.patch b/nixpkgs/pkgs/development/interpreters/lua-5/zip.patch new file mode 100644 index 000000000000..c3f88f451e8d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/zip.patch @@ -0,0 +1,23 @@ +--- a/Makefile 2007-10-30 01:59:10.000000000 +0300 ++++ b/Makefile 2014-09-18 11:04:53.176320021 +0400 +@@ -6,10 +6,6 @@ + + include $(CONFIG) + +-ifeq "$(LUA_VERSION_NUM)" "500" +-COMPAT_O= $(COMPAT_DIR)/compat-5.1.o +-endif +- + SRCS= src/lua$T.c + OBJS= src/lua$T.o $(COMPAT_O) + +@@ -19,9 +15,6 @@ + src/$(LIBNAME): $(OBJS) + export MACOSX_DEPLOYMENT_TARGET="10.3"; $(CC) $(CFLAGS) $(LIB_OPTION) -o src/$(LIBNAME) $(OBJS) -lzzip + +-$(COMPAT_DIR)/compat-5.1.o: $(COMPAT_DIR)/compat-5.1.c +- $(CC) -c $(CFLAGS) -o $@ $(COMPAT_DIR)/compat-5.1.c +- + install: src/$(LIBNAME) + mkdir -p $(LUA_LIBDIR) + cp src/$(LIBNAME) $(LUA_LIBDIR) diff --git a/nixpkgs/pkgs/development/interpreters/luajit/default.nix b/nixpkgs/pkgs/development/interpreters/luajit/default.nix new file mode 100644 index 000000000000..9ee628f498ee --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/luajit/default.nix @@ -0,0 +1,71 @@ +{ stdenv, lib, fetchurl }: +rec { + + luajit = luajit_2_1; + + luajit_2_0 = generic { + version = "2.0.5"; + isStable = true; + sha256 = "0yg9q4q6v028bgh85317ykc9whgxgysp76qzaqgq55y6jy11yjw7"; + meta = genericMeta // { + platforms = lib.filter (p: p != "aarch64-linux") genericMeta.platforms; + }; + }; + + luajit_2_1 = generic { + version = "2.1.0-beta3"; + isStable = false; + sha256 = "1hyrhpkwjqsv54hnnx4cl8vk44h9d6c9w0fz1jfjz00w255y7lhs"; + }; + + genericMeta = with stdenv.lib; { + description = "High-performance JIT compiler for Lua 5.1"; + homepage = http://luajit.org; + license = licenses.mit; + platforms = platforms.linux ++ platforms.darwin; + maintainers = with maintainers; [ thoughtpolice smironov vcunat andir ]; + }; + + generic = + { version, sha256 ? null, isStable + , name ? "luajit-${version}" + , src ? + (fetchurl { + url = "http://luajit.org/download/LuaJIT-${version}.tar.gz"; + inherit sha256; + }) + , meta ? genericMeta + }: + + stdenv.mkDerivation rec { + inherit name version src meta; + + luaversion = "5.1"; + + patchPhase = '' + substituteInPlace Makefile \ + --replace /usr/local "$out" + + substituteInPlace src/Makefile --replace gcc cc + '' + stdenv.lib.optionalString (stdenv.cc.libc != null) + '' + substituteInPlace Makefile \ + --replace ldconfig ${stdenv.cc.libc.bin or stdenv.cc.libc}/bin/ldconfig + ''; + + configurePhase = false; + + buildFlags = [ "amalg" ]; # Build highly optimized version + enableParallelBuilding = true; + + installPhase = '' + make install PREFIX="$out" + ( cd "$out/include"; ln -s luajit-*/* . ) + ln -s "$out"/bin/luajit-* "$out"/bin/lua + '' + + stdenv.lib.optionalString (!isStable) + '' + ln -s "$out"/bin/luajit-* "$out"/bin/luajit + ''; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/lush/default.nix b/nixpkgs/pkgs/development/interpreters/lush/default.nix new file mode 100644 index 000000000000..9575409f9868 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lush/default.nix @@ -0,0 +1,29 @@ +{stdenv, fetchurl, libX11, xproto, indent, readline, gsl, freeglut, libGLU_combined, SDL +, blas, libbfd, intltool, gettext, zlib, libSM}: + +stdenv.mkDerivation rec { + baseName = "lush"; + version = "2.0.1"; + name = "${baseName}-${version}"; + + src = fetchurl { + url="mirror://sourceforge/project/lush/lush2/lush-2.0.1.tar.gz"; + sha256 = "02pkfn3nqdkm9fm44911dbcz0v3r0l53vygj8xigl6id5g3iwi4k"; + }; + + buildInputs = [ + libX11 libSM xproto indent readline gsl freeglut libGLU_combined SDL blas libbfd + intltool gettext zlib + ]; + + hardeningDisable = [ "pic" ]; + + NIX_LDFLAGS=" -lz "; + + meta = { + description = "Lisp Universal SHell"; + license = stdenv.lib.licenses.gpl2Plus ; + maintainers = [ stdenv.lib.maintainers.raskin ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/lush/default.upstream b/nixpkgs/pkgs/development/interpreters/lush/default.upstream new file mode 100644 index 000000000000..8a8b08fcd68a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lush/default.upstream @@ -0,0 +1,4 @@ +url https://sourceforge.net/projects/lush/files/lush2/ +version_link '[.]tar[.]gz/download$' +SF_redirect +minimize_overwrite diff --git a/nixpkgs/pkgs/development/interpreters/maude/default.nix b/nixpkgs/pkgs/development/interpreters/maude/default.nix new file mode 100644 index 000000000000..30013946886b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/maude/default.nix @@ -0,0 +1,72 @@ +{ stdenv, fetchurl, unzip, makeWrapper , flex, bison, ncurses, buddy, tecla +, libsigsegv, gmpxx, cln +}: + +let + + version = "2.7.1"; + + fullMaude = fetchurl { + url = "http://maude.cs.illinois.edu/w/images/c/ca/Full-Maude-${version}.zip"; + sha256 = "0y4gn7n8vh24r24vckhpkd46hb5hqsbrm4w9zr6dz4paafq12fjc"; + }; + +in + +stdenv.mkDerivation rec { + name = "maude-${version}"; + + src = fetchurl { + url = "http://maude.cs.illinois.edu/w/images/d/d8/Maude-${version}.tar.gz"; + sha256 = "0jskn5dm8vvbd3mlryjxdb6wfpkvyx174wk7ci9a31aylxzpr25i"; + }; + + buildInputs = [ + flex bison ncurses buddy tecla gmpxx libsigsegv makeWrapper unzip cln + ]; + + hardeningDisable = [ "stackprotector" ] ++ + stdenv.lib.optionals stdenv.isi686 [ "pic" "fortify" ]; + + preConfigure = '' + configureFlagsArray=( + --datadir="$out/share/maude" + TECLA_LIBS="-ltecla -lncursesw" + LIBS="-lcln" + CFLAGS="-O3" CXXFLAGS="-O3" + --without-cvc4 # Our version is too new for Maude to cope. + ) + ''; + + doCheck = true; + + postInstall = '' + for n in "$out/bin/"*; do wrapProgram "$n" --suffix MAUDE_LIB ':' "$out/share/maude"; done + unzip ${fullMaude} + install -D -m 444 full-maude.maude $out/share/maude/full-maude.maude + ''; + + # bison -dv surface.yy -o surface.c + # mv surface.c surface.cc + # mv: cannot stat 'surface.c': No such file or directory + enableParallelBuilding = false; + + meta = { + homepage = http://maude.cs.illinois.edu/; + description = "High-level specification language"; + license = stdenv.lib.licenses.gpl2; + + longDescription = '' + Maude is a high-performance reflective language and system + supporting both equational and rewriting logic specification and + programming for a wide range of applications. Maude has been + influenced in important ways by the OBJ3 language, which can be + regarded as an equational logic sublanguage. Besides supporting + equational specification and programming, Maude also supports + rewriting logic computation. + ''; + + platforms = stdenv.lib.platforms.unix; + maintainers = [ stdenv.lib.maintainers.peti ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/metamath/default.nix b/nixpkgs/pkgs/development/interpreters/metamath/default.nix new file mode 100644 index 000000000000..2fb1ccb24bc4 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/metamath/default.nix @@ -0,0 +1,34 @@ +{ stdenv, fetchFromGitHub, autoreconfHook }: + +stdenv.mkDerivation rec { + name = "metamath-${version}"; + version = "0.168"; + + buildInputs = [ autoreconfHook ]; + + # This points to my own repository because there is no official repository + # for metamath; there's a download location but it gets updated in place with + # no permanent link. See discussion at + # https://groups.google.com/forum/#!topic/metamath/N4WEWQQVUfY + src = fetchFromGitHub { + owner = "Taneb"; + repo = "metamath"; + rev = "542bfd5e53d8ce026ce5d29da9e7069ec807f5e0"; + sha256 = "07ssgqh9ipiw1bf60snmjaxngln1an1h9q0vgszadc94wzw06zi4"; + }; + + meta = with stdenv.lib; { + description = "Interpreter for the metamath proof language"; + longDescription = '' + The metamath program is an ASCII-based ANSI C program with a command-line + interface. It was used (along with mmj2) to build and verify the proofs + in the Metamath Proof Explorer, and it generated its web pages. The *.mm + ASCII databases (set.mm and others) are also included in this derivation. + ''; + homepage = http://us.metamath.org; + downloadPage = "http://us.metamath.org/#downloads"; + license = licenses.gpl2; + maintainers = [ maintainers.taneb ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/mujs/default.nix b/nixpkgs/pkgs/development/interpreters/mujs/default.nix new file mode 100644 index 000000000000..c7663a116763 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/mujs/default.nix @@ -0,0 +1,23 @@ +{ stdenv, fetchgit, clang }: + +stdenv.mkDerivation rec { + name = "mujs-2017-01-24"; + + src = fetchgit { + url = git://git.ghostscript.com/mujs.git; + rev = "4006739a28367c708dea19aeb19b8a1a9326ce08"; + sha256 = "0wvjl8lkh0ga6fkmxgjqq77yagncbv1bdy6hpnxq31x3mkwn1s51"; + }; + + buildInputs = [ clang ]; + + makeFlags = [ "prefix=$(out)" ]; + + meta = with stdenv.lib; { + homepage = http://mujs.com/; + description = "A lightweight, embeddable Javascript interpreter"; + platforms = stdenv.lib.platforms.linux; + maintainers = with maintainers; [ pSub ]; + license = licenses.gpl3; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/nix-exec/default.nix b/nixpkgs/pkgs/development/interpreters/nix-exec/default.nix new file mode 100644 index 000000000000..277993339e23 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/nix-exec/default.nix @@ -0,0 +1,23 @@ +{ stdenv, fetchurl, pkgconfig, nix, git }: let + version = "4.1.6"; +in stdenv.mkDerivation { + name = "nix-exec-${version}"; + + src = fetchurl { + url = "https://github.com/shlevy/nix-exec/releases/download/v${version}/nix-exec-${version}.tar.xz"; + sha256 = "0slpsnzzzdkf5d9za7j4kr15jr4mn1k9klfsxibzy47b2bx1vkar"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ nix git ]; + + NIX_CFLAGS_COMPILE = "-std=c++1y"; + + meta = { + description = "Run programs defined in nix expressions"; + homepage = https://github.com/shlevy/nix-exec; + license = stdenv.lib.licenses.mit; + platforms = nix.meta.platforms; + broken = true; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/octave/default.nix b/nixpkgs/pkgs/development/interpreters/octave/default.nix new file mode 100644 index 000000000000..cbe919c70929 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/octave/default.nix @@ -0,0 +1,88 @@ +{ stdenv, fetchurl, gfortran, readline, ncurses, perl, flex, texinfo, qhull +, libsndfile, portaudio, libX11, graphicsmagick, pcre, pkgconfig, libGLU_combined, fltk +, fftw, fftwSinglePrec, zlib, curl, qrupdate, openblas, arpack, libwebp +, qt ? null, qscintilla ? null, ghostscript ? null, llvm ? null, hdf5 ? null,glpk ? null +, suitesparse ? null, gnuplot ? null, jdk ? null, python ? null, overridePlatforms ? null +}: + +let + suitesparseOrig = suitesparse; + qrupdateOrig = qrupdate; +in +# integer width is determined by openblas, so all dependencies must be built +# with exactly the same openblas +let + suitesparse = + if suitesparseOrig != null then suitesparseOrig.override { inherit openblas; } else null; + qrupdate = if qrupdateOrig != null then qrupdateOrig.override { inherit openblas; } else null; +in + +stdenv.mkDerivation rec { + version = "4.4.1"; + name = "octave-${version}"; + src = fetchurl { + url = "mirror://gnu/octave/${name}.tar.gz"; + sha256 = "15xfcx6dc7p204b92i7va2a7ygff637l370x7zjj3vzl2brd1yq9"; + }; + + buildInputs = [ gfortran readline ncurses perl flex texinfo qhull + graphicsmagick pcre pkgconfig fltk zlib curl openblas libsndfile fftw + fftwSinglePrec portaudio qrupdate arpack libwebp ] + ++ (stdenv.lib.optional (qt != null) qt) + ++ (stdenv.lib.optional (qscintilla != null) qscintilla) + ++ (stdenv.lib.optional (ghostscript != null) ghostscript) + ++ (stdenv.lib.optional (llvm != null) llvm) + ++ (stdenv.lib.optional (hdf5 != null) hdf5) + ++ (stdenv.lib.optional (glpk != null) glpk) + ++ (stdenv.lib.optional (suitesparse != null) suitesparse) + ++ (stdenv.lib.optional (jdk != null) jdk) + ++ (stdenv.lib.optional (gnuplot != null) gnuplot) + ++ (stdenv.lib.optional (python != null) python) + ++ (stdenv.lib.optionals (!stdenv.isDarwin) [ libGLU_combined libX11 ]) + ; + + # makeinfo is required by Octave at runtime to display help + prePatch = '' + substituteInPlace libinterp/corefcn/help.cc \ + --replace 'Vmakeinfo_program = "makeinfo"' \ + 'Vmakeinfo_program = "${texinfo}/bin/makeinfo"' + ''; + + doCheck = !stdenv.isDarwin; + + enableParallelBuilding = true; + + # See https://savannah.gnu.org/bugs/?50339 + F77_INTEGER_8_FLAG = if openblas.blas64 then "-fdefault-integer-8" else ""; + + configureFlags = + [ "--enable-readline" + "--enable-dl" + "--with-blas=openblas" + "--with-lapack=openblas" + ] + ++ stdenv.lib.optional openblas.blas64 "--enable-64" + ++ stdenv.lib.optionals stdenv.isDarwin ["--with-x=no"] + ; + + # Keep a copy of the octave tests detailed results in the output + # derivation, because someone may care + postInstall = '' + cp test/fntests.log $out/share/octave/${name}-fntests.log || true + ''; + + passthru = { + inherit version; + sitePath = "share/octave/${version}/site"; + }; + + meta = { + homepage = http://octave.org/; + license = stdenv.lib.licenses.gpl3Plus; + maintainers = with stdenv.lib.maintainers; [raskin]; + description = "Scientific Pragramming Language"; + platforms = if overridePlatforms == null then + (with stdenv.lib.platforms; linux ++ darwin) + else overridePlatforms; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/octave/hg.nix b/nixpkgs/pkgs/development/interpreters/octave/hg.nix new file mode 100644 index 000000000000..a34834af48cb --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/octave/hg.nix @@ -0,0 +1,75 @@ +args@{ stdenv, openblas, ghostscript ? null, texinfo + + , # These are arguments that shouldn't be passed to the + # octave package. + texlive, tex ? texlive.combined.scheme-small + , epstool, pstoedit, transfig + , lib, fetchhg, callPackage + , autoconf, automake, libtool + , bison, librsvg, icoutils, gperf + + , # These are options that can be passed in addition to the ones + # octave usually takes. + # - rev is the HG revision. Use "tip" for the bleeding edge. + # - docs can be set to false to skip building documentation. + rev ? "23269", docs ? true + + , # All remaining arguments will be passed to the octave package. + ... + }: + +with stdenv.lib; +let + octaveArgs = removeAttrs args + [ "texlive" "tex" + "epstool" "pstoedit" "transfig" + "lib" "fetchhg" "callPackage" + "autoconf" "automake" "libtool" + "bison" "librsvg" "icoutils" "gperf" + "rev" "docs" + ]; + octave = callPackage ./default.nix octaveArgs; + + # List of hashes for known HG revisions. + sha256s = { + "23269" = "87f560e873ad1454fdbcdd8aca65f9f0b1e605bdc00aebbdc4f9d862ca72ff1d"; + }; + +in lib.overrideDerivation octave (attrs: rec { + version = "4.3.0pre${rev}"; + name = "octave-${version}"; + + src = fetchhg { + url = http://www.octave.org/hg/octave; + inherit rev; + + sha256 = + if builtins.hasAttr rev sha256s + then builtins.getAttr rev sha256s + else null; + + fetchSubrepos = true; + }; + + # Octave's test for including this flag seems to be broken in 4.3. + F77_INTEGER_8_FLAG = optional openblas.blas64 "-fdefault-integer-8"; + + # This enables texinfo to find the files it needs. + TEXINPUTS = ".:build-aux:${texinfo}/texmf-dist/tex/generic/epsf:"; + + disableDocs = !docs || ghostscript == null; + + nativeBuildInputs = attrs.nativeBuildInputs + ++ [ autoconf automake libtool bison librsvg icoutils gperf ] + ++ optionals (!disableDocs) [ tex epstool pstoedit transfig ]; + + # Run bootstrap before any other patches, as other patches may refer + # to files that are generated by the bootstrap. + prePatch = '' + patchShebangs bootstrap + ./bootstrap + '' + attrs.prePatch; + + configureFlags = attrs.configureFlags ++ + optional disableDocs "--disable-docs"; +}) diff --git a/nixpkgs/pkgs/development/interpreters/perl/MakeMaker-cross.patch b/nixpkgs/pkgs/development/interpreters/perl/MakeMaker-cross.patch new file mode 100644 index 000000000000..40626c51f9bd --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/MakeMaker-cross.patch @@ -0,0 +1,17 @@ +diff -Naur a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm +--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 2017-06-30 17:03:20.000000000 -0400 ++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 2018-02-28 10:06:37.031237946 -0500 +@@ -1267,7 +1267,12 @@ + my $value = shift; + return $value if $UNDER_CORE; + my $tvalue = ''; +- require B; ++ eval { ++ require B; ++ }; ++ if ($@) { ++ return $tvalue; ++ } + my $sv = B::svref_2object(\$value); + my $magic = ref($sv) eq 'B::PVMG' ? $sv->MAGIC : undef; + while ( $magic ) { diff --git a/nixpkgs/pkgs/development/interpreters/perl/cpp-precomp.patch b/nixpkgs/pkgs/development/interpreters/perl/cpp-precomp.patch new file mode 100644 index 000000000000..231853fe51a6 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/cpp-precomp.patch @@ -0,0 +1,11 @@ +--- a/hints/darwin.sh 2013-05-08 11:13:45.000000000 -0600 ++++ b/hints/darwin.sh 2013-05-08 11:15:04.000000000 -0600 +@@ -129,7 +129,7 @@ + + # Avoid Apple's cpp precompiler, better for extensions + if [ "X`echo | ${cc} -no-cpp-precomp -E - 2>&1 >/dev/null`" = "X" ]; then +- cppflags="${cppflags} -no-cpp-precomp" ++ #cppflags="${cppflags} -no-cpp-precomp" + + # This is necessary because perl's build system doesn't + # apply cppflags to cc compile lines as it should. diff --git a/nixpkgs/pkgs/development/interpreters/perl/default.nix b/nixpkgs/pkgs/development/interpreters/perl/default.nix new file mode 100644 index 000000000000..8d21d92ef430 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/default.nix @@ -0,0 +1,192 @@ +{ lib, stdenv, fetchurlBoot, buildPackages +, enableThreading ? stdenv ? glibc, makeWrapper +}: + +with lib; + +# We can only compile perl with threading on platforms where we have a +# real glibc in the stdenv. +# +# Instead of silently building an unthreaded perl if this is not the +# case, we force callers to disableThreading explicitly, therefore +# documenting the platforms where the perl is not threaded. +# +# In the case of stdenv linux boot stage1 it's not possible to use +# threading because of the simpleness of the bootstrap glibc, so we +# use enableThreading = false there. +assert enableThreading -> (stdenv ? glibc); + +let + + libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr"; + libcInc = lib.getDev libc; + libcLib = lib.getLib libc; + crossCompiling = stdenv.buildPlatform != stdenv.hostPlatform; + common = { version, sha256 }: stdenv.mkDerivation (rec { + inherit version; + + name = "perl-${version}"; + + src = fetchurlBoot { + url = "mirror://cpan/src/5.0/${name}.tar.gz"; + inherit sha256; + }; + + # TODO: Add a "dev" output containing the header files. + outputs = [ "out" "man" "devdoc" ] ++ + stdenv.lib.optional crossCompiling "dev"; + setOutputFlags = false; + + disallowedReferences = [ stdenv.cc ]; + + patches = + [ + # Do not look in /usr etc. for dependencies. + ./no-sys-dirs-5.26.patch + # Fix parallel building: https://rt.perl.org/Public/Bug/Display.html?id=132360 + (fetchurlBoot { + url = "https://rt.perl.org/Public/Ticket/Attachment/1502646/807252/0001-Fix-missing-build-dependency-for-pods.patch"; + sha256 = "1bb4mldfp8kq1scv480wm64n2jdsqa3ar46cjp1mjpby8h5dr2r0"; + }) + ] + ++ optional stdenv.isSunOS ./ld-shared.patch + ++ optionals stdenv.isDarwin [ ./cpp-precomp.patch ./sw_vers.patch ] + ++ optional crossCompiling ./MakeMaker-cross.patch; + + postPatch = '' + pwd="$(type -P pwd)" + substituteInPlace dist/PathTools/Cwd.pm \ + --replace "/bin/pwd" "$pwd" + '' + stdenv.lib.optionalString crossCompiling '' + substituteInPlace cnf/configure_tool.sh --replace "cc -E -P" "cc -E" + ''; + + # Build a thread-safe Perl with a dynamic libperls.o. We need the + # "installstyle" option to ensure that modules are put under + # $out/lib/perl5 - this is the general default, but because $out + # contains the string "perl", Configure would select $out/lib. + # Miniperl needs -lm. perl needs -lrt. + configureFlags = + (if crossCompiling + then [ "-Dlibpth=\"\"" "-Dglibpth=\"\"" ] + else [ "-de" "-Dcc=cc" ]) + ++ [ + "-Uinstallusrbinperl" + "-Dinstallstyle=lib/perl5" + "-Duseshrplib" + "-Dlocincpth=${libcInc}/include" + "-Dloclibpth=${libcLib}/lib" + ] + ++ optionals ((builtins.match ''5\.[0-9]*[13579]\..+'' version) != null) [ "-Dusedevel" "-Uversiononly" ] + ++ optional stdenv.isSunOS "-Dcc=gcc" + ++ optional enableThreading "-Dusethreads"; + + configureScript = stdenv.lib.optionalString (!crossCompiling) "${stdenv.shell} ./Configure"; + + dontAddPrefix = !crossCompiling; + + enableParallelBuilding = !crossCompiling; + + preConfigure = optionalString (!crossCompiling) '' + configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3" + '' + optionalString (stdenv.isAarch32 || stdenv.isMips) '' + configureFlagsArray=(-Dldflags="-lm -lrt") + '' + optionalString stdenv.isDarwin '' + substituteInPlace hints/darwin.sh --replace "env MACOSX_DEPLOYMENT_TARGET=10.3" "" + '' + optionalString (!enableThreading) '' + # We need to do this because the bootstrap doesn't have a static libpthread + sed -i 's,\(libswanted.*\)pthread,\1,g' Configure + ''; + + setupHook = ./setup-hook.sh; + + passthru.libPrefix = "lib/perl5/site_perl"; + + doCheck = false; # some tests fail, expensive + + # TODO: it seems like absolute paths to some coreutils is required. + postInstall = + '' + # Remove dependency between "out" and "man" outputs. + rm "$out"/lib/perl5/*/*/.packlist + + # Remove dependencies on glibc and gcc + sed "/ *libpth =>/c libpth => ' '," \ + -i "$out"/lib/perl5/*/*/Config.pm + # TODO: removing those paths would be cleaner than overwriting with nonsense. + substituteInPlace "$out"/lib/perl5/*/*/Config_heavy.pl \ + --replace "${libcInc}" /no-such-path \ + --replace "${ + if stdenv.cc.cc or null != null then stdenv.cc.cc else "/no-such-path" + }" /no-such-path \ + --replace "${stdenv.cc}" /no-such-path \ + --replace "$man" /no-such-path + '' + stdenv.lib.optionalString crossCompiling + '' + mkdir -p $dev/lib/perl5/cross_perl/${version} + for dir in cnf/{stub,cpan}; do + cp -r $dir/* $dev/lib/perl5/cross_perl/${version} + done + + mkdir -p $dev/bin + install -m755 miniperl $dev/bin/perl + + export runtimeArch="$(ls $out/lib/perl5/site_perl/${version})" + # wrapProgram should use a runtime-native SHELL by default, but + # it actually uses a buildtime-native one. If we ever fix that, + # we'll need to fix this to use a buildtime-native one. + # + # Adding the arch-specific directory is morally incorrect, as + # miniperl can't load the native modules there. However, it can + # (and sometimes needs to) load and run some of the pure perl + # code there, so we add it anyway. When needed, stubs can be put + # into $dev/lib/perl5/cross_perl/${version}. + wrapProgram $dev/bin/perl --prefix PERL5LIB : \ + "$dev/lib/perl5/cross_perl/${version}:$out/lib/perl5/${version}:$out/lib/perl5/${version}/$runtimeArch" + ''; # */ + + meta = { + homepage = https://www.perl.org/; + description = "The standard implementation of the Perl 5 programmming language"; + license = licenses.artistic1; + maintainers = [ maintainers.eelco ]; + platforms = platforms.all; + }; + } // stdenv.lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) rec { + crossVersion = "ab8d05c9e695d3db4f7dc15c70f23623349c2f49"; # Oct 03, 2018 + + perl-cross-src = fetchurlBoot { + url = "https://github.com/arsv/perl-cross/archive/${crossVersion}.tar.gz"; + sha256 = "1g7p7mqmx8x3diqvbh881gr72d106cn6yvm4gx7f0ars3n3b3wj0"; + }; + + depsBuildBuild = [ buildPackages.stdenv.cc makeWrapper ]; + + postUnpack = '' + unpackFile ${perl-cross-src} + cp -R perl-cross-${crossVersion}/* perl-${version}/ + ''; + + configurePlatforms = [ "build" "host" "target" ]; + + # TODO merge setup hooks + setupHook = ./setup-hook-cross.sh; + }); +in rec { + perl526 = common { + version = "5.26.2"; + sha256 = "03gpnxx1g6hvlh0v4aqx00580h787sfywp1vlvw64q2xcbm9qbsp"; + }; + + # the latest Maint version + perl528 = common { + version = "5.28.0"; + sha256 = "1a3f822lcl8dr8v0hk80yyhpzqlljg49z9flb48rs3nbsij9z4ky"; + }; + + # the latest Devel version + perldevel = common { + version = "5.29.4"; + sha256 = "153r0f6jdqrl7hxrvhfivf5g8ivhbvggfhg841q3hi3db5rc86k4"; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/perl/ld-shared.patch b/nixpkgs/pkgs/development/interpreters/perl/ld-shared.patch new file mode 100644 index 000000000000..9f92368df687 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/ld-shared.patch @@ -0,0 +1,24 @@ +$NetBSD: patch-hints_solaris__2.sh,v 1.2 2015/10/27 09:10:44 jperkin Exp $ + +Redo PR pkg/44999. + +--- perl-5.20.2/hints/solaris_2.sh.orig 2015-05-13 20:19:29.000000000 +0000 ++++ perl-5.20.2/hints/solaris_2.sh +@@ -585,7 +585,7 @@ EOM + fi + fi + case "${cc:-cc} -v 2>/dev/null" in +- *gcc*) ++ *gcc*|clang*) + echo 'int main() { return 0; }' > try.c + case "`${cc:-cc} $ccflags -mcpu=v9 -m64 -S try.c 2>&1 | grep 'm64 is not supported by this configuration'`" in + *"m64 is not supported"*) +@@ -622,7 +622,7 @@ EOM + # use that with Solaris 11 and later, but keep + # the old behavior for older Solaris versions. + case "$osvers" in +- 2.?|2.10) lddlflags="$lddlflags -G -m64" ;; ++ 2.?|2.10) lddlflags="$lddlflags -shared -m64" ;; + *) lddlflags="$lddlflags -shared -m64" ;; + esac + ;; diff --git a/nixpkgs/pkgs/development/interpreters/perl/no-sys-dirs-5.26.patch b/nixpkgs/pkgs/development/interpreters/perl/no-sys-dirs-5.26.patch new file mode 100644 index 000000000000..ad65d1339f36 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/no-sys-dirs-5.26.patch @@ -0,0 +1,250 @@ +diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure +--- perl-5.20.0-orig/Configure 2014-05-26 15:34:18.000000000 +0200 ++++ perl-5.20.0/Configure 2014-06-25 10:43:35.368285986 +0200 +@@ -106,15 +106,7 @@ + fi + + : Proper PATH setting +-paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin' +-paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin" +-paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin" +-paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin" +-paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb" +-paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin" +-paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib" +-paths="$paths /sbin /usr/sbin /usr/libexec" +-paths="$paths /system/gnu_library/bin" ++paths='' + + for p in $paths + do +@@ -1337,8 +1329,7 @@ + archname='' + : Possible local include directories to search. + : Set locincpth to "" in a hint file to defeat local include searches. +-locincpth="/usr/local/include /opt/local/include /usr/gnu/include" +-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include" ++locincpth="" + : + : no include file wanted by default + inclwanted='' +@@ -1349,17 +1340,12 @@ + + libnames='' + : change the next line if compiling for Xenix/286 on Xenix/386 +-xlibpth='/usr/lib/386 /lib/386' ++xlibpth='' + : Possible local library directories to search. +-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib" +-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib" ++loclibpth="" + + : general looking path for locating libraries +-glibpth="/lib /usr/lib $xlibpth" +-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib" +-test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth" +-test -f /shlib/libc.so && glibpth="/shlib $glibpth" +-test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64" ++glibpth="" + + : Private path used by Configure to find libraries. Its value + : is prepended to libpth. This variable takes care of special +@@ -1391,8 +1377,6 @@ + libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD" + : We probably want to search /usr/shlib before most other libraries. + : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist. +-glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'` +-glibpth="/usr/shlib $glibpth" + : Do not use vfork unless overridden by a hint file. + usevfork=false + +@@ -2446,7 +2430,6 @@ + zip + " + pth=`echo $PATH | sed -e "s/$p_/ /g"` +-pth="$pth $sysroot/lib $sysroot/usr/lib" + for file in $loclist; do + eval xxx=\$$file + case "$xxx" in +@@ -4936,7 +4919,7 @@ + : Set private lib path + case "$plibpth" in + '') if ./mips; then +- plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib" ++ plibpth="$incpath/usr/lib" + fi;; + esac + case "$libpth" in +@@ -8600,13 +8583,8 @@ + echo " " + case "$sysman" in + '') +- syspath='/usr/share/man/man1 /usr/man/man1' +- syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1" +- syspath="$syspath /usr/man/u_man/man1" +- syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1" +- syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" +- syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1" +- sysman=`./loc . /usr/man/man1 $syspath` ++ syspath='' ++ sysman='' + ;; + esac + if $test -d "$sysman"; then +@@ -19900,9 +19878,10 @@ + case "$full_ar" in + '') full_ar=$ar ;; + esac ++full_ar=ar + + : Store the full pathname to the sed program for use in the C program +-full_sed=$sed ++full_sed=sed + + : see what type gids are declared as in the kernel + echo " " +Only in perl-5.20.0/: Configure.orig +diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/ext/Errno/Errno_pm.PL perl-5.20.0/ext/Errno/Errno_pm.PL +--- perl-5.20.0-orig/ext/Errno/Errno_pm.PL 2014-05-26 15:34:20.000000000 +0200 ++++ perl-5.20.0/ext/Errno/Errno_pm.PL 2014-06-25 10:31:24.317970047 +0200 +@@ -126,11 +126,7 @@ + if ($dep =~ /(\S+errno\.h)/) { + $file{$1} = 1; + } +- } elsif ($^O eq 'linux' && +- $Config{gccversion} ne '' && +- $Config{gccversion} !~ /intel/i +- # might be using, say, Intel's icc +- ) { ++ } elsif (0) { + # When cross-compiling we may store a path for gcc's "sysroot" option: + my $sysroot = $Config{sysroot} || ''; + # Some Linuxes have weird errno.hs which generate +Only in perl-5.20.0/ext/Errno: Errno_pm.PL.orig +diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/freebsd.sh perl-5.20.0/hints/freebsd.sh +--- perl-5.20.0-orig/hints/freebsd.sh 2014-01-31 22:55:51.000000000 +0100 ++++ perl-5.20.0/hints/freebsd.sh 2014-06-25 10:25:53.263964680 +0200 +@@ -119,21 +119,21 @@ + objformat=`/usr/bin/objformat` + if [ x$objformat = xaout ]; then + if [ -e /usr/lib/aout ]; then +- libpth="/usr/lib/aout /usr/local/lib /usr/lib" +- glibpth="/usr/lib/aout /usr/local/lib /usr/lib" ++ libpth="" ++ glibpth="" + fi + lddlflags='-Bshareable' + else +- libpth="/usr/lib /usr/local/lib" +- glibpth="/usr/lib /usr/local/lib" ++ libpth="" ++ glibpth="" + ldflags="-Wl,-E " + lddlflags="-shared " + fi + cccdlflags='-DPIC -fPIC' + ;; + *) +- libpth="/usr/lib /usr/local/lib" +- glibpth="/usr/lib /usr/local/lib" ++ libpth="" ++ glibpth="" + ldflags="-Wl,-E " + lddlflags="-shared " + cccdlflags='-DPIC -fPIC' +diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/linux.sh +--- perl-5.20.0-orig/hints/linux.sh 2014-05-26 15:34:20.000000000 +0200 ++++ perl-5.20.0/hints/linux.sh 2014-06-25 10:33:47.354883843 +0200 +@@ -150,25 +150,6 @@ + ;; + esac + +-# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries +-# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us +-# where to look. We don't want gcc's own libraries, however, so we +-# filter those out. +-# This could be conditional on Unbuntu, but other distributions may +-# follow suit, and this scheme seems to work even on rather old gcc's. +-# This unconditionally uses gcc because even if the user is using another +-# compiler, we still need to find the math library and friends, and I don't +-# know how other compilers will cope with that situation. +-# Morever, if the user has their own gcc earlier in $PATH than the system gcc, +-# we don't want its libraries. So we try to prefer the system gcc +-# Still, as an escape hatch, allow Configure command line overrides to +-# plibpth to bypass this check. +-if [ -x /usr/bin/gcc ] ; then +- gcc=/usr/bin/gcc +-else +- gcc=gcc +-fi +- + case "$plibpth" in + '') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries | + cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'` +@@ -178,32 +159,6 @@ + ;; + esac + +-case "$libc" in +-'') +-# If you have glibc, then report the version for ./myconfig bug reporting. +-# (Configure doesn't need to know the specific version since it just uses +-# gcc to load the library for all tests.) +-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they +-# are insufficiently precise to distinguish things like +-# libc-2.0.6 and libc-2.0.7. +- for p in $plibpth +- do +- for trylib in libc.so.6 libc.so +- do +- if $test -e $p/$trylib; then +- libc=`ls -l $p/$trylib | awk '{print $NF}'` +- if $test "X$libc" != X; then +- break +- fi +- fi +- done +- if $test "X$libc" != X; then +- break +- fi +- done +- ;; +-esac +- + if ${sh:-/bin/sh} -c exit; then + echo '' + echo 'You appear to have a working bash. Good.' +@@ -367,33 +322,6 @@ + ;; + esac + +-# SuSE8.2 has /usr/lib/libndbm* which are ld scripts rather than +-# true libraries. The scripts cause binding against static +-# version of -lgdbm which is a bad idea. So if we have 'nm' +-# make sure it can read the file +-# NI-S 2003/08/07 +-case "$nm" in +- '') ;; +- *) +- for p in $plibpth +- do +- if $test -r $p/libndbm.so; then +- if $nm $p/libndbm.so >/dev/null 2>&1 ; then +- echo 'Your shared -lndbm seems to be a real library.' +- _libndbm_real=1 +- break +- fi +- fi +- done +- if $test "X$_libndbm_real" = X; then +- echo 'Your shared -lndbm is not a real library.' +- set `echo X "$libswanted "| sed -e 's/ ndbm / /'` +- shift +- libswanted="$*" +- fi +- ;; +-esac +- + # Linux on Synology. + if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then + # Tested on Synology DS213 and DS413 diff --git a/nixpkgs/pkgs/development/interpreters/perl/setup-hook-cross.sh b/nixpkgs/pkgs/development/interpreters/perl/setup-hook-cross.sh new file mode 100644 index 000000000000..95aae0b2670f --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/setup-hook-cross.sh @@ -0,0 +1,12 @@ +addPerlLibPath () { + addToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@ + addToSearchPath PERL5LIB $1/lib/perl5/site_perl/cross_perl/@version@ + # Adding the arch-specific directory is morally incorrect, as + # miniperl can't load the native modules there. However, it can + # (and sometimes needs to) load and run some of the pure perl + # code there, so we add it anyway. When needed, stubs can be put + # into $1/lib/perl5/site_perl/cross_perl/@version@ + addToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@/@runtimeArch@ +} + +addEnvHooks "$targetOffset" addPerlLibPath diff --git a/nixpkgs/pkgs/development/interpreters/perl/setup-hook.sh b/nixpkgs/pkgs/development/interpreters/perl/setup-hook.sh new file mode 100644 index 000000000000..7909412806c8 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/setup-hook.sh @@ -0,0 +1,5 @@ +addPerlLibPath () { + addToSearchPath PERL5LIB $1/lib/perl5/site_perl +} + +addEnvHooks "$hostOffset" addPerlLibPath diff --git a/nixpkgs/pkgs/development/interpreters/perl/sw_vers.patch b/nixpkgs/pkgs/development/interpreters/perl/sw_vers.patch new file mode 100644 index 000000000000..9d4cd75486e6 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/sw_vers.patch @@ -0,0 +1,13 @@ +diff --git a/hints/darwin.sh b/hints/darwin.sh +index afadf53..80b7533 100644 +--- a/hints/darwin.sh ++++ b/hints/darwin.sh +@@ -329,7 +329,7 @@ EOM + # sw_vers output what we want + # "ProductVersion: 10.10.5" "10.10" + # "ProductVersion: 10.11" "10.11" +- prodvers=`sw_vers|awk '/^ProductVersion:/{print $2}'|awk -F. '{print $1"."$2}'` ++ prodvers="10.10" + case "$prodvers" in + 10.*) + add_macosx_version_min ccflags $prodvers diff --git a/nixpkgs/pkgs/development/interpreters/php/default.nix b/nixpkgs/pkgs/development/interpreters/php/default.nix new file mode 100644 index 000000000000..2757b9bd4bab --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/php/default.nix @@ -0,0 +1,274 @@ +# pcre functionality is tested in nixos/tests/php-pcre.nix +{ lib, stdenv, fetchurl, flex, bison, autoconf +, mysql, libxml2, readline, zlib, curl, postgresql, gettext +, openssl, pcre, pcre2, pkgconfig, sqlite, config, libjpeg, libpng, freetype +, libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash +, uwimap, pam, gmp, apacheHttpd, libiconv, systemd, libsodium, html-tidy, libargon2, libzip +}: + +with lib; + +let + generic = + { version + , sha256 + , extraPatches ? [] + , withSystemd ? config.php.systemd or stdenv.isLinux + , imapSupport ? config.php.imap or (!stdenv.isDarwin) + , ldapSupport ? config.php.ldap or true + , mhashSupport ? config.php.mhash or true + , mysqlndSupport ? config.php.mysqlnd or true + , mysqliSupport ? config.php.mysqli or true + , pdo_mysqlSupport ? config.php.pdo_mysql or true + , libxml2Support ? config.php.libxml2 or true + , apxs2Support ? config.php.apxs2 or (!stdenv.isDarwin) + , embedSupport ? config.php.embed or false + , bcmathSupport ? config.php.bcmath or true + , socketsSupport ? config.php.sockets or true + , curlSupport ? config.php.curl or true + , gettextSupport ? config.php.gettext or true + , pcntlSupport ? config.php.pcntl or true + , postgresqlSupport ? config.php.postgresql or true + , pdo_pgsqlSupport ? config.php.pdo_pgsql or true + , readlineSupport ? config.php.readline or true + , sqliteSupport ? config.php.sqlite or true + , soapSupport ? (config.php.soap or true) && (libxml2Support) + , zlibSupport ? config.php.zlib or true + , opensslSupport ? config.php.openssl or true + , mbstringSupport ? config.php.mbstring or true + , gdSupport ? config.php.gd or true + , intlSupport ? config.php.intl or true + , exifSupport ? config.php.exif or true + , xslSupport ? config.php.xsl or false + , mcryptSupport ? (config.php.mcrypt or true) && (versionOlder version "7.2") + , bz2Support ? config.php.bz2 or false + , zipSupport ? config.php.zip or true + , ftpSupport ? config.php.ftp or true + , fpmSupport ? config.php.fpm or true + , gmpSupport ? config.php.gmp or true + , ztsSupport ? config.php.zts or false + , calendarSupport ? config.php.calendar or true + , sodiumSupport ? (config.php.sodium or true) && (versionAtLeast version "7.2") + , tidySupport ? (config.php.tidy or false) + , argon2Support ? (config.php.argon2 or true) && (versionAtLeast version "7.2") + , libzipSupport ? (config.php.libzip or true) && (versionAtLeast version "7.3") + , phpdbgSupport ? config.php.phpdbg or true + , cgiSupport ? config.php.cgi or true + , cliSupport ? config.php.cli or true + , pharSupport ? config.php.phar or true + , xmlrpcSupport ? (config.php.xmlrpc or false) && (libxml2Support) + }: + + let + mysqlBuildInputs = optional (!mysqlndSupport) mysql.connector-c; + libmcrypt' = libmcrypt.override { disablePosixThreads = true; }; + in stdenv.mkDerivation { + + inherit version; + + name = "php-${version}"; + + enableParallelBuilding = true; + + nativeBuildInputs = [ pkgconfig autoconf ]; + buildInputs = [ flex bison ] + ++ optional (versionOlder version "7.3") pcre + ++ optional (versionAtLeast version "7.3") pcre2 + ++ optional withSystemd systemd + ++ optionals imapSupport [ uwimap openssl pam ] + ++ optionals curlSupport [ curl openssl ] + ++ optionals ldapSupport [ openldap openssl ] + ++ optionals gdSupport [ libpng libjpeg freetype ] + ++ optionals opensslSupport [ openssl openssl.dev ] + ++ optional apxs2Support apacheHttpd + ++ optional (ldapSupport && stdenv.isLinux) cyrus_sasl + ++ optional mhashSupport libmhash + ++ optional zlibSupport zlib + ++ optional libxml2Support libxml2 + ++ optional readlineSupport readline + ++ optional sqliteSupport sqlite + ++ optional postgresqlSupport postgresql + ++ optional pdo_pgsqlSupport postgresql + ++ optional pdo_mysqlSupport mysqlBuildInputs + ++ optional mysqliSupport mysqlBuildInputs + ++ optional gmpSupport gmp + ++ optional gettextSupport gettext + ++ optional intlSupport icu + ++ optional xslSupport libxslt + ++ optional mcryptSupport libmcrypt' + ++ optional bz2Support bzip2 + ++ optional sodiumSupport libsodium + ++ optional tidySupport html-tidy + ++ optional argon2Support libargon2 + ++ optional libzipSupport libzip; + + CXXFLAGS = optional stdenv.cc.isClang "-std=c++11"; + + configureFlags = [ + "--with-config-file-scan-dir=/etc/php.d" + ] + ++ optional (versionOlder version "7.3") "--with-pcre-regex=${pcre.dev} PCRE_LIBDIR=${pcre}" + ++ optional (versionAtLeast version "7.3") "--with-pcre-regex=${pcre2.dev} PCRE_LIBDIR=${pcre2}" + ++ optional stdenv.isDarwin "--with-iconv=${libiconv}" + ++ optional withSystemd "--with-fpm-systemd" + ++ optionals imapSupport [ + "--with-imap=${uwimap}" + "--with-imap-ssl" + ] + ++ optionals ldapSupport [ + "--with-ldap=/invalid/path" + "LDAP_DIR=${openldap.dev}" + "LDAP_INCDIR=${openldap.dev}/include" + "LDAP_LIBDIR=${openldap.out}/lib" + ] + ++ optional (ldapSupport && stdenv.isLinux) "--with-ldap-sasl=${cyrus_sasl.dev}" + ++ optional apxs2Support "--with-apxs2=${apacheHttpd.dev}/bin/apxs" + ++ optional embedSupport "--enable-embed" + ++ optional mhashSupport "--with-mhash" + ++ optional curlSupport "--with-curl=${curl.dev}" + ++ optional zlibSupport "--with-zlib=${zlib.dev}" + ++ optional libxml2Support "--with-libxml-dir=${libxml2.dev}" + ++ optional (!libxml2Support) [ + "--disable-dom" + "--disable-libxml" + "--disable-simplexml" + "--disable-xml" + "--disable-xmlreader" + "--disable-xmlwriter" + "--without-pear" + ] + ++ optional pcntlSupport "--enable-pcntl" + ++ optional readlineSupport "--with-readline=${readline.dev}" + ++ optional sqliteSupport "--with-pdo-sqlite=${sqlite.dev}" + ++ optional postgresqlSupport "--with-pgsql=${postgresql}" + ++ optional pdo_pgsqlSupport "--with-pdo-pgsql=${postgresql}" + ++ optional pdo_mysqlSupport "--with-pdo-mysql=${if mysqlndSupport then "mysqlnd" else mysql.connector-c}" + ++ optionals mysqliSupport [ + "--with-mysqli=${if mysqlndSupport then "mysqlnd" else "${mysql.connector-c}/bin/mysql_config"}" + ] + ++ optional ( pdo_mysqlSupport || mysqliSupport ) "--with-mysql-sock=/run/mysqld/mysqld.sock" + ++ optional bcmathSupport "--enable-bcmath" + # FIXME: Our own gd package doesn't work, see https://bugs.php.net/bug.php?id=60108. + ++ optionals gdSupport [ + "--with-gd" + "--with-freetype-dir=${freetype.dev}" + "--with-png-dir=${libpng.dev}" + "--with-jpeg-dir=${libjpeg.dev}" + ] + ++ optional gmpSupport "--with-gmp=${gmp.dev}" + ++ optional soapSupport "--enable-soap" + ++ optional socketsSupport "--enable-sockets" + ++ optional opensslSupport "--with-openssl" + ++ optional mbstringSupport "--enable-mbstring" + ++ optional gettextSupport "--with-gettext=${gettext}" + ++ optional intlSupport "--enable-intl" + ++ optional exifSupport "--enable-exif" + ++ optional xslSupport "--with-xsl=${libxslt.dev}" + ++ optional mcryptSupport "--with-mcrypt=${libmcrypt'}" + ++ optional bz2Support "--with-bz2=${bzip2.dev}" + ++ optional zipSupport "--enable-zip" + ++ optional ftpSupport "--enable-ftp" + ++ optional fpmSupport "--enable-fpm" + ++ optional ztsSupport "--enable-maintainer-zts" + ++ optional calendarSupport "--enable-calendar" + ++ optional sodiumSupport "--with-sodium=${libsodium.dev}" + ++ optional tidySupport "--with-tidy=${html-tidy}" + ++ optional argon2Support "--with-password-argon2=${libargon2}" + ++ optional libzipSupport "--with-libzip=${libzip.dev}" + ++ optional phpdbgSupport "--enable-phpdbg" + ++ optional (!phpdbgSupport) "--disable-phpdbg" + ++ optional (!cgiSupport) "--disable-cgi" + ++ optional (!cliSupport) "--disable-cli" + ++ optional (!pharSupport) "--disable-phar" + ++ optional xmlrpcSupport "--with-xmlrpc"; + + hardeningDisable = [ "bindnow" ]; + + preConfigure = '' + # Don't record the configure flags since this causes unnecessary + # runtime dependencies + for i in main/build-defs.h.in scripts/php-config.in; do + substituteInPlace $i \ + --replace '@CONFIGURE_COMMAND@' '(omitted)' \ + --replace '@CONFIGURE_OPTIONS@' "" \ + --replace '@PHP_LDFLAGS@' "" + done + + #[[ -z "$libxml2" ]] || addToSearchPath PATH $libxml2/bin + + export EXTENSION_DIR=$out/lib/php/extensions + + configureFlags+=(--with-config-file-path=$out/etc \ + --includedir=$dev/include) + + ./buildconf --force + ''; + + postInstall = '' + test -d $out/etc || mkdir $out/etc + cp php.ini-production $out/etc/php.ini + ''; + + postFixup = '' + mkdir -p $dev/bin $dev/share/man/man1 + mv $out/bin/phpize $out/bin/php-config $dev/bin/ + mv $out/share/man/man1/phpize.1.gz \ + $out/share/man/man1/php-config.1.gz \ + $dev/share/man/man1/ + ''; + + src = fetchurl { + url = "http://www.php.net/distributions/php-${version}.tar.bz2"; + inherit sha256; + }; + + meta = with stdenv.lib; { + description = "An HTML-embedded scripting language"; + homepage = http://www.php.net/; + license = licenses.php301; + maintainers = with maintainers; [ globin etu ]; + platforms = platforms.all; + outputsToInstall = [ "out" "dev" ]; + }; + + patches = [ ./fix-paths-php7.patch ] ++ extraPatches; + + postPatch = optional stdenv.isDarwin '' + substituteInPlace configure --replace "-lstdc++" "-lc++" + ''; + + stripDebugList = "bin sbin lib modules"; + + outputs = [ "out" "dev" ]; + + }; + +in { + php71 = generic { + version = "7.1.25"; + sha256 = "1b5az5vhap593ggjxirs1zdlg20hcv9h94iq5kgaxky71a4dqb00"; + + # https://bugs.php.net/bug.php?id=76826 + extraPatches = optional stdenv.isDarwin ./php71-darwin-isfinite.patch; + }; + + php72 = generic { + version = "7.2.13"; + sha256 = "0bg9nfc250p24hxn4bdjz7ngcw75h8rpf4qjxqzcs6s9fvxlcjjv"; + + # https://bugs.php.net/bug.php?id=71041 + # https://bugs.php.net/bug.php?id=76826 + extraPatches = [ ./fix-bug-71041.patch ] + ++ optional stdenv.isDarwin ./php72-darwin-isfinite.patch; + }; + + php73 = generic { + version = "7.3.0"; + sha256 = "0rvwx37dsmxivgrf4wfc1y778iln498c6a40biy9k6lnr6p7s9ks"; + + # https://bugs.php.net/bug.php?id=71041 + # https://bugs.php.net/bug.php?id=76826 + extraPatches = [ ./fix-bug-71041.patch ] + ++ optional stdenv.isDarwin ./php73-darwin-isfinite.patch; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/php/fix-bug-71041.patch b/nixpkgs/pkgs/development/interpreters/php/fix-bug-71041.patch new file mode 100644 index 000000000000..350b635bdf36 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/php/fix-bug-71041.patch @@ -0,0 +1,25 @@ +diff --git a/Zend/zend_signal.c b/Zend/zend_signal.c +index 24d454d..6307620 100644 +--- a/Zend/zend_signal.c ++++ b/Zend/zend_signal.c +@@ -399,7 +399,7 @@ void zend_signal_init(void) /* {{{ */ + + /* {{{ zend_signal_startup + * alloc zend signal globals */ +-void zend_signal_startup(void) ++ZEND_API void zend_signal_startup(void) + { + + #ifdef ZTS +diff --git a/Zend/zend_signal.h b/Zend/zend_signal.h +index e8ee7d6..462d06f 100644 +--- a/Zend/zend_signal.h ++++ b/Zend/zend_signal.h +@@ -89,7 +89,7 @@ ZEND_API void zend_signal_handler_unblock(void); + void zend_signal_activate(void); + void zend_signal_deactivate(void); + BEGIN_EXTERN_C() +-void zend_signal_startup(void); ++ZEND_API void zend_signal_startup(void); + END_EXTERN_C() + void zend_signal_init(void); diff --git a/nixpkgs/pkgs/development/interpreters/php/fix-paths-php7.patch b/nixpkgs/pkgs/development/interpreters/php/fix-paths-php7.patch new file mode 100644 index 000000000000..908f06ec49ab --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/php/fix-paths-php7.patch @@ -0,0 +1,26 @@ +diff -ru a/ext/gettext/config.m4 b/ext/gettext/config.m4 +--- a/ext/gettext/config.m4 2018-11-07 15:35:26.000000000 +0000 ++++ b/ext/gettext/config.m4 2018-11-27 00:33:07.000000000 +0000 +@@ -6,9 +6,7 @@ + [ --with-gettext[=DIR] Include GNU gettext support]) + + if test "$PHP_GETTEXT" != "no"; then +- for i in $PHP_GETTEXT /usr/local /usr; do +- test -r $i/include/libintl.h && GETTEXT_DIR=$i && break +- done ++ GETTEXT_DIR=$PHP_GETTEXT + + if test -z "$GETTEXT_DIR"; then + AC_MSG_ERROR(Cannot locate header file libintl.h) +diff -ru a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 +--- a/sapi/apache2handler/config.m4 2018-11-07 15:35:23.000000000 +0000 ++++ b/sapi/apache2handler/config.m4 2018-11-27 00:32:28.000000000 +0000 +@@ -66,7 +66,7 @@ + AC_MSG_ERROR([Please note that Apache version >= 2.0.44 is required]) + fi + +- APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR` ++ APXS_LIBEXECDIR="$prefix/modules" + if test -z `$APXS -q SYSCONFDIR`; then + INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \ + $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ diff --git a/nixpkgs/pkgs/development/interpreters/php/php71-darwin-isfinite.patch b/nixpkgs/pkgs/development/interpreters/php/php71-darwin-isfinite.patch new file mode 100644 index 000000000000..ebfcd94f8d4b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/php/php71-darwin-isfinite.patch @@ -0,0 +1,60 @@ +diff -ru a/Zend/configure.in b/Zend/configure.in +--- a/Zend/configure.in 2018-11-07 15:35:26.000000000 +0000 ++++ b/Zend/configure.in 2018-11-27 00:28:48.000000000 +0000 +@@ -70,7 +70,7 @@ + #endif + + #ifndef zend_isnan +-#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISNAN && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isnan(a) isnan(a) + #elif defined(HAVE_FPCLASS) + #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN)) +@@ -79,7 +79,7 @@ + #endif + #endif + +-#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISINF && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isinf(a) isinf(a) + #elif defined(INFINITY) + /* Might not work, but is required by ISO C99 */ +@@ -90,7 +90,7 @@ + #define zend_isinf(a) 0 + #endif + +-#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISFINITE && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_finite(a) isfinite(a) + #elif defined(HAVE_FINITE) + #define zend_finite(a) finite(a) +diff -ru a/configure.in b/configure.in +--- a/configure.in 2018-11-07 15:35:26.000000000 +0000 ++++ b/configure.in 2018-11-27 00:28:48.000000000 +0000 +@@ -75,7 +75,7 @@ + #endif + + #ifndef zend_isnan +-#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISNAN && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isnan(a) isnan(a) + #elif defined(HAVE_FPCLASS) + #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN)) +@@ -84,7 +84,7 @@ + #endif + #endif + +-#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISINF && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isinf(a) isinf(a) + #elif defined(INFINITY) + /* Might not work, but is required by ISO C99 */ +@@ -95,7 +95,7 @@ + #define zend_isinf(a) 0 + #endif + +-#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISFINITE && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_finite(a) isfinite(a) + #elif defined(HAVE_FINITE) + #define zend_finite(a) finite(a) diff --git a/nixpkgs/pkgs/development/interpreters/php/php72-darwin-isfinite.patch b/nixpkgs/pkgs/development/interpreters/php/php72-darwin-isfinite.patch new file mode 100644 index 000000000000..ea2e3e28f2cc --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/php/php72-darwin-isfinite.patch @@ -0,0 +1,62 @@ +diff --git a/Zend/configure.ac b/Zend/configure.ac +index b95c1360b8..fe16c86007 100644 +--- a/Zend/configure.ac ++++ b/Zend/configure.ac +@@ -60,7 +60,7 @@ int zend_sprintf(char *buffer, const char *format, ...); + #include <math.h> + + #ifndef zend_isnan +-#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISNAN && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isnan(a) isnan(a) + #elif defined(HAVE_FPCLASS) + #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN)) +@@ -69,7 +69,7 @@ int zend_sprintf(char *buffer, const char *format, ...); + #endif + #endif + +-#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISINF && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isinf(a) isinf(a) + #elif defined(INFINITY) + /* Might not work, but is required by ISO C99 */ +@@ -80,7 +80,7 @@ int zend_sprintf(char *buffer, const char *format, ...); + #define zend_isinf(a) 0 + #endif + +-#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISFINITE && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_finite(a) isfinite(a) + #elif defined(HAVE_FINITE) + #define zend_finite(a) finite(a) +diff --git a/configure.ac b/configure.ac +index d3f3cacd07..ddbf712ba2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -68,7 +68,7 @@ int zend_sprintf(char *buffer, const char *format, ...); + #include <math.h> + + #ifndef zend_isnan +-#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISNAN && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isnan(a) isnan(a) + #elif defined(HAVE_FPCLASS) + #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN)) +@@ -77,7 +77,7 @@ int zend_sprintf(char *buffer, const char *format, ...); + #endif + #endif + +-#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISINF && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isinf(a) isinf(a) + #elif defined(INFINITY) + /* Might not work, but is required by ISO C99 */ +@@ -88,7 +88,7 @@ int zend_sprintf(char *buffer, const char *format, ...); + #define zend_isinf(a) 0 + #endif + +-#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISFINITE && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_finite(a) isfinite(a) + #elif defined(HAVE_FINITE) + #define zend_finite(a) finite(a) diff --git a/nixpkgs/pkgs/development/interpreters/php/php73-darwin-isfinite.patch b/nixpkgs/pkgs/development/interpreters/php/php73-darwin-isfinite.patch new file mode 100644 index 000000000000..7f784e0f5a95 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/php/php73-darwin-isfinite.patch @@ -0,0 +1,60 @@ +diff -ru a/configure.ac b/configure.ac +--- a/configure.ac 2018-12-04 19:12:20.000000000 +0300 ++++ b/configure.ac 2018-12-10 12:30:37.798917520 +0300 +@@ -68,7 +68,7 @@ + #include <math.h> + + #ifndef zend_isnan +-#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISNAN && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isnan(a) isnan(a) + #elif defined(HAVE_FPCLASS) + #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN)) +@@ -77,7 +77,7 @@ + #endif + #endif + +-#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISINF && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isinf(a) isinf(a) + #elif defined(INFINITY) + /* Might not work, but is required by ISO C99 */ +@@ -88,7 +88,7 @@ + #define zend_isinf(a) 0 + #endif + +-#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISFINITE && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_finite(a) isfinite(a) + #elif defined(HAVE_FINITE) + #define zend_finite(a) finite(a) +diff -ru a/Zend/configure.ac b/Zend/configure.ac +--- a/Zend/configure.ac 2018-12-04 19:12:30.000000000 +0300 ++++ b/Zend/configure.ac 2018-12-10 12:28:50.350929699 +0300 +@@ -59,7 +59,7 @@ + #include <math.h> + + #ifndef zend_isnan +-#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISNAN && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isnan(a) isnan(a) + #elif defined(HAVE_FPCLASS) + #define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN)) +@@ -68,7 +68,7 @@ + #endif + #endif + +-#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISINF && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_isinf(a) isinf(a) + #elif defined(INFINITY) + /* Might not work, but is required by ISO C99 */ +@@ -79,7 +79,7 @@ + #define zend_isinf(a) 0 + #endif + +-#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L) ++#if HAVE_DECL_ISFINITE && (defined(__APPLE__) || defined(__APPLE_CC__) || !defined(__cplusplus) || __cplusplus < 201103L) + #define zend_finite(a) isfinite(a) + #elif defined(HAVE_FINITE) + #define zend_finite(a) finite(a) diff --git a/nixpkgs/pkgs/development/interpreters/picoc/default.nix b/nixpkgs/pkgs/development/interpreters/picoc/default.nix new file mode 100644 index 000000000000..62ab7b02585e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/picoc/default.nix @@ -0,0 +1,51 @@ +{ stdenv, fetchFromGitHub, readline }: + +stdenv.mkDerivation rec { + name = "picoc-${version}"; + version = "2015-05-04"; + + src = fetchFromGitHub { + sha256 = "01w3jwl0vn9fsmh7p20ad4nl9ljzgfn576yvncd9pk9frx3pd8y4"; + rev = "4555e8456f020554bcac50751fbb9b36c7d8c13b"; + repo = "picoc"; + owner = "zsaleeba"; + }; + + buildInputs = [ readline ]; + + postPatch = '' + substituteInPlace Makefile --replace '`svnversion -n`' "${version}" + ''; + + enableParallelBuilding = true; + + # Tests are currently broken on i686 see + # http://hydra.nixos.org/build/24003763/nixlog/1 + doCheck = if stdenv.isi686 then false else true; + checkTarget = "test"; + + installPhase = '' + install -Dm755 picoc $out/bin/picoc + + mkdir -p $out/include + install -m644 *.h $out/include + ''; + + meta = with stdenv.lib; { + description = "Very small C interpreter for scripting"; + longDescription = '' + PicoC is a very small C interpreter for scripting. It was originally + written as a script language for a UAV's on-board flight system. It's + also very suitable for other robotic, embedded and non-embedded + applications. The core C source code is around 3500 lines of code. It's + not intended to be a complete implementation of ISO C but it has all the + essentials. When compiled it only takes a few k of code space and is also + very sparing of data space. This means it can work well in small embedded + devices. + ''; + homepage = https://github.com/zsaleeba/picoc; + downloadPage = https://code.google.com/p/picoc/downloads/list; + license = licenses.bsd3; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/picolisp/default.nix b/nixpkgs/pkgs/development/interpreters/picolisp/default.nix new file mode 100644 index 000000000000..37a5bdd0ce94 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/picolisp/default.nix @@ -0,0 +1,54 @@ +{ stdenv, fetchurl, jdk }: +with stdenv.lib; + +stdenv.mkDerivation rec { + name = "picoLisp-${version}"; + version = "16.12"; + src = fetchurl { + url = "https://www.software-lab.de/${name}.tgz"; + sha256 = "1k3x6mvk9b34iiyml142bzh3gf241f25ywjlaagbxzb9vklpws75"; + }; + buildInputs = optional stdenv.is64bit jdk; + patchPhase = optionalString stdenv.isAarch32 '' + sed -i s/-m32//g Makefile + cat >>Makefile <<EOF + ext.o: ext.c + \$(CC) \$(CFLAGS) -fPIC -D_OS='"\$(OS)"' \$*.c + ht.o: ht.c + \$(CC) \$(CFLAGS) -fPIC -D_OS='"\$(OS)"' \$*.c + EOF + ''; + sourceRoot = ''picoLisp/src${optionalString stdenv.is64bit "64"}''; + installPhase = '' + cd .. + + mkdir -p "$out/share/picolisp" "$out/lib" "$out/bin" + cp -r . "$out/share/picolisp/build-dir" + ln -s "$out/share/picolisp/build-dir" "$out/lib/picolisp" + ln -s "$out/lib/picolisp/bin/picolisp" "$out/bin/picolisp" + + cat >"$out/bin/pil" <<EOF + #! /bin/sh + exec $out/bin/picolisp $out/lib/picolisp/lib.l @lib/misc.l @lib/btree.l @lib/db.l @lib/pilog.l + EOF + chmod +x "$out/bin/pil" + + mkdir -p "$out/share/emacs" + ln -s "$out/lib/picolisp/lib/el" "$out/share/emacs/site-lisp" + ''; + + meta = { + description = "A simple Lisp with an integrated database"; + homepage = https://picolisp.com/; + license = licenses.mit; + platforms = platforms.all; + broken = stdenv.isDarwin; # times out + maintainers = with maintainers; [ raskin tohl ]; + }; + + passthru = { + updateInfo = { + downloadPage = "http://www.software-lab.de/down.html"; + }; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/pixie/default.nix b/nixpkgs/pkgs/development/interpreters/pixie/default.nix new file mode 100644 index 000000000000..928a55173243 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/pixie/default.nix @@ -0,0 +1,93 @@ +{ stdenv, fetchgit, fetchurl, python2, makeWrapper, pkgconfig, gcc, + pypy, libffi, libedit, libuv, boost, zlib, + variant ? "jit", buildWithPypy ? false }: + +let + commit-count = "1364"; + common-flags = "--thread --gcrootfinder=shadowstack --continuation"; + variants = { + jit = { flags = "--opt=jit"; target = "target.py"; }; + jit-preload = { flags = "--opt=jit"; target = "target_preload.py"; }; + no-jit = { flags = ""; target = "target.py"; }; + no-jit-preload = { flags = ""; target = "target_preload.py"; }; + }; + pixie-src = fetchgit { + url = "https://github.com/pixie-lang/pixie.git"; + rev = "5eb0ccbe8b0087d3a5f2d0bbbc6998d624d3cd62"; + sha256 = "0pf31x5h2m6dpxlidv98qay1y179qw40cw4cb4v4xa88gmq2f3vm"; + }; + pypy-tag = "91db1a9"; + pypy-src = fetchurl { + name = "pypy-src-${pypy-tag}"; + url = "https://bitbucket.org/pypy/pypy/get/${pypy-tag}.tar.bz2"; + sha256 = "0ylbqvhbcp5m09l15i2q2h3a0vjd055x2r37cq71lkhgmmaxrwbq"; + }; + libs = [ libffi libedit libuv boost.dev boost.out zlib ]; + include-path = stdenv.lib.concatStringsSep ":" + (map (p: "${p}/include") libs); + library-path = stdenv.lib.concatStringsSep ":" + (map (p: "${p}/lib") libs); + bin-path = stdenv.lib.concatStringsSep ":" + (map (p: "${p}/bin") [ gcc ]); + build = {flags, target}: stdenv.mkDerivation rec { + name = "pixie-${version}"; + version = "0-r${commit-count}-${variant}"; + nativeBuildInputs = [ makeWrapper pkgconfig ]; + buildInputs = libs; + PYTHON = if buildWithPypy + then "${pypy}/pypy-c/.pypy-c-wrapped" + else "${python2.interpreter}"; + unpackPhase = '' + cp -R ${pixie-src} pixie-src + mkdir pypy-src + (cd pypy-src + tar --strip-components=1 -xjf ${pypy-src}) + chmod -R +w pypy-src pixie-src + ''; + patchPhase = '' + (cd pixie-src + patch -p1 < ${./load_paths.patch} + libraryPaths='["${libuv}" "${libedit}" "${libffi.dev}" "${boost.dev}" "${boost.out}" "${zlib.dev}"]' + export libraryPaths + substituteAllInPlace ./pixie/ffi-infer.pxi) + ''; + buildPhase = ''( + PYTHONPATH="`pwd`/pypy-src:$PYTHONPATH"; + RPYTHON="`pwd`/pypy-src/rpython/bin/rpython"; + cd pixie-src + $PYTHON $RPYTHON ${common-flags} ${target} + find pixie -name "*.pxi" -exec ./pixie-vm -c {} \; + )''; + LD_LIBRARY_PATH = library-path; + C_INCLUDE_PATH = include-path; + LIBRARY_PATH = library-path; + PATH = bin-path; + installPhase = '' + mkdir -p $out/share $out/bin + cp pixie-src/pixie-vm $out/share/pixie-vm + cp -R pixie-src/pixie $out/share/pixie + makeWrapper $out/share/pixie-vm $out/bin/pixie \ + --prefix LD_LIBRARY_PATH : ${LD_LIBRARY_PATH} \ + --prefix C_INCLUDE_PATH : ${C_INCLUDE_PATH} \ + --prefix LIBRARY_PATH : ${LIBRARY_PATH} \ + --prefix PATH : ${PATH} + ''; + doCheck = true; + checkPhase = '' + RES=$(./pixie-src/pixie-vm -e "(print :ok)") + if [ "$RES" != ":ok" ]; then + echo "ERROR Unexpected output: '$RES'" + return 1 + else + echo "$RES" + fi + ''; + meta = { + description = "A clojure-like lisp, built with the pypy vm toolkit"; + homepage = https://github.com/pixie-lang/pixie; + license = stdenv.lib.licenses.lgpl3; + platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"]; + maintainers = with stdenv.lib.maintainers; [ bendlas ]; + }; + }; +in build (builtins.getAttr variant variants) diff --git a/nixpkgs/pkgs/development/interpreters/pixie/dust.nix b/nixpkgs/pkgs/development/interpreters/pixie/dust.nix new file mode 100644 index 000000000000..4a7f3423defd --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/pixie/dust.nix @@ -0,0 +1,35 @@ +{ stdenv, pixie, fetchFromGitHub }: + +stdenv.mkDerivation rec { + name = "dust-0-91"; + src = fetchFromGitHub { + owner = "pixie-lang"; + repo = "dust"; + rev = "efe469661e749a71e86858fd006f61464810575a"; + sha256 = "09n57b6haxwask9m8vimv42ikczf7lgfc7m9izjrcqgs0padvfzc"; + }; + buildInputs = [ pixie ]; + patches = [ ./make-paths-configurable.patch ]; + configurePhase = '' + pixiePath="${pixie}/bin/pixie-vm" \ + basePath="$out/share/dust" \ + substituteAll dust.in dust + chmod +x dust + ''; +# FIXME: AOT for dust +# buildPhase = '' +# find . -name "*.pxi" -exec pixie-vm -c {} \; +# ''; + installPhase = '' + mkdir -p $out/bin $out/share/dust + cp -a src/ run.pxi $out/share/dust + mv dust $out/bin/dust + ''; + + meta = { + description = "Provides tooling around pixie, e.g. a nicer repl, running tests and fetching dependencies"; + homepage = src.meta.homepage; + license = stdenv.lib.licenses.lgpl3; + platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/pixie/load_paths.patch b/nixpkgs/pkgs/development/interpreters/pixie/load_paths.patch new file mode 100644 index 000000000000..a36d280c5867 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/pixie/load_paths.patch @@ -0,0 +1,25 @@ +diff --git a/pixie/ffi-infer.pxi b/pixie/ffi-infer.pxi +index 9f13ac7..74301c2 100644 +--- a/pixie/ffi-infer.pxi ++++ b/pixie/ffi-infer.pxi +@@ -1,15 +1,12 @@ + (ns pixie.ffi-infer + (:require [pixie.io-blocking :as io])) + ++(defn -add-library-path [p] ++ (swap! load-paths conj (str p "/include")) ++ (swap! load-paths conj (str p "/lib"))) + +-(defn -add-rel-path [rel] +- (swap! load-paths conj (str (first @load-paths) "/" rel))) +- +-(-add-rel-path "lib") +-(-add-rel-path "include") +-(-add-rel-path "../lib") +-(-add-rel-path "../include") +- ++(doseq [lp @libraryPaths@] ++ (-add-library-path lp)) + + (def *config* nil) + (set-dynamic! (var *config*)) diff --git a/nixpkgs/pkgs/development/interpreters/pixie/make-paths-configurable.patch b/nixpkgs/pkgs/development/interpreters/pixie/make-paths-configurable.patch new file mode 100644 index 000000000000..122ab6e2c07b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/pixie/make-paths-configurable.patch @@ -0,0 +1,122 @@ +From 0cbb82e606610d36e52c70d888995fbbf9b0d7c8 Mon Sep 17 00:00:00 2001 +From: Herwig Hochleitner <herwig@bendlas.net> +Date: Sun, 28 Feb 2016 16:34:14 +0100 +Subject: [PATCH] make paths configurable + +--- + dust | 52 ---------------------------------------------------- + dust.in | 43 +++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 43 insertions(+), 52 deletions(-) + delete mode 100755 dust + create mode 100755 dust.in + +diff --git a/dust b/dust +deleted file mode 100755 +index ffced9b..0000000 +--- a/dust ++++ /dev/null +@@ -1,52 +0,0 @@ +-#!/usr/bin/env bash +- +-base_path=$0 +-if [ -L "$base_path" ]; then +- base_path=`readlink $base_path` +-fi +-base_path=`dirname $base_path` +- +-pixie_path=`which pixie-vm` +-if [ -z "$pixie_path" ]; then +- echo "Error: 'pixie-vm' must be on your PATH" +- exit 1 +-fi +- +-function set_load_path() { +- load_path="" +- if ([ -f "project.edn" ] || [ -f "project.pxi" ]) && [ -f ".load-path" ]; then +- load_path="`cat .load-path`" +- fi +-} +- +-if [ ! -f "project.edn" ] && [ -f "project.pxi" ]; then +- echo "Warning: 'project.pxi' is deprecated, please use 'project.edn'." +- echo "To start you can run the following command:" +- echo " pixie-vm -l $base_path/src -e '(require dust.project :as p) (p/load-project!) (prn (dissoc @p/*project* :path))'" +- echo +-fi +- +-set_load_path +-run_dust="$pixie_path -l $base_path/src $load_path $base_path/run.pxi" +- +-case $1 in +- ""|"repl") +- rlwrap_cmd="" +- if [ -n "`which rlwrap`" ]; then +- rlwrap_cmd="rlwrap -aignored -n" +- fi +- $rlwrap_cmd $pixie_path $load_path +- ;; +- "run") +- shift +- file=$1 +- shift +- $pixie_path $load_path $file $@ +- ;; +- -h|--help) +- $run_dust help +- ;; +- *) +- $run_dust $@ +- ;; +-esac +diff --git a/dust.in b/dust.in +new file mode 100755 +index 0000000..44a7fbd +--- /dev/null ++++ b/dust.in +@@ -0,0 +1,43 @@ ++#!/usr/bin/env bash ++ ++base_path=@basePath@ ++pixie_path=@pixiePath@ ++ ++function set_load_path() { ++ load_path="" ++ if ([ -f "project.edn" ] || [ -f "project.pxi" ]) && [ -f ".load-path" ]; then ++ load_path="`cat .load-path`" ++ fi ++} ++ ++if [ ! -f "project.edn" ] && [ -f "project.pxi" ]; then ++ echo "Warning: 'project.pxi' is deprecated, please use 'project.edn'." ++ echo "To start you can run the following command:" ++ echo " pixie-vm -l $base_path/src -e '(require dust.project :as p) (p/load-project!) (prn (dissoc @p/*project* :path))'" ++ echo ++fi ++ ++set_load_path ++run_dust="$pixie_path -l $base_path/src $load_path $base_path/run.pxi" ++ ++case $1 in ++ ""|"repl") ++ rlwrap_cmd="" ++ if [ -n "`which rlwrap`" ]; then ++ rlwrap_cmd="rlwrap -aignored -n" ++ fi ++ $rlwrap_cmd $pixie_path $load_path ++ ;; ++ "run") ++ shift ++ file=$1 ++ shift ++ $pixie_path $load_path $file $@ ++ ;; ++ -h|--help) ++ $run_dust help ++ ;; ++ *) ++ $run_dust $@ ++ ;; ++esac +-- +2.7.1 + diff --git a/nixpkgs/pkgs/development/interpreters/proglodyte-wasm/default.nix b/nixpkgs/pkgs/development/interpreters/proglodyte-wasm/default.nix new file mode 100644 index 000000000000..9a30ae7d8a85 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/proglodyte-wasm/default.nix @@ -0,0 +1,59 @@ +{ stdenv, fetchFromGitHub, cmake, clang, python, v8_static, coreutils }: + +let + sexpr_wasm_prototype = stdenv.mkDerivation { + name = "sexpr_wasm_prototype"; + src = fetchFromGitHub { + owner = "WebAssembly"; + repo = "sexpr-wasm-prototype"; + rev = "1347a367c34876bfe92562f244a8c8b770372479"; + sha256 = "1v1mph5fp1rffhvh8bbx937gpjqjrdgm7yhffdxzdn4pih9d0grn"; + }; + + configurePhase = '' + # set this to nonempty string to disable default cmake configure + ''; + + buildInputs = [ cmake clang python ]; + + buildPhase = "make clang-debug-no-tests"; + + hardeningDisable = [ "format" ]; + + installPhase = '' + mkdir -p $out/bin + cp out/clang/Debug/no-tests/sexpr-wasm $out/bin + ''; + }; + +in + +stdenv.mkDerivation { + name = "wasm-0.0.1"; + + src = fetchFromGitHub { + owner = "proglodyte"; + repo = "wasm"; + rev = "650188eecaaf4b64f12b341986b4e89e5fdb3bbe"; + sha256 = "1f5mdl0l2448lx7h36b4bdr541a4q1wapn1kdwrd4z7s94n7a5gq"; + }; + + configurePhase = '' + sed -i -e "s|sudo ||g" Makefile + ''; + + installPhase = '' + export DESTDIR=$out + export MKTEMPDIR=${coreutils}/bin + export D8DIR=${v8_static}/bin + export SWDIR=${sexpr_wasm_prototype}/bin + make install + ''; + + meta = with stdenv.lib; { + description = "wasm runs WebAssembly from the command line"; + maintainers = with maintainers; [ proglodyte ]; + platforms = platforms.linux; + license = licenses.asl20; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/pure/default.nix b/nixpkgs/pkgs/development/interpreters/pure/default.nix new file mode 100644 index 000000000000..c2b120576ea2 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/pure/default.nix @@ -0,0 +1,43 @@ +{ lib, stdenv, fetchurl, makeWrapper, + llvm, gmp, mpfr, readline, bison, flex }: + +stdenv.mkDerivation rec { + baseName="pure"; + version="0.68"; + name="${baseName}-${version}"; + + src = fetchurl { + url="https://github.com/agraef/pure-lang/releases/download/${name}/${name}.tar.gz"; + sha256="0px6x5ivcdbbp2pz5n1r1cwg1syadklhjw8piqhl63n91i4r7iyb"; + }; + + buildInputs = [ bison flex makeWrapper ]; + propagatedBuildInputs = [ llvm gmp mpfr readline ]; + + postPatch = '' + for f in expr.cc matcher.cc printer.cc symtable.cc parserdefs.hh; do + sed -i '1i\#include <stddef.h>' $f + done + ''; + + configureFlags = [ "--enable-release" ]; + doCheck = true; + checkPhase = '' + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${llvm}/lib make check + ''; + postInstall = '' + wrapProgram $out/bin/pure --prefix LD_LIBRARY_PATH : ${llvm}/lib + ''; + + meta = { + description = "A modern-style functional programming language based on term rewriting"; + maintainers = with lib.maintainers; + [ + raskin + asppsa + ]; + platforms = with lib.platforms; + linux; + license = lib.licenses.gpl3Plus; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/pyrex/0.9.5.nix b/nixpkgs/pkgs/development/interpreters/pyrex/0.9.5.nix new file mode 100644 index 000000000000..009f9b48ea4e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/pyrex/0.9.5.nix @@ -0,0 +1,20 @@ +{ stdenv, fetchurl, python2Packages }: + +let version = "0.9.5.1.1"; in + +python2Packages.buildPythonPackage rec { + name = "pyrex-${version}"; + + src = fetchurl { + url = "https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/oldtar/Pyrex-${version}.tar.gz"; + sha256 = "0lxxvn4mjfb83swcbqb5908q4iy53w4ip5i0f9angm2va1jyhd3z"; + }; + + doCheck = false; + + meta = { + homepage = http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/; + description = "A language for writing Python extension modules"; + license = stdenv.lib.licenses.asl20; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/pyrex/0.9.6.nix b/nixpkgs/pkgs/development/interpreters/pyrex/0.9.6.nix new file mode 100644 index 000000000000..d79cd58c1598 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/pyrex/0.9.6.nix @@ -0,0 +1,20 @@ +{ stdenv, fetchurl, python2Packages }: + +let version = "0.9.6.4"; in + +python2Packages.buildPythonPackage rec { + name = "pyrex-${version}"; + + src = fetchurl { + url = "https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/oldtar/Pyrex-${version}.tar.gz"; + sha256 = "18pd9f8al3l6i27cc0ddhgg7hxf28lnfs75x4a8jzscydxgiq5a8"; + }; + + doCheck = false; + + meta = { + homepage = http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/; + description = "A language for writing Python extension modules"; + license = stdenv.lib.licenses.asl20; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/build-python-package-common.nix b/nixpkgs/pkgs/development/interpreters/python/build-python-package-common.nix new file mode 100644 index 000000000000..2b383fe985d1 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/build-python-package-common.nix @@ -0,0 +1,32 @@ +# This function provides generic bits to install a Python wheel. + +{ python +, bootstrapped-pip +}: + +{ buildInputs ? [] +# Additional flags to pass to "pip install". +, installFlags ? [] +, ... } @ attrs: + +attrs // { + buildInputs = buildInputs ++ [ bootstrapped-pip ]; + + configurePhase = attrs.configurePhase or '' + runHook preConfigure + runHook postConfigure + ''; + + installPhase = attrs.installPhase or '' + runHook preInstall + + mkdir -p "$out/${python.sitePackages}" + export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" + + pushd dist + ${bootstrapped-pip}/bin/pip install *.whl --no-index --prefix=$out --no-cache ${toString installFlags} --build tmpbuild + popd + + runHook postInstall + ''; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/build-python-package-flit.nix b/nixpkgs/pkgs/development/interpreters/python/build-python-package-flit.nix new file mode 100644 index 000000000000..911078a5e340 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/build-python-package-flit.nix @@ -0,0 +1,22 @@ +# This function provides specific bits for building a flit-based Python package. + +{ python +, flit +}: + +{ ... } @ attrs: + +attrs // { + buildInputs = [ flit ]; + buildPhase = attrs.buildPhase or '' + runHook preBuild + flit build --format wheel + runHook postBuild + ''; + + # Flit packages, like setuptools packages, might have tests. + installCheckPhase = attrs.checkPhase or '' + ${python.interpreter} -m unittest discover + ''; + doCheck = attrs.doCheck or true; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/build-python-package-setuptools.nix b/nixpkgs/pkgs/development/interpreters/python/build-python-package-setuptools.nix new file mode 100644 index 000000000000..bc512357acd5 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/build-python-package-setuptools.nix @@ -0,0 +1,56 @@ +# This function provides specific bits for building a setuptools-based Python package. + +{ lib +, python +, bootstrapped-pip +}: + +{ +# passed to "python setup.py build_ext" +# https://github.com/pypa/pip/issues/881 + setupPyBuildFlags ? [] +# Execute before shell hook +, preShellHook ? "" +# Execute after shell hook +, postShellHook ? "" +, ... } @ attrs: + +let + # use setuptools shim (so that setuptools is imported before distutils) + # pip does the same thing: https://github.com/pypa/pip/pull/3265 + setuppy = ./run_setup.py; + +in attrs // { + # we copy nix_run_setup over so it's executed relative to the root of the source + # many project make that assumption + buildPhase = attrs.buildPhase or '' + runHook preBuild + cp ${setuppy} nix_run_setup + ${python.interpreter} nix_run_setup ${lib.optionalString (setupPyBuildFlags != []) ("build_ext " + (lib.concatStringsSep " " setupPyBuildFlags))} bdist_wheel + runHook postBuild + ''; + + installCheckPhase = attrs.checkPhase or '' + runHook preCheck + ${python.interpreter} nix_run_setup test + runHook postCheck + ''; + + # Python packages that are installed with setuptools + # are typically distributed with tests. + # With Python it's a common idiom to run the tests + # after the software has been installed. + doCheck = attrs.doCheck or true; + + shellHook = attrs.shellHook or '' + ${preShellHook} + if test -e setup.py; then + tmp_path=$(mktemp -d) + export PATH="$tmp_path/bin:$PATH" + export PYTHONPATH="$tmp_path/${python.sitePackages}:$PYTHONPATH" + mkdir -p $tmp_path/${python.sitePackages} + ${bootstrapped-pip}/bin/pip install -e . --prefix $tmp_path >&2 + fi + ${postShellHook} + ''; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/build-python-package-wheel.nix b/nixpkgs/pkgs/development/interpreters/python/build-python-package-wheel.nix new file mode 100644 index 000000000000..7be0a4c304a3 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/build-python-package-wheel.nix @@ -0,0 +1,20 @@ +# This function provides specific bits for building a wheel-based Python package. + +{ +}: + +{ ... } @ attrs: + +attrs // { + unpackPhase = '' + mkdir dist + cp $src dist/"''${src#*-}" + ''; + + # Wheels are pre-compiled + buildPhase = attrs.buildPhase or ":"; + installCheckPhase = attrs.checkPhase or ":"; + + # Wheels don't have any checks to run + doCheck = attrs.doCheck or false; +} \ No newline at end of file diff --git a/nixpkgs/pkgs/development/interpreters/python/build-python-package.nix b/nixpkgs/pkgs/development/interpreters/python/build-python-package.nix new file mode 100644 index 000000000000..391086a662ec --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/build-python-package.nix @@ -0,0 +1,47 @@ +# This function provides a generic Python package builder, +# and can build packages that use distutils, setuptools or flit. + +{ lib +, config +, python +, wrapPython +, setuptools +, unzip +, ensureNewerSourcesForZipFilesHook +, toPythonModule +, namePrefix +, bootstrapped-pip +, flit +, writeScript +, update-python-libraries +}: + +let + setuptools-specific = import ./build-python-package-setuptools.nix { inherit lib python bootstrapped-pip; }; + flit-specific = import ./build-python-package-flit.nix { inherit python flit; }; + wheel-specific = import ./build-python-package-wheel.nix { }; + common = import ./build-python-package-common.nix { inherit python bootstrapped-pip; }; + mkPythonDerivation = import ./mk-python-derivation.nix { + inherit lib config python wrapPython setuptools unzip ensureNewerSourcesForZipFilesHook; + inherit toPythonModule namePrefix writeScript update-python-libraries; + }; +in + +{ +# Several package formats are supported. +# "setuptools" : Install a common setuptools/distutils based package. This builds a wheel. +# "wheel" : Install from a pre-compiled wheel. +# "flit" : Install a flit package. This builds a wheel. +# "other" : Provide your own buildPhase and installPhase. +format ? "setuptools" +, ... } @ attrs: + +let + formatspecific = + if format == "setuptools" then common (setuptools-specific attrs) + else if format == "flit" then common (flit-specific attrs) + else if format == "wheel" then common (wheel-specific attrs) + else if format == "other" then {} + else throw "Unsupported format ${format}"; + +in mkPythonDerivation ( attrs // formatspecific ) diff --git a/nixpkgs/pkgs/development/interpreters/python/catch_conflicts/README.md b/nixpkgs/pkgs/development/interpreters/python/catch_conflicts/README.md new file mode 100644 index 000000000000..d144b80e3385 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/catch_conflicts/README.md @@ -0,0 +1,13 @@ + + +catch_conflicts.py +================== + +The file catch_conflicts.py is in a subdirectory because, if it isn't, the +/nix/store/ directory is added to sys.path causing a delay when building. + +Pointers: + +- https://docs.python.org/3/library/sys.html#sys.path + +- https://github.com/NixOS/nixpkgs/pull/23600 diff --git a/nixpkgs/pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py b/nixpkgs/pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py new file mode 100644 index 000000000000..bb82900c65a9 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py @@ -0,0 +1,30 @@ +import pkg_resources +import collections +import sys + +do_abort = False +packages = collections.defaultdict(list) + +for f in sys.path: + for req in pkg_resources.find_distributions(f): + if req not in packages[req.project_name]: + # some exceptions inside buildPythonPackage + if req.project_name in ['setuptools', 'pip', 'wheel']: + continue + packages[req.project_name].append(req) + + +for name, duplicates in packages.items(): + if len(duplicates) > 1: + do_abort = True + print("Found duplicated packages in closure for dependency '{}': ".format(name)) + for dup in duplicates: + print(" " + repr(dup)) + +if do_abort: + print("") + print( + 'Package duplicates found in closure, see above. Usually this ' + 'happens if two packages depend on different version ' + 'of the same dependency.') + sys.exit(1) diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-ctypes-util-find_library.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-ctypes-util-find_library.patch new file mode 100644 index 000000000000..22bc0f7ced0a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-ctypes-util-find_library.patch @@ -0,0 +1,34 @@ +--- origsrc/Lib/ctypes/util.py 2007-09-14 15:05:26.000000000 -0500 ++++ src/Lib/ctypes/util.py 2008-11-25 17:54:47.319296200 -0600 +@@ -41,6 +41,20 @@ + continue + return None + ++elif sys.platform == "cygwin": ++ def find_library(name): ++ for libdir in ['/usr/lib', '/usr/local/lib']: ++ for libext in ['lib%s.dll.a' % name, 'lib%s.a' % name]: ++ implib = os.path.join(libdir, libext) ++ if not os.path.exists(implib): ++ continue ++ cmd = "dlltool -I " + implib + " 2>/dev/null" ++ res = os.popen(cmd).read().replace("\n","") ++ if not res: ++ continue ++ return res ++ return None ++ + elif os.name == "posix": + # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump + import re, tempfile, errno +@@ -157,6 +173,10 @@ + print cdll.LoadLibrary("libcrypto.dylib") + print cdll.LoadLibrary("libSystem.dylib") + print cdll.LoadLibrary("System.framework/System") ++ elif sys.platform == "cygwin": ++ print cdll.LoadLibrary("cygbz2-1.dll") ++ print find_library("crypt") ++ print cdll.LoadLibrary("cygcrypt-0.dll") + else: + print cdll.LoadLibrary("libm.so") + print cdll.LoadLibrary("libcrypt.so") diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-tkinter-x11.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-tkinter-x11.patch new file mode 100644 index 000000000000..28b6dafc3f15 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.5.2-tkinter-x11.patch @@ -0,0 +1,27 @@ +--- origsrc/setup.py 2008-02-04 17:41:02.000000000 -0600 ++++ src/setup.py 2008-07-02 02:11:28.671875000 -0500 +@@ -1277,12 +1279,6 @@ + include_dirs.append('/usr/X11/include') + added_lib_dirs.append('/usr/X11/lib') + +- # If Cygwin, then verify that X is installed before proceeding +- if host_platform == 'cygwin': +- x11_inc = find_file('X11/Xlib.h', [], include_dirs) +- if x11_inc is None: +- return +- + # Check for BLT extension + if self.compiler.find_library_file(lib_dirs + added_lib_dirs, + 'BLT8.0'): +@@ -1300,9 +1296,8 @@ + if host_platform in ['aix3', 'aix4']: + libs.append('ld') + +- # Finally, link with the X11 libraries (not appropriate on cygwin) +- if host_platform != "cygwin": +- libs.append('X11') ++ # Finally, link with the X11 libraries ++ libs.append('X11') + + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)] + defs, diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.2-ssl-threads.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.2-ssl-threads.patch new file mode 100644 index 000000000000..bef137efda7b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.2-ssl-threads.patch @@ -0,0 +1,13 @@ +--- origsrc/Modules/_ssl.c 2009-01-26 10:55:41.000000000 -0600 ++++ src/Modules/_ssl.c 2009-08-20 00:04:59.346816700 -0500 +@@ -15,6 +15,10 @@ + + #include "Python.h" + ++#ifdef __CYGWIN__ ++#undef WITH_THREAD ++#endif ++ + #ifdef WITH_THREAD + #include "pythread.h" + #define PySSL_BEGIN_ALLOW_THREADS { \ diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-FD_SETSIZE.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-FD_SETSIZE.patch new file mode 100644 index 000000000000..d1dae8c47dc1 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-FD_SETSIZE.patch @@ -0,0 +1,41 @@ +--- Python-2.6.5.orig/Modules/selectmodule.c 2012-02-02 22:35:21.835125000 -0500 ++++ Python-2.6.5/Modules/selectmodule.c 2012-02-02 22:41:41.210125000 -0500 +@@ -6,6 +6,21 @@ + >= 0. + */ + ++/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined. ++ 64 is too small (too many people have bumped into that limit). ++ Here we boost it. ++ ++ Cygwin also defines FD_SETSIZE to 64, so also increase the limit on ++ Cygwin. We must do this before sys/types.h is included, which otherwise ++ sets FD_SETSIZE to the default. ++ ++ Users who want even more than the boosted limit should #define ++ FD_SETSIZE higher before this; e.g., via compiler /D switch. ++*/ ++#if (defined(MS_WINDOWS) || defined(__CYGWIN__)) && !defined(FD_SETSIZE) ++#define FD_SETSIZE 512 ++#endif ++ + #include "Python.h" + #include <structmember.h> + +@@ -16,16 +31,6 @@ + #undef HAVE_BROKEN_POLL + #endif + +-/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined. +- 64 is too small (too many people have bumped into that limit). +- Here we boost it. +- Users who want even more than the boosted limit should #define +- FD_SETSIZE higher before this; e.g., via compiler /D switch. +-*/ +-#if defined(MS_WINDOWS) && !defined(FD_SETSIZE) +-#define FD_SETSIZE 512 +-#endif +- + #if defined(HAVE_POLL_H) + #include <poll.h> + #elif defined(HAVE_SYS_POLL_H) diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-export-PySignal_SetWakeupFd.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-export-PySignal_SetWakeupFd.patch new file mode 100644 index 000000000000..ea696978236a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-export-PySignal_SetWakeupFd.patch @@ -0,0 +1,11 @@ +--- origsrc/Include/pyerrors.h 2008-06-08 23:58:54.000000000 -0500 ++++ src/Include/pyerrors.h 2010-05-12 04:19:31.535297200 -0500 +@@ -232,7 +232,7 @@ PyAPI_FUNC(int) PyErr_CheckSignals(void) + PyAPI_FUNC(void) PyErr_SetInterrupt(void); + + /* In signalmodule.c */ +-int PySignal_SetWakeupFd(int fd); ++PyAPI_FUNC(int) PySignal_SetWakeupFd(int fd); + + /* Support for adding program text to SyntaxErrors */ + PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int); diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-ncurses-abi6.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-ncurses-abi6.patch new file mode 100644 index 000000000000..e1cf5ad4bbf9 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.6.5-ncurses-abi6.patch @@ -0,0 +1,16 @@ +--- origsrc/Include/py_curses.h 2009-09-06 16:23:05.000000000 -0500 ++++ src/Include/py_curses.h 2010-04-14 15:21:23.008971400 -0500 +@@ -17,6 +17,13 @@ + #define NCURSES_OPAQUE 0 + #endif /* __APPLE__ */ + ++#ifdef __CYGWIN__ ++/* the following define is necessary for Cygwin; without it, the ++ Cygwin-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python ++ can't get at the WINDOW flags field. */ ++#define NCURSES_INTERNALS ++#endif /* __CYGWIN__ */ ++ + #ifdef __FreeBSD__ + /* + ** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dbm.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dbm.patch new file mode 100644 index 000000000000..bfaeb37c287d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dbm.patch @@ -0,0 +1,27 @@ +--- origsrc/setup.py.orig 2012-11-27 10:20:47.442395900 -0500 ++++ src/setup.py 2012-11-27 10:53:15.583020900 -0500 +@@ -1141,7 +1141,7 @@ + + dbm_order = ['gdbm'] + # The standard Unix dbm module: +- if host_platform not in ['cygwin']: ++ if host_platform not in ['win32']: + config_args = [arg.strip("'") + for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] + dbm_args = [arg for arg in config_args +@@ -1192,6 +1192,15 @@ + ], + libraries = gdbm_libs) + break ++ if find_file("ndbm.h", inc_dirs, []) is not None: ++ print("building dbm using gdbm") ++ dbmext = Extension( ++ 'dbm', ['dbmmodule.c'], ++ define_macros=[ ++ ('HAVE_NDBM_H', None), ++ ], ++ libraries = gdbm_libs) ++ break + elif cand == "bdb": + if db_incs is not None: + print "building dbm using bdb" diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dylib.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dylib.patch new file mode 100644 index 000000000000..6e1fc8b53e83 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-dylib.patch @@ -0,0 +1,10 @@ +--- origsrc/Lib/distutils/unixccompiler.py.orig 2012-11-27 07:44:15.409993500 -0500 ++++ src/Lib/distutils/unixccompiler.py 2012-11-27 08:09:57.801770900 -0500 +@@ -141,6 +141,7 @@ + static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s" + if sys.platform == "cygwin": + exe_extension = ".exe" ++ dylib_lib_extension = ".dll.a" + + def preprocess(self, source, + output_file=None, macros=None, include_dirs=None, diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-getpath-exe-extension.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-getpath-exe-extension.patch new file mode 100644 index 000000000000..68f6921ba6aa --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-getpath-exe-extension.patch @@ -0,0 +1,31 @@ +--- origsrc/Modules/getpath.c.orig 2012-11-27 12:07:56.098645900 -0500 ++++ src/Modules/getpath.c 2012-11-27 12:10:11.254895900 -0500 +@@ -436,6 +436,28 @@ + if (isxfile(progpath)) + break; + ++#ifdef __CYGWIN__ ++ /* ++ * Cygwin automatically removes the ".exe" extension from argv[0] ++ * to make programs feel like they are in a more Unix-like ++ * environment. Unfortunately, this can make it problemmatic for ++ * Cygwin to distinguish between a directory and an executable with ++ * the same name excluding the ".exe" extension. For example, the ++ * Cygwin Python build directory has a "Python" directory and a ++ * "python.exe" executable. This causes isxfile() to erroneously ++ * return false. If isdir() returns true and there is enough space ++ * to append the ".exe" extension, then we try again with the ++ * extension appended. ++ */ ++#define EXE ".exe" ++ if (isdir(progpath) && strlen(progpath) + strlen(EXE) <= MAXPATHLEN) ++ { ++ strcat(progpath, EXE); ++ if (isxfile(progpath)) ++ break; ++ } ++#endif /* __CYGWIN__ */ ++ + if (!delim) { + progpath[0] = '\0'; + break; diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-no-libm.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-no-libm.patch new file mode 100644 index 000000000000..55281db6768f --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/2.7.3-no-libm.patch @@ -0,0 +1,11 @@ +--- origsrc/setup.py.orig 2012-11-27 09:28:34.051770900 -0500 ++++ src/setup.py 2012-11-27 09:28:47.239270900 -0500 +@@ -470,7 +470,7 @@ + + # Check for MacOS X, which doesn't need libm.a at all + math_libs = ['m'] +- if host_platform in ['darwin', 'beos']: ++ if host_platform in ['darwin', 'beos', 'cygwin']: + math_libs = [] + + # XXX Omitted modules: gl, pure, dl, SGI-specific modules diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/boot.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/boot.nix new file mode 100644 index 000000000000..976d30819dbe --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/boot.nix @@ -0,0 +1,105 @@ +{ stdenv, fetchurl, configd, CF, coreutils }: + +with stdenv.lib; + +let + + mkPaths = paths: { + C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths; + LIBRARY_PATH = makeLibraryPath paths; + }; + +in + +stdenv.mkDerivation rec { + name = "python-boot-${version}"; + version = "2.7.12"; + libPrefix = "python2.7"; + + src = fetchurl { + url = "https://www.python.org/ftp/python/2.7.12/Python-${version}.tar.xz"; + sha256 = "0y7rl603vmwlxm6ilkhc51rx2mfj14ckcz40xxgs0ljnvlhp30yp"; + }; + + inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH; + + LDFLAGS = optionalString (!stdenv.isDarwin) "-lgcc_s"; + NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2"; + + buildInputs = optionals stdenv.isDarwin [ CF configd ]; + + patches = + [ # Look in C_INCLUDE_PATH and LIBRARY_PATH for stuff. + ./search-path.patch + + # Python recompiles a Python if the mtime stored *in* the + # pyc/pyo file differs from the mtime of the source file. This + # doesn't work in Nix because Nix changes the mtime of files in + # the Nix store to 1. So treat that as a special case. + ./nix-store-mtime.patch + + # patch python to put zero timestamp into pyc + # if DETERMINISTIC_BUILD env var is set + ./deterministic-build.patch + ]; + + # Hack hack hack to stop shit from failing from a missing _scproxy on Darwin. Since + # we only use this python for bootstrappy things, it doesn't really matter if it + # doesn't have perfect proxy support in urllib :) this just makes it fall back on env + # vars instead of attempting to read the proxy configuration automatically, so not a + # huge loss even if for whatever reason we did want proxy support. + postPatch = '' + substituteInPlace Lib/urllib.py --replace "if sys.platform == 'darwin'" "if False" + ''; + + DETERMINISTIC_BUILD = 1; + + preConfigure = '' + # Purity. + for i in /usr /sw /opt /pkg; do + substituteInPlace ./setup.py --replace $i /no-such-path + done + '' + optionalString (stdenv ? cc && stdenv.cc.libc != null) '' + for i in Lib/plat-*/regen; do + substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/ + done + '' + optionalString stdenv.isDarwin '' + substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"' + substituteInPlace Lib/multiprocessing/__init__.py \ + --replace 'os.popen(comm)' 'os.popen("${coreutils}/bin/nproc")' + ''; + + configureFlags = [ "--enable-shared" "--with-threads" "--enable-unicode=ucs4" ] + ++ optionals stdenv.isCygwin [ "ac_cv_func_bind_textdomain_codeset=yes" ] + ++ optionals stdenv.isDarwin [ "--disable-toolbox-glue" ]; + + postInstall = + '' + ln -s $out/share/man/man1/{python2.7.1.gz,python.1.gz} + + paxmark E $out/bin/python2.7 + + rm "$out"/lib/python*/plat-*/regen # refers to glibc.dev + ''; + + enableParallelBuilding = true; + + passthru.pkgs = builtins.throw "python-boot does not support packages, this package is only intended for bootstrapping." {}; + + meta = { + homepage = http://python.org; + description = "A high-level dynamically-typed programming language"; + longDescription = '' + Python is a remarkably powerful dynamic programming language that + is used in a wide variety of application domains. Some of its key + distinguishing features include: clear, readable syntax; strong + introspection capabilities; intuitive object orientation; natural + expression of procedural code; full modularity, supporting + hierarchical packages; exception-based error handling; and very + high level dynamic data types. + ''; + license = stdenv.lib.licenses.psfl; + platforms = stdenv.lib.platforms.all; + maintainers = with stdenv.lib.maintainers; [ lnl7 chaoflow domenkozar ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/cross-compile.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/cross-compile.patch new file mode 100644 index 000000000000..c83b56437a49 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/cross-compile.patch @@ -0,0 +1,32 @@ +--- ./setup.py.orig 2018-04-29 15:47:33.000000000 -0700 ++++ ./setup.py 2018-11-11 09:41:58.097682221 -0800 +@@ -458,8 +458,6 @@ + if not cross_compiling: + add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') + add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') +- if cross_compiling: +- self.add_gcc_paths() + self.add_multiarch_paths() + + # Add paths specified in the environment variables LDFLAGS and +@@ -517,7 +515,10 @@ + # be assumed that no additional -I,-L directives are needed. + inc_dirs = self.compiler.include_dirs[:] + lib_dirs = self.compiler.library_dirs[:] +- if not cross_compiling: ++ if cross_compiling: ++ inc_dirs = [] ++ lib_dirs = [] ++ else: + for d in ( + '/usr/include', + ): +@@ -582,6 +584,8 @@ class PyBuildExt(build_ext): + # Some modules that are normally always on: + #exts.append( Extension('_weakref', ['_weakref.c']) ) + ++ self.compiler.library_dirs = lib_dirs + [ '.' ] ++ + # array objects + exts.append( Extension('array', ['arraymodule.c']) ) + diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix new file mode 100644 index 000000000000..63dad3bf42ff --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix @@ -0,0 +1,293 @@ +{ stdenv, buildPackages, fetchurl +, bzip2 +, gdbm +, fetchpatch +, ncurses +, openssl +, readline +, sqlite +, tcl ? null, tk ? null, tix ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? false +, zlib +, callPackage +, self +, db +, expat +, libffi +, CF, configd, coreutils +, python-setup-hook +# Some proprietary libs assume UCS2 unicode, especially on darwin :( +, ucsEncoding ? 4 +# For the Python package set +, packageOverrides ? (self: super: {}) +}: + +assert x11Support -> tcl != null + && tk != null + && xlibsWrapper != null + && libX11 != null; + +with stdenv.lib; + +let + majorVersion = "2.7"; + minorVersion = "15"; + minorVersionSuffix = ""; + version = "${majorVersion}.${minorVersion}${minorVersionSuffix}"; + libPrefix = "python${majorVersion}"; + sitePackages = "lib/${libPrefix}/site-packages"; + + src = fetchurl { + url = "https://www.python.org/ftp/python/${majorVersion}.${minorVersion}/Python-${version}.tar.xz"; + sha256 = "0x2mvz9dp11wj7p5ccvmk9s0hzjk2fa1m462p395l4r6bfnb3n92"; + }; + + hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); + patches = + [ # Look in C_INCLUDE_PATH and LIBRARY_PATH for stuff. + ./search-path.patch + + # Python recompiles a Python if the mtime stored *in* the + # pyc/pyo file differs from the mtime of the source file. This + # doesn't work in Nix because Nix changes the mtime of files in + # the Nix store to 1. So treat that as a special case. + ./nix-store-mtime.patch + + # patch python to put zero timestamp into pyc + # if DETERMINISTIC_BUILD env var is set + ./deterministic-build.patch + + # Fix python bug #27177 (https://bugs.python.org/issue27177) + # The issue is that `match.group` only recognizes python integers + # instead of everything that has `__index__`. + # This bug was fixed upstream, but not backported to 2.7 + (fetchpatch { + name = "re_match_index.patch"; + url = "https://bugs.python.org/file43084/re_match_index.patch"; + sha256 = "0l9rw6r5r90iybdkp3hhl2pf0h0s1izc68h5d3ywrm92pq32wz57"; + }) + + # "`type_getattro()` calls `tp_descr_get(self, obj, type)` without actually owning a reference to "self". + # In very rare cases, this can cause a segmentation fault if "self" is deleted by the descriptor." + # https://github.com/python/cpython/pull/6118 + (fetchpatch { + name = "type_getattro.patch"; + url = "file://${./type_getattro.patch}"; + sha256 = "11v9yx20hs3jmw0wggzvmw39qs4mxay4kb8iq2qjydwy9ya61nrd"; + }) + + (fetchpatch { + name = "CVE-2018-1000802.patch"; + url = "https://github.com/python/cpython/pull/8985.patch"; + sha256 = "1c8nq2c9sjqa8ipl62hiandg6a7lzrwwfhi3ky6jd3pxgyalrh97"; + }) + ] ++ optionals (x11Support && stdenv.isDarwin) [ + ./use-correct-tcl-tk-on-darwin.patch + ] ++ optionals stdenv.isLinux [ + + # Disable the use of ldconfig in ctypes.util.find_library (since + # ldconfig doesn't work on NixOS), and don't use + # ctypes.util.find_library during the loading of the uuid module + # (since it will do a futile invocation of gcc (!) to find + # libuuid, slowing down program startup a lot). + ./no-ldconfig.patch + + ] ++ optionals stdenv.hostPlatform.isCygwin [ + ./2.5.2-ctypes-util-find_library.patch + ./2.5.2-tkinter-x11.patch + ./2.6.2-ssl-threads.patch + ./2.6.5-export-PySignal_SetWakeupFd.patch + ./2.6.5-FD_SETSIZE.patch + ./2.6.5-ncurses-abi6.patch + ./2.7.3-dbm.patch + ./2.7.3-dylib.patch + ./2.7.3-getpath-exe-extension.patch + ./2.7.3-no-libm.patch + ] ++ optionals hasDistutilsCxxPatch [ + + # Patch from http://bugs.python.org/issue1222585 adapted to work with + # `patch -p1' and with a last hunk removed + # Upstream distutils is calling C compiler to compile C++ code, which + # only works for GCC and Apple Clang. This makes distutils to call C++ + # compiler when needed. + ./python-2.7-distutils-C++.patch + ] ++ optional (stdenv.hostPlatform != stdenv.buildPlatform) [ + ./cross-compile.patch + ]; + + preConfigure = '' + # Purity. + for i in /usr /sw /opt /pkg; do + substituteInPlace ./setup.py --replace $i /no-such-path + done + '' + optionalString (stdenv ? cc && stdenv.cc.libc != null) '' + for i in Lib/plat-*/regen; do + substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/ + done + '' + optionalString stdenv.isDarwin '' + substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"' + substituteInPlace Lib/multiprocessing/__init__.py \ + --replace 'os.popen(comm)' 'os.popen("${coreutils}/bin/nproc")' + ''; + + configureFlags = [ + "--enable-shared" + "--with-threads" + "--enable-unicode=ucs${toString ucsEncoding}" + ] ++ optionals (stdenv.hostPlatform.isCygwin || stdenv.hostPlatform.isAarch64) [ + "--with-system-ffi" + ] ++ optionals stdenv.hostPlatform.isCygwin [ + "--with-system-expat" + "ac_cv_func_bind_textdomain_codeset=yes" + ] ++ optionals stdenv.isDarwin [ + "--disable-toolbox-glue" + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "PYTHON_FOR_BUILD=${getBin buildPackages.python}/bin/python" + "ac_cv_buggy_getaddrinfo=no" + # Assume little-endian IEEE 754 floating point when cross compiling + "ac_cv_little_endian_double=yes" + "ac_cv_big_endian_double=no" + "ac_cv_mixed_endian_double=no" + "ac_cv_x87_double_rounding=yes" + "ac_cv_tanh_preserves_zero_sign=yes" + # Generally assume that things are present and work + "ac_cv_posix_semaphores_enabled=yes" + "ac_cv_broken_sem_getvalue=no" + "ac_cv_wchar_t_signed=yes" + "ac_cv_rshift_extends_sign=yes" + "ac_cv_broken_nice=no" + "ac_cv_broken_poll=no" + "ac_cv_working_tzset=yes" + "ac_cv_have_long_long_format=yes" + "ac_cv_have_size_t_format=yes" + "ac_cv_computed_gotos=yes" + "ac_cv_file__dev_ptmx=yes" + "ac_cv_file__dev_ptc=yes" + ] + # Never even try to use lchmod on linux, + # don't rely on detecting glibc-isms. + ++ optional stdenv.hostPlatform.isLinux "ac_cv_func_lchmod=no"; + + buildInputs = + optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++ + [ bzip2 openssl zlib ] + ++ optional (stdenv.hostPlatform.isCygwin || stdenv.hostPlatform.isAarch64) libffi + ++ optional stdenv.hostPlatform.isCygwin expat + ++ [ db gdbm ncurses sqlite readline ] + ++ optionals x11Support [ tcl tk xlibsWrapper libX11 ] + ++ optionals stdenv.isDarwin ([ CF ] ++ optional (configd != null) configd); + nativeBuildInputs = + optionals (stdenv.hostPlatform != stdenv.buildPlatform) + [ buildPackages.stdenv.cc buildPackages.python ]; + + mkPaths = paths: { + C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" paths; + LIBRARY_PATH = makeLibraryPath paths; + }; + + # Python 2.7 needs this + crossCompileEnv = stdenv.lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) + { _PYTHON_HOST_PLATFORM = stdenv.hostPlatform.config; }; + + # Build the basic Python interpreter without modules that have + # external dependencies. + +in stdenv.mkDerivation ({ + name = "python-${version}"; + pythonVersion = majorVersion; + + inherit majorVersion version src patches buildInputs nativeBuildInputs + preConfigure configureFlags; + + LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s"; + inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH; + + NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2" + + optionalString stdenv.hostPlatform.isMusl " -DTHREAD_STACK_SIZE=0x100000"; + DETERMINISTIC_BUILD = 1; + + setupHook = python-setup-hook sitePackages; + + postPatch = optionalString (x11Support && (tix != null)) '' + substituteInPlace "Lib/lib-tk/Tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" + ''; + + postInstall = + '' + # needed for some packages, especially packages that backport + # functionality to 2.x from 3.x + for item in $out/lib/python${majorVersion}/test/*; do + if [[ "$item" != */test_support.py* + && "$item" != */test/support + && "$item" != */test/regrtest.py* ]]; then + rm -rf "$item" + else + echo $item + fi + done + touch $out/lib/python${majorVersion}/test/__init__.py + ln -s $out/lib/python${majorVersion}/pdb.py $out/bin/pdb + ln -s $out/lib/python${majorVersion}/pdb.py $out/bin/pdb${majorVersion} + ln -s $out/share/man/man1/{python2.7.1.gz,python.1.gz} + + paxmark E $out/bin/python${majorVersion} + + # Python on Nix is not manylinux1 compatible. https://github.com/NixOS/nixpkgs/issues/18484 + echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py + + rm "$out"/lib/python*/plat-*/regen # refers to glibc.dev + + # Determinism: Windows installers were not deterministic. + # We're also not interested in building Windows installers. + find "$out" -name 'wininst*.exe' | xargs -r rm -f + '' + optionalString (stdenv.hostPlatform == stdenv.buildPlatform) + '' + # Determinism: rebuild all bytecode + # We exclude lib2to3 because that's Python 2 code which fails + # We rebuild three times, once for each optimization level + find $out -name "*.py" | $out/bin/python -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | $out/bin/python -O -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | $out/bin/python -OO -m compileall -q -f -x "lib2to3" -i - + '' + optionalString stdenv.hostPlatform.isCygwin '' + cp libpython2.7.dll.a $out/lib + ''; + + passthru = let + pythonPackages = callPackage ../../../../../top-level/python-packages.nix { + python = self; + overrides = packageOverrides; + }; + in rec { + inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch ucsEncoding; + executable = libPrefix; + buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; }; + withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;}; + pkgs = pythonPackages; + isPy2 = true; + isPy27 = true; + interpreter = "${self}/bin/${executable}"; + }; + + enableParallelBuilding = true; + + doCheck = false; # expensive, and fails + + meta = { + homepage = http://python.org; + description = "A high-level dynamically-typed programming language"; + longDescription = '' + Python is a remarkably powerful dynamic programming language that + is used in a wide variety of application domains. Some of its key + distinguishing features include: clear, readable syntax; strong + introspection capabilities; intuitive object orientation; natural + expression of procedural code; full modularity, supporting + hierarchical packages; exception-based error handling; and very + high level dynamic data types. + ''; + license = stdenv.lib.licenses.psfl; + platforms = stdenv.lib.platforms.all; + maintainers = with stdenv.lib.maintainers; [ fridh ]; + # Higher priority than Python 3.x so that `/bin/python` points to `/bin/python2` + # in case both 2 and 3 are installed. + priority = -100; + }; + } // crossCompileEnv) diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/deterministic-build.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/deterministic-build.patch new file mode 100644 index 000000000000..98d9d339fa11 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/deterministic-build.patch @@ -0,0 +1,36 @@ +diff -ur orig/Lib/py_compile.py new/Lib/py_compile.py +--- orig/Lib/py_compile.py ++++ new/Lib/py_compile.py +@@ -122,7 +122,10 @@ + cfile = file + (__debug__ and 'c' or 'o') + with open(cfile, 'wb') as fc: + fc.write('\0\0\0\0') +- wr_long(fc, timestamp) ++ if "DETERMINISTIC_BUILD" in os.environ: ++ fc.write('\0\0\0\0') ++ else: ++ wr_long(fc, timestamp) + marshal.dump(codeobject, fc) + fc.flush() + fc.seek(0, 0) +diff -ur orig/Python/import.c new/Python/import.c +--- orig/Python/import.c ++++ new/Python/import.c +@@ -939,10 +939,12 @@ + return; + } + /* Now write the true mtime (as a 32-bit field) */ +- fseek(fp, 4L, 0); +- assert(mtime <= 0xFFFFFFFF); +- PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); +- fflush(fp); ++ if (Py_GETENV("DETERMINISTIC_BUILD") == NULL) { ++ fseek(fp, 4L, 0); ++ assert(mtime <= 0xFFFFFFFF); ++ PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); ++ fflush(fp); ++ } + fclose(fp); + if (Py_VerboseFlag) + PySys_WriteStderr("# wrote %s\n", cpathname); + diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/nix-store-mtime.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/nix-store-mtime.patch new file mode 100644 index 000000000000..83f3fea1931b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/nix-store-mtime.patch @@ -0,0 +1,12 @@ +diff -ru -x '*~' Python-2.7.1-orig/Python/import.c Python-2.7.1/Python/import.c +--- Python-2.7.1-orig/Python/import.c 2010-05-20 20:37:55.000000000 +0200 ++++ Python-2.7.1/Python/import.c 2011-01-04 15:55:11.000000000 +0100 +@@ -751,7 +751,7 @@ + return NULL; + } + pyc_mtime = PyMarshal_ReadLongFromFile(fp); +- if (pyc_mtime != mtime) { ++ if (pyc_mtime != mtime && mtime != 1) { + if (Py_VerboseFlag) + PySys_WriteStderr("# %s has bad mtime\n", cpathname); + fclose(fp); diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/no-ldconfig.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/no-ldconfig.patch new file mode 100644 index 000000000000..2a6b2a20dd19 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/no-ldconfig.patch @@ -0,0 +1,117 @@ +From 6b0f329a9f37110020ca02b35c8125391ef282b7 Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Sat, 24 Dec 2016 15:56:10 +0100 +Subject: [PATCH] no ldconfig + +--- + Lib/ctypes/util.py | 35 +---------------------------------- + Lib/uuid.py | 47 ----------------------------------------------- + 2 files changed, 1 insertion(+), 81 deletions(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index ab10ec5..f253e34 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -235,40 +235,7 @@ elif os.name == "posix": + else: + + def _findSoname_ldconfig(name): +- import struct +- if struct.calcsize('l') == 4: +- machine = os.uname()[4] + '-32' +- else: +- machine = os.uname()[4] + '-64' +- mach_map = { +- 'x86_64-64': 'libc6,x86-64', +- 'ppc64-64': 'libc6,64bit', +- 'sparc64-64': 'libc6,64bit', +- 's390x-64': 'libc6,64bit', +- 'ia64-64': 'libc6,IA-64', +- } +- abi_type = mach_map.get(machine, 'libc6') +- +- # XXX assuming GLIBC's ldconfig (with option -p) +- expr = r'\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type) +- +- env = dict(os.environ) +- env['LC_ALL'] = 'C' +- env['LANG'] = 'C' +- null = open(os.devnull, 'wb') +- try: +- with null: +- p = subprocess.Popen(['/sbin/ldconfig', '-p'], +- stderr=null, +- stdout=subprocess.PIPE, +- env=env) +- except OSError: # E.g. command not found +- return None +- [data, _] = p.communicate() +- res = re.search(expr, data) +- if not res: +- return None +- return res.group(1) ++ return None + + def find_library(name): + return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) +diff --git a/Lib/uuid.py b/Lib/uuid.py +index 7432032..05eeee5 100644 +--- a/Lib/uuid.py ++++ b/Lib/uuid.py +@@ -441,53 +441,6 @@ def _netbios_getnode(): + + # If ctypes is available, use it to find system routines for UUID generation. + _uuid_generate_time = _UuidCreate = None +-try: +- import ctypes, ctypes.util +- import sys +- +- # The uuid_generate_* routines are provided by libuuid on at least +- # Linux and FreeBSD, and provided by libc on Mac OS X. +- _libnames = ['uuid'] +- if not sys.platform.startswith('win'): +- _libnames.append('c') +- for libname in _libnames: +- try: +- lib = ctypes.CDLL(ctypes.util.find_library(libname)) +- except: +- continue +- if hasattr(lib, 'uuid_generate_time'): +- _uuid_generate_time = lib.uuid_generate_time +- break +- del _libnames +- +- # The uuid_generate_* functions are broken on MacOS X 10.5, as noted +- # in issue #8621 the function generates the same sequence of values +- # in the parent process and all children created using fork (unless +- # those children use exec as well). +- # +- # Assume that the uuid_generate functions are broken from 10.5 onward, +- # the test can be adjusted when a later version is fixed. +- if sys.platform == 'darwin': +- import os +- if int(os.uname()[2].split('.')[0]) >= 9: +- _uuid_generate_time = None +- +- # On Windows prior to 2000, UuidCreate gives a UUID containing the +- # hardware address. On Windows 2000 and later, UuidCreate makes a +- # random UUID and UuidCreateSequential gives a UUID containing the +- # hardware address. These routines are provided by the RPC runtime. +- # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last +- # 6 bytes returned by UuidCreateSequential are fixed, they don't appear +- # to bear any relationship to the MAC address of any network device +- # on the box. +- try: +- lib = ctypes.windll.rpcrt4 +- except: +- lib = None +- _UuidCreate = getattr(lib, 'UuidCreateSequential', +- getattr(lib, 'UuidCreate', None)) +-except: +- pass + + def _unixdll_getnode(): + """Get the hardware address on Unix using ctypes.""" +-- +2.11.0 + diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/python-2.7-distutils-C++.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/python-2.7-distutils-C++.patch new file mode 100644 index 000000000000..90c21d5e60ca --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/python-2.7-distutils-C++.patch @@ -0,0 +1,260 @@ +--- a/Lib/distutils/cygwinccompiler.py ++++ b/Lib/distutils/cygwinccompiler.py +@@ -117,8 +117,10 @@ + # dllwrap 2.10.90 is buggy + if self.ld_version >= "2.10.90": + self.linker_dll = "gcc" ++ self.linker_dll_cxx = "g++" + else: + self.linker_dll = "dllwrap" ++ self.linker_dll_cxx = "dllwrap" + + # ld_version >= "2.13" support -shared so use it instead of + # -mdll -static +@@ -132,9 +134,13 @@ + self.set_executables(compiler='gcc -mcygwin -O -Wall', + compiler_so='gcc -mcygwin -mdll -O -Wall', + compiler_cxx='g++ -mcygwin -O -Wall', ++ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall', + linker_exe='gcc -mcygwin', + linker_so=('%s -mcygwin %s' % +- (self.linker_dll, shared_option))) ++ (self.linker_dll, shared_option)), ++ linker_exe_cxx='g++ -mcygwin', ++ linker_so_cxx=('%s -mcygwin %s' % ++ (self.linker_dll_cxx, shared_option))) + + # cygwin and mingw32 need different sets of libraries + if self.gcc_version == "2.91.57": +@@ -160,8 +166,12 @@ + raise CompileError, msg + else: # for other files use the C-compiler + try: +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError, msg: + raise CompileError, msg + +@@ -327,9 +337,14 @@ + self.set_executables(compiler='gcc%s -O -Wall' % no_cygwin, + compiler_so='gcc%s -mdll -O -Wall' % no_cygwin, + compiler_cxx='g++%s -O -Wall' % no_cygwin, ++ compiler_so_cxx='g++%s -mdll -O -Wall' % no_cygwin, + linker_exe='gcc%s' % no_cygwin, + linker_so='%s%s %s %s' + % (self.linker_dll, no_cygwin, ++ shared_option, entry_point), ++ linker_exe_cxx='g++%s' % no_cygwin, ++ linker_so_cxx='%s%s %s %s' ++ % (self.linker_dll_cxx, no_cygwin, + shared_option, entry_point)) + # Maybe we should also append -mthreads, but then the finished + # dlls need another dll (mingwm10.dll see Mingw32 docs) +--- a/Lib/distutils/emxccompiler.py ++++ b/Lib/distutils/emxccompiler.py +@@ -65,8 +65,12 @@ + # XXX optimization, warnings etc. should be customizable. + self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', + compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', ++ compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', ++ compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', + linker_exe='gcc -Zomf -Zmt -Zcrtdll', +- linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll') ++ linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll', ++ linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll', ++ linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll') + + # want the gcc library statically linked (so that we don't have + # to distribute a version dependent on the compiler we have) +@@ -83,8 +87,12 @@ + raise CompileError, msg + else: # for other files use the C-compiler + try: +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError, msg: + raise CompileError, msg + +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -170,10 +170,12 @@ + _osx_support.customize_compiler(_config_vars) + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' + +- (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ +- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SO', 'AR', +- 'ARFLAGS') ++ (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \ ++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'SO', 'AR', 'ARFLAGS') ++ ++ cflags = '' ++ cxxflags = '' + + if 'CC' in os.environ: + newcc = os.environ['CC'] +@@ -188,19 +190,27 @@ + cxx = os.environ['CXX'] + if 'LDSHARED' in os.environ: + ldshared = os.environ['LDSHARED'] ++ if 'LDCXXSHARED' in os.environ: ++ ldcxxshared = os.environ['LDCXXSHARED'] + if 'CPP' in os.environ: + cpp = os.environ['CPP'] + else: + cpp = cc + " -E" # not always + if 'LDFLAGS' in os.environ: + ldshared = ldshared + ' ' + os.environ['LDFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] + if 'CFLAGS' in os.environ: +- cflags = opt + ' ' + os.environ['CFLAGS'] ++ cflags = os.environ['CFLAGS'] + ldshared = ldshared + ' ' + os.environ['CFLAGS'] ++ if 'CXXFLAGS' in os.environ: ++ cxxflags = os.environ['CXXFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] + if 'CPPFLAGS' in os.environ: + cpp = cpp + ' ' + os.environ['CPPFLAGS'] + cflags = cflags + ' ' + os.environ['CPPFLAGS'] ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] + ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] + if 'AR' in os.environ: + ar = os.environ['AR'] + if 'ARFLAGS' in os.environ: +@@ -209,13 +219,17 @@ + archiver = ar + ' ' + ar_flags + + cc_cmd = cc + ' ' + cflags ++ cxx_cmd = cxx + ' ' + cxxflags + compiler.set_executables( + preprocessor=cpp, + compiler=cc_cmd, + compiler_so=cc_cmd + ' ' + ccshared, +- compiler_cxx=cxx, ++ compiler_cxx=cxx_cmd, ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, + linker_so=ldshared, + linker_exe=cc, ++ linker_so_cxx=ldcxxshared, ++ linker_exe_cxx=cxx, + archiver=archiver) + + compiler.shared_lib_extension = so_ext +--- a/Lib/distutils/unixccompiler.py ++++ b/Lib/distutils/unixccompiler.py +@@ -55,14 +55,17 @@ + # are pretty generic; they will probably have to be set by an outsider + # (eg. using information discovered by the sysconfig about building + # Python extensions). +- executables = {'preprocessor' : None, +- 'compiler' : ["cc"], +- 'compiler_so' : ["cc"], +- 'compiler_cxx' : ["cc"], +- 'linker_so' : ["cc", "-shared"], +- 'linker_exe' : ["cc"], +- 'archiver' : ["ar", "-cr"], +- 'ranlib' : None, ++ executables = {'preprocessor' : None, ++ 'compiler' : ["cc"], ++ 'compiler_so' : ["cc"], ++ 'compiler_cxx' : ["c++"], ++ 'compiler_so_cxx' : ["c++"], ++ 'linker_so' : ["cc", "-shared"], ++ 'linker_exe' : ["cc"], ++ 'linker_so_cxx' : ["c++", "-shared"], ++ 'linker_exe_cxx' : ["c++"], ++ 'archiver' : ["ar", "-cr"], ++ 'ranlib' : None, + } + + if sys.platform[:6] == "darwin": +@@ -112,12 +115,19 @@ + + def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + compiler_so = self.compiler_so ++ compiler_so_cxx = self.compiler_so_cxx + if sys.platform == 'darwin': + compiler_so = _osx_support.compiler_fixup(compiler_so, + cc_args + extra_postargs) ++ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx, ++ cc_args + extra_postargs) + try: +- self.spawn(compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ if self.detect_language(src) == 'c++': ++ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] + ++ extra_postargs) ++ else: ++ self.spawn(compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs) + except DistutilsExecError, msg: + raise CompileError, msg + +@@ -174,23 +184,16 @@ + ld_args.extend(extra_postargs) + self.mkpath(os.path.dirname(output_filename)) + try: +- if target_desc == CCompiler.EXECUTABLE: +- linker = self.linker_exe[:] ++ if target_lang == "c++": ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe_cxx[:] ++ else: ++ linker = self.linker_so_cxx[:] + else: +- linker = self.linker_so[:] +- if target_lang == "c++" and self.compiler_cxx: +- # skip over environment variable settings if /usr/bin/env +- # is used to set up the linker's environment. +- # This is needed on OSX. Note: this assumes that the +- # normal and C++ compiler have the same environment +- # settings. +- i = 0 +- if os.path.basename(linker[0]) == "env": +- i = 1 +- while '=' in linker[i]: +- i = i + 1 +- +- linker[i] = self.compiler_cxx[i] ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe[:] ++ else: ++ linker = self.linker_so[:] + + if sys.platform == 'darwin': + linker = _osx_support.compiler_fixup(linker, ld_args) +--- a/Lib/_osx_support.py ++++ b/Lib/_osx_support.py +@@ -14,13 +14,13 @@ + # configuration variables that may contain universal build flags, + # like "-arch" or "-isdkroot", that may need customization for + # the user environment +-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS', +- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX', +- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS', +- 'PY_CORE_CFLAGS') ++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS', ++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS', ++ 'PY_CPPFLAGS', 'PY_CORE_CFLAGS') + + # configuration variables that may contain compiler calls +-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX') ++_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX') + + # prefix added to original configuration variable names + _INITPRE = '_OSX_SUPPORT_INITIAL_' \ No newline at end of file diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/search-path.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/search-path.patch new file mode 100644 index 000000000000..2e7b7526c0ce --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/search-path.patch @@ -0,0 +1,27 @@ +diff -rc Python-2.4.4-orig/setup.py Python-2.4.4/setup.py +*** Python-2.4.4-orig/setup.py 2006-10-08 19:41:25.000000000 +0200 +--- Python-2.4.4/setup.py 2007-05-27 16:04:54.000000000 +0200 +*************** +*** 279,288 **** + # Check for AtheOS which has libraries in non-standard locations + if platform == 'atheos': + lib_dirs += ['/system/libs', '/atheos/autolnk/lib'] +- lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep) + inc_dirs += ['/system/include', '/atheos/autolnk/include'] +- inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) + + # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) + if platform in ['osf1', 'unixware7', 'openunix8']: + lib_dirs += ['/usr/ccs/lib'] +--- 279,289 ---- + # Check for AtheOS which has libraries in non-standard locations + if platform == 'atheos': + lib_dirs += ['/system/libs', '/atheos/autolnk/lib'] + inc_dirs += ['/system/include', '/atheos/autolnk/include'] + ++ lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep) ++ inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) ++ + # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) + if platform in ['osf1', 'unixware7', 'openunix8']: + lib_dirs += ['/usr/ccs/lib'] diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/type_getattro.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/type_getattro.patch new file mode 100644 index 000000000000..c69c86b642b4 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/type_getattro.patch @@ -0,0 +1,62 @@ +--- a/Objects/typeobject.c ++++ b/Objects/typeobject.c +@@ -3137,6 +3137,7 @@ + PyTypeObject *metatype = Py_TYPE(type); + PyObject *meta_attribute, *attribute; + descrgetfunc meta_get; ++ PyObject* res; + + if (!PyUnicode_Check(name)) { + PyErr_Format(PyExc_TypeError, +@@ -3158,6 +3159,7 @@ + meta_attribute = _PyType_Lookup(metatype, name); + + if (meta_attribute != NULL) { ++ Py_INCREF(meta_attribute); + meta_get = Py_TYPE(meta_attribute)->tp_descr_get; + + if (meta_get != NULL && PyDescr_IsData(meta_attribute)) { +@@ -3165,10 +3167,11 @@ + * writes. Assume the attribute is not overridden in + * type's tp_dict (and bases): call the descriptor now. + */ +- return meta_get(meta_attribute, (PyObject *)type, +- (PyObject *)metatype); ++ res = meta_get(meta_attribute, (PyObject *)type, ++ (PyObject *)metatype); ++ Py_DECREF(meta_attribute); ++ return res; + } +- Py_INCREF(meta_attribute); + } + + /* No data descriptor found on metatype. Look in tp_dict of this +@@ -3176,6 +3179,7 @@ + attribute = _PyType_Lookup(type, name); + if (attribute != NULL) { + /* Implement descriptor functionality, if any */ ++ Py_INCREF(attribute); + descrgetfunc local_get = Py_TYPE(attribute)->tp_descr_get; + + Py_XDECREF(meta_attribute); +@@ -3183,11 +3187,12 @@ + if (local_get != NULL) { + /* NULL 2nd argument indicates the descriptor was + * found on the target object itself (or a base) */ +- return local_get(attribute, (PyObject *)NULL, +- (PyObject *)type); ++ res = local_get(attribute, (PyObject *)NULL, ++ (PyObject *)type); ++ Py_DECREF(attribute); ++ return res; + } + +- Py_INCREF(attribute); + return attribute; + } + +--- /dev/null ++++ b/Misc/NEWS.d/next/Core and Builtins/2018-03-14-21-42-17.bpo-25750.lxgkQz.rst +@@ -0,0 +1,2 @@ ++Fix rare Python crash due to bad refcounting in ``type_getattro()`` if a ++descriptor deletes itself from the class. diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/use-correct-tcl-tk-on-darwin.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/use-correct-tcl-tk-on-darwin.patch new file mode 100644 index 000000000000..b73f62b97ec5 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/use-correct-tcl-tk-on-darwin.patch @@ -0,0 +1,48 @@ +diff --git a/setup.py b/setup.py +index 2779658..902d0eb 100644 +--- a/setup.py ++++ b/setup.py +@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext): + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (host_platform == 'darwin' and +- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): +- return + + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without +@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext): + if dir not in include_dirs: + include_dirs.append(dir) + +- # Check for various platform-specific directories +- if host_platform == 'sunos5': +- include_dirs.append('/usr/openwin/include') +- added_lib_dirs.append('/usr/openwin/lib') +- elif os.path.exists('/usr/X11R6/include'): +- include_dirs.append('/usr/X11R6/include') +- added_lib_dirs.append('/usr/X11R6/lib64') +- added_lib_dirs.append('/usr/X11R6/lib') +- elif os.path.exists('/usr/X11R5/include'): +- include_dirs.append('/usr/X11R5/include') +- added_lib_dirs.append('/usr/X11R5/lib') +- else: +- # Assume default location for X11 +- include_dirs.append('/usr/X11/include') +- added_lib_dirs.append('/usr/X11/lib') +- + # If Cygwin, then verify that X is installed before proceeding + if host_platform == 'cygwin': + x11_inc = find_file('X11/Xlib.h', [], include_dirs) +@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext): + if host_platform in ['aix3', 'aix4']: + libs.append('ld') + +- # Finally, link with the X11 libraries (not appropriate on cygwin) +- if host_platform != "cygwin": +- libs.append('X11') +- + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)] + defs, + include_dirs = include_dirs, diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/default.nix new file mode 100644 index 000000000000..92c277aacd4f --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/default.nix @@ -0,0 +1,213 @@ +{ stdenv, fetchurl, fetchpatch +, bzip2 +, expat +, libffi +, gdbm +, lzma +, ncurses +, openssl +, readline +, sqlite +, tcl ? null, tk ? null, tix ? null, libX11 ? null, xproto ? null, x11Support ? false +, zlib +, callPackage +, self +, CF, configd +, python-setup-hook +# For the Python package set +, packageOverrides ? (self: super: {}) +}: + +assert x11Support -> tcl != null + && tk != null + && xproto != null + && libX11 != null; + +with stdenv.lib; + +let + majorVersion = "3.5"; + minorVersion = "6"; + minorVersionSuffix = ""; + version = "${majorVersion}.${minorVersion}${minorVersionSuffix}"; + libPrefix = "python${majorVersion}"; + sitePackages = "lib/${libPrefix}/site-packages"; + + buildInputs = filter (p: p != null) [ + zlib bzip2 expat lzma libffi gdbm sqlite readline ncurses openssl ] + ++ optionals x11Support [ tcl tk libX11 xproto ] + ++ optionals stdenv.isDarwin [ CF configd ]; + + hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); + +in stdenv.mkDerivation { + name = "python3-${version}"; + pythonVersion = majorVersion; + inherit majorVersion version; + + inherit buildInputs; + + src = fetchurl { + url = "https://www.python.org/ftp/python/${majorVersion}.${minorVersion}/Python-${version}.tar.xz"; + sha256 = "0pqmf51zy2lzhbaj4yya2py2qr653j9152d0rg3p7wi1yl2dwp7m"; + }; + + NIX_LDFLAGS = optionalString stdenv.isLinux "-lgcc_s"; + + # Determinism: The interpreter is patched to write null timestamps when compiling python files. + # This way python doesn't try to update them when we freeze timestamps in nix store. + DETERMINISTIC_BUILD=1; + # Determinism: We fix the hashes of str, bytes and datetime objects. + PYTHONHASHSEED=0; + + prePatch = optionalString stdenv.isDarwin '' + substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"' + substituteInPlace configure --replace '-Wl,-stack_size,1000000' ' ' + ''; + + patches = [ + ./no-ldconfig.patch + ./ld_library_path.patch + ] ++ optionals stdenv.isDarwin [ + # Fix for https://bugs.python.org/issue24658 + (fetchpatch { + url = "https://bugs.python.org/file45178/issue24658-3-3.6.diff"; + sha256 = "1x060hs80nl34mcl2ji2i7l4shxkmxwgq8h8lcmav8rjqqz1nb4a"; + }) + ] ++ optionals (x11Support && stdenv.isDarwin) [ + ./use-correct-tcl-tk-on-darwin.patch + ] ++ optionals hasDistutilsCxxPatch [ + # Fix for http://bugs.python.org/issue1222585 + # Upstream distutils is calling C compiler to compile C++ code, which + # only works for GCC and Apple Clang. This makes distutils to call C++ + # compiler when needed. + (fetchpatch { + url = "https://bugs.python.org/file47046/python-3.x-distutils-C++.patch"; + sha256 = "0dgdn9k2kmw4wh90vdnjcrnn97ylxgx7mbn9l87fwz6j501jqvk8"; + extraPrefix = ""; + }) + ]; + + postPatch = '' + # Determinism + substituteInPlace "Lib/py_compile.py" --replace "source_stats['mtime']" "(1 if 'DETERMINISTIC_BUILD' in os.environ else source_stats['mtime'])" + # Determinism. This is done unconditionally + substituteInPlace "Lib/importlib/_bootstrap_external.py" --replace "source_mtime = int(st['mtime'])" "source_mtime = 1" + '' + optionalString (x11Support && (tix != null)) '' + substituteInPlace "Lib/tkinter/tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" + ''; + + CPPFLAGS="${concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs)}"; + LDFLAGS="${concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs)}"; + LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}"; + + configureFlags = [ + "--enable-shared" + "--with-threads" + "--without-ensurepip" + "--with-system-expat" + "--with-system-ffi" + ] + # Never even try to use lchmod on linux, + # don't rely on detecting glibc-isms. + ++ optional stdenv.hostPlatform.isLinux "ac_cv_func_lchmod=no"; + + preConfigure = '' + for i in /usr /sw /opt /pkg; do # improve purity + substituteInPlace ./setup.py --replace $i /no-such-path + done + ${optionalString stdenv.isDarwin '' + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2" + export MACOSX_DEPLOYMENT_TARGET=10.6 + '' + + optionalString stdenv.hostPlatform.isMusl '' + export NIX_CFLAGS_COMPILE+=" -DTHREAD_STACK_SIZE=0x100000" + ''} + ''; + + setupHook = python-setup-hook sitePackages; + + postInstall = '' + # needed for some packages, especially packages that backport functionality + # to 2.x from 3.x + for item in $out/lib/python${majorVersion}/test/*; do + if [[ "$item" != */test_support.py* + && "$item" != */test/support + && "$item" != */test/libregrtest + && "$item" != */test/regrtest.py* ]]; then + rm -rf "$item" + else + echo $item + fi + done + touch $out/lib/python${majorVersion}/test/__init__.py + + ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}" + paxmark E $out/bin/python${majorVersion} + + # Python on Nix is not manylinux1 compatible. https://github.com/NixOS/nixpkgs/issues/18484 + echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py + + # Determinism: Windows installers were not deterministic. + # We're also not interested in building Windows installers. + find "$out" -name 'wininst*.exe' | xargs -r rm -f + + # Use Python3 as default python + ln -s "$out/bin/idle3" "$out/bin/idle" + ln -s "$out/bin/pydoc3" "$out/bin/pydoc" + ln -s "$out/bin/python3" "$out/bin/python" + ln -s "$out/bin/python3-config" "$out/bin/python-config" + ln -s "$out/lib/pkgconfig/python3.pc" "$out/lib/pkgconfig/python.pc" + + # Get rid of retained dependencies on -dev packages, and remove + # some $TMPDIR references to improve binary reproducibility. + # Note that the .pyc file of _sysconfigdata.py should be regenerated! + for i in $out/lib/python${majorVersion}/_sysconfigdata.py $out/lib/python${majorVersion}/config-${majorVersion}m/Makefile; do + sed -i $i -e "s|-I/nix/store/[^ ']*||g" -e "s|-L/nix/store/[^ ']*||g" -e "s|$TMPDIR|/no-such-path|g" + done + + # Determinism: rebuild all bytecode + # We exclude lib2to3 because that's Python 2 code which fails + # We rebuild three times, once for each optimization level + find $out -name "*.py" | $out/bin/python -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | $out/bin/python -O -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | $out/bin/python -OO -m compileall -q -f -x "lib2to3" -i - + ''; + + passthru = let + pythonPackages = callPackage ../../../../../top-level/python-packages.nix { + python = self; + overrides = packageOverrides; + }; + in rec { + inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch; + executable = "${libPrefix}m"; + buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; }; + withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;}; + pkgs = pythonPackages; + isPy3 = true; + isPy35 = true; + interpreter = "${self}/bin/${executable}"; + }; + + enableParallelBuilding = true; + + doCheck = false; # expensive, and fails + + meta = { + homepage = http://python.org; + description = "A high-level dynamically-typed programming language"; + longDescription = '' + Python is a remarkably powerful dynamic programming language that + is used in a wide variety of application domains. Some of its key + distinguishing features include: clear, readable syntax; strong + introspection capabilities; intuitive object orientation; natural + expression of procedural code; full modularity, supporting + hierarchical packages; exception-based error handling; and very + high level dynamic data types. + ''; + license = licenses.psfl; + platforms = with platforms; linux ++ darwin; + maintainers = with maintainers; [ fridh ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/ld_library_path.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/ld_library_path.patch new file mode 100644 index 000000000000..013c2d266eff --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/ld_library_path.patch @@ -0,0 +1,51 @@ +From 918201682127ed8a270a4bd1a448b490019e4ada Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Thu, 14 Sep 2017 10:00:31 +0200 +Subject: [PATCH] ctypes.util: support LD_LIBRARY_PATH + +Backports support for LD_LIBRARY_PATH from 3.6 +--- + Lib/ctypes/util.py | 26 +++++++++++++++++++++++++- + 1 file changed, 25 insertions(+), 1 deletion(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index e9957d7951..9926f6c881 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -219,8 +219,32 @@ elif os.name == "posix": + def _findSoname_ldconfig(name): + return None + ++ def _findLib_ld(name): ++ # See issue #9998 for why this is needed ++ expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name) ++ cmd = ['ld', '-t'] ++ libpath = os.environ.get('LD_LIBRARY_PATH') ++ if libpath: ++ for d in libpath.split(':'): ++ cmd.extend(['-L', d]) ++ cmd.extend(['-o', os.devnull, '-l%s' % name]) ++ result = None ++ try: ++ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, ++ stderr=subprocess.PIPE, ++ universal_newlines=True) ++ out, _ = p.communicate() ++ res = re.search(expr, os.fsdecode(out)) ++ if res: ++ result = res.group(0) ++ except Exception as e: ++ pass # result will be None ++ return result ++ + def find_library(name): +- return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) ++ # See issue #9998 ++ return _findSoname_ldconfig(name) or \ ++ _get_soname(_findLib_gcc(name) or _findLib_ld(name)) + + ################################################################ + # test code +-- +2.14.1 + diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/no-ldconfig.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/no-ldconfig.patch new file mode 100644 index 000000000000..9718b1d8dceb --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/no-ldconfig.patch @@ -0,0 +1,164 @@ +From 590c46bb04f79ab611b2f8fd682dd7e43a01f268 Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Mon, 28 Aug 2017 09:24:06 +0200 +Subject: [PATCH] Don't use ldconfig and speed up uuid load + +--- + Lib/ctypes/util.py | 70 ++---------------------------------------------------- + Lib/uuid.py | 49 -------------------------------------- + 2 files changed, 2 insertions(+), 117 deletions(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 7684eab81d..e9957d7951 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -95,46 +95,7 @@ elif os.name == "posix": + import re, tempfile + + def _findLib_gcc(name): +- # Run GCC's linker with the -t (aka --trace) option and examine the +- # library name it prints out. The GCC command will fail because we +- # haven't supplied a proper program with main(), but that does not +- # matter. +- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) +- +- c_compiler = shutil.which('gcc') +- if not c_compiler: +- c_compiler = shutil.which('cc') +- if not c_compiler: +- # No C compiler available, give up +- return None +- +- temp = tempfile.NamedTemporaryFile() +- try: +- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] +- +- env = dict(os.environ) +- env['LC_ALL'] = 'C' +- env['LANG'] = 'C' +- try: +- proc = subprocess.Popen(args, +- stdout=subprocess.PIPE, +- stderr=subprocess.STDOUT, +- env=env) +- except OSError: # E.g. bad executable +- return None +- with proc: +- trace = proc.stdout.read() +- finally: +- try: +- temp.close() +- except FileNotFoundError: +- # Raised if the file was already removed, which is the normal +- # behaviour of GCC if linking fails +- pass +- res = re.search(expr, trace) +- if not res: +- return None +- return os.fsdecode(res.group(0)) ++ return None + + + if sys.platform == "sunos5": +@@ -256,34 +217,7 @@ elif os.name == "posix": + else: + + def _findSoname_ldconfig(name): +- import struct +- if struct.calcsize('l') == 4: +- machine = os.uname().machine + '-32' +- else: +- machine = os.uname().machine + '-64' +- mach_map = { +- 'x86_64-64': 'libc6,x86-64', +- 'ppc64-64': 'libc6,64bit', +- 'sparc64-64': 'libc6,64bit', +- 's390x-64': 'libc6,64bit', +- 'ia64-64': 'libc6,IA-64', +- } +- abi_type = mach_map.get(machine, 'libc6') +- +- # XXX assuming GLIBC's ldconfig (with option -p) +- regex = os.fsencode( +- '\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type)) +- try: +- with subprocess.Popen(['/sbin/ldconfig', '-p'], +- stdin=subprocess.DEVNULL, +- stderr=subprocess.DEVNULL, +- stdout=subprocess.PIPE, +- env={'LC_ALL': 'C', 'LANG': 'C'}) as p: +- res = re.search(regex, p.stdout.read()) +- if res: +- return os.fsdecode(res.group(1)) +- except OSError: +- pass ++ return None + + def find_library(name): + return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) +diff --git a/Lib/uuid.py b/Lib/uuid.py +index e96e7e034c..31160ace95 100644 +--- a/Lib/uuid.py ++++ b/Lib/uuid.py +@@ -455,58 +455,9 @@ def _netbios_getnode(): + continue + return int.from_bytes(bytes, 'big') + +-# Thanks to Thomas Heller for ctypes and for his help with its use here. + +-# If ctypes is available, use it to find system routines for UUID generation. +-# XXX This makes the module non-thread-safe! + _uuid_generate_time = _UuidCreate = None +-try: +- import ctypes, ctypes.util +- import sys + +- # The uuid_generate_* routines are provided by libuuid on at least +- # Linux and FreeBSD, and provided by libc on Mac OS X. +- _libnames = ['uuid'] +- if not sys.platform.startswith('win'): +- _libnames.append('c') +- for libname in _libnames: +- try: +- lib = ctypes.CDLL(ctypes.util.find_library(libname)) +- except Exception: +- continue +- if hasattr(lib, 'uuid_generate_time'): +- _uuid_generate_time = lib.uuid_generate_time +- break +- del _libnames +- +- # The uuid_generate_* functions are broken on MacOS X 10.5, as noted +- # in issue #8621 the function generates the same sequence of values +- # in the parent process and all children created using fork (unless +- # those children use exec as well). +- # +- # Assume that the uuid_generate functions are broken from 10.5 onward, +- # the test can be adjusted when a later version is fixed. +- if sys.platform == 'darwin': +- import os +- if int(os.uname().release.split('.')[0]) >= 9: +- _uuid_generate_time = None +- +- # On Windows prior to 2000, UuidCreate gives a UUID containing the +- # hardware address. On Windows 2000 and later, UuidCreate makes a +- # random UUID and UuidCreateSequential gives a UUID containing the +- # hardware address. These routines are provided by the RPC runtime. +- # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last +- # 6 bytes returned by UuidCreateSequential are fixed, they don't appear +- # to bear any relationship to the MAC address of any network device +- # on the box. +- try: +- lib = ctypes.windll.rpcrt4 +- except: +- lib = None +- _UuidCreate = getattr(lib, 'UuidCreateSequential', +- getattr(lib, 'UuidCreate', None)) +-except: +- pass + + def _unixdll_getnode(): + """Get the hardware address on Unix using ctypes.""" +-- +2.14.1 + diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/use-correct-tcl-tk-on-darwin.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/use-correct-tcl-tk-on-darwin.patch new file mode 100644 index 000000000000..b73f62b97ec5 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/use-correct-tcl-tk-on-darwin.patch @@ -0,0 +1,48 @@ +diff --git a/setup.py b/setup.py +index 2779658..902d0eb 100644 +--- a/setup.py ++++ b/setup.py +@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext): + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (host_platform == 'darwin' and +- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): +- return + + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without +@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext): + if dir not in include_dirs: + include_dirs.append(dir) + +- # Check for various platform-specific directories +- if host_platform == 'sunos5': +- include_dirs.append('/usr/openwin/include') +- added_lib_dirs.append('/usr/openwin/lib') +- elif os.path.exists('/usr/X11R6/include'): +- include_dirs.append('/usr/X11R6/include') +- added_lib_dirs.append('/usr/X11R6/lib64') +- added_lib_dirs.append('/usr/X11R6/lib') +- elif os.path.exists('/usr/X11R5/include'): +- include_dirs.append('/usr/X11R5/include') +- added_lib_dirs.append('/usr/X11R5/lib') +- else: +- # Assume default location for X11 +- include_dirs.append('/usr/X11/include') +- added_lib_dirs.append('/usr/X11/lib') +- + # If Cygwin, then verify that X is installed before proceeding + if host_platform == 'cygwin': + x11_inc = find_file('X11/Xlib.h', [], include_dirs) +@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext): + if host_platform in ['aix3', 'aix4']: + libs.append('ld') + +- # Finally, link with the X11 libraries (not appropriate on cygwin) +- if host_platform != "cygwin": +- libs.append('X11') +- + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)] + defs, + include_dirs = include_dirs, diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/default.nix new file mode 100644 index 000000000000..cad35cac53a8 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/default.nix @@ -0,0 +1,229 @@ +{ stdenv, fetchurl, fetchpatch, buildPackages +, bzip2 +, expat +, libffi +, gdbm +, lzma +, ncurses +, openssl +, readline +, sqlite +, tcl ? null, tk ? null, tix ? null, libX11 ? null, xproto ? null, x11Support ? false +, zlib +, callPackage +, self +, CF, configd +, python-setup-hook +# For the Python package set +, packageOverrides ? (self: super: {}) +}: + +assert x11Support -> tcl != null + && tk != null + && xproto != null + && libX11 != null; +with stdenv.lib; + +let + majorVersion = "3.6"; + minorVersion = "8"; + minorVersionSuffix = ""; + version = "${majorVersion}.${minorVersion}${minorVersionSuffix}"; + libPrefix = "python${majorVersion}"; + sitePackages = "lib/${libPrefix}/site-packages"; + + buildInputs = filter (p: p != null) [ + zlib bzip2 expat lzma libffi gdbm sqlite readline ncurses openssl ] + ++ optionals x11Support [ tcl tk libX11 xproto ] + ++ optionals stdenv.isDarwin [ CF configd ]; + + nativeBuildInputs = + optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.python3; + + hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); + +in stdenv.mkDerivation { + name = "python3-${version}"; + pythonVersion = majorVersion; + inherit majorVersion version; + + inherit buildInputs nativeBuildInputs; + + src = fetchurl { + url = "https://www.python.org/ftp/python/${majorVersion}.${minorVersion}/Python-${version}.tar.xz"; + sha256 = "14qi6n5gpcjnwy165wi9hkfcmbadc95ny6bxxldknxwmx50n4i1m"; + }; + + NIX_LDFLAGS = optionalString stdenv.isLinux "-lgcc_s"; + + # Determinism: The interpreter is patched to write null timestamps when compiling python files. + # This way python doesn't try to update them when we freeze timestamps in nix store. + DETERMINISTIC_BUILD=1; + # Determinism: We fix the hashes of str, bytes and datetime objects. + PYTHONHASHSEED=0; + + prePatch = optionalString stdenv.isDarwin '' + substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"' + substituteInPlace configure --replace '-Wl,-stack_size,1000000' ' ' + ''; + + patches = [ + ./no-ldconfig.patch + ] ++ optionals (x11Support && stdenv.isDarwin) [ + ./use-correct-tcl-tk-on-darwin.patch + ] ++ optionals hasDistutilsCxxPatch [ + # Fix for http://bugs.python.org/issue1222585 + # Upstream distutils is calling C compiler to compile C++ code, which + # only works for GCC and Apple Clang. This makes distutils to call C++ + # compiler when needed. + (fetchpatch { + url = "https://bugs.python.org/file48016/python-3.x-distutils-C++.patch"; + sha256 = "1h18lnpx539h5lfxyk379dxwr8m2raigcjixkf133l4xy3f4bzi2"; + }) + ]; + + postPatch = '' + # Determinism + substituteInPlace "Lib/py_compile.py" --replace "source_stats['mtime']" "(1 if 'DETERMINISTIC_BUILD' in os.environ else source_stats['mtime'])" + # Determinism. This is done unconditionally + substituteInPlace "Lib/importlib/_bootstrap_external.py" --replace "source_mtime = int(st['mtime'])" "source_mtime = 1" + '' + optionalString (x11Support && (tix != null)) '' + substituteInPlace "Lib/tkinter/tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" + ''; + + CPPFLAGS="${concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs)}"; + LDFLAGS="${concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs)}"; + LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}"; + + configureFlags = [ + "--enable-shared" + "--with-threads" + "--without-ensurepip" + "--with-system-expat" + "--with-system-ffi" + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "ac_cv_buggy_getaddrinfo=no" + # Assume little-endian IEEE 754 floating point when cross compiling + "ac_cv_little_endian_double=yes" + "ac_cv_big_endian_double=no" + "ac_cv_mixed_endian_double=no" + "ac_cv_x87_double_rounding=yes" + "ac_cv_tanh_preserves_zero_sign=yes" + # Generally assume that things are present and work + "ac_cv_posix_semaphores_enabled=yes" + "ac_cv_broken_sem_getvalue=no" + "ac_cv_wchar_t_signed=yes" + "ac_cv_rshift_extends_sign=yes" + "ac_cv_broken_nice=no" + "ac_cv_broken_poll=no" + "ac_cv_working_tzset=yes" + "ac_cv_have_long_long_format=yes" + "ac_cv_have_size_t_format=yes" + "ac_cv_computed_gotos=yes" + "ac_cv_file__dev_ptmx=yes" + "ac_cv_file__dev_ptc=yes" + ] + # Never even try to use lchmod on linux, + # don't rely on detecting glibc-isms. + ++ optional stdenv.hostPlatform.isLinux "ac_cv_func_lchmod=no"; + + preConfigure = '' + for i in /usr /sw /opt /pkg; do # improve purity + substituteInPlace ./setup.py --replace $i /no-such-path + done + ${optionalString stdenv.isDarwin '' + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2" + export MACOSX_DEPLOYMENT_TARGET=10.6 + '' + + optionalString stdenv.hostPlatform.isMusl '' + export NIX_CFLAGS_COMPILE+=" -DTHREAD_STACK_SIZE=0x100000" + ''} + ''; + + setupHook = python-setup-hook sitePackages; + + postInstall = '' + # needed for some packages, especially packages that backport functionality + # to 2.x from 3.x + for item in $out/lib/python${majorVersion}/test/*; do + if [[ "$item" != */test_support.py* + && "$item" != */test/support + && "$item" != */test/libregrtest + && "$item" != */test/regrtest.py* ]]; then + rm -rf "$item" + else + echo $item + fi + done + touch $out/lib/python${majorVersion}/test/__init__.py + + ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}" + paxmark E $out/bin/python${majorVersion} + + # Python on Nix is not manylinux1 compatible. https://github.com/NixOS/nixpkgs/issues/18484 + echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py + + # Determinism: Windows installers were not deterministic. + # We're also not interested in building Windows installers. + find "$out" -name 'wininst*.exe' | xargs -r rm -f + + # Use Python3 as default python + ln -s "$out/bin/idle3" "$out/bin/idle" + ln -s "$out/bin/pydoc3" "$out/bin/pydoc" + ln -s "$out/bin/python3" "$out/bin/python" + ln -s "$out/bin/python3-config" "$out/bin/python-config" + ln -s "$out/lib/pkgconfig/python3.pc" "$out/lib/pkgconfig/python.pc" + + # Get rid of retained dependencies on -dev packages, and remove + # some $TMPDIR references to improve binary reproducibility. + # Note that the .pyc file of _sysconfigdata.py should be regenerated! + for i in $out/lib/python${majorVersion}/_sysconfigdata*.py $out/lib/python${majorVersion}/config-${majorVersion}m*/Makefile; do + sed -i $i -e "s|-I/nix/store/[^ ']*||g" -e "s|-L/nix/store/[^ ']*||g" -e "s|$TMPDIR|/no-such-path|g" + done + '' + optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' + # Determinism: rebuild all bytecode + # We exclude lib2to3 because that's Python 2 code which fails + # We rebuild three times, once for each optimization level + find $out -name "*.py" | $out/bin/python -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | $out/bin/python -O -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | $out/bin/python -OO -m compileall -q -f -x "lib2to3" -i - + ''; + + passthru = let + pythonPackages = callPackage ../../../../../top-level/python-packages.nix { + python = self; + overrides = packageOverrides; + }; + in rec { + inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch; + executable = "${libPrefix}m"; + buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; }; + withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;}; + pkgs = pythonPackages; + isPy3 = true; + isPy36 = true; + is_py3k = true; # deprecated + interpreter = "${self}/bin/${executable}"; + }; + + enableParallelBuilding = true; + + doCheck = false; # expensive, and fails + + meta = { + homepage = http://python.org; + description = "A high-level dynamically-typed programming language"; + longDescription = '' + Python is a remarkably powerful dynamic programming language that + is used in a wide variety of application domains. Some of its key + distinguishing features include: clear, readable syntax; strong + introspection capabilities; intuitive object orientation; natural + expression of procedural code; full modularity, supporting + hierarchical packages; exception-based error handling; and very + high level dynamic data types. + ''; + license = licenses.psfl; + platforms = with platforms; linux ++ darwin; + maintainers = with maintainers; [ fridh kragniz ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/no-ldconfig.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/no-ldconfig.patch new file mode 100644 index 000000000000..0f829860a5b7 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/no-ldconfig.patch @@ -0,0 +1,163 @@ +From 105621b99cc30615c79b5aa3d12d6732e14b0d59 Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Mon, 28 Aug 2017 09:24:06 +0200 +Subject: [PATCH] Don't use ldconfig and speed up uuid load + +--- + Lib/ctypes/util.py | 70 ++---------------------------------------------------- + Lib/uuid.py | 48 ------------------------------------- + 2 files changed, 2 insertions(+), 116 deletions(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 339ae8aa8a..2944985c30 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -85,46 +85,7 @@ elif os.name == "posix": + import re, tempfile + + def _findLib_gcc(name): +- # Run GCC's linker with the -t (aka --trace) option and examine the +- # library name it prints out. The GCC command will fail because we +- # haven't supplied a proper program with main(), but that does not +- # matter. +- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) +- +- c_compiler = shutil.which('gcc') +- if not c_compiler: +- c_compiler = shutil.which('cc') +- if not c_compiler: +- # No C compiler available, give up +- return None +- +- temp = tempfile.NamedTemporaryFile() +- try: +- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] +- +- env = dict(os.environ) +- env['LC_ALL'] = 'C' +- env['LANG'] = 'C' +- try: +- proc = subprocess.Popen(args, +- stdout=subprocess.PIPE, +- stderr=subprocess.STDOUT, +- env=env) +- except OSError: # E.g. bad executable +- return None +- with proc: +- trace = proc.stdout.read() +- finally: +- try: +- temp.close() +- except FileNotFoundError: +- # Raised if the file was already removed, which is the normal +- # behaviour of GCC if linking fails +- pass +- res = re.search(expr, trace) +- if not res: +- return None +- return os.fsdecode(res.group(0)) ++ return None + + + if sys.platform == "sunos5": +@@ -246,34 +207,7 @@ elif os.name == "posix": + else: + + def _findSoname_ldconfig(name): +- import struct +- if struct.calcsize('l') == 4: +- machine = os.uname().machine + '-32' +- else: +- machine = os.uname().machine + '-64' +- mach_map = { +- 'x86_64-64': 'libc6,x86-64', +- 'ppc64-64': 'libc6,64bit', +- 'sparc64-64': 'libc6,64bit', +- 's390x-64': 'libc6,64bit', +- 'ia64-64': 'libc6,IA-64', +- } +- abi_type = mach_map.get(machine, 'libc6') +- +- # XXX assuming GLIBC's ldconfig (with option -p) +- regex = r'\s+(lib%s\.[^\s]+)\s+\(%s' +- regex = os.fsencode(regex % (re.escape(name), abi_type)) +- try: +- with subprocess.Popen(['/sbin/ldconfig', '-p'], +- stdin=subprocess.DEVNULL, +- stderr=subprocess.DEVNULL, +- stdout=subprocess.PIPE, +- env={'LC_ALL': 'C', 'LANG': 'C'}) as p: +- res = re.search(regex, p.stdout.read()) +- if res: +- return os.fsdecode(res.group(1)) +- except OSError: +- pass ++ return None + + def _findLib_ld(name): + # See issue #9998 for why this is needed +diff --git a/Lib/uuid.py b/Lib/uuid.py +index 200c800b34..31160ace95 100644 +--- a/Lib/uuid.py ++++ b/Lib/uuid.py +@@ -455,57 +455,9 @@ def _netbios_getnode(): + continue + return int.from_bytes(bytes, 'big') + +-# Thanks to Thomas Heller for ctypes and for his help with its use here. + +-# If ctypes is available, use it to find system routines for UUID generation. +-# XXX This makes the module non-thread-safe! + _uuid_generate_time = _UuidCreate = None +-try: +- import ctypes, ctypes.util +- import sys + +- # The uuid_generate_* routines are provided by libuuid on at least +- # Linux and FreeBSD, and provided by libc on Mac OS X. +- _libnames = ['uuid'] +- if not sys.platform.startswith('win'): +- _libnames.append('c') +- for libname in _libnames: +- try: +- lib = ctypes.CDLL(ctypes.util.find_library(libname)) +- except Exception: +- continue +- if hasattr(lib, 'uuid_generate_time'): +- _uuid_generate_time = lib.uuid_generate_time +- break +- del _libnames +- +- # The uuid_generate_* functions are broken on MacOS X 10.5, as noted +- # in issue #8621 the function generates the same sequence of values +- # in the parent process and all children created using fork (unless +- # those children use exec as well). +- # +- # Assume that the uuid_generate functions are broken from 10.5 onward, +- # the test can be adjusted when a later version is fixed. +- if sys.platform == 'darwin': +- if int(os.uname().release.split('.')[0]) >= 9: +- _uuid_generate_time = None +- +- # On Windows prior to 2000, UuidCreate gives a UUID containing the +- # hardware address. On Windows 2000 and later, UuidCreate makes a +- # random UUID and UuidCreateSequential gives a UUID containing the +- # hardware address. These routines are provided by the RPC runtime. +- # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last +- # 6 bytes returned by UuidCreateSequential are fixed, they don't appear +- # to bear any relationship to the MAC address of any network device +- # on the box. +- try: +- lib = ctypes.windll.rpcrt4 +- except: +- lib = None +- _UuidCreate = getattr(lib, 'UuidCreateSequential', +- getattr(lib, 'UuidCreate', None)) +-except: +- pass + + def _unixdll_getnode(): + """Get the hardware address on Unix using ctypes.""" +-- +2.14.1 + diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/use-correct-tcl-tk-on-darwin.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/use-correct-tcl-tk-on-darwin.patch new file mode 100644 index 000000000000..b73f62b97ec5 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/use-correct-tcl-tk-on-darwin.patch @@ -0,0 +1,48 @@ +diff --git a/setup.py b/setup.py +index 2779658..902d0eb 100644 +--- a/setup.py ++++ b/setup.py +@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext): + # Rather than complicate the code below, detecting and building + # AquaTk is a separate method. Only one Tkinter will be built on + # Darwin - either AquaTk, if it is found, or X11 based Tk. +- if (host_platform == 'darwin' and +- self.detect_tkinter_darwin(inc_dirs, lib_dirs)): +- return + + # Assume we haven't found any of the libraries or include files + # The versions with dots are used on Unix, and the versions without +@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext): + if dir not in include_dirs: + include_dirs.append(dir) + +- # Check for various platform-specific directories +- if host_platform == 'sunos5': +- include_dirs.append('/usr/openwin/include') +- added_lib_dirs.append('/usr/openwin/lib') +- elif os.path.exists('/usr/X11R6/include'): +- include_dirs.append('/usr/X11R6/include') +- added_lib_dirs.append('/usr/X11R6/lib64') +- added_lib_dirs.append('/usr/X11R6/lib') +- elif os.path.exists('/usr/X11R5/include'): +- include_dirs.append('/usr/X11R5/include') +- added_lib_dirs.append('/usr/X11R5/lib') +- else: +- # Assume default location for X11 +- include_dirs.append('/usr/X11/include') +- added_lib_dirs.append('/usr/X11/lib') +- + # If Cygwin, then verify that X is installed before proceeding + if host_platform == 'cygwin': + x11_inc = find_file('X11/Xlib.h', [], include_dirs) +@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext): + if host_platform in ['aix3', 'aix4']: + libs.append('ld') + +- # Finally, link with the X11 libraries (not appropriate on cygwin) +- if host_platform != "cygwin": +- libs.append('X11') +- + ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], + define_macros=[('WITH_APPINIT', 1)] + defs, + include_dirs = include_dirs, diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/default.nix new file mode 100644 index 000000000000..a008be707c2c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/default.nix @@ -0,0 +1,196 @@ +{ stdenv, fetchurl, fetchpatch +, bzip2 +, expat +, libffi +, gdbm +, lzma +, ncurses +, openssl +, readline +, sqlite +, tcl ? null, tk ? null, tix ? null, libX11 ? null, xproto ? null, x11Support ? false +, zlib +, callPackage +, self +, CF, configd +, python-setup-hook +# For the Python package set +, packageOverrides ? (self: super: {}) +}: + +assert x11Support -> tcl != null + && tk != null + && xproto != null + && libX11 != null; +with stdenv.lib; + +let + majorVersion = "3.7"; + minorVersion = "2"; + minorVersionSuffix = ""; + version = "${majorVersion}.${minorVersion}${minorVersionSuffix}"; + libPrefix = "python${majorVersion}"; + sitePackages = "lib/${libPrefix}/site-packages"; + + buildInputs = filter (p: p != null) [ + zlib bzip2 expat lzma libffi gdbm sqlite readline ncurses openssl ] + ++ optionals x11Support [ tcl tk libX11 xproto ] + ++ optionals stdenv.isDarwin [ CF configd ]; + + hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); + +in stdenv.mkDerivation { + name = "python3-${version}"; + pythonVersion = majorVersion; + inherit majorVersion version; + + inherit buildInputs; + + src = fetchurl { + url = "https://www.python.org/ftp/python/${majorVersion}.${minorVersion}/Python-${version}.tar.xz"; + sha256 = "1fzi9d2gibh0wzwidyckzbywsxcsbckgsl05ryxlifxia77fhgyq"; + }; + + NIX_LDFLAGS = optionalString stdenv.isLinux "-lgcc_s"; + + # Determinism: We fix the hashes of str, bytes and datetime objects. + PYTHONHASHSEED=0; + + prePatch = optionalString stdenv.isDarwin '' + substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"' + substituteInPlace configure --replace '-Wl,-stack_size,1000000' ' ' + ''; + + patches = [ + ./no-ldconfig.patch + # Fix darwin build https://bugs.python.org/issue34027 + (fetchpatch { + url = https://bugs.python.org/file47666/darwin-libutil.patch; + sha256 = "0242gihnw3wfskl4fydp2xanpl8k5q7fj4dp7dbbqf46a4iwdzpa"; + }) + ] ++ optionals hasDistutilsCxxPatch [ + # Fix for http://bugs.python.org/issue1222585 + # Upstream distutils is calling C compiler to compile C++ code, which + # only works for GCC and Apple Clang. This makes distutils to call C++ + # compiler when needed. + (fetchpatch { + url = "https://bugs.python.org/file48016/python-3.x-distutils-C++.patch"; + sha256 = "1h18lnpx539h5lfxyk379dxwr8m2raigcjixkf133l4xy3f4bzi2"; + }) + ]; + + postPatch = '' + '' + optionalString (x11Support && (tix != null)) '' + substituteInPlace "Lib/tkinter/tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" + ''; + + CPPFLAGS="${concatStringsSep " " (map (p: "-I${getDev p}/include") buildInputs)}"; + LDFLAGS="${concatStringsSep " " (map (p: "-L${getLib p}/lib") buildInputs)}"; + LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}"; + + configureFlags = [ + "--enable-shared" + "--with-threads" + "--without-ensurepip" + "--with-system-expat" + "--with-system-ffi" + "--with-openssl=${openssl.dev}" + ]; + + preConfigure = '' + for i in /usr /sw /opt /pkg; do # improve purity + substituteInPlace ./setup.py --replace $i /no-such-path + done + ${optionalString stdenv.isDarwin '' + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2" + export MACOSX_DEPLOYMENT_TARGET=10.6 + ''} + ''; + + setupHook = python-setup-hook sitePackages; + + postInstall = '' + # needed for some packages, especially packages that backport functionality + # to 2.x from 3.x + for item in $out/lib/python${majorVersion}/test/*; do + if [[ "$item" != */test_support.py* + && "$item" != */test/support + && "$item" != */test/libregrtest + && "$item" != */test/regrtest.py* ]]; then + rm -rf "$item" + else + echo $item + fi + done + touch $out/lib/python${majorVersion}/test/__init__.py + + ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}" + paxmark E $out/bin/python${majorVersion} + + # Python on Nix is not manylinux1 compatible. https://github.com/NixOS/nixpkgs/issues/18484 + echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py + + # Determinism: Windows installers were not deterministic. + # We're also not interested in building Windows installers. + find "$out" -name 'wininst*.exe' | xargs -r rm -f + + # Use Python3 as default python + ln -s "$out/bin/idle3" "$out/bin/idle" + ln -s "$out/bin/pydoc3" "$out/bin/pydoc" + ln -s "$out/bin/python3" "$out/bin/python" + ln -s "$out/bin/python3-config" "$out/bin/python-config" + ln -s "$out/lib/pkgconfig/python3.pc" "$out/lib/pkgconfig/python.pc" + + # Get rid of retained dependencies on -dev packages, and remove + # some $TMPDIR references to improve binary reproducibility. + # Note that the .pyc file of _sysconfigdata.py should be regenerated! + for i in $out/lib/python${majorVersion}/_sysconfigdata*.py $out/lib/python${majorVersion}/config-${majorVersion}m*/Makefile; do + sed -i $i -e "s|-I/nix/store/[^ ']*||g" -e "s|-L/nix/store/[^ ']*||g" -e "s|$TMPDIR|/no-such-path|g" + done + + # Determinism: rebuild all bytecode + # We exclude lib2to3 because that's Python 2 code which fails + # We rebuild three times, once for each optimization level + # Python 3.7 implements PEP 552, introducing support for deterministic bytecode. + # This is automatically used when `SOURCE_DATE_EPOCH` is set. + find $out -name "*.py" | $out/bin/python -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | $out/bin/python -O -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | $out/bin/python -OO -m compileall -q -f -x "lib2to3" -i - + ''; + + passthru = let + pythonPackages = callPackage ../../../../../top-level/python-packages.nix { + python = self; + overrides = packageOverrides; + }; + in rec { + inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch; + executable = "${libPrefix}m"; + buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; }; + withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;}; + pkgs = pythonPackages; + isPy3 = true; + isPy37 = true; + is_py3k = true; # deprecated + interpreter = "${self}/bin/${executable}"; + }; + + enableParallelBuilding = true; + + meta = { + homepage = http://python.org; + description = "A high-level dynamically-typed programming language"; + longDescription = '' + Python is a remarkably powerful dynamic programming language that + is used in a wide variety of application domains. Some of its key + distinguishing features include: clear, readable syntax; strong + introspection capabilities; intuitive object orientation; natural + expression of procedural code; full modularity, supporting + hierarchical packages; exception-based error handling; and very + high level dynamic data types. + ''; + license = licenses.psfl; + platforms = with platforms; linux ++ darwin; + maintainers = with maintainers; [ fridh kragniz ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/no-ldconfig.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/no-ldconfig.patch new file mode 100644 index 000000000000..a1f9d68eb166 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/no-ldconfig.patch @@ -0,0 +1,100 @@ +From 597e73f2a4b2f0b508127931b36d5540d6941823 Mon Sep 17 00:00:00 2001 +From: Frederik Rietdijk <fridh@fridh.nl> +Date: Mon, 28 Aug 2017 09:24:06 +0200 +Subject: [PATCH] Don't use ldconfig + +--- + Lib/ctypes/util.py | 70 ++---------------------------------------------------- + 1 file changed, 2 insertions(+), 68 deletions(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 5e8b31a854..7b45ce6c15 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -94,46 +94,7 @@ elif os.name == "posix": + import re, tempfile + + def _findLib_gcc(name): +- # Run GCC's linker with the -t (aka --trace) option and examine the +- # library name it prints out. The GCC command will fail because we +- # haven't supplied a proper program with main(), but that does not +- # matter. +- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) +- +- c_compiler = shutil.which('gcc') +- if not c_compiler: +- c_compiler = shutil.which('cc') +- if not c_compiler: +- # No C compiler available, give up +- return None +- +- temp = tempfile.NamedTemporaryFile() +- try: +- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] +- +- env = dict(os.environ) +- env['LC_ALL'] = 'C' +- env['LANG'] = 'C' +- try: +- proc = subprocess.Popen(args, +- stdout=subprocess.PIPE, +- stderr=subprocess.STDOUT, +- env=env) +- except OSError: # E.g. bad executable +- return None +- with proc: +- trace = proc.stdout.read() +- finally: +- try: +- temp.close() +- except FileNotFoundError: +- # Raised if the file was already removed, which is the normal +- # behaviour of GCC if linking fails +- pass +- res = re.search(expr, trace) +- if not res: +- return None +- return os.fsdecode(res.group(0)) ++ return None + + + if sys.platform == "sunos5": +@@ -255,34 +216,7 @@ elif os.name == "posix": + else: + + def _findSoname_ldconfig(name): +- import struct +- if struct.calcsize('l') == 4: +- machine = os.uname().machine + '-32' +- else: +- machine = os.uname().machine + '-64' +- mach_map = { +- 'x86_64-64': 'libc6,x86-64', +- 'ppc64-64': 'libc6,64bit', +- 'sparc64-64': 'libc6,64bit', +- 's390x-64': 'libc6,64bit', +- 'ia64-64': 'libc6,IA-64', +- } +- abi_type = mach_map.get(machine, 'libc6') +- +- # XXX assuming GLIBC's ldconfig (with option -p) +- regex = r'\s+(lib%s\.[^\s]+)\s+\(%s' +- regex = os.fsencode(regex % (re.escape(name), abi_type)) +- try: +- with subprocess.Popen(['/sbin/ldconfig', '-p'], +- stdin=subprocess.DEVNULL, +- stderr=subprocess.DEVNULL, +- stdout=subprocess.PIPE, +- env={'LC_ALL': 'C', 'LANG': 'C'}) as p: +- res = re.search(regex, p.stdout.read()) +- if res: +- return os.fsdecode(res.group(1)) +- except OSError: +- pass ++ return None + + def _findLib_ld(name): + # See issue #9998 for why this is needed +-- +2.15.0 + diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-html.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-html.nix new file mode 100644 index 000000000000..3885b43960f5 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-html.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation rec { + name = "python27-docs-html-2.7.3"; + src = fetchurl { + url = http://docs.python.org/ftp/python/doc/2.7.3/python-2.7.3-docs-html.tar.bz2; + sha256 = "1hg92n0mzl9w6j33b2h0bf2vy6fsxnpxfdc3qw760vcm0y00155j"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/html + ''; + meta = { + maintainers = [ lib.maintainers.chaoflow ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-a4.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-a4.nix new file mode 100644 index 000000000000..d8dde17ac66a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-a4.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation rec { + name = "python27-docs-pdf-a4-2.7.3"; + src = fetchurl { + url = http://docs.python.org/ftp/python/doc/2.7.3/python-2.7.3-docs-pdf-a4.tar.bz2; + sha256 = "13da88panq5b6qfhf8k4dgqgxkg4ydcac5cx69a3f35s1w90xdjr"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/pdf-a4 + ''; + meta = { + maintainers = [ lib.maintainers.chaoflow ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-letter.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-letter.nix new file mode 100644 index 000000000000..32581cd229a9 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-pdf-letter.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation rec { + name = "python27-docs-pdf-letter-2.7.3"; + src = fetchurl { + url = http://docs.python.org/ftp/python/doc/2.7.3/python-2.7.3-docs-pdf-letter.tar.bz2; + sha256 = "0x41phsdrpivhzkchswsliyx3a10n7gzc9irkrw6rz22j81bfydg"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/pdf-letter + ''; + meta = { + maintainers = [ lib.maintainers.chaoflow ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-text.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-text.nix new file mode 100644 index 000000000000..590192383016 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/2.7-text.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation rec { + name = "python27-docs-text-2.7.3"; + src = fetchurl { + url = http://docs.python.org/ftp/python/doc/2.7.3/python-2.7.3-docs-text.tar.bz2; + sha256 = "1rxlb3jhh3892y65i45nk1y2lx981fr22a5hmfkp9gvjvdykjnzp"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/text + ''; + meta = { + maintainers = [ lib.maintainers.chaoflow ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/docs/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/default.nix new file mode 100644 index 000000000000..60e0a0bf1e6e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, lib }: + +let +pythonDocs = { + html = { + recurseForDerivations = true; + python27 = import ./2.7-html.nix { + inherit stdenv fetchurl lib; + }; + }; + pdf_a4 = { + recurseForDerivations = true; + python27 = import ./2.7-pdf-a4.nix { + inherit stdenv fetchurl lib; + }; + }; + pdf_letter = { + recurseForDerivations = true; + python27 = import ./2.7-pdf-letter.nix { + inherit stdenv fetchurl lib; + }; + }; + text = { + recurseForDerivations = true; + python27 = import ./2.7-text.nix { + inherit stdenv fetchurl lib; + }; + }; +}; in pythonDocs diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/docs/generate.sh b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/generate.sh new file mode 100755 index 000000000000..bebefc10ccd0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/generate.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +TYPES="html pdf-a4 pdf-letter text" +URL=http://docs.python.org/ftp/python/doc/VERSION/python-VERSION-docs-TYPE.tar.bz2 +VERSIONS=$(curl http://www.python.org/download/releases/ 2>/dev/null | grep "releases/[123456789]"| cut -d/ -f4 |grep -v "^[12].[012345]" |grep -v "^1.6.1") +echo "Generating expressions for: +${VERSIONS} +" + + +cat >default.nix <<EOF +{ stdenv, fetchurl, lib }: + +let +pythonDocs = { +EOF + +for type in $TYPES; do + cat >>default.nix <<EOF + ${type/-/_} = { + recurseForDerivations = true; +EOF + + for version in $VERSIONS; do + major=$(echo -n ${version}| cut -d. -f1) + minor=$(echo -n ${version}| cut -d. -f2) + outfile=${major}.${minor}-${type}.nix + hash= + if [ -e ${outfile} ]; then + currentversion=$(grep "url =" ${outfile} |cut -d/ -f7) + if [ ${version} = ${currentversion} ]; then + hash=$(grep sha256 ${outfile} | cut -d'"' -f2) + fi + fi + echo "Generating ${outfile}" + url=$(echo -n $URL |sed -e "s,VERSION,${version},g" -e "s,TYPE,${type},") + sha=$(nix-prefetch-url ${url} ${hash}) + + sed -e "s,VERSION,${version}," \ + -e "s,MAJOR,${major}," \ + -e "s,MINOR,${minor}," \ + -e "s,TYPE,${type}," \ + -e "s,URL,${url}," \ + -e "s,SHA,${sha}," < template.nix > ${outfile} + + attrname=python${major}${minor} + cat >>default.nix <<EOF + ${attrname} = import ./${major}.${minor}-${type}.nix { + inherit stdenv fetchurl lib; + }; +EOF + + echo "done." + echo + done + echo " };" >> default.nix +done + +echo "}; in pythonDocs" >> default.nix diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/docs/template.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/template.nix new file mode 100644 index 000000000000..cc92f71bc1ea --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/template.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation rec { + name = "pythonMAJORMINOR-docs-TYPE-VERSION"; + src = fetchurl { + url = URL; + sha256 = "SHA"; + }; + installPhase = '' + mkdir -p $out/share/doc/pythonMAJORMINOR + cp -R ./ $out/share/doc/pythonMAJORMINOR/TYPE + ''; + meta = { + maintainers = [ lib.maintainers.chaoflow ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/mk-python-derivation.nix b/nixpkgs/pkgs/development/interpreters/python/mk-python-derivation.nix new file mode 100644 index 000000000000..b9a6835908f9 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -0,0 +1,116 @@ +# Generic builder. + +{ lib +, config +, python +, wrapPython +, setuptools +, unzip +, ensureNewerSourcesForZipFilesHook +# Whether the derivation provides a Python module or not. +, toPythonModule +, namePrefix +, writeScript +, update-python-libraries +}: + +{ name ? "${attrs.pname}-${attrs.version}" + +# Build-time dependencies for the package +, nativeBuildInputs ? [] + +# Run-time dependencies for the package +, buildInputs ? [] + +# Dependencies needed for running the checkPhase. +# These are added to buildInputs when doCheck = true. +, checkInputs ? [] + +# propagate build dependencies so in case we have A -> B -> C, +# C can import package A propagated by B +, propagatedBuildInputs ? [] + +# DEPRECATED: use propagatedBuildInputs +, pythonPath ? [] + +# used to disable derivation, useful for specific python versions +, disabled ? false + +# Raise an error if two packages are installed with the same name +, catchConflicts ? true + +# Additional arguments to pass to the makeWrapper function, which wraps +# generated binaries. +, makeWrapperArgs ? [] + +# Skip wrapping of python programs altogether +, dontWrapPythonPrograms ? false + +# Remove bytecode from bin folder. +# When a Python script has the extension `.py`, bytecode is generated +# Typically, executables in bin have no extension, so no bytecode is generated. +# However, some packages do provide executables with extensions, and thus bytecode is generated. +, removeBinBytecode ? true + +, meta ? {} + +, passthru ? {} + +, doCheck ? config.doCheckByDefault or false + +, ... } @ attrs: + + +# Keep extra attributes from `attrs`, e.g., `patchPhase', etc. +if disabled +then throw "${name} not supported for interpreter ${python.executable}" +else + +let self = toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [ + "disabled" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" + ] // { + + name = namePrefix + name; + + nativeBuildInputs = [ ensureNewerSourcesForZipFilesHook ] + ++ nativeBuildInputs; + + buildInputs = [ wrapPython ] + ++ lib.optional (lib.hasSuffix "zip" (attrs.src.name or "")) unzip + ++ lib.optional catchConflicts setuptools # If we no longer propagate setuptools + ++ buildInputs + ++ pythonPath; + + # Propagate python and setuptools. We should stop propagating setuptools. + propagatedBuildInputs = propagatedBuildInputs ++ [ python setuptools ]; + + # Python packages don't have a checkPhase, only an installCheckPhase + doCheck = false; + doInstallCheck = doCheck; + installCheckInputs = checkInputs; + + postFixup = lib.optionalString (!dontWrapPythonPrograms) '' + wrapPythonPrograms + '' + lib.optionalString removeBinBytecode '' + if [ -d "$out/bin" ]; then + rm -rf "$out/bin/__pycache__" # Python 3 + find "$out/bin" -type f -name "*.pyc" -delete # Python 2 + fi + '' + lib.optionalString catchConflicts '' + # Check if we have two packages with the same name in the closure and fail. + # If this happens, something went wrong with the dependencies specs. + # Intentionally kept in a subdirectory, see catch_conflicts/README.md. + ${python.interpreter} ${./catch_conflicts}/catch_conflicts.py + '' + attrs.postFixup or ''''; + + meta = { + # default to python's platforms + platforms = python.meta.platforms; + isBuildPythonPackage = python.meta.platforms; + } // meta; +})); + +passthru.updateScript = let + filename = builtins.head (lib.splitString ":" self.meta.position); + in attrs.passthru.updateScript or [ update-python-libraries filename ]; +in lib.extendDerivation true passthru self diff --git a/nixpkgs/pkgs/development/interpreters/python/pypy/2.7/default.nix b/nixpkgs/pkgs/development/interpreters/python/pypy/2.7/default.nix new file mode 100644 index 000000000000..6f7fa9622960 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/pypy/2.7/default.nix @@ -0,0 +1,136 @@ +{ stdenv, substituteAll, fetchurl +, zlib ? null, zlibSupport ? true, bzip2, pkgconfig, libffi +, sqlite, openssl, ncurses, python, expat, tcl, tk, tix, xlibsWrapper, libX11 +, makeWrapper, callPackage, self, gdbm, db +, python-setup-hook +# For the Python package set +, packageOverrides ? (self: super: {}) +}: + +assert zlibSupport -> zlib != null; + +let + version = "6.0.0"; + pythonVersion = "2.7"; + libPrefix = "pypy${pythonVersion}"; + sitePackages = "site-packages"; + + pythonForPypy = python.withPackages (ppkgs: [ ppkgs.pycparser ]); + +in stdenv.mkDerivation rec { + name = "pypy-${version}"; + inherit version pythonVersion; + + src = fetchurl { + url = "https://bitbucket.org/pypy/pypy/get/release-pypy${pythonVersion}-v${version}.tar.bz2"; + sha256 = "1qjwpc8n68sxxlfg36s5vn1h2gdfvvd6lxvr4lzbvfwhzrgqahsw"; + }; + + nativeBuildInputs = [ pkgconfig makeWrapper ]; + buildInputs = [ + bzip2 openssl pythonForPypy libffi ncurses expat sqlite tk tcl xlibsWrapper libX11 gdbm db + ] ++ stdenv.lib.optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc + ++ stdenv.lib.optional zlibSupport zlib; + + hardeningDisable = stdenv.lib.optional stdenv.isi686 "pic"; + + C_INCLUDE_PATH = stdenv.lib.makeSearchPathOutput "dev" "include" buildInputs; + LIBRARY_PATH = stdenv.lib.makeLibraryPath buildInputs; + LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath (stdenv.lib.filter (x : x.outPath != stdenv.cc.libc.outPath or "") buildInputs); + + patches = [ + (substituteAll { + src = ./tk_tcl_paths.patch; + inherit tk tcl; + tk_dev = tk.dev; + tcl_dev = tcl; + tk_libprefix = tk.libPrefix; + tcl_libprefix = tcl.libPrefix; + }) + ]; + + postPatch = '' + substituteInPlace "lib-python/2.7/lib-tk/Tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" + + # hint pypy to find nix ncurses + substituteInPlace pypy/module/_minimal_curses/fficurses.py \ + --replace "/usr/include/ncurses/curses.h" "${ncurses.dev}/include/curses.h" \ + --replace "ncurses/curses.h" "${ncurses.dev}/include/curses.h" \ + --replace "ncurses/term.h" "${ncurses.dev}/include/term.h" \ + --replace "libraries=['curses']" "libraries=['ncurses']" + + sed -i "s@libraries=\['sqlite3'\]\$@libraries=['sqlite3'], include_dirs=['${sqlite.dev}/include'], library_dirs=['${sqlite.out}/lib']@" lib_pypy/_sqlite3_build.py + ''; + + buildPhase = '' + ${pythonForPypy.interpreter} rpython/bin/rpython \ + --make-jobs="$NIX_BUILD_CORES" \ + -Ojit \ + --batch pypy/goal/targetpypystandalone.py + ''; + + setupHook = python-setup-hook sitePackages; + + doCheck = true; + checkPhase = '' + export TERMINFO="${ncurses.out}/share/terminfo/"; + export TERM="xterm"; + export HOME="$TMPDIR"; + # disable shutils because it assumes gid 0 exists + # disable socket because it has two actual network tests that fail + # disable test_urllib2net, test_urllib2_localnet, and test_urllibnet because they require networking (example.com) + ./pypy-c ./pypy/test_all.py --pypy=./pypy-c -k 'not ( test_urllib2net or test_urllibnet or test_urllib2_localnet or test_socket or test_shutil )' lib-python + ''; + + installPhase = '' + mkdir -p $out/{bin,include,lib,pypy-c} + + cp -R {include,lib_pypy,lib-python,pypy-c} $out/pypy-c + cp libpypy-c.so $out/lib/ + ln -s $out/pypy-c/pypy-c $out/bin/pypy + chmod +x $out/bin/pypy + + # other packages expect to find stuff according to libPrefix + ln -s $out/pypy-c/include $out/include/${libPrefix} + ln -s $out/pypy-c/lib-python/${pythonVersion} $out/lib/${libPrefix} + + # We must wrap the original, not the symlink. + # PyPy uses argv[0] to find its standard library, and while it knows + # how to follow symlinks, it doesn't know about wrappers. So, it + # will think the wrapper is the original. As long as the wrapper has + # the same path as the original, this is OK. + wrapProgram "$out/pypy-c/pypy-c" \ + --set LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:$out/lib" \ + --set LIBRARY_PATH "${LIBRARY_PATH}:$out/lib" + + # verify cffi modules + $out/bin/pypy -c "import Tkinter;import sqlite3;import curses" + + # Python on Nix is not manylinux1 compatible. https://github.com/NixOS/nixpkgs/issues/18484 + echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py + ''; + + passthru = let + pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;}; + in rec { + inherit zlibSupport libPrefix sitePackages; + executable = "pypy"; + isPypy = true; + isPy2 = true; + isPy27 = true; + buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; }; + interpreter = "${self}/bin/${executable}"; + withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;}; + pkgs = pythonPackages; + }; + + enableParallelBuilding = true; # almost no parallelization without STM + + meta = with stdenv.lib; { + homepage = http://pypy.org/; + description = "Fast, compliant alternative implementation of the Python language (2.7.13)"; + license = licenses.mit; + platforms = [ "i686-linux" "x86_64-linux" ]; + maintainers = with maintainers; [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/pypy/2.7/tk_tcl_paths.patch b/nixpkgs/pkgs/development/interpreters/python/pypy/2.7/tk_tcl_paths.patch new file mode 100644 index 000000000000..92bbfc557b35 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/pypy/2.7/tk_tcl_paths.patch @@ -0,0 +1,17 @@ +--- pypy-pypy-84a2f3e6a7f8.org/lib_pypy/_tkinter/tklib_build.py 2017-10-03 11:49:20.000000000 +0100 ++++ pypy-pypy-84a2f3e6a7f8/lib_pypy/_tkinter/tklib_build.py 2017-11-21 13:20:51.398607530 +0000 +@@ -24,11 +24,11 @@ + else: + # On some Linux distributions, the tcl and tk libraries are + # stored in /usr/include, so we must check this case also +- libdirs = [] ++ libdirs = ["@tcl@/lib", "@tk@/lib"] + found = False + for _ver in ['', '8.6', '8.5']: +- incdirs = ['/usr/include/tcl' + _ver] +- linklibs = ['tcl' + _ver, 'tk' + _ver] ++ incdirs = ['@tcl_dev@/include', '@tk_dev@/include'] ++ linklibs = ['@tcl_libprefix@', '@tk_libprefix@'] + if os.path.isdir(incdirs[0]): + found = True + break diff --git a/nixpkgs/pkgs/development/interpreters/python/pypy/3/default.nix b/nixpkgs/pkgs/development/interpreters/python/pypy/3/default.nix new file mode 100644 index 000000000000..23e239d925ba --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/pypy/3/default.nix @@ -0,0 +1,138 @@ +{ stdenv, substituteAll, fetchurl +, zlib ? null, zlibSupport ? true, bzip2, pkgconfig, libffi +, sqlite, openssl, ncurses, python, expat, tcl, tk, tix, xlibsWrapper, libX11 +, makeWrapper, callPackage, self, gdbm, db, lzma +, python-setup-hook +# For the Python package set +, packageOverrides ? (self: super: {}) +}: + +assert zlibSupport -> zlib != null; + +let + version = "6.0.0"; + pythonVersion = "3.5"; + libPrefix = "pypy${pythonVersion}"; + sitePackages = "site-packages"; + + pythonForPypy = python.withPackages (ppkgs: [ ppkgs.pycparser ]); + +in stdenv.mkDerivation rec { + name = "pypy3-${version}"; + inherit version pythonVersion; + + src = fetchurl { + url = "https://bitbucket.org/pypy/pypy/get/release-pypy${pythonVersion}-v${version}.tar.bz2"; + sha256 = "0lwq8nn0r5yj01bwmkk5p7xvvrp4s550l8184mkmn74d3gphrlwg"; + }; + + nativeBuildInputs = [ pkgconfig makeWrapper ]; + buildInputs = [ + bzip2 openssl pythonForPypy libffi ncurses expat sqlite tk tcl xlibsWrapper libX11 gdbm db lzma + ] ++ stdenv.lib.optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc + ++ stdenv.lib.optional zlibSupport zlib; + + hardeningDisable = stdenv.lib.optional stdenv.isi686 "pic"; + + C_INCLUDE_PATH = stdenv.lib.makeSearchPathOutput "dev" "include" buildInputs; + LIBRARY_PATH = stdenv.lib.makeLibraryPath buildInputs; + LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath (stdenv.lib.filter (x : x.outPath != stdenv.cc.libc.outPath or "") buildInputs); + + patches = [ + (substituteAll { + src = ./tk_tcl_paths.patch; + inherit tk tcl; + tk_dev = tk.dev; + tcl_dev = tcl; + tk_libprefix = tk.libPrefix; + tcl_libprefix = tcl.libPrefix; + }) + ]; + + postPatch = '' + substituteInPlace "lib-python/3/tkinter/tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" + + # hint pypy to find nix ncurses + substituteInPlace pypy/module/_minimal_curses/fficurses.py \ + --replace "/usr/include/ncurses/curses.h" "${ncurses.dev}/include/curses.h" \ + --replace "ncurses/curses.h" "${ncurses.dev}/include/curses.h" \ + --replace "ncurses/term.h" "${ncurses.dev}/include/term.h" \ + --replace "libraries=['curses']" "libraries=['ncurses']" + + sed -i "s@libraries=\['sqlite3'\]\$@libraries=['sqlite3'], include_dirs=['${sqlite.dev}/include'], library_dirs=['${sqlite.out}/lib']@" lib_pypy/_sqlite3_build.py + ''; + + buildPhase = '' + ${pythonForPypy.interpreter} rpython/bin/rpython \ + --make-jobs="$NIX_BUILD_CORES" \ + -Ojit \ + --batch pypy/goal/targetpypystandalone.py + ''; + + setupHook = python-setup-hook sitePackages; + + doCheck = true; + checkPhase = '' + export TERMINFO="${ncurses.out}/share/terminfo/"; + export TERM="xterm"; + export HOME="$TMPDIR"; + # disable asyncio due to https://github.com/NixOS/nix/issues/1238 + # disable os due to https://github.com/NixOS/nixpkgs/issues/10496 + # disable pathlib due to https://bitbucket.org/pypy/pypy/pull-requests/594 + # disable shutils because it assumes gid 0 exists + # disable socket because it has two actual network tests that fail + # disable tarfile because it assumes gid 0 exists + ${pythonForPypy.interpreter} ./pypy/test_all.py --pypy=./pypy3-c -k 'not ( test_asyncio or test_os or test_pathlib or test_shutil or test_socket or test_tarfile )' lib-python + ''; + + installPhase = '' + mkdir -p $out/{bin,include,lib,pypy3-c} + + cp -R {include,lib_pypy,lib-python,pypy3-c} $out/pypy3-c + cp libpypy3-c.so $out/lib/ + ln -s $out/pypy3-c/pypy3-c $out/bin/pypy3 + + # other packages expect to find stuff according to libPrefix + ln -s $out/pypy3-c/include $out/include/${libPrefix} + ln -s $out/pypy3-c/lib-python/3 $out/lib/${libPrefix} + + # We must wrap the original, not the symlink. + # PyPy uses argv[0] to find its standard library, and while it knows + # how to follow symlinks, it doesn't know about wrappers. So, it + # will think the wrapper is the original. As long as the wrapper has + # the same path as the original, this is OK. + wrapProgram "$out/pypy3-c/pypy3-c" \ + --set LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:$out/lib" \ + --set LIBRARY_PATH "${LIBRARY_PATH}:$out/lib" + + # verify cffi modules + $out/bin/pypy3 -c "import tkinter;import sqlite3;import curses;import lzma" + + # Python on Nix is not manylinux1 compatible. https://github.com/NixOS/nixpkgs/issues/18484 + echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py + ''; + + passthru = let + pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;}; + in rec { + inherit zlibSupport libPrefix sitePackages; + executable = "pypy3"; + isPypy = true; + isPy3 = true; + isPy35 = true; + buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; }; + interpreter = "${self}/bin/${executable}"; + withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;}; + pkgs = pythonPackages; + }; + + enableParallelBuilding = true; # almost no parallelization without STM + + meta = with stdenv.lib; { + homepage = http://pypy.org/; + description = "Fast, compliant alternative implementation of the Python language (3.5.3)"; + license = licenses.mit; + platforms = [ "i686-linux" "x86_64-linux" ]; + maintainers = with maintainers; [ andersk ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/pypy/3/tk_tcl_paths.patch b/nixpkgs/pkgs/development/interpreters/python/pypy/3/tk_tcl_paths.patch new file mode 100644 index 000000000000..92bbfc557b35 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/pypy/3/tk_tcl_paths.patch @@ -0,0 +1,17 @@ +--- pypy-pypy-84a2f3e6a7f8.org/lib_pypy/_tkinter/tklib_build.py 2017-10-03 11:49:20.000000000 +0100 ++++ pypy-pypy-84a2f3e6a7f8/lib_pypy/_tkinter/tklib_build.py 2017-11-21 13:20:51.398607530 +0000 +@@ -24,11 +24,11 @@ + else: + # On some Linux distributions, the tcl and tk libraries are + # stored in /usr/include, so we must check this case also +- libdirs = [] ++ libdirs = ["@tcl@/lib", "@tk@/lib"] + found = False + for _ver in ['', '8.6', '8.5']: +- incdirs = ['/usr/include/tcl' + _ver] +- linklibs = ['tcl' + _ver, 'tk' + _ver] ++ incdirs = ['@tcl_dev@/include', '@tk_dev@/include'] ++ linklibs = ['@tcl_libprefix@', '@tk_libprefix@'] + if os.path.isdir(incdirs[0]): + found = True + break diff --git a/nixpkgs/pkgs/development/interpreters/python/run_setup.py b/nixpkgs/pkgs/development/interpreters/python/run_setup.py new file mode 100644 index 000000000000..e3a530eb0cb6 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/run_setup.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- + +import setuptools +import tokenize + +__file__='setup.py'; + +exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec')) diff --git a/nixpkgs/pkgs/development/interpreters/python/setup-hook.nix b/nixpkgs/pkgs/development/interpreters/python/setup-hook.nix new file mode 100644 index 000000000000..b66bd1cc5f69 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/setup-hook.nix @@ -0,0 +1,13 @@ +{ runCommand }: + +sitePackages: + +let + hook = ./setup-hook.sh; +in runCommand "python-setup-hook.sh" { + inherit sitePackages; +} '' + cp ${hook} hook.sh + substituteAllInPlace hook.sh + mv hook.sh $out +'' diff --git a/nixpkgs/pkgs/development/interpreters/python/setup-hook.sh b/nixpkgs/pkgs/development/interpreters/python/setup-hook.sh new file mode 100644 index 000000000000..77ec9e9ac0bf --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/setup-hook.sh @@ -0,0 +1,24 @@ +addPythonPath() { + addToSearchPathWithCustomDelimiter : PYTHONPATH $1/@sitePackages@ +} + +toPythonPath() { + local paths="$1" + local result= + for i in $paths; do + p="$i/@sitePackages@" + result="${result}${result:+:}$p" + done + echo $result +} + +addEnvHooks "$hostOffset" addPythonPath + +# Determinism: The interpreter is patched to write null timestamps when compiling python files. +# This way python doesn't try to update them when we freeze timestamps in nix store. +export DETERMINISTIC_BUILD=1; +# Determinism: We fix the hashes of str, bytes and datetime objects. +export PYTHONHASHSEED=0; +# Determinism. Whenever Python is included, it should not check user site-packages. +# This option is only relevant when the sandbox is disabled. +export PYTHONNOUSERSITE=1; diff --git a/nixpkgs/pkgs/development/interpreters/python/update-python-libraries/default.nix b/nixpkgs/pkgs/development/interpreters/python/update-python-libraries/default.nix new file mode 100644 index 000000000000..762ca2bdd34b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/update-python-libraries/default.nix @@ -0,0 +1,12 @@ +{ python3, runCommand, git }: + +runCommand "update-python-libraries" { + buildInputs = [ + (python3.withPackages(ps: with ps; [ packaging requests toolz ])) + git + ]; +} '' + cp ${./update-python-libraries.py} $out + patchShebangs $out + substituteInPlace $out --replace 'GIT = "git"' 'GIT = "${git}/bin/git"' +'' \ No newline at end of file diff --git a/nixpkgs/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py b/nixpkgs/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py new file mode 100755 index 000000000000..9292a9307030 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py @@ -0,0 +1,362 @@ +#!/usr/bin/env python3 + +""" +Update a Python package expression by passing in the `.nix` file, or the directory containing it. +You can pass in multiple files or paths. + +You'll likely want to use +`` + $ ./update-python-libraries ../../pkgs/development/python-modules/* +`` +to update all libraries in that folder. +""" + +import argparse +import logging +import os +import re +import requests +import toolz +from concurrent.futures import ThreadPoolExecutor as Pool +from packaging.version import Version as _Version +from packaging.version import InvalidVersion +from packaging.specifiers import SpecifierSet +import collections +import subprocess + +INDEX = "https://pypi.io/pypi" +"""url of PyPI""" + +EXTENSIONS = ['tar.gz', 'tar.bz2', 'tar', 'zip', '.whl'] +"""Permitted file extensions. These are evaluated from left to right and the first occurance is returned.""" + +PRERELEASES = False + +GIT = "git" + +import logging +logging.basicConfig(level=logging.INFO) + + +class Version(_Version, collections.abc.Sequence): + + def __init__(self, version): + super().__init__(version) + # We cannot use `str(Version(0.04.21))` because that becomes `0.4.21` + # https://github.com/avian2/unidecode/issues/13#issuecomment-354538882 + self.raw_version = version + + def __getitem__(self, i): + return self._version.release[i] + + def __len__(self): + return len(self._version.release) + + def __iter__(self): + yield from self._version.release + + +def _get_values(attribute, text): + """Match attribute in text and return all matches. + + :returns: List of matches. + """ + regex = '{}\s+=\s+"(.*)";'.format(attribute) + regex = re.compile(regex) + values = regex.findall(text) + return values + +def _get_unique_value(attribute, text): + """Match attribute in text and return unique match. + + :returns: Single match. + """ + values = _get_values(attribute, text) + n = len(values) + if n > 1: + raise ValueError("found too many values for {}".format(attribute)) + elif n == 1: + return values[0] + else: + raise ValueError("no value found for {}".format(attribute)) + +def _get_line_and_value(attribute, text): + """Match attribute in text. Return the line and the value of the attribute.""" + regex = '({}\s+=\s+"(.*)";)'.format(attribute) + regex = re.compile(regex) + value = regex.findall(text) + n = len(value) + if n > 1: + raise ValueError("found too many values for {}".format(attribute)) + elif n == 1: + return value[0] + else: + raise ValueError("no value found for {}".format(attribute)) + + +def _replace_value(attribute, value, text): + """Search and replace value of attribute in text.""" + old_line, old_value = _get_line_and_value(attribute, text) + new_line = old_line.replace(old_value, value) + new_text = text.replace(old_line, new_line) + return new_text + +def _fetch_page(url): + r = requests.get(url) + if r.status_code == requests.codes.ok: + return r.json() + else: + raise ValueError("request for {} failed".format(url)) + + +SEMVER = { + 'major' : 0, + 'minor' : 1, + 'patch' : 2, +} + + +def _determine_latest_version(current_version, target, versions): + """Determine latest version, given `target`. + """ + current_version = Version(current_version) + + def _parse_versions(versions): + for v in versions: + try: + yield Version(v) + except InvalidVersion: + pass + + versions = _parse_versions(versions) + + index = SEMVER[target] + + ceiling = list(current_version[0:index]) + if len(ceiling) == 0: + ceiling = None + else: + ceiling[-1]+=1 + ceiling = Version(".".join(map(str, ceiling))) + + # We do not want prereleases + versions = SpecifierSet(prereleases=PRERELEASES).filter(versions) + + if ceiling is not None: + versions = SpecifierSet(f"<{ceiling}").filter(versions) + + return (max(sorted(versions))).raw_version + + +def _get_latest_version_pypi(package, extension, current_version, target): + """Get latest version and hash from PyPI.""" + url = "{}/{}/json".format(INDEX, package) + json = _fetch_page(url) + + versions = json['releases'].keys() + version = _determine_latest_version(current_version, target, versions) + + try: + releases = json['releases'][version] + except KeyError as e: + raise KeyError('Could not find version {} for {}'.format(version, package)) from e + for release in releases: + if release['filename'].endswith(extension): + # TODO: In case of wheel we need to do further checks! + sha256 = release['digests']['sha256'] + break + else: + sha256 = None + return version, sha256 + + +def _get_latest_version_github(package, extension, current_version, target): + raise ValueError("updating from GitHub is not yet supported.") + + +FETCHERS = { + 'fetchFromGitHub' : _get_latest_version_github, + 'fetchPypi' : _get_latest_version_pypi, + 'fetchurl' : _get_latest_version_pypi, +} + + +DEFAULT_SETUPTOOLS_EXTENSION = 'tar.gz' + + +FORMATS = { + 'setuptools' : DEFAULT_SETUPTOOLS_EXTENSION, + 'wheel' : 'whl' +} + +def _determine_fetcher(text): + # Count occurences of fetchers. + nfetchers = sum(text.count('src = {}'.format(fetcher)) for fetcher in FETCHERS.keys()) + if nfetchers == 0: + raise ValueError("no fetcher.") + elif nfetchers > 1: + raise ValueError("multiple fetchers.") + else: + # Then we check which fetcher to use. + for fetcher in FETCHERS.keys(): + if 'src = {}'.format(fetcher) in text: + return fetcher + + +def _determine_extension(text, fetcher): + """Determine what extension is used in the expression. + + If we use: + - fetchPypi, we check if format is specified. + - fetchurl, we determine the extension from the url. + - fetchFromGitHub we simply use `.tar.gz`. + """ + if fetcher == 'fetchPypi': + try: + src_format = _get_unique_value('format', text) + except ValueError as e: + src_format = None # format was not given + + try: + extension = _get_unique_value('extension', text) + except ValueError as e: + extension = None # extension was not given + + if extension is None: + if src_format is None: + src_format = 'setuptools' + elif src_format == 'flit': + raise ValueError("Don't know how to update a Flit package.") + extension = FORMATS[src_format] + + elif fetcher == 'fetchurl': + url = _get_unique_value('url', text) + extension = os.path.splitext(url)[1] + if 'pypi' not in url: + raise ValueError('url does not point to PyPI.') + + elif fetcher == 'fetchFromGitHub': + raise ValueError('updating from GitHub is not yet implemented.') + + return extension + + +def _update_package(path, target): + + # Read the expression + with open(path, 'r') as f: + text = f.read() + + # Determine pname. + pname = _get_unique_value('pname', text) + + # Determine version. + version = _get_unique_value('version', text) + + # First we check how many fetchers are mentioned. + fetcher = _determine_fetcher(text) + + extension = _determine_extension(text, fetcher) + + new_version, new_sha256 = FETCHERS[fetcher](pname, extension, version, target) + + if new_version == version: + logging.info("Path {}: no update available for {}.".format(path, pname)) + return False + elif Version(new_version) <= Version(version): + raise ValueError("downgrade for {}.".format(pname)) + if not new_sha256: + raise ValueError("no file available for {}.".format(pname)) + + text = _replace_value('version', new_version, text) + text = _replace_value('sha256', new_sha256, text) + + with open(path, 'w') as f: + f.write(text) + + logging.info("Path {}: updated {} from {} to {}".format(path, pname, version, new_version)) + + result = { + 'path' : path, + 'target': target, + 'pname': pname, + 'old_version' : version, + 'new_version' : new_version, + #'fetcher' : fetcher, + } + + return result + + +def _update(path, target): + + # We need to read and modify a Nix expression. + if os.path.isdir(path): + path = os.path.join(path, 'default.nix') + + # If a default.nix does not exist, we quit. + if not os.path.isfile(path): + logging.info("Path {}: does not exist.".format(path)) + return False + + # If file is not a Nix expression, we quit. + if not path.endswith(".nix"): + logging.info("Path {}: does not end with `.nix`.".format(path)) + return False + + try: + return _update_package(path, target) + except ValueError as e: + logging.warning("Path {}: {}".format(path, e)) + return False + + +def _commit(path, pname, old_version, new_version, **kwargs): + """Commit result. + """ + + msg = f'python: {pname}: {old_version} -> {new_version}' + + try: + subprocess.check_call([GIT, 'add', path]) + subprocess.check_call([GIT, 'commit', '-m', msg]) + except subprocess.CalledProcessError as e: + subprocess.check_call([GIT, 'checkout', path]) + raise subprocess.CalledProcessError(f'Could not commit {path}') from e + + return True + + +def main(): + + parser = argparse.ArgumentParser() + parser.add_argument('package', type=str, nargs='+') + parser.add_argument('--target', type=str, choices=SEMVER.keys(), default='major') + parser.add_argument('--commit', action='store_true', help='Create a commit for each package update') + + args = parser.parse_args() + target = args.target + + packages = list(map(os.path.abspath, args.package)) + + logging.info("Updating packages...") + + # Use threads to update packages concurrently + with Pool() as p: + results = list(p.map(lambda pkg: _update(pkg, target), packages)) + + logging.info("Finished updating packages.") + + # Commits are created sequentially. + if args.commit: + logging.info("Committing updates...") + list(map(lambda x: _commit(**x), filter(bool, results))) + logging.info("Finished committing updates") + + count = sum(map(bool, results)) + logging.info("{} package(s) updated".format(count)) + + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/nixpkgs/pkgs/development/interpreters/python/with-packages.nix b/nixpkgs/pkgs/development/interpreters/python/with-packages.nix new file mode 100644 index 000000000000..e1de0b2ee4ca --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/with-packages.nix @@ -0,0 +1,3 @@ +{ buildEnv, pythonPackages }: + +f: let packages = f pythonPackages; in buildEnv.override { extraLibs = packages; } diff --git a/nixpkgs/pkgs/development/interpreters/python/wrap-python.nix b/nixpkgs/pkgs/development/interpreters/python/wrap-python.nix new file mode 100644 index 000000000000..1efd777bb052 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/wrap-python.nix @@ -0,0 +1,51 @@ +{ lib +, python +, makeSetupHook +, makeWrapper }: + +with lib; + +makeSetupHook { + deps = makeWrapper; + substitutions.libPrefix = python.libPrefix; + substitutions.executable = python.interpreter; + substitutions.python = python; + substitutions.magicalSedExpression = let + # Looks weird? Of course, it's between single quoted shell strings. + # NOTE: Order DOES matter here, so single character quotes need to be + # at the last position. + quoteVariants = [ "'\"'''\"'" "\"\"\"" "\"" "'\"'\"'" ]; # hey Vim: '' + + mkStringSkipper = labelNum: quote: let + label = "q${toString labelNum}"; + isSingle = elem quote [ "\"" "'\"'\"'" ]; + endQuote = if isSingle then "[^\\\\]${quote}" else quote; + in '' + /^[a-z]?${quote}/ { + /${quote}${quote}|${quote}.*${endQuote}/{n;br} + :${label}; n; /^${quote}/{n;br}; /${endQuote}/{n;br}; b${label} + } + ''; + + # This preamble does two things: + # * Sets argv[0] to the original application's name; otherwise it would be .foo-wrapped. + # Python doesn't support `exec -a`. + # * Adds all required libraries to sys.path via `site.addsitedir`. It also handles *.pth files. + preamble = '' + import sys + import site + import functools + sys.argv[0] = '"'$(readlink -f "$f")'"' + functools.reduce(lambda k, p: site.addsitedir(p, k), ['"$([ -n "$program_PYTHONPATH" ] && (echo "'$program_PYTHONPATH'" | sed "s|:|','|g") || true)"'], site._init_pathinfo()) + ''; + + in '' + 1 { + :r + /\\$|,$/{N;br} + /__future__|^ |^ *(#.*)?$/{n;br} + ${concatImapStrings mkStringSkipper quoteVariants} + /^[^# ]/i ${replaceStrings ["\n"] [";"] preamble} + } + ''; +} ./wrap.sh diff --git a/nixpkgs/pkgs/development/interpreters/python/wrap.sh b/nixpkgs/pkgs/development/interpreters/python/wrap.sh new file mode 100644 index 000000000000..01b573e6ad5d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/wrap.sh @@ -0,0 +1,122 @@ +# Wrapper around wrapPythonProgramsIn, below. The $pythonPath +# variable is passed in from the buildPythonPackage function. +wrapPythonPrograms() { + wrapPythonProgramsIn "$out/bin" "$out $pythonPath" +} + +# Builds environment variables like PYTHONPATH and PATH walking through closure +# of dependencies. +buildPythonPath() { + local pythonPath="$1" + local path + + # Create an empty table of python paths (see doc on _addToPythonPath + # for how this is used). Build up the program_PATH and program_PYTHONPATH + # variables. + declare -A pythonPathsSeen=() + program_PYTHONPATH= + program_PATH= + pythonPathsSeen["@python@"]=1 + addToSearchPath program_PATH @python@/bin + for path in $pythonPath; do + _addToPythonPath $path + done +} + +# Patches a Python script so that it has correct libraries path and executable +# name. +patchPythonScript() { + local f="$1" + + # The magicalSedExpression will invoke a "$(basename "$f")", so + # if you change $f to something else, be sure to also change it + # in pkgs/top-level/python-packages.nix! + # It also uses $program_PYTHONPATH. + sed -i "$f" -re '@magicalSedExpression@' +} + +# Transforms any binaries generated by the setup.py script, replacing them +# with an executable shell script which will set some environment variables +# and then call into the original binary (which has been given a .wrapped +# suffix). +wrapPythonProgramsIn() { + local dir="$1" + local pythonPath="$2" + local f + + buildPythonPath "$pythonPath" + + # Find all regular files in the output directory that are executable. + if [ -d "$dir" ]; then + find "$dir" -type f -perm -0100 -print0 | while read -d "" f; do + # Rewrite "#! .../env python" to "#! /nix/store/.../python". + # Strip suffix, like "3" or "2.7m" -- we don't have any choice on which + # Python to use besides one with this hook anyway. + if head -n1 "$f" | grep -q '#!.*/env.*\(python\|pypy\)'; then + sed -i "$f" -e "1 s^.*/env[ ]*\(python\|pypy\)[^ ]*^#! @executable@^" + fi + + # catch /python and /.python-wrapped + if head -n1 "$f" | grep -q '/\.\?\(python\|pypy\)'; then + # dont wrap EGG-INFO scripts since they are called from python + if echo "$f" | grep -qv EGG-INFO/scripts; then + echo "wrapping \`$f'..." + patchPythonScript "$f" + # wrapProgram creates the executable shell script described + # above. The script will set PYTHONPATH and PATH variables.! + # (see pkgs/build-support/setup-hooks/make-wrapper.sh) + local -a wrap_args=("$f" + --prefix PATH ':' "$program_PATH" + --set PYTHONNOUSERSITE "true" + ) + + # Add any additional arguments provided by makeWrapperArgs + # argument to buildPythonPackage. + local -a user_args="($makeWrapperArgs)" + local -a wrapProgramArgs=("${wrap_args[@]}" "${user_args[@]}") + wrapProgram "${wrapProgramArgs[@]}" + fi + fi + done + fi +} + +# Adds the lib and bin directories to the PYTHONPATH and PATH variables, +# respectively. Recurses on any paths declared in +# `propagated-build-inputs`, while avoiding duplicating paths by +# flagging the directories it has visited in `pythonPathsSeen`. +_addToPythonPath() { + local dir="$1" + # Stop if we've already visited here. + if [ -n "${pythonPathsSeen[$dir]}" ]; then return; fi + pythonPathsSeen[$dir]=1 + # addToSearchPath is defined in stdenv/generic/setup.sh. It will have + # the effect of calling `export program_X=$dir/...:$program_X`. + addToSearchPath program_PYTHONPATH $dir/lib/@libPrefix@/site-packages + addToSearchPath program_PATH $dir/bin + + # Inspect the propagated inputs (if they exist) and recur on them. + local prop="$dir/nix-support/propagated-build-inputs" + if [ -e $prop ]; then + local new_path + for new_path in $(cat $prop); do + _addToPythonPath $new_path + done + fi +} + +createBuildInputsPth() { + local category="$1" + local inputs="$2" + if [ foo"$inputs" != foo ]; then + for x in $inputs; do + if $(echo -n $x |grep -q python-recursive-pth-loader); then + continue + fi + if test -d "$x"/lib/@libPrefix@/site-packages; then + echo $x/lib/@libPrefix@/site-packages \ + >> "$out"/lib/@libPrefix@/site-packages/${name}-nix-python-$category.pth + fi + done + fi +} diff --git a/nixpkgs/pkgs/development/interpreters/python/wrapper.nix b/nixpkgs/pkgs/development/interpreters/python/wrapper.nix new file mode 100644 index 000000000000..27d01e4e1f51 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/wrapper.nix @@ -0,0 +1,63 @@ +{ stdenv, python, buildEnv, makeWrapper +, extraLibs ? [] +, extraOutputsToInstall ? [] +, postBuild ? "" +, ignoreCollisions ? false +, requiredPythonModules +# Wrap executables with the given argument. +, makeWrapperArgs ? [] +, }: + +# Create a python executable that knows about additional packages. +let + env = let + paths = requiredPythonModules (extraLibs ++ [ python ] ) ; + in buildEnv { + name = "${python.name}-env"; + + inherit paths; + inherit ignoreCollisions; + extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall; + + postBuild = '' + . "${makeWrapper}/nix-support/setup-hook" + + if [ -L "$out/bin" ]; then + unlink "$out/bin" + fi + mkdir -p "$out/bin" + + for path in ${stdenv.lib.concatStringsSep " " paths}; do + if [ -d "$path/bin" ]; then + cd "$path/bin" + for prg in *; do + if [ -f "$prg" ]; then + rm -f "$out/bin/$prg" + if [ -x "$prg" ]; then + makeWrapper "$path/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out" --set PYTHONNOUSERSITE "true" ${stdenv.lib.concatStringsSep " " makeWrapperArgs} + fi + fi + done + fi + done + '' + postBuild; + + inherit (python) meta; + + passthru = python.passthru // { + interpreter = "${env}/bin/${python.executable}"; + inherit python; + env = stdenv.mkDerivation { + name = "interactive-${python.name}-environment"; + nativeBuildInputs = [ env ]; + + buildCommand = '' + echo >&2 "" + echo >&2 "*** Python 'env' attributes are intended for interactive nix-shell sessions, not for building! ***" + echo >&2 "" + exit 1 + ''; + }; + }; + }; +in env diff --git a/nixpkgs/pkgs/development/interpreters/qnial/default.nix b/nixpkgs/pkgs/development/interpreters/qnial/default.nix new file mode 100644 index 000000000000..779039c6d6aa --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/qnial/default.nix @@ -0,0 +1,40 @@ +{ stdenv, fetchFromGitHub, unzip, pkgconfig, makeWrapper, ncurses }: + +stdenv.mkDerivation rec { + name = "qnial-${version}"; + version = "6.3"; + + src = fetchFromGitHub { + sha256 = "0426hb8w0wpkisvmf3danj656j6g7rc6v91gqbgzkcj485qjaliw"; + rev = "cfe8720a4577d6413034faa2878295431bfe39f8"; + repo = "qnial"; + owner = "vrthra"; + }; + + nativeBuildInputs = [ makeWrapper ]; + + preConfigure = '' + cd build; + ''; + + installPhase = '' + cd .. + mkdir -p $out/bin $out/lib + cp build/nial $out/bin/ + cp -r niallib $out/lib/ + ''; + + buildInputs = [ + unzip + pkgconfig + ncurses + ]; + + meta = { + description = "An array language from Nial Systems"; + homepage = https://github.com/vrthra/qnial; + license = stdenv.lib.licenses.artistic1; + maintainers = [ stdenv.lib.maintainers.vrthra ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/racket/default.nix b/nixpkgs/pkgs/development/interpreters/racket/default.nix new file mode 100644 index 000000000000..ba66404062be --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/racket/default.nix @@ -0,0 +1,107 @@ +{ stdenv, fetchurl, makeFontsConf, makeWrapper +, cairo, coreutils, fontconfig, freefont_ttf +, glib, gmp +, gtk3 +, libedit, libffi +, libiconv +, libjpeg +, libpng, libtool, mpfr, openssl, pango, poppler +, readline, sqlite +, disableDocs ? false +, CoreFoundation +, gsettings-desktop-schemas +}: + +let + + fontsConf = makeFontsConf { + fontDirectories = [ freefont_ttf ]; + }; + + libPath = stdenv.lib.makeLibraryPath [ + cairo + fontconfig + glib + gmp + gtk3 + gsettings-desktop-schemas + libedit + libjpeg + libpng + mpfr + openssl + pango + poppler + readline + sqlite + ]; + +in + +stdenv.mkDerivation rec { + name = "racket-${version}"; + version = "7.1"; # always change at once with ./minimal.nix + + src = (stdenv.lib.makeOverridable ({ name, sha256 }: + fetchurl rec { + url = "https://mirror.racket-lang.org/installers/${version}/${name}-src.tgz"; + inherit sha256; + } + )) { + inherit name; + sha256 = "180z0z6srzyipi9wfnbh61nbvzxr5d1cls7wxapv6fw92y52jwz9"; + }; + + FONTCONFIG_FILE = fontsConf; + LD_LIBRARY_PATH = libPath; + NIX_LDFLAGS = stdenv.lib.concatStringsSep " " [ + (stdenv.lib.optionalString (stdenv.cc.isGNU && ! stdenv.isDarwin) "-lgcc_s") + (stdenv.lib.optionalString stdenv.isDarwin "-framework CoreFoundation") + ]; + + buildInputs = [ fontconfig libffi libtool makeWrapper sqlite gsettings-desktop-schemas gtk3 ] + ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv CoreFoundation ]; + + preConfigure = '' + unset AR + for f in src/configure src/racket/src/string.c; do + substituteInPlace "$f" --replace /usr/bin/uname ${coreutils}/bin/uname + done + mkdir src/build + cd src/build + ''; + + shared = if stdenv.isDarwin then "dylib" else "shared"; + configureFlags = [ "--enable-${shared}" "--enable-lt=${libtool}/bin/libtool" ] + ++ stdenv.lib.optional disableDocs [ "--disable-docs" ] + ++ stdenv.lib.optional stdenv.isDarwin [ "--enable-xonx" ]; + + configureScript = "../configure"; + + enableParallelBuilding = false; + + postInstall = '' + for p in $(ls $out/bin/) ; do + wrapProgram $out/bin/$p \ + --prefix LD_LIBRARY_PATH ":" "${LD_LIBRARY_PATH}" \ + --prefix XDG_DATA_DIRS ":" "$GSETTINGS_SCHEMAS_PATH"; + done + ''; + + meta = with stdenv.lib; { + description = "A programmable programming language"; + longDescription = '' + Racket is a full-spectrum programming language. It goes beyond + Lisp and Scheme with dialects that support objects, types, + laziness, and more. Racket enables programmers to link + components written in different dialects, and it empowers + programmers to create new, project-specific dialects. Racket's + libraries support applications from web servers and databases to + GUIs and charts. + ''; + homepage = http://racket-lang.org/; + license = licenses.lgpl3; + maintainers = with maintainers; [ kkallio henrytill vrthra ]; + platforms = [ "x86_64-darwin" "x86_64-linux" ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/racket/minimal.nix b/nixpkgs/pkgs/development/interpreters/racket/minimal.nix new file mode 100644 index 000000000000..114023defcd4 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/racket/minimal.nix @@ -0,0 +1,19 @@ +{ racket +}: + +racket.overrideAttrs (oldAttrs: rec { + name = "racket-minimal-${oldAttrs.version}"; + src = oldAttrs.src.override { + inherit name; + sha256 = "11vcqxdgyarv89ijd46wzrdl2wk7xjirg7ynlz7r0smdcqrcl711"; + }; + + meta = oldAttrs.meta // { + description = "Racket without bundled packages, such as Dr. Racket."; + longDescription = ''The essential package racket-libs is included, + as well as libraries that live in collections. In particular, raco + and the pkg library are still bundled. + ''; + platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ]; + }; +}) diff --git a/nixpkgs/pkgs/development/interpreters/rakudo/default.nix b/nixpkgs/pkgs/development/interpreters/rakudo/default.nix new file mode 100644 index 000000000000..1244ad5ecd2e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/rakudo/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, perl, icu, zlib, gmp, readline +, CoreServices, ApplicationServices }: + +stdenv.mkDerivation rec { + name = "rakudo-star-${version}"; + version = "2017.01"; + + src = fetchurl { + url = "http://rakudo.org/downloads/star/${name}.tar.gz"; + sha256 = "07zjqdzxm30pmjqwlnr669d75bsbimy09sk0dvgm0pnn3zr92fjq"; + }; + + buildInputs = [ icu zlib gmp readline perl ] + ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices ApplicationServices ]; + configureScript = "perl ./Configure.pl"; + configureFlags = + [ "--backends=moar" + "--gen-moar" + "--gen-nqp" + ]; + + meta = with stdenv.lib; { + description = "A Perl 6 implementation"; + homepage = https://www.rakudo.org; + license = licenses.artistic2; + platforms = platforms.unix; + maintainers = with maintainers; [ thoughtpolice vrthra ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/rascal/default.nix b/nixpkgs/pkgs/development/interpreters/rascal/default.nix new file mode 100644 index 000000000000..25e125b9af63 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/rascal/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, makeWrapper, jdk }: + +stdenv.mkDerivation rec { + name = "rascal-0.6.2"; + + src = fetchurl { + url = "https://update.rascal-mpl.org/console/${name}.jar"; + sha256 = "1z4mwdbdc3r24haljnxng8znlfg2ihm9bf9zq8apd9a32ipcw4i6"; + }; + + buildInputs = [ makeWrapper jdk ]; + + unpackPhase = "true"; + + installPhase = + '' + mkdir -p $out/bin + makeWrapper ${jdk}/bin/java $out/bin/rascal \ + --add-flags "-jar ${src}" \ + ''; + + meta = { + homepage = https://www.rascal-mpl.org/; + description = "Command-line REPL for the Rascal metaprogramming language"; + license = stdenv.lib.licenses.epl10; + maintainers = [ stdenv.lib.maintainers.eelco ]; + platforms = stdenv.lib.platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/rebol/default.nix b/nixpkgs/pkgs/development/interpreters/rebol/default.nix new file mode 100644 index 000000000000..4d98f18eee4a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/rebol/default.nix @@ -0,0 +1,43 @@ +{ stdenv, fetchFromGitHub, fetchurl, glibc, libX11, libXt, perl }: + +stdenv.mkDerivation rec { + name = "rebol-nightly-${version}"; + version = "3-alpha"; + src = fetchFromGitHub { + rev = "bd45d0de512ff5953e098301c3d610f6024515d6"; + owner = "earl"; + repo = "r3"; + sha256 = "0pirn6936rxi894xxdvj7xdwlwmmxq2wz36jyjnj26667v2n543c"; + }; + + r3 = fetchurl { + url = "http://rebolsource.net/downloads/experimental/r3-linux-x64-gbf237fc"; + sha256 = "0cm86kn4lcbvyy6pqg67x53y0wz353y0vg7pfqv65agxj1ynxnrx"; + name = "r3"; + }; + + buildInputs = [ glibc libX11 libXt perl ]; + + configurePhase = '' + cp ${r3} make/r3-make + chmod 777 make/r3-make + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./make/r3-make + cd make + perl -pi -e 's#-m32##g' makefile + perl -pi -e 's#sudo .*#echo#g' makefile + make prep + ''; + buildPhase = '' + make + mkdir -p $out/bin + cp r3 $out/bin + ''; + + meta = with stdenv.lib; { + description = ''Relative expression based object language, a language where code is data''; + maintainers = with maintainers; [ vrthra ]; + platforms = [ "x86_64-linux" ]; + license = licenses.asl20; + homepage = http://www.rebol.com/; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/red/default.nix b/nixpkgs/pkgs/development/interpreters/red/default.nix new file mode 100644 index 000000000000..56ff02831741 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/red/default.nix @@ -0,0 +1,92 @@ +{ stdenv, stdenv_32bit, pkgsi686Linux, fetchFromGitHub, fetchurl }: + +stdenv.mkDerivation rec { + name = "red-${version}"; + version = "0.6.3"; + src = fetchFromGitHub { + rev = "6a43c767fa2e85d668b83f749158a18e62c30f70"; + owner = "red"; + repo = "red"; + sha256 = "1zh6xc728bs7r4v5jz1jjrdk0xd838xsxmvy9gfg75a3zffm0slr"; + }; + + rebol = fetchurl { + url = "http://www.rebol.com/downloads/v278/rebol-core-278-4-2.tar.gz"; + sha256 = "1c1v0pyhf3d8z98qc93a5zmx0bbl0qq5lr8mbkdgygqsq2bv2xbz"; + }; + + buildInputs = [ pkgsi686Linux.curl stdenv_32bit ]; + + r2 = "./rebol/releases/rebol-core/rebol"; + + configurePhase = '' + # Download rebol + mkdir rebol/ + tar -xzvf ${rebol} -C rebol/ + patchelf --set-interpreter \ + ${stdenv_32bit.cc.libc.out}/lib/32/ld-linux.so.2 \ + ${r2} + ''; + + buildPhase = '' + # Do tests + #${r2} -qw run-all.r + + # Build test + ${r2} -qw red.r tests/hello.red + + # Compiling the Red console... + ${r2} -qw red.r -r environment/console/console.red + + # Generating docs... + cd docs + ../${r2} -qw makedoc2.r red-system-specs.txt + ../${r2} -qw makedoc2.r red-system-quick-test.txt + cd ../ + ''; + + installPhase = '' + mkdir $out + + # Install + install -d $out/opt/red + find quick-test -type f -executable -print0 | xargs -0 rm + cp -R * $out/opt/red/ + rm -rf $out/opt/red/rebol + install -Dm755 console $out/bin/red + install -Dm644 BSD-3-License.txt \ + $out/share/licenses/${name}/BSD-3-License.txt + install -Dm644 BSL-License.txt \ + $out/share/licenses/${name}/BSL-License.txt + install -Dm644 docs/red-system-quick-test.html \ + $out/share/doc/${name}/red-system-quick-test.html + install -Dm644 docs/red-system-specs.html \ + $out/share/doc/${name}/red-system-specs.html + + # PathElf + patchelf --set-interpreter \ + ${stdenv_32bit.cc.libc.out}/lib/32/ld-linux.so.2 \ + $out/opt/red/console + patchelf --set-rpath ${pkgsi686Linux.curl.out}/lib \ + $out/opt/red/console + patchelf --set-interpreter \ + ${stdenv_32bit.cc.libc.out}/lib/32/ld-linux.so.2 \ + $out/bin/red + patchelf --set-rpath ${pkgsi686Linux.curl.out}/lib \ + $out/bin/red + + ''; + + meta = with stdenv.lib; { + description = '' + New programming language strongly inspired by Rebol, but with a + broader field of usage thanks to its native-code compiler, from system + programming to high-level scripting, while providing modern support for + concurrency and multi-core CPUs + ''; + maintainers = with maintainers; [ uralbash ]; + platforms = [ "i686-linux" "x86_64-linux" ]; + license = licenses.bsd3; + homepage = https://www.red-lang.org/; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/regina/default.nix b/nixpkgs/pkgs/development/interpreters/regina/default.nix new file mode 100644 index 000000000000..1d67193a73cf --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/regina/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchurl, ncurses }: + +stdenv.mkDerivation rec { + name = "Regina-REXX-${version}"; + version = "3.9.1"; + + src = fetchurl { + url = "mirror://sourceforge/regina-rexx/regina-rexx/${version}/${name}.tar.gz"; + sha256 = "1vpksnjmg6y5zag9li6sxqxj2xapgalfz8krfxgg49vyk0kdy4sx"; + }; + + buildInputs = [ ncurses ]; + + configureFlags = [ + "--libdir=$(out)/lib" + ]; + + meta = with stdenv.lib; { + description = "REXX interpreter"; + maintainers = [ maintainers.raskin ]; + platforms = platforms.linux; + license = licenses.lgpl2; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/regina/default.upstream b/nixpkgs/pkgs/development/interpreters/regina/default.upstream new file mode 100644 index 000000000000..481d9848f830 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/regina/default.upstream @@ -0,0 +1,5 @@ +url https://sourceforge.net/projects/regina-rexx/files/regina-rexx/ +SF_version_dir +SF_version_tarball +SF_redirect +minimize_overwrite diff --git a/nixpkgs/pkgs/development/interpreters/renpy/default.nix b/nixpkgs/pkgs/development/interpreters/renpy/default.nix new file mode 100644 index 000000000000..947f05809034 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/renpy/default.nix @@ -0,0 +1,62 @@ +{ stdenv, fetchurl, pythonPackages, pkgconfig, SDL2 +, libpng, ffmpeg, freetype, glew, libGLU_combined, fribidi, zlib +, glib +}: + +with pythonPackages; + +stdenv.mkDerivation rec { + name = "renpy-${version}"; + version = "7.1.3"; + + meta = with stdenv.lib; { + description = "Ren'Py Visual Novel Engine"; + homepage = https://renpy.org/; + license = licenses.mit; + platforms = platforms.linux; + }; + + src = fetchurl { + url = "https://www.renpy.org/dl/${version}/renpy-${version}-source.tar.bz2"; + sha256 = "0z6s1vzjb5jh0i79pv5kgynfrzqj1a1f3afrpmp2aaqbrljkidbn"; + }; + + patches = [ + ./launcherenv.patch + ]; + + postPatch = '' + substituteInPlace launcher/game/choose_directory.rpy --replace /usr/bin/python ${python.interpreter} + ''; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + python cython wrapPython tkinter + SDL2 libpng ffmpeg freetype glew libGLU_combined fribidi zlib pygame_sdl2 glib + ]; + + pythonPath = [ pygame_sdl2 tkinter ]; + + RENPY_DEPS_INSTALL = stdenv.lib.concatStringsSep "::" (map (path: "${path}") [ + SDL2 SDL2.dev libpng ffmpeg ffmpeg.out freetype glew.dev glew.out libGLU_combined fribidi zlib + ]); + + buildPhase = '' + python module/setup.py build + ''; + + installPhase = '' + mkdir -p $out/share/renpy + cp -vr * $out/share/renpy + rm -rf $out/share/renpy/module + + python module/setup.py install --prefix=$out --install-lib=$out/share/renpy/module + + makeWrapper ${python}/bin/python $out/bin/renpy \ + --set PYTHONPATH $PYTHONPATH \ + --set RENPY_BASE $out/share/renpy \ + --add-flags "-O $out/share/renpy/renpy.py" + ''; + + NIX_CFLAGS_COMPILE = "-I${pygame_sdl2}/include/${python.libPrefix}"; +} diff --git a/nixpkgs/pkgs/development/interpreters/renpy/launcherenv.patch b/nixpkgs/pkgs/development/interpreters/renpy/launcherenv.patch new file mode 100644 index 000000000000..85a6c6439b9c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/renpy/launcherenv.patch @@ -0,0 +1,14 @@ +# The launcher game starts projects in a separate python process +# with the -E flag, which prevents the nix set PYTHONPATH envvar +# from taking effect, preventing the loading of pygame_sdl2 +--- a/launcher/game/project.rpy ++++ b/launcher/game/project.rpy +@@ -239,7 +239,7 @@ + raise Exception("Python interpreter not found: %r", executables) + + # Put together the basic command line. +- cmd = [ executable, "-EO", sys.argv[0] ] ++ cmd = [ executable, "-O", sys.argv[0] ] + + cmd.append(self.path) + cmd.extend(args) diff --git a/nixpkgs/pkgs/development/interpreters/ruby/bitperfect-rdoc.patch b/nixpkgs/pkgs/development/interpreters/ruby/bitperfect-rdoc.patch new file mode 100644 index 000000000000..d5fb9e4554fa --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/bitperfect-rdoc.patch @@ -0,0 +1,13 @@ +diff -r -u orig/lib/rdoc/generator/template/darkfish/filepage.rhtml new/lib/rdoc/generator/template/darkfish/filepage.rhtml +--- orig/lib/rdoc/generator/template/darkfish/filepage.rhtml ++++ new/lib/rdoc/generator/template/darkfish/filepage.rhtml +@@ -88,9 +88,6 @@ + <body class="file file-popup"> + <div id="metadata"> + <dl> +- <dt class="modified-date">Last Modified</dt> +- <dd class="modified-date"><%= file.last_modified %></dd> +- + <% if file.requires %> + <dt class="requires">Requires</dt> + <dd class="requires"> diff --git a/nixpkgs/pkgs/development/interpreters/ruby/config.nix b/nixpkgs/pkgs/development/interpreters/ruby/config.nix new file mode 100644 index 000000000000..c4f3160d1602 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/config.nix @@ -0,0 +1,8 @@ +# Ruby >= 2.1.0 tries to download config.{guess,sub} +{ fetchFromSavannah }: + +fetchFromSavannah { + repo = "config"; + rev = "576c839acca0e082e536fd27568b90a446ce5b96"; + sha256 = "11bjngchjhj0qq0ppp8c37rfw0yhp230nvhs2jvlx15i9qbf56a0"; +} diff --git a/nixpkgs/pkgs/development/interpreters/ruby/default.nix b/nixpkgs/pkgs/development/interpreters/ruby/default.nix new file mode 100644 index 000000000000..3408a4c2a648 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/default.nix @@ -0,0 +1,278 @@ +{ stdenv, buildPackages, lib +, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub +, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison +, autoconf, libiconv, libobjc, libunwind, Foundation +, buildEnv, bundler, bundix +} @ args: + +let + op = lib.optional; + ops = lib.optionals; + opString = lib.optionalString; + patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; }; + config = import ./config.nix { inherit fetchFromSavannah; }; + rubygemsSrc = import ./rubygems-src.nix { inherit fetchurl; }; + rubygemsPatch = fetchpatch { + url = "https://github.com/zimbatm/rubygems/compare/v2.6.6...v2.6.6-nix.patch"; + sha256 = "0297rdb1m6v75q8665ry9id1s74p9305dv32l95ssf198liaihhd"; + }; + unpackdir = obj: + lib.removeSuffix ".tgz" + (lib.removeSuffix ".tar.gz" obj.name); + + # Contains the ruby version heuristics + rubyVersion = import ./ruby-version.nix { inherit lib; }; + + # Needed during postInstall + buildRuby = + if stdenv.hostPlatform == stdenv.buildPlatform + then "$out/bin/ruby" + else "${buildPackages.ruby}/bin/ruby"; + + generic = { version, sha256 }: let + ver = version; + tag = ver.gitTag; + isRuby20 = ver.majMin == "2.0"; + isRuby21 = ver.majMin == "2.1"; + atLeast25 = lib.versionAtLeast ver.majMin "2.5"; + baseruby = self.override { useRailsExpress = false; }; + self = lib.makeOverridable ( + { stdenv, buildPackages, lib + , fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub + , useRailsExpress ? true + , zlib, zlibSupport ? true + , openssl, opensslSupport ? true + , gdbm, gdbmSupport ? true + , ncurses, readline, cursesSupport ? true + , groff, docSupport ? false + , libyaml, yamlSupport ? true + , libffi, fiddleSupport ? true + , autoreconfHook, bison, autoconf + , buildEnv, bundler, bundix + , libiconv, libobjc, libunwind, Foundation + }: + let rubySrc = + if useRailsExpress then fetchFromGitHub { + owner = "ruby"; + repo = "ruby"; + rev = tag; + sha256 = sha256.git; + } else fetchurl { + url = "https://cache.ruby-lang.org/pub/ruby/${ver.majMin}/ruby-${ver}.tar.gz"; + sha256 = sha256.src; + }; + in + stdenv.mkDerivation rec { + name = "ruby-${version}"; + + srcs = [ rubySrc rubygemsSrc ]; + sourceRoot = + if useRailsExpress then + rubySrc.name + else + unpackdir rubySrc; + + # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds. + NROFF = if docSupport then "${groff}/bin/nroff" else null; + + nativeBuildInputs = + ops useRailsExpress [ autoreconfHook bison ] + ++ ops (stdenv.buildPlatform != stdenv.hostPlatform) [ + buildPackages.ruby + ]; + buildInputs = + (op fiddleSupport libffi) + ++ (ops cursesSupport [ ncurses readline ]) + ++ (op docSupport groff) + ++ (op zlibSupport zlib) + ++ (op opensslSupport openssl) + ++ (op gdbmSupport gdbm) + ++ (op yamlSupport libyaml) + ++ (op atLeast25 autoconf) + # Looks like ruby fails to build on darwin without readline even if curses + # support is not enabled, so add readline to the build inputs if curses + # support is disabled (if it's enabled, we already have it) and we're + # running on darwin + ++ op (!cursesSupport && stdenv.isDarwin) readline + ++ ops stdenv.isDarwin [ libiconv libobjc libunwind Foundation ]; + + enableParallelBuilding = true; + + hardeningDisable = lib.optional isRuby20 "format"; + + patches = + (import ./patchsets.nix { + inherit patchSet useRailsExpress ops; + patchLevel = ver.patchLevel; + })."${ver.majMinTiny}"; + + postUnpack = '' + cp -r ${unpackdir rubygemsSrc} ${sourceRoot}/rubygems + pushd ${sourceRoot}/rubygems + patch -p1 < ${rubygemsPatch} + popd + '' + opString isRuby21 '' + rm "$sourceRoot/enc/unicode/name2ctype.h" + ''; + + postPatch = if isRuby21 then '' + rm tool/config_files.rb + cp ${config}/config.guess tool/ + cp ${config}/config.sub tool/ + '' + else if atLeast25 then '' + sed -i configure.ac -e '/config.guess/d' + cp --remove-destination ${config}/config.guess tool/ + cp --remove-destination ${config}/config.sub tool/ + '' + else opString useRailsExpress '' + sed -i configure.in -e '/config.guess/d' + cp ${config}/config.guess tool/ + cp ${config}/config.sub tool/ + ''; + + configureFlags = ["--enable-shared" "--enable-pthread"] + ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby" + ++ op (!docSupport) "--disable-install-doc" + ++ ops stdenv.isDarwin [ + # on darwin, we have /usr/include/tk.h -- so the configure script detects + # that tk is installed + "--with-out-ext=tk" + # on yosemite, "generating encdb.h" will hang for a very long time without this flag + "--with-setjmp-type=setjmp" + ] + ++ op (stdenv.hostPlatform != stdenv.buildPlatform) + "--with-baseruby=${buildRuby}"; + + # fails with "16993 tests, 2229489 assertions, 105 failures, 14 errors, 89 skips" + # mostly TZ- and patch-related tests + # TZ- failures are caused by nix sandboxing, I didn't investigate others + doCheck = false; + + preInstall = '' + # Ruby installs gems here itself now. + mkdir -pv "$out/${passthru.gemPath}" + export GEM_HOME="$out/${passthru.gemPath}" + ''; + + installFlags = stdenv.lib.optionalString docSupport "install-doc"; + # Bundler tries to create this directory + postInstall = '' + # Update rubygems + pushd rubygems + ${buildRuby} setup.rb + popd + + # Remove unnecessary groff reference from runtime closure, since it's big + sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb + + # Bundler tries to create this directory + mkdir -p $out/nix-support + cat > $out/nix-support/setup-hook <<EOF + addGemPath() { + addToSearchPath GEM_PATH \$1/${passthru.gemPath} + } + + addEnvHooks "$hostOffset" addGemPath + EOF + '' + opString useRailsExpress '' + rbConfig=$(find $out/lib/ruby -name rbconfig.rb) + + # Prevent the baseruby from being included in the closure. + sed -i '/^ CONFIG\["BASERUBY"\]/d' $rbConfig + sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig + ''; + + meta = with stdenv.lib; { + description = "The Ruby language"; + homepage = http://www.ruby-lang.org/en/; + license = licenses.ruby; + maintainers = with maintainers; [ vrthra manveru ]; + platforms = platforms.all; + }; + + passthru = rec { + version = ver; + rubyEngine = "ruby"; + baseRuby = baseruby; + libPath = "lib/${rubyEngine}/${ver.libDir}"; + gemPath = "lib/${rubyEngine}/gems/${ver.libDir}"; + devEnv = import ./dev.nix { + inherit buildEnv bundler bundix; + ruby = self; + }; + + # deprecated 2016-09-21 + majorVersion = ver.major; + minorVersion = ver.minor; + teenyVersion = ver.tiny; + patchLevel = ver.patchLevel; + }; + } + ) args; in self; + +in { + ruby_1_9 = generic { + version = rubyVersion "1" "9" "3" "p551"; + sha256 = { + src = "1s2ibg3s2iflzdv7rfxi1qqkvdbn2dq8gxdn0nxrb77ls5ffanxv"; + git = "1r9xzzxmci2ajb34qb4y1w424mz878zdgzxkfp9w60agldxnb36s"; + }; + }; + + ruby_2_0 = generic { + version = rubyVersion "2" "0" "0" "p648"; + sha256 = { + src = "1y3n4c6xw2wki7pyjpq5zpbgxnw5i3jc8mcpj6rk7hs995mvv446"; + git = "0ncjfq4hfqj9kcr8pbll6kypwnmcgs8w7l4466qqfyv7jj3yjd76"; + }; + }; + + ruby_2_1 = generic { + version = rubyVersion "2" "1" "10" ""; + sha256 = { + src = "086x66w51lg41abjn79xb7f6xsryymkcc3nvakmkjnjyg96labpv"; + git = "133phd5r5y0np5lc9nqif93l7yb13yd52aspyl6c46z5jhvhyvfi"; + }; + }; + + ruby_2_2 = generic { + version = rubyVersion "2" "2" "9" ""; + sha256 = { + src = "19m1ximl7vcrsvq595dgrjh4yb6kar944095wbywqh7waiqcfirg"; + git = "03qrjh55098wcqh2khxryzkzfqkznjrcdgwf27r2bgcycbg5ca5q"; + }; + }; + + ruby_2_3 = generic { + version = rubyVersion "2" "3" "8" ""; + sha256 = { + src = "1gwsqmrhpx1wanrfvrsj3j76rv888zh7jag2si2r14qf8ihns0dm"; + git = "0158fg1sx6l6applbq0831kl8kzx5jacfl9lfg0shfzicmjlys3f"; + }; + }; + + ruby_2_4 = generic { + version = rubyVersion "2" "4" "5" ""; + sha256 = { + src = "162izk7c72y73vmdgcbsh8kqihrbm65xvp53r1s139pzwqd78dv7"; + git = "181za4h6bd2bkyzyknxc18i5gq0pnqag60ybc17p0ixw3q7pdj43"; + }; + }; + + ruby_2_5 = generic { + version = rubyVersion "2" "5" "3" ""; + sha256 = { + src = "0v4442aqqlzxwc792kbkfs2k61qg97r680is6gx20z63a8wd0a4q"; + git = "0r9mgvqk6gj8pc9q6qmy7j2kbln7drc8wy67sb2ij8ciclcw9nn2"; + }; + }; + + ruby_2_6 = generic { + version = rubyVersion "2" "6" "0" ""; + sha256 = { + src = "0wn0gxlx6xhhqrm2caxp0h6cj4nw7knnv5gh27qqzj0i9a95phzk"; + git = "0bwbl4hz18dd5aij2l4s6xy90dc17d03kk577gdl34l9mbd9m7mn"; + }; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/ruby/dev.nix b/nixpkgs/pkgs/development/interpreters/ruby/dev.nix new file mode 100644 index 000000000000..62d561fbc142 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/dev.nix @@ -0,0 +1,23 @@ +/* An environment for development that bundles ruby, bundler and bundix + together. This avoids version conflicts where each is using a diferent + version of each-other. +*/ +{ buildEnv, ruby, bundler, bundix }: +let + bundler_ = bundler.override { + ruby = ruby; + }; + bundix_ = bundix.override { + bundler = bundler_; + }; +in +buildEnv { + name = "${ruby.rubyEngine}-dev-${ruby.version}"; + paths = [ + bundix_ + bundler_ + ruby + ]; + pathsToLink = [ "/bin" ]; + ignoreCollisions = true; +} diff --git a/nixpkgs/pkgs/development/interpreters/ruby/patchsets.nix b/nixpkgs/pkgs/development/interpreters/ruby/patchsets.nix new file mode 100644 index 000000000000..4dc25834314b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/patchsets.nix @@ -0,0 +1,75 @@ +{ patchSet, useRailsExpress, ops, patchLevel }: + +rec { + "1.9.3" = [ + ./ssl_v3.patch + ./rand-egd.patch + ./ruby19-parallel-install.patch + ./bitperfect-rdoc.patch + ] ++ ops useRailsExpress [ + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/01-fix-make-clean.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/02-zero-broken-tests.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/03-railsbench-gc.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/04-display-more-detailed-stack-trace.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/05-fork-support-for-gc-logging.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/06-track-live-dataset-size.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/07-webrick_204_304_keep_alive_fix.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/08-export-a-few-more-symbols-for-ruby-prof.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/09-thread-variables.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/10-faster-loading.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/11-falcon-st-opt.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/12-falcon-sparse-array.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/13-falcon-array-queue.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/14-railsbench-gc-fixes.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/15-show-full-backtrace-on-stack-overflow.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/16-configurable-fiber-stack-sizes.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/17-backport-psych-20.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/18-fix-missing-c-return-event.patch" + "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/19-fix-process-daemon-call.patch" + ]; + "2.0.0" = [ + ./ssl_v3.patch + ./rand-egd.patch + ] ++ ops useRailsExpress [ + "${patchSet}/patches/ruby/2.0.0/p${patchLevel}/railsexpress/01-zero-broken-tests.patch" + "${patchSet}/patches/ruby/2.0.0/p${patchLevel}/railsexpress/02-railsexpress-gc.patch" + "${patchSet}/patches/ruby/2.0.0/p${patchLevel}/railsexpress/03-display-more-detailed-stack-trace.patch" + "${patchSet}/patches/ruby/2.0.0/p${patchLevel}/railsexpress/04-show-full-backtrace-on-stack-overflow.patch" + ]; + "2.1.10" = [ + ./rand-egd.patch + ] ++ ops useRailsExpress [ + # 2.1.10 patchsets are not available, but 2.1.8 patchsets apply + "${patchSet}/patches/ruby/2.1.8/railsexpress/01-zero-broken-tests.patch" + "${patchSet}/patches/ruby/2.1.8/railsexpress/02-improve-gc-stats.patch" + "${patchSet}/patches/ruby/2.1.8/railsexpress/03-display-more-detailed-stack-trace.patch" + "${patchSet}/patches/ruby/2.1.8/railsexpress/04-show-full-backtrace-on-stack-overflow.patch" + "${patchSet}/patches/ruby/2.1.8/railsexpress/05-funny-falcon-stc-density.patch" + "${patchSet}/patches/ruby/2.1.8/railsexpress/06-funny-falcon-stc-pool-allocation.patch" + "${patchSet}/patches/ruby/2.1.8/railsexpress/07-aman-opt-aset-aref-str.patch" + "${patchSet}/patches/ruby/2.1.8/railsexpress/08-funny-falcon-method-cache.patch" + "${patchSet}/patches/ruby/2.1.8/railsexpress/09-heap-dump-support.patch" + ]; + "2.2.9" = ops useRailsExpress [ + "${patchSet}/patches/ruby/2.2/head/railsexpress/01-zero-broken-tests.patch" + "${patchSet}/patches/ruby/2.2/head/railsexpress/02-improve-gc-stats.patch" + "${patchSet}/patches/ruby/2.2/head/railsexpress/03-display-more-detailed-stack-trace.patch" + ]; + "2.3.8" = ops useRailsExpress [ + "${patchSet}/patches/ruby/2.3/head/railsexpress/01-skip-broken-tests.patch" + "${patchSet}/patches/ruby/2.3/head/railsexpress/02-improve-gc-stats.patch" + "${patchSet}/patches/ruby/2.3/head/railsexpress/03-display-more-detailed-stack-trace.patch" + ]; + "2.4.5" = ops useRailsExpress [ + "${patchSet}/patches/ruby/2.4/head/railsexpress/01-skip-broken-tests.patch" + "${patchSet}/patches/ruby/2.4/head/railsexpress/02-improve-gc-stats.patch" + "${patchSet}/patches/ruby/2.4/head/railsexpress/03-display-more-detailed-stack-trace.patch" + ]; + "2.5.3" = ops useRailsExpress [ + "${patchSet}/patches/ruby/2.5/head/railsexpress/01-fix-broken-tests-caused-by-ad.patch" + "${patchSet}/patches/ruby/2.5/head/railsexpress/02-improve-gc-stats.patch" + "${patchSet}/patches/ruby/2.5/head/railsexpress/03-more-detailed-stacktrace.patch" + ]; + "2.6.0" = ops useRailsExpress [ # no Rails Express patchset yet (2018-12-26) + ]; +} diff --git a/nixpkgs/pkgs/development/interpreters/ruby/rand-egd.patch b/nixpkgs/pkgs/development/interpreters/ruby/rand-egd.patch new file mode 100644 index 000000000000..e4f6452000c2 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/rand-egd.patch @@ -0,0 +1,42 @@ +diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb +index e272cba..3a1fa71 100644 +--- a/ext/openssl/extconf.rb ++++ b/ext/openssl/extconf.rb +@@ -87,6 +87,7 @@ + have_func("PEM_def_callback") + have_func("PKCS5_PBKDF2_HMAC") + have_func("PKCS5_PBKDF2_HMAC_SHA1") ++have_func("RAND_egd") + have_func("X509V3_set_nconf") + have_func("X509V3_EXT_nconf_nid") + have_func("X509_CRL_add0_revoked") +diff --git a/ext/openssl/ossl_rand.c b/ext/openssl/ossl_rand.c +index 29cbf8c..27466fe 100644 +--- a/ext/openssl/ossl_rand.c ++++ b/ext/openssl/ossl_rand.c +@@ -148,6 +148,7 @@ ossl_rand_pseudo_bytes(VALUE self, VALUE len) + return str; + } + ++#ifdef HAVE_RAND_EGD + /* + * call-seq: + * egd(filename) -> true +@@ -186,6 +187,7 @@ ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len) + } + return Qtrue; + } ++#endif /* HAVE_RAND_EGD */ + + /* + * call-seq: +@@ -219,7 +221,9 @@ Init_ossl_rand(void) + DEFMETH(mRandom, "write_random_file", ossl_rand_write_file, 1); + DEFMETH(mRandom, "random_bytes", ossl_rand_bytes, 1); + DEFMETH(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1); ++#ifdef HAVE_RAND_EGD + DEFMETH(mRandom, "egd", ossl_rand_egd, 1); + DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2); ++#endif /* HAVE_RAND_EGD */ + DEFMETH(mRandom, "status?", ossl_rand_status, 0) + } diff --git a/nixpkgs/pkgs/development/interpreters/ruby/ruby-version.nix b/nixpkgs/pkgs/development/interpreters/ruby/ruby-version.nix new file mode 100644 index 000000000000..b1cbbfc216dc --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/ruby-version.nix @@ -0,0 +1,63 @@ +# Contains the ruby version heuristics +{ lib }: +with lib; +let + # The returned set should be immutable + rubyVersion = major: minor: tiny: tail: + rec { + inherit major minor tiny tail; + + # Contains the patch number "223" if tail is "p223" or null + patchLevel = + let + p = removePrefix "p" tail; + isPosInt = num: + 0 == stringLength + (replaceStrings + ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"] + ["" "" "" "" "" "" "" "" "" "" ] + num); + in + if hasPrefix "p" tail && isPosInt p then p + else null; + + # Shortcuts + majMin = "${major}.${minor}"; + majMinTiny = "${major}.${minor}.${tiny}"; + + # Ruby separates lib and gem folders by ABI version which isn't very + # consistent. + libDir = + if versionAtLeast majMinTiny "2.1.0" then + "${majMin}.0" + else if versionAtLeast majMinTiny "2.0.0" then + "2.0.0" + else if versionAtLeast majMinTiny "1.9.1" then + "1.9.1" + else + throw "version ${majMinTiny} is not supported"; + + # How ruby releases are tagged on github.com/ruby/ruby + gitTag = + let + base = "v${major}_${minor}_${tiny}"; + in + if patchLevel != null then + "${base}_${patchLevel}" + else + if tail != "" then + "${base}_${tail}" + else + base; + + # Implements the builtins.toString interface. + __toString = self: + self.majMinTiny + ( + if self.patchLevel != null then + "-p${self.patchLevel}" + else if self.tail != "" then + "-${self.tail}" + else ""); + }; +in + rubyVersion diff --git a/nixpkgs/pkgs/development/interpreters/ruby/ruby19-parallel-install.patch b/nixpkgs/pkgs/development/interpreters/ruby/ruby19-parallel-install.patch new file mode 100644 index 000000000000..bb8063508732 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/ruby19-parallel-install.patch @@ -0,0 +1,15 @@ +Index: ruby-1.9.3-p392/lib/mkmf.rb +=================================================================== +--- ruby-1.9.3-p392.orig/lib/mkmf.rb ++++ ruby-1.9.3-p392/lib/mkmf.rb +@@ -2039,8 +2039,8 @@ static: $(STATIC_LIB)#{$extout ? " insta + end + for f in files + dest = "#{dir}/#{File.basename(f)}" +- mfile.print("install-rb#{sfx}: #{dest} #{dir}\n") +- mfile.print("#{dest}: #{f}\n") ++ mfile.print("install-rb#{sfx}: #{dest}\n") ++ mfile.print("#{dest}: #{f} #{timestamp_file(dir)}\n") + mfile.print("\t$(Q) $(#{$extout ? 'COPY' : 'INSTALL_DATA'}) #{f} $(@D#{sep})\n") + if defined?($installed_list) and !$extout + mfile.print("\t@echo #{dest}>>$(INSTALLED_LIST)\n") diff --git a/nixpkgs/pkgs/development/interpreters/ruby/rubygems-src.nix b/nixpkgs/pkgs/development/interpreters/ruby/rubygems-src.nix new file mode 100644 index 000000000000..4e5793f11139 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/rubygems-src.nix @@ -0,0 +1,8 @@ +{ fetchurl +, version ? "2.7.7" +, sha256 ? "1jsmmd31j8j066b83lin4bbqz19jhrirarzb41f3sjhfdjiwkcjc" +}: +fetchurl { + url = "https://rubygems.org/rubygems/rubygems-${version}.tgz"; + sha256 = sha256; +} diff --git a/nixpkgs/pkgs/development/interpreters/ruby/rvm-patchsets.nix b/nixpkgs/pkgs/development/interpreters/ruby/rvm-patchsets.nix new file mode 100644 index 000000000000..1598cbc56e1d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/rvm-patchsets.nix @@ -0,0 +1,8 @@ +{ fetchFromGitHub }: + +fetchFromGitHub { + owner = "skaes"; + repo = "rvm-patchsets"; + rev = "ba5a3c6f972e1b957b4b3fe28b5730ef0e27bff3"; + sha256 = "0sjmhhb8hshxa58x062j44w0xdck8ykgpsg33wjr0wv9npwpkwrz"; +} diff --git a/nixpkgs/pkgs/development/interpreters/ruby/ssl_v3.patch b/nixpkgs/pkgs/development/interpreters/ruby/ssl_v3.patch new file mode 100644 index 000000000000..faa402165751 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/ssl_v3.patch @@ -0,0 +1,16 @@ +--- a/ext/openssl/ossl_ssl.c 2015-11-26 16:41:03.775058140 +0000 ++++ b/ext/openssl/ossl_ssl.c 2015-11-26 16:40:56.191907346 +0000 +@@ -138,9 +138,12 @@ + OSSL_SSL_METHOD_ENTRY(SSLv2_server), + OSSL_SSL_METHOD_ENTRY(SSLv2_client), + #endif ++#if defined(HAVE_SSLV3_METHOD) && defined(HAVE_SSLV3_SERVER_METHOD) && \ ++ defined(HAVE_SSLV3_CLIENT_METHOD) + OSSL_SSL_METHOD_ENTRY(SSLv3), + OSSL_SSL_METHOD_ENTRY(SSLv3_server), + OSSL_SSL_METHOD_ENTRY(SSLv3_client), ++#endif + OSSL_SSL_METHOD_ENTRY(SSLv23), + OSSL_SSL_METHOD_ENTRY(SSLv23_server), + OSSL_SSL_METHOD_ENTRY(SSLv23_client), + diff --git a/nixpkgs/pkgs/development/interpreters/scheme48/default.nix b/nixpkgs/pkgs/development/interpreters/scheme48/default.nix new file mode 100644 index 000000000000..e01aef98303c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/scheme48/default.nix @@ -0,0 +1,18 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation { + name = "scheme48-1.9.2"; + + meta = { + homepage = http://s48.org/; + description = "Scheme 48"; + maintainers = with stdenv.lib.maintainers; [ the-kenny ]; + platforms = with stdenv.lib.platforms; unix; + license = stdenv.lib.licenses.bsd3; + }; + + src = fetchurl { + url = http://s48.org/1.9.2/scheme48-1.9.2.tgz; + sha256 = "1x4xfm3lyz2piqcw1h01vbs1iq89zq7wrsfjgh3fxnlm1slj2jcw"; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/scsh/default.nix b/nixpkgs/pkgs/development/interpreters/scsh/default.nix new file mode 100644 index 000000000000..85c9434f0813 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/scsh/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchgit, autoreconfHook, scheme48 }: + +stdenv.mkDerivation { + name = "scsh-0.7pre"; + + src = fetchgit { + url = "git://github.com/scheme/scsh.git"; + rev = "f99b8c5293628cfeaeb792019072e3a96841104f"; + fetchSubmodules = true; + sha256 = "0ci2h9hhv8pl12sdyl2qwal3dhmd7zgm1pjnmd4kg8r1hnm6vidx"; + }; + + nativeBuildInputs = [ autoreconfHook ]; + buildInputs = [ scheme48 ]; + configureFlags = [ "--with-scheme48=${scheme48}" ]; + + meta = with stdenv.lib; { + description = "A Scheme shell"; + homepage = http://www.scsh.net/; + license = licenses.bsd3; + maintainers = with maintainers; [ joachifm ]; + platforms = with platforms; unix; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/self/default.nix b/nixpkgs/pkgs/development/interpreters/self/default.nix new file mode 100644 index 000000000000..594bbc05b7ce --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/self/default.nix @@ -0,0 +1,44 @@ +{ fetchgit, stdenv, xorg, makeWrapper, ncurses, cmake }: + +stdenv.mkDerivation rec { + # The Self wrapper stores source in $XDG_DATA_HOME/self or ~/.local/share/self + # so that it can be written to when using the Self transposer. Running 'Self' + # after installation runs without an image. You can then build a Self image with: + # $ cd ~/.local/share/self/objects + # $ Self + # > 'worldBuilder.self' _RunScript + # + # This image can later be started with: + # $ Self -s myimage.snap + # + version = "4.5.0"; + name = "self-${version}"; + + src = fetchgit { + url = "https://github.com/russellallen/self"; + rev = "d16bcaad3c5092dae81ad0b16d503f2a53b8ef86"; + sha256 = "1dhs6209407j0ll9w9id31vbawdrm9nz1cjak8g8hixrw1nid4i5"; + }; + + buildInputs = [ ncurses xorg.libX11 xorg.libXext makeWrapper cmake ]; + + selfWrapper = ./self; + + installPhase = '' + mkdir -p "$out"/bin + cp ./vm/Self "$out"/bin/Self.wrapped + mkdir -p "$out"/share/self + cp -r ../objects "$out"/share/self/ + makeWrapper $selfWrapper $out/bin/Self \ + --set SELF_ROOT "$out" + ''; + + meta = { + description = "A prototype-based dynamic object-oriented programming language, environment, and virtual machine"; + homepage = http://selflanguage.org/; + license = stdenv.lib.licenses.bsd3; + maintainers = [ stdenv.lib.maintainers.doublec ]; + platforms = with stdenv.lib.platforms; linux; + broken = true; # segfaults on gcc > 4.4 + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/self/self b/nixpkgs/pkgs/development/interpreters/self/self new file mode 100755 index 000000000000..d504682086b0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/self/self @@ -0,0 +1,18 @@ +#! /usr/bin/env bash + +export SELF_HOME="$HOME/.local/share/self" +if [ -n "$XDG_DATA_HOME" ] + then export SELF_HOME="$XDG_DATA_HOME/self" +fi + +if [ ! -d $SELF_HOME ]; then + mkdir -p $SELF_HOME +fi + +if [ ! -d $SELF_HOME/objects ]; then + mkdir -p $SELF_HOME/objects + cp -r $SELF_ROOT/share/self/objects/* $SELF_HOME/objects + chmod -R +w $SELF_HOME/objects +fi + +exec $SELF_ROOT/bin/Self.wrapped "$@" diff --git a/nixpkgs/pkgs/development/interpreters/spidermonkey/1.8.5-arm-flags.patch b/nixpkgs/pkgs/development/interpreters/spidermonkey/1.8.5-arm-flags.patch new file mode 100644 index 000000000000..721aff154e37 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/1.8.5-arm-flags.patch @@ -0,0 +1,342 @@ +From: Mike Hommey <mh@glandium.org> +Date: Wed, 27 Apr 2011 08:58:01 +0200 +Subject: Bug 626035 - Modify the way arm compiler flags are set in configure + +--- + configure.in | 292 ++++++++++++++++++++++++++++++++------------------- + js/src/configure.in | 284 ++++++++++++++++++++++++++++++++----------------- + 2 files changed, 372 insertions(+), 204 deletions(-) + +Index: mozjs-1.8.5-1.0.0+dfsg/js/src/configure.in +=================================================================== +--- mozjs-1.8.5-1.0.0+dfsg.orig/js/src/configure.in 2012-01-21 15:57:37.507703219 +0100 ++++ mozjs-1.8.5-1.0.0+dfsg/js/src/configure.in 2012-01-21 15:58:04.951703302 +0100 +@@ -3535,34 +3535,6 @@ + AC_CHECK_LIB(socket, socket) + esac + +-AC_MSG_CHECKING(for ARM SIMD support in compiler) +-AC_TRY_COMPILE([], +- [asm("uqadd8 r1, r1, r2");], +- result="yes", result="no") +-AC_MSG_RESULT("$result") +-if test "$result" = "yes"; then +- AC_DEFINE(HAVE_ARM_SIMD) +- HAVE_ARM_SIMD=1 +-fi +-AC_SUBST(HAVE_ARM_SIMD) +- +-AC_MSG_CHECKING(for ARM NEON support in compiler) +-_SAVE_CFLAGS="$CFLAGS" +-if test "$GNU_CC"; then +- # gcc needs -mfpu=neon to recognize NEON instructions +- CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp" +-fi +-AC_TRY_COMPILE([], +- [asm("vadd.i8 d0, d0, d0");], +- result="yes", result="no") +-AC_MSG_RESULT("$result") +-if test "$result" = "yes"; then +- AC_DEFINE(HAVE_ARM_NEON) +- HAVE_ARM_NEON=1 +-fi +-CFLAGS="$_SAVE_CFLAGS" +-AC_SUBST(HAVE_ARM_NEON) +- + dnl ======================================================== + dnl = pthread support + dnl = Start by checking whether the system support pthreads +@@ -4614,13 +4586,11 @@ + BUILD_STATIC_LIBS= + ENABLE_TESTS=1 + +-MOZ_THUMB2= + USE_ARM_KUSER= + + case "${target}" in + arm-android-eabi) + USE_ARM_KUSER=1 +- MOZ_THUMB2=1 + ;; + esac + +@@ -4666,80 +4636,204 @@ + dnl ======================================================== + MOZ_ARG_HEADER(Individual module options) + +-dnl Setup default CPU arch for arm target +-case "$target_cpu" in +- arm*) +- MOZ_ARM_ARCH=armv7 +- ;; +-esac + dnl ======================================================== +-dnl = Enable building the Thumb2 instruction set ++dnl = ARM toolchain tweaks + dnl ======================================================== +-MOZ_ARG_ENABLE_BOOL(thumb2, +- [ --enable-thumb2 Enable Thumb2 instruction set (implies ARMv7)], +- MOZ_THUMB2=1, +- MOZ_THUMB2=) +-if test -n "$MOZ_THUMB2"; then +- MOZ_ARM_ARCH=armv7 ++ ++dnl Defaults ++case "${target}" in ++arm-android-eabi) ++ MOZ_THUMB=yes ++ MOZ_ARCH=armv7-a ++ MOZ_FPU=vfp ++ MOZ_FLOAT_ABI=softfp ++ ;; ++arm*-*) ++ if test -n "$MOZ_PLATFORM_MAEMO"; then ++ MOZ_THUMB=no ++ MOZ_ARCH=armv7-a ++ MOZ_FLOAT_ABI=softfp ++ fi ++ if test "$MOZ_PLATFORM_MAEMO" = 6; then ++ MOZ_THUMB=yes ++ fi ++ ;; ++esac ++ ++dnl Kept for compatibility with some buildbot mozconfig ++MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes) ++ ++MOZ_ARG_WITH_STRING(thumb, ++[ --with-thumb[[=yes|no|toolchain]]] ++[ Use Thumb instruction set (-mthumb)], ++ if test -z "$GNU_CC"; then ++ AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchains]) ++ fi ++ MOZ_THUMB=$withval) ++ ++MOZ_ARG_WITH_STRING(thumb-interwork, ++[ --with-thumb-interwork[[=yes|no|toolchain]] ++ Use Thumb/ARM instuctions interwork (-mthumb-interwork)], ++ if test -z "$GNU_CC"; then ++ AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchains]) ++ fi ++ MOZ_THUMB_INTERWORK=$withval) ++ ++MOZ_ARG_WITH_STRING(arch, ++[ --with-arch=[[type|toolchain]] ++ Use specific CPU features (-march=type)], ++ if test -z "$GNU_CC"; then ++ AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchains]) ++ fi ++ MOZ_ARCH=$withval) ++ ++MOZ_ARG_WITH_STRING(fpu, ++[ --with-fpu=[[type|toolchain]] ++ Use specific FPU type (-mfpu=type)], ++ if test -z "$GNU_CC"; then ++ AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchains]) ++ fi ++ MOZ_FPU=$withval) ++ ++MOZ_ARG_WITH_STRING(float-abi, ++[ --with-float-abi=[[type|toolchain]] ++ Use specific arm float ABI (-mfloat-abi=type)], ++ if test -z "$GNU_CC"; then ++ AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchains]) ++ fi ++ MOZ_FLOAT_ABI=$withval) ++ ++MOZ_ARG_WITH_STRING(soft-float, ++[ --with-soft-float[[=yes|no|toolchain]] ++ Use soft float library (-msoft-float)], ++ if test -z "$GNU_CC"; then ++ AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchains]) ++ fi ++ MOZ_SOFT_FLOAT=$withval) ++ ++case "$MOZ_ARCH" in ++toolchain|"") ++ arch_flag="" ++ ;; ++*) ++ arch_flag="-march=$MOZ_ARCH" ++ ;; ++esac ++ ++case "$MOZ_THUMB" in ++yes) ++ MOZ_THUMB2=1 ++ thumb_flag="-mthumb" ++ ;; ++no) ++ MOZ_THUMB2= ++ thumb_flag="-marm" ++ ;; ++*) ++ _SAVE_CFLAGS="$CFLAGS" ++ CFLAGS="$arch_flag" ++ AC_TRY_COMPILE([],[return sizeof(__thumb2__);], ++ MOZ_THUMB2=1, ++ MOZ_THUMB2=) ++ CFLAGS="$_SAVE_CFLAGS" ++ thumb_flag="" ++ ;; ++esac ++ ++if test "$MOZ_THUMB2" = 1; then ++ AC_DEFINE(MOZ_THUMB2) + fi + +-dnl ======================================================== +-dnl = Enable building for ARM specific CPU features +-dnl ======================================================== +-MOZ_ARG_WITH_STRING(cpu-arch, +-[ --with-cpu-arch=arch Use specific arm architecture CPU features, default armv7], +- MOZ_ARM_ARCH=$withval) ++case "$MOZ_THUMB_INTERWORK" in ++yes) ++ thumb_interwork_flag="-mthumb-interwork" ++ ;; ++no) ++ thumb_interwork_flag="-mno-thumb-interwork" ++ ;; ++*) # toolchain ++ thumb_interwork_flag="" ++ ;; ++esac + +-if test -n "$MOZ_THUMB2"; then +- case "$target_cpu" in +- arm*) +- if test "$MOZ_ARM_ARCH" != "armv7"; then +- AC_MSG_ERROR([--enable-thumb2 is not compatible with cpu-arch=$MOZ_ARM_ARCH]) +- fi +- if test "$GNU_CC"; then +- AC_DEFINE(MOZ_THUMB2) +- AC_DEFINE(MOZ_ARM_ARCH) +- CFLAGS="$CFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS" +- CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS" +- ASFLAGS="$ASFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS" +- else +- AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains]) +- fi ++case "$MOZ_FPU" in ++toolchain|"") ++ fpu_flag="" + ;; +- *) +- AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures]) ++*) ++ fpu_flag="-mfpu=$MOZ_FPU" + ;; +- esac +-elif test "$MOZ_ARM_ARCH" = "armv7"; then +- case "$target_cpu" in +- arm*) +- if test "$GNU_CC"; then +- AC_DEFINE(MOZ_ARM_ARCH) +- CFLAGS="$CFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS" +- CXXFLAGS="$CXXFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS" +- ASFLAGS="$ASFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS" +- else +- AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-GNU toolchains]) +- fi ++esac ++ ++case "$MOZ_FLOAT_ABI" in ++toolchain|"") ++ float_abi_flag="" + ;; +- *) +- AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-ARM CPU architectures]) ++*) ++ float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI" + ;; +- esac +-else +- case "$target_cpu" in +- arm*) +- if test "$GNU_CC"; then +- CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -msoft-float" +- CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -msoft-float" +- ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork -msoft-float" +- fi +- ;; +- esac ++esac ++ ++case "$MOZ_SOFT_FLOAT" in ++yes) ++ soft_float_flag="-msoft-float" ++ ;; ++no) ++ soft_float_flag="-mno-soft-float" ++ ;; ++*) # toolchain ++ soft_float_flag="" ++ ;; ++esac ++ ++dnl Use echo to avoid accumulating space characters ++all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag` ++if test -n "$all_flags"; then ++ _SAVE_CFLAGS="$CFLAGS" ++ CFLAGS="$all_flags" ++ AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works) ++ AC_TRY_COMPILE([],[return 0;], ++ AC_MSG_RESULT([yes]), ++ AC_MSG_ERROR([no])) ++ ++ CFLAGS="$_SAVE_CFLAGS $all_flags" ++ CXXFLAGS="$CXXFLAGS $all_flags" ++ ASFLAGS="$ASFLAGS $all_flags" ++ if test -n "$thumb_flag"; then ++ LDFLAGS="$LDFLAGS $thumb_flag" ++ fi + fi + + AC_SUBST(MOZ_THUMB2) +-AC_SUBST(MOZ_ARM_ARCH) ++ ++if test "$CPU_ARCH" = "arm"; then ++ AC_MSG_CHECKING(for ARM SIMD support in compiler) ++ # We try to link so that this also fails when ++ # building with LTO. ++ AC_TRY_LINK([], ++ [asm("uqadd8 r1, r1, r2");], ++ result="yes", result="no") ++ AC_MSG_RESULT("$result") ++ if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_ARM_SIMD) ++ HAVE_ARM_SIMD=1 ++ fi ++ ++ AC_MSG_CHECKING(for ARM NEON support in compiler) ++ # We try to link so that this also fails when ++ # building with LTO. ++ AC_TRY_LINK([], ++ [asm(".fpu neon\n vadd.i8 d0, d0, d0");], ++ result="yes", result="no") ++ AC_MSG_RESULT("$result") ++ if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_ARM_NEON) ++ HAVE_ARM_NEON=1 ++ fi ++fi # CPU_ARCH = arm ++ ++AC_SUBST(HAVE_ARM_SIMD) ++AC_SUBST(HAVE_ARM_NEON) + + dnl ======================================================== + dnl = +@@ -6147,12 +6241,6 @@ + if test "$OS_ARCH" = "OS2"; then + ac_configure_args="$ac_configure_args CFLAGS=-Zomf AR=emxomfar" + fi +- if test -n "$MOZ_THUMB2"; then +- ac_configure_args="$ac_configure_args --enable-thumb2" +- fi +- if test -n "$MOZ_ARM_ARCH"; then +- ac_configure_args="$ac_configure_args --with-cpu-arch=$MOZ_ARM_ARCH" +- fi + + # Use a separate cache file for libffi, since it does things differently + # from our configure. diff --git a/nixpkgs/pkgs/development/interpreters/spidermonkey/1.8.5-findvanilla.patch b/nixpkgs/pkgs/development/interpreters/spidermonkey/1.8.5-findvanilla.patch new file mode 100644 index 000000000000..f6dab5497a0a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/1.8.5-findvanilla.patch @@ -0,0 +1,19 @@ +diff --git a/js/src/Makefile.in b/js/src/Makefile.in +index a85e055..92ef441 100644 +--- a/js/src/Makefile.in ++++ b/js/src/Makefile.in +@@ -580,14 +580,6 @@ check-valgrind:: + $(check-sync-dirs) $(srcdir)/build $(MOZ_SYNC_BUILD_FILES)/build + endif + +-# The "find any vanilla new/new[] calls" script is tailored to Linux, so +-# only run it there. That should be enough to catch any such calls that +-# creep in. +-ifeq ($(OS_ARCH),Linux) +-check:: +- $(srcdir)/config/find_vanilla_new_calls $(LIBRARY) +-endif +- + ifdef ENABLE_TRACEJIT + ifndef WINCE + JITFLAGS = ,m,j,mj,mjp,am,amj,amjp,amd diff --git a/nixpkgs/pkgs/development/interpreters/spidermonkey/1.8.5.nix b/nixpkgs/pkgs/development/interpreters/spidermonkey/1.8.5.nix new file mode 100644 index 000000000000..466371955868 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/1.8.5.nix @@ -0,0 +1,76 @@ +{ stdenv, lib, autoconf213, fetchurl, fetchpatch, pkgconfig, nspr, perl, python2, zip }: + +stdenv.mkDerivation rec { + name = "spidermonkey-${version}"; + version = "1.8.5"; + + src = fetchurl { + url = "mirror://mozilla/js/js185-1.0.0.tar.gz"; + sha256 = "5d12f7e1f5b4a99436685d97b9b7b75f094d33580227aa998c406bbae6f2a687"; + }; + + propagatedBuildInputs = [ nspr ]; + + nativeBuildInputs = [ pkgconfig ] ++ lib.optional stdenv.isAarch32 autoconf213; + buildInputs = [ perl python2 zip ]; + + postUnpack = "sourceRoot=\${sourceRoot}/js/src"; + + preConfigure = '' + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${nspr.dev}/include/nspr" + export LIBXUL_DIST=$out + ${lib.optionalString stdenv.isAarch32 "autoreconf --verbose --force"} + ''; + + patches = [ + (fetchpatch { + name = "gcc6.patch"; + url = "https://sources.debian.org/data/main/m/mozjs/1.8.5-1.0.0+dfsg-6/debian/patches/fix-811665.patch"; + sha256 = "1q8477xqxiy5d8376k5902l45gd0qkd4nxmhl8vr6rr1pxfcny99"; + }) + ] ++ stdenv.lib.optionals stdenv.isAarch32 [ + # Explained below in configureFlags for ARM + ./1.8.5-findvanilla.patch + # Fix for hard float flags. + ./1.8.5-arm-flags.patch + ]; + + patchFlags = "-p3"; + + # On the Sheevaplug, ARM, its nanojit thing segfaults in japi-tests in + # "make check". Disabling tracejit makes it work, but then it needs the + # patch findvanilla.patch do disable a checker about allocator safety. In case + # of polkit, which is what matters most, it does not override the allocator + # so the failure of that test does not matter much. + configureFlags = [ "--enable-threadsafe" "--with-system-nspr" ] ++ + stdenv.lib.optionals (stdenv.hostPlatform.system == "armv5tel-linux") [ + "--with-cpu-arch=armv5t" + "--disable-tracejit" ]; + + # hack around a make problem, see https://github.com/NixOS/nixpkgs/issues/1279#issuecomment-29547393 + preBuild = '' + touch -- {.,shell,jsapi-tests}/{-lpthread,-ldl} + ${if stdenv.isAarch32 then "rm -r jit-test/tests/jaeger/bug563000" else ""} + ''; + + enableParallelBuilding = true; + + doCheck = true; + + preCheck = '' + rm jit-test/tests/sunspider/check-date-format-tofte.js # https://bugzil.la/600522 + + paxmark mr shell/js + paxmark mr jsapi-tests/jsapi-tests + ''; + + meta = with stdenv.lib; { + description = "Mozilla's JavaScript engine written in C/C++"; + homepage = https://developer.mozilla.org/en/SpiderMonkey; + # TODO: MPL/GPL/LGPL tri-license. + maintainers = [ maintainers.goibhniu ]; + platforms = platforms.linux; + broken = stdenv.isAarch64; # 2018-08-21, broken since 2017-03-08 + }; +} + diff --git a/nixpkgs/pkgs/development/interpreters/spidermonkey/38.nix b/nixpkgs/pkgs/development/interpreters/spidermonkey/38.nix new file mode 100644 index 000000000000..d48cf841b048 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/38.nix @@ -0,0 +1,60 @@ +{ stdenv, fetchurl, pkgconfig, gnused_422, perl, python2, zip, libffi, readline, icu, zlib, nspr +, libobjc }: + +stdenv.mkDerivation rec { + version = "38.8.0"; + name = "spidermonkey-${version}"; + + src = fetchurl { + url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.bz2"; + sha256 = "10lrync6cxnjlnadc0j3vg8r2dq9b3wwanw8qj1h6ncxwb7asxcl"; + }; + + buildInputs = [ libffi readline icu zlib nspr ] + ++ stdenv.lib.optional stdenv.isDarwin libobjc; + nativeBuildInputs = [ pkgconfig perl python2 zip gnused_422 ]; + + postUnpack = "sourceRoot=\${sourceRoot}/js/src"; + + preConfigure = '' + export CXXFLAGS="-fpermissive" + export LIBXUL_DIST=$out + export PYTHON="${python2.interpreter}" + ''; + + configureFlags = [ + "--enable-threadsafe" + "--with-system-ffi" + "--with-system-nspr" + "--with-system-zlib" + "--with-system-icu" + "--enable-readline" + + # enabling these because they're wanted by 0ad. They may or may + # not be good defaults for other uses. + "--enable-gcgenerational" + "--enable-shared-js" + ]; + + # This addresses some build system bug. It's quite likely to be safe + # to re-enable parallel builds if the source revision changes. + enableParallelBuilding = true; + + postFixup = '' + # The headers are symlinks to a directory that doesn't get put + # into $out, so they end up broken. Fix that by just resolving the + # symlinks. + for i in $(find $out -type l); do + cp --remove-destination "$(readlink "$i")" "$i"; + done + ''; + + meta = with stdenv.lib; { + description = "Mozilla's JavaScript engine written in C/C++"; + homepage = https://developer.mozilla.org/en/SpiderMonkey; + # TODO: MPL/GPL/LGPL tri-license. + + maintainers = [ maintainers.abbradar ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/spidermonkey/52.nix b/nixpkgs/pkgs/development/interpreters/spidermonkey/52.nix new file mode 100644 index 000000000000..ea96e5ed334a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/52.nix @@ -0,0 +1,69 @@ +{ stdenv, fetchurl, fetchpatch, autoconf213, pkgconfig, perl, python2, zip, which, readline, icu, zlib, nspr }: + +let + version = "52.9.0"; +in stdenv.mkDerivation rec { + name = "spidermonkey-${version}"; + + src = fetchurl { + url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz"; + sha256 = "1mlx34fgh1kaqamrkl5isf0npch3mm6s4lz3jsjb7hakiijhj7f0"; + }; + + outputs = [ "out" "dev" ]; + setOutputFlags = false; # Configure script only understands --includedir + + buildInputs = [ readline icu zlib nspr ]; + nativeBuildInputs = [ autoconf213 pkgconfig perl which python2 zip ]; + + # Apparently this package fails to build correctly with modern compilers, which at least + # on ARMv6 causes polkit testsuite to break with an assertion failure in spidermonkey. + # These flags were stolen from: + # https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/js52 + NIX_CFLAGS_COMPILE = "-fno-delete-null-pointer-checks -fno-strict-aliasing -fno-tree-vrp"; + + patches = [ + # needed to build gnome3.gjs + (fetchpatch { + name = "mozjs52-disable-mozglue.patch"; + url = https://git.archlinux.org/svntogit/packages.git/plain/trunk/mozjs52-disable-mozglue.patch?h=packages/js52&id=4279d2e18d9a44f6375f584911f63d13de7704be; + sha256 = "18wkss0agdyff107p5lfflk72qiz350xqw2yqc353alkx4fsfpz0"; + }) + ]; + + preConfigure = '' + export CXXFLAGS="-fpermissive" + export LIBXUL_DIST=$out + export PYTHON="${python2.interpreter}" + configureFlagsArray+=("--includedir=$dev/include") + + cd js/src + + autoconf + ''; + + configureFlags = [ + "--with-system-nspr" + "--with-system-zlib" + "--with-system-icu" + "--with-intl-api" + "--enable-readline" + "--enable-shared-js" + ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-jemalloc"; + + enableParallelBuilding = true; + + postInstall = '' + moveToOutput bin/js52-config "$dev" + # Nuke a static lib. + rm $out/lib/libjs_static.ajs + ''; + + meta = with stdenv.lib; { + description = "Mozilla's JavaScript engine written in C/C++"; + homepage = https://developer.mozilla.org/en/SpiderMonkey; + license = licenses.gpl2; # TODO: MPL/GPL/LGPL tri-license. + maintainers = [ maintainers.abbradar ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/spidermonkey/60.nix b/nixpkgs/pkgs/development/interpreters/spidermonkey/60.nix new file mode 100644 index 000000000000..1dfaf9a22860 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/60.nix @@ -0,0 +1,64 @@ +{ stdenv, fetchurl, fetchpatch, autoconf213, pkgconfig, perl, python2, zip +, which, readline, zlib, icu }: + +let + version = "60.4.0"; +in stdenv.mkDerivation rec { + name = "spidermonkey-${version}"; + + src = fetchurl { + url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz"; + sha256 = "11gzxd82grc3kg1ha4yni6ag6b97n46qycvv6x15s91ziia5hli0"; + }; + + buildInputs = [ readline zlib icu ]; + nativeBuildInputs = [ autoconf213 pkgconfig perl which python2 zip ]; + + patches = [ + (fetchpatch { + url = https://bug1415202.bmoattachments.org/attachment.cgi?id=8926363; + sha256 = "082ryrvqa3lvs67v3sq9kf2jshf4qp1fpi195wffc40jdrl8fnin"; + }) + ]; + + preConfigure = '' + export CXXFLAGS="-fpermissive" + export LIBXUL_DIST=$out + export PYTHON="${python2.interpreter}" + + # We can't build in js/src/, so create a build dir + mkdir obj + cd obj/ + configureScript=../js/src/configure + ''; + + configureFlags = [ + "--with-system-zlib" + "--with-system-icu" + "--with-intl-api" + "--enable-readline" + "--enable-shared-js" + "--enable-posix-nspr-emulation" + "--disable-jemalloc" + # Fedora and Arch disable optimize, but it doesn't seme to be necessary + # It turns on -O3 which some gcc version had a problem with: + # https://src.fedoraproject.org/rpms/mozjs38/c/761399aba092bcb1299bb4fccfd60f370ab4216e + "--enable-optimize" + "--enable-release" + ]; + + # Remove unnecessary static lib + preFixup = '' + rm $out/lib/libjs_static.ajs + ''; + + enableParallelBuilding = true; + + meta = with stdenv.lib; { + description = "Mozilla's JavaScript engine written in C/C++"; + homepage = https://developer.mozilla.org/en/SpiderMonkey; + license = licenses.gpl2; # TODO: MPL/GPL/LGPL tri-license. + maintainers = [ maintainers.abbradar ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/spidermonkey/aarch64-48bit-va-fix.patch b/nixpkgs/pkgs/development/interpreters/spidermonkey/aarch64-48bit-va-fix.patch new file mode 100644 index 000000000000..8258a46b1748 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/aarch64-48bit-va-fix.patch @@ -0,0 +1,106 @@ +From a0c0f32299419359b44ac0f880c1ea9073ae51e1 Mon Sep 17 00:00:00 2001 +From: Zheng Xu <zheng.xu@linaro.org> +Date: Fri, 02 Sep 2016 17:40:05 +0800 +Subject: [PATCH] Bug 1143022 - Manually mmap on arm64 to ensure high 17 bits are clear. r=ehoogeveen + +There might be 48-bit VA on arm64 depending on kernel configuration. +Manually mmap heap memory to align with the assumption made by JS engine. + +Change-Id: Ic5d2b2fe4b758b3c87cc0688348af7e71a991146 +--- + +diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp +index 5b386a2..38101cf 100644 +--- a/js/src/gc/Memory.cpp ++++ b/js/src/gc/Memory.cpp +@@ -309,6 +309,75 @@ + #endif + } + ++static inline void * ++MapMemory(size_t length, int prot, int flags, int fd, off_t offset) ++{ ++#if defined(__ia64__) ++ /* ++ * The JS engine assumes that all allocated pointers have their high 17 bits clear, ++ * which ia64's mmap doesn't support directly. However, we can emulate it by passing ++ * mmap an "addr" parameter with those bits clear. The mmap will return that address, ++ * or the nearest available memory above that address, providing a near-guarantee ++ * that those bits are clear. If they are not, we return NULL below to indicate ++ * out-of-memory. ++ * ++ * The addr is chosen as 0x0000070000000000, which still allows about 120TB of virtual ++ * address space. ++ * ++ * See Bug 589735 for more information. ++ */ ++ void *region = mmap((void*)0x0000070000000000, length, prot, flags, fd, offset); ++ if (region == MAP_FAILED) ++ return MAP_FAILED; ++ /* ++ * If the allocated memory doesn't have its upper 17 bits clear, consider it ++ * as out of memory. ++ */ ++ if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000) { ++ JS_ALWAYS_TRUE(0 == munmap(region, length)); ++ return MAP_FAILED; ++ } ++ return region; ++#elif defined(__aarch64__) ++ /* ++ * There might be similar virtual address issue on arm64 which depends on ++ * hardware and kernel configurations. But the work around is slightly ++ * different due to the different mmap behavior. ++ * ++ * TODO: Merge with the above code block if this implementation works for ++ * ia64 and sparc64. ++ */ ++ const uintptr_t start = (uintptr_t)(0x0000070000000000UL); ++ const uintptr_t end = (uintptr_t)(0x0000800000000000UL); ++ const uintptr_t step = ChunkSize; ++ /* ++ * Optimization options if there are too many retries in practice: ++ * 1. Examine /proc/self/maps to find an available address. This file is ++ * not always available, however. In addition, even if we examine ++ * /proc/self/maps, we may still need to retry several times due to ++ * racing with other threads. ++ * 2. Use a global/static variable with lock to track the addresses we have ++ * allocated or tried. ++ */ ++ uintptr_t hint; ++ void* region = MAP_FAILED; ++ for (hint = start; region == MAP_FAILED && hint + length <= end; hint += step) { ++ region = mmap((void*)hint, length, prot, flags, fd, offset); ++ if (region != MAP_FAILED) { ++ if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000) { ++ if (munmap(region, length)) { ++ MOZ_ASSERT(errno == ENOMEM); ++ } ++ region = MAP_FAILED; ++ } ++ } ++ } ++ return region == MAP_FAILED ? NULL : region; ++#else ++ return mmap(NULL, length, prot, flags, fd, offset); ++#endif ++} ++ + void * + MapAlignedPages(size_t size, size_t alignment) + { +@@ -322,12 +391,12 @@ + + /* Special case: If we want page alignment, no further work is needed. */ + if (alignment == PageSize) { +- return mmap(NULL, size, prot, flags, -1, 0); ++ return MapMemory(size, prot, flags, -1, 0); + } + + /* Overallocate and unmap the region's edges. */ + size_t reqSize = Min(size + 2 * alignment, 2 * size); +- void *region = mmap(NULL, reqSize, prot, flags, -1, 0); ++ void *region = MapMemory(reqSize, prot, flags, -1, 0); + if (region == MAP_FAILED) + return NULL; + diff --git a/nixpkgs/pkgs/development/interpreters/spidermonkey/aarch64-double-conversion.patch b/nixpkgs/pkgs/development/interpreters/spidermonkey/aarch64-double-conversion.patch new file mode 100644 index 000000000000..bf41ce0a8a21 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/aarch64-double-conversion.patch @@ -0,0 +1,13 @@ +diff -ru mozjs17.0.0-orig/mfbt/double-conversion/utils.h mozjs17.0.0/mfbt/double-conversion/utils.h +--- mozjs17.0.0-orig/mfbt/double-conversion/utils.h 2013-02-11 17:33:28.000000000 -0500 ++++ mozjs17.0.0/mfbt/double-conversion/utils.h 2016-12-03 20:39:07.915042988 -0500 +@@ -58,7 +58,8 @@ + defined(__mips__) || defined(__powerpc__) || \ + defined(__sparc__) || defined(__sparc) || defined(__s390__) || \ + defined(__SH4__) || defined(__alpha__) || \ +- defined(_MIPS_ARCH_MIPS32R2) ++ defined(_MIPS_ARCH_MIPS32R2) || \ ++ defined(__AARCH64EL__) + #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 + #elif defined(_M_IX86) || defined(__i386__) || defined(__i386) + #if defined(_WIN32) diff --git a/nixpkgs/pkgs/development/interpreters/supercollider/default.nix b/nixpkgs/pkgs/development/interpreters/supercollider/default.nix new file mode 100644 index 000000000000..c16b57dcb9c5 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/supercollider/default.nix @@ -0,0 +1,40 @@ +{ stdenv, fetchurl, cmake, pkgconfig, alsaLib +, libjack2, libsndfile, fftw, curl, gcc +, libXt, qtbase, qttools, qtwebkit, readline +, useSCEL ? false, emacs +}: + +let optional = stdenv.lib.optional; +in + +stdenv.mkDerivation rec { + name = "supercollider-${version}"; + version = "3.9.3"; + + + src = fetchurl { + url = "https://github.com/supercollider/supercollider/releases/download/Version-${version}/SuperCollider-${version}-Source-linux.tar.bz2"; + sha256 = "1d8ixfl100jvlialxdizp8wqsl1mp5pi2bam25vp97bhjd59cfdr"; + }; + + hardeningDisable = [ "stackprotector" ]; + + cmakeFlags = '' + -DSC_WII=OFF + -DSC_EL=${if useSCEL then "ON" else "OFF"} + ''; + + nativeBuildInputs = [ cmake pkgconfig qttools ]; + + buildInputs = [ + gcc libjack2 libsndfile fftw curl libXt qtbase qtwebkit readline ] + ++ optional (!stdenv.isDarwin) alsaLib + ++ optional useSCEL emacs; + + meta = { + description = "Programming language for real time audio synthesis"; + homepage = http://supercollider.sourceforge.net/; + license = stdenv.lib.licenses.gpl3Plus; + platforms = [ "x686-linux" "x86_64-linux" ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/tcl/8.5.nix b/nixpkgs/pkgs/development/interpreters/tcl/8.5.nix new file mode 100644 index 000000000000..193ff4f93769 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/tcl/8.5.nix @@ -0,0 +1,11 @@ +{ callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + release = "8.5"; + version = "${release}.18"; + + src = fetchurl { + url = "mirror://sourceforge/tcl/tcl${version}-src.tar.gz"; + sha256 = "1jfkqp2fr0xh6xvaqx134hkfa5kh7agaqbxm6lhjbpvvc1xfaaq3"; + }; +}) diff --git a/nixpkgs/pkgs/development/interpreters/tcl/8.6.nix b/nixpkgs/pkgs/development/interpreters/tcl/8.6.nix new file mode 100644 index 000000000000..61d67a874e90 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/tcl/8.6.nix @@ -0,0 +1,11 @@ +{ callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + release = "8.6"; + version = "${release}.6"; + + src = fetchurl { + url = "mirror://sourceforge/tcl/tcl${version}-src.tar.gz"; + sha256 = "01zypqhy57wvh1ikk28bg733sk5kf4q568pq9v6fvcz4h6bl0rd2"; + }; +}) diff --git a/nixpkgs/pkgs/development/interpreters/tcl/generic.nix b/nixpkgs/pkgs/development/interpreters/tcl/generic.nix new file mode 100644 index 000000000000..a472ccaafbf2 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/tcl/generic.nix @@ -0,0 +1,47 @@ +{ stdenv + +# Version specific stuff +, release, version, src +, ... +}: + +stdenv.mkDerivation rec { + name = "tcl-${version}"; + + inherit src; + + outputs = [ "out" "man" ]; + + setOutputFlags = false; + + preConfigure = '' + # Note: using $out instead of $man to prevent a runtime dependency on $man. + configureFlagsArray+=(--mandir=$out/share/man --enable-man-symlinks) + + # Don't install tzdata because NixOS already has a more up-to-date copy. + configureFlagsArray+=(--with-tzdata=no) + + cd unix + ''; + + enableParallelBuilding = true; + + postInstall = '' + make install-private-headers + ln -s $out/bin/tclsh${release} $out/bin/tclsh + ''; + + meta = with stdenv.lib; { + description = "The Tcl scription language"; + homepage = http://www.tcl.tk/; + license = licenses.tcltk; + platforms = platforms.all; + maintainers = with maintainers; [ wkennington vrthra ]; + }; + + passthru = rec { + inherit release version; + libPrefix = "tcl${release}"; + libdir = "lib/${libPrefix}"; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/unicon-lang/default.nix b/nixpkgs/pkgs/development/interpreters/unicon-lang/default.nix new file mode 100644 index 000000000000..77154b54fd8f --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/unicon-lang/default.nix @@ -0,0 +1,44 @@ +{ stdenv, fetchurl, unzip, libX11, libXt }: + +stdenv.mkDerivation rec { + name = "unicon-lang-${version}"; + version = "11.7"; + src = fetchurl { + url = "http://unicon.org/dist/uni-2-4-2010.zip"; + sha256 = "1g9l2dfp99dqih2ir2limqfjgagh3v9aqly6x0l3qavx3qkkwf61"; + }; + buildInputs = [ libX11 libXt unzip ]; + + hardeningDisable = [ "fortify" ]; + + sourceRoot = "."; + + configurePhase = '' + case "$(uname -a | sed 's/ /_/g')" in + Darwin*Version_9*i386) sys=intel_macos;; + Linux*x86_64*) sys=amd64_linux;; + Linux*i686*) sys=intel_linux;; + *) sys=unknown;; + esac + echo "all: ; echo" > uni/3d/makefile + make X-Configure name=$sys + ''; + + buildPhase = '' + make Unicon + ''; + + installPhase = '' + mkdir -p $out/ + cp -r bin $out/ + ''; + + meta = with stdenv.lib; { + description = ''A very high level, goal-directed, object-oriented, general purpose applications language''; + maintainers = with maintainers; [ vrthra ]; + platforms = platforms.linux; + license = licenses.gpl2; + homepage = http://unicon.org; + }; +} + diff --git a/nixpkgs/pkgs/development/interpreters/wasm-gc/default.nix b/nixpkgs/pkgs/development/interpreters/wasm-gc/default.nix new file mode 100644 index 000000000000..cf0fad18d1ca --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/wasm-gc/default.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchFromGitHub, rustPlatform }: + +rustPlatform.buildRustPackage rec { + name = "wasm-gc-${version}"; + version = "0.1.6"; + + src = fetchFromGitHub { + owner = "alexcrichton"; + repo = "wasm-gc"; + rev = version; + sha256 = "1lc30xxqp3vv1r269xzznh2lf2dzdq89bi5f1vmqjw4yc3xmawm7"; + }; + + cargoPatches = [ ./fix-build.patch ]; # Cargo.lock is not up-to-date + + cargoSha256 = "1jvk9n324p3x3j6q6x0p5diig3b5c683k74cfflff25i7gsmmvc7"; + + meta = with stdenv.lib; { + description = "gc-sections for wasm"; + homepage = "https://github.com/alexcrichton/wasm-gc"; + maintainers = with maintainers; [ ekleog ]; + platforms = platforms.all; + license = with licenses; [ mit asl20 ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/wasm-gc/fix-build.patch b/nixpkgs/pkgs/development/interpreters/wasm-gc/fix-build.patch new file mode 100644 index 000000000000..3144dd898374 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/wasm-gc/fix-build.patch @@ -0,0 +1,34 @@ +diff --git a/Cargo.lock b/Cargo.lock +index 923ed91..71f17c8 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -212,16 +212,16 @@ dependencies = [ + + [[package]] + name = "wasm-gc" +-version = "0.1.1" ++version = "0.1.6" + dependencies = [ + "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", +- "wasm-gc-api 0.1.5", ++ "wasm-gc-api 0.1.6", + ] + + [[package]] + name = "wasm-gc-api" +-version = "0.1.5" ++version = "0.1.6" + dependencies = [ + "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-wasm 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -234,7 +234,7 @@ version = "0.1.0" + dependencies = [ + "cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", +- "wasm-gc-api 0.1.5", ++ "wasm-gc-api 0.1.6", + ] + + [[package]] + |