diff options
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters')
288 files changed, 15900 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/acl2/0001-Fix-some-paths-for-Nix-build.patch b/nixpkgs/pkgs/development/interpreters/acl2/0001-Fix-some-paths-for-Nix-build.patch new file mode 100644 index 000000000000..2b7f8b6a53b1 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/acl2/0001-Fix-some-paths-for-Nix-build.patch @@ -0,0 +1,190 @@ +From 43d23211dd7d22b5264ed06d446f89d632125da8 Mon Sep 17 00:00:00 2001 +From: Keshav Kini <keshav.kini@gmail.com> +Date: Sat, 30 May 2020 21:27:47 -0700 +Subject: [PATCH 1/2] Fix some paths for Nix build + +--- + books/build/features.sh | 1 + + .../ipasir/load-ipasir-sharedlib-raw.lsp | 16 +++---- + books/projects/smtlink/config.lisp | 2 +- + books/projects/smtlink/examples/examples.lisp | 4 +- + books/projects/smtlink/smtlink-config | 2 +- + .../cl+ssl-20181018-git/src/reload.lisp | 48 ++----------------- + .../shellpool-20150505-git/src/main.lisp | 20 +------- + 7 files changed, 15 insertions(+), 78 deletions(-) + +diff --git a/books/build/features.sh b/books/build/features.sh +index c8493d51a..def853f53 100755 +--- a/books/build/features.sh ++++ b/books/build/features.sh +@@ -84,6 +84,7 @@ fi + + + echo "Determining whether an ipasir shared library is installed" 1>&2 ++IPASIR_SHARED_LIBRARY=${IPASIR_SHARED_LIBRARY:-@libipasirglucose4@/lib/libipasirglucose4.so} + if [[ $IPASIR_SHARED_LIBRARY != '' ]]; + then + if [[ -e $IPASIR_SHARED_LIBRARY ]]; +diff --git a/books/centaur/ipasir/load-ipasir-sharedlib-raw.lsp b/books/centaur/ipasir/load-ipasir-sharedlib-raw.lsp +index c6b0b3185..5ac5c675a 100644 +--- a/books/centaur/ipasir/load-ipasir-sharedlib-raw.lsp ++++ b/books/centaur/ipasir/load-ipasir-sharedlib-raw.lsp +@@ -28,13 +28,9 @@ + ; + ; Original authors: Sol Swords <sswords@centtech.com> + +-(er-let* ((libname (acl2::getenv$ "IPASIR_SHARED_LIBRARY" acl2::*the-live-state*))) +- (if libname +- (handler-case +- (cffi::load-foreign-library libname) +- (error () (er hard? 'load-ipasir-shardlib-raw +- "Couldn't load the specified ipasir shared library, ~s0." +- libname))) +- (er hard? 'load-ipasir-shardlib-raw +- "Couldn't load an ipasir library because the ~ +- IPASIR_SHARED_LIBRARY environment variable was unset."))) ++(let ((libname "@libipasirglucose4@/lib/libipasirglucose4.so")) ++ (handler-case ++ (cffi::load-foreign-library libname) ++ (error () (er hard? 'load-ipasir-shardlib-raw ++ "Couldn't load the specified ipasir shared library, ~s0." ++ libname)))) +diff --git a/books/projects/smtlink/config.lisp b/books/projects/smtlink/config.lisp +index c74073174..8d92355f7 100644 +--- a/books/projects/smtlink/config.lisp ++++ b/books/projects/smtlink/config.lisp +@@ -51,7 +51,7 @@ where the system books are.")) + (make-smtlink-config :interface-dir interface-dir + :smt-module "ACL2_to_Z3" + :smt-class "ACL22SMT" +- :smt-cmd "/usr/bin/env python" ++ :smt-cmd "python" + :pythonpath ""))) + + ;; ----------------------------------------------------------------- +diff --git a/books/projects/smtlink/examples/examples.lisp b/books/projects/smtlink/examples/examples.lisp +index bc66e0165..24f0d639c 100644 +--- a/books/projects/smtlink/examples/examples.lisp ++++ b/books/projects/smtlink/examples/examples.lisp +@@ -75,7 +75,7 @@ Subgoal 2 + Subgoal 2.2 + Subgoal 2.2' + Using default SMT-trusted-cp... +-; SMT solver: `/usr/bin/env python /tmp/py_file/smtlink.w59zR`: 0.52 sec, 7,904 bytes ++; SMT solver: `python /tmp/py_file/smtlink.w59zR`: 0.52 sec, 7,904 bytes + Proved! + Subgoal 2.2'' + Subgoal 2.1 +@@ -139,7 +139,7 @@ read back into ACL2. Below are the outputs from this clause processor called + + @({ + Using default SMT-trusted-cp... +-; SMT solver: `/usr/bin/env python /tmp/py_file/smtlink.w59zR`: 0.52 sec, 7,904 bytes ++; SMT solver: `python /tmp/py_file/smtlink.w59zR`: 0.52 sec, 7,904 bytes + Proved! + }) + +diff --git a/books/projects/smtlink/smtlink-config b/books/projects/smtlink/smtlink-config +index 0d2703545..0f58904ea 100644 +--- a/books/projects/smtlink/smtlink-config ++++ b/books/projects/smtlink/smtlink-config +@@ -1 +1 @@ +-smt-cmd=/usr/bin/env python ++smt-cmd=python +diff --git a/books/quicklisp/bundle/software/cl+ssl-20181018-git/src/reload.lisp b/books/quicklisp/bundle/software/cl+ssl-20181018-git/src/reload.lisp +index 3f6aa35d0..ac4012363 100644 +--- a/books/quicklisp/bundle/software/cl+ssl-20181018-git/src/reload.lisp ++++ b/books/quicklisp/bundle/software/cl+ssl-20181018-git/src/reload.lisp +@@ -20,54 +20,12 @@ + (in-package :cl+ssl) + + (cffi:define-foreign-library libcrypto +- (:openbsd "libcrypto.so") +- (:darwin (:or "/opt/local/lib/libcrypto.dylib" ;; MacPorts +- "/sw/lib/libcrypto.dylib" ;; Fink +- "/usr/local/opt/openssl/lib/libcrypto.dylib" ;; Homebrew +- "/usr/local/lib/libcrypto.dylib" ;; personalized install +- "libcrypto.dylib" ;; default system libcrypto, which may have insufficient crypto +- "/usr/lib/libcrypto.dylib"))) ++ (t "@openssl@/lib/libcrypto.so")) + + (cffi:define-foreign-library libssl +- (:windows (:or "libssl32.dll" "ssleay32.dll")) +- ;; The default OS-X libssl seems have had insufficient crypto algos +- ;; (missing TLSv1_[1,2]_XXX methods, +- ;; see https://github.com/cl-plus-ssl/cl-plus-ssl/issues/56) +- ;; so first try to load possible custom installations of libssl +- (:darwin (:or "/opt/local/lib/libssl.dylib" ;; MacPorts +- "/sw/lib/libssl.dylib" ;; Fink +- "/usr/local/opt/openssl/lib/libssl.dylib" ;; Homebrew +- "/usr/local/lib/libssl.dylib" ;; personalized install +- "libssl.dylib" ;; default system libssl, which may have insufficient crypto +- "/usr/lib/libssl.dylib")) +- (:solaris (:or "/lib/64/libssl.so" +- "libssl.so.0.9.8" "libssl.so" "libssl.so.4")) +- ;; Unlike some other systems, OpenBSD linker, +- ;; when passed library name without versions at the end, +- ;; will locate the library with highest macro.minor version, +- ;; so we can just use just "libssl.so". +- ;; More info at https://github.com/cl-plus-ssl/cl-plus-ssl/pull/2. +- (:openbsd "libssl.so") +- ((and :unix (not :cygwin)) (:or "libssl.so.1.0.2m" +- "libssl.so.1.0.2k" +- "libssl.so.1.0.2" +- "libssl.so.1.0.1l" +- "libssl.so.1.0.1j" +- "libssl.so.1.0.1e" +- "libssl.so.1.0.1" +- "libssl.so.1.0.0q" +- "libssl.so.1.0.0" +- "libssl.so.0.9.8ze" +- "libssl.so.0.9.8" +- "libssl.so.10" +- "libssl.so.4" +- "libssl.so")) +- (:cygwin "cygssl-1.0.0.dll") +- (t (:default "libssl3"))) +- +-(cffi:define-foreign-library libeay32 +- (:windows "libeay32.dll")) ++ (t "@openssl@/lib/libssl.so")) + ++(cffi:define-foreign-library libeay32) + + (unless (member :cl+ssl-foreign-libs-already-loaded + *features*) +diff --git a/books/quicklisp/bundle/software/shellpool-20150505-git/src/main.lisp b/books/quicklisp/bundle/software/shellpool-20150505-git/src/main.lisp +index cda8dc94c..11035ea09 100644 +--- a/books/quicklisp/bundle/software/shellpool-20150505-git/src/main.lisp ++++ b/books/quicklisp/bundle/software/shellpool-20150505-git/src/main.lisp +@@ -106,26 +106,8 @@ + ; Glue + + +-#-sbcl + (defun find-bash () +- #+windows "bash.exe" +- #-windows "bash") +- +-#+sbcl +-;; SBCL (on Linux, at least) won't successfully run "bash" all by itself. So, +-;; on SBCL, try to find a likely bash. BOZO this probably isn't great. It +-;; would be better to search the user's PATH for which bash to use. +-(let ((found-bash)) +- (defun find-bash () +- (or found-bash +- (let ((paths-to-try '("/bin/bash" +- "/usr/bin/bash" +- "/usr/local/bin/bash"))) +- (loop for path in paths-to-try do +- (when (cl-fad::file-exists-p path) +- (setq found-bash path) +- (return-from find-bash path))) +- (error "Bash not found among ~s" paths-to-try))))) ++ "@bash@/bin/bash") + + #+(or allegro lispworks) + (defstruct bashprocess +-- +2.25.4 + diff --git a/nixpkgs/pkgs/development/interpreters/acl2/0002-Restrict-RDTSC-to-x86.patch b/nixpkgs/pkgs/development/interpreters/acl2/0002-Restrict-RDTSC-to-x86.patch new file mode 100644 index 000000000000..74af5adef649 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/acl2/0002-Restrict-RDTSC-to-x86.patch @@ -0,0 +1,29 @@ +From b0ccf68f277d0bd5e6fc9d41742f31ddda99a955 Mon Sep 17 00:00:00 2001 +From: Keshav Kini <keshav.kini@gmail.com> +Date: Mon, 1 Jun 2020 21:42:24 -0700 +Subject: [PATCH 2/2] Restrict RDTSC to x86 + +Backported from [1]. According to Curtis Dunham, this should fix the ACL2 base +system build on ARM. + +[1]: https://github.com/acl2/acl2/commit/292fa2ccc6217e6307d7bb8373eb90f5d258ea5e +--- + memoize-raw.lisp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/memoize-raw.lisp b/memoize-raw.lisp +index 205e78653..478198dee 100644 +--- a/memoize-raw.lisp ++++ b/memoize-raw.lisp +@@ -189,7 +189,7 @@ + ;; RDTSC nonsense, but we still can report mysterious results since we have no + ;; clue about which core we are running on in CCL (or, presumably, SBCL). + +-#+(or ccl sbcl) ++#+(and (or ccl sbcl) x86-64) + (eval-when + (:execute :compile-toplevel :load-toplevel) + (when #+ccl (fboundp 'ccl::rdtsc) +-- +2.25.4 + diff --git a/nixpkgs/pkgs/development/interpreters/acl2/default.nix b/nixpkgs/pkgs/development/interpreters/acl2/default.nix new file mode 100644 index 000000000000..e3c62aae9833 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/acl2/default.nix @@ -0,0 +1,137 @@ +{ stdenv, callPackage, fetchFromGitHub, writeShellScriptBin, substituteAll +, sbcl, bash, which, perl, nettools +, openssl, glucose, minisat, abc-verifier, z3, python2 +, certifyBooks ? true +} @ args: + +let + # Disable immobile space so we don't run out of memory on large books; see + # http://www.cs.utexas.edu/users/moore/acl2/current/HTML/installation/requirements.html#Obtaining-SBCL + sbcl = args.sbcl.override { disableImmobileSpace = true; }; + + # Wrap to add `-model` argument because some of the books in 8.3 need this. + # Fixed upstream (https://github.com/acl2/acl2/commit/0359538a), so this can + # be removed in ACL2 8.4. + glucose = writeShellScriptBin "glucose" ''exec ${args.glucose}/bin/glucose -model "$@"''; + +in stdenv.mkDerivation rec { + pname = "acl2"; + version = "8.3"; + + src = fetchFromGitHub { + owner = "acl2-devel"; + repo = "acl2-devel"; + rev = "${version}"; + sha256 = "0c0wimaf16nrr3d6cxq6p7nr7rxffvpmn66hkpwc1m6zpcipf0y5"; + }; + + libipasirglucose4 = callPackage ./libipasirglucose4 { }; + + patches = [ + (substituteAll { + src = ./0001-Fix-some-paths-for-Nix-build.patch; + inherit bash libipasirglucose4; + openssl = openssl.out; + }) + ./0002-Restrict-RDTSC-to-x86.patch + ]; + + buildInputs = [ + # ACL2 itself only needs a Common Lisp compiler/interpreter: + sbcl + ] ++ stdenv.lib.optionals certifyBooks [ + # To build community books, we need Perl and a couple of utilities: + which perl nettools + # Some of the books require one or more of these external tools: + openssl.out glucose minisat abc-verifier libipasirglucose4 + z3 (python2.withPackages (ps: [ ps.z3 ])) + ]; + + # NOTE: Parallel building can be memory-intensive depending on the number of + # concurrent jobs. For example, this build has been seen to use >120GB of + # RAM on an 85 core machine. + enableParallelBuilding = true; + + preConfigure = '' + # When certifying books, ACL2 doesn't like $HOME not existing. + export HOME=$(pwd)/fake-home + '' + stdenv.lib.optionalString certifyBooks '' + # Some books also care about $USER being nonempty. + export USER=nobody + ''; + + postConfigure = '' + # ACL2 and its books need to be built in place in the out directory because + # the proof artifacts are not relocatable. Since ACL2 mostly expects + # everything to exist in the original source tree layout, we put it in + # $out/share/${pname} and create symlinks in $out/bin as necessary. + mkdir -p $out/share/${pname} + cp -pR . $out/share/${pname} + cd $out/share/${pname} + ''; + + preBuild = "mkdir -p $HOME"; + makeFlags="LISP=${sbcl}/bin/sbcl"; + + doCheck = true; + checkTarget = "mini-proveall"; + + installPhase = '' + mkdir -p $out/bin + ln -s $out/share/${pname}/saved_acl2 $out/bin/${pname} + '' + stdenv.lib.optionalString certifyBooks '' + ln -s $out/share/${pname}/books/build/cert.pl $out/bin/${pname}-cert + ln -s $out/share/${pname}/books/build/clean.pl $out/bin/${pname}-clean + ''; + + preDistPhases = [ (if certifyBooks then "certifyBooksPhase" else "removeBooksPhase") ]; + + certifyBooksPhase = '' + # Certify the community books + pushd $out/share/${pname}/books + makeFlags="ACL2=$out/share/${pname}/saved_acl2" + buildFlags="everything" + buildPhase + popd + ''; + + removeBooksPhase = '' + # Delete the community books + rm -rf $out/share/${pname}/books + ''; + + meta = with stdenv.lib; { + 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. + + This package installs the main ACL2 executable ${pname}, as well as the + build tools cert.pl and clean.pl, renamed to ${pname}-cert and + ${pname}-clean. + + '' + (if certifyBooks then '' + The community books are also included and certified with the `make + everything` target. + '' else '' + The community books are not included in this package. + ''); + homepage = "http://www.cs.utexas.edu/users/moore/acl2/"; + downloadPage = "https://github.com/acl2-devel/acl2-devel/releases"; + license = with licenses; [ + # ACL2 itself is bsd3 + bsd3 + ] ++ optionals certifyBooks [ + # The community books are mostly bsd3 or mit but with a few + # other things thrown in. + mit gpl2 llgpl21 cc0 publicDomain unfreeRedistributable + ]; + maintainers = with maintainers; [ kini raskin ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/acl2/libipasirglucose4/0001-Support-shared-library-build.patch b/nixpkgs/pkgs/development/interpreters/acl2/libipasirglucose4/0001-Support-shared-library-build.patch new file mode 100644 index 000000000000..c78fa1ab925a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/acl2/libipasirglucose4/0001-Support-shared-library-build.patch @@ -0,0 +1,46 @@ +From 0f48e046f44624f4d4d8255ac5bd26397a38f16c Mon Sep 17 00:00:00 2001 +From: Keshav Kini <keshav.kini@gmail.com> +Date: Sun, 23 Feb 2020 14:09:30 -0800 +Subject: [PATCH] Support shared library build + +Patch taken from [the ACL2 Books documentation][1]. + +- Add " -fPIC" to the CXXFLAGS to build position-independent code, + required for shared libraries. + +- Add the line "export CXXFLAGS" below the setting of CXXFLAGS, so that + those flags apply to the recursive make of the core solver library. + +- Fix a typo: replace the occurrence of "CXXLAGS" with "CXXFLAGS". + +[1]: http://www.cs.utexas.edu/users/moore/acl2/v8-2/combined-manual/index.html?topic=IPASIR____BUILDING-AN-IPASIR-SOLVER-LIBRARY +--- + makefile | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/makefile b/makefile +index 07121de..4e85c4b 100755 +--- a/makefile ++++ b/makefile +@@ -29,7 +29,8 @@ TARGET=libipasir$(SIG).a + + CXX=g++ + +-CXXFLAGS= -g -std=c++11 -Wall -DNDEBUG -O3 ++CXXFLAGS= -g -std=c++11 -Wall -DNDEBUG -O3 -fPIC ++export CXXFLAGS + + #-----------------------------------------------------------------------# + #- REQUIRED TOP RULES --------------------------------------------------# +@@ -67,7 +68,7 @@ libipasir$(SIG).a: .FORCE + #-----------------------------------------------------------------------# + + ipasir$(NAME)glue.o: ipasir$(NAME)glue.cc ipasir.h makefile +- $(CXX) -g -std=c++11 $(CXXLAGS) \ ++ $(CXX) -g -std=c++11 $(CXXFLAGS) \ + -DVERSION=\"$(VERSION)\" \ + -I$(DIR) -I$(DIR)/core -c ipasir$(NAME)glue.cc + +-- +2.23.1 + diff --git a/nixpkgs/pkgs/development/interpreters/acl2/libipasirglucose4/default.nix b/nixpkgs/pkgs/development/interpreters/acl2/libipasirglucose4/default.nix new file mode 100644 index 000000000000..5186cd69584e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/acl2/libipasirglucose4/default.nix @@ -0,0 +1,36 @@ +{ stdenv, fetchurl, zlib, unzip }: + +stdenv.mkDerivation rec { + pname = "libipasirglucose4"; + # This library has no version number AFAICT (beyond generally being based on + # Glucose 4.x), but it was submitted to the 2017 SAT competition so let's use + # that as the version number, I guess. + version = "2017"; + + src = fetchurl { + url = "https://baldur.iti.kit.edu/sat-competition-2017/solvers/incremental/glucose-ipasir.zip"; + sha256 = "0xchgady9vwdh8frmc8swz6va53igp2wj1y9sshd0g7549n87wdj"; + }; + nativeBuildInputs = [ unzip ]; + + buildInputs = [ zlib ]; + + sourceRoot = "sat/glucose4"; + patches = [ ./0001-Support-shared-library-build.patch ]; + + postBuild = '' + g++ -shared -Wl,-soname,libipasirglucose4.so -o libipasirglucose4.so \ + ipasirglucoseglue.o libipasirglucose4.a + ''; + + installPhase = '' + install -D libipasirglucose4.so $out/lib/libipasirglucose4.so + ''; + + meta = with stdenv.lib; { + description = "Shared library providing IPASIR interface to the Glucose SAT solver"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ kini ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/alda/default.nix b/nixpkgs/pkgs/development/interpreters/alda/default.nix new file mode 100644 index 000000000000..3e5273d63290 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/alda/default.nix @@ -0,0 +1,27 @@ +{ stdenv, fetchurl, jre }: + +stdenv.mkDerivation rec { + pname = "alda"; + version = "1.4.2"; + + src = fetchurl { + url = "https://github.com/alda-lang/alda/releases/download/${version}/alda"; + sha256 = "1d0412jw37gh1y7i8cmaml8r4sn516i6pxmm8m16yprqmz6glx28"; + }; + + dontUnpack = true; + + installPhase = '' + install -Dm755 $src $out/bin/alda + sed -i -e '1 s!java!${jre}/bin/java!' $out/bin/alda + ''; + + meta = with stdenv.lib; { + description = "A music programming language for musicians."; + homepage = "https://alda.io"; + license = licenses.epl10; + maintainers = [ maintainers.ericdallo ]; + platforms = jre.meta.platforms; + }; + +} 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..0209bcaaafcd --- /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.34.0"; + name="${baseName}-${version}"; + url="http://www.angelcode.com/angelscript/sdk/files/angelscript_${version}.zip"; + sha256 = "1xxxpwln4v2yasa35y7552fsfd8fbg50gnbp4vxy0ajj2wvh9akg"; + }; + 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..bbc38e515424 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/bats/default.nix @@ -0,0 +1,30 @@ +{ stdenv, fetchzip, coreutils, gnugrep }: + +stdenv.mkDerivation rec { + pname = "bats"; + version = "1.2.0"; + + src = fetchzip { + url = "https://github.com/bats-core/bats-core/archive/v${version}.tar.gz"; + sha256 = "0f59zh4d4pa1a7ybs5zl6h0csbqqv11lbnq0jl1dgwm1s6p49bsq"; + }; + + patchPhase = '' + patchShebangs ./install.sh + + substituteInPlace ./libexec/bats-core/bats \ + --replace 'type -p greadlink readlink' 'type -p ${coreutils}/bin/readlink' + 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..de12185b96f0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ceptre/default.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchgit, mlton }: + +stdenv.mkDerivation { + 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..7bf4c0fd52d0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/chibi/default.nix @@ -0,0 +1,39 @@ +{ stdenv, fetchFromGitHub, makeWrapper }: +let + version = "0.9.1"; + 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 = "0nd63i924ifh39cba1hd4sbi6vh1cb73v97nrn4bf8rrjh3k8pdi"; + }; + + 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..cf0710f36a1a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clips/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation { + version = "6.30"; + pname = "clips"; + 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..1b7ff2c8cba3 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clisp/default.nix @@ -0,0 +1,104 @@ +# 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, xorgproto, libXext +, 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 && xorgproto != null && libXext != 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 xorgproto libXext + ]; + + 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; + license = stdenv.lib.licenses.gpl2; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/clisp/hg.nix b/nixpkgs/pkgs/development/interpreters/clisp/hg.nix new file mode 100644 index 000000000000..6898f84669f7 --- /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, xorgproto, libXext +, 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 && xorgproto != null && libXext != 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 xorgproto libXext + ]; + + # 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/babashka.nix b/nixpkgs/pkgs/development/interpreters/clojure/babashka.nix new file mode 100644 index 000000000000..c023aa65fdaa --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojure/babashka.nix @@ -0,0 +1,84 @@ +{ stdenv, fetchurl, graalvm8, glibcLocales }: + +with stdenv.lib; +stdenv.mkDerivation rec { + pname = "babashka"; + version = "0.0.97"; + + reflectionJson = fetchurl { + name = "reflection.json"; + url = "https://github.com/borkdude/${pname}/releases/download/v${version}/${pname}-${version}-reflection.json"; + sha256 = "1gd9ih9l02n1j9qkbxb36d3cb5sddwvxiw8kkicgc4xig77lsa7z"; + }; + + src = fetchurl { + url = "https://github.com/borkdude/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar"; + sha256 = "08py6bawfrhg90fbcnv2mq4c91g5wa1q2q6zdjy2i1b9q4x1654r"; + }; + + dontUnpack = true; + + LC_ALL = "en_US.UTF-8"; + nativeBuildInputs = [ graalvm8 glibcLocales ]; + + buildPhase = '' + native-image \ + -jar ${src} \ + -H:Name=bb \ + -H:+ReportExceptionStackTraces \ + -J-Dclojure.spec.skip-macros=true \ + -J-Dclojure.compiler.direct-linking=true \ + "-H:IncludeResources=BABASHKA_VERSION" \ + "-H:IncludeResources=SCI_VERSION" \ + -H:ReflectionConfigurationFiles=${reflectionJson} \ + --initialize-at-run-time=java.lang.Math\$RandomNumberGeneratorHolder \ + --initialize-at-build-time \ + -H:Log=registerResource: \ + -H:EnableURLProtocols=http,https \ + --enable-all-security-services \ + -H:+JNI \ + --verbose \ + --no-fallback \ + --no-server \ + --report-unsupported-elements-at-runtime \ + "--initialize-at-run-time=org.postgresql.sspi.SSPIClient" \ + "-J-Xmx4500m" + ''; + + installPhase = '' + mkdir -p $out/bin + cp bb $out/bin/bb + ''; + + meta = with stdenv.lib; { + description = "A Clojure babushka for the grey areas of Bash"; + longDescription = '' + The main idea behind babashka is to leverage Clojure in places where you + would be using bash otherwise. + + As one user described it: + + I’m quite at home in Bash most of the time, but there’s a substantial + grey area of things that are too complicated to be simple in bash, but + too simple to be worth writing a clj/s script for. Babashka really + seems to hit the sweet spot for those cases. + + Goals: + + - Low latency Clojure scripting alternative to JVM Clojure. + - Easy installation: grab the self-contained binary and run. No JVM needed. + - Familiarity and portability: + - Scripts should be compatible with JVM Clojure as much as possible + - Scripts should be platform-independent as much as possible. Babashka + offers support for linux, macOS and Windows. + - Allow interop with commonly used classes like java.io.File and System + - Multi-threading support (pmap, future, core.async) + - Batteries included (tools.cli, cheshire, ...) + - Library support via popular tools like the clojure CLI + ''; + homepage = "https://github.com/borkdude/babashka"; + license = licenses.epl10; + platforms = graalvm8.meta.platforms; + maintainers = with maintainers; [ bandresen bhougland DerGuteMoritz jlesquembre ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/clojure/clooj.nix b/nixpkgs/pkgs/development/interpreters/clojure/clooj.nix new file mode 100644 index 000000000000..d51fa76003b2 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojure/clooj.nix @@ -0,0 +1,30 @@ +{ stdenv, fetchurl, jre, makeWrapper }: + +let version = "0.4.4"; in + +stdenv.mkDerivation { + pname = "clooj"; + inherit 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..39db54babe44 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojure/default.nix @@ -0,0 +1,70 @@ +{ stdenv, fetchurl, installShellFiles, jdk, rlwrap, makeWrapper }: + +stdenv.mkDerivation rec { + pname = "clojure"; + version = "1.10.1.645"; + + src = fetchurl { + url = "https://download.clojure.org/install/clojure-tools-${version}.tar.gz"; + sha256 = "1z6a9an8ls992y4japmzdxay7c5d2z9s2q1xl4g615r23jwpcsf9"; + }; + + nativeBuildInputs = [ + installShellFiles + makeWrapper + ]; + + installPhase = + let + binPath = stdenv.lib.makeBinPath [ rlwrap jdk ]; + in + '' + mkdir -p $out/libexec + cp clojure-tools-${version}.jar $out/libexec + cp example-deps.edn $out + cp deps.edn $out + cp clj_exec.clj $out + + substituteInPlace clojure --replace PREFIX $out + + install -Dt $out/bin clj clojure + wrapProgram $out/bin/clj --prefix PATH : $out/bin:${binPath} + wrapProgram $out/bin/clojure --prefix PATH : $out/bin:${binPath} + + installManPage clj.1 clojure.1 + ''; + + doInstallCheck = true; + installCheckPhase = '' + CLJ_CONFIG=$out CLJ_CACHE=$out/libexec $out/bin/clojure \ + -Spath \ + -Sverbose \ + -Scp $out/libexec/clojure-tools-${version}.jar + ''; + 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; [ jlesquembre ]; + 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..122831e80cc0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/default.nix @@ -0,0 +1,287 @@ +{ stdenv +, lib +, fetchurl +, clojure +, gnutar +, nodejs +, jre +, unzip +, nodePackages +, xcbuild +, python +, openssl +, pkgs +, fetchgit +, darwin +}: +let + version = "1.10.1"; + nodeVersion = "11.13.0"; + nodeSources = fetchurl { + url = "https://nodejs.org/dist/v${nodeVersion}/node-v${nodeVersion}.tar.gz"; + sha256 = "1cjzjbshxnysxkvbf41p3m8298cnhs9kfvdczgvvvlp6w16x4aac"; + }; + 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; }; + 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 { + inherit version; + pname = "lumo"; + + src = fetchgit { + url = "https://github.com/anmonteiro/lumo.git"; + rev = "${version}"; + sha256 = "12agi6bacqic2wq6q3l28283badzamspajmajzqm7fbdl2aq1a4p"; + }; + + buildInputs = [ + nodejs + clojure + jre + unzip + python + openssl + gnutar + nodePackages."lumo-build-deps-../interpreters/clojurescript/lumo" + ] + ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ + ApplicationServices + xcbuild + ] + ); + + patches = [ ./no_mangle.patch ./mkdir_promise.patch ]; + + postPatch = '' + substituteInPlace $NIX_BUILD_TOP/lumo/vendor/nexe/exe.js \ + --replace 'glob.sync(dir + "/*")' 'glob.sync(dir + "/../*")' + ''; + + 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/node/${nodeVersion} + cp ${nodeSources} tmp/node/${nodeVersion}/node-${nodeVersion}.tar.gz + tar -C ./tmp/node/${nodeVersion} -xf ${nodeSources} --warning=no-unknown-keyword + mv ./tmp/node/${nodeVersion}/node-v${nodeVersion}/* ./tmp/node/${nodeVersion}/ + rm -rf ${lumo-internal-classpath} + cp -rf target ${lumo-internal-classpath} + node scripts/package.js ${nodeVersion} + rm -rf target + mv ${lumo-internal-classpath} target + + # Step 7: AOT Macros + sh scripts/aot-bundle-macros.sh + + # Step 8: Package executeable 2nd time + 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 ++ stdenv.lib.platforms.darwin; + }; +} 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..7a2faee1d7a5 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/deps.edn @@ -0,0 +1,12 @@ +{:deps + {org.clojure/clojure {:mvn/version "1.10.1"} + org.clojure/clojurescript {:mvn/version "1.10.520"} + org.clojure/test.check {:mvn/version "0.10.0-alpha4"} + 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.17" + :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..4f3beff3b819 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/deps.nix @@ -0,0 +1,392 @@ +# generated by clj2nix-1.0.4 +{ pkgs }: + +let repos = [ + "https://repo.clojars.org/" + "https://repo1.maven.org/" + "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 = "f28178179483531862afae13e246386f8fda081afa523d3c4ea3a083ab607d23575d38ecb9ec0ee7f4d65cbe39a119f680e6de4669bc9cf593aa92be0c61562b"; + version = "1.10.1"; + }; + } + + { + 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 = "d844ab63d28cb5e31657cc38e574bbc7072a78419c997f25445ac6ea4a719904a4f4844b37e3f664a8d2e49bd38ff1006a9e8c6e63fb4e2f0a2322d6c2638275"; + version = "0.6.17"; + }; + } + + { + name = "org.clojure/clojurescript"; + path = pkgs.fetchMavenArtifact { + inherit repos; + artifactId = "clojurescript"; + groupId = "org.clojure"; + sha512 = "b241959d6bd2ab659920965d301508226e26b3edcee469e4cd516cd4ed014b1a6b132c17ee7d96a8e66fe27fd01a74813ac8b85958d260f9fdbbeb4348d57ff1"; + version = "1.10.520"; + }; + } + + { + 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 = "4e410c4a90a869e98d5d69a8a6dd6427e9d77b70e1a2b54cf24baf23389f22e7a208375783c2fdc5c1a5acfb8511a5c5ed57ad1a946d5bffd203f453d90a6155"; + version = "0.0.14"; + }; + } + + { + 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 = "60fa3bd38c32cf193c573f1bd47c6abd7e7a5bb2fc7f7f9f97aa9dcd54d5e2eab9e351f5f83b01bb96b32811a9f2f5ab384c6b7b7ebbb6c86d1ad4f2789351bf"; + version = "0.10.0-alpha4"; + }; + } + + { + 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/mkdir_promise.patch b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/mkdir_promise.patch new file mode 100644 index 000000000000..e9504bb5c1a0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/mkdir_promise.patch @@ -0,0 +1,20 @@ +diff --git a/vendor/nexe/exe.js b/vendor/nexe/exe.js +index 21e78bb..ecbfca4 100644 +--- a/vendor/nexe/exe.js ++++ b/vendor/nexe/exe.js +@@ -254,9 +254,7 @@ return initModule._compile(${JSON.stringify(source)}, process.execPath); + */ + + function makeOutputDirectory(next) { +- mkdirp(path.dirname(options.output), function() { +- next(); +- }); ++ mkdirp(path.dirname(options.output)).then(() => next()); + }, + + /** +@@ -1107,4 +1105,3 @@ exports.package = function(path, options) { + + return obj; + } +- diff --git a/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/no_mangle.patch b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/no_mangle.patch new file mode 100644 index 000000000000..9af223411958 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/no_mangle.patch @@ -0,0 +1,13 @@ +diff --git a/scripts/bundle.js b/scripts/bundle.js +index 16425a4..0d510fc 100644 +--- a/scripts/bundle.js ++++ b/scripts/bundle.js +@@ -73,6 +73,8 @@ const plugins = [ + if (!isDevBuild) { + plugins.push( + babelMinify({ ++ evaluate: false, ++ mangle: false, + comments: false, + removeConsole: true, + removeDebugger: true, 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..acfd5c4ed498 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/clojurescript/lumo/package.json @@ -0,0 +1,51 @@ +{ + "name": "lumo-build-deps", + "version": "1.10.1", + "dependencies": { + "@babel/core": "^7.1.5", + "@babel/plugin-external-helpers": "7.8.3", + "@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.8.3", + "@babel/runtime": "^7.1.5", + "async": "^3.1.1", + "async-retry": "^1.2.3", + "babel-core": "^7.0.0-bridge.0", + "babel-eslint": "10.0.3", + "babel-jest": "^25.1.0", + "babel-loader": "^8.0.4", + "babel-plugin-transform-flow-strip-types": "6.22.0", + "browserify": "^16.2.3", + "chalk": "^3.0.0", + "colors": "^1.3.3", + "cross-env": "7.0.0", + "death": "^1.1.0", + "flow-bin": "0.118.0", + "google-closure-compiler-js": "20170910.0.1", + "glob": "^7.1.3", + "gunzip-maybe": "^1.4.1", + "insert-module-globals": "^7.2.0", + "jszip": "2.x", + "mkdirp": "^1.0.3", + "ncp": "^2.0.0", + "node-fetch": "^2.2.1", + "paredit.js": "0.3.6", + "posix-getopt": "github:anmonteiro/node-getopt#master", + "prettier": "1.19.1", + "progress": "^2.0.0", + "read-pkg": "^5.2.0", + "request": "^2.88.0", + "rollup": "^1.9.0", + "rollup-plugin-babel": "^4.3.2", + "rollup-plugin-babel-minify": "^9.1.1", + "rollup-plugin-commonjs": "^10.0.0", + "rollup-plugin-node-resolve": "^5.0.0", + "rollup-plugin-replace": "^2.1.1", + "tar-stream": "^2.0.1", + "webpack": "^4.25.1", + "webpack-cli": "^3.2.3", + "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..050e7f14979c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/dart/default.nix @@ -0,0 +1,93 @@ +{ stdenv, fetchurl, unzip, version ? "2.7.2" }: + +let + + sources = let + + base = "https://storage.googleapis.com/dart-archive/channels"; + stable_version = "stable"; + dev_version = "dev"; + x86_64 = "x64"; + i686 = "ia32"; + aarch64 = "arm64"; + + in { + "1.24.3-x86_64-linux" = fetchurl { + url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${x86_64}-release.zip"; + sha256 = "16sm02wbkj328ni0z1z4n4msi12lb8ijxzmbbfamvg766mycj8z3"; + }; + "1.24.3-i686-linux" = fetchurl { + url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${i686}-release.zip"; + sha256 = "0a559mfpb0zfd49zdcpld95h2g1lmcjwwsqf69hd9rw6j67qyyyn"; + }; + "1.24.3-aarch64-linux" = fetchurl { + url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${aarch64}-release.zip"; + sha256 = "1p5bn04gr91chcszgmw5ng8mlzgwsrdr2v7k7ppwr1slkx97fsrh"; + }; + "2.7.2-x86_64-linux" = fetchurl { + url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${x86_64}-release.zip"; + sha256 = "0vvsgda1smqdjn35yiq9pxx8f5haxb4hqnspcsfs6sn5c36k854v"; + }; + "2.7.2-i686-linux" = fetchurl { + url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${i686}-release.zip"; + sha256 = "0dj01d2wwrp3cc5x73vs6fzhs6db60gkbjlrw3w9j04wcx69i38m"; + }; + "2.7.2-aarch64-linux" = fetchurl { + url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${aarch64}-release.zip"; + sha256 = "1p66fkdh1kv0ypmadmg67c3y3li3aaf1lahqh2g6r6qrzbh5da2p"; + }; + "2.9.0-4.0.dev-x86_64-linux" = fetchurl { + url = "${base}/${dev_version}/release/${version}/sdk/dartsdk-linux-${x86_64}-release.zip"; + sha256 = "16d9842fb3qbc0hy0zmimav9zndfkq96glgykj20xssc88qpjk2r"; + }; + "2.9.0-4.0.dev-i686-linux" = fetchurl { + url = "${base}/${dev_version}/release/${version}/sdk/dartsdk-linux-${i686}-release.zip"; + sha256 = "105wgyxmi491c7qw0z3zhn4lv52h80ngyz4ch9dyj0sq8nndz2rc"; + }; + "2.9.0-4.0.dev-aarch64-linux" = fetchurl { + url = "${base}/${dev_version}/release/${version}/sdk/dartsdk-linux-${aarch64}-release.zip"; + sha256 = "1x6mlmc4hccmx42k7srhma18faxpxvghjwqahna80508rdpljwgc"; + }; + }; + +in + +with stdenv.lib; + +stdenv.mkDerivation { + + pname = "dart"; + inherit 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 = makeLibraryPath [ stdenv.cc.cc ]; + + dontStrip = true; + + meta = { + homepage = "https://www.dartlang.org/"; + maintainers = with maintainers; [ grburst ]; + 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. + ''; + platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ]; + license = licenses.bsd3; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix b/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix new file mode 100644 index 000000000000..b4401a85d141 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix @@ -0,0 +1,25 @@ +{ buildDhallPackage, lib }: + +# This is a minor variation on `buildDhallPackage` that splits the `code` +# argument into `src` and `file` in such a way that you can easily override +# the `file` +# +# This function is used by `dhall-to-nixpkgs` when given a directory +lib.makeOverridable + ( { # Arguments passed through to `buildDhallPackage` + name + , dependencies ? [] + , source ? false + + , src + , # The file to import, relative to the root directory + file ? "package.dhall" + }: + + buildDhallPackage { + inherit name dependencies source; + + code = "${src}/${file}"; + } + ) + diff --git a/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-github-package.nix b/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-github-package.nix new file mode 100644 index 000000000000..9289e9b656d3 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-github-package.nix @@ -0,0 +1,50 @@ +{ buildDhallPackage, fetchFromGitHub, lib }: + +# This function is used by `dhall-to-nixpkgs` when given a GitHub repository +lib.makeOverridable + ( { # Arguments passed through to `buildDhallPackage` + name + , dependencies ? [] + , source ? false + + , # The directory containing the Dhall files, if other than the root of the + # repository + directory ? "" + , # The file to import, relative to the above directory + file ? "package.dhall" + + # Arguments passed through to `fetchFromGitHub` + , owner + , repo + , rev + # Extra arguments passed through to `fetchFromGitHub`, such as the hash + # or `fetchSubmodules` + , ... + }@args: + + buildDhallPackage { + inherit name dependencies source; + + code = + let + src = fetchFromGitHub ({ + name = "${name}-source"; + + inherit owner repo rev; + } // removeAttrs args [ + "name" + "dependencies" + "source" + "directory" + "file" + "owner" + "repo" + "rev" + ]); + + prefix = lib.optionalString (directory != "") "${directory}/"; + + in + "${src}/${prefix}${file}"; + } + ) diff --git a/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-package.nix b/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-package.nix new file mode 100644 index 000000000000..9303244eb885 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/dhall/build-dhall-package.nix @@ -0,0 +1,74 @@ +{ dhall, haskell, lib, lndir, runCommand, writeText }: + +{ name + + # Expressions to add to the cache before interpreting the code +, dependencies ? [] + + # A Dhall expression + # + # Carefully note that the following expression must be devoid of uncached HTTP + # imports. This is because the expression will be evaluated using an + # interpreter with HTTP support disabled, so all HTTP imports have to be + # protected by an integrity check that can be satisfied via cached + # dependencies. + # + # You can add a dependency to the cache using the preceding `dependencies` + # option +, code + + # `buildDhallPackage` can include both a "source distribution" in + # `source.dhall` and a "binary distribution" in `binary.dhall`: + # + # * `source.dhall` is a dependency-free αβ-normalized Dhall expression + # + # * `binary.dhall` is an expression of the form: `missing sha256:${HASH}` + # + # This expression requires you to install the cache product located at + # `.cache/dhall/1220${HASH}` to successfully resolve + # + # By default, `buildDhallPackage` only includes "binary.dhall" to conserve + # space within the Nix store, but if you set the following `source` option to + # `true` then the package will also include `source.dhall`. +, source ? false +}: + +let + # HTTP support is disabled in order to force that HTTP dependencies are built + # using Nix instead of using Dhall's support for HTTP imports. + dhallNoHTTP = haskell.lib.appendConfigureFlag dhall "-f-with-http"; + + file = writeText "${name}.dhall" code; + + cache = ".cache"; + + cacheDhall = "${cache}/dhall"; + + sourceFile = "source.dhall"; + +in + runCommand name { inherit dependencies; } '' + set -eu + + mkdir -p ${cacheDhall} + + for dependency in $dependencies; do + ${lndir}/bin/lndir -silent $dependency/${cacheDhall} ${cacheDhall} + done + + export XDG_CACHE_HOME=$PWD/${cache} + + mkdir -p $out/${cacheDhall} + + ${dhallNoHTTP}/bin/dhall --alpha --file '${file}' > $out/${sourceFile} + + SHA_HASH=$(${dhallNoHTTP}/bin/dhall hash <<< $out/${sourceFile}) + + HASH_FILE="''${SHA_HASH/sha256:/1220}" + + ${dhallNoHTTP}/bin/dhall encode --file $out/${sourceFile} > $out/${cacheDhall}/$HASH_FILE + + echo "missing $SHA_HASH" > $out/binary.dhall + + ${lib.optionalString (!source) "rm $out/${sourceFile}"} + '' diff --git a/nixpkgs/pkgs/development/interpreters/duktape/default.nix b/nixpkgs/pkgs/development/interpreters/duktape/default.nix new file mode 100644 index 000000000000..53cbbad8e553 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/duktape/default.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + pname = "duktape"; + version = "2.5.0"; + src = fetchurl { + url = "http://duktape.org/duktape-${version}.tar.xz"; + sha256 = "05ln6b2a0s8ynz28armwqs2r5zjyi3cxi0dx6ahnxlqw19b13m43"; + }; + + 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 = "https://duktape.org/"; + downloadPage = "https://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..cfd3bbbda4c3 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/eff/default.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchFromGitHub, which, ocamlPackages }: + +let version = "5.0"; in + +stdenv.mkDerivation { + + pname = "eff"; + inherit version; + + src = fetchFromGitHub { + owner = "matijapretnar"; + repo = "eff"; + rev = "v${version}"; + sha256 = "1fslfj5d7fhj3f7kh558b8mk5wllwyq4rnhfkyd96fpy144sdcka"; + }; + + postPatch = '' + substituteInPlace setup.ml --replace js_of_ocaml.ocamlbuild js_of_ocaml-ocamlbuild + ''; + + buildInputs = [ which ] ++ (with ocamlPackages; [ + ocaml findlib ocamlbuild menhir js_of_ocaml js_of_ocaml-ocamlbuild + ]); + + doCheck = true; + checkTarget = "test"; + + meta = with stdenv.lib; { + homepage = "https://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.10.nix b/nixpkgs/pkgs/development/interpreters/elixir/1.10.nix new file mode 100644 index 000000000000..04f4b5af240b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/1.10.nix @@ -0,0 +1,9 @@ +{ mkDerivation }: + +# How to obtain `sha256`: +# nix-prefetch-url --unpack https://github.com/elixir-lang/elixir/archive/v${version}.tar.gz +mkDerivation { + version = "1.10.4"; + sha256 = "16j4rmm3ix088fvxhvyjqf1hnfg7wiwa87gml3b2mrwirdycbinv"; + minimumOTPVersion = "21"; +} 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..10ebd5438a11 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/1.7.nix @@ -0,0 +1,7 @@ +{ mkDerivation }: + +mkDerivation { + version = "1.7.4"; + sha256 = "0f8j4pib13kffiihagdwl3xqs3a1ak19qz3z8fpyfxn9dnjiinla"; + minimumOTPVersion = "19"; +} diff --git a/nixpkgs/pkgs/development/interpreters/elixir/1.8.nix b/nixpkgs/pkgs/development/interpreters/elixir/1.8.nix new file mode 100644 index 000000000000..931fa50b1f72 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/1.8.nix @@ -0,0 +1,7 @@ +{ mkDerivation }: + +mkDerivation { + version = "1.8.2"; + sha256 = "1n77cpcl2b773gmj3m9s24akvj9gph9byqbmj2pvlsmby4aqwckq"; + minimumOTPVersion = "20"; +} diff --git a/nixpkgs/pkgs/development/interpreters/elixir/1.9.nix b/nixpkgs/pkgs/development/interpreters/elixir/1.9.nix new file mode 100644 index 000000000000..4eead35bae37 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/1.9.nix @@ -0,0 +1,9 @@ +{ mkDerivation }: + +# How to obtain `sha256`: +# nix-prefetch-url --unpack https://github.com/elixir-lang/elixir/archive/v${version}.tar.gz +mkDerivation { + version = "1.9.4"; + sha256 = "1l4318g35y4h0vi2w07ayc3jizw1xc3s7hdb47w6j3iw33y06g6b"; + minimumOTPVersion = "20"; +} 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..f821baf66c5d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/elixir/generic-builder.nix @@ -0,0 +1,74 @@ +{ pkgs, stdenv, fetchFromGitHub, erlang, 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"; } +} @ args: + +let + inherit (stdenv.lib) getVersion versionAtLeast optional; + +in + assert versionAtLeast (getVersion erlang) minimumOTPVersion; + + stdenv.mkDerivation ({ + name = "${baseName}-${version}"; + + inherit src version; + + buildInputs = [ erlang makeWrapper ]; + + LANG = "C.UTF-8"; + LC_TYPE = "C.UTF-8"; + + setupHook = ./setup-hook.sh; + + inherit debugInfo; + + buildFlags = optional debugInfo "ERL_COMPILER_OPTIONS=debug_info"; + + preBuild = '' + 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" + ''; + + pos = builtins.unsafeGetAttrPos "sha256" args; + 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; [ havvy couchemar ankhers filalex77 ]; + }; + }) 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..c94528e674f4 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/R16B02-basho.nix @@ -0,0 +1,65 @@ +{ pkgs, mkDerivation }: + +mkDerivation { + 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 = "https://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..e9d9366851eb --- /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 { + 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..d5f3afe5f3df --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/R19.nix @@ -0,0 +1,19 @@ +{ mkDerivation, fetchpatch }: + +mkDerivation { + 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`' "''${MACOSX_DEPLOYMENT_TARGET:-10.12}" + ''; +} diff --git a/nixpkgs/pkgs/development/interpreters/erlang/R20.nix b/nixpkgs/pkgs/development/interpreters/erlang/R20.nix new file mode 100644 index 000000000000..3a33e55767b4 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/R20.nix @@ -0,0 +1,10 @@ +{ mkDerivation }: + +mkDerivation { + version = "20.3.8.9"; + sha256 = "0v2iiyzss8hiih98wvj0gi2qzdmmhh7bvc9p025wlfm4k7r1109a"; + + prePatch = '' + substituteInPlace configure.in --replace '`sw_vers -productVersion`' "''${MACOSX_DEPLOYMENT_TARGET:-10.12}" + ''; +} diff --git a/nixpkgs/pkgs/development/interpreters/erlang/R21.nix b/nixpkgs/pkgs/development/interpreters/erlang/R21.nix new file mode 100644 index 000000000000..fdd034fc6075 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/R21.nix @@ -0,0 +1,10 @@ +{ mkDerivation }: + +mkDerivation { + version = "21.3.8.3"; + sha256 = "1szybirrcpqsl2nmlmpbkxjqnm6i7l7bma87m5cpwi0kpvlxwmcw"; + + prePatch = '' + substituteInPlace configure.in --replace '`sw_vers -productVersion`' "''${MACOSX_DEPLOYMENT_TARGET:-10.12}" + ''; +} diff --git a/nixpkgs/pkgs/development/interpreters/erlang/R22.nix b/nixpkgs/pkgs/development/interpreters/erlang/R22.nix new file mode 100644 index 000000000000..7596ad9e2f10 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/R22.nix @@ -0,0 +1,13 @@ +{ mkDerivation }: + +# How to obtain `sha256`: +# nix-prefetch-url --unpack https://github.com/erlang/otp/archive/OTP-${version}.tar.gz +mkDerivation { + version = "22.3"; + sha256 = "0srbyncgnr1kp0rrviq14ia3h795b3gk0iws5ishv6rphcq1rs27"; + + prePatch = '' + substituteInPlace make/configure.in --replace '`sw_vers -productVersion`' "''${MACOSX_DEPLOYMENT_TARGET:-10.12}" + substituteInPlace erts/configure.in --replace '-Wl,-no_weak_imports' "" + ''; +} diff --git a/nixpkgs/pkgs/development/interpreters/erlang/R23.nix b/nixpkgs/pkgs/development/interpreters/erlang/R23.nix new file mode 100644 index 000000000000..d42508c2ef96 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/R23.nix @@ -0,0 +1,13 @@ +{ mkDerivation }: + +# How to obtain `sha256`: +# nix-prefetch-url --unpack https://github.com/erlang/otp/archive/OTP-${version}.tar.gz +mkDerivation { + version = "23.0.3"; + sha256 = "133aw1ffkxdf38na3smmvn5qwwlalh4r4a51793h1wkhdzkyl6mv"; + + prePatch = '' + substituteInPlace make/configure.in --replace '`sw_vers -productVersion`' "''${MACOSX_DEPLOYMENT_TARGET:-10.12}" + substituteInPlace erts/configure.in --replace '-Wl,-no_weak_imports' "" + ''; +} 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..18b658ae37ce --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/erlang/generic-builder.nix @@ -0,0 +1,151 @@ +{ pkgs, stdenv, fetchFromGitHub, makeWrapper, gawk, gnum4, gnused +, libxml2, libxslt, ncurses, openssl, perl, autoconf +# TODO: use jdk https://github.com/NixOS/nixpkgs/pull/89731 +, openjdk8 ? null # javacSupport +, unixODBC ? null # odbcSupport +, libGL ? null, libGLU ? null, wxGTK ? null, wxmac ? null, xorg ? null # wxSupport +, parallelBuild ? false +, 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 ? [ openjdk8 ] +, odbcSupport ? false, odbcPackages ? [ unixODBC ] +, wxSupport ? true, wxPackages ? [ libGL libGLU 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 libGL != null && libGLU != null && wxGTK != null && xorg != null); + +assert odbcSupport -> unixODBC != null; +assert javacSupport -> openjdk8 != 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 = [ autoconf 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; + + # On some machines, parallel build reliably crashes on `GEN asn1ct_eval_ext.erl` step + enableParallelBuilding = parallelBuild; + + # 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" + ++ configureFlags; + + # 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 = "https://www.erlang.org/"; + downloadPage = "https://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. + ''; + + platforms = platforms.unix; + maintainers = with maintainers; [ sjmackenzie couchemar gleber ]; + license = licenses.asl20; + } // meta); +} +// optionalAttrs (preUnpack != "") { inherit preUnpack; } +// optionalAttrs (postUnpack != "") { inherit postUnpack; } +// optionalAttrs (patches != []) { inherit patches; } +// optionalAttrs (patchPhase != "") { inherit patchPhase; } +// 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/evcxr/default.nix b/nixpkgs/pkgs/development/interpreters/evcxr/default.nix new file mode 100644 index 000000000000..11b9cd1ba505 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/evcxr/default.nix @@ -0,0 +1,30 @@ +{ cargo, fetchFromGitHub, makeWrapper, pkgconfig, rustPlatform, stdenv, gcc, Security, cmake }: + +rustPlatform.buildRustPackage rec { + pname = "evcxr"; + version = "0.5.3"; + + src = fetchFromGitHub { + owner = "google"; + repo = "evcxr"; + rev = "v${version}"; + sha256 = "144xqi19d2nj9qgmhpx6d1kfhx9vfkmk7rnq6nzybpx4mbbl3ki2"; + }; + + cargoSha256 = "07lzxh0wh6azrlzfaacg29zmkn8jdnkdqbwgd5ajy79y8nii3c7z"; + + nativeBuildInputs = [ pkgconfig makeWrapper cmake ]; + buildInputs = stdenv.lib.optional stdenv.isDarwin Security; + postInstall = '' + wrapProgram $out/bin/evcxr --prefix PATH : ${stdenv.lib.makeBinPath [ cargo gcc ]} + wrapProgram $out/bin/evcxr_jupyter --prefix PATH : ${stdenv.lib.makeBinPath [ cargo gcc ]} + rm $out/bin/testing_runtime + ''; + + meta = with stdenv.lib; { + description = "An evaluation context for Rust"; + homepage = "https://github.com/google/evcxr"; + license = licenses.asl20; + maintainers = with maintainers; [ protoben ma27 ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/falcon/default.nix b/nixpkgs/pkgs/development/interpreters/falcon/default.nix new file mode 100644 index 000000000000..39d4918a70bf --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/falcon/default.nix @@ -0,0 +1,23 @@ +{ stdenv, fetchFromGitHub, cmake, pkgconfig, pcre, zlib, sqlite }: + +stdenv.mkDerivation { + pname = "falcon"; + 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..58653fae8908 --- /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 { + pname = "gauche"; + version = "0.9.9"; + + src = fetchurl { + url = "mirror://sourceforge/gauche/Gauche-${version}.tgz"; + sha256 = "1yzpszhw52vkpr65r5d4khf3489mnnvnw58dd2wsvvx7499k5aac"; + }; + + 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=${cacert}/etc/ssl/certs/ca-bundle.crt" + # 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..f01cfc2444bc --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/gnu-apl/default.nix @@ -0,0 +1,46 @@ +{ stdenv, fetchurl, readline, gettext, ncurses }: + +stdenv.mkDerivation rec { + pname = "gnu-apl"; + version = "1.8"; + + src = fetchurl { + url = "mirror://gnu/apl/apl-${version}.tar.gz"; + sha256 = "1jxvv2h3y1am1fw6r5sn3say1n0dj8shmscbybl0qhqdia2lqkql"; + }; + + buildInputs = [ readline gettext ncurses ]; + + # Needed with GCC 8 + NIX_CFLAGS_COMPILE = with stdenv.lib; toString ((optionals stdenv.cc.isGNU [ + "-Wno-error=int-in-bool-context" + "-Wno-error=class-memaccess" + "-Wno-error=restrict" + "-Wno-error=format-truncation" + ]) ++ optional 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..97e997bdd693 --- /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 { + pname = "groovy"; + version = "3.0.3"; + + src = fetchurl { + url = "http://dl.bintray.com/groovy/maven/apache-groovy-binary-${version}.zip"; + sha256 = "0xdm70b61pdj8z3g08az16y9b6cpz5hv7iwvwfyfyxrjdi47h419"; + }; + + 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..4a8330f2749c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/gtk-server/default.nix @@ -0,0 +1,34 @@ +{ stdenv, fetchurl +, glib +, gtk3 +, libffcall +, pkgconfig +, wrapGAppsHook +}: + +stdenv.mkDerivation rec { + pname = "gtk-server"; + version = "2.4.5"; + + src = fetchurl { + url = "https://www.gtk-server.org/stable/gtk-server-${version}.tar.gz"; + sha256 = "0vlx5ibvc7hyc8yipjgvrx1azvmh42i9fv1khg3dvn09nrdkrc7f"; + }; + + preConfigure = '' + cd src + ''; + + nativeBuildInputs = [ pkgconfig wrapGAppsHook ]; + buildInputs = [ libffcall glib gtk3 ]; + + configureOptions = [ "--with-gtk3" ]; + + meta = with stdenv.lib; { + description = "gtk-server for interpreted GUI programming"; + homepage = "http://www.gtk-server.org/"; + license = licenses.gpl2Plus; + maintainers = [ maintainers.tohl ]; + platforms = 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..6057480476f2 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/1.8.nix @@ -0,0 +1,80 @@ +{ stdenv, pkgsBuildBuild, 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) + pkgsBuildBuild.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..5b26b38dbd4e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/2.0.nix @@ -0,0 +1,127 @@ +{ stdenv, pkgsBuildBuild, 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) + pkgsBuildBuild.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) + ++ stdenv.lib.optionals stdenv.isDarwin [ + (fetchpatch { + url = "https://gitlab.gnome.org/GNOME/gtk-osx/raw/52898977f165777ad9ef169f7d4818f2d4c9b731/patches/guile-clocktime.patch"; + sha256 = "12wvwdna9j8795x59ldryv9d84c1j3qdk2iskw09306idfsis207"; + }) + ./filter-mkostemp-darwin.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 && !stdenv.hostPlatform.isMusl) "-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 = stdenv.shell; + CONFIG_SHELL = stdenv.shell; +}) 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..68df200835fa --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/default.nix @@ -0,0 +1,112 @@ +{ stdenv, pkgsBuildBuild, buildPackages +, fetchurl, makeWrapper, gawk, pkgconfig +, libffi, libtool, readline, gmp, boehmgc, libunistring +, coverageAnalysis ? null +, fetchpatch +}: + +# 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.7"; + + src = fetchurl { + url = "mirror://gnu/guile/${name}.tar.xz"; + sha256 = "013mydzhfswqci6xmyc1ajzd59pfbdak15i0b090nhr9bzm7dxyd"; + }; + + outputs = [ "out" "dev" "info" ]; + setOutputFlags = false; # $dev gets into the library otherwise + + depsBuildBuild = [ buildPackages.stdenv.cc ] + ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + pkgsBuildBuild.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 + ] ++ stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch + ++ stdenv.lib.optional stdenv.isDarwin (fetchpatch { + url = "https://gitlab.gnome.org/GNOME/gtk-osx/raw/52898977f165777ad9ef169f7d4818f2d4c9b731/patches/guile-clocktime.patch"; + sha256 = "12wvwdna9j8795x59ldryv9d84c1j3qdk2iskw09306idfsis207"; + }); + + # 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/filter-mkostemp-darwin.patch b/nixpkgs/pkgs/development/interpreters/guile/filter-mkostemp-darwin.patch new file mode 100644 index 000000000000..8b9b853fb00d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/guile/filter-mkostemp-darwin.patch @@ -0,0 +1,28 @@ +Filter incompat. mkostemp(3) flags on macOS 10.12 + +macOS Sierra introduces a mkostemp(3) function which is used when +present. Contrary to the GNUlib version of mkostemp(3) that was used +previously, this version fails with 'invalid argument' when flags other +than from a specified set are passed. From mktemp(3): + +| The mkostemp() function is like mkstemp() but allows specifying +| additional open(2) flags (defined in <fcntl.h>). The permitted flags +| are O_APPEND, O_SHLOCK, O_EXLOCK and O_CLOEXEC. + +Signed-off-by: Clemens Lang <cal@macports.org> +Upstream-Status: Submitted [https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24862#23] +--- a/libguile/filesys.c.orig 2017-01-09 00:53:27.000000000 +0100 ++++ b/libguile/filesys.c 2017-01-09 00:54:48.000000000 +0100 +@@ -1486,6 +1486,12 @@ + mode_bits = scm_i_mode_bits (mode); + } + ++#ifdef __APPLE__ ++ /* macOS starting with 10.12 defines mkostemp(2) which is used if defined, ++ * but only accepts some flags according to its manpage. It fails with ++ * invalid argument when other flags are passed. */ ++ open_flags &= O_APPEND | O_SHLOCK | O_EXLOCK | O_CLOEXEC; ++#endif + SCM_SYSCALL (rv = mkostemp (c_tmpl, open_flags)); + if (rv == -1) + SCM_SYSERROR; 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..6bb3910aaff4 --- /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..4b3541fcc7f0 --- /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..d006b50ce8ef --- /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..35463b161572 --- /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..a8890b048fbe --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/hy/default.nix @@ -0,0 +1,37 @@ +{ stdenv, python3Packages }: + +python3Packages.buildPythonApplication rec { + pname = "hy"; + version = "0.19.0"; + + src = python3Packages.fetchPypi { + inherit pname version; + sha256 = "05k05qmiiysiwdc05sxmanwhv1crfwbb3l8swxfisbzbvmv1snis"; + }; + + checkInputs = with python3Packages; [ flake8 pytest ]; + + propagatedBuildInputs = with python3Packages; [ + appdirs + astor + clint + colorama + fastentrypoints + funcparserlib + rply + pygments + ]; + + # Hy does not include tests in the source distribution from PyPI, so only test executable. + checkPhase = '' + $out/bin/hy --help > /dev/null + ''; + + meta = with stdenv.lib; { + description = "A LISP dialect embedded in Python"; + homepage = "http://hylang.org/"; + license = licenses.mit; + maintainers = with maintainers; [ nixy ]; + platforms = 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..d85448a9677c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/icon-lang/default.nix @@ -0,0 +1,46 @@ +{ stdenv, fetchFromGitHub, fetchpatch, libX11, libXt, withGraphics ? true }: + +stdenv.mkDerivation rec { + pname = "icon-lang"; + version = "9.5.1"; + src = fetchFromGitHub { + owner = "gtownsend"; + repo = "icon"; + rev = "rel${builtins.replaceStrings ["."] [""] version}"; + sha256 = "1gkvj678ldlr1m5kjhx6zpmq11nls8kxa7pyy64whgakfzrypynw"; + }; + + buildInputs = stdenv.lib.optionals withGraphics [ libX11 libXt ]; + + patches = [ + # Patch on git master, likely won't be necessary in future release + (fetchpatch { + url = "https://github.com/gtownsend/icon/commit/bfc4a6004d0d3984c8066289b8d8e563640c4ddd.patch"; + sha256 = "1pqapjghk10rb73a1mfflki2wipjy4kvnravhmrilkqzb9hd6v8m"; + excludes = [ + "doc/relnotes.htm" + "src/h/version.h" + ]; + }) + ]; + + configurePhase = + let + _name = if stdenv.isDarwin then "macintosh" else "linux"; + in + '' + make ${stdenv.lib.optionalString withGraphics "X-"}Configure name=${_name} + ''; + + installPhase = '' + make Install dest=$out + ''; + + meta = with stdenv.lib; { + description = ''A very high level general-purpose programming language''; + maintainers = with maintainers; [ vrthra yurrriq ]; + platforms = with platforms; linux ++ darwin; + 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..42af3cc427b4 --- /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, libGL, 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 libGL 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 + maggesi + 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..b7f8b63d54ad --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/j/default.nix @@ -0,0 +1,78 @@ +{ stdenv, fetchFromGitHub, readline, libedit, bc +, avxSupport ? stdenv.hostPlatform.avxSupport +}: + +stdenv.mkDerivation rec { + pname = "j"; + version = "901"; + jtype = "release-f"; + src = fetchFromGitHub { + owner = "jsoftware"; + repo = "jsource"; + rev = "j${version}-${jtype}"; + sha256 = "1776021m0j1aanzwg60by83n53pw7i6afd5wplfzczwk8bywax4p"; + name = "jsource"; + }; + + 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"; + variant = if stdenv.isx86_64 && avxSupport then "avx" else ""; + + j64x="j${bits}${variant}"; + + doCheck = true; + + # Causes build failure due to warning + hardeningDisable = stdenv.lib.optional stdenv.cc.isClang "strictoverflow"; + + buildPhase = '' + export SOURCE_DIR=$(pwd) + export HOME=$TMPDIR + export JLIB=$SOURCE_DIR/jlibrary + + echo $OUT_DIR + + cd make2 + + patchShebangs . + sed -i $JLIB/bin/profile.ijs -e "s@'/usr/share/j/.*'@'$out/share/j'@;" + + j64x="${j64x}" ./build_all.sh + + cp $SOURCE_DIR/bin/${platform}/j${bits}*/* "$JLIB/bin" + ''; + + checkPhase = '' + + echo 'i. 5' | $JLIB/bin/jconsole | fgrep "0 1 2 3 4" + + # Now run the real tests + cd $SOURCE_DIR/test + for f in *.ijs + do + echo $f + $JLIB/bin/jconsole < $f > /dev/null || echo FAIL && echo PASS + done + ''; + + installPhase = '' + mkdir -p "$out" + + 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/janet/default.nix b/nixpkgs/pkgs/development/interpreters/janet/default.nix new file mode 100644 index 000000000000..113a582392fe --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/janet/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchFromGitHub, meson, ninja }: + +stdenv.mkDerivation rec { + pname = "janet"; + version = "1.12.2"; + + src = fetchFromGitHub { + owner = "janet-lang"; + repo = pname; + rev = "v${version}"; + sha256 = "0if514zdmbjvvrsa9x5yfvg2b14sz53yaka12g3yhwkq8ls3qk0c"; + }; + + nativeBuildInputs = [ meson ninja ]; + mesonFlags = [ "-Dgit_hash=release" ]; + + doCheck = true; + + meta = with stdenv.lib; { + description = "Janet programming language"; + homepage = "https://janet-lang.org/"; + license = licenses.mit; + platforms = platforms.all; + maintainers = with maintainers; [ andrewchambers ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/jelly/default.nix b/nixpkgs/pkgs/development/interpreters/jelly/default.nix new file mode 100644 index 000000000000..a317f35d2a78 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/jelly/default.nix @@ -0,0 +1,28 @@ +{ lib, python3Packages, fetchFromGitHub }: + +python3Packages.buildPythonApplication { + pname = "jelly"; + version = "0.1.31"; + + src = fetchFromGitHub { + owner = "DennisMitchell"; + repo = "jellylanguage"; + rev = "70c9fd93ab009c05dc396f8cc091f72b212fb188"; + sha256 = "1rpclqagvigp5qhvgnjavvy463f1drshnc1mfxm6z7ygzs0l0yz6"; + }; + + propagatedBuildInputs = [ python3Packages.sympy ]; + + # checks are disabled because jelly has no tests, and the default is to run + # the output binary with no arguments, which exits with status 1 and causes + # the build to fail + doCheck = false; + + meta = with lib; { + description = "A recreational programming language inspired by J"; + homepage = https://github.com/DennisMitchell/jellylanguage; + license = licenses.mit; + maintainers = [ maintainers.tckmn ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/jimtcl/default.nix b/nixpkgs/pkgs/development/interpreters/jimtcl/default.nix new file mode 100644 index 000000000000..d803fe43fd7a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/jimtcl/default.nix @@ -0,0 +1,59 @@ +{ stdenv, fetchFromGitHub, sqlite, readline, asciidoc, SDL, SDL_gfx }: + +let + makeSDLFlags = map (p: "-I${stdenv.lib.getDev p}/include/SDL"); + +in stdenv.mkDerivation rec { + pname = "jimtcl"; + version = "0.79"; + + src = fetchFromGitHub { + owner = "msteveb"; + repo = "jimtcl"; + rev = version; + sha256 = "1k88hz0v3bi19xdvlp0i9nsx38imzwpjh632w7326zwbv2wldf0h"; + }; + + nativeBuildInputs = [ + asciidoc + ]; + + buildInputs = [ + sqlite readline SDL SDL_gfx + ]; + + configureFlags = [ + "--shared" + "--with-ext=oo" + "--with-ext=tree" + "--with-ext=binary" + "--with-ext=sqlite3" + "--with-ext=readline" + "--with-ext=sdl" + "--with-ext=json" + "--enable-utf8" + "--ipv6" + ]; + + NIX_CFLAGS_COMPILE = toString (makeSDLFlags [ SDL SDL_gfx ]); + + enableParallelBuilding = true; + + doCheck = true; + preCheck = '' + # test exec2-3.2 fails depending on platform or sandboxing (?) + rm tests/exec2.test + ''; + + postInstall = '' + ln -sr $out/lib/libjim.so.${version} $out/lib/libjim.so + ''; + + 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..7f773882d8f9 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/joker/default.nix @@ -0,0 +1,30 @@ +{ stdenv, buildGoModule, fetchFromGitHub }: + +buildGoModule rec { + pname = "joker"; + version = "0.15.6"; + + src = fetchFromGitHub { + rev = "v${version}"; + owner = "candid82"; + repo = "joker"; + sha256 = "1yi9q8ibia6gz6s30i3bjrbmlhj6knrb3d73113dxrs8abi1mkbh"; + }; + + vendorSha256 = "031ban30kx84r54fj9aq96pwkz9nqh4p9yzs4l8i1wqmy52rldvl"; + + doCheck = false; + + preBuild = '' + go generate ./... + ''; + + subPackages = [ "." ]; + + meta = with stdenv.lib; { + homepage = "https://github.com/candid82/joker"; + description = "A small Clojure interpreter and linter written in Go"; + license = licenses.epl10; + maintainers = with maintainers; [ andrestylianos ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/jruby/default.nix b/nixpkgs/pkgs/development/interpreters/jruby/default.nix new file mode 100644 index 000000000000..8d27bfb64f8b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/jruby/default.nix @@ -0,0 +1,67 @@ +{ 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" "5" "7" ""; +jruby = stdenv.mkDerivation rec { + pname = "jruby"; + + version = "9.2.13.0"; + + src = fetchurl { + url = "https://s3.amazonaws.com/jruby.org/downloads/${version}/jruby-bin-${version}.tar.gz"; + sha256 = "0n5glz6xm3skrfihzn3g5awdxpjsqn2k8k46gv449rk2l50w5a3k"; + }; + + 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 + ''; + + postFixup = '' + PATH=$out/bin:$PATH patchShebangs $out/bin + ''; + + passthru = rec { + rubyEngine = "jruby"; + gemPath = "lib/${rubyEngine}/gems/${rubyVersion.libDir}"; + libPath = "lib/${rubyEngine}/${rubyVersion.libDir}"; + }; + + meta = with stdenv.lib; { + description = "Ruby interpreter written in Java"; + homepage = "http://jruby.org/"; + license = with licenses; [ cpl10 gpl2 lgpl21 ]; + platforms = platforms.unix; + maintainers = [ maintainers.fzakaria ]; + }; +}; +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..35af365c1f7d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/jython/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, makeWrapper, jre }: + +stdenv.mkDerivation rec { + pname = "jython"; + + version = "2.7.2b3"; + + src = fetchurl { + url = "http://search.maven.org/remotecontent?filepath=org/python/jython-standalone/${version}/jython-standalone-${version}.jar"; + sha256 = "142285hd9mx0nx5zw0jvkpqkb4kbhgyyy52p5bj061ya8bg5jizy"; + }; + + buildInputs = [ makeWrapper ]; + + dontUnpack = true; + + 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 = "https://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..041616cc1f63 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/kona/default.nix @@ -0,0 +1,21 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + pname = "kona"; + 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/1.3.nix b/nixpkgs/pkgs/development/interpreters/lfe/1.3.nix new file mode 100644 index 000000000000..52df5c025447 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lfe/1.3.nix @@ -0,0 +1,43 @@ +{ fetchpatch, mkDerivation }: + +let + _fetchpatch = + { rev, sha256 }: + fetchpatch { + url = "https://github.com/rvirding/lfe/commit/${rev}.patch"; + inherit sha256; + }; + fetchPatches = map _fetchpatch; +in + +mkDerivation { + version = "1.3"; + sha256 = "0pgwi0h0d34353m39jin8dxw4yykgfcg90k6pc4qkjyrg40hh4l6"; + maximumOTPVersion = "21"; + patches = fetchPatches [ + { + rev = "b457e5d521bb35008e6049fab31b4073cc10d583"; + sha256 = "1zrq1b3291xhb0jsirgb5s8hacq5xvz7xidsp29aqcnpazdvivdc"; + } + { + rev = "5fe9f37741b7d53bd43109fd3435e1437f124a0d"; + sha256 = "1anqlcbih52lc0wynf58r67w1jhn264lz49rczwgh19pqg92dvqf"; + } + { + rev = "b8f3e06511cb6805cf3a904c1589b27f33f3958d"; + sha256 = "1zqafc0asm9m6cq7r0brvfawv69fqggy1phif3zknjmpicf25pqf"; + } + { + rev = "40c239a608460e55563edb68c1b6faca57518b54"; + sha256 = "03av5115jwyammw337xzy50l6api5h0wbwwda5vzw0w10zwb2z8y"; + } + { + rev = "5faa7106419263689bfc0bc08a7451ccb1fba718"; + sha256 = "0ml5yh5b3rn4ympks4bpx409hkra0i79zvq80azk0kmbjd869fxp"; + } + { + rev = "9ff978693babcfd043d741b5c6940920b8315892"; + sha256 = "04968dmp527wbkdv7dqpaj3nsyjls93whc1b5hx73b39dvl3n3y1"; + } + ]; +} diff --git a/nixpkgs/pkgs/development/interpreters/lfe/dedup-ebins.patch b/nixpkgs/pkgs/development/interpreters/lfe/dedup-ebins.patch new file mode 100644 index 000000000000..44e3733c4165 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lfe/dedup-ebins.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile b/Makefile +index 59f2c06..5ee8f6e 100644 +--- a/Makefile ++++ b/Makefile +@@ -60,7 +60,7 @@ ESRCS = $(notdir $(wildcard $(SRCDIR)/*.erl)) + XSRCS = $(notdir $(wildcard $(SRCDIR)/*.xrl)) + YSRCS = $(notdir $(wildcard $(SRCDIR)/*.yrl)) + LSRCS = $(notdir $(wildcard $(LSRCDIR)/*.lfe)) +-EBINS = $(ESRCS:.erl=.beam) $(XSRCS:.xrl=.beam) $(YSRCS:.yrl=.beam) ++EBINS = $(sort $(ESRCS:.erl=.beam) $(XSRCS:.xrl=.beam) $(YSRCS:.yrl=.beam)) + LBINS = $(LSRCS:.lfe=.beam) + + CSRCS = $(notdir $(wildcard $(CSRCDIR)/*.c)) 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..ba42c2d59d56 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lfe/generic-builder.nix @@ -0,0 +1,93 @@ +{ 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"; } +, patches ? [] +}: + +let + inherit (stdenv.lib) + assertMsg makeBinPath optionalString + getVersion versionAtLeast versionOlder versions; + + mainVersion = versions.major (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 (assertMsg (versionAtLeast maximumOTPVersion mainVersion)) '' + LFE ${version} is supported on OTP <=${maximumOTPVersion}, not ${mainVersion}. +''; + +buildRebar3 { + name = baseName; + + inherit src version; + + buildInputs = [ erlang makeWrapper ]; + beamDeps = [ proper ]; + patches = [ ./no-test-deps.patch ./dedup-ebins.patch ] ++ patches; + doCheck = true; + checkTarget = "travis"; + + makeFlags = [ "-e" "MANDB=''" "PREFIX=$$out"]; + + # These installPhase tricks are based on Elixir's Makefile. + # TODO: Make, upload, and apply a patch. + installPhase = optionalString (versionOlder version "1.3") '' + 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 ":" "${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..bd4b93b835fc --- /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 { + + pname = "lolcode"; + 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..dbe3f6fa2df0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/love/0.10.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchFromBitbucket, pkgconfig, SDL2, libGLU, libGL, openal, luajit, + libdevil, freetype, physfs, libmodplug, mpg123, libvorbis, libogg, + libtheora, which, autoconf, automake, libtool +}: + +let + pname = "love"; + version = "0.10.2"; +in + +stdenv.mkDerivation { + name = "${pname}-${version}"; + src = fetchFromBitbucket { + owner = "rude"; + repo = "love"; + rev = version; + sha256 = "19yfmlcx6w8yi4ndm5lni8lrsvnn77bxw5py0dc293nzzlaqa9ym"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + SDL2 libGLU libGL 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-gl-prototypes.patch b/nixpkgs/pkgs/development/interpreters/love/0.7-gl-prototypes.patch new file mode 100644 index 000000000000..0b6778f6a90b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/love/0.7-gl-prototypes.patch @@ -0,0 +1,21 @@ +diff --unified --recursive --text love-HEAD.orig/src/modules/graphics/opengl/Framebuffer.cpp love-HEAD.new/src/modules/graphics/opengl/Framebuffer.cpp +--- love-HEAD.orig/src/modules/graphics/opengl/Framebuffer.cpp 2019-03-14 12:46:55.032982224 -0400 ++++ love-HEAD.new/src/modules/graphics/opengl/Framebuffer.cpp 2019-03-14 12:47:22.356175299 -0400 +@@ -1,3 +1,5 @@ ++#define GL_GLEXT_PROTOTYPES ++ + #include "Framebuffer.h" + #include <common/Matrix.h> + +diff --unified --recursive --text love-HEAD.orig/src/modules/graphics/opengl/SpriteBatch.cpp love-HEAD.new/src/modules/graphics/opengl/SpriteBatch.cpp +--- love-HEAD.orig/src/modules/graphics/opengl/SpriteBatch.cpp 2019-03-14 12:46:55.032982224 -0400 ++++ love-HEAD.new/src/modules/graphics/opengl/SpriteBatch.cpp 2019-03-14 12:47:33.346119890 -0400 +@@ -18,6 +18,8 @@ + * 3. This notice may not be removed or altered from any source distribution. + **/ + ++#define GL_GLEXT_PROTOTYPES ++ + #include "SpriteBatch.h" + + // STD 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..6f09c0764412 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/love/0.7.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchurl, pkgconfig +, SDL, libGLU, libGL, openal, lua +, libdevil, freetype, physfs +, libmodplug, mpg123, libvorbis, libogg +, libmng +}: + +stdenv.mkDerivation rec { + name = "love-0.7.2"; + src = fetchurl { + url = "https://bitbucket.org/rude/love/downloads/${name}-linux-src.tar.gz"; + sha256 = "0s7jywkvydlshlgy11ilzngrnybmq5xlgzp2v2dhlffwrfqdqym5"; + }; + + # see discussion on arch linux user repository (https://aur.archlinux.org/packages/love07/?setlang=cs#comment-684696) + patches = [ ./0.7-gl-prototypes.patch ]; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + SDL libGLU libGL openal lua + libdevil freetype physfs libmodplug mpg123 libvorbis libogg libmng + ]; + + 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..3a6c385ee5fc --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/love/0.8.nix @@ -0,0 +1,55 @@ +{ stdenv, fetchurl, pkgconfig +, SDL, libGLU, libGL, openal, lua +, libdevil, freetype, physfs +, libmodplug, mpg123, libvorbis, libogg +}: + +stdenv.mkDerivation rec { + pname = "love"; + version = "0.8.0"; + + src = fetchurl { + url = "https://bitbucket.org/rude/love/downloads/${pname}-${version}-linux-src.tar.gz"; + sha256 = "1k4fcsa8zzi04ja179bmj24hvqcbm3icfvrvrzyz2gw9qwfclrwi"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + SDL libGLU libGL 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 = toString [ + "-I${SDL.dev}/include/SDL" + "-I${freetype.dev}include/freetype2" + "-DGL_GLEXT_PROTOTYPES" # https://community.khronos.org/t/glgenbuffers-was-not-declared-in-this-scope/59283/2 + ]; + + 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..79b83f0643f1 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/love/0.9.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchurl, pkgconfig +, SDL2, libGLU, libGL, 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 libGL 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 ]; + broken = true; + }; +} 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..2ef3a4ca05a4 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/love/11.1.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchFromBitbucket, pkgconfig, SDL2, libGLU, libGL, openal, luajit, + libdevil, freetype, physfs, libmodplug, mpg123, libvorbis, libogg, + libtheora, which, autoconf, automake, libtool +}: + +let + pname = "love"; + version = "11.3"; +in + +stdenv.mkDerivation { + name = "${pname}-${version}"; + src = fetchFromBitbucket { + owner = "rude"; + repo = "love"; + rev = version; + sha256 = "18gfp65ngb8k8g7hgbw2bhrwk2i7m56m21d39pk4484q9z8p4vm7"; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + SDL2 libGLU libGL 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.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.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/CVE-2014-5461.patch b/nixpkgs/pkgs/development/interpreters/lua-5/CVE-2014-5461.patch new file mode 100644 index 000000000000..31d3b8bdee76 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/CVE-2014-5461.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/CVE-2019-6706.patch b/nixpkgs/pkgs/development/interpreters/lua-5/CVE-2019-6706.patch new file mode 100644 index 000000000000..89e81b7eb68b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/CVE-2019-6706.patch @@ -0,0 +1,22 @@ +--- a/src/lapi.c ++++ b/src/lapi.c +@@ -1285,14 +1285,14 @@ LUA_API void *lua_upvalueid (lua_State * + + LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, + int fidx2, int n2) { +- LClosure *f1; +- UpVal **up1 = getupvalref(L, fidx1, n1, &f1); ++ UpVal **up1 = getupvalref(L, fidx1, n1, NULL); /* the last parameter not needed */ + UpVal **up2 = getupvalref(L, fidx2, n2, NULL); ++ if (*up1 == *up2) return; /* Already joined */ ++ (*up2)->refcount++; ++ if (upisopen(*up2)) (*up2)->u.open.touched = 1; ++ luaC_upvalbarrier(L, *up2); + luaC_upvdeccount(L, *up1); + *up1 = *up2; +- (*up1)->refcount++; +- if (upisopen(*up1)) (*up1)->u.open.touched = 1; +- luaC_upvalbarrier(L, *up1); + } + + diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/build-lua-package.nix b/nixpkgs/pkgs/development/interpreters/lua-5/build-lua-package.nix new file mode 100644 index 000000000000..98a98c0dd348 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/build-lua-package.nix @@ -0,0 +1,251 @@ +# Generic builder for lua packages +{ lib +, lua +, wrapLua +# Whether the derivation provides a lua module or not. +, toLuaModule +}: + +{ +name ? "${attrs.pname}-${attrs.version}" + +, version + +# by default prefix `name` e.g. "lua5.2-${name}" +, namePrefix ? if lua.pkgs.isLuaJIT + then lua.name + "-" + else "lua" + lua.luaversion + "-" + +# Dependencies for building 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 ? [] +, propagatedNativeBuildInputs ? [] + +# used to disable derivation, useful for specific lua versions +# TODO move from this setting meta.broken to a 'disabled' attribute on the +# package, then use that to skip/include in each lua${ver}Packages set? +, disabled ? false + +# Additional arguments to pass to the makeWrapper function, which wraps +# generated binaries. +, makeWrapperArgs ? [] + +# Skip wrapping of lua programs altogether +, dontWrapLuaPrograms ? false + +, meta ? {} + +, passthru ? {} +, doCheck ? false + +# Non-Lua / system (e.g. C library) dependencies. Is a list of deps, where +# each dep is either a derivation, or an attribute set like +# { name = "rockspec external_dependencies key"; dep = derivation; } +# The latter is used to work-around luarocks having a problem with +# multiple-output derivations as external deps: +# https://github.com/luarocks/luarocks/issues/766<Paste> +, externalDeps ? lib.unique (lib.filter (drv: !drv ? luaModule) (propagatedBuildInputs ++ buildInputs)) + +# Appended to the generated luarocks config +, extraConfig ? "" +# Inserted into the generated luarocks config in the "variables" table +, extraVariables ? {} +# The two above arguments have access to builder variables -- e.g. to $out + +# relative to srcRoot, path to the rockspec to use when using rocks +, rockspecFilename ? "../*.rockspec" + +# must be set for packages that don't have a rock +, knownRockspec ? null + +, ... } @ attrs: + + +# Keep extra attributes from `attrs`, e.g., `patchPhase', etc. + +let + # TODO fix warnings "Couldn't load rockspec for ..." during manifest + # construction -- from initial investigation, appears it will require + # upstream luarocks changes to fix cleanly (during manifest construction, + # luarocks only looks for rockspecs in the default/system tree instead of all + # configured trees) + luarocks_config = "luarocks-config.lua"; + luarocks_content = let + extraVariablesStr = lib.concatStringsSep "\n " + (lib.mapAttrsToList (k: v: "${k}='${v}';") extraVariables); + in '' + local_cache = "" + -- To prevent collisions when creating environments, we install the rock + -- files into per-package subdirectories + rocks_subdir = '${rocksSubdir}' + -- Then we need to tell luarocks where to find the rock files per + -- dependency + rocks_trees = { + ${lib.concatStringsSep "\n, " rocksTrees} + } + '' + lib.optionalString lua.pkgs.isLuaJIT '' + -- Luajit provides some additional functionality built-in; this exposes + -- that to luarock's dependency system + rocks_provided = { + jit='${lua.luaversion}-1'; + ffi='${lua.luaversion}-1'; + luaffi='${lua.luaversion}-1'; + bit='${lua.luaversion}-1'; + } + '' + '' + -- For single-output external dependencies + external_deps_dirs = { + ${lib.concatStringsSep "\n, " externalDepsDirs} + } + variables = { + -- Some needed machinery to handle multiple-output external dependencies, + -- as per https://github.com/luarocks/luarocks/issues/766 + ${lib.optionalString (lib.length depVariables > 0) '' + ${lib.concatStringsSep "\n " depVariables}''} + ${extraVariablesStr} + } + ${extraConfig} + ''; + + rocksSubdir = "${attrs.pname}-${version}-rocks"; + + externalDepsDirs = map + (x: "'${builtins.toString x}'") + (lib.filter (lib.isDerivation) externalDeps); + + rocksTrees = lib.imap0 + (i: dep: "{ name = [[dep-${toString i}]], root = '${dep}', rocks_dir = '${dep}/${dep.rocksSubdir}' }") + requiredLuaRocks; + + # Filter out the lua derivation itself from the Lua module dependency + # closure, as it doesn't have a rock tree :) + requiredLuaRocks = lib.filter (d: d ? luaModule) + (lua.pkgs.requiredLuaModules propagatedBuildInputs); + + # Explicitly point luarocks to the relevant locations for multiple-output + # derivations that are external dependencies, to work around an issue it has + # (https://github.com/luarocks/luarocks/issues/766) + depVariables = lib.concatMap ({name, dep}: [ + "${name}_INCDIR='${lib.getDev dep}/include';" + "${name}_LIBDIR='${lib.getLib dep}/lib';" + "${name}_BINDIR='${lib.getBin dep}/bin';" + ]) externalDeps'; + + # example externalDeps': [ { name = "CRYPTO"; dep = pkgs.openssl; } ] + externalDeps' = lib.filter (dep: !lib.isDerivation dep) externalDeps; +in +toLuaModule ( lua.stdenv.mkDerivation ( +builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps" "extraVariables"] // { + + name = namePrefix + name; + + buildInputs = [ wrapLua lua.pkgs.luarocks ] + ++ buildInputs + ++ lib.optionals doCheck checkInputs + ++ (map (d: d.dep) externalDeps') + ; + + # propagate lua to active setup-hook in nix-shell + propagatedBuildInputs = propagatedBuildInputs ++ [ lua ]; + inherit doCheck; + + # @-patterns do not capture formal argument default values, so we need to + # explicitly inherit this for it to be available as a shell variable in the + # builder + inherit rockspecFilename; + inherit rocksSubdir; + + # enabled only for src.rock + setSourceRoot= let + name_only= lib.getName name; + in + lib.optionalString (knownRockspec == null) '' + # format is rockspec_basename/source_basename + # rockspec can set it via spec.source.dir + folder=$(find . -mindepth 2 -maxdepth 2 -type d -path '*${name_only}*/*'|head -n1) + sourceRoot="$folder" + ''; + + configurePhase = '' + runHook preConfigure + + cat > ${luarocks_config} <<EOF + ${luarocks_content} + EOF + export LUAROCKS_CONFIG="$PWD/${luarocks_config}"; + '' + + lib.optionalString (knownRockspec != null) '' + + # prevents the following type of error: + # Inconsistency between rockspec filename (42fm1b3d7iv6fcbhgm9674as3jh6y2sh-luv-1.22.0-1.rockspec) and its contents (luv-1.22.0-1.rockspec) + rockspecFilename="$TMP/$(stripHash ''${knownRockspec})" + cp ''${knownRockspec} "$rockspecFilename" + '' + + '' + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + + nix_debug "Using LUAROCKS_CONFIG=$LUAROCKS_CONFIG" + + LUAROCKS=luarocks + if (( ''${NIX_DEBUG:-0} >= 1 )); then + LUAROCKS="$LUAROCKS --verbose" + fi + + runHook postBuild + ''; + + postFixup = lib.optionalString (!dontWrapLuaPrograms) '' + wrapLuaPrograms + '' + attrs.postFixup or ''''; + + installPhase = attrs.installPhase or '' + runHook preInstall + + # work around failing luarocks test for Write access + mkdir -p $out + + # luarocks make assumes sources are available in cwd + # After the build is complete, it also installs the rock. + # If no argument is given, it looks for a rockspec in the current directory + # but some packages have several rockspecs in their source directory so + # we force the use of the upper level since it is + # the sole rockspec in that folder + # maybe we could reestablish dependency checking via passing --rock-trees + + nix_debug "ROCKSPEC $rockspecFilename" + nix_debug "cwd: $PWD" + $LUAROCKS make --deps-mode=all --tree=$out ''${rockspecFilename} + + runHook postInstall + ''; + + + checkPhase = attrs.checkPhase or '' + runHook preCheck + $LUAROCKS test + runHook postCheck + ''; + + passthru = { + inherit lua; # The lua interpreter + inherit externalDeps; + } // passthru; + + meta = with lib.maintainers; { + platforms = lua.meta.platforms; + # add extra maintainer(s) to every package + maintainers = (meta.maintainers or []) ++ [ ]; + broken = disabled; + } // meta; +})) diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/default.nix b/nixpkgs/pkgs/development/interpreters/lua-5/default.nix new file mode 100644 index 000000000000..7e79ff8f117a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/default.nix @@ -0,0 +1,68 @@ +# similar to interpreters/python/default.nix +{ stdenv, lib, callPackage, fetchurl, fetchpatch }: +let + dsoPatch51 = fetchurl { + url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/lua-arch.patch?h=packages/lua51"; + sha256 = "11fcyb4q55p4p7kdb8yp85xlw8imy14kzamp2khvcyxss4vw8ipw"; + name = "lua-arch.patch"; + }; + + dsoPatch52 = fetchurl { + url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/liblua.so.patch?h=packages/lua52"; + sha256 = "1by1dy4ql61f5c6njq9ibf9kaqm3y633g2q8j54iyjr4cxvqwqz9"; + name = "lua-arch.patch"; + }; + +in rec { + + lua5_3 = callPackage ./interpreter.nix { + sourceVersion = { major = "5"; minor = "3"; patch = "5"; }; + hash = "0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac"; + patches = + lib.optionals stdenv.isDarwin [ ./5.2.darwin.patch ] ++ [ + ./CVE-2019-6706.patch + ]; + postConfigure = lib.optionalString (!stdenv.isDarwin) '' + 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 $makeFlags "''${makeFlagsArray[@]}" liblua.so ) + ''; + }; + + lua5_3_compat = lua5_3.override({ + compat = true; + }); + + + lua5_2 = callPackage ./interpreter.nix { + sourceVersion = { major = "5"; minor = "2"; patch = "4"; }; + hash = "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"; + patches = if stdenv.isDarwin then [ ./5.2.darwin.patch ] else [ dsoPatch52 ]; + }; + + lua5_2_compat = lua5_2.override({ + compat = true; + }); + + + lua5_1 = callPackage ./interpreter.nix { + sourceVersion = { major = "5"; minor = "1"; patch = "5"; }; + hash = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333"; + patches = (if stdenv.isDarwin then [ ./5.1.darwin.patch ] else [ dsoPatch51 ]) + ++ [ ./CVE-2014-5461.patch ]; + }; + + luajit_2_0 = import ../luajit/2.0.nix { + self = luajit_2_0; + inherit callPackage lib; + }; + + luajit_2_1 = import ../luajit/2.1.nix { + self = luajit_2_1; + inherit callPackage; + }; + +} 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..a3e633bbab17 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/filesystem.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchurl, lua5 }: + +stdenv.mkDerivation { + version = "1.6.2"; + pname = "lua-filesystem"; + 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/interpreter.nix b/nixpkgs/pkgs/development/interpreters/lua-5/interpreter.nix new file mode 100644 index 000000000000..98e4684e0921 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/interpreter.nix @@ -0,0 +1,114 @@ +{ stdenv, fetchurl, readline +, compat ? false +, callPackage +, packageOverrides ? (self: super: {}) +, sourceVersion +, hash +, patches ? [] +, postConfigure ? null +, postBuild ? null +}: +let +luaPackages = callPackage ../../lua-modules {lua=self; overrides=packageOverrides;}; + +self = stdenv.mkDerivation rec { + pname = "lua"; + luaversion = with sourceVersion; "${major}.${minor}"; + version = "${luaversion}.${sourceVersion.patch}"; + + src = fetchurl { + url = "https://www.lua.org/ftp/${pname}-${version}.tar.gz"; + sha256 = hash; + }; + + LuaPathSearchPaths = luaPackages.getLuaPathList luaversion; + LuaCPathSearchPaths = luaPackages.getLuaCPathList luaversion; + setupHook = luaPackages.lua-setup-hook LuaPathSearchPaths LuaCPathSearchPaths; + + buildInputs = [ readline ]; + + inherit patches; + + # see configurePhase for additional flags (with space) + makeFlags = [ + "INSTALL_TOP=${placeholder "out"}" + "INSTALL_MAN=${placeholder "out"}/share/man/man1" + "R=${version}" + "LDFLAGS=-fPIC" + "V=${luaversion}" + ] ++ (if stdenv.isDarwin then [ + "PLAT=macosx" + ] else [ + "PLAT=linux" + ]) ++ (if stdenv.buildPlatform != stdenv.hostPlatform then [ + "CC=${stdenv.hostPlatform.config}-gcc" + "RANLIB=${stdenv.hostPlatform.config}-ranlib" + ] else []) + ; + + configurePhase = '' + runHook preConfigure + + makeFlagsArray+=(CFLAGS="-DLUA_USE_LINUX -O2 -fPIC${if compat then " -DLUA_COMPAT_ALL" else ""}" ) + makeFlagsArray+=(${stdenv.lib.optionalString stdenv.isDarwin "CC=\"$CC\""}${stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) " 'AR=${stdenv.hostPlatform.config}-ar rcu'"}) + + installFlagsArray=( TO_BIN="lua luac" INSTALL_DATA='cp -d' \ + TO_LIB="${if stdenv.isDarwin then "liblua.${version}.dylib" else "liblua.a liblua.so liblua.so.${luaversion} liblua.so.${version}"}" ) + + runHook postConfigure + ''; + inherit postConfigure; + + inherit postBuild; + + 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" + ''; + + passthru = rec { + buildEnv = callPackage ./wrapper.nix { + lua = self; + inherit (luaPackages) requiredLuaModules; + }; + withPackages = import ./with-packages.nix { inherit buildEnv luaPackages;}; + pkgs = luaPackages; + interpreter = "${self}/bin/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; + platforms = stdenv.lib.platforms.unix; + }; +}; +in self 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/setup-hook.nix b/nixpkgs/pkgs/development/interpreters/lua-5/setup-hook.nix new file mode 100644 index 000000000000..62caffd8d8a0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/setup-hook.nix @@ -0,0 +1,15 @@ +{ runCommand, lib, }: + +LuaPathSearchPaths: LuaCPathSearchPaths: + +let + hook = ./setup-hook.sh; +in runCommand "lua-setup-hook.sh" { + # hum doesn't seem to like caps !! BUG ? + luapathsearchpaths=lib.escapeShellArgs LuaPathSearchPaths; + luacpathsearchpaths=lib.escapeShellArgs LuaCPathSearchPaths; +} '' + cp ${hook} hook.sh + substituteAllInPlace hook.sh + mv hook.sh $out +'' diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/setup-hook.sh b/nixpkgs/pkgs/development/interpreters/lua-5/setup-hook.sh new file mode 100644 index 000000000000..1c445b82afde --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/setup-hook.sh @@ -0,0 +1,47 @@ +# set -e + +nix_print() { + if [ ${NIX_DEBUG:-0} -ge $1 ]; then + echo "$2" + fi +} + +nix_debug() { + nix_print 3 "$1" +} + +addToLuaSearchPathWithCustomDelimiter() { + local varName="$1" + local absPattern="$2" + # delete longest match starting from the lua placeholder '?' + local topDir="${absPattern%%\?*}" + + # export only if the folder exists else LUA_PATH/LUA_CPATH grow too large + if [[ ! -d "$topDir" ]]; then return; fi + + # export only if we haven't already got this dir in the search path + if [[ ${!varName-} == *"$absPattern"* ]]; then return; fi + + export "${varName}=${!varName:+${!varName};}${absPattern}" +} + +addToLuaPath() { + local dir="$1" + + if [[ ! -d "$dir" ]]; then + nix_debug "$dir not a directory abort" + return 0 + fi + cd "$dir" + for pattern in @luapathsearchpaths@; do + addToLuaSearchPathWithCustomDelimiter LUA_PATH "$PWD/$pattern" + done + + # LUA_CPATH + for pattern in @luacpathsearchpaths@; do + addToLuaSearchPathWithCustomDelimiter LUA_CPATH "$PWD/$pattern" + done + cd - >/dev/null +} + +addEnvHooks "$hostOffset" addToLuaPath 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..73fbbc3e66a6 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/sockets.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchurl, lua5 }: + +stdenv.mkDerivation rec { + pname = "lua-sockets"; + 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/with-packages.nix b/nixpkgs/pkgs/development/interpreters/lua-5/with-packages.nix new file mode 100644 index 000000000000..0e0fbd397358 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/with-packages.nix @@ -0,0 +1,4 @@ +{ buildEnv, luaPackages }: + +# this is a function that returns a function that returns an environment +f: let packages = f luaPackages; in buildEnv.override { extraLibs = packages; } diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/wrap-lua.nix b/nixpkgs/pkgs/development/interpreters/lua-5/wrap-lua.nix new file mode 100644 index 000000000000..f00e0d5ac336 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/wrap-lua.nix @@ -0,0 +1,19 @@ +{ lib +, lua +, makeSetupHook +, makeWrapper +}: + +with lib; + +# defined in trivial-builders.nix +# imported as wrapLua in lua-packages.nix and passed to build-lua-derivation to be used as buildInput +makeSetupHook { + deps = makeWrapper; + substitutions.executable = lua.interpreter; + substitutions.lua = lua; + substitutions.LuaPathSearchPaths = lib.escapeShellArgs lua.LuaPathSearchPaths; + substitutions.LuaCPathSearchPaths = lib.escapeShellArgs lua.LuaPathSearchPaths; + +} ./wrap.sh + diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/wrap.sh b/nixpkgs/pkgs/development/interpreters/lua-5/wrap.sh new file mode 100644 index 000000000000..5941ff4a6b98 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/wrap.sh @@ -0,0 +1,98 @@ +# Inspired by python/wrapper.nix +# Wrapper around wrapLuaProgramsIn, below. The $luaPath +# variable is passed in from the buildLuarocksPackage function. +set -e + +wrapLuaPrograms() { + wrapLuaProgramsIn "$out/bin" "$out $luaPath" +} + +# Builds environment variables like LUA_PATH and PATH walking through closure +# of dependencies. +buildLuaPath() { + local luaPath="$1" + local path + + # Create an empty table of paths (see doc on loadFromPropagatedInputs + # for how this is used). Build up the program_PATH and program_LUA_PATH + # variables. + declare -A luaPathsSeen=() + program_PATH= + luaPathsSeen["@lua@"]=1 + addToSearchPath program_PATH @lua@/bin + for path in $luaPath; do + addToLuaPath "$path" + done +} + +# 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). +# luaPath is a list of directories +wrapLuaProgramsIn() { + local dir="$1" + local luaPath="$2" + local f + + buildLuaPath "$luaPath" + + if [ ! -d "$dir" ]; then + nix_debug "$dir not a directory" + return + fi + + nix_debug "wrapping programs in [$dir]" + + # Find all regular files in the output directory that are executable. + find "$dir" -type f -perm -0100 -print0 | while read -d "" f; do + # Rewrite "#! .../env lua" to "#! /nix/store/.../lua". + # Strip suffix, like "3" or "2.7m" -- we don't have any choice on which + # Lua to use besides one with this hook anyway. + if head -n1 "$f" | grep -q '#!.*/env.*\(lua\)'; then + sed -i "$f" -e "1 s^.*/env[ ]*\(lua\)[^ ]*^#! @executable@^" + fi + + # wrapProgram creates the executable shell script described + # above. The script will set LUA_(C)PATH and PATH variables! + # (see pkgs/build-support/setup-hooks/make-wrapper.sh) + local -a wrap_args=("$f" + --prefix PATH ':' "$program_PATH" + --prefix LUA_PATH ';' "$LUA_PATH" + --prefix LUA_CPATH ';' "$LUA_CPATH" + ) + + # Add any additional arguments provided by makeWrapperArgs + # argument to buildLuaPackage. + # makeWrapperArgs + local -a user_args="($makeWrapperArgs)" + local -a wrapProgramArgs=("${wrap_args[@]}" "${user_args[@]}") + + # see setup-hooks/make-wrapper.sh + wrapProgram "${wrapProgramArgs[@]}" + + done +} + +# Adds the lib and bin directories to the LUA_PATH and PATH variables, +# respectively. Recurses on any paths declared in +# `propagated-native-build-inputs`, while avoiding duplicating paths by +# flagging the directories it has visited in `luaPathsSeen`. +loadFromPropagatedInputs() { + local dir="$1" + # Stop if we've already visited here. + if [ -n "${luaPathsSeen[$dir]}" ]; then + return + fi + luaPathsSeen[$dir]=1 + + addToLuaPath "$dir" + addToSearchPath program_PATH $dir/bin + + # Inspect the propagated inputs (if they exist) and recur on them. + local prop="$dir/nix-support/propagated-native-build-inputs" + if [ -e "$prop" ]; then + local new_path + for new_path in $(cat $prop); do + loadFromPropagatedInputs "$new_path" + done + fi +} diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/wrapper.nix b/nixpkgs/pkgs/development/interpreters/lua-5/wrapper.nix new file mode 100644 index 000000000000..53ec2baeb5e5 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lua-5/wrapper.nix @@ -0,0 +1,69 @@ +{ stdenv, lua, buildEnv, makeWrapper +, extraLibs ? [] +, extraOutputsToInstall ? [] +, postBuild ? "" +, ignoreCollisions ? false +, requiredLuaModules +, makeWrapperArgs ? [] +}: + +# Create a lua executable that knows about additional packages. +let + env = let + paths = requiredLuaModules (extraLibs ++ [ lua ] ); + in (buildEnv { + name = "${lua.name}-env"; + + inherit paths; + inherit ignoreCollisions; + extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall; + + # we create wrapper for the binaries in the different packages + postBuild = '' + if [ -L "$out/bin" ]; then + unlink "$out/bin" + fi + mkdir -p "$out/bin" + + addToLuaPath "$out" + + # take every binary from lua packages and put them into the env + for path in ${stdenv.lib.concatStringsSep " " paths}; do + nix_debug "looking for binaries in path = $path" + 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 + nix_debug "Making wrapper $prg" + makeWrapper "$path/bin/$prg" "$out/bin/$prg" --suffix LUA_PATH ';' "$LUA_PATH" --suffix LUA_CPATH ';' "$LUA_CPATH" ${stdenv.lib.concatStringsSep " " makeWrapperArgs} + fi + fi + done + fi + done + '' + postBuild; + + inherit (lua) meta; + + passthru = lua.passthru // { + interpreter = "${env}/bin/lua"; + inherit lua; + env = stdenv.mkDerivation { + name = "interactive-${lua.name}-environment"; + nativeBuildInputs = [ env ]; + + buildCommand = '' + echo >&2 "" + echo >&2 "*** lua 'env' attributes are intended for interactive nix-shell sessions, not for building! ***" + echo >&2 "" + exit 1 + ''; + }; + }; + }).overrideAttrs (_: { + # Add extra deps needed for postBuild hook. + nativeBuildInputs = [ makeWrapper lua ]; + }); +in env 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/2.0.nix b/nixpkgs/pkgs/development/interpreters/luajit/2.0.nix new file mode 100644 index 000000000000..afb5dd9c5b64 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/luajit/2.0.nix @@ -0,0 +1,12 @@ +{ self, callPackage, lib }: +callPackage ./default.nix { + inherit self; + version = "2.0.5-2020-08-09"; + rev = "e296f56"; + isStable = true; + sha256 = "0g4wvpmmrxj8ir6yi86gg93khy8ri7x4w091jihpxsmn670da21f"; + extraMeta = { # this isn't precise but it at least stops the useless Hydra build + platforms = with lib; filter (p: p != "aarch64-linux") + (platforms.linux ++ platforms.darwin); + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/luajit/2.1.nix b/nixpkgs/pkgs/development/interpreters/luajit/2.1.nix new file mode 100644 index 000000000000..cb0320c7c7cf --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/luajit/2.1.nix @@ -0,0 +1,8 @@ +{ self, callPackage }: +callPackage ./default.nix { + inherit self; + version = "2.1.0-2020-08-27"; + rev = "ff1e72a"; + isStable = false; + sha256 = "0rlh5y48jbxnamr3a5i3szzh7y9ycvq052rw6m82gdhrb1jlamdz"; +} diff --git a/nixpkgs/pkgs/development/interpreters/luajit/default.nix b/nixpkgs/pkgs/development/interpreters/luajit/default.nix new file mode 100644 index 000000000000..9658186b9c09 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/luajit/default.nix @@ -0,0 +1,109 @@ +{ stdenv, fetchFromGitHub, buildPackages +, name ? "luajit-${version}" +, isStable +, sha256 +, rev +, version +, extraMeta ? {} +, callPackage +, self +, packageOverrides ? (self: super: {}) +, enableFFI ? true +, enableJIT ? true +, enableJITDebugModule ? enableJIT +, enableGC64 ? stdenv.hostPlatform.isAarch64 +, enable52Compat ? false +, enableValgrindSupport ? false +, valgrind ? null +, enableGDBJITSupport ? false +, enableAPICheck ? false +, enableVMAssertions ? false +, useSystemMalloc ? false +}: +assert enableJITDebugModule -> enableJIT; +assert enableGDBJITSupport -> enableJIT; +assert enableValgrindSupport -> valgrind != null; +let + luaPackages = callPackage ../../lua-modules {lua=self; overrides=packageOverrides;}; + + XCFLAGS = with stdenv.lib; + optional (!enableFFI) "-DLUAJIT_DISABLE_FFI" + ++ optional (!enableJIT) "-DLUAJIT_DISABLE_JIT" + ++ optional enable52Compat "-DLUAJIT_ENABLE_LUA52COMPAT" + ++ optional (!enableGC64) "-DLUAJIT_DISABLE_GC64" + ++ optional useSystemMalloc "-DLUAJIT_USE_SYSMALLOC" + ++ optional enableValgrindSupport "-DLUAJIT_USE_VALGRIND" + ++ optional enableGDBJITSupport "-DLUAJIT_USE_GDBJIT" + ++ optional enableAPICheck "-DLUAJIT_USE_APICHECK" + ++ optional enableVMAssertions "-DLUAJIT_USE_ASSERT" + ; +in +stdenv.mkDerivation rec { + inherit name version; + src = fetchFromGitHub { + owner = "LuaJIT"; + repo = "LuaJIT"; + inherit sha256 rev; + }; + + luaversion = "5.1"; + + postPatch = '' + substituteInPlace Makefile --replace ldconfig : + if test -n "''${dontStrip-}"; then + # CCDEBUG must be non-empty or everything will be stripped, -g being + # passed by nixpkgs CC wrapper is insufficient on its own + substituteInPlace src/Makefile --replace "#CCDEBUG= -g" "CCDEBUG= -g" + fi + ''; + + configurePhase = false; + + buildInputs = stdenv.lib.optional enableValgrindSupport valgrind; + + buildFlags = [ + "amalg" # Build highly optimized version + ]; + makeFlags = [ + "PREFIX=$(out)" + "DEFAULT_CC=cc" + "CROSS=${stdenv.cc.targetPrefix}" + # TODO: when pointer size differs, we would need e.g. -m32 + "HOST_CC=${buildPackages.stdenv.cc}/bin/cc" + ] ++ stdenv.lib.optional enableJITDebugModule "INSTALL_LJLIBD=$(INSTALL_LMOD)"; + enableParallelBuilding = true; + NIX_CFLAGS_COMPILE = XCFLAGS; + + postInstall = '' + ( 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 + ''; + + LuaPathSearchPaths = [ + "lib/lua/${luaversion}/?.lua" "share/lua/${luaversion}/?.lua" + "share/lua/${luaversion}/?/init.lua" "lib/lua/${luaversion}/?/init.lua" + "share/${name}/?.lua" + ]; + LuaCPathSearchPaths = [ "lib/lua/${luaversion}/?.so" "share/lua/${luaversion}/?.so" ]; + setupHook = luaPackages.lua-setup-hook LuaPathSearchPaths LuaCPathSearchPaths; + + passthru = rec { + buildEnv = callPackage ../lua-5/wrapper.nix { + lua = self; + inherit (luaPackages) requiredLuaModules; + }; + withPackages = import ../lua-5/with-packages.nix { inherit buildEnv luaPackages;}; + pkgs = luaPackages; + interpreter = "${self}/bin/lua"; + }; + + meta = 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 lblasc ]; + } // extraMeta; +} diff --git a/nixpkgs/pkgs/development/interpreters/lush/default.nix b/nixpkgs/pkgs/development/interpreters/lush/default.nix new file mode 100644 index 000000000000..a8db08e87a2c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/lush/default.nix @@ -0,0 +1,29 @@ +{stdenv, fetchurl, libX11, xorgproto, indent, readline, gsl, freeglut, libGLU, libGL, 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 xorgproto indent readline gsl freeglut libGLU libGL 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..e4e984fc4ac6 --- /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, yices +}: + +let + + version = "3.0"; + + fullMaude = fetchurl { + url = "http://maude.cs.illinois.edu/w/images/0/04/Full-Maude-${version}.zip"; + sha256 = "0gf36wlkkl343vlxgryqdhxmgyn8z0cc2zayccd7ac3inmj1iayw"; + }; + +in + +stdenv.mkDerivation { + pname = "maude"; + inherit version; + + src = fetchurl { + url = "http://maude.cs.illinois.edu/w/images/9/92/Maude-${version}.tar.gz"; + sha256 = "0vhn3lsck6ji9skrgm67hqrn3k4f6y442q73jbw65qqznm321k5a"; + }; + + buildInputs = [ + flex bison ncurses buddy tecla gmpxx libsigsegv makeWrapper unzip cln yices + ]; + + 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" + ) + ''; + + 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-maude3.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.gpl2Plus; + + 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..66352cfdda4b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/metamath/default.nix @@ -0,0 +1,30 @@ +{ stdenv, fetchFromGitHub, autoreconfHook }: + +stdenv.mkDerivation { + pname = "metamath"; + version = "0.182"; + + buildInputs = [ autoreconfHook ]; + + src = fetchFromGitHub { + owner = "metamath"; + repo = "metamath-exe"; + rev = "5df616efe4119ff88daf77e7041d45b6fa39c578"; + sha256 = "0amjdgy42c7jypf6sz98iczlxcyl9bqx67ws1q8w2zdqk2izsyjp"; + }; + + 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/micropython/default.nix b/nixpkgs/pkgs/development/interpreters/micropython/default.nix new file mode 100644 index 000000000000..3293c4b9f58d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/micropython/default.nix @@ -0,0 +1,44 @@ +{ stdenv, lib, fetchFromGitHub, pkgconfig, libffi, python3, readline }: + +stdenv.mkDerivation rec { + pname = "micropython"; + version = "1.12"; + + src = fetchFromGitHub { + owner = "micropython"; + repo = "micropython"; + rev = "v${version}"; + sha256 = "1fsigdahnv5yn0mc7dr1y6h7g8ywg084pcgj6d64kb39w641n8j5"; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ pkgconfig python3 ]; + + buildInputs = [ libffi readline ]; + + doCheck = true; + + buildPhase = '' + make -C mpy-cross + make -C ports/unix + ''; + + checkPhase = '' + pushd tests + MICROPY_MICROPYTHON=../ports/unix/micropython ${python3.interpreter} ./run-tests + popd + ''; + + installPhase = '' + mkdir -p $out/bin + install -Dm755 ports/unix/micropython $out/bin/micropython + ''; + + meta = with lib; { + description = "A lean and efficient Python implementation for microcontrollers and constrained systems"; + homepage = "https://micropython.org"; + platforms = [ "x86_64-linux" ]; + license = licenses.mit; + maintainers = with maintainers; [ sgo ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/mujs/default.nix b/nixpkgs/pkgs/development/interpreters/mujs/default.nix new file mode 100644 index 000000000000..692aed3e4ee6 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/mujs/default.nix @@ -0,0 +1,23 @@ +{ stdenv, fetchurl, readline }: + +stdenv.mkDerivation rec { + pname = "mujs"; + version = "1.0.7"; + + src = fetchurl { + url = "https://mujs.com/downloads/mujs-${version}.tar.xz"; + sha256 = "1ilhay15z4k7mlzs6g2d00snivin7vp72dfw5wwpmc0x70jr31l2"; + }; + + buildInputs = [ readline ]; + + makeFlags = [ "prefix=$(out)" ]; + + meta = with stdenv.lib; { + homepage = "https://mujs.com/"; + description = "A lightweight, embeddable Javascript interpreter"; + platforms = platforms.unix; + 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..0c976f2f0b05 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/nix-exec/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchurl, pkgconfig, nix, git }: let + version = "4.1.6"; +in stdenv.mkDerivation { + pname = "nix-exec"; + inherit 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..d9766108596a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/octave/default.nix @@ -0,0 +1,167 @@ +{ stdenv +# Note: either stdenv.mkDerivation or, for octaveFull, the qt-5 mkDerivation +# with wrapQtAppsHook (comes from libsForQt5.callPackage) +, mkDerivation +, fetchurl +, gfortran +, ncurses +, perl +, flex +, texinfo +, qhull +, libsndfile +, portaudio +, libX11 +, graphicsmagick +, pcre +, pkgconfig +, libGL +, libGLU +, fltk +# Both are needed for discrete Fourier transform +, fftw +, fftwSinglePrec +, zlib +, curl +, qrupdate +, blas, lapack +, arpack +, libwebp +, gl2ps +, ghostscript ? null +, hdf5 ? null +, glpk ? null +, suitesparse ? null +, gnuplot ? null +# - Include support for GNU readline: +, enableReadline ? true +, readline ? null +# - Build Java interface: +, enableJava ? true +, jdk ? null +, python ? null +, overridePlatforms ? null +, sundials_2 ? null +# - Build Octave Qt GUI: +, enableQt ? false +, qtbase ? null +, qtsvg ? null +, qtscript ? null +, qscintilla ? null +, qttools ? null +# - JIT compiler for loops: +, enableJIT ? false +, llvm ? null +, libiconv +, darwin +}: + +assert (!blas.isILP64) && (!lapack.isILP64); + +mkDerivation rec { + version = "5.2.0"; + pname = "octave"; + + src = fetchurl { + url = "mirror://gnu/octave/${pname}-${version}.tar.gz"; + sha256 = "1qcmcpsq1lfka19fxzvxjwjhg113c39a9a0x8plkhvwdqyrn5sig"; + }; + + buildInputs = [ + readline + ncurses + perl + flex + qhull + graphicsmagick + pcre + fltk + zlib + curl + blas + lapack + libsndfile + fftw + fftwSinglePrec + portaudio + qrupdate + arpack + libwebp + gl2ps + ] + ++ (stdenv.lib.optionals enableQt [ + qtbase + qtsvg + qscintilla + ]) + ++ (stdenv.lib.optional (ghostscript != null) ghostscript) + ++ (stdenv.lib.optional (hdf5 != null) hdf5) + ++ (stdenv.lib.optional (glpk != null) glpk) + ++ (stdenv.lib.optional (suitesparse != null) suitesparse) + ++ (stdenv.lib.optional (enableJava) jdk) + ++ (stdenv.lib.optional (sundials_2 != null) sundials_2) + ++ (stdenv.lib.optional (gnuplot != null) gnuplot) + ++ (stdenv.lib.optional (python != null) python) + ++ (stdenv.lib.optionals (!stdenv.isDarwin) [ libGL libGLU libX11 ]) + ++ (stdenv.lib.optionals (stdenv.isDarwin) [ libiconv + darwin.apple_sdk.frameworks.Accelerate + darwin.apple_sdk.frameworks.Cocoa ]) + ; + nativeBuildInputs = [ + pkgconfig + gfortran + # Listed here as well because it's outputs are split + fftw + fftwSinglePrec + texinfo + ] + ++ (stdenv.lib.optional (sundials_2 != null) sundials_2) + ++ (stdenv.lib.optional enableJIT llvm) + ++ (stdenv.lib.optionals enableQt [ + qtscript + qttools + ]) + ; + + doCheck = !stdenv.isDarwin; + + enableParallelBuilding = true; + + # See https://savannah.gnu.org/bugs/?50339 + F77_INTEGER_8_FLAG = if blas.isILP64 then "-fdefault-integer-8" else ""; + + configureFlags = [ + "--with-blas=blas" + "--with-lapack=lapack" + (if blas.isILP64 then "--enable-64" else "--disable-64") + ] + ++ (if stdenv.isDarwin then [ "--enable-link-all-dependencies" ] else [ ]) + ++ stdenv.lib.optionals enableReadline [ "--enable-readline" ] + ++ stdenv.lib.optionals stdenv.isDarwin [ "--with-x=no" ] + ++ stdenv.lib.optionals enableQt [ "--with-qt=5" ] + ++ stdenv.lib.optionals enableJIT [ "--enable-jit" ] + ; + + # 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/${pname}-${version}-fntests.log || true + ''; + + passthru = { + inherit version; + sitePath = "share/octave/${version}/site"; + }; + + meta = { + homepage = "https://www.gnu.org/software/octave/"; + license = stdenv.lib.licenses.gpl3Plus; + maintainers = with stdenv.lib.maintainers; [raskin]; + description = "Scientific Pragramming Language"; + # https://savannah.gnu.org/bugs/?func=detailitem&item_id=56425 is the best attempt to fix JIT + broken = enableJIT; + platforms = if overridePlatforms == null then + (with stdenv.lib; platforms.linux ++ platforms.darwin) + else overridePlatforms; + }; +} 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..991c385cedca --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/default.nix @@ -0,0 +1,221 @@ +{ config, lib, stdenv, fetchurl, pkgs, buildPackages, callPackage +, enableThreading ? true, coreutils, makeWrapper +}: + +# Note: this package is used for bootstrapping fetchurl, and thus +# cannot use fetchpatch! All mutable patches (generated by GitHub or +# cgit) that are needed here should be included directly in Nixpkgs as +# files. + +with lib; + +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 = { perl, buildPerl, version, sha256 }: stdenv.mkDerivation (rec { + inherit version; + + name = "perl-${version}"; + + src = fetchurl { + url = "mirror://cpan/src/5.0/${name}.tar.gz"; + inherit sha256; + }; + + # TODO: Add a "dev" output containing the header files. + outputs = [ "out" "man" "devdoc" ] ++ + optional crossCompiling "mini"; + setOutputFlags = false; + + disallowedReferences = [ stdenv.cc ]; + + patches = + [ + # Do not look in /usr etc. for dependencies. + (if (versionOlder version "5.29.6") then ./no-sys-dirs-5.26.patch + else if (versionOlder version "5.31.1") then ./no-sys-dirs-5.29.patch + else ./no-sys-dirs-5.31.patch) + ] + ++ optional (versionOlder version "5.29.6") + # Fix parallel building: https://rt.perl.org/Public/Bug/Display.html?id=132360 + (fetchurl { + 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; + + # This is not done for native builds because pwd may need to come from + # bootstrap tools when building bootstrap perl. + postPatch = (if crossCompiling then '' + substituteInPlace dist/PathTools/Cwd.pm \ + --replace "/bin/pwd" '${coreutils}/bin/pwd' + substituteInPlace cnf/configure_tool.sh --replace "cc -E -P" "cc -E" + '' else '' + substituteInPlace dist/PathTools/Cwd.pm \ + --replace "/bin/pwd" "$(type -P pwd)" + '') + + # Perl's build system uses the src variable, and its value may end up in + # the output in some cases (when cross-compiling) + '' + unset src + ''; + + # 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=\"\"" "-Ddefault_inc_excludes_dot" ] + 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" + ++ optionals (!crossCompiling) [ + "-Dprefix=${placeholder "out"}" + "-Dman1dir=${placeholder "out"}/share/man/man1" + "-Dman3dir=${placeholder "out"}/share/man/man3" + ]; + + configureScript = optionalString (!crossCompiling) "${stdenv.shell} ./Configure"; + + dontAddPrefix = !crossCompiling; + + enableParallelBuilding = !crossCompiling; + + preConfigure = '' + substituteInPlace ./Configure --replace '`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`' 'Thu Jan 1 00:00:01 UTC 1970' + substituteInPlace ./Configure --replace '$uname -a' '$uname --kernel-name --machine --operating-system' + '' + 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 = rec { + interpreter = "${perl}/bin/perl"; + libPrefix = "lib/perl5/site_perl"; + pkgs = callPackage ../../../top-level/perl-packages.nix { + inherit perl buildPerl; + overrides = config.perlPackageOverrides or (p: {}); # TODO: (self: super: {}) like in python + }; + buildEnv = callPackage ./wrapper.nix { + inherit perl; + inherit (pkgs) requiredPerlModules; + }; + withPackages = f: buildEnv.override { extraLibs = f pkgs; }; + }; + + 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.hasCC then stdenv.cc.cc else "/no-such-path" + }" /no-such-path \ + --replace "${stdenv.cc}" /no-such-path \ + --replace "$man" /no-such-path + '' + optionalString crossCompiling + '' + mkdir -p $mini/lib/perl5/cross_perl/${version} + for dir in cnf/{stub,cpan}; do + cp -r $dir/* $mini/lib/perl5/cross_perl/${version} + done + + mkdir -p $mini/bin + install -m755 miniperl $mini/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 $mini/lib/perl5/cross_perl/${version}. + wrapProgram $mini/bin/perl --prefix PERL5LIB : \ + "$mini/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; + priority = 6; # in `buildEnv' (including the one inside `perl.withPackages') the library files will have priority over files in `perl` + }; + } // optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) rec { + crossVersion = "15ca5359f99698ef0a199bc307b7956c08907abc"; # Aug 27, 2020 + + perl-cross-src = fetchurl { + url = "https://github.com/arsv/perl-cross/archive/${crossVersion}.tar.gz"; + sha256 = "0pcwv2ac02i2l0fjc8drdw70q6gwbypj2c5a53x2449m919v37h9"; + }; + + 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 { + # Maint version + perl530 = common { + perl = pkgs.perl530; + buildPerl = buildPackages.perl530; + version = "5.30.3"; + sha256 = "0vs0wwwlw47sswxaflkk4hw0y45cmc7arxx788kwpbminy5lrq1j"; + }; + + # Maint version + perl532 = common { + perl = pkgs.perl532; + buildPerl = buildPackages.perl532; + version = "5.32.0"; + sha256 = "1d6001cjnpxfv79000bx00vmv2nvdz7wrnyas451j908y7hirszg"; + }; + + # the latest Devel version + perldevel = common { + perl = pkgs.perldevel; + buildPerl = buildPackages.perldevel; + version = "5.33.1"; + sha256 = "1rlnqqqzyhal79ys5dv7fwm3mg81s43dwks28b74x2gcmsngjnw9"; + }; +} 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/no-sys-dirs-5.29.patch b/nixpkgs/pkgs/development/interpreters/perl/no-sys-dirs-5.29.patch new file mode 100644 index 000000000000..0ccf6254b782 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/no-sys-dirs-5.29.patch @@ -0,0 +1,251 @@ +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 +@@ -134,12 +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 +- $linux_errno_h +- ) { ++ } elsif (0) { + $file{$linux_errno_h} = 1; + } elsif ($^O eq 'haiku') { + # hidden in a special place +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/no-sys-dirs-5.31.patch b/nixpkgs/pkgs/development/interpreters/perl/no-sys-dirs-5.31.patch new file mode 100644 index 000000000000..62dce0e25b94 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/no-sys-dirs-5.31.patch @@ -0,0 +1,254 @@ +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 +@@ -134,12 +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 +- $linux_errno_h +- ) { ++ } elsif (0) { + $file{$linux_errno_h} = 1; + } elsif ($^O eq 'haiku') { + # hidden in a special place +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,28 +150,6 @@ case "$optimize" in + ;; + 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 +-# clang also provides -print-search-dirs +-elif ${cc:-cc} --version 2>/dev/null | grep -q '^clang ' ; then +- gcc=${cc:-cc} +-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:/$::'` +@@ -208,32 +186,6 @@ case "$usequadmath" in + ;; + 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.' +@@ -311,33 +263,6 @@ sparc*) + ;; + 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..a7aad6f2453e --- /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 "$hostOffset" 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..2e30dba92924 --- /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="${MACOSX_DEPLOYMENT_TARGET:-10.12}" + case "$prodvers" in + 10.*) + add_macosx_version_min ccflags $prodvers diff --git a/nixpkgs/pkgs/development/interpreters/perl/wrapper.nix b/nixpkgs/pkgs/development/interpreters/perl/wrapper.nix new file mode 100644 index 000000000000..2e3d394f8515 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/perl/wrapper.nix @@ -0,0 +1,53 @@ +{ stdenv, perl, buildEnv, makeWrapper +, extraLibs ? [] +, extraOutputsToInstall ? [] +, postBuild ? "" +, ignoreCollisions ? false +, requiredPerlModules +}: + +# Create a perl executable that knows about additional packages. +let + env = let + paths = requiredPerlModules (extraLibs ++ [ perl ] ); + in buildEnv { + name = "${perl.name}-env"; + + inherit paths; + inherit ignoreCollisions; + extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall; + + # we create wrapper for the binaries in the different packages + postBuild = '' + + . "${makeWrapper}/nix-support/setup-hook" + + if [ -L "$out/bin" ]; then + unlink "$out/bin" + fi + mkdir -p "$out/bin" + + # take every binary from perl packages and put them into the env + 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" --suffix PERL5LIB ':' "$out/${perl.libPrefix}" + fi + fi + done + fi + done + '' + postBuild; + + meta = perl.meta // { outputsToInstall = ["out"]; }; # remove "man" from meta.outputsToInstall. pkgs.buildEnv produces no "man", it puts everything to "out" + + passthru = perl.passthru // { + interpreter = "${env}/bin/perl"; + inherit perl; + }; + }; +in env diff --git a/nixpkgs/pkgs/development/interpreters/php/default.nix b/nixpkgs/pkgs/development/interpreters/php/default.nix new file mode 100644 index 000000000000..8921cf78aa83 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/php/default.nix @@ -0,0 +1,303 @@ +# We have tests for PCRE and PHP-FPM in nixos/tests/php/ or +# both in the same attribute named nixosTests.php + +{ callPackage, lib, stdenv, nixosTests }@_args: + +let + generic = + { callPackage, lib, stdenv, nixosTests, config, fetchurl, makeWrapper + , symlinkJoin, writeText, autoconf, automake, bison, flex, libtool + , pkgconfig, re2c, apacheHttpd, libargon2, libxml2, pcre, pcre2 + , systemd, system-sendmail, valgrind, xcbuild + + , version + , sha256 + , extraPatches ? [] + + # Sapi flags + , cgiSupport ? true + , cliSupport ? true + , fpmSupport ? true + , pearSupport ? true + , pharSupport ? true + , phpdbgSupport ? true + + # Misc flags + , apxs2Support ? !stdenv.isDarwin + , argon2Support ? true + , cgotoSupport ? false + , embedSupport ? false + , ipv6Support ? true + , systemdSupport ? stdenv.isLinux + , valgrindSupport ? true + , ztsSupport ? apxs2Support + }@args: + let + # buildEnv wraps php to provide additional extensions and + # configuration. Its usage is documented in + # doc/languages-frameworks/php.section.md. + # + # Create a buildEnv with earlier overridden values and + # extensions functions in its closure. This is necessary for + # consecutive calls to buildEnv and overrides to work as + # expected. + mkBuildEnv = prevArgs: prevExtensionFunctions: lib.makeOverridable ( + { extensions ? ({ enabled, ... }: enabled), extraConfig ? "", ... }@innerArgs: + let + allArgs = args // prevArgs // innerArgs; + filteredArgs = builtins.removeAttrs allArgs [ "extensions" "extraConfig" ]; + php = generic filteredArgs; + + php-packages = (callPackage ../../../top-level/php-packages.nix { + php = phpWithExtensions; + }); + + allExtensionFunctions = prevExtensionFunctions ++ [ extensions ]; + enabledExtensions = + builtins.foldl' + (enabled: f: + f { inherit enabled; all = php-packages.extensions; }) + [] + allExtensionFunctions; + + getExtName = ext: lib.removePrefix "php-" (builtins.parseDrvName ext.name).name; + + # Recursively get a list of all internal dependencies + # for a list of extensions. + getDepsRecursively = extensions: + let + deps = lib.concatMap + (ext: (ext.internalDeps or []) ++ (ext.peclDeps or [])) + extensions; + in + if ! (deps == []) then + deps ++ (getDepsRecursively deps) + else + deps; + + # Generate extension load configuration snippets from the + # extension parameter. This is an attrset suitable for use + # with textClosureList, which is used to put the strings in + # the right order - if a plugin which is dependent on + # another plugin is placed before its dependency, it will + # fail to load. + extensionTexts = + lib.listToAttrs + (map (ext: + let + extName = getExtName ext; + phpDeps = (ext.internalDeps or []) ++ (ext.peclDeps or []); + type = "${lib.optionalString (ext.zendExtension or false) "zend_"}extension"; + in + lib.nameValuePair extName { + text = "${type}=${ext}/lib/php/extensions/${extName}.so"; + deps = map getExtName phpDeps; + }) + (enabledExtensions ++ (getDepsRecursively enabledExtensions))); + + extNames = map getExtName enabledExtensions; + extraInit = writeText "php.ini" '' + ${lib.concatStringsSep "\n" + (lib.textClosureList extensionTexts extNames)} + ${extraConfig} + ''; + + phpWithExtensions = symlinkJoin rec { + name = "php-with-extensions-${version}"; + inherit (php) version; + nativeBuildInputs = [ makeWrapper ]; + passthru = { + buildEnv = mkBuildEnv allArgs allExtensionFunctions; + withExtensions = mkWithExtensions allArgs allExtensionFunctions; + phpIni = "${phpWithExtensions}/lib/php.ini"; + unwrapped = php; + tests = nixosTests.php; + inherit (php-packages) packages extensions buildPecl; + meta = php.meta // { + outputsToInstall = [ "out" ]; + }; + }; + paths = [ php ]; + postBuild = '' + cp ${extraInit} $out/lib/php.ini + + wrapProgram $out/bin/php --set PHP_INI_SCAN_DIR $out/lib + + if test -e $out/bin/php-fpm; then + wrapProgram $out/bin/php-fpm --set PHP_INI_SCAN_DIR $out/lib + fi + ''; + }; + in + phpWithExtensions); + + mkWithExtensions = prevArgs: prevExtensionFunctions: extensions: + mkBuildEnv prevArgs prevExtensionFunctions { inherit extensions; }; + + pcre' = if (lib.versionAtLeast version "7.3") then pcre2 else pcre; + in + stdenv.mkDerivation { + pname = "php"; + + inherit version; + + enableParallelBuilding = true; + + nativeBuildInputs = [ autoconf automake bison flex libtool pkgconfig re2c ] + ++ lib.optional stdenv.isDarwin xcbuild; + + buildInputs = + # PCRE extension + [ pcre' ] + + # Enable sapis + ++ lib.optional pearSupport [ libxml2.dev ] + + # Misc deps + ++ lib.optional apxs2Support apacheHttpd + ++ lib.optional argon2Support libargon2 + ++ lib.optional systemdSupport systemd + ++ lib.optional valgrindSupport valgrind + ; + + CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++11"; + + configureFlags = + # Disable all extensions + [ "--disable-all" ] + + # PCRE + ++ lib.optionals (lib.versionAtLeast version "7.4") [ "--with-external-pcre=${pcre'.dev}" ] + ++ lib.optionals (lib.versions.majorMinor version == "7.3") [ "--with-pcre-regex=${pcre'.dev}" ] + ++ lib.optionals (lib.versionOlder version "7.3") [ "--with-pcre-regex=${pcre'.dev}" ] + ++ [ "PCRE_LIBDIR=${pcre'}" ] + + + # Enable sapis + ++ lib.optional (!cgiSupport) "--disable-cgi" + ++ lib.optional (!cliSupport) "--disable-cli" + ++ lib.optional fpmSupport "--enable-fpm" + ++ lib.optional pearSupport [ "--with-pear=$(out)/lib/php/pear" "--enable-xml" "--with-libxml" ] + ++ lib.optionals (pearSupport && (lib.versionOlder version "7.4")) [ + "--enable-libxml" + "--with-libxml-dir=${libxml2.dev}" + ] + ++ lib.optional pharSupport "--enable-phar" + ++ lib.optional phpdbgSupport "--enable-phpdbg" + + + # Misc flags + ++ lib.optional apxs2Support "--with-apxs2=${apacheHttpd.dev}/bin/apxs" + ++ lib.optional argon2Support "--with-password-argon2=${libargon2}" + ++ lib.optional cgotoSupport "--enable-re2c-cgoto" + ++ lib.optional embedSupport "--enable-embed" + ++ lib.optional (!ipv6Support) "--disable-ipv6" + ++ lib.optional systemdSupport "--with-fpm-systemd" + ++ lib.optional valgrindSupport "--with-valgrind=${valgrind.dev}" + ++ lib.optional ztsSupport "--enable-maintainer-zts" + + + # Sendmail + ++ [ "PROG_SENDMAIL=${system-sendmail}/bin/sendmail" ] + ; + + 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 + + export EXTENSION_DIR=$out/lib/php/extensions + '' + # PKG_CONFIG need not be a relative path + + lib.optionalString (! lib.versionAtLeast version "7.4") '' + for i in $(find . -type f -name "*.m4"); do + substituteInPlace $i \ + --replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null' + done + '' + '' + ./buildconf --copy --force + + if test -f $src/genfiles; then + ./genfiles + fi + '' + lib.optionalString stdenv.isDarwin '' + substituteInPlace configure --replace "-lstdc++" "-lc++" + ''; + + 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 = "https://www.php.net/distributions/php-${version}.tar.bz2"; + inherit sha256; + }; + + patches = [ ./fix-paths-php7.patch ] ++ extraPatches; + + separateDebugInfo = true; + + outputs = [ "out" "dev" ]; + + passthru = { + buildEnv = mkBuildEnv {} []; + withExtensions = mkWithExtensions {} []; + }; + + meta = with stdenv.lib; { + description = "An HTML-embedded scripting language"; + homepage = "https://www.php.net/"; + license = licenses.php301; + maintainers = teams.php.members; + platforms = platforms.all; + outputsToInstall = [ "out" "dev" ]; + }; + }; + + php73base = callPackage generic (_args // { + version = "7.3.20"; + sha256 = "1pl9bjwvdva2yx4sh465z9cr4bnr8mvv008w71sy1kqsj6a7ivf6"; + + # https://bugs.php.net/bug.php?id=76826 + extraPatches = lib.optional stdenv.isDarwin ./php73-darwin-isfinite.patch; + }); + + php74base = callPackage generic (_args // { + version = "7.4.8"; + sha256 = "0ql01sfg8l7y2bfwmnjxnfw9irpibnz57ssck24b00y00nkd6j3a"; + }); + + defaultPhpExtensions = { all, ... }: with all; ([ + bcmath calendar curl ctype dom exif fileinfo filter ftp gd + gettext gmp iconv intl json ldap mbstring mysqli mysqlnd opcache + openssl pcntl pdo pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql + posix readline session simplexml sockets soap sodium sqlite3 + tokenizer xmlreader xmlwriter zip zlib + ] ++ lib.optionals (!stdenv.isDarwin) [ imap ]); + + defaultPhpExtensionsWithHash = { all, ... }: + (defaultPhpExtensions { inherit all; }) ++ [ all.hash ]; + + php74 = php74base.withExtensions defaultPhpExtensions; + php73 = php73base.withExtensions defaultPhpExtensionsWithHash; + +in { + inherit php73 php74; +} 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/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/php/zlib-darwin-tests.patch b/nixpkgs/pkgs/development/interpreters/php/zlib-darwin-tests.patch new file mode 100644 index 000000000000..ef61f0a87845 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/php/zlib-darwin-tests.patch @@ -0,0 +1,44 @@ +diff --git a/ext/zlib/tests/bug55544.phpt b/ext/zlib/tests/bug55544.phpt +index a0d22f4fcebf4846da6781f424f87821626de5ea..e650fe6909f555d04834f4c08f7fd0d354b783e2 100644 +--- a/ext/zlib/tests/bug55544.phpt ++++ b/ext/zlib/tests/bug55544.phpt +@@ -6,6 +6,9 @@ extension_loaded("zlib") or die("skip"); + if (substr(PHP_OS, 0, 3) == 'WIN') { + die("skip not for windows"); + } ++if (PHP_OS == "Darwin") { ++ die("skip not for darwin"); ++} + ?> + --INI-- + output_handler=ob_gzhandler +diff --git a/ext/zlib/tests/gzencode_variation1.phpt b/ext/zlib/tests/gzencode_variation1.phpt +index c966b2cbc5b7..2f953168fa22 100644 +--- a/ext/zlib/tests/gzencode_variation1.phpt ++++ b/ext/zlib/tests/gzencode_variation1.phpt +@@ -10,6 +10,10 @@ if( substr(PHP_OS, 0, 3) == "WIN" ) { + if (!extension_loaded("zlib")) { + print "skip - ZLIB extension not loaded"; + } ++ ++if (PHP_OS == "Darwin") { ++ print "skip - OS is encoded in headers, tested header is non Darwin"; ++} + ?> + --FILE-- + <?php +diff --git a/ext/zlib/tests/gzencode_variation2.phpt b/ext/zlib/tests/gzencode_variation2.phpt +index 94ac42a5f1cd..9160cf519751 100644 +--- a/ext/zlib/tests/gzencode_variation2.phpt ++++ b/ext/zlib/tests/gzencode_variation2.phpt +@@ -10,6 +10,10 @@ if( substr(PHP_OS, 0, 3) == "WIN" ) { + if (!extension_loaded("zlib")) { + print "skip - ZLIB extension not loaded"; + } ++ ++if (PHP_OS == "Darwin") { ++ print "skip - OS is encoded in headers, tested header is non Darwin"; ++} + ?> + --FILE-- + <?php diff --git a/nixpkgs/pkgs/development/interpreters/picoc/default.nix b/nixpkgs/pkgs/development/interpreters/picoc/default.nix new file mode 100644 index 000000000000..f7343f6e4d60 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/picoc/default.nix @@ -0,0 +1,51 @@ +{ stdenv, fetchFromGitHub, readline }: + +stdenv.mkDerivation rec { + pname = "picoc"; + 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 + # https://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..1511698c9215 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/picolisp/default.nix @@ -0,0 +1,65 @@ +{ stdenv, fetchurl, jdk, w3m, openssl, makeWrapper }: +with stdenv.lib; + +stdenv.mkDerivation rec { + pname = "picoLisp"; + version = "20.6"; + src = fetchurl { + url = "https://www.software-lab.de/${pname}-${version}.tgz"; + sha256 = "0l51x98bn1hh6kv40sdgp0x09pzg5i8yxbcjvm9n5bxsd6bbk5w2"; + }; + buildInputs = [makeWrapper openssl] ++ optional stdenv.is64bit jdk; + patchPhase = '' + sed -i "s/which java/command -v java/g" mkAsm + + ${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"}''; + postBuild = '' + cd ../src; make gate + ''; + 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" + ln -s "$out/lib/picolisp/bin/httpGate" "$out/bin/httpGate" + + + makeWrapper $out/bin/picolisp $out/bin/pil \ + --prefix PATH : ${w3m}/bin \ + --add-flags "$out/lib/picolisp/lib.l" \ + --add-flags "@lib/misc.l" \ + --add-flags "@lib/btree.l" \ + --add-flags "@lib/db.l" \ + --add-flags "@lib/pilog.l" + + 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..9b57e153aa05 --- /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 { + pname = "pixie"; + version = "0-r${commit-count}-${variant}"; + nativeBuildInputs = [ makeWrapper pkgconfig ]; + buildInputs = libs; + PYTHON = if buildWithPypy + then "${pypy}/pypy-c/pypy-c" + 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..8ebbf6cf5012 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/proglodyte-wasm/default.nix @@ -0,0 +1,60 @@ +{ stdenv, fetchFromGitHub, cmake, clang, python, v8, 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}/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; + broken = true; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/pure/default.nix b/nixpkgs/pkgs/development/interpreters/pure/default.nix new file mode 100644 index 000000000000..19e6c93378f7 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/pure/default.nix @@ -0,0 +1,45 @@ +{ 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 ]; + NIX_LDFLAGS = "-lLLVMJIT"; + + 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''${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; + broken = true; + }; +} 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..40eb1daf49c8 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/pyrex/0.9.5.nix @@ -0,0 +1,21 @@ +{ stdenv, fetchurl, python2Packages }: + +let version = "0.9.5.1.1"; in + +python2Packages.buildPythonPackage { + pname = "pyrex"; + inherit 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..e518edba1b39 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/pyrex/0.9.6.nix @@ -0,0 +1,21 @@ +{ stdenv, fetchurl, python2Packages }: + +let version = "0.9.6.4"; in + +python2Packages.buildPythonPackage { + pname = "pyrex"; + inherit 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/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/CVE-2019-20907.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/CVE-2019-20907.patch new file mode 100644 index 000000000000..cf67ae2b51be --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/CVE-2019-20907.patch @@ -0,0 +1,24 @@ +From 5a8d121a1f3ef5ad7c105ee378cc79a3eac0c7d4 Mon Sep 17 00:00:00 2001 +From: Rishi <rishi_devan@mail.com> +Date: Wed, 15 Jul 2020 13:51:00 +0200 +Subject: [PATCH] bpo-39017: Avoid infinite loop in the tarfile module + (GH-21454) + +Avoid infinite loop when reading specially crafted TAR files using the tarfile module +(CVE-2019-20907). +--- + Lib/tarfile.py | 2 ++ + +diff --git a/Lib/tarfile.py b/Lib/tarfile.py +index e2b60532f6..6769066cab 100755 +--- a/Lib/tarfile.py ++++ b/Lib/tarfile.py +@@ -1249,6 +1249,8 @@ class TarInfo(object): + + length, keyword = match.groups() + length = int(length) ++ if length == 0: ++ raise InvalidHeaderError("invalid header") + value = buf[match.end(2) + 1:match.start(1) + length - 1] + + # Normally, we could just use "utf-8" as the encoding and "strict" diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/atomic_pyc.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/atomic_pyc.patch new file mode 100644 index 000000000000..06d3718d4993 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/atomic_pyc.patch @@ -0,0 +1,116 @@ +diff --git a/Lib/py_compile.py b/Lib/py_compile.py +index 978da73d74..3559eb95ca 100644 +--- a/Lib/py_compile.py ++++ b/Lib/py_compile.py +@@ -120,16 +120,27 @@ def compile(file, cfile=None, dfile=None, doraise=False): + return + if cfile is None: + cfile = file + (__debug__ and 'c' or 'o') +- with open(cfile, 'wb') as fc: +- fc.write('\0\0\0\0') +- if "DETERMINISTIC_BUILD" in os.environ: ++ # Atomically write the pyc/pyo file. Issue #13146. ++ # id() is used to generate a pseudo-random filename. ++ path_tmp = '{}.{}'.format(cfile, id(cfile)) ++ try: ++ with open(path_tmp, 'wb') as fc: + fc.write('\0\0\0\0') +- else: +- wr_long(fc, timestamp) +- marshal.dump(codeobject, fc) +- fc.flush() +- fc.seek(0, 0) +- fc.write(MAGIC) ++ 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) ++ fc.write(MAGIC) ++ os.rename(path_tmp, cfile) ++ except OSError: ++ try: ++ os.unlink(path_tmp) ++ except OSError: ++ pass ++ raise + + def main(args=None): + """Compile several source files. +diff --git a/Python/import.c b/Python/import.c +index 1e31d79279..f78a1efcf0 100644 +--- a/Python/import.c ++++ b/Python/import.c +@@ -951,6 +951,8 @@ static void + write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, time_t mtime) + { + FILE *fp; ++ size_t cpathname_len; ++ char *cpathname_tmp; + #ifdef MS_WINDOWS /* since Windows uses different permissions */ + mode_t mode = srcstat->st_mode & ~S_IEXEC; + /* Issue #6074: We ensure user write access, so we can delete it later +@@ -963,11 +965,28 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, t + mode_t mode = srcstat->st_mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH; + #endif + ++#ifdef MS_WINDOWS + fp = open_exclusive(cpathname, mode); ++#else ++ /* Under POSIX, we first write to a tmp file and then take advantage ++ of atomic renaming. */ ++ cpathname_len = strlen(cpathname); ++ cpathname_tmp = PyMem_MALLOC(cpathname_len + 5); ++ if (cpathname_tmp == NULL) { ++ PyErr_Clear(); ++ return; ++ } ++ memcpy(cpathname_tmp, cpathname, cpathname_len); ++ memcpy(cpathname_tmp + cpathname_len, ".tmp", 5); ++ fp = open_exclusive(cpathname_tmp, mode); ++#endif + if (fp == NULL) { + if (Py_VerboseFlag) + PySys_WriteStderr( + "# can't create %s\n", cpathname); ++#ifndef MS_WINDOWS ++ PyMem_FREE(cpathname_tmp); ++#endif + return; + } + PyMarshal_WriteLongToFile(pyc_magic, fp, Py_MARSHAL_VERSION); +@@ -979,7 +998,12 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, t + PySys_WriteStderr("# can't write %s\n", cpathname); + /* Don't keep partial file */ + fclose(fp); ++#ifdef MS_WINDOWS + (void) unlink(cpathname); ++#else ++ (void) unlink(cpathname_tmp); ++ PyMem_FREE(cpathname_tmp); ++#endif + return; + } + /* Now write the true mtime (as a 32-bit field) */ +@@ -989,6 +1013,19 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, t + PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); + fflush(fp); + } ++ /* Under POSIX, do an atomic rename */ ++#ifndef MS_WINDOWS ++ if (rename(cpathname_tmp, cpathname)) { ++ if (Py_VerboseFlag) ++ PySys_WriteStderr("# can't write %s\n", cpathname); ++ /* Don't keep tmp file */ ++ fclose(fp); ++ (void) unlink(cpathname_tmp); ++ PyMem_FREE(cpathname_tmp); ++ return; ++ } ++ PyMem_FREE(cpathname_tmp); ++#endif + fclose(fp); + if (Py_VerboseFlag) + PySys_WriteStderr("# wrote %s\n", cpathname); 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..2cfaa69a4c8b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix @@ -0,0 +1,295 @@ +{ stdenv, fetchurl, fetchpatch +, bzip2 +, expat +, libffi +, gdbm +, db +, ncurses +, openssl +, readline +, sqlite +, tcl ? null, tk ? null, tix ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? false +, zlib +, self +, configd, coreutils +, autoreconfHook +, python-setup-hook +# Some proprietary libs assume UCS2 unicode, especially on darwin :( +, ucsEncoding ? 4 +# For the Python package set +, packageOverrides ? (self: super: {}) +, buildPackages +, sourceVersion +, sha256 +, passthruFun +, static ? false +, enableOptimizations ? (!stdenv.isDarwin) +}: + +assert x11Support -> tcl != null + && tk != null + && xlibsWrapper != null + && libX11 != null; + +with stdenv.lib; + +let + + pythonForBuild = buildPackages.${"python${sourceVersion.major}${sourceVersion.minor}"}; + + passthru = passthruFun rec { + inherit self sourceVersion packageOverrides; + implementation = "cpython"; + libPrefix = "python${pythonVersion}"; + executable = libPrefix; + pythonVersion = with sourceVersion; "${major}.${minor}"; + sitePackages = "lib/${libPrefix}/site-packages"; + inherit hasDistutilsCxxPatch pythonForBuild; + } // { + inherit ucsEncoding; + }; + + version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; + + src = fetchurl { + url = with sourceVersion; "https://www.python.org/ftp/python/${major}.${minor}.${patch}/Python-${version}.tar.xz"; + inherit sha256; + }; + + 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"; + }) + + # Fix race-condition during pyc creation. Has a slight backwards + # incompatible effect: pyc symlinks will now be overridden + # (https://bugs.python.org/issue17222). Included in python >= 3.4, + # backported in debian since 2013. + # https://bugs.python.org/issue13146 + ./atomic_pyc.patch + + # Backport from CPython 3.8 of a good list of tests to run for PGO. + ./profile-task.patch + + # Patch is likely to go away in the next release (if there is any) + ./CVE-2019-20907.patch + ] ++ 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 = optionals enableOptimizations [ + "--enable-optimizations" + ] ++ [ + "--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" + ++ optional static "LDFLAGS=-static"; + + 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 ] + ++ optional (stdenv.isDarwin && configd != null) configd; + nativeBuildInputs = + [ autoreconfHook ] + ++ 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 with passthru; stdenv.mkDerivation ({ + pname = "python"; + inherit version; + + inherit 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/${libPrefix}/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/${libPrefix}/test/__init__.py + ln -s $out/lib/${libPrefix}/pdb.py $out/bin/pdb + ln -s $out/lib/${libPrefix}/pdb.py $out/bin/pdb${sourceVersion.major}.${sourceVersion.minor} + ln -s $out/share/man/man1/{python2.7.1.gz,python.1.gz} + + 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 + ''; + + inherit passthru; + + postFixup = '' + # Include a sitecustomize.py file. Note it causes an error when it's in postInstall with 2.7. + cp ${../../sitecustomize.py} $out/${sitePackages}/sitecustomize.py + ''; + + 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/profile-task.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/profile-task.patch new file mode 100644 index 000000000000..9c085657ac9d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/profile-task.patch @@ -0,0 +1,21 @@ +Backport from CPython 3.8 of a good list of tests to run for PGO. + +Upstream commit: + https://github.com/python/cpython/commit/4e16a4a31 + +Upstream discussion: + https://bugs.python.org/issue36044 + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 00fdd21ce..713dc1e53 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -259,7 +259,7 @@ TCLTK_LIBS= + # The task to run while instrumented when building the profile-opt target. + # We exclude unittests with -x that take a rediculious amount of time to + # run in the instrumented training build or do not provide much value. +-PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing test_subprocess ++PROFILE_TASK=-m test.regrtest --pgo test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_pickle test_pprint test_re test_set test_sqlite test_statistics test_struct test_tabnanny test_time test_unicode test_xml_etree test_xml_etree_c + + # report files for gcov / lcov coverage report + COVERAGE_INFO= $(abs_builddir)/coverage.info 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..78d9272d098a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/python-2.7-distutils-C++.patch @@ -0,0 +1,259 @@ +--- 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, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ +- get_config_vars('CC', 'CXX', '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 = 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/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/force_bytecode_determinism.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/force_bytecode_determinism.patch new file mode 100644 index 000000000000..c263cdbff4db --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/force_bytecode_determinism.patch @@ -0,0 +1,17 @@ +--- a/Lib/py_compile.py ++++ b/Lib/py_compile.py +@@ -139,3 +139,4 @@ + source_stats = loader.path_stats(file) ++ source_mtime = 1 if 'DETERMINISTIC_BUILD' in os.environ else source_stats['mtime'] + bytecode = importlib._bootstrap_external._code_to_bytecode( +- code, source_stats['mtime'], source_stats['size']) ++ code, source_mtime, source_stats['size']) +--- a/Lib/importlib/_bootstrap_external.py ++++ b/Lib/importlib/_bootstrap_external.py +@@ -485,5 +485,5 @@ + if source_stats is not None: + try: +- source_mtime = int(source_stats['mtime']) ++ source_mtime = 1 + except KeyError: + pass 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/profile-task.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/profile-task.patch new file mode 100644 index 000000000000..39d5587379ca --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/profile-task.patch @@ -0,0 +1,21 @@ +Backport from CPython 3.8 of a good list of tests to run for PGO. + +Upstream commit: + https://github.com/python/cpython/commit/4e16a4a31 + +Upstream discussion: + https://bugs.python.org/issue36044 + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 00fdd21ce..713dc1e53 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -259,7 +259,7 @@ TCLTK_LIBS= + # The task to run while instrumented when building the profile-opt target. + # We exclude unittests with -x that take a rediculious amount of time to + # run in the instrumented training build or do not provide much value. +-PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_subprocess ++PROFILE_TASK=-m test.regrtest --pgo test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_pickle test_pprint test_re test_set test_sqlite test_statistics test_struct test_tabnanny test_time test_unicode test_xml_etree test_xml_etree_c + + # report files for gcov / lcov coverage report + COVERAGE_INFO= $(abs_builddir)/coverage.info diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/python-3.x-distutils-C++.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/python-3.x-distutils-C++.patch new file mode 100644 index 000000000000..01356020b394 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.5/python-3.x-distutils-C++.patch @@ -0,0 +1,237 @@ +Source: https://bugs.python.org/file47046/python-3.x-distutils-C++.patch +--- a/Lib/distutils/cygwinccompiler.py ++++ b/Lib/distutils/cygwinccompiler.py +@@ -125,8 +125,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 +@@ -140,9 +142,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": +@@ -166,8 +172,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 as msg: + raise CompileError(msg) + +@@ -302,9 +312,14 @@ + self.set_executables(compiler='gcc -O -Wall', + compiler_so='gcc -mdll -O -Wall', + compiler_cxx='g++ -O -Wall', ++ compiler_so_cxx='g++ -mdll -O -Wall', + linker_exe='gcc', + linker_so='%s %s %s' + % (self.linker_dll, shared_option, ++ entry_point), ++ linker_exe_cxx='g++', ++ linker_so_cxx='%s %s %s' ++ % (self.linker_dll_cxx, 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/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -184,9 +184,11 @@ + _osx_support.customize_compiler(_config_vars) + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' + +- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ +- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ (cc, cxx, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \ ++ get_config_vars('CC', 'CXX', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ ++ cxxflags = cflags + + if 'CC' in os.environ: + newcc = os.environ['CC'] +@@ -201,19 +204,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: +@@ -222,13 +233,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 = shlib_suffix +--- a/Lib/distutils/unixccompiler.py ++++ b/Lib/distutils/unixccompiler.py +@@ -52,14 +52,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": +@@ -108,12 +111,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 as msg: + raise CompileError(msg) + +@@ -171,22 +181,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 += 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_' +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -538,7 +538,7 @@ + *\ -s*|s*) quiet="-q";; \ + *) quiet="";; \ + esac; \ +- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build 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/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/profile-task.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/profile-task.patch new file mode 100644 index 000000000000..df55da3a4132 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.6/profile-task.patch @@ -0,0 +1,21 @@ +Backport from CPython 3.8 of a good list of tests to run for PGO. + +Upstream commit: + https://github.com/python/cpython/commit/4e16a4a31 + +Upstream discussion: + https://bugs.python.org/issue36044 + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 00fdd21ce..713dc1e53 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -259,7 +259,7 @@ TCLTK_LIBS= + # The task to run while instrumented when building the profile-opt target. + # We exclude unittests with -x that take a rediculious amount of time to + # run in the instrumented training build or do not provide much value. +-PROFILE_TASK=-m test.regrtest --pgo ++PROFILE_TASK=-m test.regrtest --pgo test_array test_base64 test_binascii test_binop test_bisect test_bytes test_bz2 test_cmath test_codecs test_collections test_complex test_dataclasses test_datetime test_decimal test_difflib test_embed test_float test_fstring test_functools test_generators test_hashlib test_heapq test_int test_itertools test_json test_long test_lzma test_math test_memoryview test_operator test_ordered_dict test_pickle test_pprint test_re test_set test_sqlite test_statistics test_struct test_tabnanny test_time test_unicode test_xml_etree test_xml_etree_c + + # report files for gcov / lcov coverage report + COVERAGE_INFO= $(abs_builddir)/coverage.info 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/darwin-libutil.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/darwin-libutil.patch new file mode 100644 index 000000000000..51e3cb6d7f11 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/darwin-libutil.patch @@ -0,0 +1,23 @@ +diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c +index c3682b4..16826c6 100644 +--- a/Modules/posixmodule.c ++++ b/Modules/posixmodule.c +@@ -5880,15 +5880,13 @@ error: + #if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX) + #ifdef HAVE_PTY_H + #include <pty.h> +-#else ++#endif + #ifdef HAVE_LIBUTIL_H + #include <libutil.h> +-#else ++#endif + #ifdef HAVE_UTIL_H + #include <util.h> +-#endif /* HAVE_UTIL_H */ +-#endif /* HAVE_LIBUTIL_H */ +-#endif /* HAVE_PTY_H */ ++#endif + #ifdef HAVE_STROPTS_H + #include <stropts.h> + #endif diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/fix-hardcoded-path-checking-for-rpmbuild.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/fix-hardcoded-path-checking-for-rpmbuild.patch new file mode 100644 index 000000000000..bb3d992612d3 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/fix-hardcoded-path-checking-for-rpmbuild.patch @@ -0,0 +1,30 @@ +From a612c481f6116955d420db5ae1fe4c1eb93eb2f2 Mon Sep 17 00:00:00 2001 +From: Marcin Niemira <marcin.niemira@gmail.com> +Date: Sun, 9 Jun 2019 07:05:06 +1000 +Subject: [PATCH] bpo-11122: fix hardcoded path checking for rpmbuild in + bdist_rpm.py (GH-10594) (cherry picked from commit + 45a14942c969ed508b35abd5e116cb18f84ce5b4) + +Co-authored-by: Marcin Niemira <marcin.niemira@gmail.com> +--- + Lib/distutils/command/bdist_rpm.py | 5 +---- + .../next/Library/2018-11-12-19-08-50.bpo-11122.Gj7BQn.rst | 1 + + 2 files changed, 2 insertions(+), 4 deletions(-) + create mode 100644 Misc/NEWS.d/next/Library/2018-11-12-19-08-50.bpo-11122.Gj7BQn.rst + +diff --git a/Lib/distutils/command/bdist_rpm.py b/Lib/distutils/command/bdist_rpm.py +index 20ca7ac6dcffa..74381cc69a6ce 100644 +--- a/Lib/distutils/command/bdist_rpm.py ++++ b/Lib/distutils/command/bdist_rpm.py +@@ -309,10 +309,7 @@ def run(self): + + # build package + log.info("building RPMs") +- rpm_cmd = ['rpm'] +- if os.path.exists('/usr/bin/rpmbuild') or \ +- os.path.exists('/bin/rpmbuild'): +- rpm_cmd = ['rpmbuild'] ++ rpm_cmd = ['rpmbuild'] + + if self.source_only: # what kind of RPMs? + rpm_cmd.append('-bs') 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/3.7/python-3.x-distutils-C++.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/python-3.x-distutils-C++.patch new file mode 100644 index 000000000000..243313f76548 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.7/python-3.x-distutils-C++.patch @@ -0,0 +1,248 @@ +--- a/Lib/_osx_support.py ++++ b/Lib/_osx_support.py +@@ -14,13 +14,13 @@ __all__ = [ + # 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', 'PY_CORE_LDFLAGS') ++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS', ++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS', ++ 'PY_CPPFLAGS', 'PY_CORE_LDFLAGS', '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_' +--- a/Lib/distutils/cygwinccompiler.py ++++ b/Lib/distutils/cygwinccompiler.py +@@ -125,8 +125,10 @@ class CygwinCCompiler(UnixCCompiler): + # 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 +@@ -140,9 +142,13 @@ class CygwinCCompiler(UnixCCompiler): + 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": +@@ -166,8 +172,12 @@ class CygwinCCompiler(UnixCCompiler): + 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 as msg: + raise CompileError(msg) + +@@ -302,9 +312,14 @@ class Mingw32CCompiler(CygwinCCompiler): + self.set_executables(compiler='gcc -O -Wall', + compiler_so='gcc -mdll -O -Wall', + compiler_cxx='g++ -O -Wall', ++ compiler_so_cxx='g++ -mdll -O -Wall', + linker_exe='gcc', + linker_so='%s %s %s' + % (self.linker_dll, shared_option, ++ entry_point), ++ linker_exe_cxx='g++', ++ linker_so_cxx='%s %s %s' ++ % (self.linker_dll_cxx, 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/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -170,9 +170,11 @@ def customize_compiler(compiler): + _osx_support.customize_compiler(_config_vars) + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' + +- (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ +- get_config_vars('CC', 'CXX', 'CFLAGS', +- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ (cc, cxx, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \ ++ get_config_vars('CC', 'CXX', 'CFLAGS', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', ++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') ++ ++ cxxflags = cflags + + if 'CC' in os.environ: + newcc = os.environ['CC'] +@@ -187,19 +189,27 @@ def customize_compiler(compiler): + 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 = cflags + ' ' + 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: +@@ -208,13 +218,17 @@ def customize_compiler(compiler): + 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 = shlib_suffix +--- a/Lib/distutils/unixccompiler.py ++++ b/Lib/distutils/unixccompiler.py +@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler): + # 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": +@@ -110,12 +113,19 @@ class UnixCCompiler(CCompiler): + + 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 as msg: + raise CompileError(msg) + +@@ -173,30 +183,16 @@ class UnixCCompiler(CCompiler): + 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 += 1 +- +- if os.path.basename(linker[i]) == 'ld_so_aix': +- # AIX platforms prefix the compiler with the ld_so_aix +- # script, so we need to adjust our linker index +- offset = 1 ++ if target_desc == CCompiler.EXECUTABLE: ++ linker = self.linker_exe[:] + else: +- offset = 0 +- +- linker[i+offset] = self.compiler_cxx[i] ++ linker = self.linker_so[:] + + if sys.platform == 'darwin': + linker = _osx_support.compiler_fixup(linker, ld_args) +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -584,10 +584,10 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o + *\ -s*|s*) quiet="-q";; \ + *) quiet="";; \ + esac; \ +- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ +- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ ++ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \ + _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build + diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch new file mode 100644 index 000000000000..0c26300d9c06 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch @@ -0,0 +1,33 @@ +From 1911995b1a1252d80bf2b9651840e185a1a6baf5 Mon Sep 17 00:00:00 2001 +From: Hong Xu <hong@topbug.net> +Date: Thu, 25 Jul 2019 10:25:55 -0700 +Subject: [PATCH] On all posix systems, not just Darwin, set LDSHARED (if not + set) according to CC + +This patch is slightly different from https://bugs.python.org/issue24935 +, except that we now handle LDSHARED according to CC on all posix +systems, not just Darwin or Linux. +--- + Lib/distutils/sysconfig.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 37feae5df7..9fdce6896d 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -199,10 +199,10 @@ def customize_compiler(compiler): + + if 'CC' in os.environ: + newcc = os.environ['CC'] +- if (sys.platform == 'darwin' ++ if (os.name == 'posix' + and 'LDSHARED' not in os.environ + and ldshared.startswith(cc)): +- # On OS X, if CC is overridden, use that as the default ++ # On POSIX systems, if CC is overridden, use that as the default + # command for LDSHARED as well + ldshared = newcc + ldshared[len(cc):] + cc = newcc +-- +2.25.1 + diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch new file mode 100644 index 000000000000..a1f9d68eb166 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.8/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/3.9/no-ldconfig.patch b/nixpkgs/pkgs/development/interpreters/python/cpython/3.9/no-ldconfig.patch new file mode 100644 index 000000000000..a1f9d68eb166 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/3.9/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/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix new file mode 100644 index 000000000000..b25d613eb7f3 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix @@ -0,0 +1,340 @@ +{ stdenv, fetchurl, fetchpatch +, bzip2 +, expat +, libffi +, gdbm +, lzma +, ncurses +, openssl +, readline +, sqlite +, tcl ? null, tk ? null, tix ? null, libX11 ? null, xorgproto ? null, x11Support ? false +, bluez ? null, bluezSupport ? false +, zlib +, self +, configd +, autoreconfHook +, python-setup-hook +, nukeReferences +# For the Python package set +, packageOverrides ? (self: super: {}) +, buildPackages +, pythonForBuild ? buildPackages.${"python${sourceVersion.major}${sourceVersion.minor}"} +, sourceVersion +, sha256 +, passthruFun +, bash +, stripConfig ? false +, stripIdlelib ? false +, stripTests ? false +, stripTkinter ? false +, rebuildBytecode ? true +, stripBytecode ? false +, includeSiteCustomize ? true +, static ? false +# Not using optimizations on Darwin +# configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found. +, enableOptimizations ? (!stdenv.isDarwin) +}: + +# Note: this package is used for bootstrapping fetchurl, and thus +# cannot use fetchpatch! All mutable patches (generated by GitHub or +# cgit) that are needed here should be included directly in Nixpkgs as +# files. + +assert x11Support -> tcl != null + && tk != null + && xorgproto != null + && libX11 != null; + +assert bluezSupport -> bluez != null; + +with stdenv.lib; + +let + + passthru = passthruFun rec { + inherit self sourceVersion packageOverrides; + implementation = "cpython"; + libPrefix = "python${pythonVersion}"; + executable = libPrefix; + pythonVersion = with sourceVersion; "${major}.${minor}"; + sitePackages = "lib/${libPrefix}/site-packages"; + inherit hasDistutilsCxxPatch pythonForBuild; + }; + + version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; + + nativeBuildInputs = optionals (!stdenv.isDarwin) [ + autoreconfHook + ] ++ [ + nukeReferences + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + buildPackages.stdenv.cc + pythonForBuild + ]; + + buildInputs = filter (p: p != null) ([ + zlib bzip2 expat lzma libffi gdbm sqlite readline ncurses openssl ] + ++ optionals x11Support [ tcl tk libX11 xorgproto ] + ++ optionals (bluezSupport && stdenv.isLinux) [ bluez ] + ++ optionals stdenv.isDarwin [ configd ]); + + hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); + + inherit pythonForBuild; + + pythonForBuildInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then + "$out/bin/python" + else pythonForBuild.interpreter; + +in with passthru; stdenv.mkDerivation { + pname = "python3"; + inherit version; + + inherit buildInputs nativeBuildInputs; + + src = fetchurl { + url = with sourceVersion; "https://www.python.org/ftp/python/${major}.${minor}.${patch}/Python-${version}.tar.xz"; + inherit sha256; + }; + + prePatch = optionalString stdenv.isDarwin '' + substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"' + substituteInPlace configure --replace '-Wl,-stack_size,1000000' ' ' + '' + optionalString (stdenv.isDarwin && x11Support) '' + substituteInPlace setup.py --replace /Library/Frameworks /no-such-path + ''; + + patches = [ + # 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). + (./. + "/${sourceVersion.major}.${sourceVersion.minor}/no-ldconfig.patch") + ] ++ optionals (isPy35 || isPy36) [ + # Determinism: Write null timestamps when compiling python files. + ./3.5/force_bytecode_determinism.patch + ] ++ optionals isPy35 [ + # Backports support for LD_LIBRARY_PATH from 3.6 + ./3.5/ld_library_path.patch + ] ++ optionals (isPy35 || isPy36 || isPy37) [ + # Backport a fix for discovering `rpmbuild` command when doing `python setup.py bdist_rpm` to 3.5, 3.6, 3.7. + # See: https://bugs.python.org/issue11122 + ./3.7/fix-hardcoded-path-checking-for-rpmbuild.patch + ] ++ optionals (isPy37 || isPy38 || isPy39) [ + # Fix darwin build https://bugs.python.org/issue34027 + ./3.7/darwin-libutil.patch + ] ++ optionals (pythonOlder "3.8") [ + # Backport from CPython 3.8 of a good list of tests to run for PGO. + ( + if isPy36 || isPy37 then + ./3.6/profile-task.patch + else + ./3.5/profile-task.patch + ) + ] ++ optionals (isPy3k && 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. + ( + if isPy35 then + ./3.5/python-3.x-distutils-C++.patch + else if isPy37 || isPy38 || isPy39 then + ./3.7/python-3.x-distutils-C++.patch + else + fetchpatch { + url = "https://bugs.python.org/file48016/python-3.x-distutils-C++.patch"; + sha256 = "1h18lnpx539h5lfxyk379dxwr8m2raigcjixkf133l4xy3f4bzi2"; + } + ) + ] ++ [ + # LDSHARED now uses $CC instead of gcc. Fixes cross-compilation of extension modules. + ./3.8/0001-On-all-posix-systems-not-just-Darwin-set-LDSHARED-if.patch + ]; + + postPatch = '' + substituteInPlace Lib/subprocess.py \ + --replace "'/bin/sh'" "'${bash}/bin/sh'" + '' + 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"}"; + NIX_LDFLAGS = optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) "-lgcc_s" + optionalString stdenv.hostPlatform.isMusl "-lgcc_eh"; + # Determinism: We fix the hashes of str, bytes and datetime objects. + PYTHONHASHSEED=0; + + configureFlags = [ + "--enable-shared" + "--without-ensurepip" + "--with-system-expat" + "--with-system-ffi" + ] ++ optionals enableOptimizations [ + "--enable-optimizations" + ] ++ optionals (pythonOlder "3.7") [ + # This is unconditionally true starting in CPython 3.7. + "--with-threads" + ] ++ optionals (sqlite != null && isPy3k) [ + "--enable-loadable-sqlite-extensions" + ] ++ optionals (openssl != null) [ + "--with-openssl=${openssl.dev}" + ] ++ 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" + ] ++ optionals stdenv.hostPlatform.isLinux [ + # Never even try to use lchmod on linux, + # don't rely on detecting glibc-isms. + "ac_cv_func_lchmod=no" + ] ++ optional static "LDFLAGS=-static"; + + 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 (isPy3k && pythonOlder "3.7") '' + # Determinism: The interpreter is patched to write null timestamps when compiling Python files + # so Python doesn't try to update the bytecode when seeing frozen timestamps in Nix's store. + export DETERMINISTIC_BUILD=1; + '' + 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/${libPrefix}/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/${libPrefix}/test/__init__.py + + ln -s "$out/include/${executable}m" "$out/include/${executable}" + + # 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/${libPrefix}/_sysconfigdata*.py $out/lib/${libPrefix}/config-${sourceVersion.major}${sourceVersion.minor}*/Makefile; do + sed -i $i -e "s|$TMPDIR|/no-such-path|g" + done + + # Further get rid of references. https://github.com/NixOS/nixpkgs/issues/51668 + find $out/lib/python*/config-* -type f -print -exec nuke-refs -e $out '{}' + + find $out/lib -name '_sysconfigdata*.py*' -print -exec nuke-refs -e $out '{}' + + + '' + optionalString stripConfig '' + rm -R $out/bin/python*-config $out/lib/python*/config-* + '' + optionalString stripIdlelib '' + # Strip IDLE (and turtledemo, which uses it) + rm -R $out/bin/idle* $out/lib/python*/{idlelib,turtledemo} + '' + optionalString stripTkinter '' + rm -R $out/lib/python*/tkinter + '' + optionalString stripTests '' + # Strip tests + rm -R $out/lib/python*/test $out/lib/python*/**/test{,s} + '' + optionalString includeSiteCustomize '' + # Include a sitecustomize.py file + cp ${../sitecustomize.py} $out/${sitePackages}/sitecustomize.py + '' + optionalString rebuildBytecode '' + + # 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" | ${pythonForBuildInterpreter} -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | ${pythonForBuildInterpreter} -O -m compileall -q -f -x "lib2to3" -i - + find $out -name "*.py" | ${pythonForBuildInterpreter} -OO -m compileall -q -f -x "lib2to3" -i - + '' + optionalString stripBytecode '' + find $out -type d -name __pycache__ -print0 | xargs -0 -I {} rm -rf "{}" + '' + '' + # *strip* shebang from libpython gdb script - it should be dual-syntax and + # interpretable by whatever python the gdb in question is using, which may + # not even match the major version of this python. doing this after the + # bytecode compilations for the same reason. + mkdir -p $out/share/gdb + sed '/^#!/d' Tools/gdb/libpython.py > $out/share/gdb/libpython.py + ''; + + preFixup = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' + # Ensure patch-shebangs uses shebangs of host interpreter. + export PATH=${stdenv.lib.makeBinPath [ "$out" bash ]}:$PATH + ''; + + # Enforce that we don't have references to the OpenSSL -dev package, which we + # explicitly specify in our configure flags above. + disallowedReferences = + stdenv.lib.optionals (openssl != null && !static) [ openssl.dev ] + ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + # Ensure we don't have references to build-time packages. + # These typically end up in shebangs. + pythonForBuild buildPackages.bash + ]; + + separateDebugInfo = true; + + inherit passthru; + + 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 ]; + }; +} 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..e033858acc01 --- /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 { + name = "python27-docs-html-2.7.16"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/2.7.16/python-2.7.16-docs-html.tar.bz2"; + sha256 = "1razs1grzhai65ihaiyph8kz6ncjkgp1gsn3c8v7kanf13lqim02"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/html + ''; + meta = { + maintainers = [ ]; + }; +} 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..c9a770a6fcf1 --- /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 { + name = "python27-docs-pdf-a4-2.7.16"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/2.7.16/python-2.7.16-docs-pdf-a4.tar.bz2"; + sha256 = "14ml1ynrlbhg43737bdsb8k5y39wsffqj4iwhylhb8n8l5dplfdq"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/pdf-a4 + ''; + meta = { + maintainers = [ ]; + }; +} 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..e03d031bae48 --- /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 { + name = "python27-docs-pdf-letter-2.7.16"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/2.7.16/python-2.7.16-docs-pdf-letter.tar.bz2"; + sha256 = "019i8n48m71mn31v8d85kkwyqfgcgqnqh506y4a7fcgf656bajs0"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/pdf-letter + ''; + meta = { + maintainers = [ ]; + }; +} 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..d19d7be19357 --- /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 { + name = "python27-docs-text-2.7.16"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/2.7.16/python-2.7.16-docs-text.tar.bz2"; + sha256 = "1da7swlykvc013684nywycinfz3v8dqkcmv0zj8p7l5lyi5mq03r"; + }; + installPhase = '' + mkdir -p $out/share/doc/python27 + cp -R ./ $out/share/doc/python27/text + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-html.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-html.nix new file mode 100644 index 000000000000..a83363b5c473 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-html.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python37-docs-html-3.7.2"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/3.7.2/python-3.7.2-docs-html.tar.bz2"; + sha256 = "19wbrawpdam09fmyipfy92sxwn1rl93v8jkfqsfx028qhvzf0422"; + }; + installPhase = '' + mkdir -p $out/share/doc/python37 + cp -R ./ $out/share/doc/python37/html + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-a4.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-a4.nix new file mode 100644 index 000000000000..e60032f71bf8 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-a4.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python37-docs-pdf-a4-3.7.2"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/3.7.2/python-3.7.2-docs-pdf-a4.tar.bz2"; + sha256 = "0vdx762m30hjaabn6w88awcj2qpbz0b6z59zn9wmamd35k59lfba"; + }; + installPhase = '' + mkdir -p $out/share/doc/python37 + cp -R ./ $out/share/doc/python37/pdf-a4 + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-letter.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-letter.nix new file mode 100644 index 000000000000..b737a1e32995 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-pdf-letter.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python37-docs-pdf-letter-3.7.2"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/3.7.2/python-3.7.2-docs-pdf-letter.tar.bz2"; + sha256 = "17g57vlyvqx0k916q84q2pcx7y8myw0fda9fvg9kh0ph930c837x"; + }; + installPhase = '' + mkdir -p $out/share/doc/python37 + cp -R ./ $out/share/doc/python37/pdf-letter + ''; + meta = { + maintainers = [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-text.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-text.nix new file mode 100644 index 000000000000..2897042ec04a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/3.7-text.nix @@ -0,0 +1,18 @@ +# This file was generated and will be overwritten by ./generate.sh + +{ stdenv, fetchurl, lib }: + +stdenv.mkDerivation { + name = "python37-docs-text-3.7.2"; + src = fetchurl { + url = "http://docs.python.org/ftp/python/doc/3.7.2/python-3.7.2-docs-text.tar.bz2"; + sha256 = "0h50rlr8jclwfxa106b42q2vn2ynp219c4zsy5qz65n5m3b7y1g2"; + }; + installPhase = '' + mkdir -p $out/share/doc/python37 + cp -R ./ $out/share/doc/python37/text + ''; + meta = { + maintainers = [ ]; + }; +} 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..a538f731473b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/cpython/docs/default.nix @@ -0,0 +1,41 @@ +{ stdenv, fetchurl, lib }: + +let +pythonDocs = { + html = { + recurseForDerivations = true; + python27 = import ./2.7-html.nix { + inherit stdenv fetchurl lib; + }; + python37 = import ./3.7-html.nix { + inherit stdenv fetchurl lib; + }; + }; + pdf_a4 = { + recurseForDerivations = true; + python27 = import ./2.7-pdf-a4.nix { + inherit stdenv fetchurl lib; + }; + python37 = import ./3.7-pdf-a4.nix { + inherit stdenv fetchurl lib; + }; + }; + pdf_letter = { + recurseForDerivations = true; + python27 = import ./2.7-pdf-letter.nix { + inherit stdenv fetchurl lib; + }; + python37 = import ./3.7-pdf-letter.nix { + inherit stdenv fetchurl lib; + }; + }; + text = { + recurseForDerivations = true; + python27 = import ./2.7-text.nix { + inherit stdenv fetchurl lib; + }; + python37 = import ./3.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..a4b2e0893fcd --- /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=$(for major in 2 3; do curl https://docs.python.org/$major/archives/ 2>/dev/null | perl -l -n -e'/<a href="python-([23].[0-9].[0-9]+)-docs-html.tar.bz2/ && print $1' | tail -n 1; done) +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..3cc0c2a9ee85 --- /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 { + 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 = [ ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/default.nix b/nixpkgs/pkgs/development/interpreters/python/default.nix new file mode 100644 index 000000000000..ce357b6f58e3 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/default.nix @@ -0,0 +1,207 @@ +{ pkgs }: + +with pkgs; + +(let + + # Common passthru for all Python interpreters. + passthruFun = + { implementation + , libPrefix + , executable + , sourceVersion + , pythonVersion + , packageOverrides + , sitePackages + , hasDistutilsCxxPatch + , pythonForBuild + , self + }: let + pythonPackages = callPackage ../../../top-level/python-packages.nix { + python = self; + overrides = packageOverrides; + }; + in rec { + isPy27 = pythonVersion == "2.7"; + isPy35 = pythonVersion == "3.5"; + isPy36 = pythonVersion == "3.6"; + isPy37 = pythonVersion == "3.7"; + isPy38 = pythonVersion == "3.8"; + isPy39 = pythonVersion == "3.9"; + isPy2 = lib.strings.substring 0 1 pythonVersion == "2"; + isPy3 = lib.strings.substring 0 1 pythonVersion == "3"; + isPy3k = isPy3; + isPyPy = lib.hasInfix "pypy" interpreter; + + buildEnv = callPackage ./wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; }; + withPackages = import ./with-packages.nix { inherit buildEnv pythonPackages;}; + pkgs = pythonPackages; + interpreter = "${self}/bin/${executable}"; + inherit executable implementation libPrefix pythonVersion sitePackages; + inherit sourceVersion packageOverrides; + pythonAtLeast = lib.versionAtLeast pythonVersion; + pythonOlder = lib.versionOlder pythonVersion; + inherit hasDistutilsCxxPatch pythonForBuild; + + tests = callPackage ./tests.nix { + python = self; + }; + }; + +in { + + python27 = callPackage ./cpython/2.7 { + self = python27; + sourceVersion = { + major = "2"; + minor = "7"; + patch = "18"; + suffix = ""; + }; + sha256 = "0hzgxl94hnflis0d6m4szjx0b52gah7wpmcg5g00q7am6xwhwb5n"; + inherit (darwin) configd; + inherit passthruFun; + }; + + python36 = callPackage ./cpython { + self = python36; + sourceVersion = { + major = "3"; + minor = "6"; + patch = "12"; + suffix = ""; + }; + sha256 = "cJU6m11okdkuZdGEw1EhJqFYFL7hXh7/LdzOBDNOmpk="; + inherit (darwin) configd; + inherit passthruFun; + }; + + python37 = callPackage ./cpython { + self = python37; + sourceVersion = { + major = "3"; + minor = "7"; + patch = "9"; + suffix = ""; + }; + sha256 = "008v6g1jkrjrdmiqlgjlq6msbbj848bvkws6ppwva1ahn03k14li"; + inherit (darwin) configd; + inherit passthruFun; + }; + + python38 = callPackage ./cpython { + self = python38; + sourceVersion = { + major = "3"; + minor = "8"; + patch = "5"; + suffix = ""; + }; + sha256 = "1c43dbv9lvlp3ynqmgdi4rh8q94swanhqarqrdx62zmigpakw073"; + inherit (darwin) configd; + inherit passthruFun; + }; + + python39 = callPackage ./cpython { + self = python39; + sourceVersion = { + major = "3"; + minor = "9"; + patch = "0"; + suffix = "rc1"; + }; + sha256 = "0w6wvyy9fbvfvrmhvmlb5gq18haagywk9hjkp1knjdarfczag9zv"; + inherit (darwin) configd; + inherit passthruFun; + }; + + # Minimal versions of Python (built without optional dependencies) + python3Minimal = (python38.override { + self = python3Minimal; + pythonForBuild = pkgs.buildPackages.python3Minimal; + # strip down that python version as much as possible + openssl = null; + readline = null; + ncurses = null; + gdbm = null; + sqlite = null; + configd = null; + stripConfig = true; + stripIdlelib = true; + stripTests = true; + stripTkinter = true; + rebuildBytecode = false; + stripBytecode = true; + includeSiteCustomize = false; + enableOptimizations = false; + }).overrideAttrs(old: { + pname = "python3-minimal"; + meta = old.meta // { + maintainers = []; + }; + }); + + pypy27 = callPackage ./pypy { + self = pypy27; + sourceVersion = { + major = "7"; + minor = "3"; + patch = "1"; + }; + sha256 = "08ckkhd0ix6j9873a7gr507c72d4cmnv5lwvprlljdca9i8p2dzs"; + pythonVersion = "2.7"; + db = db.override { dbmSupport = !stdenv.isDarwin; }; + python = python27; + inherit passthruFun; + inherit (darwin) libunwind; + inherit (darwin.apple_sdk.frameworks) Security; + }; + + pypy36 = callPackage ./pypy { + self = pypy36; + sourceVersion = { + major = "7"; + minor = "3"; + patch = "1"; + }; + sha256 = "10zsk8jby8j6visk5mzikpb1cidvz27qq4pfpa26jv53klic6b0c"; + pythonVersion = "3.6"; + db = db.override { dbmSupport = !stdenv.isDarwin; }; + python = python27; + inherit passthruFun; + inherit (darwin) libunwind; + inherit (darwin.apple_sdk.frameworks) Security; + }; + + pypy27_prebuilt = callPackage ./pypy/prebuilt.nix { + # Not included at top-level + self = pythonInterpreters.pypy27_prebuilt; + sourceVersion = { + major = "7"; + minor = "3"; + patch = "1"; + }; + sha256 = "18xc5kwidj5hjwbr0w8v1nfpg5l4lk01z8cn804zfyyz8xjqhx5y"; # linux64 + pythonVersion = "2.7"; + inherit passthruFun; + }; + + pypy36_prebuilt = callPackage ./pypy/prebuilt.nix { + # Not included at top-level + self = pythonInterpreters.pypy36_prebuilt; + sourceVersion = { + major = "7"; + minor = "3"; + patch = "1"; + }; + sha256 = "04nv0mkalaliphbjw7y0pmb372bxwjzwmcsqkf9kwsik99kg2z7n"; # linux64 + pythonVersion = "3.6"; + inherit passthruFun; + }; + + graalpython37 = callPackage ./graalpython/default.nix { + self = pythonInterpreters.graalpython37; + inherit passthruFun; + }; + +}) diff --git a/nixpkgs/pkgs/development/interpreters/python/fetchpypi.nix b/nixpkgs/pkgs/development/interpreters/python/fetchpypi.nix new file mode 100644 index 000000000000..e60c9df1f8bb --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/fetchpypi.nix @@ -0,0 +1,28 @@ +# `fetchPypi` function for fetching artifacts from PyPI. +{ fetchurl +, makeOverridable +}: + +let + computeUrl = {format ? "setuptools", ... } @attrs: let + computeWheelUrl = {pname, version, python ? "py2.py3", abi ? "none", platform ? "any"}: + # Fetch a wheel. By default we fetch an universal wheel. + # See https://www.python.org/dev/peps/pep-0427/#file-name-convention for details regarding the optional arguments. + "https://files.pythonhosted.org/packages/${python}/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}-${python}-${abi}-${platform}.whl"; + + computeSourceUrl = {pname, version, extension ? "tar.gz"}: + # Fetch a source tarball. + "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}.${extension}"; + + compute = (if format == "wheel" then computeWheelUrl + else if format == "setuptools" then computeSourceUrl + else throw "Unsupported format ${format}"); + + in compute (builtins.removeAttrs attrs ["format"]); + +in makeOverridable( {format ? "setuptools", sha256 ? "", hash ? "", ... } @attrs: + let + url = computeUrl (builtins.removeAttrs attrs ["sha256" "hash"]) ; + in fetchurl { + inherit url sha256 hash; + }) diff --git a/nixpkgs/pkgs/development/interpreters/python/graalpython/default.nix b/nixpkgs/pkgs/development/interpreters/python/graalpython/default.nix new file mode 100644 index 000000000000..b5d7d130b5a7 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/graalpython/default.nix @@ -0,0 +1,21 @@ +{ pkgs +, lib +, graalvm8 +, passthruFun +, packageOverrides ? (self: super: {}) +, self +}: + +let + passthru = passthruFun { + inherit self packageOverrides; + implementation = "graal"; + sourceVersion = graalvm8.version; + pythonVersion = "3.7"; + libPrefix = "graalvm"; + sitePackages = "jre/languages/python/lib-python/3/site-packages"; + executable = "graalpython"; + hasDistutilsCxxPatch = false; + pythonForBuild = pkgs.buildPackages.pythonInterpreters.graalpython37; + }; +in lib.extendDerivation true passthru graalvm8 diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix b/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix new file mode 100644 index 000000000000..d14eb9cbb09d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix @@ -0,0 +1,156 @@ +# Hooks for building Python packages. +{ python +, lib +, callPackage +, makeSetupHook +, disabledIf +, isPy3k +, ensureNewerSourcesForZipFilesHook +}: + +let + pythonInterpreter = python.pythonForBuild.interpreter; + pythonSitePackages = python.sitePackages; + pythonCheckInterpreter = python.interpreter; + setuppy = ../run_setup.py; +in rec { + + eggBuildHook = callPackage ({ }: + makeSetupHook { + name = "egg-build-hook.sh"; + deps = [ ]; + } ./egg-build-hook.sh) {}; + + eggInstallHook = callPackage ({ setuptools }: + makeSetupHook { + name = "egg-install-hook.sh"; + deps = [ setuptools ]; + substitutions = { + inherit pythonInterpreter pythonSitePackages; + }; + } ./egg-install-hook.sh) {}; + + eggUnpackHook = callPackage ({ }: + makeSetupHook { + name = "egg-unpack-hook.sh"; + deps = [ ]; + } ./egg-unpack-hook.sh) {}; + + flitBuildHook = callPackage ({ flit }: + makeSetupHook { + name = "flit-build-hook"; + deps = [ flit ]; + substitutions = { + inherit pythonInterpreter; + }; + } ./flit-build-hook.sh) {}; + + pipBuildHook = callPackage ({ pip, wheel }: + makeSetupHook { + name = "pip-build-hook.sh"; + deps = [ pip wheel ]; + substitutions = { + inherit pythonInterpreter pythonSitePackages; + }; + } ./pip-build-hook.sh) {}; + + pipInstallHook = callPackage ({ pip }: + makeSetupHook { + name = "pip-install-hook"; + deps = [ pip ]; + substitutions = { + inherit pythonInterpreter pythonSitePackages; + }; + } ./pip-install-hook.sh) {}; + + pytestCheckHook = callPackage ({ pytest }: + makeSetupHook { + name = "pytest-check-hook"; + deps = [ pytest ]; + substitutions = { + inherit pythonCheckInterpreter; + }; + } ./pytest-check-hook.sh) {}; + + pythonCatchConflictsHook = callPackage ({ setuptools }: + makeSetupHook { + name = "python-catch-conflicts-hook"; + deps = [ setuptools ]; + substitutions = { + inherit pythonInterpreter; + catchConflicts=../catch_conflicts/catch_conflicts.py; + }; + } ./python-catch-conflicts-hook.sh) {}; + + pythonImportsCheckHook = callPackage ({}: + makeSetupHook { + name = "python-imports-check-hook.sh"; + substitutions = { + inherit pythonCheckInterpreter; + }; + } ./python-imports-check-hook.sh) {}; + + pythonNamespacesHook = callPackage ({}: + makeSetupHook { + name = "python-namespaces-hook.sh"; + substitutions = { + inherit pythonSitePackages; + }; + } ./python-namespaces-hook.sh) {}; + + pythonRecompileBytecodeHook = callPackage ({ }: + makeSetupHook { + name = "python-recompile-bytecode-hook"; + substitutions = { + inherit pythonInterpreter pythonSitePackages; + compileArgs = lib.concatStringsSep " " (["-q" "-f" "-i -"] ++ lib.optionals isPy3k ["-j $NIX_BUILD_CORES"]); + bytecodeName = if isPy3k then "__pycache__" else "*.pyc"; + }; + } ./python-recompile-bytecode-hook.sh ) {}; + + pythonRemoveBinBytecodeHook = callPackage ({ }: + makeSetupHook { + name = "python-remove-bin-bytecode-hook"; + } ./python-remove-bin-bytecode-hook.sh) {}; + + pythonRemoveTestsDirHook = callPackage ({ }: + makeSetupHook { + name = "python-remove-tests-dir-hook"; + substitutions = { + inherit pythonSitePackages; + }; + } ./python-remove-tests-dir-hook.sh) {}; + + setuptoolsBuildHook = callPackage ({ setuptools, wheel }: + makeSetupHook { + name = "setuptools-setup-hook"; + deps = [ setuptools wheel ]; + substitutions = { + inherit pythonInterpreter pythonSitePackages setuppy; + }; + } ./setuptools-build-hook.sh) {}; + + setuptoolsCheckHook = callPackage ({ setuptools }: + makeSetupHook { + name = "setuptools-check-hook"; + deps = [ setuptools ]; + substitutions = { + inherit pythonCheckInterpreter setuppy; + }; + } ./setuptools-check-hook.sh) {}; + + venvShellHook = disabledIf (!isPy3k) (callPackage ({ }: + makeSetupHook { + name = "venv-shell-hook"; + deps = [ ensureNewerSourcesForZipFilesHook ]; + substitutions = { + inherit pythonInterpreter; + }; + } ./venv-shell-hook.sh) {}); + + wheelUnpackHook = callPackage ({ wheel }: + makeSetupHook { + name = "wheel-unpack-hook.sh"; + deps = [ wheel ]; + } ./wheel-unpack-hook.sh) {}; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/egg-build-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/egg-build-hook.sh new file mode 100644 index 000000000000..d5abc8d55e5a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/egg-build-hook.sh @@ -0,0 +1,15 @@ +# Setup hook to use for eggs +echo "Sourcing egg-build-hook" + +eggBuildPhase() { + echo "Executing eggBuildPhase" + runHook preBuild + + runHook postBuild + echo "Finished executing eggBuildPhase" +} + +if [ -z "${dontUseEggBuild-}" ] && [ -z "${buildPhase-}" ]; then + echo "Using eggBuildPhase" + buildPhase=eggBuildPhase +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/egg-install-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/egg-install-hook.sh new file mode 100644 index 000000000000..ae894fb1bde4 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/egg-install-hook.sh @@ -0,0 +1,21 @@ +# Setup hook for eggs +echo "Sourcing egg-install-hook" + +eggInstallPhase() { + echo "Executing eggInstallPhase" + runHook preInstall + + mkdir -p "$out/@pythonSitePackages@" + export PYTHONPATH="$out/@pythonSitePackages@:$PYTHONPATH" + + find + @pythonInterpreter@ -m easy_install --prefix="$out" *.egg + + runHook postInstall + echo "Finished executing eggInstallPhase" +} + +if [ -z "${dontUseEggInstall-}" ] && [ -z "${installPhase-}" ]; then + echo "Using eggInstallPhase" + installPhase=eggInstallPhase +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/egg-unpack-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/egg-unpack-hook.sh new file mode 100644 index 000000000000..c8ed3dee83ba --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/egg-unpack-hook.sh @@ -0,0 +1,17 @@ +# Setup hook to use in case an egg is fetched +echo "Sourcing egg setup hook" + +eggUnpackPhase(){ + echo "Executing eggUnpackPhase" + runHook preUnpack + + cp "$src" "$(stripHash "$src")" + +# runHook postUnpack # Calls find...? + echo "Finished executing eggUnpackPhase" +} + +if [ -z "${dontUseEggUnpack-}" ] && [ -z "${unpackPhase-}" ]; then + echo "Using eggUnpackPhase" + unpackPhase=eggUnpackPhase +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/flit-build-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/flit-build-hook.sh new file mode 100644 index 000000000000..45893aae00f4 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/flit-build-hook.sh @@ -0,0 +1,15 @@ +# Setup hook for flit +echo "Sourcing flit-build-hook" + +flitBuildPhase () { + echo "Executing flitBuildPhase" + runHook preBuild + @pythonInterpreter@ -m flit build --format wheel + runHook postBuild + echo "Finished executing flitBuildPhase" +} + +if [ -z "${dontUseFlitBuild-}" ] && [ -z "${buildPhase-}" ]; then + echo "Using flitBuildPhase" + buildPhase=flitBuildPhase +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/pip-build-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/pip-build-hook.sh new file mode 100644 index 000000000000..6dd384b4847f --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/pip-build-hook.sh @@ -0,0 +1,43 @@ +# Setup hook to use for pip projects +echo "Sourcing pip-build-hook" + +pipBuildPhase() { + echo "Executing pipBuildPhase" + runHook preBuild + + mkdir -p dist + echo "Creating a wheel..." + @pythonInterpreter@ -m pip wheel --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist . + echo "Finished creating a wheel..." + + runHook postBuild + echo "Finished executing pipBuildPhase" +} + +pipShellHook() { + echo "Executing pipShellHook" + runHook preShellHook + + # Long-term setup.py should be dropped. + if [ -e pyproject.toml ]; then + tmp_path=$(mktemp -d) + export PATH="$tmp_path/bin:$PATH" + export PYTHONPATH="$tmp_path/@pythonSitePackages@:$PYTHONPATH" + mkdir -p "$tmp_path/@pythonSitePackages@" + @pythonInterpreter@ -m pip install -e . --prefix "$tmp_path" \ + --no-build-isolation >&2 + fi + + runHook postShellHook + echo "Finished executing pipShellHook" +} + +if [ -z "${dontUsePipBuild-}" ] && [ -z "${buildPhase-}" ]; then + echo "Using pipBuildPhase" + buildPhase=pipBuildPhase +fi + +if [ -z "${shellHook-}" ]; then + echo "Using pipShellHook" + shellHook=pipShellHook +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/pip-install-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/pip-install-hook.sh new file mode 100644 index 000000000000..770739b36bde --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/pip-install-hook.sh @@ -0,0 +1,26 @@ +# Setup hook for pip. +echo "Sourcing pip-install-hook" + +declare -a pipInstallFlags + +pipInstallPhase() { + echo "Executing pipInstallPhase" + runHook preInstall + + mkdir -p "$out/@pythonSitePackages@" + export PYTHONPATH="$out/@pythonSitePackages@:$PYTHONPATH" + + pushd dist || return 1 + mkdir tmpbuild + NIX_PIP_INSTALL_TMPDIR=tmpbuild @pythonInterpreter@ -m pip install ./*.whl --no-index --prefix="$out" --no-cache $pipInstallFlags + rm -rf tmpbuild + popd || return 1 + + runHook postInstall + echo "Finished executing pipInstallPhase" +} + +if [ -z "${dontUsePipInstall-}" ] && [ -z "${installPhase-}" ]; then + echo "Using pipInstallPhase" + installPhase=pipInstallPhase +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh new file mode 100644 index 000000000000..bfd2bfa75836 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh @@ -0,0 +1,61 @@ +# Setup hook for pytest +echo "Sourcing pytest-check-hook" + +declare -ar disabledTests + +function _concatSep { + local result + local sep="$1" + local -n arr=$2 + for index in ${!arr[*]}; do + if [ $index -eq 0 ]; then + result="${arr[index]}" + else + result+=" $sep ${arr[index]}" + fi + done + echo "$result" +} + +function _pytestComputeDisabledTestsString () { + declare -a tests + local tests=($1) + local prefix="not " + prefixed=( "${tests[@]/#/$prefix}" ) + result=$(_concatSep "and" prefixed) + echo "$result" +} + +function pytestCheckPhase() { + echo "Executing pytestCheckPhase" + runHook preCheck + + # Compose arguments + args=" -m pytest" + if [ -n "$disabledTests" ]; then + disabledTestsString=$(_pytestComputeDisabledTestsString "${disabledTests[@]}") + args+=" -k \""$disabledTestsString"\"" + fi + args+=" ${pytestFlagsArray[@]}" + eval "@pythonCheckInterpreter@ $args" + + runHook postCheck + echo "Finished executing pytestCheckPhase" +} + +if [ -z "${dontUsePytestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then + echo "Using pytestCheckPhase" + preDistPhases+=" pytestCheckPhase" + + # It's almost always the case that setuptoolsCheckPhase should not be ran + # when the pytestCheckHook is being ran + if [ -z "${useSetuptoolsCheck-}" ]; then + dontUseSetuptoolsCheck=1 + + # Remove command if already injected into preDistPhases + if [[ "$preDistPhases" =~ "setuptoolsCheckPhase" ]]; then + echo "Removing setuptoolsCheckPhase" + preDistPhases=${preDistPhases/setuptoolsCheckPhase/} + fi + fi +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh new file mode 100644 index 000000000000..374a2eddb407 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook.sh @@ -0,0 +1,10 @@ +# Setup hook for detecting conflicts in Python packages +echo "Sourcing python-catch-conflicts-hook.sh" + +pythonCatchConflictsPhase() { + @pythonInterpreter@ @catchConflicts@ +} + +if [ -z "${dontUsePythonCatchConflicts-}" ]; then + preDistPhases+=" pythonCatchConflictsPhase" +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh new file mode 100644 index 000000000000..f8ca84cd573a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/python-imports-check-hook.sh @@ -0,0 +1,16 @@ +# Setup hook for checking whether Python imports succeed +echo "Sourcing python-imports-check-hook.sh" + +pythonImportsCheckPhase () { + echo "Executing pythonImportsCheckPhase" + + if [ -n "$pythonImportsCheck" ]; then + echo "Check whether the following modules can be imported: $pythonImportsCheck" + ( cd $out && eval "@pythonCheckInterpreter@ -c 'import os; import importlib; list(map(lambda mod: importlib.import_module(mod), os.environ[\"pythonImportsCheck\"].split()))'" ) + fi +} + +if [ -z "${dontUsePythonImportsCheck-}" ]; then + echo "Using pythonImportsCheckPhase" + preDistPhases+=" pythonImportsCheckPhase" +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh new file mode 100644 index 000000000000..50f21819d176 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh @@ -0,0 +1,40 @@ +# Clean up __init__.py's found in namespace directories +echo "Sourcing python-namespaces-hook" + +pythonNamespacesHook() { + echo "Executing pythonNamespacesHook" + + for namespace in ${pythonNamespaces[@]}; do + echo "Enforcing PEP420 namespace: ${namespace}" + + # split namespace into segments. "azure.mgmt" -> "azure mgmt" + IFS='.' read -ra pathSegments <<< $namespace + constructedPath=$out/@pythonSitePackages@ + + # Need to remove the __init__.py at each namespace level + # E.g `azure/__init__.py` and `azure/mgmt/__init__.py` + # The __pycache__ entry also needs to be removed + for pathSegment in ${pathSegments[@]}; do + constructedPath=${constructedPath}/${pathSegment} + pathToRemove=${constructedPath}/__init__.py + pycachePath=${constructedPath}/__pycache__/__init__* + + if [ -f "$pathToRemove" ]; then + echo "Removing $pathToRemove" + rm "$pathToRemove" + fi + + if [ -f "$pycachePath" ]; then + echo "Removing $pycachePath" + rm "$pycachePath" + fi + done + done + + echo "Finished executing pythonNamespacesHook" +} + +if [ -z "${dontUsePythonNamespacesHook-}" -a -n "${pythonNamespaces-}" ]; then + postFixupHooks+=(pythonNamespacesHook) +fi + diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/python-recompile-bytecode-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/python-recompile-bytecode-hook.sh new file mode 100644 index 000000000000..649d0c17ea0c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/python-recompile-bytecode-hook.sh @@ -0,0 +1,24 @@ +# Setup hook for recompiling bytecode. +# https://github.com/NixOS/nixpkgs/issues/81441 +echo "Sourcing python-recompile-bytecode-hook.sh" + +# Remove all bytecode from the $out output. Then, recompile only site packages folder +# Note this effectively duplicates `python-remove-bin-bytecode`, but long-term +# this hook should be removed again. + +pythonRecompileBytecodePhase () { + # TODO: consider other outputs than $out + + items="$(find "$out" -name "@bytecodeName@")" + if [[ -n $items ]]; then + for pycache in $items; do + rm -rf "$pycache" + done + fi + + find "$out"/@pythonSitePackages@ -name "*.py" -exec @pythonInterpreter@ -OO -m compileall @compileArgs@ {} + +} + +if [ -z "${dontUsePythonRecompileBytecode-}" ]; then + postPhases+=" pythonRecompileBytecodePhase" +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh new file mode 100644 index 000000000000..1180694294db --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/python-remove-bin-bytecode-hook.sh @@ -0,0 +1,17 @@ +# Setup hook for removing bytecode from the bin folder +echo "Sourcing python-remove-bin-bytecode-hook.sh" + +# The bin folder is added to $PATH and should only contain executables. +# It may happen there are executables with a .py extension for which +# bytecode is generated. This hook removes that bytecode. + +pythonRemoveBinBytecodePhase () { + if [ -d "$out/bin" ]; then + rm -rf "$out/bin/__pycache__" # Python 3 + find "$out/bin" -type f -name "*.pyc" -delete # Python 2 + fi +} + +if [ -z "${dontUsePythonRemoveBinBytecode-}" ]; then + preDistPhases+=" pythonRemoveBinBytecodePhase" +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/python-remove-tests-dir-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/python-remove-tests-dir-hook.sh new file mode 100644 index 000000000000..83bea786db6d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/python-remove-tests-dir-hook.sh @@ -0,0 +1,15 @@ +# Clean up top-level tests directory in site-package installation. +echo "Sourcing python-remove-tests-dir-hook" + +pythonRemoveTestsDir() { + echo "Executing pythonRemoveTestsDir" + + rm -rf $out/@pythonSitePackages@/tests + + echo "Finished executing pythonRemoveTestsDir" +} + +if [ -z "${dontUsePythonRemoveTestsDir-}" ]; then + postFixupHooks+=(pythonRemoveTestsDir) +fi + diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh new file mode 100644 index 000000000000..311590425e68 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh @@ -0,0 +1,48 @@ +# Setup hook for setuptools. +echo "Sourcing setuptools-build-hook" + +setuptoolsBuildPhase() { + echo "Executing setuptoolsBuildPhase" + local args + runHook preBuild + + cp -f @setuppy@ nix_run_setup + args="" + if [ -n "$setupPyGlobalFlags" ]; then + args+="$setupPyGlobalFlags" + fi + if [ -n "$setupPyBuildFlags" ]; then + args+="build_ext $setupPyBuildFlags" + fi + eval "@pythonInterpreter@ nix_run_setup $args bdist_wheel" + + runHook postBuild + echo "Finished executing setuptoolsBuildPhase" +} + +setuptoolsShellHook() { + echo "Executing setuptoolsShellHook" + runHook preShellHook + + if test -e setup.py; then + tmp_path=$(mktemp -d) + export PATH="$tmp_path/bin:$PATH" + export PYTHONPATH="$tmp_path/@pythonSitePackages@:$PYTHONPATH" + mkdir -p "$tmp_path/@pythonSitePackages@" + eval "@pythonInterpreter@ -m pip install -e . --prefix $tmp_path \ + --no-build-isolation >&2" + fi + + runHook postShellHook + echo "Finished executing setuptoolsShellHook" +} + +if [ -z "${dontUseSetuptoolsBuild-}" ] && [ -z "${buildPhase-}" ]; then + echo "Using setuptoolsBuildPhase" + buildPhase=setuptoolsBuildPhase +fi + +if [ -z "${dontUseSetuptoolsShellHook-}" ] && [ -z "${shellHook-}" ]; then + echo "Using setuptoolsShellHook" + shellHook=setuptoolsShellHook +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/setuptools-check-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/setuptools-check-hook.sh new file mode 100644 index 000000000000..88b7b11931b0 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/setuptools-check-hook.sh @@ -0,0 +1,18 @@ +# Setup hook for setuptools. +echo "Sourcing setuptools-check-hook" + +setuptoolsCheckPhase() { + echo "Executing setuptoolsCheckPhase" + runHook preCheck + + cp -f @setuppy@ nix_run_setup + @pythonCheckInterpreter@ nix_run_setup test + + runHook postCheck + echo "Finished executing setuptoolsCheckPhase" +} + +if [ -z "${dontUseSetuptoolsCheck-}" ] && [ -z "${installCheckPhase-}" ]; then + echo "Using setuptoolsCheckPhase" + preDistPhases+=" setuptoolsCheckPhase" +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/venv-shell-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/venv-shell-hook.sh new file mode 100644 index 000000000000..1fcc0bbd4b13 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/venv-shell-hook.sh @@ -0,0 +1,28 @@ +venvShellHook() { + echo "Executing venvHook" + runHook preShellHook + + if [ -d "${venvDir}" ]; then + echo "Skipping venv creation, '${venvDir}' already exists" + source "${venvDir}/bin/activate" + else + echo "Creating new venv environment in path: '${venvDir}'" + @pythonInterpreter@ -m venv "${venvDir}" + + source "${venvDir}/bin/activate" + runHook postVenvCreation + fi + + runHook postShellHook + echo "Finished executing venvShellHook" +} + +if [ -z "${dontUseVenvShellHook:-}" ] && [ -z "${shellHook-}" ]; then + echo "Using venvShellHook" + if [ -z "${venvDir-}" ]; then + echo "Error: \`venvDir\` should be set when using \`venvShellHook\`." + exit 1 + else + shellHook=venvShellHook + fi +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/wheel-unpack-hook.sh b/nixpkgs/pkgs/development/interpreters/python/hooks/wheel-unpack-hook.sh new file mode 100644 index 000000000000..fca808a933ba --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/hooks/wheel-unpack-hook.sh @@ -0,0 +1,18 @@ +# Setup hook to use in case a wheel is fetched +echo "Sourcing wheel setup hook" + +wheelUnpackPhase(){ + echo "Executing wheelUnpackPhase" + runHook preUnpack + + mkdir -p dist + cp "$src" "dist/$(stripHash "$src")" + +# runHook postUnpack # Calls find...? + echo "Finished executing wheelUnpackPhase" +} + +if [ -z "${dontUseWheelUnpack-}" ] && [ -z "${unpackPhase-}" ]; then + echo "Using wheelUnpackPhase" + unpackPhase=wheelUnpackPhase +fi diff --git a/nixpkgs/pkgs/development/interpreters/python/manylinux/default.nix b/nixpkgs/pkgs/development/interpreters/python/manylinux/default.nix new file mode 100644 index 000000000000..a44ead23752b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/manylinux/default.nix @@ -0,0 +1,86 @@ +{ lib, pkgs }: + +let + # Create a derivation that links all desired manylinux libraries + createManyLinuxPackage = name: libs: let + drvs = lib.unique (lib.attrValues libs); + names = lib.attrNames libs; + in pkgs.runCommand name { + buildInputs = drvs; + } '' + mkdir -p $out/lib + num_found=0 + + IFS=: + export DESIRED_LIBRARIES=${lib.concatStringsSep ":" names} + export LIBRARY_PATH=${lib.makeLibraryPath drvs} + for desired in $DESIRED_LIBRARIES; do + for path in $LIBRARY_PATH; do + if [ -e $path/$desired ]; then + echo "FOUND $path/$desired" + ln -s $path/$desired $out/lib/$desired + num_found=$((num_found+1)) + break + fi + done + done + + num_desired=${toString (lib.length names)} + echo "Found $num_found of $num_desired libraries" + if [ "$num_found" -ne "$num_desired" ]; then + echo "Error: not all desired libraries were found" + exit 1 + fi + ''; + + getLibOutputs = lib.mapAttrs (k: v: lib.getLib v); + + # https://www.python.org/dev/peps/pep-0599/ + manylinux2014Libs = getLibOutputs(with pkgs; { + "libgcc_s.so.1" = glibc; + "libstdc++.so.6" = stdenv.cc.cc; + "libm.so.6" = glibc; + "libdl.so.2" = glibc; + "librt.so.1" = glibc; + "libc.so.6" = glibc; + "libnsl.so.1" = glibc; + "libutil.so.1" = glibc; + "libpthread.so.0" = glibc; + "libresolv.so.2" = glibc; + "libX11.so.6" = xorg.libX11; + "libXext.so.6" = xorg.libXext; + "libXrender.so.1" = xorg.libXrender; + "libICE.so.6" = xorg.libICE; + "libSM.so.6" = xorg.libSM; + "libGL.so.1" = libGL; + "libgobject-2.0.so.0" = glib; + "libgthread-2.0.so.0" = glib; + "libglib-2.0.so.0" = glib; + }); + + # https://www.python.org/dev/peps/pep-0571/ + manylinux2010Libs = manylinux2014Libs; + + # https://www.python.org/dev/peps/pep-0513/ + manylinux1Libs = getLibOutputs(manylinux2010Libs // (with pkgs; { + "libpanelw.so.5" = ncurses5; + "libncursesw.so.5" = ncurses5; + "libcrypt.so.1" = glibc; + })); + +in { + # List of libraries that are needed for manylinux compatibility. + # When using a wheel that is manylinux1 compatible, just extend + # the `buildInputs` with one of these `manylinux` lists. + # Additionally, add `autoPatchelfHook` to `nativeBuildInputs`. + manylinux1 = lib.unique (lib.attrValues manylinux1Libs); + manylinux2010 = lib.unique (lib.attrValues manylinux2010Libs); + manylinux2014 = lib.unique (lib.attrValues manylinux2014Libs); + + # These are symlink trees to the relevant libs and are typically not needed + # These exist so as to quickly test whether all required libraries are provided + # by the mapped packages. + manylinux1Package = createManyLinuxPackage "manylinux1" manylinux1Libs; + manylinux2010Package = createManyLinuxPackage "manylinux2010" manylinux2010Libs; + manylinux2014Package = createManyLinuxPackage "manylinux2014" manylinux2014Libs; +} 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..c3be76790ebd --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -0,0 +1,187 @@ +# Generic builder. + +{ lib +, config +, python +, wrapPython +, unzip +, ensureNewerSourcesForZipFilesHook +# Whether the derivation provides a Python module or not. +, toPythonModule +, namePrefix +, update-python-libraries +, setuptools +, flitBuildHook +, pipBuildHook +, pipInstallHook +, pythonCatchConflictsHook +, pythonImportsCheckHook +, pythonNamespacesHook +, pythonRecompileBytecodeHook +, pythonRemoveBinBytecodeHook +, pythonRemoveTestsDirHook +, setuptoolsBuildHook +, setuptoolsCheckHook +, wheelUnpackHook +, eggUnpackHook +, eggBuildHook +, eggInstallHook +}: + +{ 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 ? [] + +# Enabled to detect some (native)BuildInputs mistakes +, strictDeps ? true + +# 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 + +# Don't use Pip to install a wheel +# Note this is actually a variable for the pipInstallPhase in pip's setupHook. +# It's included here to prevent an infinite recursion. +, dontUsePipInstall ? false + +# Skip setting the PYTHONNOUSERSITE environment variable in wrapped programs +, permitUserSite ? 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 + +# 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. +# "pyproject": Install a package using a ``pyproject.toml`` file (PEP517). This builds a wheel. +# "egg": Install a package from an egg. +# "other" : Provide your own buildPhase and installPhase. +, format ? "setuptools" + +, 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 + inherit (python) stdenv; + + self = toPythonModule (stdenv.mkDerivation ((builtins.removeAttrs attrs [ + "disabled" "checkPhase" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "format" + ]) // { + + name = namePrefix + name; + + nativeBuildInputs = [ + python + wrapPython + ensureNewerSourcesForZipFilesHook # move to wheel installer (pip) or builder (setuptools, flit, ...)? + pythonRecompileBytecodeHook # Remove when solved https://github.com/NixOS/nixpkgs/issues/81441 + pythonRemoveTestsDirHook + ] ++ lib.optionals catchConflicts [ + setuptools pythonCatchConflictsHook + ] ++ lib.optionals removeBinBytecode [ + pythonRemoveBinBytecodeHook + ] ++ lib.optionals (lib.hasSuffix "zip" (attrs.src.name or "")) [ + unzip + ] ++ lib.optionals (format == "setuptools") [ + setuptoolsBuildHook + ] ++ lib.optionals (format == "flit") [ + flitBuildHook + ] ++ lib.optionals (format == "pyproject") [ + pipBuildHook + ] ++ lib.optionals (format == "wheel") [ + wheelUnpackHook + ] ++ lib.optionals (format == "egg") [ + eggUnpackHook eggBuildHook eggInstallHook + ] ++ lib.optionals (!(format == "other") || dontUsePipInstall) [ + pipInstallHook + ] ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ + # This is a test, however, it should be ran independent of the checkPhase and checkInputs + pythonImportsCheckHook + ] ++ lib.optionals (python.pythonAtLeast "3.3") [ + # Optionally enforce PEP420 for python3 + pythonNamespacesHook + ] ++ nativeBuildInputs; + + buildInputs = buildInputs ++ pythonPath; + + propagatedBuildInputs = propagatedBuildInputs ++ [ python ]; + + inherit strictDeps; + + LANG = "${if python.stdenv.isDarwin then "en_US" else "C"}.UTF-8"; + + # Python packages don't have a checkPhase, only an installCheckPhase + doCheck = false; + doInstallCheck = attrs.doCheck or true; + installCheckInputs = [ + ] ++ lib.optionals (format == "setuptools") [ + # Longer-term we should get rid of this and require + # users of this function to set the `installCheckPhase` or + # pass in a hook that sets it. + setuptoolsCheckHook + ] ++ checkInputs; + + postFixup = lib.optionalString (!dontWrapPythonPrograms) '' + wrapPythonPrograms + '' + attrs.postFixup or ''''; + + # Python packages built through cross-compilation are always for the host platform. + disallowedReferences = lib.optionals (python.stdenv.hostPlatform != python.stdenv.buildPlatform) [ python.pythonForBuild ]; + + # For now, revert recompilation of bytecode. + dontUsePythonRecompileBytecode = true; + + meta = { + # default to python's platforms + platforms = python.meta.platforms; + isBuildPythonPackage = python.meta.platforms; + } // meta; + } // lib.optionalAttrs (attrs?checkPhase) { + # If given use the specified checkPhase, otherwise use the setup hook. + # Longer-term we should get rid of `checkPhase` and use `installCheckPhase`. + installCheckPhase = attrs.checkPhase; + })); + + 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/default.nix b/nixpkgs/pkgs/development/interpreters/python/pypy/default.nix new file mode 100644 index 000000000000..10073602071a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/pypy/default.nix @@ -0,0 +1,157 @@ +{ stdenv, substituteAll, fetchurl +, zlib ? null, zlibSupport ? true, bzip2, pkgconfig, libffi, libunwind, Security +, sqlite, openssl, ncurses, python, expat, tcl, tk, tix, xlibsWrapper, libX11 +, self, gdbm, db, lzma +, python-setup-hook +# For the Python package set +, packageOverrides ? (self: super: {}) +, sourceVersion +, pythonVersion +, sha256 +, passthruFun +}: + +assert zlibSupport -> zlib != null; + +with stdenv.lib; + +let + isPy3k = substring 0 1 pythonVersion == "3"; + passthru = passthruFun { + inherit self sourceVersion pythonVersion packageOverrides; + implementation = "pypy"; + libPrefix = "pypy${pythonVersion}"; + executable = "pypy${if isPy3k then "3" else ""}"; + pythonForBuild = self; # No cross-compiling for now. + sitePackages = "site-packages"; + hasDistutilsCxxPatch = false; + }; + pname = passthru.executable; + version = with sourceVersion; "${major}.${minor}.${patch}"; + pythonForPypy = python.withPackages (ppkgs: [ ppkgs.pycparser ]); + +in with passthru; stdenv.mkDerivation rec { + inherit pname version; + + src = fetchurl { + url = "https://bitbucket.org/pypy/pypy/downloads/pypy${pythonVersion}-v${version}-src.tar.bz2"; + inherit sha256; + }; + + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ + bzip2 openssl pythonForPypy libffi ncurses expat sqlite tk tcl xlibsWrapper libX11 gdbm db + ] ++ optionals isPy3k [ + lzma + ] ++ optionals (stdenv ? cc && stdenv.cc.libc != null) [ + stdenv.cc.libc + ] ++ optionals zlibSupport [ + zlib + ] ++ optionals stdenv.isDarwin [ + libunwind Security + ]; + + hardeningDisable = optional stdenv.isi686 "pic"; + + # Remove bootstrap python from closure + dontPatchShebangs = true; + disallowedReferences = [ python ]; + + C_INCLUDE_PATH = makeSearchPathOutput "dev" "include" buildInputs; + LIBRARY_PATH = makeLibraryPath buildInputs; + LD_LIBRARY_PATH = makeLibraryPath (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/${if isPy3k then "3/tkinter/tix.py" else "2.7/lib-tk/Tix.py"}" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" + + 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; + + # TODO: A bunch of tests are failing as of 7.1.1, please feel free to + # fix and re-enable if you have the patience and tenacity. + doCheck = false; + checkPhase = let + disabledTests = [ + # disable shutils because it assumes gid 0 exists + "test_shutil" + # disable socket because it has two actual network tests that fail + "test_socket" + ] ++ optionals (!isPy3k) [ + # disable test_urllib2net, test_urllib2_localnet, and test_urllibnet because they require networking (example.com) + "test_urllib2net" + "test_urllibnet" + "test_urllib2_localnet" + ] ++ optionals isPy3k [ + # disable asyncio due to https://github.com/NixOS/nix/issues/1238 + "test_asyncio" + # disable os due to https://github.com/NixOS/nixpkgs/issues/10496 + "test_os" + # disable pathlib due to https://bitbucket.org/pypy/pypy/pull-requests/594 + "test_pathlib" + # disable tarfile because it assumes gid 0 exists + "test_tarfile" + # disable __all__ because of spurious imp/importlib warning and + # warning-to-error test policy + "test___all__" + ]; + in '' + export TERMINFO="${ncurses.out}/share/terminfo/"; + export TERM="xterm"; + export HOME="$TMPDIR"; + + ${pythonForPypy.interpreter} ./pypy/test_all.py --pypy=./${executable}-c -k 'not (${concatStringsSep " or " disabledTests})' lib-python + ''; + + installPhase = '' + mkdir -p $out/{bin,include,lib,${executable}-c} + + cp -R {include,lib_pypy,lib-python,${executable}-c} $out/${executable}-c + cp lib${executable}-c${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/ + ln -s $out/${executable}-c/${executable}-c $out/bin/${executable} + + # other packages expect to find stuff according to libPrefix + ln -s $out/${executable}-c/include $out/include/${libPrefix} + ln -s $out/${executable}-c/lib-python/${if isPy3k then "3" else pythonVersion} $out/lib/${libPrefix} + + ${stdenv.lib.optionalString stdenv.isDarwin '' + install_name_tool -change @rpath/libpypy${optionalString isPy3k "3"}-c.dylib $out/lib/libpypy${optionalString isPy3k "3"}-c.dylib $out/bin/${executable} + ''} + + # verify cffi modules + $out/bin/${executable} -c ${if isPy3k then "'import tkinter;import sqlite3;import curses;import lzma'" else "'import Tkinter;import sqlite3;import curses'"} + + # Include a sitecustomize.py file + cp ${../sitecustomize.py} $out/lib/${libPrefix}/${sitePackages}/sitecustomize.py + ''; + + inherit passthru; + enableParallelBuilding = true; # almost no parallelization without STM + + meta = with stdenv.lib; { + homepage = "http://pypy.org/"; + description = "Fast, compliant alternative implementation of the Python language (${pythonVersion})"; + license = licenses.mit; + platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ]; + maintainers = with maintainers; [ andersk ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/python/pypy/prebuilt.nix b/nixpkgs/pkgs/development/interpreters/python/pypy/prebuilt.nix new file mode 100644 index 000000000000..1522047a3806 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/pypy/prebuilt.nix @@ -0,0 +1,125 @@ +{ stdenv +, fetchurl +, python-setup-hook +, self +, which +# Dependencies +, bzip2 +, zlib +, openssl_1_0_2 +, expat +, ncurses6 +, tcl-8_5 +, tk-8_5 +# For the Python package set +, packageOverrides ? (self: super: {}) +, sourceVersion +, pythonVersion +, sha256 +, passthruFun +}: + +# This version of PyPy is primarily added to speed-up translation of +# our PyPy source build when developing that expression. + +with stdenv.lib; + +let + isPy3k = majorVersion == "3"; + passthru = passthruFun { + inherit self sourceVersion pythonVersion packageOverrides; + implementation = "pypy"; + libPrefix = "pypy${pythonVersion}"; + executable = "pypy${if isPy3k then "3" else ""}"; + pythonForBuild = self; # Not possible to cross-compile with. + sitePackages = "site-packages"; + hasDistutilsCxxPatch = false; + }; + pname = "${passthru.executable}_prebuilt"; + version = with sourceVersion; "${major}.${minor}.${patch}"; + + majorVersion = substring 0 1 pythonVersion; + + deps = [ + bzip2 + zlib + openssl_1_0_2 + expat + ncurses6 + tcl-8_5 + tk-8_5 + ]; + +in with passthru; stdenv.mkDerivation { + inherit pname version; + + src = fetchurl { + url = "https://bitbucket.org/pypy/pypy/downloads/pypy${pythonVersion}-v${version}-linux64.tar.bz2"; + inherit sha256; + }; + + buildInputs = [ which ]; + + installPhase = '' + mkdir -p $out/lib + echo "Moving files to $out" + mv -t $out bin include lib-python lib_pypy site-packages + mv lib/libffi.so.6* $out/lib/ + + mv $out/bin/libpypy*-c.so $out/lib/ + + rm $out/bin/*.debug + + echo "Patching binaries" + interpreter=$(patchelf --print-interpreter $(readlink -f $(which patchelf))) + patchelf --set-interpreter $interpreter \ + --set-rpath $out/lib \ + $out/bin/pypy* + + pushd $out + find {lib,lib_pypy*} -name "*.so" -exec patchelf --remove-needed libncursesw.so.6 --replace-needed libtinfow.so.6 libncursesw.so.6 {} \; + find {lib,lib_pypy*} -name "*.so" -exec patchelf --set-rpath ${stdenv.lib.makeLibraryPath deps}:$out/lib {} \; + + echo "Removing bytecode" + find . -name "__pycache__" -type d -depth -exec rm -rf {} \; + popd + + # Include a sitecustomize.py file + cp ${../sitecustomize.py} $out/${sitePackages}/sitecustomize.py + + ''; + + doInstallCheck = true; + + # Check whether importing of (extension) modules functions + installCheckPhase = let + modules = [ + "ssl" + "sys" + "curses" + ] ++ optionals (!isPy3k) [ + "Tkinter" + ] ++ optionals isPy3k [ + "tkinter" + ]; + imports = concatMapStringsSep "; " (x: "import ${x}") modules; + in '' + echo "Testing whether we can import modules" + $out/bin/${executable} -c '${imports}' + ''; + + setupHook = python-setup-hook sitePackages; + + donPatchElf = true; + dontStrip = true; + + inherit passthru; + + meta = with stdenv.lib; { + homepage = "http://pypy.org/"; + description = "Fast, compliant alternative implementation of the Python language (${pythonVersion})"; + license = licenses.mit; + platforms = [ "x86_64-linux" ]; + }; + +} diff --git a/nixpkgs/pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch b/nixpkgs/pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch new file mode 100644 index 000000000000..0b78caf7e075 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch @@ -0,0 +1,24 @@ +--- 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 +@@ -17,18 +17,14 @@ + incdirs = [] + linklibs = ['tcl85', 'tk85'] + libdirs = [] +-elif sys.platform == 'darwin': +- incdirs = ['/System/Library/Frameworks/Tk.framework/Versions/Current/Headers/'] +- linklibs = ['tcl', 'tk'] +- libdirs = [] + 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..523df5762fad --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/setup-hook.sh @@ -0,0 +1,26 @@ +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 +} + +if [ -z "${dontAddPythonPath:-}" ]; then + addEnvHooks "$hostOffset" addPythonPath +fi + +# 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/sitecustomize.py b/nixpkgs/pkgs/development/interpreters/python/sitecustomize.py new file mode 100644 index 000000000000..d79a4696d8ea --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/sitecustomize.py @@ -0,0 +1,39 @@ +""" +This is a Nix-specific module for discovering modules built with Nix. + +The module recursively adds paths that are on `NIX_PYTHONPATH` to `sys.path`. In +order to process possible `.pth` files `site.addsitedir` is used. + +The paths listed in `PYTHONPATH` are added to `sys.path` afterwards, but they +will be added before the entries we add here and thus take precedence. + +Note the `NIX_PYTHONPATH` environment variable is unset in order to prevent leakage. + +Similarly, this module listens to the environment variable `NIX_PYTHONEXECUTABLE` +and sets `sys.executable` to its value. +""" +import site +import sys +import os +import functools + +paths = os.environ.pop('NIX_PYTHONPATH', None) +if paths: + functools.reduce(lambda k, p: site.addsitedir(p, k), paths.split(':'), site._init_pathinfo()) + +# Check whether we are in a venv or virtualenv. +# For Python 3 we check whether our `base_prefix` is different from our current `prefix`. +# For Python 2 we check whether the non-standard `real_prefix` is set. +# https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv +in_venv = (sys.version_info.major == 3 and sys.prefix != sys.base_prefix) or (sys.version_info.major == 2 and hasattr(sys, "real_prefix")) + +if not in_venv: + executable = os.environ.pop('NIX_PYTHONEXECUTABLE', None) + prefix = os.environ.pop('NIX_PYTHONPREFIX', None) + + if 'PYTHONEXECUTABLE' not in os.environ and executable is not None: + sys.executable = executable + if prefix is not None: + # Sysconfig does not like it when sys.prefix is set to None + sys.prefix = sys.exec_prefix = prefix + site.PREFIXES.insert(0, prefix) diff --git a/nixpkgs/pkgs/development/interpreters/python/tests.nix b/nixpkgs/pkgs/development/interpreters/python/tests.nix new file mode 100644 index 000000000000..dcfa41cc308e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/tests.nix @@ -0,0 +1,95 @@ +{ python +, runCommand +, substituteAll +, lib +, callPackage +}: + +let + environmentTests = let + envs = let + inherit python; + pythonEnv = python.withPackages(ps: with ps; [ ]); + pythonVirtualEnv = python.withPackages(ps: with ps; [ virtualenv ]); + in { + # Plain Python interpreter + plain = rec { + env = python; + interpreter = env.interpreter; + is_venv = "False"; + is_nixenv = "False"; + is_virtualenv = "False"; + }; + } // lib.optionalAttrs (!python.isPyPy) { + # Use virtualenv from a Nix env. + nixenv-virtualenv = rec { + env = runCommand "${python.name}-virtualenv" {} '' + ${pythonVirtualEnv.interpreter} -m virtualenv $out + ''; + interpreter = "${env}/bin/${python.executable}"; + is_venv = "False"; + is_nixenv = "True"; + is_virtualenv = "True"; + }; + } // lib.optionalAttrs (python.implementation != "graal") { + # Python Nix environment (python.buildEnv) + nixenv = rec { + env = pythonEnv; + interpreter = env.interpreter; + is_venv = "False"; + is_nixenv = "True"; + is_virtualenv = "False"; + }; + } // lib.optionalAttrs (python.isPy3k && (!python.isPyPy)) rec { + # Venv built using plain Python + # Python 2 does not support venv + # TODO: PyPy executable name is incorrect, it should be pypy-c or pypy-3c instead of pypy and pypy3. + plain-venv = rec { + env = runCommand "${python.name}-venv" {} '' + ${python.interpreter} -m venv $out + ''; + interpreter = "${env}/bin/${python.executable}"; + is_venv = "True"; + is_nixenv = "False"; + is_virtualenv = "False"; + }; + + } // lib.optionalAttrs (python.pythonAtLeast "3.8") { + # Venv built using Python Nix environment (python.buildEnv) + # TODO: Cannot create venv from a nix env + # Error: Command '['/nix/store/ddc8nqx73pda86ibvhzdmvdsqmwnbjf7-python3-3.7.6-venv/bin/python3.7', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1. + nixenv-venv = rec { + env = runCommand "${python.name}-venv" {} '' + ${pythonEnv.interpreter} -m venv $out + ''; + interpreter = "${env}/bin/${pythonEnv.executable}"; + is_venv = "True"; + is_nixenv = "True"; + is_virtualenv = "False"; + }; + }; + + testfun = name: attrs: runCommand "${python.name}-tests-${name}" ({ + inherit (python) pythonVersion; + } // attrs) '' + cp -r ${./tests/test_environments} tests + chmod -R +w tests + substituteAllInPlace tests/test_python.py + ${attrs.interpreter} -m unittest discover --verbose tests #/test_python.py + mkdir $out + touch $out/success + ''; + + in lib.mapAttrs testfun envs; + + # All PyPy package builds are broken at the moment + integrationTests = lib.optionalAttrs (python.pythonAtLeast "3.7" && (!python.isPyPy)) rec { + # Before the addition of NIX_PYTHONPREFIX mypy was broken with typed packages + nix-pythonprefix-mypy = callPackage ./tests/test_nix_pythonprefix { + interpreter = python; + }; + }; + + + +in environmentTests // integrationTests diff --git a/nixpkgs/pkgs/development/interpreters/python/tests/test_environments/test_python.py b/nixpkgs/pkgs/development/interpreters/python/tests/test_environments/test_python.py new file mode 100644 index 000000000000..0fc4b8a9e91c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/tests/test_environments/test_python.py @@ -0,0 +1,55 @@ +""" +Python interpreter and environment tests. + +These need to be executed with the standard library unittest. +Third party test runners such as pytest cannot be used because +that would interfere with the tests. +""" + +import platform +import sys +import unittest +import site + + +ENV = "@env@" +INTERPRETER = "@interpreter@" +PYTHON_VERSION = "@pythonVersion@" + +IS_VIRTUALENV = @is_virtualenv@ +IS_VENV = @is_venv@ +IS_NIXENV = @is_nixenv@ +IS_PYPY = platform.python_implementation() == "PyPy" + + +class TestCasePython(unittest.TestCase): + + @unittest.skipIf(IS_PYPY, "Executable is incorrect and needs to be fixed.") + def test_interpreter(self): + self.assertEqual(sys.executable, INTERPRETER) + + @unittest.skipIf(IS_PYPY, "Prefix is incorrect and needs to be fixed.") + def test_prefix(self): + self.assertEqual(sys.prefix, ENV) + self.assertEqual(sys.prefix, sys.exec_prefix) + + def test_site_prefix(self): + self.assertTrue(sys.prefix in site.PREFIXES) + + @unittest.skipIf(IS_PYPY or sys.version_info.major==2, "Python 2 does not have base_prefix") + def test_base_prefix(self): + if IS_VENV or IS_NIXENV or IS_VIRTUALENV: + self.assertNotEqual(sys.prefix, sys.base_prefix) + else: + self.assertEqual(sys.prefix, sys.base_prefix) + + @unittest.skipIf(sys.version_info.major==3, "sys.real_prefix is only set by virtualenv in case of Python 2.") + def test_real_prefix(self): + self.assertTrue(hasattr(sys, "real_prefix") == IS_VIRTUALENV) + + def test_python_version(self): + self.assertTrue(platform.python_version().startswith(PYTHON_VERSION)) + + +if __name__ == "__main__": + unittest.main() diff --git a/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/default.nix b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/default.nix new file mode 100644 index 000000000000..05798cbaf1b8 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/default.nix @@ -0,0 +1,25 @@ +{ interpreter, writeText, runCommandNoCC }: + +let + + python = let + packageOverrides = self: super: { + typeddep = super.callPackage ./typeddep {}; + }; + in interpreter.override {inherit packageOverrides; self = python;}; + + pythonEnv = python.withPackages(ps: [ + ps.typeddep + ps.mypy + ]); + + pythonScript = writeText "myscript.py" '' + from typeddep import util + s: str = util.echo("hello") + print(s) + ''; + +in runCommandNoCC "${interpreter.name}-site-prefix-mypy-test" {} '' + ${pythonEnv}/bin/mypy ${pythonScript} + touch $out +'' diff --git a/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/default.nix b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/default.nix new file mode 100644 index 000000000000..8d330fcdbfc9 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/default.nix @@ -0,0 +1,13 @@ +{ buildPythonPackage, pythonOlder }: + + +buildPythonPackage { + + pname = "typeddep"; + version = "1.3.3.7"; + + src = ./.; + + disabled = pythonOlder "3.7"; + +} diff --git a/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/setup.py b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/setup.py new file mode 100644 index 000000000000..25bac69ea09a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/setup.py @@ -0,0 +1,18 @@ +from setuptools import setup + +setup(**{ + 'name': 'typeddep', + 'version': '1.3.3.7', + 'description': 'Minimal repro to test mypy and site prefixes with Nix', + 'long_description': None, + 'author': 'adisbladis', + 'author_email': 'adisbladis@gmail.com', + 'maintainer': None, + 'maintainer_email': None, + 'url': None, + 'packages': ['typeddep'], + 'package_data': {'': ['*']}, + 'install_requires': [], + 'entry_points': {}, + 'python_requires': '>=3.7,<4.0', +}) diff --git a/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/typeddep/__init__.py b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/typeddep/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/typeddep/__init__.py diff --git a/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/typeddep/py.typed b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/typeddep/py.typed new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/typeddep/py.typed diff --git a/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/typeddep/util.py b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/typeddep/util.py new file mode 100644 index 000000000000..c1c3ffe74777 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/typeddep/util.py @@ -0,0 +1,2 @@ +def echo(s: str) -> str: + return s 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..b568ee6751d7 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py @@ -0,0 +1,373 @@ +#!/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/**/default.nix +`` +to update all non-pinned 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.") + elif src_format == 'other': + raise ValueError("Don't know how to update a format='other' package.") + elif src_format == 'pyproject': + raise ValueError("Don't know how to update a pyproject 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, pkgs_prefix="python: ", **kwargs): + """Commit result. + """ + + msg = f'{pkgs_prefix}{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') + parser.add_argument('--use-pkgs-prefix', action='store_true', help='Use python3Packages.${pname}: instead of python: ${pname}: when making commits') + + 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(filter(bool, p.map(lambda pkg: _update(pkg, target), packages))) + + logging.info("Finished updating packages.") + + commit_options = {} + if args.use_pkgs_prefix: + logging.info("Using python3Packages. prefix for commits") + commit_options["pkgs_prefix"] = "python3Packages." + + # Commits are created sequentially. + if args.commit: + logging.info("Committing updates...") + # list forces evaluation + list(map(lambda x: _commit(**x, **commit_options), results)) + logging.info("Finished committing updates") + + count = len(results) + logging.info("{} package(s) updated".format(count)) + + + +if __name__ == '__main__': + main() 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..6a19a2152419 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/wrap-python.nix @@ -0,0 +1,52 @@ +{ lib +, python +, makeSetupHook +, makeWrapper }: + +with lib; + +makeSetupHook { + deps = makeWrapper; + substitutions.sitePackages = python.sitePackages; + substitutions.executable = python.interpreter; + substitutions.python = python.pythonForBuild; + substitutions.pythonHost = 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..f10ba003432b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/wrap.sh @@ -0,0 +1,139 @@ +# 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["@pythonHost@"]=1 + addToSearchPath program_PATH @pythonHost@/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 + + if head -n1 "$f" | grep -q '#!.*'; then + # Cross-compilation hack: ensure shebangs are for the host + echo "Rewriting $(head -n 1 $f) to #!@pythonHost@" + sed -i "$f" -e "1 s^#!@python@^#!@pythonHost@^" + 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" + ) + + if [ -z "$permitUserSite" ]; then + wrap_args+=(--set PYTHONNOUSERSITE "true") + fi + + # Add any additional arguments provided by makeWrapperArgs + # argument to buildPythonPackage. + # We need to support both the case when makeWrapperArgs + # is an array and a IFS-separated string. + # TODO: remove the string branch when __structuredAttrs are used. + if [[ "${makeWrapperArgs+defined}" == "defined" && "$(declare -p makeWrapperArgs)" =~ ^'declare -a makeWrapperArgs=' ]]; then + local -a user_args=("${makeWrapperArgs[@]}") + else + local -a user_args="(${makeWrapperArgs:-})" + fi + + 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/@sitePackages@ + 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"/@sitePackages@; then + echo $x/@sitePackages@ \ + >> "$out"/@sitePackages@/${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..dffad6b98f5e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/python/wrapper.nix @@ -0,0 +1,66 @@ +{ stdenv, python, buildEnv, makeWrapper +, extraLibs ? [] +, extraOutputsToInstall ? [] +, postBuild ? "" +, ignoreCollisions ? false +, permitUserSite ? 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 ] ) ; + pythonPath = "${placeholder "out"}/${python.sitePackages}"; + pythonExecutable = "${placeholder "out"}/bin/${python.executable}"; + 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 NIX_PYTHONPREFIX "$out" --set NIX_PYTHONEXECUTABLE ${pythonExecutable} --set NIX_PYTHONPATH ${pythonPath} ${if permitUserSite then "" else ''--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..1762edbbdb7d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/qnial/default.nix @@ -0,0 +1,40 @@ +{ stdenv, fetchFromGitHub, unzip, pkgconfig, makeWrapper, ncurses }: + +stdenv.mkDerivation { + pname = "qnial"; + 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/quickjs/default.nix b/nixpkgs/pkgs/development/interpreters/quickjs/default.nix new file mode 100644 index 000000000000..b1d03252d7ef --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/quickjs/default.nix @@ -0,0 +1,42 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + pname = "quickjs"; + version = "2019-12-21"; + + src = fetchurl { + url = "https://bellard.org/${pname}/${pname}-${version}.tar.xz"; + sha256 = "13hlx6qwrrxmlvvqcr3irxba6zmf05cf54l32vj50wc66s1qd41p"; + }; + + makeFlags = [ "prefix=${placeholder ''out''}" ]; + enableParallelBuilding = true; + + doInstallCheck = true; + installCheckPhase = '' + PATH="$out/bin:$PATH" + + # Programs exit with code 1 when testing help, so grep for a string + set +o pipefail + qjs --help 2>&1 | grep "QuickJS version" + qjsbn --help 2>&1 | grep "QuickJS version" + qjscalc --help 2>&1 | grep "QuickJS version" + set -o pipefail + + temp=$(mktemp).js + echo "console.log('Output from compiled program');" > "$temp" + set -o verbose + out=$(mktemp) && qjsc "$temp" -o "$out" && "$out" | grep -q "Output from compiled program" + out=$(mktemp) && qjsbnc "$temp" -o "$out" && "$out" | grep -q "Output from compiled program" + out=$(mktemp) && qjsc -flto "$temp" -o "$out" && "$out" | grep -q "Output from compiled program" + out=$(mktemp) && qjsbnc -flto "$temp" -o "$out" && "$out" | grep -q "Output from compiled program" + ''; + + meta = with stdenv.lib; { + description = "A small and embeddable Javascript engine"; + homepage = "https://bellard.org/quickjs/"; + maintainers = with maintainers; [ stesie ]; + platforms = platforms.linux; + license = licenses.mit; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/racket/default.nix b/nixpkgs/pkgs/development/interpreters/racket/default.nix new file mode 100644 index 000000000000..b62df6e837b8 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/racket/default.nix @@ -0,0 +1,111 @@ +{ stdenv, fetchurl, makeFontsConf +, cacert +, cairo, coreutils, fontconfig, freefont_ttf +, glib, gmp +, gtk3 +, libedit, libffi +, libiconv +, libGL +, libGLU +, libjpeg +, libpng, libtool, mpfr, openssl, pango, poppler +, readline, sqlite +, disableDocs ? false +, CoreFoundation +, gsettings-desktop-schemas +, wrapGAppsHook +}: + +let + + fontsConf = makeFontsConf { + fontDirectories = [ freefont_ttf ]; + }; + + libPath = stdenv.lib.makeLibraryPath [ + cairo + fontconfig + glib + gmp + gtk3 + gsettings-desktop-schemas + libedit + libGL + libGLU + libjpeg + libpng + mpfr + openssl + pango + poppler + readline + sqlite + ]; + +in + +stdenv.mkDerivation rec { + pname = "racket"; + version = "7.8"; # always change at once with ./minimal.nix + + src = (stdenv.lib.makeOverridable ({ name, sha256 }: + fetchurl { + url = "https://mirror.racket-lang.org/installers/${version}/${name}-src.tgz"; + inherit sha256; + } + )) { + name = "${pname}-${version}"; + sha256 = "19z3dayybcra277s4gk2mppalwawd93f2b16xyrb6d7rbbfz7j9j"; + }; + + 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") + ]; + + nativeBuildInputs = [ cacert wrapGAppsHook ]; + + buildInputs = [ fontconfig libffi libtool sqlite gsettings-desktop-schemas gtk3 ] + ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv CoreFoundation ]; + + preConfigure = '' + unset AR + for f in src/lt/configure src/cs/c/configure src/racket/src/string.c; do + substituteInPlace "$f" --replace /usr/bin/uname ${coreutils}/bin/uname + done + mkdir src/build + cd src/build + + gappsWrapperArgs+=("--prefix" "LD_LIBRARY_PATH" ":" ${LD_LIBRARY_PATH}) + ''; + + 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; + + + 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 = "https://racket-lang.org/"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ kkallio henrytill vrthra ]; + platforms = [ "x86_64-darwin" "x86_64-linux" "aarch64-linux" ]; + broken = stdenv.isDarwin; # No support yet for setting FFI lookup path + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/racket/minimal.nix b/nixpkgs/pkgs/development/interpreters/racket/minimal.nix new file mode 100644 index 000000000000..02aed6e8929c --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/racket/minimal.nix @@ -0,0 +1,20 @@ +{ racket +}: + +racket.overrideAttrs (oldAttrs: rec { + name = "racket-minimal-${oldAttrs.version}"; + src = oldAttrs.src.override { + inherit name; + sha256 = "0bbglf9vfacpm2hn3lskhvc8cpg6z088fbnzpqsn17z8qdk8yvb3"; + }; + + 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" ]; + broken = false; # Minimal build does not require working FFI + }; +}) diff --git a/nixpkgs/pkgs/development/interpreters/rakudo/default.nix b/nixpkgs/pkgs/development/interpreters/rakudo/default.nix new file mode 100644 index 000000000000..0c708cd3171e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/rakudo/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, perl, icu, zlib, gmp, lib, nqp }: + +stdenv.mkDerivation rec { + pname = "rakudo"; + version = "2020.08.2"; + + src = fetchurl { + url = "https://www.rakudo.org/dl/rakudo/rakudo-${version}.tar.gz"; + sha256 = "16qsq6alvk2x44x39j2fzxigvm5cvmz85i0nkjcw0wz29yyf8lch"; + }; + + buildInputs = [ icu zlib gmp perl ]; + configureScript = "perl ./Configure.pl"; + configureFlags = [ + "--backends=moar" + "--with-nqp=${nqp}/bin/nqp" + ]; + + # Some tests fail on Darwin + doCheck = !stdenv.isDarwin; + + meta = with stdenv.lib; { + description = "Raku implementation on top of Moar virtual machine"; + homepage = "https://www.rakudo.org"; + license = licenses.artistic2; + platforms = platforms.unix; + maintainers = with maintainers; [ thoughtpolice vrthra sgo ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/rakudo/moarvm.nix b/nixpkgs/pkgs/development/interpreters/rakudo/moarvm.nix new file mode 100644 index 000000000000..702fccd7b6bd --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/rakudo/moarvm.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchurl, perl +, CoreServices, ApplicationServices }: + +stdenv.mkDerivation rec { + pname = "moarvm"; + version = "2020.08"; + + src = fetchurl { + url = "https://www.moarvm.org/releases/MoarVM-${version}.tar.gz"; + sha256 = "1gq7z4z5lnkai01721waawkkal82sdmyra05nnbfb1986mq5xpiy"; + }; + + buildInputs = [ perl ] ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices ApplicationServices ]; + doCheck = false; # MoarVM does not come with its own test suite + + configureScript = "${perl}/bin/perl ./Configure.pl"; + + meta = with stdenv.lib; { + description = "VM with adaptive optimization and JIT compilation, built for Rakudo"; + homepage = "https://www.moarvm.org/"; + license = licenses.artistic2; + platforms = platforms.unix; + maintainers = with maintainers; [ thoughtpolice vrthra sgo ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/rakudo/nqp.nix b/nixpkgs/pkgs/development/interpreters/rakudo/nqp.nix new file mode 100644 index 000000000000..3f5f7afcfed4 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/rakudo/nqp.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl, perl, lib, moarvm }: + +stdenv.mkDerivation rec { + pname = "nqp"; + version = "2020.08.2"; + + src = fetchurl { + url = "https://github.com/raku/nqp/releases/download/${version}/nqp-${version}.tar.gz"; + sha256 = "14zr1swprxl284k0h1w72pcypj24sga15170ylaqjb8wxy8h1mqw"; + }; + + buildInputs = [ perl ]; + + configureScript = "${perl}/bin/perl ./Configure.pl"; + configureFlags = [ + "--backends=moar" + "--with-moar=${moarvm}/bin/moar" + ]; + + doCheck = true; + + meta = with stdenv.lib; { + description = "Not Quite Perl -- a lightweight Raku-like environment for virtual machines"; + homepage = "https://github.com/perl6/nqp"; + license = licenses.artistic2; + platforms = platforms.unix; + maintainers = with maintainers; [ thoughtpolice vrthra sgo ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/rakudo/zef.nix b/nixpkgs/pkgs/development/interpreters/rakudo/zef.nix new file mode 100644 index 000000000000..c82053446933 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/rakudo/zef.nix @@ -0,0 +1,34 @@ +{ stdenv, fetchFromGitHub, rakudo, makeWrapper }: + +stdenv.mkDerivation rec { + pname = "zef"; + version = "0.8.5"; + + src = fetchFromGitHub { + owner = "ugexe"; + repo = "zef"; + rev = "v${version}"; + sha256 = "17a5ns0ph8626q3b4wv9v2n0zqmhqbqyzjzxa387kr19qs933yy6"; + }; + + buildInputs = [ rakudo makeWrapper ]; + + installPhase = '' + mkdir -p "$out" + # TODO: Find better solution. zef stores cache stuff in $HOME with the + # default config. + env HOME=$TMPDIR ${rakudo}/bin/raku -I. ./bin/zef --/depends --/test-depends --/build-depends --install-to=$out install . + ''; + + postFixup ='' + wrapProgram $out/bin/zef --prefix RAKUDOLIB , "inst#$out" + ''; + + meta = with stdenv.lib; { + description = "Raku / Perl6 Module Management"; + homepage = "https://github.com/ugexe/zef"; + license = licenses.artistic2; + platforms = platforms.unix; + maintainers = with maintainers; [ sgo ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/rascal/default.nix b/nixpkgs/pkgs/development/interpreters/rascal/default.nix new file mode 100644 index 000000000000..8b802043fe3f --- /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 ]; + + dontUnpack = 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..b26af7f0b1b7 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/rebol/default.nix @@ -0,0 +1,43 @@ +{ stdenv, fetchFromGitHub, fetchurl, glibc, libX11, libXt, perl }: + +stdenv.mkDerivation rec { + pname = "rebol-nightly"; + 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..554dc81bffb9 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/red/default.nix @@ -0,0 +1,92 @@ +{ stdenv, stdenv_32bit, pkgsi686Linux, fetchFromGitHub, fetchurl }: + +stdenv.mkDerivation rec { + pname = "red"; + version = "0.6.4"; + src = fetchFromGitHub { + rev = "755eb943ccea9e78c2cab0f20b313a52404355cb"; + owner = "red"; + repo = "red"; + sha256 = "sha256:045rrg9666zczgrwyyyglivzdzja103s52b0fzj7hqmr1fz68q37"; + }; + + 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/CLI/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/${pname}-${version}/BSD-3-License.txt + install -Dm644 BSL-License.txt \ + $out/share/licenses/${pname}-${version}/BSL-License.txt + install -Dm644 docs/red-system-quick-test.html \ + $out/share/doc/${pname}-${version}/red-system-quick-test.html + install -Dm644 docs/red-system-specs.html \ + $out/share/doc/${pname}-${version}/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..ec19b0679f4b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/regina/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchurl, ncurses }: + +stdenv.mkDerivation rec { + pname = "Regina-REXX"; + version = "3.9.1"; + + src = fetchurl { + url = "mirror://sourceforge/regina-rexx/regina-rexx/${version}/${pname}-${version}.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..41cf4c221c6a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/renpy/default.nix @@ -0,0 +1,62 @@ +{ stdenv, fetchurl, python2Packages, pkgconfig, SDL2 +, libpng, ffmpeg_3, freetype, glew, libGL, libGLU, fribidi, zlib +, glib +}: + +with python2Packages; + +stdenv.mkDerivation rec { + pname = "renpy"; + version = "7.3.5"; + + 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 = "1anr5cfbvbsbik4v4rvrkdkciwhg700k4lydfbs4n85raimz9mw4"; + }; + + 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_3 freetype glew libGLU libGL fribidi zlib pygame_sdl2 glib + ]; + + pythonPath = [ pygame_sdl2 tkinter ]; + + RENPY_DEPS_INSTALL = stdenv.lib.concatStringsSep "::" (map (path: path) [ + SDL2 SDL2.dev libpng ffmpeg_3 ffmpeg_3.out freetype glew.dev glew.out libGLU libGL 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..d90a2f4f971b --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/default.nix @@ -0,0 +1,309 @@ +{ stdenv, buildPackages, lib, defaultGemConfig, buildRubyGem +, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub +, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison +, autoconf, libiconv, libobjc, libunwind, Foundation +, buildEnv, bundler, bundix, makeWrapper, removeReferencesTo +} @ args: + +let + op = lib.optional; + ops = lib.optionals; + opString = lib.optionalString; + patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; }; + config = import ./config.nix { inherit fetchFromSavannah; }; + rubygems = import ./rubygems { inherit stdenv lib fetchurl fetchpatch; }; + + # 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"; + atLeast27 = lib.versionAtLeast ver.majMin "2.7"; + baseruby = self.override { + useRailsExpress = false; + docSupport = false; + rubygemsSupport = false; + }; + with-packages = import ../../ruby-modules/with-packages { + inherit lib stdenv makeWrapper buildRubyGem buildEnv; + gemConfig = defaultGemConfig; + ruby = self; + }; + self = lib.makeOverridable ( + { stdenv, buildPackages, lib + , fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub + , useRailsExpress ? true + , rubygemsSupport ? true + , zlib, zlibSupport ? true + , openssl, opensslSupport ? true + , gdbm, gdbmSupport ? true + , ncurses, readline, cursesSupport ? true + , groff, docSupport ? true + , libyaml, yamlSupport ? true + , libffi, fiddleSupport ? true + # ruby -e "puts RbConfig::CONFIG['configure_args']" + # puts a reference to the C compiler in the binary. + # This might be required by some gems at runtime, + # but we allow to strip it out for smaller closure size. + , removeReferencesTo, removeReferenceToCC ? true + , autoreconfHook, bison, autoconf + , buildEnv, bundler, bundix + , libiconv, libobjc, libunwind, Foundation + , makeWrapper, buildRubyGem, defaultGemConfig + }: + stdenv.mkDerivation rec { + pname = "ruby"; + inherit version; + + src = 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; + }; + + # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds. + NROFF = if docSupport then "${groff}/bin/nroff" else null; + + outputs = [ "out" ] ++ lib.optional docSupport "devdoc"; + + nativeBuildInputs = [ autoreconfHook bison ] + ++ (op docSupport groff) + ++ op (stdenv.buildPlatform != stdenv.hostPlatform) buildPackages.ruby; + buildInputs = [ autoconf ] + ++ (op fiddleSupport libffi) + ++ (ops cursesSupport [ ncurses readline ]) + ++ (op zlibSupport zlib) + ++ (op opensslSupport openssl) + ++ (op gdbmSupport gdbm) + ++ (op yamlSupport libyaml) + # 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 fetchpatch; + patchLevel = ver.patchLevel; + }).${ver.majMinTiny}; + + postUnpack = opString rubygemsSupport '' + rm -rf $sourceRoot/{lib,test}/rubygems* + cp -r ${rubygems}/lib/rubygems* $sourceRoot/lib + cp -r ${rubygems}/test/rubygems $sourceRoot/test + '' + 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 opString atLeast25 '' + sed -i configure.ac -e '/config.guess/d' + cp --remove-destination ${config}/config.guess tool/ + cp --remove-destination ${config}/config.sub tool/ + ''; + + # Force the revision.h generation. Somehow `revision.tmp` is an empty + # file and because we don't add `git` to buildInputs, hence the check is + # always true. + # https://github.com/ruby/ruby/commit/97a5af62a318fcd93a4e5e4428d576c0280ddbae + buildFlags = lib.optionals atLeast27 [ "REVISION_LATEST=0" ]; + + configureFlags = ["--enable-shared" "--enable-pthread" "--with-soname=ruby-${version}"] + ++ 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}"; + + preConfigure = opString docSupport '' + configureFlagsArray+=("--with-ridir=$devdoc/share/ri") + ''; + + # 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.optional docSupport "install-doc"; + # Bundler tries to create this directory + postInstall = '' + # Remove unnecessary groff reference from runtime closure, since it's big + sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb + ${ + lib.optionalString removeReferenceToCC '' + # Get rid of the CC runtime dependency + ${removeReferencesTo}/bin/remove-references-to \ + -t ${stdenv.cc} \ + $out/lib/libruby* + '' + } + # 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} + } + addRubyLibPath() { + addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby + addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby/${ver.libDir} + addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby/${ver.libDir}/${stdenv.targetPlatform.system} + } + + addEnvHooks "$hostOffset" addGemPath + addEnvHooks "$hostOffset" addRubyLibPath + EOF + + rbConfig=$(find $out/lib/ruby -name rbconfig.rb) + '' + opString docSupport '' + # Prevent the docs from being included in the closure + sed -i "s|\$(DESTDIR)$devdoc|\$(datarootdir)/\$(RI_BASE_NAME)|" $rbConfig + sed -i "s|'--with-ridir=$devdoc/share/ri'||" $rbConfig + + # Add rbconfig shim so ri can find docs + mkdir -p $devdoc/lib/ruby/site_ruby + cp ${./rbconfig.rb} $devdoc/lib/ruby/site_ruby/rbconfig.rb + '' + opString useRailsExpress '' + # 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; + }; + + inherit (with-packages) withPackages gems; + + # 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" "9" ""; + sha256 = { + src = "1bn6n5b920qy3lsx99jr8495jkc3sg89swgb96d5fgd579g6p6zr"; + git = "066kb1iki7mx7qkm10xhj5b6v8s47wg68v43l3nc36y2hyim1w2c"; + }; + }; + + ruby_2_5 = generic { + version = rubyVersion "2" "5" "8" ""; + sha256 = { + src = "16md4jspjwixjlbhx3pnd5iwpca07p23ghkxkqd82sbchw3xy2vc"; + git = "19gkk3q9l33cwkfsp5k8f8fipq7gkyqkqirm9farbvy425519rv2"; + }; + }; + + ruby_2_6 = generic { + version = rubyVersion "2" "6" "6" ""; + sha256 = { + src = "1492x795qzgp3zhpl580kd1sdp50n5hfsmpbfhdsq2rnxwyi8jrn"; + git = "1jr9v99a7awssqmw7531afbx4a8i9x5yfqyffha545g7r4s7kj50"; + }; + }; + + ruby_2_7 = generic { + version = rubyVersion "2" "7" "1" ""; + sha256 = { + src = "0674x98f542y02r7n2yv2qhmh97blqhi2mvh2dn5f000vlxlh66l"; + git = "0qk729kr5wm67xmwpljpdprwhp5wvn5y4ikqy00p1zcgwlwdcs33"; + }; + }; +} 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..4407cb6e5da4 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/patchsets.nix @@ -0,0 +1,83 @@ +{ patchSet, useRailsExpress, ops, patchLevel, fetchpatch }: + +{ + "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.9" = 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.8" = 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.6" = ops useRailsExpress [ + "${patchSet}/patches/ruby/2.6/head/railsexpress/01-fix-broken-tests-caused-by-ad.patch" + "${patchSet}/patches/ruby/2.6/head/railsexpress/02-improve-gc-stats.patch" + "${patchSet}/patches/ruby/2.6/head/railsexpress/03-more-detailed-stacktrace.patch" + ]; + "2.7.1" = ops useRailsExpress [ + "${patchSet}/patches/ruby/2.7/head/railsexpress/01-fix-broken-tests-caused-by-ad.patch" + "${patchSet}/patches/ruby/2.7/head/railsexpress/02-improve-gc-stats.patch" + "${patchSet}/patches/ruby/2.7/head/railsexpress/03-more-detailed-stacktrace.patch" + ]; +} 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/rbconfig.rb b/nixpkgs/pkgs/development/interpreters/ruby/rbconfig.rb new file mode 100644 index 000000000000..eeba930b54b7 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/rbconfig.rb @@ -0,0 +1,25 @@ +# This is a shim around whatever real rbconfig.rb is in the LOAD_PATH, +# so that RbConfig::CONFIG["ridir"] can be overridden to point to the +# custom location of the ri docs, without the main derivation having +# those docs in its closure. + +MY_PATH = File.realpath(__FILE__) + +candidates = $LOAD_PATH.map { |dir| File.join(dir, "rbconfig.rb") } + +# First, drop everything _before_ this file in the LOAD_PATH, just on +# the off-chance somebody is composing shims like this for some reason. +candidates.drop_while { |c| !File.exist?(c) || File.realpath(c) != MY_PATH } + +# Now, the wrapped rbconfig.rb is the next rbconfig.rb in the LOAD_PATH +# that isn't this same file. (Yes, duplicate LOAD_PATH entries are a +# thing we have to deal with.) +next_rbconfig = candidates.find { |c| + File.exist?(c) && File.realpath(c) != MY_PATH +} + +# Load the wrapped rbconfig.rb +require next_rbconfig + +# Now we have RbConfig, and can modify it for our own ends. +RbConfig::CONFIG["ridir"] = File.expand_path("../../../share/ri", __dir__) 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/0001-add-post-extract-hook.patch b/nixpkgs/pkgs/development/interpreters/ruby/rubygems/0001-add-post-extract-hook.patch new file mode 100644 index 000000000000..84d1d52409e5 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/rubygems/0001-add-post-extract-hook.patch @@ -0,0 +1,34 @@ +From a6485cfcdf51ff8be452980f93cebfea97f34dec Mon Sep 17 00:00:00 2001 +From: zimbatm <zimbatm@zimbatm.com> +Date: Wed, 21 Sep 2016 09:32:34 +0100 +Subject: [PATCH 1/3] add post-extract hook + +Allows nix to execute scripts just after the gem extraction +--- + lib/rubygems/installer.rb | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb +index d26b1e88..bf18fb7f 100644 +--- a/lib/rubygems/installer.rb ++++ b/lib/rubygems/installer.rb +@@ -848,7 +848,15 @@ TEXT + # Ensures that files can't be installed outside the gem directory. + + def extract_files +- @package.extract_files gem_dir ++ ret = @package.extract_files gem_dir ++ if ENV['NIX_POST_EXTRACT_FILES_HOOK'] ++ puts ++ puts "running NIX_POST_EXTRACT_FILES_HOOK #{ENV['NIX_POST_EXTRACT_FILES_HOOK']} #{gem_dir}" ++ system(ENV['NIX_POST_EXTRACT_FILES_HOOK'], gem_dir.to_s) ++ puts "running NIX_POST_EXTRACT_FILES_HOOK done" ++ puts ++ end ++ ret + end + + ## +-- +2.21.0 + diff --git a/nixpkgs/pkgs/development/interpreters/ruby/rubygems/0002-binaries-with-env-shebang.patch b/nixpkgs/pkgs/development/interpreters/ruby/rubygems/0002-binaries-with-env-shebang.patch new file mode 100644 index 000000000000..d6eba67e1065 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/rubygems/0002-binaries-with-env-shebang.patch @@ -0,0 +1,28 @@ +From 2e1328bcdddd35e557eabdff83ac07f3591dc693 Mon Sep 17 00:00:00 2001 +From: zimbatm <zimbatm@zimbatm.com> +Date: Wed, 21 Sep 2016 19:37:05 +0100 +Subject: [PATCH 2/3] binaries with env shebang + +By default, don't point to the absolute ruby derivation path. As a user +installing a gem in the home, it would freeze the selected ruby version +to the currently-installed ruby derivation. +--- + lib/rubygems/dependency_installer.rb | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb +index 34620860..00ab31d9 100644 +--- a/lib/rubygems/dependency_installer.rb ++++ b/lib/rubygems/dependency_installer.rb +@@ -18,7 +18,7 @@ class Gem::DependencyInstaller + extend Gem::Deprecate + + DEFAULT_OPTIONS = { # :nodoc: +- :env_shebang => false, ++ :env_shebang => true, + :document => %w[ri], + :domain => :both, # HACK dup + :force => false, +-- +2.21.0 + diff --git a/nixpkgs/pkgs/development/interpreters/ruby/rubygems/0003-gem-install-default-to-user.patch b/nixpkgs/pkgs/development/interpreters/ruby/rubygems/0003-gem-install-default-to-user.patch new file mode 100644 index 000000000000..138d432c8203 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/rubygems/0003-gem-install-default-to-user.patch @@ -0,0 +1,26 @@ +From d69249d0ff210316121b44d971ddd2439b1bc393 Mon Sep 17 00:00:00 2001 +From: zimbatm <zimbatm@zimbatm.com> +Date: Wed, 21 Sep 2016 09:40:39 +0100 +Subject: [PATCH 3/3] gem install default to user + +Default to not installing gems to the read-only system derivation. +--- + lib/rubygems/path_support.rb | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/rubygems/path_support.rb b/lib/rubygems/path_support.rb +index ed680d65..749b9ea6 100644 +--- a/lib/rubygems/path_support.rb ++++ b/lib/rubygems/path_support.rb +@@ -23,7 +23,7 @@ class Gem::PathSupport + # hashtable, or defaults to ENV, the system environment. + # + def initialize(env) +- @home = env["GEM_HOME"] || Gem.default_dir ++ @home = env["GEM_HOME"] || Gem.user_dir + + if File::ALT_SEPARATOR + @home = @home.gsub(File::ALT_SEPARATOR, File::SEPARATOR) +-- +2.21.0 + diff --git a/nixpkgs/pkgs/development/interpreters/ruby/rubygems/default.nix b/nixpkgs/pkgs/development/interpreters/ruby/rubygems/default.nix new file mode 100644 index 000000000000..0bbcadba3f51 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/rubygems/default.nix @@ -0,0 +1,35 @@ +{ stdenv, lib, fetchurl, fetchpatch }: + +stdenv.mkDerivation rec { + name = "rubygems"; + version = "3.1.2"; + + src = fetchurl { + url = "https://rubygems.org/rubygems/rubygems-${version}.tgz"; + sha256 = "0h7ij4jpj8rgnpkl63cwh2lnav73pw5wpfqra3va7077lsyadlgd"; + }; + + patches = [ + ./0001-add-post-extract-hook.patch + ./0002-binaries-with-env-shebang.patch + ./0003-gem-install-default-to-user.patch + + (fetchpatch { + url = "https://github.com/rubygems/rubygems/commit/0af4d2d369ff580ef54839ec15a8c7ec419978cb.patch"; + sha256 = "13gyfxn4rmxq1dbxq5rzphnhagn8n8kpp8lb9h6h4s9d4zaklax9"; + }) + ]; + + installPhase = '' + runHook preInstall + cp -r . $out + runHook postInstall + ''; + + meta = with lib; { + description = "Package management framework for Ruby"; + homepage = "https://rubygems.org/"; + license = with licenses; [ mit /* or */ ruby ]; + maintainers = with maintainers; [ qyliss zimbatm ]; + }; +} 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..331dda5d0503 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/ruby/rvm-patchsets.nix @@ -0,0 +1,8 @@ +{ fetchFromGitHub }: + +fetchFromGitHub { + owner = "skaes"; + repo = "rvm-patchsets"; + rev = "6d8888d34a321198f7fd9253343b78c209efb046"; + sha256 = "0xczl0nng1649km3bcbjn6zrr591l6m2kkwgnknh1fnwmmrdaya7"; +} 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..5a1e3f265b24 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/scheme48/default.nix @@ -0,0 +1,17 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation { + name = "scheme48-1.9.2"; + + meta = { + homepage = "http://s48.org/"; + description = "Scheme 48"; + 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..bb4f418f502a --- /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..ccf85f1d1c4d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/self/default.nix @@ -0,0 +1,44 @@ +{ fetchgit, stdenv, xorg, makeWrapper, ncurses, cmake }: + +stdenv.mkDerivation { + # 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"; + pname = "self"; + + 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/shen-sbcl/default.nix b/nixpkgs/pkgs/development/interpreters/shen-sbcl/default.nix new file mode 100644 index 000000000000..6d10669d20d8 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/shen-sbcl/default.nix @@ -0,0 +1,32 @@ +{ stdenv +, fetchurl +, shen-sources +, sbcl +}: + +stdenv.mkDerivation rec { + name = "shen-sbcl-${version}"; + version = "3.0.3"; + src = fetchurl { + url = "https://github.com/Shen-Language/shen-cl/releases/download/v${version}/shen-cl-v${version}-sources.tar.gz"; + sha256 = "0mc10jlrxqi337m6ngwbr547zi4qgk69g1flz5dsddjy5x41j0yz"; + }; + buildInputs = [ + sbcl shen-sources + ]; + buildPhase = '' + ln -s ${shen-sources} kernel + make sbcl + ''; + installPhase = '' + mkdir -p $out + install -m755 -D bin/sbcl/shen $out/bin/shen-sbcl + ''; + meta = with stdenv.lib; { + homepage = https://shenlanguage.org; + description = "Port of Shen running on Steel Bank Common Lisp"; + platforms = sbcl.meta.platforms; + maintainers = with maintainers; [ bsima ]; + license = licenses.bsd3; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/shen-sources/default.nix b/nixpkgs/pkgs/development/interpreters/shen-sources/default.nix new file mode 100644 index 000000000000..f35631daa282 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/shen-sources/default.nix @@ -0,0 +1,28 @@ +{ stdenv +, fetchurl +}: + +stdenv.mkDerivation rec { + name = "shen-sources-${version}"; + version = "22.3"; + + src = fetchurl { + url = "https://github.com/Shen-Language/shen-sources/releases/download/shen-${version}/ShenOSKernel-${version}.tar.gz"; + sha256 = "16jaliga3bia0f8c8ja1y22wanbnbriv31qfqdc87a4p4dx9c77q"; + }; + + buildInputs = []; + buildPhase = ""; + installPhase = '' + mkdir -p $out + cp . $out -R + ''; + + meta = with stdenv.lib; { + homepage = https://shenlanguage.org; + description = "Source code for the Shen Language"; + platforms = platforms.all; + maintainers = with maintainers; [ bsima ]; + license = licenses.bsd3; + }; +} 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..37efeba3f9b6 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/1.8.5.nix @@ -0,0 +1,79 @@ +{ stdenv, lib, autoconf213, fetchurl, fetchpatch, pkgconfig, nspr, perl, python2, zip }: + +stdenv.mkDerivation { + pname = "spidermonkey"; + 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" ]; + + # fixes build on gcc8 + postPatch = '' + substituteInPlace ./methodjit/MethodJIT.cpp \ + --replace 'asm volatile' 'asm' + ''; + + # 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 + ''; + + 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..d2aabfe64d9a --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/38.nix @@ -0,0 +1,71 @@ +{ stdenv, fetchurl, pkgconfig, gnused_422, perl, python2, zip, libffi, readline, icu, zlib, buildPackages +, libobjc }: + +with stdenv.lib; + +stdenv.mkDerivation rec { + version = "38.8.0"; + pname = "spidermonkey"; + + src = fetchurl { + url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.bz2"; + sha256 = "10lrync6cxnjlnadc0j3vg8r2dq9b3wwanw8qj1h6ncxwb7asxcl"; + }; + + buildInputs = [ libffi readline icu zlib ] + ++ 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="${buildPackages.python2.interpreter}" + ''; + + configureFlags = [ + "--enable-threadsafe" + "--with-system-ffi" + "--enable-posix-nspr-emulation" + "--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" + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + # Spidermonkey seems to use different host/build terminology for cross + # compilation here. + "--host=${stdenv.buildPlatform.config}" + "--target=${stdenv.hostPlatform.config}" + ]; + + configurePlatforms = []; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + + # 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/60.nix b/nixpkgs/pkgs/development/interpreters/spidermonkey/60.nix new file mode 100644 index 000000000000..42731421d81d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/60.nix @@ -0,0 +1,83 @@ +{ stdenv, fetchurl, fetchpatch, autoconf213, pkgconfig, perl, python2, zip, buildPackages +, which, readline, zlib, icu }: + +with stdenv.lib; + +let + version = "60.9.0"; +in stdenv.mkDerivation { + pname = "spidermonkey"; + inherit version; + + src = fetchurl { + url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz"; + sha256 = "0gy5x2rnnbkqmjd9sq93s3q5na9nkba68xwpizild7k6qn63qicz"; + }; + + outputs = [ "out" "dev" ]; + setOutputFlags = false; # Configure script only understands --includedir + + buildInputs = [ readline zlib icu ]; + nativeBuildInputs = [ autoconf213 pkgconfig perl which python2 zip ]; + + patches = [ + # Fixed in 62.0 + # https://bugzilla.mozilla.org/show_bug.cgi?id=1415202 + (fetchpatch { + url = "https://src.fedoraproject.org/rpms/mozjs60/raw/a1b605c73f382db25977cb2d4d70a3ba2ff85b92/f/Always-use-the-equivalent-year-to-determine-the-time-zone.patch"; + sha256 = "12i225qbzlyfj2disms50zrr5jy8zgn2cc4rgsg58sfgf1bn7150"; + }) + ]; + + preConfigure = '' + export CXXFLAGS="-fpermissive" + export LIBXUL_DIST=$out + export PYTHON="${buildPackages.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" + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + # Spidermonkey seems to use different host/build terminology for cross + # compilation here. + "--host=${stdenv.buildPlatform.config}" + "--target=${stdenv.hostPlatform.config}" + ]; + + configurePlatforms = []; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + + # Remove unnecessary static lib + preFixup = '' + moveToOutput bin/js60-config "$dev" + rm $out/lib/libjs_static.ajs + ln -s $out/bin/js60 $out/bin/js + ''; + + 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/68.nix b/nixpkgs/pkgs/development/interpreters/spidermonkey/68.nix new file mode 100644 index 000000000000..36d28f62e2e1 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/spidermonkey/68.nix @@ -0,0 +1,95 @@ +{ stdenv, fetchurl, fetchpatch, autoconf213, pkgconfig, perl, python2, python3, zip, buildPackages +, which, readline, zlib, icu, cargo, rustc, llvmPackages }: + +with stdenv.lib; + +let + python3Env = buildPackages.python3.withPackages (p: [p.six]); +in stdenv.mkDerivation rec { + pname = "spidermonkey"; + version = "68.10.0"; + + src = fetchurl { + url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz"; + sha256 = "0azdinwqjfv2q37gqpxmfvzsk86pvsi6cjaq1310zs26gric5j1f"; + }; + + outputs = [ "out" "dev" ]; + setOutputFlags = false; # Configure script only understands --includedir + + nativeBuildInputs = [ + autoconf213 + pkgconfig + perl + which + python2 + zip + cargo + rustc + llvmPackages.llvm + ]; + + buildInputs = [ + readline + zlib + icu + ]; + + preConfigure = '' + export CXXFLAGS="-fpermissive" + export LIBXUL_DIST=$out + export PYTHON3="${python3Env.interpreter}" + + # We can't build in js/src/, so create a build dir + mkdir obj + cd obj/ + configureScript=../js/src/configure + ''; + + configureFlags = [ + # Reccommended by gjs upstream + "--disable-jemalloc" + "--enable-unaligned-private-values" + "--with-intl-api" + "--enable-posix-nspr-emulation" + "--with-system-zlib" + "--with-system-icu" + + "--with-libclang-path=${llvmPackages.libclang}/lib" + "--with-clang-path=${llvmPackages.clang}/bin/clang" + + "--enable-shared-js" + "--enable-readline" + # 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" + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + # Spidermonkey seems to use different host/build terminology for cross + # compilation here. + "--host=${stdenv.buildPlatform.config}" + "--target=${stdenv.hostPlatform.config}" + ]; + + configurePlatforms = []; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; + + # Remove unnecessary static lib + preFixup = '' + moveToOutput bin/js60-config "$dev" + rm $out/lib/libjs_static.ajs + ln -s $out/bin/js60 $out/bin/js + ''; + + 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/supercollider/default.nix b/nixpkgs/pkgs/development/interpreters/supercollider/default.nix new file mode 100644 index 000000000000..eed0bdc5807e --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/supercollider/default.nix @@ -0,0 +1,43 @@ +{ stdenv, mkDerivation, fetchurl, cmake, pkgconfig, alsaLib +, libjack2, libsndfile, fftw, curl, gcc +, libXt, qtbase, qttools, qtwebengine +, readline, qtwebsockets, useSCEL ? false, emacs +}: + +let optional = stdenv.lib.optional; +in + +mkDerivation rec { + pname = "supercollider"; + version = "3.11.0"; + + + src = fetchurl { + url = "https://github.com/supercollider/supercollider/releases/download/Version-${version}/SuperCollider-${version}-Source.tar.bz2"; + sha256 = "0l5j7sqrjlm85ql91ybcrvdykfkkwfqd7w3m4llbymw720r2ln9p"; + }; + + hardeningDisable = [ "stackprotector" ]; + + cmakeFlags = [ + "-DSC_WII=OFF" + "-DSC_EL=${if useSCEL then "ON" else "OFF"}" + ]; + + nativeBuildInputs = [ cmake pkgconfig qttools ]; + + enableParallelBuilding = true; + + buildInputs = [ + gcc libjack2 libsndfile fftw curl libXt qtbase qtwebengine qtwebsockets readline ] + ++ optional (!stdenv.isDarwin) alsaLib + ++ optional useSCEL emacs; + + meta = with stdenv.lib; { + description = "Programming language for real time audio synthesis"; + homepage = "https://supercollider.github.io"; + maintainers = with maintainers; [ mrmebelman ]; + license = licenses.gpl3; + 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..d76ceb3421de --- /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}.9"; + + src = fetchurl { + url = "mirror://sourceforge/tcl/tcl${version}-src.tar.gz"; + sha256 = "0kjzj7mkzfnb7ksxanbibibfpciyvsh5ffdlhs0bmfc75kgd435d"; + }; +}) diff --git a/nixpkgs/pkgs/development/interpreters/tcl/generic.nix b/nixpkgs/pkgs/development/interpreters/tcl/generic.nix new file mode 100644 index 000000000000..9aaf8223837d --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/tcl/generic.nix @@ -0,0 +1,55 @@ +{ stdenv + +# Version specific stuff +, release, version, src +, ... +}: + +stdenv.mkDerivation { + pname = "tcl"; + inherit version; + + inherit src; + + outputs = [ "out" "man" ]; + + setOutputFlags = false; + + preConfigure = '' + cd unix + ''; + + configureFlags = [ + "--enable-threads" + # Note: using $out instead of $man to prevent a runtime dependency on $man. + "--mandir=${placeholder "out"}/share/man" + "--enable-man-symlinks" + # Don't install tzdata because NixOS already has a more up-to-date copy. + "--with-tzdata=no" + "tcl_cv_strtod_unbroken=ok" + ] ++ stdenv.lib.optional stdenv.is64bit "--enable-64bit"; + + enableParallelBuilding = true; + + postInstall = let + dllExtension = stdenv.hostPlatform.extensions.sharedLibrary; + in '' + make install-private-headers + ln -s $out/bin/tclsh${release} $out/bin/tclsh + ln -s $out/lib/libtcl${release}${dllExtension} $out/lib/libtcl${dllExtension} + ''; + + meta = with stdenv.lib; { + description = "The Tcl scripting language"; + homepage = "https://www.tcl.tk/"; + license = licenses.tcltk; + platforms = platforms.all; + maintainers = with maintainers; [ vrthra ]; + }; + + passthru = rec { + inherit release version; + libPrefix = "tcl${release}"; + libdir = "lib/${libPrefix}"; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/tinyscheme/default.nix b/nixpkgs/pkgs/development/interpreters/tinyscheme/default.nix new file mode 100644 index 000000000000..b49a37a72856 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/tinyscheme/default.nix @@ -0,0 +1,33 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + pname = "tinyscheme"; + version = "1.41"; + + src = fetchurl { + url = "mirror://sourceforge/tinyscheme/${pname}-${version}.tar.gz"; + sha256 = "168rk4zrlhsknbvldq2jsgabpwlqkx6la44gkqmijmf7jhs11h7a"; + }; + + patchPhase = '' + substituteInPlace scheme.c --replace "init.scm" "$out/lib/init.scm" + ''; + + installPhase = '' + mkdir -p $out/bin $out/lib + cp init.scm $out/lib + cp scheme $out/bin/tinyscheme + ''; + + meta = with stdenv.lib; { + description = "Lightweight Scheme implementation"; + longDescription = '' + TinyScheme is a lightweight Scheme interpreter that implements as large a + subset of R5RS as was possible without getting very large and complicated. + ''; + homepage = "http://tinyscheme.sourceforge.net/"; + license = licenses.bsdOriginal; + maintainers = [ maintainers.ebzzry ]; + platforms = platforms.unix; + }; +} 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..d908346f1962 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/unicon-lang/default.nix @@ -0,0 +1,44 @@ +{ stdenv, fetchurl, unzip, libX11, libXt }: + +stdenv.mkDerivation { + pname = "unicon-lang"; + 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/wasmer/default.nix b/nixpkgs/pkgs/development/interpreters/wasmer/default.nix new file mode 100644 index 000000000000..c620b1686ea6 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/wasmer/default.nix @@ -0,0 +1,39 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, cmake +, llvmPackages +, pkg-config +}: + +rustPlatform.buildRustPackage rec { + pname = "wasmer"; + version = "0.17.0"; + + src = fetchFromGitHub { + owner = "wasmerio"; + repo = pname; + rev = version; + sha256 = "05g4h0xkqd14wnmijiiwmhk6l909fjxr6a2zplrjfxk5bypdalpm"; + fetchSubmodules = true; + }; + + cargoSha256 = "1ssmgx9fjvkq7ycyzjanqmlm5b80akllq6qyv3mj0k5fvs659wcq"; + + nativeBuildInputs = [ cmake pkg-config ]; + + LIBCLANG_PATH = "${llvmPackages.libclang}/lib"; + + meta = with lib; { + description = "The Universal WebAssembly Runtime"; + longDescription = '' + Wasmer is a standalone WebAssembly runtime for running WebAssembly outside + of the browser, supporting WASI and Emscripten. Wasmer can be used + standalone (via the CLI) and embedded in different languages, running in + x86 and ARM devices. + ''; + homepage = "https://wasmer.io/"; + license = licenses.mit; + maintainers = with maintainers; [ filalex77 ]; + }; +} diff --git a/nixpkgs/pkgs/development/interpreters/wasmtime/default.nix b/nixpkgs/pkgs/development/interpreters/wasmtime/default.nix new file mode 100644 index 000000000000..f7ef111bc667 --- /dev/null +++ b/nixpkgs/pkgs/development/interpreters/wasmtime/default.nix @@ -0,0 +1,31 @@ +{ rustPlatform, fetchFromGitHub, lib, python, cmake, llvmPackages, clang, stdenv, darwin }: + +rustPlatform.buildRustPackage rec { + pname = "wasmtime"; + version = "0.19.0"; + + src = fetchFromGitHub { + owner = "bytecodealliance"; + repo = "${pname}"; + rev = "v${version}"; + sha256 = "0gb8xk27ych553b7knflbbks9q64m39v40sdirycm6prqfnfrnm8"; + fetchSubmodules = true; + }; + + cargoSha256 = "1dqaxpwfm234yjwrhglzvsqhh2fr5nsx7bpk7bmycyk6lml8vxy7"; + + nativeBuildInputs = [ python cmake clang ]; + buildInputs = [ llvmPackages.libclang ] ++ + lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]; + LIBCLANG_PATH = "${llvmPackages.libclang}/lib"; + + doCheck = true; + + meta = with lib; { + description = "Standalone JIT-style runtime for WebAssembly, using Cranelift"; + homepage = "https://github.com/CraneStation/wasmtime"; + license = licenses.asl20; + maintainers = [ maintainers.matthewbauer ]; + platforms = platforms.unix; + }; +} |