diff options
Diffstat (limited to 'pkgs/development/interpreters')
202 files changed, 5392 insertions, 2821 deletions
diff --git a/pkgs/development/interpreters/acl2/default.nix b/pkgs/development/interpreters/acl2/default.nix index e3c62aae983..c089916158b 100644 --- a/pkgs/development/interpreters/acl2/default.nix +++ b/pkgs/development/interpreters/acl2/default.nix @@ -1,4 +1,4 @@ -{ stdenv, callPackage, fetchFromGitHub, writeShellScriptBin, substituteAll +{ lib, stdenv, callPackage, fetchFromGitHub, writeShellScriptBin, substituteAll , sbcl, bash, which, perl, nettools , openssl, glucose, minisat, abc-verifier, z3, python2 , certifyBooks ? true @@ -6,7 +6,7 @@ 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 + # https://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. @@ -21,7 +21,7 @@ in stdenv.mkDerivation rec { src = fetchFromGitHub { owner = "acl2-devel"; repo = "acl2-devel"; - rev = "${version}"; + rev = version; sha256 = "0c0wimaf16nrr3d6cxq6p7nr7rxffvpmn66hkpwc1m6zpcipf0y5"; }; @@ -39,7 +39,7 @@ in stdenv.mkDerivation rec { buildInputs = [ # ACL2 itself only needs a Common Lisp compiler/interpreter: sbcl - ] ++ stdenv.lib.optionals certifyBooks [ + ] ++ 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: @@ -55,7 +55,7 @@ in stdenv.mkDerivation rec { preConfigure = '' # When certifying books, ACL2 doesn't like $HOME not existing. export HOME=$(pwd)/fake-home - '' + stdenv.lib.optionalString certifyBooks '' + '' + lib.optionalString certifyBooks '' # Some books also care about $USER being nonempty. export USER=nobody ''; @@ -79,7 +79,7 @@ in stdenv.mkDerivation rec { installPhase = '' mkdir -p $out/bin ln -s $out/share/${pname}/saved_acl2 $out/bin/${pname} - '' + stdenv.lib.optionalString certifyBooks '' + '' + 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 ''; @@ -100,7 +100,7 @@ in stdenv.mkDerivation rec { rm -rf $out/share/${pname}/books ''; - meta = with stdenv.lib; { + meta = with 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 @@ -121,7 +121,7 @@ in stdenv.mkDerivation rec { '' else '' The community books are not included in this package. ''); - homepage = "http://www.cs.utexas.edu/users/moore/acl2/"; + homepage = "https://www.cs.utexas.edu/users/moore/acl2/"; downloadPage = "https://github.com/acl2-devel/acl2-devel/releases"; license = with licenses; [ # ACL2 itself is bsd3 diff --git a/pkgs/development/interpreters/acl2/libipasirglucose4/default.nix b/pkgs/development/interpreters/acl2/libipasirglucose4/default.nix index 5186cd69584..5c10c176c14 100644 --- a/pkgs/development/interpreters/acl2/libipasirglucose4/default.nix +++ b/pkgs/development/interpreters/acl2/libipasirglucose4/default.nix @@ -1,6 +1,11 @@ -{ stdenv, fetchurl, zlib, unzip }: +{ lib, stdenv, fetchurl, zlib, unzip }: -stdenv.mkDerivation rec { +let + + cxx = "${stdenv.cc.targetPrefix}c++"; + libName = "libipasirglucose4" + stdenv.targetPlatform.extensions.sharedLibrary; + +in 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 @@ -18,16 +23,19 @@ stdenv.mkDerivation rec { sourceRoot = "sat/glucose4"; patches = [ ./0001-Support-shared-library-build.patch ]; + makeFlags = [ "CXX=${cxx}" ]; + postBuild = '' - g++ -shared -Wl,-soname,libipasirglucose4.so -o libipasirglucose4.so \ + ${cxx} -shared -o ${libName} \ + ${if stdenv.cc.isClang then "" else "-Wl,-soname,${libName}"} \ ipasirglucoseglue.o libipasirglucose4.a ''; installPhase = '' - install -D libipasirglucose4.so $out/lib/libipasirglucose4.so + install -D ${libName} $out/lib/${libName} ''; - meta = with stdenv.lib; { + meta = with lib; { description = "Shared library providing IPASIR interface to the Glucose SAT solver"; license = licenses.mit; platforms = platforms.unix; diff --git a/pkgs/development/interpreters/alda/default.nix b/pkgs/development/interpreters/alda/default.nix index 3e5273d6329..96d4207dbe8 100644 --- a/pkgs/development/interpreters/alda/default.nix +++ b/pkgs/development/interpreters/alda/default.nix @@ -1,12 +1,12 @@ -{ stdenv, fetchurl, jre }: +{ lib, stdenv, fetchurl, jre }: stdenv.mkDerivation rec { pname = "alda"; - version = "1.4.2"; + version = "1.5.0"; src = fetchurl { url = "https://github.com/alda-lang/alda/releases/download/${version}/alda"; - sha256 = "1d0412jw37gh1y7i8cmaml8r4sn516i6pxmm8m16yprqmz6glx28"; + sha256 = "sha256-OHbOsgYN87ThU7EgjCgxADnOv32qIi+7XwDwcW0dmV0="; }; dontUnpack = true; @@ -16,8 +16,8 @@ stdenv.mkDerivation rec { sed -i -e '1 s!java!${jre}/bin/java!' $out/bin/alda ''; - meta = with stdenv.lib; { - description = "A music programming language for musicians."; + meta = with lib; { + description = "A music programming language for musicians"; homepage = "https://alda.io"; license = licenses.epl10; maintainers = [ maintainers.ericdallo ]; diff --git a/pkgs/development/interpreters/angelscript/2.22.nix b/pkgs/development/interpreters/angelscript/2.22.nix index 0449572da02..4c35f065cb5 100644 --- a/pkgs/development/interpreters/angelscript/2.22.nix +++ b/pkgs/development/interpreters/angelscript/2.22.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, unzip}: +{lib, stdenv, fetchurl, unzip}: let s = # Generated upstream information rec { @@ -8,20 +8,18 @@ let url="http://www.angelcode.com/angelscript/sdk/files/angelscript_${version}.zip"; sha256 = "1pp853lbnz383ilp9wbgc3wv1dn7lpx3idz8dmzda94rckl7sd43"; }; - buildInputs = [ - unzip - ]; in stdenv.mkDerivation { inherit (s) name version; - inherit buildInputs; + nativeBuildInputs = [ unzip ]; + src = fetchurl { inherit (s) url sha256; }; preConfigure = '' cd angelscript/projects/gnuc sed -i makefile -e "s@LOCAL = .*@LOCAL = $out@" - export SHARED=1 + export SHARED=1 export VERSION="${s.version}" mkdir -p "$out/lib" "$out/bin" "$out/share" "$out/include" ''; @@ -35,9 +33,9 @@ stdenv.mkDerivation { meta = { inherit (s) version; description = "Light-weight scripting library"; - license = stdenv.lib.licenses.zlib ; - maintainers = [stdenv.lib.maintainers.raskin]; - platforms = stdenv.lib.platforms.linux; + license = lib.licenses.zlib ; + maintainers = [lib.maintainers.raskin]; + platforms = lib.platforms.linux; badPlatforms = [ "aarch64-linux" ]; downloadPage = "http://www.angelcode.com/angelscript/downloads.html"; homepage="http://www.angelcode.com/angelscript/"; diff --git a/pkgs/development/interpreters/angelscript/default.nix b/pkgs/development/interpreters/angelscript/default.nix index 0209bcaaafc..9a6aae053f9 100644 --- a/pkgs/development/interpreters/angelscript/default.nix +++ b/pkgs/development/interpreters/angelscript/default.nix @@ -1,38 +1,43 @@ -{stdenv, fetchurl, unzip}: +{ lib, stdenv, fetchurl, unzip, cmake }: let s = # Generated upstream information rec { baseName="angelscript"; - version = "2.34.0"; + version = "2.35.0"; name="${baseName}-${version}"; url="http://www.angelcode.com/angelscript/sdk/files/angelscript_${version}.zip"; - sha256 = "1xxxpwln4v2yasa35y7552fsfd8fbg50gnbp4vxy0ajj2wvh9akg"; + sha256 = "sha256-AQ3UXiPnNNRvWJHXDiaGB6EsuasSUD3aQvhC2dt+iFc="; }; - buildInputs = [ - unzip - ]; + in stdenv.mkDerivation { inherit (s) name version; - inherit buildInputs; + src = fetchurl { inherit (s) url sha256; }; + + nativeBuildInputs = [ unzip cmake ]; + preConfigure = '' - cd angelscript/projects/gnuc - export makeFlags="$makeFlags PREFIX=$out" + export ROOT=$PWD + cd angelscript/projects/cmake ''; + + cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" ]; + postInstall = '' mkdir -p "$out/share/docs/angelscript" - cp -r ../../../docs/* "$out/share/docs/angelscript" + cp -r $ROOT/docs/* "$out/share/docs/angelscript" ''; - meta = { + + meta = with lib; { 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/"; + license = licenses.zlib; + maintainers = with maintainers; [ raskin ]; + platforms = platforms.all; + downloadPage = "https://www.angelcode.com/angelscript/downloads.html"; + homepage = "https://www.angelcode.com/angelscript/"; }; } diff --git a/pkgs/development/interpreters/bats/default.nix b/pkgs/development/interpreters/bats/default.nix index bbc38e51542..01d1b61cb80 100644 --- a/pkgs/development/interpreters/bats/default.nix +++ b/pkgs/development/interpreters/bats/default.nix @@ -1,29 +1,40 @@ -{ stdenv, fetchzip, coreutils, gnugrep }: +{ stdenv, lib, fetchzip, bash, makeWrapper, coreutils, gnugrep, doCheck ? true }: stdenv.mkDerivation rec { pname = "bats"; - version = "1.2.0"; + version = "1.3.0"; src = fetchzip { url = "https://github.com/bats-core/bats-core/archive/v${version}.tar.gz"; - sha256 = "0f59zh4d4pa1a7ybs5zl6h0csbqqv11lbnq0jl1dgwm1s6p49bsq"; + hash = "sha256-+dboExOx2YELxV8Cwk9SVwk9G3p8EoP0LdaJ3o7GT6c="; }; + nativeBuildInputs = [ makeWrapper ]; + patchPhase = '' - patchShebangs ./install.sh + patchShebangs . + ''; - 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 + wrapProgram $out/bin/bats --suffix PATH : "${lib.makeBinPath [ bash coreutils gnugrep ]}" ''; - installPhase = "./install.sh $out"; + inherit doCheck; + checkPhase = '' + # TODO: cut if https://github.com/bats-core/bats-core/issues/418 allows + sed -i '/test works even if PATH is reset/a skip' test/bats.bats + + # test generates file with absolute shebang dynamically + substituteInPlace test/install.bats --replace \ + "/usr/bin/env bash" "${bash}/bin/bash" + bin/bats test + ''; - meta = with stdenv.lib; { + meta = with lib; { homepage = "https://github.com/bats-core/bats-core"; description = "Bash Automated Testing System"; - maintainers = [ maintainers.lnl7 ]; + maintainers = with maintainers; [ abathur ]; license = licenses.mit; platforms = platforms.unix; }; diff --git a/pkgs/development/interpreters/bic/default.nix b/pkgs/development/interpreters/bic/default.nix new file mode 100644 index 00000000000..c27270f7a95 --- /dev/null +++ b/pkgs/development/interpreters/bic/default.nix @@ -0,0 +1,42 @@ +{ lib +, stdenv +, fetchFromGitHub +, readline +, autoreconfHook +, autoconf-archive +, gmp +, flex +, bison +}: + +stdenv.mkDerivation rec { + pname = "bic"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "hexagonal-sun"; + repo = pname; + rev = "v${version}"; + sha256 = "1ws46h1ngzk14dspmsggj9535yl04v9wh8v4gb234n34rdkdsyyw"; + }; + + buildInputs = [ readline gmp ]; + nativeBuildInputs = [ + autoreconfHook + autoconf-archive + bison + flex + ]; + + meta = with lib; { + description = "A C interpreter and API explorer"; + longDescription = '' + bic This a project that allows developers to explore and test C-APIs using a + read eval print loop, also known as a REPL. + ''; + license = with licenses; [ gpl2Plus ]; + homepage = "https://github.com/hexagonal-sun/bic"; + platforms = platforms.unix; + maintainers = with maintainers; [ hexagonal-sun ]; + }; +} diff --git a/pkgs/development/interpreters/ceptre/default.nix b/pkgs/development/interpreters/ceptre/default.nix index de12185b96f..c3fa6a645e0 100644 --- a/pkgs/development/interpreters/ceptre/default.nix +++ b/pkgs/development/interpreters/ceptre/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchgit, mlton }: +{ lib, stdenv, fetchgit, mlton }: stdenv.mkDerivation { name = "ceptre-2016-11-27"; @@ -16,10 +16,10 @@ stdenv.mkDerivation { cp ceptre $out/bin ''; - meta = with stdenv.lib; { + meta = with 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; + platforms = platforms.unix; }; } diff --git a/pkgs/development/interpreters/chibi/default.nix b/pkgs/development/interpreters/chibi/default.nix index 7bf4c0fd52d..c0ee8988c09 100644 --- a/pkgs/development/interpreters/chibi/default.nix +++ b/pkgs/development/interpreters/chibi/default.nix @@ -1,6 +1,6 @@ -{ stdenv, fetchFromGitHub, makeWrapper }: +{ lib, stdenv, fetchFromGitHub, makeWrapper }: let - version = "0.9.1"; + version = "0.10"; name = "chibi-scheme-${version}"; in stdenv.mkDerivation { @@ -9,19 +9,19 @@ stdenv.mkDerivation { 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 ]; + platforms = lib.platforms.all; + license = lib.licenses.bsd3; + maintainers = [ lib.maintainers.DerGuteMoritz ]; }; src = fetchFromGitHub { owner = "ashinn"; repo = "chibi-scheme"; rev = version; - sha256 = "0nd63i924ifh39cba1hd4sbi6vh1cb73v97nrn4bf8rrjh3k8pdi"; + sha256 = "sha256-7vDxcnXhq1wJSLFHGxtwh+H+KWxh6B0JXSMPzSmQFXo="; }; - buildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; installPhase = '' make install PREFIX="$out" diff --git a/pkgs/development/interpreters/cling/default.nix b/pkgs/development/interpreters/cling/default.nix new file mode 100644 index 00000000000..73ed5b523dd --- /dev/null +++ b/pkgs/development/interpreters/cling/default.nix @@ -0,0 +1,105 @@ +{ lib, stdenv +, python3 +, libffi +, git +, cmake +, zlib +, fetchgit +, makeWrapper +, runCommand +, runCommandNoCC +, llvmPackages_5 +, glibc +, ncurses +}: + +let + unwrapped = stdenv.mkDerivation rec { + pname = "cling-unwrapped"; + version = "0.7"; + + src = fetchgit { + url = "http://root.cern/git/clang.git"; + # This commit has the tag cling-0.7 so we use it, even though cpt.py + # tries to use refs/tags/cling-patches-rrelease_50 + rev = "354b25b5d915ff3b1946479ad07f3f2768ea1621"; + branchName = "cling-patches"; + sha256 = "0q8q2nnvjx3v59ng0q3qqqhzmzf4pmfqqiy3rz1f3drx5w3lgyjg"; + }; + + clingSrc = fetchgit { + url = "http://root.cern/git/cling.git"; + rev = "70163975eee5a76b45a1ca4016bfafebc9b57e07"; + sha256 = "1mv2fhk857kp5rq714bq49iv7gy9fgdwibydj5wy1kq2m3sf3ysi"; + }; + + preConfigure = '' + echo "add_llvm_external_project(cling)" >> tools/CMakeLists.txt + cp -r $clingSrc ./tools/cling + chmod -R a+w ./tools/cling + ''; + + nativeBuildInputs = [ python3 git cmake llvmPackages_5.llvm.dev ]; + buildInputs = [ libffi llvmPackages_5.llvm zlib ncurses ]; + + strictDeps = true; + + cmakeFlags = [ + "-DLLVM_TARGETS_TO_BUILD=host;NVPTX" + "-DLLVM_ENABLE_RTTI=ON" + + # Setting -DCLING_INCLUDE_TESTS=ON causes the cling/tools targets to be built; + # see cling/tools/CMakeLists.txt + "-DCLING_INCLUDE_TESTS=ON" + ]; + + meta = with lib; { + description = "The Interactive C++ Interpreter"; + homepage = "https://root.cern/cling/"; + license = with licenses; [ lgpl21 ncsa ]; + maintainers = with maintainers; [ thomasjm ]; + platforms = platforms.unix; + }; + }; + + # The flags passed to the wrapped cling should + # a) prevent it from searching for system include files and libs, and + # b) provide it with the include files and libs it needs (C and C++ standard library) + + # These are also exposed as cling.flags/cling.compilerIncludeFlags because it's handy to be + # able to pass them to tools that wrap Cling, particularly Jupyter kernels such as xeus-cling + # and the built-in jupyter-cling-kernel. Both of these use Cling as a library by linking against + # libclingJupyter.so, so the makeWrapper approach to wrapping the binary doesn't work. + # Thus, if you're packaging a Jupyter kernel, you either need to pass these flags as extra + # args to xcpp (for xeus-cling) or put them in the environment variable CLING_OPTS + # (for jupyter-cling-kernel) + flags = [ + "-nostdinc" + "-nostdinc++" + "-isystem" "${lib.getDev stdenv.cc.libc}/include" + "-I" "${lib.getDev unwrapped}/include" + "-I" "${lib.getLib unwrapped}/lib/clang/5.0.2/include" + ]; + + # Autodetect the include paths for the compiler used to build Cling, in the same way Cling does at + # https://github.com/root-project/cling/blob/v0.7/lib/Interpreter/CIFactory.cpp#L107:L111 + # Note: it would be nice to just put the compiler in Cling's PATH and let it do this by itself, but + # unfortunately passing -nostdinc/-nostdinc++ disables Cling's autodetection logic. + compilerIncludeFlags = runCommandNoCC "compiler-include-flags.txt" {} '' + export LC_ALL=C + ${stdenv.cc}/bin/c++ -xc++ -E -v /dev/null 2>&1 | sed -n -e '/^.include/,''${' -e '/^ \/.*++/p' -e '}' > tmp + sed -e 's/^/-isystem /' -i tmp + tr '\n' ' ' < tmp > $out + ''; + +in + +runCommand "cling-${unwrapped.version}" { + buildInputs = [ makeWrapper ]; + inherit unwrapped flags compilerIncludeFlags; + inherit (unwrapped) meta; +} '' + makeWrapper $unwrapped/bin/cling $out/bin/cling \ + --add-flags "$(cat "$compilerIncludeFlags")" \ + --add-flags "$flags" +'' diff --git a/pkgs/development/interpreters/clips/default.nix b/pkgs/development/interpreters/clips/default.nix index cf0710f36a1..2edeaf9e4e8 100644 --- a/pkgs/development/interpreters/clips/default.nix +++ b/pkgs/development/interpreters/clips/default.nix @@ -1,19 +1,29 @@ -{ stdenv, fetchurl }: +{ lib, stdenv, fetchurl }: -stdenv.mkDerivation { - version = "6.30"; +stdenv.mkDerivation rec { + version = "6.40"; pname = "clips"; + src = fetchurl { - url = "mirror://sourceforge/clipsrules/CLIPS/6.30/clips_core_source_630.tar.Z"; - sha256 = "1r0m59l3mk9cwzq3nmyr5qxrlkzp3njls4hfv8ml85dmqh7n3ysy"; + url = "mirror://sourceforge/clipsrules/CLIPS/${version}/clips_core_source_${ + builtins.replaceStrings [ "." ] [ "" ] version + }.tar.gz"; + sha256 = "1pr5l61zxf6kjs8b2b028g2aq45pigavwjmrf4l5mrdmlnk3fq5d"; }; - buildPhase = '' - make -C core -f ../makefiles/makefile.gcc + + postPatch = '' + substituteInPlace core/makefile --replace 'gcc' '${stdenv.cc.targetPrefix}cc' ''; + + makeFlags = [ "-C" "core" ]; + installPhase = '' + runHook preInstall install -D -t $out/bin core/clips + runHook postInstall ''; - meta = with stdenv.lib; { + + meta = with lib; { description = "A Tool for Building Expert Systems"; homepage = "http://www.clipsrules.net/"; longDescription = '' @@ -23,7 +33,7 @@ stdenv.mkDerivation { easier to implement and maintain than an algorithmic solution. ''; license = licenses.publicDomain; - maintainers = [maintainers.league]; - platforms = platforms.linux; + maintainers = [ maintainers.league ]; + platforms = platforms.unix; }; } diff --git a/pkgs/development/interpreters/clisp/default.nix b/pkgs/development/interpreters/clisp/default.nix index 1b7ff2c8cba..566d16179b5 100644 --- a/pkgs/development/interpreters/clisp/default.nix +++ b/pkgs/development/interpreters/clisp/default.nix @@ -3,7 +3,7 @@ # - 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 +{ lib, stdenv, fetchurl, libsigsegv, gettext, ncurses, readline, libX11 , libXau, libXt, pcre, zlib, libXpm, xorgproto, libXext , libffi , libffcall @@ -16,8 +16,8 @@ "pcre" "rawsock" ] - ++ stdenv.lib.optionals stdenv.isLinux [ "bindings/glibc" "zlib" "wildcard" ] - ++ stdenv.lib.optional x11Support "clx/new-clx" + ++ lib.optionals stdenv.isLinux [ "bindings/glibc" "zlib" "wildcard" ] + ++ lib.optional x11Support "clx/new-clx" }: assert x11Support -> (libX11 != null && libXau != null && libXt != null @@ -37,14 +37,14 @@ stdenv.mkDerivation rec { 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 [ + ++ lib.optional (gettext != null) gettext + ++ lib.optional (ncurses != null) ncurses + ++ lib.optional (pcre != null) pcre + ++ lib.optional (zlib != null) zlib + ++ lib.optional (readline != null) readline + ++ lib.optional (ffcallAvailable && (libffi != null)) libffi + ++ lib.optional ffcallAvailable libffcall + ++ lib.optionals x11Support [ libX11 libXau libXt libXpm xorgproto libXext ]; @@ -68,14 +68,14 @@ stdenv.mkDerivation rec { ''; configureFlags = [ "builddir" ] - ++ stdenv.lib.optional (!dllSupport) "--without-dynamic-modules" - ++ stdenv.lib.optional (readline != null) "--with-readline" + ++ lib.optional (!dllSupport) "--without-dynamic-modules" + ++ 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" + ++ lib.optional (ffcallAvailable && (libffi != null)) "--with-dynamic-ffi" + ++ lib.optional ffcallAvailable "--with-ffcall" + ++ lib.optional (!ffcallAvailable) "--without-ffcall" ++ builtins.map (x: "--with-module=" + x) withModules - ++ stdenv.lib.optional threadSupport "--with-threads=POSIX_THREADS"; + ++ lib.optional threadSupport "--with-threads=POSIX_THREADS"; preBuild = '' sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d @@ -83,11 +83,11 @@ stdenv.mkDerivation rec { ''; postInstall = - stdenv.lib.optionalString (withModules != []) + lib.optionalString (withModules != []) (''./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full'' - + stdenv.lib.concatMapStrings (x: " " + x) withModules); + + lib.concatMapStrings (x: " " + x) withModules); - NIX_CFLAGS_COMPILE = "-O0 ${stdenv.lib.optionalString (!stdenv.is64bit) "-falign-functions=4"}"; + NIX_CFLAGS_COMPILE = "-O0 ${lib.optionalString (!stdenv.is64bit) "-falign-functions=4"}"; # TODO : make mod-check fails doCheck = false; @@ -95,10 +95,10 @@ stdenv.mkDerivation rec { meta = { description = "ANSI Common Lisp Implementation"; homepage = "http://clisp.cons.org"; - maintainers = with stdenv.lib.maintainers; [raskin tohl]; - platforms = stdenv.lib.platforms.unix; + maintainers = with lib.maintainers; [raskin tohl]; + platforms = 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; + license = lib.licenses.gpl2; }; } diff --git a/pkgs/development/interpreters/clisp/hg.nix b/pkgs/development/interpreters/clisp/hg.nix index 6898f84669f..83a1870d182 100644 --- a/pkgs/development/interpreters/clisp/hg.nix +++ b/pkgs/development/interpreters/clisp/hg.nix @@ -3,7 +3,7 @@ # - 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 +{ lib, stdenv, fetchhg, libsigsegv, gettext, ncurses, readline, libX11 , libXau, libXt, pcre, zlib, libXpm, xorgproto, libXext , libffi, libffcall, automake , coreutils @@ -15,8 +15,8 @@ "pcre" "rawsock" ] - ++ stdenv.lib.optionals stdenv.isLinux [ "bindings/glibc" "zlib" ] - ++ stdenv.lib.optional x11Support "clx/new-clx" + ++ lib.optionals stdenv.isLinux [ "bindings/glibc" "zlib" ] + ++ lib.optional x11Support "clx/new-clx" }: assert x11Support -> (libX11 != null && libXau != null && libXt != null @@ -38,14 +38,14 @@ stdenv.mkDerivation rec { 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 [ + ++ lib.optional (gettext != null) gettext + ++ lib.optional (ncurses != null) ncurses + ++ lib.optional (pcre != null) pcre + ++ lib.optional (zlib != null) zlib + ++ lib.optional (readline != null) readline + ++ lib.optional (ffcallAvailable && (libffi != null)) libffi + ++ lib.optional ffcallAvailable libffcall + ++ lib.optionals x11Support [ libX11 libXau libXt libXpm xorgproto libXext ]; @@ -63,14 +63,14 @@ stdenv.mkDerivation rec { ''; configureFlags = [ "builddir" ] - ++ stdenv.lib.optional (!dllSupport) "--without-dynamic-modules" - ++ stdenv.lib.optional (readline != null) "--with-readline" + ++ lib.optional (!dllSupport) "--without-dynamic-modules" + ++ 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" + ++ lib.optional (ffcallAvailable && (libffi != null)) "--with-dynamic-ffi" + ++ lib.optional ffcallAvailable "--with-ffcall" + ++ lib.optional (!ffcallAvailable) "--without-ffcall" ++ builtins.map (x: " --with-module=" + x) withModules - ++ stdenv.lib.optional threadSupport "--with-threads=POSIX_THREADS"; + ++ lib.optional threadSupport "--with-threads=POSIX_THREADS"; preBuild = '' sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d @@ -79,11 +79,11 @@ stdenv.mkDerivation rec { ''; postInstall = - stdenv.lib.optionalString (withModules != []) + lib.optionalString (withModules != []) (''./clisp-link add "$out"/lib/clisp*/base "$(dirname "$out"/lib/clisp*/base)"/full'' - + stdenv.lib.concatMapStrings (x: " " + x) withModules); + + lib.concatMapStrings (x: " " + x) withModules); - NIX_CFLAGS_COMPILE = "-O0 ${stdenv.lib.optionalString (!stdenv.is64bit) "-falign-functions=4"}"; + NIX_CFLAGS_COMPILE = "-O0 ${lib.optionalString (!stdenv.is64bit) "-falign-functions=4"}"; # TODO : make mod-check fails doCheck = false; @@ -91,8 +91,8 @@ stdenv.mkDerivation rec { meta = { description = "ANSI Common Lisp Implementation"; homepage = "http://clisp.cons.org"; - maintainers = with stdenv.lib.maintainers; [raskin tohl]; + maintainers = with lib.maintainers; [raskin tohl]; # problems on Darwin: https://github.com/NixOS/nixpkgs/issues/20062 - platforms = stdenv.lib.platforms.linux; + platforms = lib.platforms.linux; }; } diff --git a/pkgs/development/interpreters/clojure/babashka.nix b/pkgs/development/interpreters/clojure/babashka.nix index c023aa65fda..58ed4c689b1 100644 --- a/pkgs/development/interpreters/clojure/babashka.nix +++ b/pkgs/development/interpreters/clojure/babashka.nix @@ -1,56 +1,90 @@ -{ stdenv, fetchurl, graalvm8, glibcLocales }: +{ lib, stdenv, fetchurl, graalvm11-ce, glibcLocales }: -with stdenv.lib; stdenv.mkDerivation rec { pname = "babashka"; - version = "0.0.97"; + version = "0.4.5"; reflectionJson = fetchurl { name = "reflection.json"; - url = "https://github.com/borkdude/${pname}/releases/download/v${version}/${pname}-${version}-reflection.json"; - sha256 = "1gd9ih9l02n1j9qkbxb36d3cb5sddwvxiw8kkicgc4xig77lsa7z"; + url = "https://github.com/babashka/${pname}/releases/download/v${version}/${pname}-${version}-reflection.json"; + sha256 = "sha256-TVFdGFXclJE9GpolKzTGSmeianBdb2Yp3kbNUWlddPw="; }; src = fetchurl { - url = "https://github.com/borkdude/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar"; - sha256 = "08py6bawfrhg90fbcnv2mq4c91g5wa1q2q6zdjy2i1b9q4x1654r"; + url = "https://github.com/babashka/${pname}/releases/download/v${version}/${pname}-${version}-standalone.jar"; + sha256 = "sha256-SnKs30c6VTp1yzW2Glooi6ghSUIZgF6nsob1hDljTA8="; }; dontUnpack = true; + nativeBuildInputs = [ graalvm11-ce glibcLocales ]; + LC_ALL = "en_US.UTF-8"; - nativeBuildInputs = [ graalvm8 glibcLocales ]; + BABASHKA_JAR = src; + BABASHKA_BINARY = "bb"; + BABASHKA_XMX = "-J-Xmx4500m"; 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" + runHook preBuild + + # https://github.com/babashka/babashka/blob/77daea7362d8e2562c89c315b1fbcefde6fa56a5/script/compile + args=("-jar" "$BABASHKA_JAR" + "-H:Name=$BABASHKA_BINARY" + "${lib.optionalString stdenv.isDarwin ''-H:-CheckToolchain''}" + "-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-build-time" + # "-H:+PrintAnalysisCallTree" + # "-H:+DashboardAll" + # "-H:DashboardDump=reports/dump" + # "-H:+DashboardPretty" + # "-H:+DashboardJson" + "-H:Log=registerResource:" + "-H:EnableURLProtocols=http,https,jar" + "--enable-all-security-services" + "-H:+JNI" + "--verbose" + "--no-fallback" + "--no-server" + "--report-unsupported-elements-at-runtime" + "--initialize-at-run-time=org.postgresql.sspi.SSPIClient" + "--native-image-info" + "--verbose" + "-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.AudioFileReader" + "-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.MidiFileReader" + "-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.MixerProvider" + "-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.FormatConversionProvider" + "-H:ServiceLoaderFeatureExcludeServices=javax.sound.sampled.spi.AudioFileWriter" + "-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.MidiDeviceProvider" + "-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.SoundbankReader" + "-H:ServiceLoaderFeatureExcludeServices=javax.sound.midi.spi.MidiFileWriter" + "$BABASHKA_XMX") + + native-image ''${args[@]} + + runHook postBuild ''; installPhase = '' + runHook preInstall + mkdir -p $out/bin cp bb $out/bin/bb + + runHook postInstall + ''; + + installCheckPhase = '' + $out/bin/bb --version | grep '${version}' + $out/bin/bb '(+ 1 2)' | grep '3' + $out/bin/bb '(vec (dedupe *input*))' <<< '[1 1 1 1 2]' | grep '[1 2]' ''; - meta = with stdenv.lib; { + meta = with 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 @@ -76,9 +110,15 @@ stdenv.mkDerivation rec { - Batteries included (tools.cli, cheshire, ...) - Library support via popular tools like the clojure CLI ''; - homepage = "https://github.com/borkdude/babashka"; + homepage = "https://github.com/babashka/babashka"; license = licenses.epl10; - platforms = graalvm8.meta.platforms; - maintainers = with maintainers; [ bandresen bhougland DerGuteMoritz jlesquembre ]; + platforms = graalvm11-ce.meta.platforms; + maintainers = with maintainers; [ + bandresen + bhougland + DerGuteMoritz + jlesquembre + thiagokokada + ]; }; } diff --git a/pkgs/development/interpreters/clojure/clooj.nix b/pkgs/development/interpreters/clojure/clooj.nix index d51fa76003b..42d6d67ee15 100644 --- a/pkgs/development/interpreters/clojure/clooj.nix +++ b/pkgs/development/interpreters/clojure/clooj.nix @@ -1,20 +1,18 @@ -{ stdenv, fetchurl, jre, makeWrapper }: +{ lib, stdenv, fetchurl, jre, makeWrapper }: -let version = "0.4.4"; in - -stdenv.mkDerivation { +stdenv.mkDerivation rec { pname = "clooj"; - inherit version; + version = "0.4.4"; 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"; + url = "https://archive.org/download/clooj-${version}-standalone/clooj-${version}-standalone.jar"; sha256 = "0hbc29bg2a86rm3sx9kvj7h7db9j0kbnrb706wsfiyk3zi3bavnd"; }; - buildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; - phases = "installPhase"; + dontUnpack = true; installPhase = '' mkdir -p $out/share/java @@ -25,6 +23,7 @@ stdenv.mkDerivation { meta = { description = "A lightweight IDE for Clojure"; homepage = "https://github.com/arthuredelstein/clooj"; - license = stdenv.lib.licenses.bsd3; + license = lib.licenses.bsd3; + platforms = lib.platforms.all; }; } diff --git a/pkgs/development/interpreters/clojure/default.nix b/pkgs/development/interpreters/clojure/default.nix index 53cef387ae4..9ae94f0a248 100644 --- a/pkgs/development/interpreters/clojure/default.nix +++ b/pkgs/development/interpreters/clojure/default.nix @@ -1,12 +1,13 @@ -{ stdenv, fetchurl, installShellFiles, jdk11, rlwrap, makeWrapper }: +{ lib, stdenv, fetchurl, installShellFiles, jdk, rlwrap, makeWrapper }: stdenv.mkDerivation rec { pname = "clojure"; - version = "1.10.1.645"; + version = "1.10.3.855"; src = fetchurl { + # https://clojure.org/releases/tools url = "https://download.clojure.org/install/clojure-tools-${version}.tar.gz"; - sha256 = "1z6a9an8ls992y4japmzdxay7c5d2z9s2q1xl4g615r23jwpcsf9"; + sha256 = "sha256-y2PuOBRq5kZlTpPV8NwkWhspQKlNxwjl+k/Drwixk4Q="; }; nativeBuildInputs = [ @@ -14,24 +15,35 @@ stdenv.mkDerivation rec { makeWrapper ]; + # See https://github.com/clojure/brew-install/blob/1.10.3/src/main/resources/clojure/install/linux-install.sh installPhase = let - binPath = stdenv.lib.makeBinPath [ rlwrap jdk11 ]; + binPath = 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 + runHook preInstall + clojure_lib_dir=$out + bin_dir=$out/bin + + echo "Installing libs into $clojure_lib_dir" + install -Dm644 deps.edn "$clojure_lib_dir/deps.edn" + install -Dm644 example-deps.edn "$clojure_lib_dir/example-deps.edn" + install -Dm644 exec.jar "$clojure_lib_dir/libexec/exec.jar" + install -Dm644 clojure-tools-${version}.jar "$clojure_lib_dir/libexec/clojure-tools-${version}.jar" + + echo "Installing clojure and clj into $bin_dir" substituteInPlace clojure --replace PREFIX $out + substituteInPlace clj --replace BINDIR $bin_dir + install -Dm755 clojure "$bin_dir/clojure" + install -Dm755 clj "$bin_dir/clj" - install -Dt $out/bin clj clojure - wrapProgram $out/bin/clj --prefix PATH : $out/bin:${binPath} - wrapProgram $out/bin/clojure --prefix PATH : $out/bin:${binPath} + wrapProgram $bin_dir/clojure --prefix PATH : $out/bin:${binPath} + wrapProgram $bin_dir/clj --prefix PATH : $out/bin:${binPath} installManPage clj.1 clojure.1 + + runHook postInstall ''; doInstallCheck = true; @@ -41,7 +53,7 @@ stdenv.mkDerivation rec { -Sverbose \ -Scp $out/libexec/clojure-tools-${version}.jar ''; - meta = with stdenv.lib; { + meta = with lib; { description = "A Lisp dialect for the JVM"; homepage = "https://clojure.org/"; license = licenses.epl10; @@ -64,7 +76,7 @@ stdenv.mkDerivation rec { offers a software transactional memory system and reactive Agent system that ensure clean, correct, multithreaded designs. ''; - maintainers = with maintainers; [ jlesquembre ]; + maintainers = with maintainers; [ jlesquembre thiagokokada ]; platforms = platforms.unix; }; } diff --git a/pkgs/development/interpreters/clojurescript/lumo/default.nix b/pkgs/development/interpreters/clojurescript/lumo/default.nix index 122831e80cc..7bd3913260d 100644 --- a/pkgs/development/interpreters/clojurescript/lumo/default.nix +++ b/pkgs/development/interpreters/clojurescript/lumo/default.nix @@ -145,15 +145,15 @@ stdenv.mkDerivation { src = fetchgit { url = "https://github.com/anmonteiro/lumo.git"; - rev = "${version}"; + rev = version; sha256 = "12agi6bacqic2wq6q3l28283badzamspajmajzqm7fbdl2aq1a4p"; }; + nativeBuildInputs = [ unzip ]; buildInputs = [ nodejs clojure jre - unzip python openssl gnutar @@ -280,8 +280,8 @@ stdenv.mkDerivation { 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; + license = lib.licenses.epl10; + maintainers = [ lib.maintainers.hlolli ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; }; } diff --git a/pkgs/development/interpreters/clojurescript/lumo/deps.nix b/pkgs/development/interpreters/clojurescript/lumo/deps.nix index 4f3beff3b81..50f1c4af211 100644 --- a/pkgs/development/interpreters/clojurescript/lumo/deps.nix +++ b/pkgs/development/interpreters/clojurescript/lumo/deps.nix @@ -4,9 +4,9 @@ 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/" + "https://oss.sonatype.org/content/repositories/releases/" + "https://oss.sonatype.org/content/repositories/public/" + "https://repo.typesafe.com/typesafe/releases/" ]; in rec { diff --git a/pkgs/development/interpreters/cyclone/default.nix b/pkgs/development/interpreters/cyclone/default.nix new file mode 100644 index 00000000000..0d2984904d8 --- /dev/null +++ b/pkgs/development/interpreters/cyclone/default.nix @@ -0,0 +1,51 @@ +{ lib, stdenv, fetchFromGitHub, libck, darwin }: + +let + version = "0.30.0"; + bootstrap = stdenv.mkDerivation { + pname = "cyclone-bootstrap"; + inherit version; + + src = fetchFromGitHub { + owner = "justinethier"; + repo = "cyclone-bootstrap"; + rev = "v${version}"; + sha256 = "sha256-/zAcCBdJ7YQXsspdjrMca1Oj9SUUFXQKLwZPoZLhHYg="; + }; + + enableParallelBuilding = true; + + nativeBuildInputs = lib.optionals stdenv.isDarwin [ darwin.cctools ]; + + buildInputs = [ libck ]; + + makeFlags = [ "PREFIX=${placeholder "out"}" ]; + }; +in +stdenv.mkDerivation { + pname = "cyclone"; + inherit version; + + src = fetchFromGitHub { + owner = "justinethier"; + repo = "cyclone"; + rev = "v${version}"; + sha256 = "sha256-a3wiqKlIbnvIhyrI0lyVGciQiM7KSuYH5iUfGFrgOuM="; + }; + + enableParallelBuilding = true; + + nativeBuildInputs = [ bootstrap ] + ++ lib.optionals stdenv.isDarwin [ darwin.cctools ]; + + buildInputs = [ libck ]; + + makeFlags = [ "PREFIX=${placeholder "out"}" ]; + + meta = with lib; { + homepage = "https://justinethier.github.io/cyclone/"; + description = "A brand-new compiler that allows practical application development using R7RS Scheme"; + license = licenses.mit; + maintainers = with maintainers; [ siraben ]; + }; +} diff --git a/pkgs/development/interpreters/dart/default.nix b/pkgs/development/interpreters/dart/default.nix index 050e7f14979..1d6abb59504 100644 --- a/pkgs/development/interpreters/dart/default.nix +++ b/pkgs/development/interpreters/dart/default.nix @@ -1,67 +1,45 @@ -{ stdenv, fetchurl, unzip, version ? "2.7.2" }: - -let - - sources = let - +{ stdenv +, lib +, fetchurl +, unzip +, version ? "2.13.1" +, 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"; + # Make sure that if the user overrides version parameter they're + # also need to override sources, to avoid mistakes + version = "2.13.1"; + in + { + "${version}-x86_64-darwin" = fetchurl { + url = "${base}/stable/release/${version}/sdk/dartsdk-macos-${x86_64}-release.zip"; + sha256 = "0kb6r2rmp5d0shvgyy37fmykbgww8qaj4f8k79rmqfv5lwa3izya"; }; - "2.7.2-x86_64-linux" = fetchurl { - url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${x86_64}-release.zip"; - sha256 = "0vvsgda1smqdjn35yiq9pxx8f5haxb4hqnspcsfs6sn5c36k854v"; + "${version}-x86_64-linux" = fetchurl { + url = "${base}/stable/release/${version}/sdk/dartsdk-linux-${x86_64}-release.zip"; + sha256 = "0zq8wngyrw01wjc5s6w1vz2jndms09ifiymjjixxby9k41mr6jrq"; }; - "2.7.2-i686-linux" = fetchurl { - url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${i686}-release.zip"; - sha256 = "0dj01d2wwrp3cc5x73vs6fzhs6db60gkbjlrw3w9j04wcx69i38m"; + "${version}-i686-linux" = fetchurl { + url = "${base}/stable/release/${version}/sdk/dartsdk-linux-${i686}-release.zip"; + sha256 = "0zv4q8xv2i08a6izpyhhnil75qhs40m5mgyvjqjsswqkwqdf7lkj"; }; - "2.7.2-aarch64-linux" = fetchurl { - url = "${base}/${stable_version}/release/${version}/sdk/dartsdk-linux-${aarch64}-release.zip"; - sha256 = "1p66fkdh1kv0ypmadmg67c3y3li3aaf1lahqh2g6r6qrzbh5da2p"; + "${version}-aarch64-linux" = fetchurl { + url = "${base}/stable/release/${version}/sdk/dartsdk-linux-${aarch64}-release.zip"; + sha256 = "0bb9jdmg5p608jmmiqibp13ydiw9avgysxlmljvgsl7wl93j6rgc"; }; - "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; +assert version != null && version != ""; +assert sources != null && (builtins.isAttrs sources); stdenv.mkDerivation { - pname = "dart"; inherit version; - nativeBuildInputs = [ - unzip - ]; + nativeBuildInputs = [ unzip ]; src = sources."${version}-${stdenv.hostPlatform.system}" or (throw "unsupported version/system: ${version}/${stdenv.hostPlatform.system}"); @@ -69,25 +47,23 @@ stdenv.mkDerivation { mkdir -p $out cp -R * $out/ echo $libPath - patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - --set-rpath $libPath \ - $out/bin/dart + find $out/bin -executable -type f -exec patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) {} \; ''; - libPath = makeLibraryPath [ stdenv.cc.cc ]; + libPath = lib.makeLibraryPath [ stdenv.cc.cc ]; dontStrip = true; - meta = { + meta = with lib; { homepage = "https://www.dartlang.org/"; - maintainers = with maintainers; [ grburst ]; + maintainers = with maintainers; [ grburst thiagokokada ]; 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" ]; + platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" ]; license = licenses.bsd3; }; } diff --git a/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix b/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix index b4401a85d14..7fe1b46e3a5 100644 --- a/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix +++ b/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix @@ -5,7 +5,7 @@ # the `file` # # This function is used by `dhall-to-nixpkgs` when given a directory -lib.makeOverridable +lib.makePackageOverridable ( { # Arguments passed through to `buildDhallPackage` name , dependencies ? [] @@ -14,12 +14,17 @@ lib.makeOverridable , src , # The file to import, relative to the root directory file ? "package.dhall" + # Set to `true` to generate documentation for the package + , document ? false }: - buildDhallPackage { - inherit name dependencies source; + buildDhallPackage + ( { inherit name dependencies source; - code = "${src}/${file}"; - } + code = "${src}/${file}"; + + } + // lib.optionalAttrs document { documentationRoot = src; } + ) ) diff --git a/pkgs/development/interpreters/dhall/build-dhall-github-package.nix b/pkgs/development/interpreters/dhall/build-dhall-github-package.nix index 9289e9b656d..8f9e4d83551 100644 --- a/pkgs/development/interpreters/dhall/build-dhall-github-package.nix +++ b/pkgs/development/interpreters/dhall/build-dhall-github-package.nix @@ -1,7 +1,7 @@ { buildDhallPackage, fetchFromGitHub, lib }: # This function is used by `dhall-to-nixpkgs` when given a GitHub repository -lib.makeOverridable +lib.makePackageOverridable ( { # Arguments passed through to `buildDhallPackage` name , dependencies ? [] @@ -12,6 +12,8 @@ lib.makeOverridable directory ? "" , # The file to import, relative to the above directory file ? "package.dhall" + # Set to `true` to generate documentation for the package + , document ? false # Arguments passed through to `fetchFromGitHub` , owner @@ -22,29 +24,39 @@ lib.makeOverridable , ... }@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}"; - } + let + versionedName = "${name}-${rev}"; + + src = fetchFromGitHub ({ + name = "${versionedName}-source"; + + inherit owner repo rev; + } // removeAttrs args [ + "name" + "dependencies" + "document" + "source" + "directory" + "file" + "owner" + "repo" + "rev" + ]); + + prefix = lib.optionalString (directory != "") "/${directory}"; + + in + buildDhallPackage + ( { inherit dependencies source; + + name = versionedName; + + code = "${src}${prefix}/${file}"; + } + // lib.optionalAttrs document + { documentationRoot = "${src}/${prefix}"; + + baseImportUrl = "https://raw.githubusercontent.com/${owner}/${repo}/${rev}${prefix}"; + } + ) ) diff --git a/pkgs/development/interpreters/dhall/build-dhall-package.nix b/pkgs/development/interpreters/dhall/build-dhall-package.nix index 9303244eb88..86797e9f136 100644 --- a/pkgs/development/interpreters/dhall/build-dhall-package.nix +++ b/pkgs/development/interpreters/dhall/build-dhall-package.nix @@ -1,4 +1,4 @@ -{ dhall, haskell, lib, lndir, runCommand, writeText }: +{ dhall, dhall-docs, haskell, lib, lndir, runCommand, writeText }: { name @@ -31,6 +31,18 @@ # 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 + + # Directory to generate documentation for (i.e. as the `--input` option to the + # `dhall-docs` command.) + # + # If `null`, then no documentation is generated. +, documentationRoot ? null + + # Base URL prepended to paths copied to the clipboard + # + # This is used in conjunction with `documentationRoot`, and is unused if + # `documentationRoot` is `null`. +, baseImportUrl ? null }: let @@ -42,8 +54,12 @@ let cache = ".cache"; + data = ".local/share"; + cacheDhall = "${cache}/dhall"; + dataDhall = "${data}/dhall"; + sourceFile = "source.dhall"; in @@ -71,4 +87,16 @@ in echo "missing $SHA_HASH" > $out/binary.dhall ${lib.optionalString (!source) "rm $out/${sourceFile}"} + + ${lib.optionalString (documentationRoot != null) '' + mkdir -p $out/${dataDhall} + + XDG_DATA_HOME=$out/${data} ${dhall-docs}/bin/dhall-docs --output-link $out/docs ${lib.cli.toGNUCommandLineShell { } { + base-import-url = baseImportUrl; + + input = documentationRoot; + + package-name = name; + }} + ''} '' diff --git a/pkgs/development/interpreters/duktape/default.nix b/pkgs/development/interpreters/duktape/default.nix index 53cbbad8e55..ba533a17276 100644 --- a/pkgs/development/interpreters/duktape/default.nix +++ b/pkgs/development/interpreters/duktape/default.nix @@ -1,13 +1,23 @@ -{ stdenv, fetchurl }: +{ lib, stdenv, fetchurl, validatePkgConfig }: stdenv.mkDerivation rec { pname = "duktape"; - version = "2.5.0"; + version = "2.6.0"; src = fetchurl { url = "http://duktape.org/duktape-${version}.tar.xz"; - sha256 = "05ln6b2a0s8ynz28armwqs2r5zjyi3cxi0dx6ahnxlqw19b13m43"; + sha256 = "19szwxzvl2g65fw95ggvb8h0ma5bd9vvnnccn59hwnc4dida1x4n"; }; + nativeBuildInputs = [ validatePkgConfig ]; + + postPatch = '' + substituteInPlace Makefile.sharedlibrary \ + --replace 'gcc' '${stdenv.cc.targetPrefix}cc' \ + --replace 'g++' '${stdenv.cc.targetPrefix}c++' + substituteInPlace Makefile.cmdline \ + --replace 'gcc' '${stdenv.cc.targetPrefix}cc' \ + --replace 'g++' '${stdenv.cc.targetPrefix}c++' + ''; buildPhase = '' make -f Makefile.sharedlibrary make -f Makefile.cmdline @@ -15,18 +25,19 @@ stdenv.mkDerivation rec { installPhase = '' install -d $out/bin install -m755 duk $out/bin/ - install -d $out/lib + install -d $out/lib/pkgconfig install -d $out/include make -f Makefile.sharedlibrary install INSTALL_PREFIX=$out + substituteAll ${./duktape.pc.in} $out/lib/pkgconfig/duktape.pc ''; enableParallelBuilding = true; - meta = with stdenv.lib; { + meta = with 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; + platforms = platforms.all; }; } diff --git a/pkgs/development/interpreters/duktape/duktape.pc.in b/pkgs/development/interpreters/duktape/duktape.pc.in new file mode 100644 index 00000000000..d34edb320e2 --- /dev/null +++ b/pkgs/development/interpreters/duktape/duktape.pc.in @@ -0,0 +1,10 @@ +prefix=@out@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: duktape +Description: An embeddable Javascript engine, with a focus on portability and compact footprint +Version: @version@ +Libs: -L${libdir} -lduktape +Cflags: -I${includedir} diff --git a/pkgs/development/interpreters/eff/default.nix b/pkgs/development/interpreters/eff/default.nix index cfd3bbbda4c..cddb773ec16 100644 --- a/pkgs/development/interpreters/eff/default.nix +++ b/pkgs/development/interpreters/eff/default.nix @@ -1,11 +1,8 @@ -{ stdenv, fetchFromGitHub, which, ocamlPackages }: - -let version = "5.0"; in - -stdenv.mkDerivation { +{ lib, stdenv, fetchFromGitHub, which, ocamlPackages }: +stdenv.mkDerivation rec { pname = "eff"; - inherit version; + version = "5.0"; src = fetchFromGitHub { owner = "matijapretnar"; @@ -25,7 +22,7 @@ stdenv.mkDerivation { doCheck = true; checkTarget = "test"; - meta = with stdenv.lib; { + meta = with lib; { homepage = "https://www.eff-lang.org"; description = "A functional programming language based on algebraic effects and their handlers"; longDescription = '' diff --git a/pkgs/development/interpreters/elixir/1.11.nix b/pkgs/development/interpreters/elixir/1.11.nix new file mode 100644 index 00000000000..6e5a30a9dd7 --- /dev/null +++ b/pkgs/development/interpreters/elixir/1.11.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.11.4"; + sha256 = "sha256-qCX6hRWUbW+E5xaUhcYxRAnhnvncASUJck8lESlcDvk="; + minimumOTPVersion = "21"; +} diff --git a/pkgs/development/interpreters/elixir/1.12.nix b/pkgs/development/interpreters/elixir/1.12.nix new file mode 100644 index 00000000000..cd5246d989d --- /dev/null +++ b/pkgs/development/interpreters/elixir/1.12.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.12.1"; + sha256 = "sha256-gRgGXb4btMriQwT/pRIYOJt+NM7rtYBd+A3SKfowC7k="; + minimumOTPVersion = "22"; +} diff --git a/pkgs/development/interpreters/elixir/1.6.nix b/pkgs/development/interpreters/elixir/1.6.nix deleted file mode 100644 index 94dffd1f763..00000000000 --- a/pkgs/development/interpreters/elixir/1.6.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ mkDerivation }: - -mkDerivation { - version = "1.6.6"; - sha256 = "1wl8rfpw0dxacq4f7xf6wjr8v2ww5691d0cfw9pzw7phd19vazgl"; - minimumOTPVersion = "19"; -} diff --git a/pkgs/development/interpreters/elixir/generic-builder.nix b/pkgs/development/interpreters/elixir/generic-builder.nix index 54b046beaab..646fd70ff8f 100644 --- a/pkgs/development/interpreters/elixir/generic-builder.nix +++ b/pkgs/development/interpreters/elixir/generic-builder.nix @@ -1,5 +1,14 @@ -{ pkgs, stdenv, fetchFromGitHub, erlang, rebar, makeWrapper, - coreutils, curl, bash, debugInfo ? false }: +{ pkgs +, lib +, stdenv +, fetchFromGitHub +, erlang +, makeWrapper +, coreutils +, curl +, bash +, debugInfo ? false +}: { baseName ? "elixir" , version @@ -10,69 +19,61 @@ } @ args: let - inherit (stdenv.lib) getVersion versionAtLeast optional; + inherit (lib) getVersion versionAtLeast optional; in - assert versionAtLeast (getVersion erlang) minimumOTPVersion; +assert versionAtLeast (getVersion erlang) minimumOTPVersion; - stdenv.mkDerivation ({ - name = "${baseName}-${version}"; +stdenv.mkDerivation ({ + name = "${baseName}-${version}"; - inherit src version; + inherit src version debugInfo; - buildInputs = [ erlang rebar makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ erlang ]; - LANG = "C.UTF-8"; - LC_TYPE = "C.UTF-8"; + LANG = "C.UTF-8"; + LC_TYPE = "C.UTF-8"; - setupHook = ./setup-hook.sh; + buildFlags = optional debugInfo "ERL_COMPILER_OPTIONS=debug_info"; - inherit debugInfo; + preBuild = '' + patchShebangs lib/elixir/generate_app.escript || true - buildFlags = optional debugInfo "ERL_COMPILER_OPTIONS=debug_info"; + substituteInPlace Makefile \ + --replace "/usr/local" $out + ''; - preBuild = '' - # The build process uses ./rebar. Link it to the nixpkgs rebar - rm -vf rebar - ln -s ${rebar}/bin/rebar rebar + postFixup = '' + # Elixir binaries are shell scripts which run erl. Add some stuff + # to PATH so the scripts can run without problems. - patchShebangs lib/elixir/generate_app.escript || true + for f in $out/bin/*; do + b=$(basename $f) + if [ "$b" = mix ]; then continue; fi + wrapProgram $f \ + --prefix PATH ":" "${lib.makeBinPath [ erlang coreutils curl bash ]}" + done - 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. + substituteInPlace $out/bin/mix \ + --replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir" + ''; - 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 + pos = builtins.unsafeGetAttrPos "sha256" args; + meta = with lib; { + homepage = "https://elixir-lang.org/"; + description = "A functional, meta-programming aware language built on top of the Erlang VM"; - substituteInPlace $out/bin/mix \ - --replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir" + 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. ''; - 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 ]; - }; - }) + license = licenses.epl10; + platforms = platforms.unix; + maintainers = teams.beam.members; + }; +}) diff --git a/pkgs/development/interpreters/elixir/setup-hook.sh b/pkgs/development/interpreters/elixir/setup-hook.sh deleted file mode 100644 index 501eca3cf02..00000000000 --- a/pkgs/development/interpreters/elixir/setup-hook.sh +++ /dev/null @@ -1,5 +0,0 @@ -addErlLibPath() { - addToSearchPath ERL_LIBS $1/lib/elixir/lib -} - -addEnvHooks "$hostOffset" addErlLibPath diff --git a/pkgs/development/interpreters/erlang/R16B02-basho.nix b/pkgs/development/interpreters/erlang/R16B02-basho.nix index c94528e674f..69d0ac6b7a5 100644 --- a/pkgs/development/interpreters/erlang/R16B02-basho.nix +++ b/pkgs/development/interpreters/erlang/R16B02-basho.nix @@ -59,7 +59,7 @@ mkDerivation { knownVulnerabilities = [ "CVE-2017-1000385" ]; platforms = ["x86_64-linux" "x86_64-darwin"]; - license = pkgs.stdenv.lib.licenses.asl20; - maintainers = with pkgs.stdenv.lib.maintainers; [ mdaiter ]; + license = pkgs.lib.licenses.asl20; + maintainers = with pkgs.lib.maintainers; [ mdaiter ]; }; } diff --git a/pkgs/development/interpreters/erlang/R18.nix b/pkgs/development/interpreters/erlang/R18.nix deleted file mode 100644 index e9d9366851e..00000000000 --- a/pkgs/development/interpreters/erlang/R18.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ 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/pkgs/development/interpreters/erlang/R19.nix b/pkgs/development/interpreters/erlang/R19.nix deleted file mode 100644 index d5f3afe5f3d..00000000000 --- a/pkgs/development/interpreters/erlang/R19.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ 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/pkgs/development/interpreters/erlang/R20.nix b/pkgs/development/interpreters/erlang/R20.nix deleted file mode 100644 index 3a33e55767b..00000000000 --- a/pkgs/development/interpreters/erlang/R20.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ 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/pkgs/development/interpreters/erlang/R21.nix b/pkgs/development/interpreters/erlang/R21.nix index fdd034fc607..7706bd69fbf 100644 --- a/pkgs/development/interpreters/erlang/R21.nix +++ b/pkgs/development/interpreters/erlang/R21.nix @@ -1,10 +1,6 @@ { mkDerivation }: mkDerivation { - version = "21.3.8.3"; - sha256 = "1szybirrcpqsl2nmlmpbkxjqnm6i7l7bma87m5cpwi0kpvlxwmcw"; - - prePatch = '' - substituteInPlace configure.in --replace '`sw_vers -productVersion`' "''${MACOSX_DEPLOYMENT_TARGET:-10.12}" - ''; + version = "21.3.8.24"; + sha256 = "sha256-FNs+M4KFFKzfb4EG513HtyQ9eRRtxSPMpYq0bmRgY3g="; } diff --git a/pkgs/development/interpreters/erlang/R22.nix b/pkgs/development/interpreters/erlang/R22.nix index 7596ad9e2f1..9236ea42894 100644 --- a/pkgs/development/interpreters/erlang/R22.nix +++ b/pkgs/development/interpreters/erlang/R22.nix @@ -3,11 +3,6 @@ # 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' "" - ''; + version = "22.3.4.20"; + sha256 = "sha256-EUErOCW16eUb/p5dLpFV7sQ3mXlCF/OgOvGAAyYEvLo="; } diff --git a/pkgs/development/interpreters/erlang/R23.nix b/pkgs/development/interpreters/erlang/R23.nix index d42508c2ef9..3d0a2b16006 100644 --- a/pkgs/development/interpreters/erlang/R23.nix +++ b/pkgs/development/interpreters/erlang/R23.nix @@ -3,11 +3,6 @@ # 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' "" - ''; + version = "23.3.4.5"; + sha256 = "2u/w8IPKHEZ+rZ3T7Wn9+Ggxe6JY8cHz8q/N0RjbrNU="; } diff --git a/pkgs/development/interpreters/erlang/R24.nix b/pkgs/development/interpreters/erlang/R24.nix new file mode 100644 index 00000000000..b4e9ebba797 --- /dev/null +++ b/pkgs/development/interpreters/erlang/R24.nix @@ -0,0 +1,8 @@ +{ mkDerivation }: + +# How to obtain `sha256`: +# nix-prefetch-url --unpack https://github.com/erlang/otp/archive/OTP-${version}.tar.gz +mkDerivation { + version = "24.0.4"; + sha256 = "OeXXNaVJh5el+V+5ukcNOAgDmkJuGy1lYLpUTd1yxHM="; +} diff --git a/pkgs/development/interpreters/erlang/generic-builder.nix b/pkgs/development/interpreters/erlang/generic-builder.nix index af944e6fd14..13d2d33abfc 100644 --- a/pkgs/development/interpreters/erlang/generic-builder.nix +++ b/pkgs/development/interpreters/erlang/generic-builder.nix @@ -1,12 +1,33 @@ -{ pkgs, stdenv, fetchFromGitHub, makeWrapper, gawk, gnum4, gnused -, libxml2, libxslt, ncurses, openssl, perl, autoconf -, openjdk ? null # javacSupport +{ pkgs +, lib +, stdenv +, fetchFromGitHub +, makeWrapper +, gawk +, gnum4 +, gnused +, libxml2 +, libxslt +, ncurses +, openssl +, perl +, autoconf +, openjdk11 ? null # javacSupport , unixODBC ? null # odbcSupport -, libGL ? null, libGLU ? null, wxGTK ? null, wxmac ? null, xorg ? null # wxSupport +, libGL ? null +, libGLU ? null +, wxGTK ? null +, wxmac ? null +, xorg ? null , parallelBuild ? false -, withSystemd ? stdenv.isLinux, systemd # systemd support in epmd +, systemd +, wxSupport ? true + # updateScript deps +, writeScript +, common-updater-scripts +, coreutils +, git }: - { baseName ? "erlang" , version , sha256 ? null @@ -17,32 +38,52 @@ , enableThreads ? true , enableSmpSupport ? true , enableKernelPoll ? true -, javacSupport ? false, javacPackages ? [ openjdk ] -, 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 ? "" +, javacSupport ? false +, javacPackages ? [ openjdk11 ] +, odbcSupport ? false +, odbcPackages ? [ unixODBC ] +, withSystemd ? stdenv.isLinux # systemd support in epmd +, opensslPackage ? openssl +, 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 ? {} +, checkPhase ? "" +, preCheck ? "" +, postCheck ? "" +, fixupPhase ? "" +, preFixup ? "" +, postFixup ? "" +, meta ? { } }: assert wxSupport -> (if stdenv.isDarwin - then wxmac != null - else libGL != null && libGLU != null && wxGTK != null && xorg != null); +then wxmac != null +else libGL != null && libGLU != null && wxGTK != null && xorg != null); assert odbcSupport -> unixODBC != null; -assert javacSupport -> openjdk != null; +assert javacSupport -> openjdk11 != null; let - inherit (stdenv.lib) optional optionals optionalAttrs optionalString; + inherit (lib) optional optionals optionalAttrs optionalString; wxPackages2 = if stdenv.isDarwin then [ wxmac ] else wxPackages; -in stdenv.mkDerivation ({ +in +stdenv.mkDerivation ({ name = "${baseName}-${version}" + optionalString javacSupport "-javac" + optionalString odbcSupport "-odbc"; @@ -51,25 +92,18 @@ in stdenv.mkDerivation ({ nativeBuildInputs = [ autoconf makeWrapper perl gnum4 libxslt libxml2 ]; - buildInputs = [ ncurses openssl ] + buildInputs = [ ncurses opensslPackage ] ++ optionals wxSupport wxPackages2 ++ optionals odbcSupport odbcPackages ++ optionals javacSupport javacPackages ++ optional withSystemd systemd - ++ optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ Carbon Cocoa ]); + ++ optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ AGL Carbon Cocoa WebKit ]); 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 @@ -80,7 +114,8 @@ in stdenv.mkDerivation ({ ./otp_build autoconf ''; - configureFlags = [ "--with-ssl=${openssl.dev}" ] + configureFlags = [ "--with-ssl=${lib.getOutput "out" opensslPackage}" ] + ++ [ "--with-ssl-incl=${lib.getDev opensslPackage}" ] # This flag was introduced in R24 ++ optional enableThreads "--enable-threads" ++ optional enableSmpSupport "--enable-smp-support" ++ optional enableKernelPoll "--enable-kernel-poll" @@ -89,7 +124,8 @@ in stdenv.mkDerivation ({ ++ optional odbcSupport "--with-odbc=${unixODBC}" ++ optional wxSupport "--enable-wx" ++ optional withSystemd "--enable-systemd" - ++ optional stdenv.isDarwin "--enable-darwin-64bit"; + ++ 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). @@ -103,12 +139,29 @@ in stdenv.mkDerivation ({ # 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 ]}" + wrapProgram $out/lib/erlang/bin/start_erl --prefix PATH ":" "${lib.makeBinPath [ gnused gawk ]}" ''; - setupHook = ./setup-hook.sh; - - meta = with stdenv.lib; ({ + passthru = { + updateScript = + let major = builtins.head (builtins.splitVersion version); + in + writeScript "update.sh" '' + #!${stdenv.shell} + set -ox errexit + PATH=${lib.makeBinPath [ common-updater-scripts coreutils git gnused ]} + latest=$(list-git-tags https://github.com/erlang/otp.git | sed -n 's/^OTP-${major}/${major}/p' | sort -V | tail -1) + if [ "$latest" != "${version}" ]; then + nixpkgs="$(git rev-parse --show-toplevel)" + nix_file="$nixpkgs/pkgs/development/interpreters/erlang/R${major}.nix" + update-source-version ${baseName}R${major} "$latest" --version-key=version --print-changes --file="$nix_file" + else + echo "${baseName}R${major} is already up-to-date" + fi + ''; + }; + + meta = with lib; ({ homepage = "https://www.erlang.org/"; downloadPage = "https://www.erlang.org/download.html"; description = "Programming language used for massively scalable soft real-time systems"; @@ -123,28 +176,28 @@ in stdenv.mkDerivation ({ ''; platforms = platforms.unix; - maintainers = with maintainers; [ sjmackenzie couchemar gleber ]; + maintainers = teams.beam.members; license = licenses.asl20; } // meta); } -// optionalAttrs (preUnpack != "") { inherit preUnpack; } -// optionalAttrs (postUnpack != "") { inherit postUnpack; } -// optionalAttrs (patches != []) { inherit patches; } -// optionalAttrs (patchPhase != "") { inherit patchPhase; } -// optionalAttrs (configureFlags != []) { inherit configureFlags; } +// optionalAttrs (preUnpack != "") { inherit preUnpack; } +// optionalAttrs (postUnpack != "") { inherit postUnpack; } +// optionalAttrs (patches != [ ]) { inherit patches; } +// optionalAttrs (prePatch != "") { inherit prePatch; } +// 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; } +// 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/pkgs/development/interpreters/erlang/setup-hook.sh b/pkgs/development/interpreters/erlang/setup-hook.sh deleted file mode 100644 index 3962d154ba9..00000000000 --- a/pkgs/development/interpreters/erlang/setup-hook.sh +++ /dev/null @@ -1,5 +0,0 @@ -addErlangLibPath() { - addToSearchPath ERL_LIBS $1/lib/erlang/lib -} - -addEnvHooks "$hostOffset" addErlangLibPath diff --git a/pkgs/development/interpreters/evcxr/default.nix b/pkgs/development/interpreters/evcxr/default.nix index 11b9cd1ba50..7dabff3d2e5 100644 --- a/pkgs/development/interpreters/evcxr/default.nix +++ b/pkgs/development/interpreters/evcxr/default.nix @@ -1,27 +1,38 @@ -{ cargo, fetchFromGitHub, makeWrapper, pkgconfig, rustPlatform, stdenv, gcc, Security, cmake }: +{ cargo, fetchFromGitHub, makeWrapper, pkg-config, rustPlatform, lib, stdenv +, gcc, cmake, libiconv, CoreServices, Security }: rustPlatform.buildRustPackage rec { pname = "evcxr"; - version = "0.5.3"; + version = "0.10.0"; src = fetchFromGitHub { owner = "google"; repo = "evcxr"; rev = "v${version}"; - sha256 = "144xqi19d2nj9qgmhpx6d1kfhx9vfkmk7rnq6nzybpx4mbbl3ki2"; + sha256 = "sha256-EPxWLPw+V5eIm+eL8m8Xw14adgshthJSDRyWohsJH88="; }; - cargoSha256 = "07lzxh0wh6azrlzfaacg29zmkn8jdnkdqbwgd5ajy79y8nii3c7z"; + cargoSha256 = "sha256-5jGrv0YRVMo2X9p/WPgjYV3z193hl2+NiFTZr3v0Iik="; - 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 ]} + RUST_SRC_PATH = "${rustPlatform.rustLibSrc}"; + + nativeBuildInputs = [ pkg-config makeWrapper cmake ]; + buildInputs = lib.optionals stdenv.isDarwin + [ libiconv CoreServices Security ]; + + postInstall = let + wrap = exe: '' + wrapProgram $out/bin/${exe} \ + --prefix PATH : ${lib.makeBinPath [ cargo gcc ]} \ + --set-default RUST_SRC_PATH "$RUST_SRC_PATH" + ''; + in '' + ${wrap "evcxr"} + ${wrap "evcxr_jupyter"} rm $out/bin/testing_runtime ''; - meta = with stdenv.lib; { + meta = with lib; { description = "An evaluation context for Rust"; homepage = "https://github.com/google/evcxr"; license = licenses.asl20; diff --git a/pkgs/development/interpreters/falcon/default.nix b/pkgs/development/interpreters/falcon/default.nix index 39d4918a70b..0d2aa0b6420 100644 --- a/pkgs/development/interpreters/falcon/default.nix +++ b/pkgs/development/interpreters/falcon/default.nix @@ -1,23 +1,27 @@ -{ stdenv, fetchFromGitHub, cmake, pkgconfig, pcre, zlib, sqlite }: +{ lib, gccStdenv, fetchFromGitHub, cmake, pkg-config, pcre, zlib, sqlite }: -stdenv.mkDerivation { +gccStdenv.mkDerivation { pname = "falcon"; - version = "2013-09-19"; + version = "unstable-2018-10-23"; src = fetchFromGitHub { owner = "falconpl"; repo = "falcon"; - rev = "095141903c4ebab928ce803055f9bda363215c37"; - sha256 = "1x3gdcz1gqhi060ngqi0ghryf69v8bn50yrbzfad8bhblvhzzdlf"; + rev = "637e2d5cd950a874496042993c02ab7d17c1b688"; + sha256 = "iCyvvZJjXb1CR396EJ6GiP6d4e7iAc6QQlAOQoAfehg="; }; - nativeBuildInputs = [ pkgconfig ]; - buildInputs = [ cmake pcre zlib sqlite ]; + # -Wnarrowing is enabled by default in recent GCC versions, + # causing compilation to fail. + NIX_CFLAGS_COMPILE = "-Wno-narrowing"; - meta = with stdenv.lib; { + nativeBuildInputs = [ cmake pkg-config ]; + buildInputs = [ pcre zlib sqlite ]; + + meta = with lib; { description = "Programming language with macros and syntax at once"; - license = licenses.gpl2; + license = licenses.gpl2Only; maintainers = with maintainers; [ pSub ]; - platforms = with platforms; linux; + platforms = with platforms; unix; }; } diff --git a/pkgs/development/interpreters/gauche/boot.nix b/pkgs/development/interpreters/gauche/boot.nix new file mode 100644 index 00000000000..7fbc66406e6 --- /dev/null +++ b/pkgs/development/interpreters/gauche/boot.nix @@ -0,0 +1,43 @@ +{ stdenv, lib, fetchurl, pkg-config, texinfo, libiconv, gdbm, openssl, zlib +, mbedtls, cacert }: + +stdenv.mkDerivation rec { + pname = "gauche-bootstrap"; + version = "0.9.9"; + + src = fetchurl { + url = "mirror://sourceforge/gauche/Gauche-${version}.tgz"; + sha256 = "1yzpszhw52vkpr65r5d4khf3489mnnvnw58dd2wsvvx7499k5aac"; + }; + + nativeBuildInputs = [ pkg-config 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 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/pkgs/development/interpreters/gauche/default.nix b/pkgs/development/interpreters/gauche/default.nix index 58653fae890..86dc7d666d2 100644 --- a/pkgs/development/interpreters/gauche/default.nix +++ b/pkgs/development/interpreters/gauche/default.nix @@ -1,20 +1,25 @@ -{ stdenv, fetchurl, pkgconfig, texinfo, libiconv, gdbm, openssl, zlib -, mbedtls, cacert -}: +{ stdenv, lib, fetchFromGitHub, autoreconfHook, gaucheBootstrap, pkg-config, texinfo +, libiconv, gdbm, openssl, zlib, mbedtls, cacert }: stdenv.mkDerivation rec { pname = "gauche"; - version = "0.9.9"; + version = "0.9.10"; - src = fetchurl { - url = "mirror://sourceforge/gauche/Gauche-${version}.tgz"; - sha256 = "1yzpszhw52vkpr65r5d4khf3489mnnvnw58dd2wsvvx7499k5aac"; + src = fetchFromGitHub { + owner = "shirok"; + repo = pname; + rev = "release${lib.replaceChars [ "." ] [ "_" ] version}"; + sha256 = "0ki1w7sa10ivmg51sqjskby0gsznb0d3738nz80x589033km5hmb"; }; - nativeBuildInputs = [ pkgconfig texinfo ]; + nativeBuildInputs = [ gaucheBootstrap pkg-config texinfo autoreconfHook ]; buildInputs = [ libiconv gdbm openssl zlib mbedtls cacert ]; + autoreconfPhase = '' + ./DIST gen + ''; + postPatch = '' patchShebangs . ''; @@ -34,11 +39,12 @@ stdenv.mkDerivation rec { # TODO: Fix tests that fail in sandbox build doCheck = false; - meta = with stdenv.lib; { + meta = with lib; { description = "R7RS Scheme scripting engine"; homepage = "https://practical-scheme.net/gauche/"; maintainers = with maintainers; [ mnacamura ]; license = licenses.bsd3; platforms = platforms.unix; + broken = stdenv.isDarwin; }; } diff --git a/pkgs/development/interpreters/gnu-apl/default.nix b/pkgs/development/interpreters/gnu-apl/default.nix index f01cfc2444b..0f666dd9af5 100644 --- a/pkgs/development/interpreters/gnu-apl/default.nix +++ b/pkgs/development/interpreters/gnu-apl/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, readline, gettext, ncurses }: +{ lib, stdenv, fetchurl, readline, gettext, ncurses }: stdenv.mkDerivation rec { pname = "gnu-apl"; @@ -12,14 +12,16 @@ stdenv.mkDerivation rec { buildInputs = [ readline gettext ncurses ]; # Needed with GCC 8 - NIX_CFLAGS_COMPILE = with stdenv.lib; toString ((optionals stdenv.cc.isGNU [ + NIX_CFLAGS_COMPILE = with lib; toString ((optionals stdenv.cc.isGNU [ "-Wno-error=int-in-bool-context" "-Wno-error=class-memaccess" "-Wno-error=restrict" "-Wno-error=format-truncation" + # Needed with GCC 10 + "-Wno-error=maybe-uninitialized" ]) ++ optional stdenv.cc.isClang "-Wno-error=null-dereference"); - patchPhase = stdenv.lib.optionalString stdenv.isDarwin '' + patchPhase = lib.optionalString stdenv.isDarwin '' substituteInPlace src/LApack.cc --replace "malloc.h" "malloc/malloc.h" ''; @@ -28,13 +30,13 @@ stdenv.mkDerivation rec { find $out/share/doc/support-files -name 'Makefile*' -delete ''; - meta = with stdenv.lib; { + meta = with 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; + mainProgram = "apl"; longDescription = '' GNU APL is a free interpreter for the programming language APL, with an diff --git a/pkgs/development/interpreters/groovy/default.nix b/pkgs/development/interpreters/groovy/default.nix index 97e997bdd69..9d2b9a8f038 100644 --- a/pkgs/development/interpreters/groovy/default.nix +++ b/pkgs/development/interpreters/groovy/default.nix @@ -1,17 +1,17 @@ -{ stdenv, fetchurl, unzip, which, makeWrapper, jdk }: +{ lib, stdenv, fetchurl, unzip, which, makeWrapper, jdk }: # at runtime, need jdk stdenv.mkDerivation rec { pname = "groovy"; - version = "3.0.3"; + version = "3.0.7"; src = fetchurl { url = "http://dl.bintray.com/groovy/maven/apache-groovy-binary-${version}.zip"; - sha256 = "0xdm70b61pdj8z3g08az16y9b6cpz5hv7iwvwfyfyxrjdi47h419"; + sha256 = "1xdpjqx7qaq0syw448b32q36g12pgh1hn6knyqi3k5isp0f09qmr"; }; - buildInputs = [ unzip makeWrapper ]; + nativeBuildInputs = [ makeWrapper unzip ]; installPhase = '' mkdir -p $out @@ -29,7 +29,7 @@ stdenv.mkDerivation rec { done ''; - meta = with stdenv.lib; { + meta = with lib; { description = "An agile dynamic language for the Java Platform"; homepage = "http://groovy-lang.org/"; license = licenses.asl20; diff --git a/pkgs/development/interpreters/gtk-server/default.nix b/pkgs/development/interpreters/gtk-server/default.nix index 4a8330f2749..3841785e8ac 100644 --- a/pkgs/development/interpreters/gtk-server/default.nix +++ b/pkgs/development/interpreters/gtk-server/default.nix @@ -1,8 +1,8 @@ -{ stdenv, fetchurl +{ lib, stdenv, fetchurl , glib , gtk3 , libffcall -, pkgconfig +, pkg-config , wrapGAppsHook }: @@ -19,12 +19,12 @@ stdenv.mkDerivation rec { cd src ''; - nativeBuildInputs = [ pkgconfig wrapGAppsHook ]; + nativeBuildInputs = [ pkg-config wrapGAppsHook ]; buildInputs = [ libffcall glib gtk3 ]; configureOptions = [ "--with-gtk3" ]; - meta = with stdenv.lib; { + meta = with lib; { description = "gtk-server for interpreted GUI programming"; homepage = "http://www.gtk-server.org/"; license = licenses.gpl2Plus; diff --git a/pkgs/development/interpreters/guile/1.8.nix b/pkgs/development/interpreters/guile/1.8.nix index 6057480476f..6277312acc8 100644 --- a/pkgs/development/interpreters/guile/1.8.nix +++ b/pkgs/development/interpreters/guile/1.8.nix @@ -1,5 +1,5 @@ -{ stdenv, pkgsBuildBuild, buildPackages -, fetchurl, makeWrapper, gawk, pkgconfig +{ lib, stdenv, pkgsBuildBuild, buildPackages +, fetchurl, makeWrapper, gawk, pkg-config , libtool, readline, gmp }: @@ -18,13 +18,13 @@ stdenv.mkDerivation rec { 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) + ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--with-threads=no"; depsBuildBuild = [ buildPackages.stdenv.cc ] - ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) pkgsBuildBuild.guile_1_8; - nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; + nativeBuildInputs = [ makeWrapper gawk pkg-config ]; buildInputs = [ readline libtool ]; propagatedBuildInputs = [ @@ -37,7 +37,10 @@ stdenv.mkDerivation rec { libtool ]; - patches = [ ./cpp-4.5.patch ]; + patches = [ + ./cpp-4.5.patch + ./CVE-2016-8605.patch + ]; preBuild = '' sed -e '/lt_dlinit/a lt_dladdsearchdir("'$out/lib'");' -i libguile/dynl.c @@ -67,9 +70,9 @@ stdenv.mkDerivation rec { 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; + license = lib.licenses.lgpl2Plus; + maintainers = [ lib.maintainers.ludo ]; + platforms = lib.platforms.unix; longDescription = '' GNU Guile is an interpreter for the Scheme programming language, diff --git a/pkgs/development/interpreters/guile/2.0.nix b/pkgs/development/interpreters/guile/2.0.nix index 5b26b38dbd4..b93ec556cd4 100644 --- a/pkgs/development/interpreters/guile/2.0.nix +++ b/pkgs/development/interpreters/guile/2.0.nix @@ -1,5 +1,5 @@ -{ stdenv, pkgsBuildBuild, buildPackages -, fetchpatch, fetchurl, makeWrapper, gawk, pkgconfig +{ lib, stdenv, pkgsBuildBuild, buildPackages +, fetchpatch, fetchurl, makeWrapper, gawk, pkg-config , libffi, libtool, readline, gmp, boehmgc, libunistring , coverageAnalysis ? null }: @@ -21,9 +21,9 @@ setOutputFlags = false; # $dev gets into the library otherwise depsBuildBuild = [ buildPackages.stdenv.cc ] - ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) pkgsBuildBuild.guile_2_0; - nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; + nativeBuildInputs = [ makeWrapper gawk pkg-config ]; buildInputs = [ readline libtool libunistring libffi ]; propagatedBuildInputs = [ @@ -46,8 +46,8 @@ }) ./riscv.patch ] ++ - (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch) - ++ stdenv.lib.optionals stdenv.isDarwin [ + (lib.optional (coverageAnalysis != null) ./gcov-file-name.patch) + ++ lib.optionals stdenv.isDarwin [ (fetchpatch { url = "https://gitlab.gnome.org/GNOME/gtk-osx/raw/52898977f165777ad9ef169f7d4818f2d4c9b731/patches/guile-clocktime.patch"; sha256 = "12wvwdna9j8795x59ldryv9d84c1j3qdk2iskw09306idfsis207"; @@ -59,10 +59,10 @@ # "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"; + LDFLAGS = lib.optionalString (!stdenv.isDarwin && !stdenv.hostPlatform.isMusl) "-lgcc_s"; configureFlags = [ "--with-libreadline-prefix" ] - ++ stdenv.lib.optionals stdenv.isSunOS [ + ++ 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> @@ -102,9 +102,9 @@ 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; + license = lib.licenses.lgpl3Plus; + maintainers = with lib.maintainers; [ ludo lovek323 ]; + platforms = lib.platforms.all; longDescription = '' GNU Guile is an implementation of the Scheme programming language, with @@ -120,7 +120,7 @@ // -(stdenv.lib.optionalAttrs (!stdenv.isLinux) { +(lib.optionalAttrs (!stdenv.isLinux) { # Work around <https://bugs.gnu.org/14201>. SHELL = stdenv.shell; CONFIG_SHELL = stdenv.shell; diff --git a/pkgs/development/interpreters/guile/CVE-2016-8605.patch b/pkgs/development/interpreters/guile/CVE-2016-8605.patch new file mode 100644 index 00000000000..2fc281357ca --- /dev/null +++ b/pkgs/development/interpreters/guile/CVE-2016-8605.patch @@ -0,0 +1,59 @@ +commit d514e3fc42eb14a1bc5846b27ef89f50ba3a5d48 +Author: Ludovic Courtès <ludo@gnu.org> +Date: Tue Oct 11 10:14:26 2016 +0200 + + Remove 'umask' calls from 'mkdir'. + + Fixes <http://bugs.gnu.org/24659>. + + * libguile/filesys.c (SCM_DEFINE): Remove calls to 'umask' when MODE is + unbound; instead, use 0777 as the mode. Update docstring to clarify + this. + +diff --git a/libguile/filesys.c b/libguile/filesys.c +index c8acb13ef..921f765f1 100644 +--- a/libguile/filesys.c ++++ b/libguile/filesys.c +@@ -1,4 +1,5 @@ +-/* Copyright (C) 1996,1997,1998,1999,2000,2001, 2002, 2004, 2006, 2008 Free Software Foundation, Inc. ++/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006, ++ * 2009, 2010, 2011, 2012, 2013, 2014, 2016 Free Software Foundation, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public +@@ -791,26 +792,21 @@ SCM_DEFINE (scm_delete_file, "delete-file", 1, 0, 0, + SCM_DEFINE (scm_mkdir, "mkdir", 1, 1, 0, + (SCM path, SCM mode), + "Create a new directory named by @var{path}. If @var{mode} is omitted\n" +- "then the permissions of the directory file are set using the current\n" +- "umask. Otherwise they are set to the decimal value specified with\n" +- "@var{mode}. The return value is unspecified.") ++ "then the permissions of the directory are set to @code{#o777}\n" ++ "masked with the current umask (@pxref{Processes, @code{umask}}).\n" ++ "Otherwise they are set to the value specified with @var{mode}.\n" ++ "The return value is unspecified.") + #define FUNC_NAME s_scm_mkdir + { + int rv; +- mode_t mask; ++ mode_t c_mode; + +- if (SCM_UNBNDP (mode)) +- { +- mask = umask (0); +- umask (mask); +- STRING_SYSCALL (path, c_path, rv = mkdir (c_path, 0777 ^ mask)); +- } +- else +- { +- STRING_SYSCALL (path, c_path, rv = mkdir (c_path, scm_to_uint (mode))); +- } ++ c_mode = SCM_UNBNDP (mode) ? 0777 : scm_to_uint (mode); ++ ++ STRING_SYSCALL (path, c_path, rv = mkdir (c_path, c_mode)); + if (rv != 0) + SCM_SYSERROR; ++ + return SCM_UNSPECIFIED; + } + #undef FUNC_NAME diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix index 68df200835f..ed685682db6 100644 --- a/pkgs/development/interpreters/guile/default.nix +++ b/pkgs/development/interpreters/guile/default.nix @@ -1,5 +1,5 @@ -{ stdenv, pkgsBuildBuild, buildPackages -, fetchurl, makeWrapper, gawk, pkgconfig +{ lib, stdenv, pkgsBuildBuild, buildPackages +, fetchurl, makeWrapper, gawk, pkg-config , libffi, libtool, readline, gmp, boehmgc, libunistring , coverageAnalysis ? null , fetchpatch @@ -23,9 +23,9 @@ setOutputFlags = false; # $dev gets into the library otherwise depsBuildBuild = [ buildPackages.stdenv.cc ] - ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) pkgsBuildBuild.guile; - nativeBuildInputs = [ makeWrapper gawk pkgconfig ]; + nativeBuildInputs = [ makeWrapper gawk pkg-config ]; buildInputs = [ readline libtool libunistring libffi ]; propagatedBuildInputs = [ @@ -38,12 +38,18 @@ libtool libunistring ]; - enableParallelBuilding = true; + # According to Bernhard M. Wiedemann <bwiedemann suse de> on + # #reproducible-builds on irc.oftc.net, (2020-01-29): they had to + # build Guile without parallel builds to make it reproducible. + # + # re: https://issues.guix.gnu.org/issue/20272 + # re: https://build.opensuse.org/request/show/732638 + enableParallelBuilding = false; patches = [ ./eai_system.patch - ] ++ stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch - ++ stdenv.lib.optional stdenv.isDarwin (fetchpatch { + ] ++ lib.optional (coverageAnalysis != null) ./gcov-file-name.patch + ++ lib.optional stdenv.isDarwin (fetchpatch { url = "https://gitlab.gnome.org/GNOME/gtk-osx/raw/52898977f165777ad9ef169f7d4818f2d4c9b731/patches/guile-clocktime.patch"; sha256 = "12wvwdna9j8795x59ldryv9d84c1j3qdk2iskw09306idfsis207"; }); @@ -52,10 +58,11 @@ # "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"; + LDFLAGS = lib.optionalString + (!stdenv.isDarwin && !stdenv.hostPlatform.isStatic) "-lgcc_s"; configureFlags = [ "--with-libreadline-prefix=${readline.dev}" ] - ++ stdenv.lib.optionals stdenv.isSunOS [ + ++ 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> @@ -94,9 +101,9 @@ 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; + license = lib.licenses.lgpl3Plus; + maintainers = with lib.maintainers; [ ludo lovek323 vrthra ]; + platforms = lib.platforms.all; longDescription = '' GNU Guile is an implementation of the Scheme programming language, with @@ -109,4 +116,3 @@ ''; }; }) - diff --git a/pkgs/development/interpreters/guile/setup-hook-2.0.sh b/pkgs/development/interpreters/guile/setup-hook-2.0.sh index 6bb3910aaff..288f7e242f9 100644 --- a/pkgs/development/interpreters/guile/setup-hook-2.0.sh +++ b/pkgs/development/interpreters/guile/setup-hook-2.0.sh @@ -8,6 +8,16 @@ addGuileLibPath () { 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 + + if test -d "$1/lib/guile/2.0/ccache" + then + export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH-}${GUILE_LOAD_COMPILED_PATH:+:}$1/lib/guile/2.0/ccache" + fi + + if test -d "$1/lib/guile/2.0/site-ccache" + then + export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH-}${GUILE_LOAD_COMPILED_PATH:+:}$1/lib/guile/2.0/site-ccache" + fi } addEnvHooks "$hostOffset" addGuileLibPath diff --git a/pkgs/development/interpreters/guile/setup-hook-2.2.sh b/pkgs/development/interpreters/guile/setup-hook-2.2.sh index 4b3541fcc7f..1430dbe0720 100644 --- a/pkgs/development/interpreters/guile/setup-hook-2.2.sh +++ b/pkgs/development/interpreters/guile/setup-hook-2.2.sh @@ -8,6 +8,16 @@ addGuileLibPath () { 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 + + if test -d "$1/lib/guile/2.2/ccache" + then + export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH-}${GUILE_LOAD_COMPILED_PATH:+:}$1/lib/guile/2.2/ccache" + fi + + if test -d "$1/lib/guile/2.2/site-ccache" + then + export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH-}${GUILE_LOAD_COMPILED_PATH:+:}$1/lib/guile/2.2/site-ccache" + fi } addEnvHooks "$hostOffset" addGuileLibPath diff --git a/pkgs/development/interpreters/hugs/default.nix b/pkgs/development/interpreters/hugs/default.nix index 35463b16157..b903ab425c6 100644 --- a/pkgs/development/interpreters/hugs/default.nix +++ b/pkgs/development/interpreters/hugs/default.nix @@ -1,11 +1,11 @@ -{ stdenv, fetchurl, bison }: +{ lib, stdenv, fetchurl, bison }: -stdenv.mkDerivation { - - name = "hugs98-200609"; +stdenv.mkDerivation rec { + pname = "hugs98"; + version = "2006-09"; src = fetchurl { - url = "http://cvs.haskell.org/Hugs/downloads/2006-09/hugs98-Sep2006.tar.gz"; + url = "https://www.haskell.org/hugs/downloads/${version}/hugs98-Sep2006.tar.gz"; sha256 = "1dj65c39zpy6qqvvrwns2hzj6ipnd4ih655xj7kgyk2nfdvd5x1w"; }; @@ -39,7 +39,7 @@ stdenv.mkDerivation { "--enable-pthreads" # build Hugs using POSIX threads C library ]; - meta = with stdenv.lib; { + meta = with lib; { homepage = "https://www.haskell.org/hugs"; description = "Haskell interpreter"; maintainers = with maintainers; [ joachifm ]; diff --git a/pkgs/development/interpreters/hy/builder.nix b/pkgs/development/interpreters/hy/builder.nix new file mode 100644 index 00000000000..6757f859ac1 --- /dev/null +++ b/pkgs/development/interpreters/hy/builder.nix @@ -0,0 +1,40 @@ +{ lib +, python3Packages +, hyDefinedPythonPackages /* Packages like with python.withPackages */ +, ... +}: +python3Packages.buildPythonApplication rec { + pname = "hy"; + version = "1.0a1"; + + src = python3Packages.fetchPypi { + inherit pname version; + sha256 = "sha256-lCrbvbkeutSNmvvn/eHpTnJwPb5aEH7hWTXYSE+AJmU="; + }; + + checkInputs = with python3Packages; [ flake8 pytest ]; + + propagatedBuildInputs = with python3Packages; [ + appdirs + astor + clint + colorama + fastentrypoints + funcparserlib + rply + pygments + ] ++ (hyDefinedPythonPackages python3Packages); + + # Hy does not include tests in the source distribution from PyPI, so only test executable. + checkPhase = '' + $out/bin/hy --help > /dev/null + ''; + + meta = with lib; { + description = "A LISP dialect embedded in Python"; + homepage = "https://hylang.org/"; + license = licenses.mit; + maintainers = with maintainers; [ nixy mazurel ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/development/interpreters/hy/default.nix b/pkgs/development/interpreters/hy/default.nix index a8890b048fb..f5d80c11d71 100644 --- a/pkgs/development/interpreters/hy/default.nix +++ b/pkgs/development/interpreters/hy/default.nix @@ -1,37 +1,15 @@ -{ 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; - }; +{ lib +, callPackage +, hyDefinedPythonPackages ? python-packages: [] /* Packages like with python.withPackages */ +}: +let + withPackages = ( + python-packages: callPackage ./builder.nix { + hyDefinedPythonPackages = python-packages; + } + ); +in +(withPackages hyDefinedPythonPackages) // { + # Export withPackages function for hy customization + inherit withPackages; } diff --git a/pkgs/development/interpreters/icon-lang/default.nix b/pkgs/development/interpreters/icon-lang/default.nix index d85448a9677..5481f7825c9 100644 --- a/pkgs/development/interpreters/icon-lang/default.nix +++ b/pkgs/development/interpreters/icon-lang/default.nix @@ -1,45 +1,46 @@ -{ stdenv, fetchFromGitHub, fetchpatch, libX11, libXt, withGraphics ? true }: +{ lib, stdenv +, fetchFromGitHub +, libX11 +, libXt +, withGraphics ? true +}: stdenv.mkDerivation rec { pname = "icon-lang"; - version = "9.5.1"; + version = "unstable-2020-02-05"; src = fetchFromGitHub { owner = "gtownsend"; repo = "icon"; - rev = "rel${builtins.replaceStrings ["."] [""] version}"; - sha256 = "1gkvj678ldlr1m5kjhx6zpmq11nls8kxa7pyy64whgakfzrypynw"; + rev = "829cff33de4a21546fb269de3ef5acd7b4f0c0c7"; + sha256 = "1lj2f13pbaajcy4v3744bz46rghhw5sv4dwwfnzhsllbj5gnjsv2"; }; - 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" - ]; - }) - ]; + buildInputs = lib.optionals withGraphics [ libX11 libXt ]; configurePhase = let - _name = if stdenv.isDarwin then "macintosh" else "linux"; + target = if withGraphics then "X-Configure" else "Configure"; + platform = + if stdenv.isLinux then "linux" + else if stdenv.isDarwin then "macintosh" + else if stdenv.isBSD then "bsd" + else if stdenv.isCygwin then "cygwin" + else if stdenv.isSunOS then "solaris" + else throw "unsupported system"; in - '' - make ${stdenv.lib.optionalString withGraphics "X-"}Configure name=${_name} - ''; + "make ${target} name=${platform}"; installPhase = '' make Install dest=$out + rm $out/README + mkdir -p $out/share/doc + mv $out/doc $out/share/doc/icon ''; - meta = with stdenv.lib; { - description = ''A very high level general-purpose programming language''; + meta = with lib; { + description = "A very high level general-purpose programming language"; maintainers = with maintainers; [ vrthra yurrriq ]; - platforms = with platforms; linux ++ darwin; + platforms = with platforms; linux ++ darwin ++ freebsd ++ netbsd ++ openbsd ++ cygwin ++ illumos; license = licenses.publicDomain; homepage = "https://www.cs.arizona.edu/icon/"; }; diff --git a/pkgs/development/interpreters/io/default.nix b/pkgs/development/interpreters/io/default.nix index 42af3cc427b..48462a333bc 100644 --- a/pkgs/development/interpreters/io/default.nix +++ b/pkgs/development/interpreters/io/default.nix @@ -1,18 +1,27 @@ -{ stdenv, fetchFromGitHub, cmake, zlib, sqlite, gmp, libffi, cairo, +{ lib, stdenv, fetchFromGitHub, fetchpatch, 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 + python3, openssl, glfw, pkg-config, libpthreadstubs, libXdmcp, libmemcached }: stdenv.mkDerivation { - name = "io-2015.11.11"; + pname = "io"; + version = "2017.09.06"; src = fetchFromGitHub { owner = "stevedekorte"; repo = "io"; - rev = "1fc725e0a8635e2679cbb20521f4334c25273caa"; - sha256 = "0ll2kd72zy8vf29sy0nnx3awk7nywpwpv21rvninjjaqkygrc0qw"; + rev = "b8a18fc199758ed09cd2f199a9bc821f6821072a"; + sha256 = "07rg1zrz6i6ghp11cm14w7bbaaa1s8sb0y5i7gr2sds0ijlpq223"; }; + patches = [ + (fetchpatch { + name = "check-for-sysctl-h.patch"; + url = "https://github.com/IoLanguage/io/pull/446/commits/9f3e4d87b6d4c1bf583134d55d1cf92d3464c49f.patch"; + sha256 = "9f06073ac17f26c2ef6298143bdd1babe7783c228f9667622aa6c91bb7ec7fa0"; + }) + ]; + nativeBuildInputs = [ cmake ]; @@ -21,7 +30,7 @@ stdenv.mkDerivation { 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 + pkg-config glfw openssl libpthreadstubs libXdmcp libmemcached python3 ]; @@ -32,12 +41,23 @@ stdenv.mkDerivation { sed -ie \ "s/add_subdirectory(addons)/#add_subdirectory(addons)/g" \ CMakeLists.txt + # Bind Libs STATIC to avoid a segfault when relinking + sed -i 's/basekit SHARED/basekit STATIC/' libs/basekit/CMakeLists.txt + sed -i 's/garbagecollector SHARED/garbagecollector STATIC/' libs/garbagecollector/CMakeLists.txt + sed -i 's/coroutine SHARED/coroutine STATIC/' libs/coroutine/CMakeLists.txt + ''; + + doInstallCheck = true; + + installCheckPhase = '' + $out/bin/io + $out/bin/io_static ''; # for gcc5; c11 inline semantics breaks the build NIX_CFLAGS_COMPILE = "-fgnu89-inline"; - meta = with stdenv.lib; { + meta = with lib; { description = "Io programming language"; homepage = "http://iolanguage.org/"; license = licenses.bsd3; diff --git a/pkgs/development/interpreters/j/default.nix b/pkgs/development/interpreters/j/default.nix index 8e6b434281e..e41d71ef960 100644 --- a/pkgs/development/interpreters/j/default.nix +++ b/pkgs/development/interpreters/j/default.nix @@ -1,16 +1,16 @@ -{ stdenv, fetchFromGitHub, readline, libedit, bc -, avxSupport ? false +{ lib, stdenv, fetchFromGitHub, readline, libedit, bc +, avxSupport ? stdenv.hostPlatform.avxSupport }: stdenv.mkDerivation rec { pname = "j"; - version = "901"; - jtype = "release-e"; + version = "902"; + jtype = "release-b"; src = fetchFromGitHub { owner = "jsoftware"; repo = "jsource"; rev = "j${version}-${jtype}"; - sha256 = "13ky37rrl6mc66fckrdnrw64gmvq1qlv6skzd513lab4d0wigshw"; + sha256 = "0j67vgikqflwjqacsdicasvyv1k54s2c8vjgwmf0ix7l41p4xqz0"; name = "jsource"; }; @@ -27,6 +27,13 @@ stdenv.mkDerivation rec { doCheck = true; + # Causes build failure due to warning + hardeningDisable = lib.optional stdenv.cc.isClang "strictoverflow"; + + # Causes build failure due to warning + # https://github.com/jsoftware/jsource/issues/16 + NIX_CFLAGS_COMPILE = "-Wno-error=return-local-addr"; + buildPhase = '' export SOURCE_DIR=$(pwd) export HOME=$TMPDIR @@ -65,7 +72,7 @@ stdenv.mkDerivation rec { cp -r $JLIB/bin "$out" ''; - meta = with stdenv.lib; { + meta = with lib; { description = "J programming language, an ASCII-based APL successor"; maintainers = with maintainers; [ raskin synthetica ]; platforms = with platforms; linux ++ darwin; diff --git a/pkgs/development/interpreters/janet/default.nix b/pkgs/development/interpreters/janet/default.nix index 52d0b371915..35631174e26 100644 --- a/pkgs/development/interpreters/janet/default.nix +++ b/pkgs/development/interpreters/janet/default.nix @@ -1,26 +1,39 @@ -{ stdenv, fetchFromGitHub, meson, ninja }: +{ lib, stdenv, fetchFromGitHub, meson, ninja }: stdenv.mkDerivation rec { pname = "janet"; - version = "1.10.1"; + version = "1.16.1"; src = fetchFromGitHub { owner = "janet-lang"; repo = pname; rev = "v${version}"; - sha256 = "18k6dzxzr149p0bby4r0z6kybylig87rwj7gk3z6a98zf6k4xmsw"; + sha256 = "sha256-TzJbHmHIySlf3asQ02HOdehMR+s0KkPifBiaQ4FvFCg="; }; + # we don't have /usr/bin/env in the sandbox, so substitute for a proper, + # absolute path to janet + postPatch = '' + substituteInPlace jpm \ + --replace '/usr/bin/env janet' $out/bin/janet \ + --replace /usr/local/lib/janet $out/lib \ + --replace /usr/local $out + + substituteInPlace janet.1 \ + --replace /usr/local/lib/janet $out/lib + ''; + nativeBuildInputs = [ meson ninja ]; + mesonFlags = [ "-Dgit_hash=release" ]; doCheck = true; - meta = with stdenv.lib; { + meta = with lib; { description = "Janet programming language"; homepage = "https://janet-lang.org/"; license = licenses.mit; + maintainers = with maintainers; [ andrewchambers peterhoeg ]; platforms = platforms.all; - maintainers = with maintainers; [ andrewchambers ]; }; } diff --git a/pkgs/development/interpreters/jimtcl/default.nix b/pkgs/development/interpreters/jimtcl/default.nix index d803fe43fd7..78b9e40b647 100644 --- a/pkgs/development/interpreters/jimtcl/default.nix +++ b/pkgs/development/interpreters/jimtcl/default.nix @@ -1,7 +1,7 @@ -{ stdenv, fetchFromGitHub, sqlite, readline, asciidoc, SDL, SDL_gfx }: +{ lib, stdenv, fetchFromGitHub, sqlite, readline, asciidoc, SDL, SDL_gfx }: let - makeSDLFlags = map (p: "-I${stdenv.lib.getDev p}/include/SDL"); + makeSDLFlags = map (p: "-I${lib.getDev p}/include/SDL"); in stdenv.mkDerivation rec { pname = "jimtcl"; @@ -52,8 +52,8 @@ in stdenv.mkDerivation rec { 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 ]; + license = lib.licenses.bsd2; + platforms = lib.platforms.all; + maintainers = with lib.maintainers; [ dbohdan vrthra ]; }; } diff --git a/pkgs/development/interpreters/joker/default.nix b/pkgs/development/interpreters/joker/default.nix index 7f773882d8f..8a2130050bf 100644 --- a/pkgs/development/interpreters/joker/default.nix +++ b/pkgs/development/interpreters/joker/default.nix @@ -1,17 +1,17 @@ -{ stdenv, buildGoModule, fetchFromGitHub }: +{ lib, buildGoModule, fetchFromGitHub }: buildGoModule rec { pname = "joker"; - version = "0.15.6"; + version = "0.17.1"; src = fetchFromGitHub { rev = "v${version}"; owner = "candid82"; repo = "joker"; - sha256 = "1yi9q8ibia6gz6s30i3bjrbmlhj6knrb3d73113dxrs8abi1mkbh"; + sha256 = "sha256-3OimYXcQ3KPav44sClbC60220/YK4Jhq+l5UfRFYoJI="; }; - vendorSha256 = "031ban30kx84r54fj9aq96pwkz9nqh4p9yzs4l8i1wqmy52rldvl"; + vendorSha256 = "sha256-AYoespfzFLP/jIIxbw5K653wc7sSfLY8K7di8GZ64wA="; doCheck = false; @@ -21,7 +21,7 @@ buildGoModule rec { subPackages = [ "." ]; - meta = with stdenv.lib; { + meta = with lib; { homepage = "https://github.com/candid82/joker"; description = "A small Clojure interpreter and linter written in Go"; license = licenses.epl10; diff --git a/pkgs/development/interpreters/jruby/default.nix b/pkgs/development/interpreters/jruby/default.nix index e4511da498c..68724a55b98 100644 --- a/pkgs/development/interpreters/jruby/default.nix +++ b/pkgs/development/interpreters/jruby/default.nix @@ -1,4 +1,4 @@ -{ stdenv, callPackage, fetchurl, makeWrapper, jre }: +{ lib, stdenv, callPackage, fetchurl, makeWrapper, jre }: let # The version number here is whatever is reported by the RUBY_VERSION string @@ -6,14 +6,14 @@ rubyVersion = callPackage ../ruby/ruby-version.nix {} "2" "5" "7" ""; jruby = stdenv.mkDerivation rec { pname = "jruby"; - version = "9.2.13.0"; + version = "9.2.19.0"; src = fetchurl { url = "https://s3.amazonaws.com/jruby.org/downloads/${version}/jruby-bin-${version}.tar.gz"; - sha256 = "0n5glz6xm3skrfihzn3g5awdxpjsqn2k8k46gv449rk2l50w5a3k"; + sha256 = "sha256-H3SIWi0/pYn8vrKSo5+s9/hr4+rBqwFeMsZdMqzz878="; }; - buildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; installPhase = '' mkdir -pv $out/docs @@ -23,7 +23,7 @@ jruby = stdenv.mkDerivation rec { for i in $out/bin/jruby{,.bash}; do wrapProgram $i \ - --set JAVA_HOME ${jre} + --set JAVA_HOME ${jre.home} done ln -s $out/bin/jruby $out/bin/ruby @@ -40,13 +40,17 @@ jruby = stdenv.mkDerivation rec { 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; { + meta = with lib; { description = "Ruby interpreter written in Java"; homepage = "http://jruby.org/"; license = with licenses; [ cpl10 gpl2 lgpl21 ]; diff --git a/pkgs/development/interpreters/jython/default.nix b/pkgs/development/interpreters/jython/default.nix index 35af365c1f7..38b599d339e 100644 --- a/pkgs/development/interpreters/jython/default.nix +++ b/pkgs/development/interpreters/jython/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, makeWrapper, jre }: +{ lib, stdenv, fetchurl, makeWrapper, jre }: stdenv.mkDerivation rec { pname = "jython"; @@ -10,7 +10,7 @@ stdenv.mkDerivation rec { sha256 = "142285hd9mx0nx5zw0jvkpqkb4kbhgyyy52p5bj061ya8bg5jizy"; }; - buildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; dontUnpack = true; @@ -23,7 +23,7 @@ stdenv.mkDerivation rec { meta = { description = "Python interpreter written in Java"; homepage = "https://jython.org/"; - license = stdenv.lib.licenses.psfl; + license = lib.licenses.psfl; platforms = jre.meta.platforms; }; } diff --git a/pkgs/development/interpreters/kona/default.nix b/pkgs/development/interpreters/kona/default.nix index 041616cc1f6..15ce9321a8d 100644 --- a/pkgs/development/interpreters/kona/default.nix +++ b/pkgs/development/interpreters/kona/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl }: +{ lib, stdenv, fetchurl }: stdenv.mkDerivation rec { pname = "kona"; @@ -11,7 +11,7 @@ stdenv.mkDerivation rec { makeFlags = [ "PREFIX=$(out)" ]; preInstall = ''mkdir -p "$out/bin"''; - meta = with stdenv.lib; { + meta = with lib; { description = "An interpreter of K, APL-like programming language"; homepage = "https://github.com/kevinlawler/kona/"; maintainers = with maintainers; [ raskin ]; diff --git a/pkgs/development/interpreters/lfe/fix-rebar-config.patch b/pkgs/development/interpreters/lfe/fix-rebar-config.patch new file mode 100644 index 00000000000..ac385351b1c --- /dev/null +++ b/pkgs/development/interpreters/lfe/fix-rebar-config.patch @@ -0,0 +1,29 @@ +diff --git a/rebar.config b/rebar.config +index 1d5a68e..a86ee39 100644 +--- a/rebar.config ++++ b/rebar.config +@@ -2,20 +2,20 @@ + + {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" +- " -o $REBAR_DEPS_DIR/lfe/test" ++ " -o test" + " test/*_SUITE.lfe"}, + {"(linux|darwin|solaris|freebsd|netbsd|openbsd)", eunit, + "bin/lfe bin/lfec" +- " -o $REBAR_DEPS_DIR/lfe/ebin" ++ " -o ebin" + " test/clj-tests.lfe"}, + %% TODO: Test this on a win32 box + %% {"win32", ct, + %% "bin/lfe bin/lfec -o $REBAR_DEPS_DIR/lfe/test test/*_SUITE.lfe"} + {"(linux|darwin|solaris|freebsd|netbsd|openbsd)", app_compile, +- "bin/lfe bin/lfec -o $REBAR_DEPS_DIR/lfe/ebin src/*.lfe"} ++ "bin/lfe bin/lfec -o ebin src/*.lfe"} + %% TODO: equivalent win32 hook + ]}. diff --git a/pkgs/development/interpreters/lfe/generic-builder.nix b/pkgs/development/interpreters/lfe/generic-builder.nix index ba42c2d59d5..62056896745 100644 --- a/pkgs/development/interpreters/lfe/generic-builder.nix +++ b/pkgs/development/interpreters/lfe/generic-builder.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, erlang, makeWrapper, coreutils, bash, buildRebar3, buildHex }: +{ lib, fetchFromGitHub, erlang, makeWrapper, coreutils, bash, buildRebar3, buildHex }: { baseName ? "lfe" , version @@ -10,7 +10,7 @@ }: let - inherit (stdenv.lib) + inherit (lib) assertMsg makeBinPath optionalString getVersion versionAtLeast versionOlder versions; @@ -39,7 +39,7 @@ buildRebar3 { buildInputs = [ erlang makeWrapper ]; beamDeps = [ proper ]; - patches = [ ./no-test-deps.patch ./dedup-ebins.patch ] ++ patches; + patches = [ ./fix-rebar-config.patch ./dedup-ebins.patch ] ++ patches; doCheck = true; checkTarget = "travis"; @@ -75,7 +75,7 @@ buildRebar3 { done ''; - meta = with stdenv.lib; { + meta = with 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 @@ -87,7 +87,7 @@ buildRebar3 { downloadPage = "https://github.com/rvirding/lfe/releases"; license = licenses.asl20; - maintainers = with maintainers; [ yurrriq ankhers ]; + maintainers = teams.beam.members; platforms = platforms.unix; }; } diff --git a/pkgs/development/interpreters/lfe/no-test-deps.patch b/pkgs/development/interpreters/lfe/no-test-deps.patch deleted file mode 100644 index 8c3faf1ff40..00000000000 --- a/pkgs/development/interpreters/lfe/no-test-deps.patch +++ /dev/null @@ -1,13 +0,0 @@ -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/pkgs/development/interpreters/lolcode/default.nix b/pkgs/development/interpreters/lolcode/default.nix index bd4b93b835f..65653701b80 100644 --- a/pkgs/development/interpreters/lolcode/default.nix +++ b/pkgs/development/interpreters/lolcode/default.nix @@ -1,6 +1,6 @@ -{ stdenv, fetchurl, pkgconfig, doxygen, cmake, readline }: +{ lib, stdenv, fetchurl, pkg-config, doxygen, cmake, readline }: -with stdenv.lib; +with lib; stdenv.mkDerivation rec { pname = "lolcode"; @@ -11,7 +11,7 @@ stdenv.mkDerivation rec { sha256 = "1li7ikcrs7wqah7gqkirg0k61n6pm12w7pydin966x1sdn9na46b"; }; - nativeBuildInputs = [ pkgconfig cmake doxygen ]; + nativeBuildInputs = [ pkg-config cmake doxygen ]; buildInputs = [ readline ]; # Maybe it clashes with lci scientific logic software package... @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { ''; license = licenses.gpl3; maintainers = [ maintainers.AndersonTorres ]; - platforms = stdenv.lib.platforms.unix; + platforms = lib.platforms.unix; }; } diff --git a/pkgs/development/interpreters/love/0.10.nix b/pkgs/development/interpreters/love/0.10.nix index dbe3f6fa2df..ed002d99fbb 100644 --- a/pkgs/development/interpreters/love/0.10.nix +++ b/pkgs/development/interpreters/love/0.10.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromBitbucket, pkgconfig, SDL2, libGLU, libGL, openal, luajit, +{ lib, stdenv, fetchFromBitbucket, pkg-config, SDL2, libGLU, libGL, openal, luajit, libdevil, freetype, physfs, libmodplug, mpg123, libvorbis, libogg, libtheora, which, autoconf, automake, libtool }: @@ -17,7 +17,7 @@ stdenv.mkDerivation { sha256 = "19yfmlcx6w8yi4ndm5lni8lrsvnn77bxw5py0dc293nzzlaqa9ym"; }; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ SDL2 libGLU libGL openal luajit libdevil freetype physfs libmodplug mpg123 libvorbis libogg libtheora autoconf which libtool automake @@ -34,8 +34,8 @@ stdenv.mkDerivation { 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 ]; + license = lib.licenses.zlib; + platforms = lib.platforms.linux; + maintainers = [ lib.maintainers.raskin ]; }; } diff --git a/pkgs/development/interpreters/love/0.7.nix b/pkgs/development/interpreters/love/0.7.nix index 6f09c076441..6cba19bff0f 100644 --- a/pkgs/development/interpreters/love/0.7.nix +++ b/pkgs/development/interpreters/love/0.7.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, pkgconfig +{ lib, stdenv, fetchurl, pkg-config , SDL, libGLU, libGL, openal, lua , libdevil, freetype, physfs , libmodplug, mpg123, libvorbis, libogg @@ -15,7 +15,7 @@ stdenv.mkDerivation rec { # 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 ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ SDL libGLU libGL openal lua libdevil freetype physfs libmodplug mpg123 libvorbis libogg libmng @@ -48,9 +48,9 @@ stdenv.mkDerivation rec { meta = { homepage = "http://love2d.org"; description = "A Lua-based 2D game engine/scripting language"; - license = stdenv.lib.licenses.zlib; + license = lib.licenses.zlib; - platforms = stdenv.lib.platforms.linux; - maintainers = [ stdenv.lib.maintainers.raskin ]; + platforms = lib.platforms.linux; + maintainers = [ lib.maintainers.raskin ]; }; } diff --git a/pkgs/development/interpreters/love/0.8.nix b/pkgs/development/interpreters/love/0.8.nix index 3a6c385ee5f..8bad501170d 100644 --- a/pkgs/development/interpreters/love/0.8.nix +++ b/pkgs/development/interpreters/love/0.8.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, pkgconfig +{ lib, stdenv, fetchurl, pkg-config , SDL, libGLU, libGL, openal, lua , libdevil, freetype, physfs , libmodplug, mpg123, libvorbis, libogg @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { sha256 = "1k4fcsa8zzi04ja179bmj24hvqcbm3icfvrvrzyz2gw9qwfclrwi"; }; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ SDL libGLU libGL openal lua libdevil freetype physfs libmodplug mpg123 libvorbis libogg @@ -47,9 +47,9 @@ stdenv.mkDerivation rec { meta = { homepage = "http://love2d.org"; description = "A Lua-based 2D game engine/scripting language"; - license = stdenv.lib.licenses.zlib; + license = lib.licenses.zlib; - platforms = stdenv.lib.platforms.linux; - maintainers = [ stdenv.lib.maintainers.raskin ]; + platforms = lib.platforms.linux; + maintainers = [ lib.maintainers.raskin ]; }; } diff --git a/pkgs/development/interpreters/love/0.9.nix b/pkgs/development/interpreters/love/0.9.nix index 79b83f0643f..b7e20498a39 100644 --- a/pkgs/development/interpreters/love/0.9.nix +++ b/pkgs/development/interpreters/love/0.9.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, pkgconfig +{ lib, stdenv, fetchurl, pkg-config , SDL2, libGLU, libGL, openal, luajit , libdevil, freetype, physfs , libmodplug, mpg123, libvorbis, libogg @@ -11,7 +11,7 @@ stdenv.mkDerivation rec { sha256 = "1pikd0bzb44r4bf0jbgn78whz1yswpq1n5jc8nf87v42pm30kp84"; }; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ SDL2 libGLU libGL openal luajit libdevil freetype physfs libmodplug mpg123 libvorbis libogg @@ -26,10 +26,10 @@ stdenv.mkDerivation rec { meta = { homepage = "http://love2d.org"; description = "A Lua-based 2D game engine/scripting language"; - license = stdenv.lib.licenses.zlib; + license = lib.licenses.zlib; - platforms = stdenv.lib.platforms.linux; - maintainers = [ stdenv.lib.maintainers.raskin ]; + platforms = lib.platforms.linux; + maintainers = [ lib.maintainers.raskin ]; broken = true; }; } diff --git a/pkgs/development/interpreters/love/11.1.nix b/pkgs/development/interpreters/love/11.1.nix index 2ef3a4ca05a..bf76547a07a 100644 --- a/pkgs/development/interpreters/love/11.1.nix +++ b/pkgs/development/interpreters/love/11.1.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromBitbucket, pkgconfig, SDL2, libGLU, libGL, openal, luajit, +{ lib, stdenv, fetchFromBitbucket, pkg-config, SDL2, libGLU, libGL, openal, luajit, libdevil, freetype, physfs, libmodplug, mpg123, libvorbis, libogg, libtheora, which, autoconf, automake, libtool }: @@ -17,7 +17,7 @@ stdenv.mkDerivation { sha256 = "18gfp65ngb8k8g7hgbw2bhrwk2i7m56m21d39pk4484q9z8p4vm7"; }; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ SDL2 libGLU libGL openal luajit libdevil freetype physfs libmodplug mpg123 libvorbis libogg libtheora autoconf which libtool automake @@ -34,8 +34,8 @@ stdenv.mkDerivation { 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 ]; + license = lib.licenses.zlib; + platforms = lib.platforms.linux; + maintainers = [ lib.maintainers.raskin ]; }; } diff --git a/pkgs/development/interpreters/lua-5/5.4.darwin.patch b/pkgs/development/interpreters/lua-5/5.4.darwin.patch new file mode 100644 index 00000000000..eb16ed9c689 --- /dev/null +++ b/pkgs/development/interpreters/lua-5/5.4.darwin.patch @@ -0,0 +1,48 @@ +--- a/Makefile 2021-05-14 22:39:14.407200562 +0300 ++++ b/Makefile 2021-05-14 22:36:23.828513407 +0300 +@@ -41,7 +41,7 @@ + # 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. +@@ -60,6 +60,8 @@ + 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) +--- a/src/Makefile 2021-05-14 22:35:38.575051882 +0300 ++++ b/src/Makefile 2021-05-14 22:35:33.584631206 +0300 +@@ -32,7 +32,7 @@ + + PLATS= guess aix bsd c89 freebsd generic linux linux-readline 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 + LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o + BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) +@@ -57,11 +57,13 @@ + 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/pkgs/development/interpreters/lua-5/CVE-2019-6706.patch b/pkgs/development/interpreters/lua-5/CVE-2019-6706.patch deleted file mode 100644 index 89e81b7eb68..00000000000 --- a/pkgs/development/interpreters/lua-5/CVE-2019-6706.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- 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/pkgs/development/interpreters/lua-5/build-lua-package.nix b/pkgs/development/interpreters/lua-5/build-lua-package.nix index 98a98c0dd34..74f5b2b7b39 100644 --- a/pkgs/development/interpreters/lua-5/build-lua-package.nix +++ b/pkgs/development/interpreters/lua-5/build-lua-package.nix @@ -207,7 +207,7 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps" "extraVariab postFixup = lib.optionalString (!dontWrapLuaPrograms) '' wrapLuaPrograms - '' + attrs.postFixup or ''''; + '' + attrs.postFixup or ""; installPhase = attrs.installPhase or '' runHook preInstall diff --git a/pkgs/development/interpreters/lua-5/default.nix b/pkgs/development/interpreters/lua-5/default.nix index 7e79ff8f117..3e36f77dab4 100644 --- a/pkgs/development/interpreters/lua-5/default.nix +++ b/pkgs/development/interpreters/lua-5/default.nix @@ -1,35 +1,24 @@ # 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"; +rec { + lua5_4 = callPackage ./interpreter.nix { + sourceVersion = { major = "5"; minor = "4"; patch = "3"; }; + hash = "1yxvjvnbg4nyrdv10bq42gz6dr66pyan28lgzfygqfwy2rv24qgq"; + + patches = lib.optional stdenv.isDarwin ./5.4.darwin.patch; }; -in rec { + lua5_4_compat = lua5_4.override({ + compat = true; + }); 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 - ''; + sourceVersion = { major = "5"; minor = "3"; patch = "6"; }; + hash = "0q3d8qhd7p0b7a4mh9g7fxqksqfs6mr1nav74vq26qvkp2dxcpzw"; - postBuild = stdenv.lib.optionalString (!stdenv.isDarwin) '' - ( cd src; make $makeFlags "''${makeFlagsArray[@]}" liblua.so ) - ''; + patches = + lib.optionals stdenv.isDarwin [ ./5.2.darwin.patch ]; }; lua5_3_compat = lua5_3.override({ @@ -40,7 +29,7 @@ in rec { 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 ]; + patches = lib.optional stdenv.isDarwin ./5.2.darwin.patch; }; lua5_2_compat = lua5_2.override({ @@ -51,7 +40,7 @@ in rec { 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 ]) + patches = (lib.optional stdenv.isDarwin ./5.1.darwin.patch) ++ [ ./CVE-2014-5461.patch ]; }; diff --git a/pkgs/development/interpreters/lua-5/filesystem.nix b/pkgs/development/interpreters/lua-5/filesystem.nix deleted file mode 100644 index a3e633bbab1..00000000000 --- a/pkgs/development/interpreters/lua-5/filesystem.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ 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/pkgs/development/interpreters/lua-5/interpreter.nix b/pkgs/development/interpreters/lua-5/interpreter.nix index 98e4684e092..3476b2b648b 100644 --- a/pkgs/development/interpreters/lua-5/interpreter.nix +++ b/pkgs/development/interpreters/lua-5/interpreter.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, readline +{ lib, stdenv, fetchurl, readline , compat ? false , callPackage , packageOverrides ? (self: super: {}) @@ -7,10 +7,20 @@ , patches ? [] , postConfigure ? null , postBuild ? null +, staticOnly ? stdenv.hostPlatform.isStatic }: let luaPackages = callPackage ../../lua-modules {lua=self; overrides=packageOverrides;}; +plat = if stdenv.isLinux then "linux" + else if stdenv.isDarwin then "macosx" + else if stdenv.hostPlatform.isMinGW then "mingw" + else if stdenv.isFreeBSD then "freebsd" + else if stdenv.isSunOS then "solaris" + else if stdenv.hostPlatform.isBSD then "bsd" + else if stdenv.hostPlatform.isUnix then "posix" + else "generic"; + self = stdenv.mkDerivation rec { pname = "lua"; luaversion = with sourceVersion; "${major}.${minor}"; @@ -29,6 +39,14 @@ self = stdenv.mkDerivation rec { inherit patches; + postPatch = lib.optionalString (!stdenv.isDarwin && !staticOnly) '' + # Add a target for a shared library to the Makefile. + sed -e '1s/^/LUA_SO = liblua.so/' \ + -e 's/ALL_T *= */&$(LUA_SO) /' \ + -i src/Makefile + cat ${./lua-dso.make} >> src/Makefile + ''; + # see configurePhase for additional flags (with space) makeFlags = [ "INSTALL_TOP=${placeholder "out"}" @@ -36,24 +54,25 @@ self = stdenv.mkDerivation rec { "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 []) - ; + "PLAT=${plat}" + "CC=${stdenv.cc.targetPrefix}cc" + "RANLIB=${stdenv.cc.targetPrefix}ranlib" + # Lua links with readline wich depends on ncurses. For some reason when + # building pkgsStatic.lua it fails because symbols from ncurses are not + # found. Adding ncurses here fixes the problem. + "MYLIBS=-lncurses" + ]; 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'"}) + makeFlagsArray+=(CFLAGS='-O2 -fPIC${lib.optionalString compat " -DLUA_COMPAT_ALL"} $(${ + if lib.versionAtLeast luaversion "5.2" then "SYSCFLAGS" else "MYCFLAGS"})' ) + makeFlagsArray+=(${lib.optionalString stdenv.isDarwin "CC=\"$CC\""}${lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) " 'AR=${stdenv.cc.targetPrefix}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}"}" ) + TO_LIB="${if stdenv.isDarwin then "liblua.${version}.dylib" + else ("liblua.a" + lib.optionalString (!staticOnly) " liblua.so liblua.so.${luaversion} liblua.so.${version}" )}" ) runHook postConfigure ''; @@ -80,10 +99,12 @@ self = stdenv.mkDerivation rec { Description: An Extensible Extension Language Version: ${version} Requires: - Libs: -L$out/lib -llua -lm + Libs: -L$out/lib -llua Cflags: -I$out/include EOF + ln -s "$out/lib/pkgconfig/lua.pc" "$out/lib/pkgconfig/lua-${luaversion}.pc" ln -s "$out/lib/pkgconfig/lua.pc" "$out/lib/pkgconfig/lua${luaversion}.pc" + ln -s "$out/lib/pkgconfig/lua.pc" "$out/lib/pkgconfig/lua${lib.replaceStrings [ "." ] [ "" ] luaversion}.pc" ''; passthru = rec { @@ -107,8 +128,8 @@ self = stdenv.mkDerivation rec { management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping. ''; - license = stdenv.lib.licenses.mit; - platforms = stdenv.lib.platforms.unix; + license = lib.licenses.mit; + platforms = lib.platforms.unix; }; }; in self diff --git a/pkgs/development/interpreters/lua-5/lua-5.3-dso.make b/pkgs/development/interpreters/lua-5/lua-dso.make index c70dbc4f9cc..19c57685677 100644 --- a/pkgs/development/interpreters/lua-5/lua-5.3-dso.make +++ b/pkgs/development/interpreters/lua-5/lua-dso.make @@ -1,8 +1,4 @@ - -LUA_SO=liblua.so - $(LUA_SO): $(CORE_O) $(LIB_O) - $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS) + $(CC) -shared $(LIBS) -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? $(MYLDFLAGS) ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V) ln -sf $(LUA_SO).$(R) $(LUA_SO) - diff --git a/pkgs/development/interpreters/lua-5/sockets.nix b/pkgs/development/interpreters/lua-5/sockets.nix deleted file mode 100644 index 73fbbc3e66a..00000000000 --- a/pkgs/development/interpreters/lua-5/sockets.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ 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/pkgs/development/interpreters/lua-5/wrapper.nix b/pkgs/development/interpreters/lua-5/wrapper.nix index 53ec2baeb5e..0459b67534d 100644 --- a/pkgs/development/interpreters/lua-5/wrapper.nix +++ b/pkgs/development/interpreters/lua-5/wrapper.nix @@ -1,4 +1,4 @@ -{ stdenv, lua, buildEnv, makeWrapper +{ lib, stdenv, lua, buildEnv, makeWrapper , extraLibs ? [] , extraOutputsToInstall ? [] , postBuild ? "" @@ -28,7 +28,7 @@ let addToLuaPath "$out" # take every binary from lua packages and put them into the env - for path in ${stdenv.lib.concatStringsSep " " paths}; do + for path in ${lib.concatStringsSep " " paths}; do nix_debug "looking for binaries in path = $path" if [ -d "$path/bin" ]; then cd "$path/bin" @@ -37,7 +37,7 @@ let 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} + makeWrapper "$path/bin/$prg" "$out/bin/$prg" --suffix LUA_PATH ';' "$LUA_PATH" --suffix LUA_CPATH ';' "$LUA_CPATH" ${lib.concatStringsSep " " makeWrapperArgs} fi fi done diff --git a/pkgs/development/interpreters/luajit/2.0.nix b/pkgs/development/interpreters/luajit/2.0.nix index e96a7c604c7..153b11aaa5f 100644 --- a/pkgs/development/interpreters/luajit/2.0.nix +++ b/pkgs/development/interpreters/luajit/2.0.nix @@ -1,10 +1,10 @@ { self, callPackage, lib }: callPackage ./default.nix { inherit self; - version = "2.0.5-2020-08-05"; - rev = "2211f6f"; + version = "2.0.5-2021-06-08"; + rev = "98f95f69180d48ce49289d6428b46a9ccdd67a46"; isStable = true; - sha256 = "01adxmknq2xyb3w9sn8ilnar8181h7ksd9i80yrsbwzix5lwkn6m"; + sha256 = "1pdmhk5syp0nir80xcnkf6xy2w5rwslak8hgmjpgaxzlnrjcgs7p"; 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/pkgs/development/interpreters/luajit/2.1.nix b/pkgs/development/interpreters/luajit/2.1.nix index f08bbd0e972..d11514c07c6 100644 --- a/pkgs/development/interpreters/luajit/2.1.nix +++ b/pkgs/development/interpreters/luajit/2.1.nix @@ -1,8 +1,8 @@ { self, callPackage }: callPackage ./default.nix { inherit self; - version = "2.1.0-2020-08-05"; - rev = "10ddae7"; + version = "2.1.0-2021-06-25"; + rev = "e957737650e060d5bf1c2909b741cc3dffe073ac"; isStable = false; - sha256 = "1lmjs0gz9vgbhh5f45jvvibpj7f3sz81r8cz4maln9yhc67f2zmk"; + sha256 = "04i7n5xdd1nci4mv2p6bv71fq5b1nkswz12hcgirsxqbnkrlbbcj"; } diff --git a/pkgs/development/interpreters/luajit/default.nix b/pkgs/development/interpreters/luajit/default.nix index 9658186b9c0..860642b0fd2 100644 --- a/pkgs/development/interpreters/luajit/default.nix +++ b/pkgs/development/interpreters/luajit/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, buildPackages +{ lib, stdenv, fetchFromGitHub, buildPackages , name ? "luajit-${version}" , isStable , sha256 @@ -11,7 +11,7 @@ , enableFFI ? true , enableJIT ? true , enableJITDebugModule ? enableJIT -, enableGC64 ? stdenv.hostPlatform.isAarch64 +, enableGC64 ? true , enable52Compat ? false , enableValgrindSupport ? false , valgrind ? null @@ -26,7 +26,7 @@ assert enableValgrindSupport -> valgrind != null; let luaPackages = callPackage ../../lua-modules {lua=self; overrides=packageOverrides;}; - XCFLAGS = with stdenv.lib; + XCFLAGS = with lib; optional (!enableFFI) "-DLUAJIT_DISABLE_FFI" ++ optional (!enableJIT) "-DLUAJIT_DISABLE_JIT" ++ optional enable52Compat "-DLUAJIT_ENABLE_LUA52COMPAT" @@ -59,7 +59,7 @@ stdenv.mkDerivation rec { configurePhase = false; - buildInputs = stdenv.lib.optional enableValgrindSupport valgrind; + buildInputs = lib.optional enableValgrindSupport valgrind; buildFlags = [ "amalg" # Build highly optimized version @@ -70,14 +70,14 @@ stdenv.mkDerivation rec { "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)"; + ] ++ 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) '' + '' + lib.optionalString (!isStable) '' ln -s "$out"/bin/luajit-* "$out"/bin/luajit ''; @@ -99,7 +99,7 @@ stdenv.mkDerivation rec { interpreter = "${self}/bin/lua"; }; - meta = with stdenv.lib; { + meta = with lib; { description = "High-performance JIT compiler for Lua 5.1"; homepage = "http://luajit.org"; license = licenses.mit; diff --git a/pkgs/development/interpreters/lush/default.nix b/pkgs/development/interpreters/lush/default.nix index a8db08e87a2..fe51d154956 100644 --- a/pkgs/development/interpreters/lush/default.nix +++ b/pkgs/development/interpreters/lush/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, libX11, xorgproto, indent, readline, gsl, freeglut, libGLU, libGL, SDL +{lib, stdenv, fetchurl, libX11, xorgproto, indent, readline, gsl, freeglut, libGLU, libGL, SDL , blas, libbfd, intltool, gettext, zlib, libSM}: stdenv.mkDerivation rec { @@ -22,8 +22,8 @@ stdenv.mkDerivation rec { meta = { description = "Lisp Universal SHell"; - license = stdenv.lib.licenses.gpl2Plus ; - maintainers = [ stdenv.lib.maintainers.raskin ]; - platforms = stdenv.lib.platforms.linux; + license = lib.licenses.gpl2Plus ; + maintainers = [ lib.maintainers.raskin ]; + platforms = lib.platforms.linux; }; } diff --git a/pkgs/development/interpreters/maude/default.nix b/pkgs/development/interpreters/maude/default.nix index e4e984fc4ac..860f9ac3a5e 100644 --- a/pkgs/development/interpreters/maude/default.nix +++ b/pkgs/development/interpreters/maude/default.nix @@ -1,14 +1,14 @@ -{ stdenv, fetchurl, unzip, makeWrapper, flex, bison, ncurses, buddy, tecla +{ lib, stdenv, fetchurl, unzip, makeWrapper, flex, bison, ncurses, buddy, tecla , libsigsegv, gmpxx, cln, yices }: let - version = "3.0"; + version = "3.1"; fullMaude = fetchurl { - url = "http://maude.cs.illinois.edu/w/images/0/04/Full-Maude-${version}.zip"; - sha256 = "0gf36wlkkl343vlxgryqdhxmgyn8z0cc2zayccd7ac3inmj1iayw"; + url = "http://maude.cs.illinois.edu/w/images/0/0a/Full-Maude-${version}.zip"; + sha256 = "8b13af02c6243116c2ef9592622ecaa06d05dbe1dd6b1e595551ff33855948f2"; }; in @@ -18,16 +18,17 @@ stdenv.mkDerivation { inherit version; src = fetchurl { - url = "http://maude.cs.illinois.edu/w/images/9/92/Maude-${version}.tar.gz"; - sha256 = "0vhn3lsck6ji9skrgm67hqrn3k4f6y442q73jbw65qqznm321k5a"; + url = "http://maude.cs.illinois.edu/w/images/d/d3/Maude-${version}.tar.gz"; + sha256 = "b112d7843f65217e3b5a9d40461698ef8dab7cbbe830af21216dfb924dc88a2f"; }; + nativeBuildInputs = [ unzip ]; buildInputs = [ - flex bison ncurses buddy tecla gmpxx libsigsegv makeWrapper unzip cln yices + flex bison ncurses buddy tecla gmpxx libsigsegv makeWrapper cln yices ]; hardeningDisable = [ "stackprotector" ] ++ - stdenv.lib.optionals stdenv.isi686 [ "pic" "fortify" ]; + lib.optionals stdenv.isi686 [ "pic" "fortify" ]; preConfigure = '' configureFlagsArray=( @@ -43,7 +44,7 @@ stdenv.mkDerivation { 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 + install -D -m 444 full-maude31.maude $out/share/maude/full-maude.maude ''; # bison -dv surface.yy -o surface.c @@ -54,7 +55,7 @@ stdenv.mkDerivation { meta = { homepage = "http://maude.cs.illinois.edu/"; description = "High-level specification language"; - license = stdenv.lib.licenses.gpl2Plus; + license = lib.licenses.gpl2Plus; longDescription = '' Maude is a high-performance reflective language and system @@ -66,7 +67,7 @@ stdenv.mkDerivation { rewriting logic computation. ''; - platforms = stdenv.lib.platforms.unix; - maintainers = [ stdenv.lib.maintainers.peti ]; + platforms = lib.platforms.unix; + maintainers = [ lib.maintainers.peti ]; }; } diff --git a/pkgs/development/interpreters/metamath/default.nix b/pkgs/development/interpreters/metamath/default.nix index 66352cfdda4..d5c021a815f 100644 --- a/pkgs/development/interpreters/metamath/default.nix +++ b/pkgs/development/interpreters/metamath/default.nix @@ -1,19 +1,19 @@ -{ stdenv, fetchFromGitHub, autoreconfHook }: +{ lib, stdenv, fetchFromGitHub, autoreconfHook }: -stdenv.mkDerivation { +stdenv.mkDerivation rec { pname = "metamath"; - version = "0.182"; + version = "0.196"; - buildInputs = [ autoreconfHook ]; + nativeBuildInputs = [ autoreconfHook ]; src = fetchFromGitHub { owner = "metamath"; repo = "metamath-exe"; - rev = "5df616efe4119ff88daf77e7041d45b6fa39c578"; - sha256 = "0amjdgy42c7jypf6sz98iczlxcyl9bqx67ws1q8w2zdqk2izsyjp"; + rev = "v${version}"; + sha256 = "sha256-/ofH5fq7lUxbbRBAczsLNG3UPsOMbCdcxkB3el5OPcU="; }; - meta = with stdenv.lib; { + meta = with lib; { description = "Interpreter for the metamath proof language"; longDescription = '' The metamath program is an ASCII-based ANSI C program with a command-line @@ -23,7 +23,7 @@ stdenv.mkDerivation { ''; homepage = "http://us.metamath.org"; downloadPage = "http://us.metamath.org/#downloads"; - license = licenses.gpl2; + license = licenses.gpl2Plus; maintainers = [ maintainers.taneb ]; platforms = platforms.all; }; diff --git a/pkgs/development/interpreters/micropython/default.nix b/pkgs/development/interpreters/micropython/default.nix index 3293c4b9f58..2e0b587acfd 100644 --- a/pkgs/development/interpreters/micropython/default.nix +++ b/pkgs/development/interpreters/micropython/default.nix @@ -1,43 +1,82 @@ -{ stdenv, lib, fetchFromGitHub, pkgconfig, libffi, python3, readline }: +{ stdenv +, lib +, fetchFromGitHub +, fetchpatch +, pkg-config +, libffi +, python3 +, readline +}: stdenv.mkDerivation rec { pname = "micropython"; - version = "1.12"; + version = "1.15"; src = fetchFromGitHub { owner = "micropython"; repo = "micropython"; rev = "v${version}"; - sha256 = "1fsigdahnv5yn0mc7dr1y6h7g8ywg084pcgj6d64kb39w641n8j5"; + sha256 = "11bf1lq4kgfs1nzg5cnshh2dqxyk5w2k816i04innri6fj0g7y6p"; fetchSubmodules = true; }; - nativeBuildInputs = [ pkgconfig python3 ]; + # drop the following patches when upgrading to 1.16 + patches = [ + # fix build with modern clang https://github.com/micropython/micropython/pull/7254 + (fetchpatch { + url = "https://github.com/micropython/micropython/commit/126b1c727118352923703719a2a3d45b9fad3c97.patch"; + sha256 = "13a2bmz24syhd1qsqbx39dcjkjdhf05ln7lanh816m94lkfib21j"; + }) + # fix build with modern clang https://github.com/micropython/micropython/pull/7254 + (fetchpatch { + url = "https://github.com/micropython/micropython/commit/7ceccad4e2f1e9d073f5781c32e5b377e8391a25.patch"; + sha256 = "04mbxmb5yr6pbhhf9villq8km4wy579r46v9p4n0ysivrxij7i6f"; + }) + # fix build on aarch64-darwin https://github.com/micropython/micropython/pull/7393 + (fetchpatch { + url = "https://github.com/micropython/micropython/commit/95048129b1d93854c25f501c02801929aeeb23f0.patch"; + sha256 = "1cngcwq4jviyhdnfcrrkdadfikhffzbj0d634j0344cp247jb41n"; + }) + ]; - buildInputs = [ libffi readline ]; + nativeBuildInputs = [ pkg-config python3 ]; - doCheck = true; + buildInputs = [ libffi readline ]; buildPhase = '' + runHook preBuild make -C mpy-cross make -C ports/unix + runHook postBuild ''; + doCheck = true; + + skippedTests = "" + + lib.optionalString (stdenv.isDarwin) " -e uasyncio_basic -e uasyncio_wait_task" + + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) " -e ffi_callback" + + lib.optionalString (stdenv.isLinux && stdenv.isAarch64) " -e float_parse" + ; + checkPhase = '' + runHook preCheck pushd tests - MICROPY_MICROPYTHON=../ports/unix/micropython ${python3.interpreter} ./run-tests + ${python3.interpreter} ./run-tests.py ${skippedTests} popd + runHook postCheck ''; installPhase = '' + runHook preInstall mkdir -p $out/bin - install -Dm755 ports/unix/micropython $out/bin/micropython + install -Dm755 ports/unix/micropython -t $out/bin + runHook postInstall ''; meta = with lib; { description = "A lean and efficient Python implementation for microcontrollers and constrained systems"; homepage = "https://micropython.org"; - platforms = [ "x86_64-linux" ]; + platforms = platforms.unix; license = licenses.mit; maintainers = with maintainers; [ sgo ]; }; diff --git a/pkgs/development/interpreters/mujs/default.nix b/pkgs/development/interpreters/mujs/default.nix index 692aed3e4ee..46f86f85fc3 100644 --- a/pkgs/development/interpreters/mujs/default.nix +++ b/pkgs/development/interpreters/mujs/default.nix @@ -1,23 +1,23 @@ -{ stdenv, fetchurl, readline }: +{ lib, stdenv, fetchurl, readline }: stdenv.mkDerivation rec { pname = "mujs"; - version = "1.0.7"; + version = "1.1.2"; src = fetchurl { url = "https://mujs.com/downloads/mujs-${version}.tar.xz"; - sha256 = "1ilhay15z4k7mlzs6g2d00snivin7vp72dfw5wwpmc0x70jr31l2"; + sha256 = "sha256-cZ6IK7fZhkDvoWM4Hpto7xzjXIekIuKqQZDJ5AIlh10="; }; buildInputs = [ readline ]; makeFlags = [ "prefix=$(out)" ]; - meta = with stdenv.lib; { + meta = with lib; { homepage = "https://mujs.com/"; description = "A lightweight, embeddable Javascript interpreter"; platforms = platforms.unix; maintainers = with maintainers; [ pSub ]; - license = licenses.gpl3; + license = licenses.isc; }; } diff --git a/pkgs/development/interpreters/nix-exec/default.nix b/pkgs/development/interpreters/nix-exec/default.nix deleted file mode 100644 index 0c976f2f0b0..00000000000 --- a/pkgs/development/interpreters/nix-exec/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ 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/pkgs/development/interpreters/octave/build-env.nix b/pkgs/development/interpreters/octave/build-env.nix new file mode 100644 index 00000000000..59575f95fc4 --- /dev/null +++ b/pkgs/development/interpreters/octave/build-env.nix @@ -0,0 +1,84 @@ +{ lib, stdenv, octave, buildEnv +, makeWrapper, texinfo +, octavePackages +, wrapOctave +, computeRequiredOctavePackages +, extraLibs ? [] +, extraOutputsToInstall ? [] +, postBuild ? "" +, ignoreCollisions ? false +}: + +# Create an octave executable that knows about additional packages +let + packages = computeRequiredOctavePackages extraLibs; + +in buildEnv { + name = "${octave.name}-env"; + paths = extraLibs ++ [ octave ]; + + inherit ignoreCollisions; + extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall; + + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ texinfo wrapOctave ]; + + # During "build" we must first unlink the /share symlink to octave's /share + # Then, we can re-symlink the all of octave/share, except for /share/octave + # in env/share/octave, re-symlink everything from octave/share/octave and then + # perform the pkg install. + postBuild = '' + if [ -L "$out/bin" ]; then + unlink $out/bin + mkdir -p "$out/bin" + cd "${octave}/bin" + for prg in *; do + if [ -x $prg ]; then + makeWrapper "${octave}/bin/$prg" "$out/bin/$prg" --set OCTAVE_SITE_INITFILE "$out/share/octave/site/m/startup/octaverc" + fi + done + cd $out + fi + + # Remove symlinks to the input tarballs, they aren't needed, use -f so it + # will not fail if no .tar.gz symlinks are there - for example if + # sommething which is not a tarball used as a package + rm -f $out/*.tar.gz + + createOctavePackagesPath $out ${octave} + + # Create the file even if the loop afterwards has no packages to run over + touch $out/.octave_packages + for path in ${lib.concatStringsSep " " packages}; do + if [ -e $path/*.tar.gz ]; then + $out/bin/octave-cli --eval "pkg local_list $out/.octave_packages; \ + pkg prefix $out/${octave.octPkgsPath} $out/${octave.octPkgsPath}; \ + pfx = pkg (\"prefix\"); \ + pkg install -nodeps -local $path/*.tar.gz" + fi + done + + # Re-write the octave-wide startup file (share/octave/site/m/startup/octaverc) + # To point to the new local_list in $out + addPkgLocalList $out ${octave} + + wrapOctavePrograms "${lib.concatStringsSep " " packages}" + '' + postBuild; + + inherit (octave) meta; + + passthru = octave.passthru // { + interpreter = "$out/bin/octave"; + inherit octave; + env = stdenv.mkDerivation { + name = "interactive-${octave.name}-environment"; + + buildCommand = '' + echo >&2 "" + echo >&2 "*** octave 'env' attributes are intended for interactive nix-shell sessions, not for building! ***" + echo >&2 "" + exit 1 + ''; + }; + }; +} diff --git a/pkgs/development/interpreters/octave/build-octave-package.nix b/pkgs/development/interpreters/octave/build-octave-package.nix new file mode 100644 index 00000000000..73a67769d6a --- /dev/null +++ b/pkgs/development/interpreters/octave/build-octave-package.nix @@ -0,0 +1,113 @@ +# Generic builder for GNU Octave libraries. +# This is a file that contains nested functions. The first, outer, function +# is the library- and package-wide details, such as the nixpkgs library, any +# additional configuration provided, and the namePrefix to use (based on the +# pname and version of Octave), the octave package, etc. + +{ lib +, stdenv +, config +, octave +, texinfo +, computeRequiredOctavePackages +, writeRequiredOctavePackagesHook +}: + +# The inner function contains information required to build the individual +# libraries. +{ fullLibName ? "${attrs.pname}-${attrs.version}" + +, src + +, dontPatch ? false +, patches ? [] +, patchPhase ? "" + +, enableParallelBuilding ? true +# Build-time dependencies for the package, which were compiled for the system compiling this. +, nativeBuildInputs ? [] + +# Build-time dependencies for the package, which may not have been compiled for the system compiling this. +, buildInputs ? [] + +# Propagate build dependencies so in case we have A -> B -> C, +# C can import package A propagated by B +# Run-time dependencies for the package. +, propagatedBuildInputs ? [] + +# Octave packages that are required at runtime for this one. +# These behave similarly to propagatedBuildInputs, where if +# package A is needed by B, and C needs B, then C also requires A. +# The main difference between these and propagatedBuildInputs is +# during the package's installation into octave, where all +# requiredOctavePackages are ALSO installed into octave. +, requiredOctavePackages ? [] + +, preBuild ? "" + +, meta ? {} + +, passthru ? {} + +, ... } @ attrs: + +let + requiredOctavePackages' = computeRequiredOctavePackages requiredOctavePackages; + +in stdenv.mkDerivation { + packageName = "${fullLibName}"; + # The name of the octave package ends up being + # "octave-version-package-version" + name = "${octave.pname}-${octave.version}-${fullLibName}"; + + # This states that any package built with the function that this returns + # will be an octave package. This is used for ensuring other octave + # packages are installed into octave during the environment building phase. + isOctavePackage = true; + + OCTAVE_HISTFILE = "/dev/null"; + + inherit src; + + inherit dontPatch patches patchPhase; + + dontConfigure = true; + + enableParallelBuilding = enableParallelBuilding; + + requiredOctavePackages = requiredOctavePackages'; + + nativeBuildInputs = [ + octave + writeRequiredOctavePackagesHook + ] + ++ nativeBuildInputs; + + buildInputs = buildInputs ++ requiredOctavePackages'; + + propagatedBuildInputs = propagatedBuildInputs ++ [ texinfo ]; + + preBuild = if preBuild == "" then + '' + # This trickery is needed because Octave expects a single directory inside + # at the top-most level of the tarball. + tar --transform 's,^,${fullLibName}/,' -cz * -f ${fullLibName}.tar.gz + '' + else + preBuild; + + buildPhase = '' + runHook preBuild + + mkdir -p $out + octave-cli --eval "pkg build $out ${fullLibName}.tar.gz" + + runHook postBuild + ''; + + # We don't install here, because that's handled when we build the environment + # together with Octave. + dontInstall = true; + + inherit meta; +} diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix index 06d69ed8117..e8228d23b0c 100644 --- a/pkgs/development/interpreters/octave/default.nix +++ b/pkgs/development/interpreters/octave/default.nix @@ -1,4 +1,9 @@ { stdenv +, pkgs +, lib +# Note: either stdenv.mkDerivation or, for octaveFull, the qt-5 mkDerivation +# with wrapQtAppsHook (comes from libsForQt5.callPackage) +, mkDerivation , fetchurl , gfortran , ncurses @@ -11,7 +16,7 @@ , libX11 , graphicsmagick , pcre -, pkgconfig +, pkg-config , libGL , libGLU , fltk @@ -20,15 +25,17 @@ , fftwSinglePrec , zlib , curl -, qrupdate , blas, lapack -, arpack +# These two should use the same lapack and blas as the above +, qrupdate, arpack, suitesparse ? null +# If set to true, the above 5 deps are overriden to use the blas and lapack +# with 64 bit indexes support. If all are not compatible, the build will fail. +, use64BitIdx ? false , libwebp , gl2ps , ghostscript ? null , hdf5 ? null , glpk ? null -, suitesparse ? null , gnuplot ? null # - Include support for GNU readline: , enableReadline ? true @@ -38,7 +45,12 @@ , jdk ? null , python ? null , overridePlatforms ? null -, sundials_2 ? null +, sundials ? null +# - Packages required for building extra packages. +, newScope +, callPackage +, makeSetupHook +, makeWrapper # - Build Octave Qt GUI: , enableQt ? false , qtbase ? null @@ -53,112 +65,188 @@ , darwin }: -assert (!blas.isILP64) && (!lapack.isILP64); +let -stdenv.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 + # Not always evaluated + blas' = if use64BitIdx then + blas.override { + isILP64 = true; + } + else blas + ; + lapack' = if use64BitIdx then + lapack.override { + isILP64 = true; + } + else 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 - ]) + qrupdate' = qrupdate.override { + # If use64BitIdx is false, this override doesn't evaluate to a new + # derivation, as blas and lapack are not overriden. + blas = blas'; + lapack = lapack'; + }; + arpack' = arpack.override { + blas = blas'; + lapack = lapack'; + }; + # Not always suitesparse is required at all + suitesparse' = if suitesparse != null then + suitesparse.override { + blas = blas'; + lapack = lapack'; + } + else + null ; - doCheck = !stdenv.isDarwin; + octavePackages = import ../../../top-level/octave-packages.nix { + inherit pkgs; + inherit lib stdenv fetchurl newScope; + octave = self; + }; - enableParallelBuilding = true; + wrapOctave = callPackage ./wrap-octave.nix { + octave = self; + inherit (pkgs) makeSetupHook makeWrapper; + }; - # See https://savannah.gnu.org/bugs/?50339 - F77_INTEGER_8_FLAG = if blas.isILP64 then "-fdefault-integer-8" else ""; + self = mkDerivation rec { + version = "6.2.0"; + pname = "octave"; - 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" ] - ; + src = fetchurl { + url = "mirror://gnu/octave/${pname}-${version}.tar.gz"; + sha256 = "sha256-RX0f2oY0qDni/Xz8VbmL1W82tq5z0xu530Pd4wEsqnw="; + }; - # 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 - ''; + buildInputs = [ + readline + ncurses + perl + flex + qhull + graphicsmagick + pcre + fltk + zlib + curl + blas' + lapack' + libsndfile + fftw + fftwSinglePrec + portaudio + qrupdate' + arpack' + libwebp + gl2ps + ] + ++ lib.optionals enableQt [ + qtbase + qtsvg + qscintilla + ] + ++ lib.optionals (ghostscript != null) [ ghostscript ] + ++ lib.optionals (hdf5 != null) [ hdf5 ] + ++ lib.optionals (glpk != null) [ glpk ] + ++ lib.optionals (suitesparse != null) [ suitesparse' ] + ++ lib.optionals (enableJava) [ jdk ] + ++ lib.optionals (sundials != null) [ sundials ] + ++ lib.optionals (gnuplot != null) [ gnuplot ] + ++ lib.optionals (python != null) [ python ] + ++ lib.optionals (!stdenv.isDarwin) [ libGL libGLU libX11 ] + ++ lib.optionals stdenv.isDarwin [ + libiconv + darwin.apple_sdk.frameworks.Accelerate + darwin.apple_sdk.frameworks.Cocoa + ] + ; + nativeBuildInputs = [ + pkg-config + gfortran + # Listed here as well because it's outputs are split + fftw + fftwSinglePrec + texinfo + ] + ++ lib.optionals (sundials != null) [ sundials ] + ++ lib.optionals enableJIT [ llvm ] + ++ lib.optionals enableQt [ + qtscript + qttools + ] + ; - passthru = { - inherit version; - sitePath = "share/octave/${version}/site"; - }; + doCheck = !stdenv.isDarwin; + + enableParallelBuilding = true; + + # Fix linker error on Darwin (see https://trac.macports.org/ticket/61865) + NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-lobjc"; + + # Avoid Qt 5.12 problem on Big Sur: https://bugreports.qt.io/browse/QTBUG-87014 + qtWrapperArgs = lib.optionals stdenv.isDarwin [ + "--set QT_MAC_WANTS_LAYER 1" + ]; + + # See https://savannah.gnu.org/bugs/?50339 + F77_INTEGER_8_FLAG = if use64BitIdx then "-fdefault-integer-8" else ""; - 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; + configureFlags = [ + "--with-blas=blas" + "--with-lapack=lapack" + (if use64BitIdx then "--enable-64" else "--disable-64") + ] + ++ lib.optionals stdenv.isDarwin [ "--enable-link-all-dependencies" ] + ++ lib.optionals enableReadline [ "--enable-readline" ] + ++ lib.optionals stdenv.isDarwin [ "--with-x=no" ] + ++ lib.optionals enableQt [ "--with-qt=5" ] + ++ 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 = rec { + sitePath = "share/octave/${version}/site"; + octPkgsPath = "share/octave/octave_packages"; + blas = blas'; + lapack = lapack'; + qrupdate = qrupdate'; + arpack = arpack'; + suitesparse = suitesparse'; + inherit fftw fftwSinglePrec; + inherit portaudio; + inherit jdk; + inherit python; + inherit enableQt enableJIT enableReadline enableJava; + buildEnv = callPackage ./build-env.nix { + octave = self; + inherit octavePackages wrapOctave; + inherit (octavePackages) computeRequiredOctavePackages; + }; + withPackages = import ./with-packages.nix { inherit buildEnv octavePackages; }; + pkgs = octavePackages; + interpreter = "${self}/bin/octave"; + }; + + meta = { + homepage = "https://www.gnu.org/software/octave/"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ raskin doronbehar ]; + 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 + (lib.platforms.linux ++ lib.platforms.darwin) + else overridePlatforms; + }; }; -} + +in self diff --git a/pkgs/development/interpreters/octave/hooks/default.nix b/pkgs/development/interpreters/octave/hooks/default.nix new file mode 100644 index 00000000000..f47560921af --- /dev/null +++ b/pkgs/development/interpreters/octave/hooks/default.nix @@ -0,0 +1,13 @@ +# Hooks for building Octave packages. +{ octave +, lib +, callPackage +, makeSetupHook +}: + +rec { + writeRequiredOctavePackagesHook = callPackage ({ }: + makeSetupHook { + name = "write-required-octave-packages-hook"; + } ./write-required-octave-packages-hook.sh) {}; +} diff --git a/pkgs/development/interpreters/octave/hooks/octave-write-required-octave-packages-hook.sh b/pkgs/development/interpreters/octave/hooks/octave-write-required-octave-packages-hook.sh new file mode 100644 index 00000000000..64e87d68246 --- /dev/null +++ b/pkgs/development/interpreters/octave/hooks/octave-write-required-octave-packages-hook.sh @@ -0,0 +1,17 @@ +# Setup hook for writing octave packages that are run-time dependencies for +# another package to a nix-support file. +# `echo`s the full path name to the package derivation that is required. +echo "Sourcing octave-write-required-octave-packages-hook.sh" + +octaveWriteRequiredOctavePackagesPhase() { + echo "Executing octaveWriteRequiredOctavePackagesPhase" + + mkdir -p $out/nix-support + echo ${requiredOctavePackages} > $out/nix-support/required-octave-packages +} + +# Yes its a bit long... +if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then + echo "Using octaveWriteRequiredOctavePackagesPhase" + preDistPhases+=" octaveWriteRequiredOctavePackagesPhase" +fi diff --git a/pkgs/development/interpreters/octave/hooks/write-required-octave-packages-hook.sh b/pkgs/development/interpreters/octave/hooks/write-required-octave-packages-hook.sh new file mode 100644 index 00000000000..032ea398ac5 --- /dev/null +++ b/pkgs/development/interpreters/octave/hooks/write-required-octave-packages-hook.sh @@ -0,0 +1,17 @@ +# Setup hook for writing octave packages that are run-time dependencies for +# another package to a nix-support file. +# `echo`s the full path name to the package derivation that is required. +echo "Sourcing write-required-octave-packages-hook.sh" + +writeRequiredOctavePackagesPhase() { + echo "Executing writeRequiredOctavePackagesPhase" + + mkdir -p $out/nix-support + echo ${requiredOctavePackages} > $out/nix-support/required-octave-packages +} + +# Yes its a bit long... +if [ -z "${dontWriteRequiredOctavePackagesPhase-}" ]; then + echo "Using writeRequiredOctavePackagesPhase" + preDistPhases+=" writeRequiredOctavePackagesPhase" +fi diff --git a/pkgs/development/interpreters/octave/with-packages.nix b/pkgs/development/interpreters/octave/with-packages.nix new file mode 100644 index 00000000000..f00befbb00d --- /dev/null +++ b/pkgs/development/interpreters/octave/with-packages.nix @@ -0,0 +1,6 @@ +{ buildEnv, octavePackages }: + +# Takes the buildEnv defined for Octave and the set of octavePackages, and returns +# a function, which when given a function whose return value is a list of extra +# packages to install, builds and returns that environment. +f: let packages = f octavePackages; in buildEnv.override { extraLibs = packages; } diff --git a/pkgs/development/interpreters/octave/wrap-octave.nix b/pkgs/development/interpreters/octave/wrap-octave.nix new file mode 100644 index 00000000000..1e4616136a1 --- /dev/null +++ b/pkgs/development/interpreters/octave/wrap-octave.nix @@ -0,0 +1,16 @@ +{ lib +, octave +, makeSetupHook +, makeWrapper +}: + +# Defined in trivial-builders.nix +# Imported as wrapOctave in octave/default.nix and passed to octave's buildEnv +# as nativeBuildInput +# Each of the substitutions is available in the wrap.sh script as @thingSubstituted@ +makeSetupHook { + name = "${octave.name}-pkgs-setup-hook"; + deps = makeWrapper; + substitutions.executable = octave.interpreter; + substitutions.octave = octave; +} ./wrap.sh diff --git a/pkgs/development/interpreters/octave/wrap.sh b/pkgs/development/interpreters/octave/wrap.sh new file mode 100644 index 00000000000..a5969fca2a9 --- /dev/null +++ b/pkgs/development/interpreters/octave/wrap.sh @@ -0,0 +1,132 @@ +# Unlinks a directory (given as the first argument), and re-creates that +# directory as an actual directory. Then descends into the directory of +# the same name in the origin (arg_2/arg_3) and symlinks the contents of +# that directory into the passed end-location. +unlinkDirReSymlinkContents() { + local dirToUnlink="$1" + local origin="$2" + local contentsLocation="$3" + + unlink $dirToUnlink/$contentsLocation + mkdir -p $dirToUnlink/$contentsLocation + for f in $origin/$contentsLocation/*; do + ln -s -t "$dirToUnlink/$contentsLocation" "$f" + done +} + +# Using unlinkDirReSymlinkContents, un-symlinks directories down to +# $out/share/octave, and then creates the octave_packages directory. +createOctavePackagesPath() { + local desiredOut=$1 + local origin=$2 + + if [ -L "$out/share" ]; then + unlinkDirReSymlinkContents "$desiredOut" "$origin" "share" + fi + + if [ -L "$out/share/octave" ]; then + unlinkDirReSymlinkContents "$desiredOut" "$origin" "share/octave" + fi + + # Now that octave_packages has a path rather than symlinks, create the + # octave_packages directory for installed packages. + mkdir -p "$desiredOut/share/octave/octave_packages" +} + +# First, descends down to $out/share/octave/site/m/startup/octaverc, and +# copies that start-up file. Once done, it performs a `chmod` to allow +# writing. Lastly, it `echo`s the location of the locally installed packages +# to the startup file, allowing octave to discover installed packages. +addPkgLocalList() { + local desiredOut=$1 + local origin=$2 + local octaveSite="share/octave/site" + local octaveSiteM="$octaveSite/m" + local octaveSiteStartup="$octaveSiteM/startup" + local siteOctavercStartup="$octaveSiteStartup/octaverc" + + unlinkDirReSymlinkContents "$desiredOut" "$origin" "$octaveSite" + unlinkDirReSymlinkContents "$desiredOut" "$origin" "$octaveSiteM" + unlinkDirReSymlinkContents "$desiredOut" "$origin" "$octaveSiteStartup" + + unlink "$out/$siteOctavercStartup" + cp "$origin/$siteOctavercStartup" "$desiredOut/$siteOctavercStartup" + chmod u+w "$desiredOut/$siteOctavercStartup" + echo "pkg local_list $out/.octave_packages" >> "$desiredOut/$siteOctavercStartup" +} + +# Wrapper function for wrapOctaveProgramsIn. Takes one argument, a +# space-delimited string of packages' paths that will be installed. +wrapOctavePrograms() { + wrapOctaveProgramsIn "$out/bin" "$out" "$@" +} + +# Wraps all octave programs in $out/bin with all the propagated inputs that +# a particular package requires. $1 is the directory to look for binaries in +# to wrap. $2 is the path to the octave ENVIRONMENT. $3 is the space-delimited +# string of packages. +wrapOctaveProgramsIn() { + local dir="$1" + local octavePath="$2" + local pkgs="$3" + local f + + buildOctavePath "$octavePath" "$pkgs" + + # 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 + echo "wrapping \`$f'..." + local -a wrap_args=("$f" + --prefix PATH ':' "$program_PATH" + ) + local -a wrapProgramArgs=("${wrap_args[@]}") + wrapProgram "${wrapProgramArgs[@]}" + done + fi +} + +# Build the PATH environment variable by walking through the closure of +# dependencies. Starts by constructing the `program_PATH` variable with the +# environment's path, then adding the original octave's location, and marking +# them in `octavePathsSeen`. +buildOctavePath() { + local octavePath="$1" + local packages="$2" + + local pathsToSearch="$octavePath $packages" + + # Create an empty table of Octave paths. + declare -A octavePathsSeen=() + program_PATH= + octavePathsSeen["$out"]=1 + octavePathsSeen["@octave@"]=1 + addToSearchPath program_PATH "$out/bin" + addToSearchPath program_PATH "@octave@/bin" + echo "program_PATH to change to is: $program_PATH" + for path in $pathsToSearch; do + echo "Recurse to propagated-build-input: $path" + _addToOctavePath $path + done +} + +# Adds the bin directories to the program_PATH variable. +# Recurses on any paths declared in `propagated-build-inputs`, while avoiding +# duplicating paths by flagging the directires it has seen in `octavePathsSeen`. +_addToOctavePath() { + local dir="$1" + # Stop if we've already visited this path. + if [ -n "${octavePathsSeen[$dir]}" ]; then return; fi + octavePathsSeen[$dir]=1 + # addToSearchPath is defined in stdenv/generic/setup.sh. It has the effect + # of calling `export X=$dir/...:$X`. + 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 + for new_path in $(cat $prop); do + _addToOctavePath $new_path + done + fi +} diff --git a/pkgs/development/interpreters/perl/default.nix b/pkgs/development/interpreters/perl/default.nix index 8f539d23392..3b39974c16b 100644 --- a/pkgs/development/interpreters/perl/default.nix +++ b/pkgs/development/interpreters/perl/default.nix @@ -1,4 +1,5 @@ -{ config, lib, stdenv, fetchurl, pkgs, buildPackages, callPackage +{ config, lib, stdenv, fetchurl, fetchFromGitHub, pkgs, buildPackages +, callPackage , enableThreading ? true, coreutils, makeWrapper }: @@ -36,16 +37,8 @@ let 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) + ./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; @@ -73,7 +66,7 @@ let # Miniperl needs -lm. perl needs -lrt. configureFlags = (if crossCompiling - then [ "-Dlibpth=\"\"" "-Dglibpth=\"\"" ] + then [ "-Dlibpth=\"\"" "-Dglibpth=\"\"" "-Ddefault_inc_excludes_dot" ] else [ "-de" "-Dcc=cc" ]) ++ [ "-Uinstallusrbinperl" @@ -175,18 +168,22 @@ let 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 = "1.3.4"; # Jun 2, 2020 - - perl-cross-src = fetchurl { - url = "https://github.com/arsv/perl-cross/archive/${crossVersion}.tar.gz"; - sha256 = "15wvlafhpsh9h66s3vazhx46hf8ik75473acrvf6722ijd1wpz45"; + crossVersion = "1.3.6"; + + perl-cross-src = fetchFromGitHub { + name = "perl-cross-${crossVersion}"; + owner = "arsv"; + repo = "perl-cross"; + rev = crossVersion; + sha256 = "0k5vyj40czbkfl7r3dcwxpc7dvdlp2xliaav358bviq3dq9vq9bb"; }; depsBuildBuild = [ buildPackages.stdenv.cc makeWrapper ]; postUnpack = '' unpackFile ${perl-cross-src} - cp -R perl-cross-${crossVersion}/* perl-${version}/ + chmod -R u+w ${perl-cross-src.name} + cp -R ${perl-cross-src.name}/* perl-${version}/ ''; configurePlatforms = [ "build" "host" "target" ]; @@ -196,26 +193,26 @@ let }); in { # Maint version - perl528 = common { - perl = pkgs.perl528; - buildPerl = buildPackages.perl528; - version = "5.28.3"; - sha256 = "052if351m81yhaab429i1kv77v9b15qm0g48kr6y2yjrc7bc3jdg"; + perl532 = common { + perl = pkgs.perl532; + buildPerl = buildPackages.perl532; + version = "5.32.1"; + sha256 = "0b7brakq9xs4vavhg391as50nbhzryc7fy5i65r81bnq3j897dh3"; }; # Maint version - perl530 = common { - perl = pkgs.perl530; - buildPerl = buildPackages.perl530; - version = "5.30.3"; - sha256 = "0vs0wwwlw47sswxaflkk4hw0y45cmc7arxx788kwpbminy5lrq1j"; + perl534 = common { + perl = pkgs.perl534; + buildPerl = buildPackages.perl534; + version = "5.34.0"; + sha256 = "16mywn5afpv1mczv9dlc1w84rbgjgrr0pyr4c0hhb2wnif0zq7jm"; }; # the latest Devel version perldevel = common { perl = pkgs.perldevel; buildPerl = buildPackages.perldevel; - version = "5.32.0-RC0"; - sha256 = "02i6n1xa4j0ksp014yy8q0j7scjcy5mr0yd4iash2ryrrfv5yw5k"; + version = "5.35.0"; + sha256 = "0217nbswhkjhw60kng2p64611xna7za681kk30fkriyicd3yph6n"; }; } diff --git a/pkgs/development/interpreters/perl/no-sys-dirs-5.26.patch b/pkgs/development/interpreters/perl/no-sys-dirs-5.26.patch deleted file mode 100644 index ad65d1339f3..00000000000 --- a/pkgs/development/interpreters/perl/no-sys-dirs-5.26.patch +++ /dev/null @@ -1,250 +0,0 @@ -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/pkgs/development/interpreters/perl/no-sys-dirs-5.29.patch b/pkgs/development/interpreters/perl/no-sys-dirs-5.29.patch deleted file mode 100644 index 0ccf6254b78..00000000000 --- a/pkgs/development/interpreters/perl/no-sys-dirs-5.29.patch +++ /dev/null @@ -1,251 +0,0 @@ -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/pkgs/development/interpreters/perl/wrapper.nix b/pkgs/development/interpreters/perl/wrapper.nix index 2e3d394f851..e1909a15e05 100644 --- a/pkgs/development/interpreters/perl/wrapper.nix +++ b/pkgs/development/interpreters/perl/wrapper.nix @@ -1,4 +1,4 @@ -{ stdenv, perl, buildEnv, makeWrapper +{ lib, perl, buildEnv, makeWrapper , extraLibs ? [] , extraOutputsToInstall ? [] , postBuild ? "" @@ -17,18 +17,17 @@ let inherit ignoreCollisions; extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall; + nativeBuildInputs = [ makeWrapper ]; + # 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 + for path in ${lib.concatStringsSep " " paths}; do if [ -d "$path/bin" ]; then cd "$path/bin" for prg in *; do diff --git a/pkgs/development/interpreters/php/7.4.nix b/pkgs/development/interpreters/php/7.4.nix new file mode 100644 index 00000000000..1e72f7b48b4 --- /dev/null +++ b/pkgs/development/interpreters/php/7.4.nix @@ -0,0 +1,52 @@ +{ callPackage, lib, stdenv, ... }@_args: + +let + base = callPackage ./generic.nix (_args // { + version = "7.4.21"; + sha256 = "0al2697d5hwq0f39rgncl1pwfxzzpc0afmr0fjvw5qjpww163v1n"; + }); + +in +base.withExtensions ({ 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 ])) diff --git a/pkgs/development/interpreters/php/8.0.nix b/pkgs/development/interpreters/php/8.0.nix new file mode 100644 index 00000000000..82d78d95314 --- /dev/null +++ b/pkgs/development/interpreters/php/8.0.nix @@ -0,0 +1,51 @@ +{ callPackage, lib, stdenv, ... }@_args: + +let + base = callPackage ./generic.nix (_args // { + version = "8.0.8"; + sha256 = "0vyi9hhy7yl4l589dniwb3gq29sp3giq7ni4nca3x54q3bbpgg8l"; + }); + +in +base.withExtensions ({ all, ... }: with all; ([ + bcmath + calendar + curl + ctype + dom + exif + fileinfo + filter + ftp + gd + gettext + gmp + iconv + intl + 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 ])) diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix deleted file mode 100644 index 8921cf78aa8..00000000000 --- a/pkgs/development/interpreters/php/default.nix +++ /dev/null @@ -1,303 +0,0 @@ -# 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/pkgs/development/interpreters/php/generic.nix b/pkgs/development/interpreters/php/generic.nix new file mode 100644 index 00000000000..dbe01acb6df --- /dev/null +++ b/pkgs/development/interpreters/php/generic.nix @@ -0,0 +1,301 @@ +# We have tests for PCRE and PHP-FPM in nixos/tests/php/ or +# both in the same attribute named nixosTests.php + +let + generic = + { callPackage + , lib + , stdenv + , nixosTests + , fetchurl + , makeWrapper + , symlinkJoin + , writeText + , autoconf + , automake + , bison + , flex + , libtool + , pkg-config + , re2c + , apacheHttpd + , libargon2 + , libxml2 + , pcre2 + , systemd + , system-sendmail + , valgrind + , xcbuild + + , version + , sha256 + , extraPatches ? [ ] + , packageOverrides ? (final: prev: { }) + + # 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 ? !stdenv.isDarwin && lib.meta.availableOn stdenv.hostPlatform valgrind + , 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 { + phpPackage = phpWithExtensions; + }).overrideScope' packageOverrides; + + 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-extra-init-${version}.ini" '' + ${lib.concatStringsSep "\n" + (lib.textClosureList extensionTexts extNames)} + ${extraConfig} + ''; + + phpWithExtensions = symlinkJoin { + name = "php-with-extensions-${version}"; + inherit (php) version; + nativeBuildInputs = [ makeWrapper ]; + passthru = php.passthru // { + buildEnv = mkBuildEnv allArgs allExtensionFunctions; + withExtensions = mkWithExtensions allArgs allExtensionFunctions; + phpIni = "${phpWithExtensions}/lib/php.ini"; + unwrapped = php; + # Select the right php tests for the php version + tests = nixosTests."php${lib.strings.replaceStrings [ "." ] [ "" ] (lib.versions.majorMinor php.version)}"; + inherit (php-packages) extensions buildPecl mkExtension; + packages = php-packages.tools; + meta = php.meta // { + outputsToInstall = [ "out" ]; + }; + }; + paths = [ php ]; + postBuild = '' + ln -s ${extraInit} $out/lib/php.ini + + if test -e $out/bin/php; then + wrapProgram $out/bin/php --set PHP_INI_SCAN_DIR $out/lib + fi + + if test -e $out/bin/php-fpm; then + wrapProgram $out/bin/php-fpm --set PHP_INI_SCAN_DIR $out/lib + fi + + if test -e $out/bin/phpdbg; then + wrapProgram $out/bin/phpdbg --set PHP_INI_SCAN_DIR $out/lib + fi + ''; + }; + in + phpWithExtensions + ); + + mkWithExtensions = prevArgs: prevExtensionFunctions: extensions: + mkBuildEnv prevArgs prevExtensionFunctions { inherit extensions; }; + in + stdenv.mkDerivation { + pname = "php"; + + inherit version; + + enableParallelBuilding = true; + + nativeBuildInputs = [ autoconf automake bison flex libtool pkg-config re2c ] + ++ lib.optional stdenv.isDarwin xcbuild; + + buildInputs = + # PCRE extension + [ pcre2 ] + + # 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=${pcre2.dev}" ] + ++ [ "PCRE_LIBDIR=${pcre2}" ] + + + # Enable sapis + ++ lib.optional (!cgiSupport) "--disable-cgi" + ++ lib.optional (!cliSupport) "--disable-cli" + ++ lib.optional fpmSupport "--enable-fpm" + ++ lib.optional pearSupport [ "--with-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) "--disable-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 && (lib.versionOlder version "8.0")) "--enable-maintainer-zts" + ++ lib.optional (ztsSupport && (lib.versionAtLeast version "8.0")) "--enable-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 { } [ ]; + inherit ztsSupport; + }; + + meta = with 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" ]; + }; + }; +in +generic diff --git a/pkgs/development/interpreters/php/php73-darwin-isfinite.patch b/pkgs/development/interpreters/php/php73-darwin-isfinite.patch deleted file mode 100644 index 7f784e0f5a9..00000000000 --- a/pkgs/development/interpreters/php/php73-darwin-isfinite.patch +++ /dev/null @@ -1,60 +0,0 @@ -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/pkgs/development/interpreters/picoc/default.nix b/pkgs/development/interpreters/picoc/default.nix index f7343f6e4d6..2c674754935 100644 --- a/pkgs/development/interpreters/picoc/default.nix +++ b/pkgs/development/interpreters/picoc/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, readline }: +{ lib, stdenv, fetchFromGitHub, readline }: stdenv.mkDerivation rec { pname = "picoc"; @@ -31,7 +31,7 @@ stdenv.mkDerivation rec { install -m644 *.h $out/include ''; - meta = with stdenv.lib; { + meta = with lib; { description = "Very small C interpreter for scripting"; longDescription = '' PicoC is a very small C interpreter for scripting. It was originally diff --git a/pkgs/development/interpreters/picolisp/default.nix b/pkgs/development/interpreters/picolisp/default.nix index 1511698c921..623eefec416 100644 --- a/pkgs/development/interpreters/picolisp/default.nix +++ b/pkgs/development/interpreters/picolisp/default.nix @@ -1,5 +1,5 @@ -{ stdenv, fetchurl, jdk, w3m, openssl, makeWrapper }: -with stdenv.lib; +{ lib, stdenv, fetchurl, jdk, w3m, openssl, makeWrapper }: +with lib; stdenv.mkDerivation rec { pname = "picoLisp"; @@ -8,7 +8,8 @@ stdenv.mkDerivation rec { url = "https://www.software-lab.de/${pname}-${version}.tgz"; sha256 = "0l51x98bn1hh6kv40sdgp0x09pzg5i8yxbcjvm9n5bxsd6bbk5w2"; }; - buildInputs = [makeWrapper openssl] ++ optional stdenv.is64bit jdk; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [openssl] ++ optional stdenv.is64bit jdk; patchPhase = '' sed -i "s/which java/command -v java/g" mkAsm diff --git a/pkgs/development/interpreters/pixie/default.nix b/pkgs/development/interpreters/pixie/default.nix index 9b57e153aa0..ca55eceaedb 100644 --- a/pkgs/development/interpreters/pixie/default.nix +++ b/pkgs/development/interpreters/pixie/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchgit, fetchurl, python2, makeWrapper, pkgconfig, gcc, +{ lib, stdenv, fetchgit, fetchurl, python2, makeWrapper, pkg-config, gcc, pypy, libffi, libedit, libuv, boost, zlib, variant ? "jit", buildWithPypy ? false }: @@ -23,16 +23,16 @@ let sha256 = "0ylbqvhbcp5m09l15i2q2h3a0vjd055x2r37cq71lkhgmmaxrwbq"; }; libs = [ libffi libedit libuv boost.dev boost.out zlib ]; - include-path = stdenv.lib.concatStringsSep ":" + include-path = lib.concatStringsSep ":" (map (p: "${p}/include") libs); - library-path = stdenv.lib.concatStringsSep ":" + library-path = lib.concatStringsSep ":" (map (p: "${p}/lib") libs); - bin-path = stdenv.lib.concatStringsSep ":" + bin-path = lib.concatStringsSep ":" (map (p: "${p}/bin") [ gcc ]); build = {flags, target}: stdenv.mkDerivation rec { pname = "pixie"; version = "0-r${commit-count}-${variant}"; - nativeBuildInputs = [ makeWrapper pkgconfig ]; + nativeBuildInputs = [ makeWrapper pkg-config ]; buildInputs = libs; PYTHON = if buildWithPypy then "${pypy}/pypy-c/pypy-c" @@ -85,9 +85,9 @@ let meta = { description = "A clojure-like lisp, built with the pypy vm toolkit"; homepage = "https://github.com/pixie-lang/pixie"; - license = stdenv.lib.licenses.lgpl3; + license = lib.licenses.lgpl3; platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"]; - maintainers = with stdenv.lib.maintainers; [ bendlas ]; + maintainers = with lib.maintainers; [ bendlas ]; }; }; in build (builtins.getAttr variant variants) diff --git a/pkgs/development/interpreters/pixie/dust.nix b/pkgs/development/interpreters/pixie/dust.nix index 4a7f3423def..e6818cb03ed 100644 --- a/pkgs/development/interpreters/pixie/dust.nix +++ b/pkgs/development/interpreters/pixie/dust.nix @@ -1,4 +1,4 @@ -{ stdenv, pixie, fetchFromGitHub }: +{ lib, stdenv, pixie, fetchFromGitHub }: stdenv.mkDerivation rec { name = "dust-0-91"; @@ -29,7 +29,7 @@ stdenv.mkDerivation rec { 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; + license = lib.licenses.lgpl3; + platforms = lib.platforms.linux ++ lib.platforms.darwin; }; } diff --git a/pkgs/development/interpreters/proglodyte-wasm/default.nix b/pkgs/development/interpreters/proglodyte-wasm/default.nix deleted file mode 100644 index 8ebbf6cf501..00000000000 --- a/pkgs/development/interpreters/proglodyte-wasm/default.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ 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/pkgs/development/interpreters/pure/default.nix b/pkgs/development/interpreters/pure/default.nix index 19e6c93378f..d1c03bba5a3 100644 --- a/pkgs/development/interpreters/pure/default.nix +++ b/pkgs/development/interpreters/pure/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, fetchurl, makeWrapper, - llvm, gmp, mpfr, readline, bison, flex }: + libllvm, gmp, mpfr, readline, bison, flex }: stdenv.mkDerivation rec { baseName="pure"; @@ -11,8 +11,9 @@ stdenv.mkDerivation rec { sha256="0px6x5ivcdbbp2pz5n1r1cwg1syadklhjw8piqhl63n91i4r7iyb"; }; - buildInputs = [ bison flex makeWrapper ]; - propagatedBuildInputs = [ llvm gmp mpfr readline ]; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ bison flex ]; + propagatedBuildInputs = [ libllvm gmp mpfr readline ]; NIX_LDFLAGS = "-lLLVMJIT"; postPatch = '' @@ -24,10 +25,10 @@ stdenv.mkDerivation rec { configureFlags = [ "--enable-release" ]; doCheck = true; checkPhase = '' - LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${llvm}/lib make check + LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${libllvm}/lib make check ''; postInstall = '' - wrapProgram $out/bin/pure --prefix LD_LIBRARY_PATH : ${llvm}/lib + wrapProgram $out/bin/pure --prefix LD_LIBRARY_PATH : ${libllvm}/lib ''; meta = { diff --git a/pkgs/development/interpreters/pyrex/0.9.5.nix b/pkgs/development/interpreters/pyrex/0.9.5.nix index 40eb1daf49c..3fb909b0bb0 100644 --- a/pkgs/development/interpreters/pyrex/0.9.5.nix +++ b/pkgs/development/interpreters/pyrex/0.9.5.nix @@ -1,10 +1,8 @@ -{ stdenv, fetchurl, python2Packages }: +{ lib, fetchurl, python2Packages }: -let version = "0.9.5.1.1"; in - -python2Packages.buildPythonPackage { +python2Packages.buildPythonPackage rec { pname = "pyrex"; - inherit version; + version = "0.9.5.1.1"; src = fetchurl { url = "https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/oldtar/Pyrex-${version}.tar.gz"; @@ -16,6 +14,6 @@ python2Packages.buildPythonPackage { 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; + license = lib.licenses.asl20; }; } diff --git a/pkgs/development/interpreters/pyrex/0.9.6.nix b/pkgs/development/interpreters/pyrex/0.9.6.nix index e518edba1b3..e9d8d309709 100644 --- a/pkgs/development/interpreters/pyrex/0.9.6.nix +++ b/pkgs/development/interpreters/pyrex/0.9.6.nix @@ -1,10 +1,8 @@ -{ stdenv, fetchurl, python2Packages }: +{ lib, fetchurl, python2Packages }: -let version = "0.9.6.4"; in - -python2Packages.buildPythonPackage { +python2Packages.buildPythonPackage rec { pname = "pyrex"; - inherit version; + version = "0.9.6.4"; src = fetchurl { url = "https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/oldtar/Pyrex-${version}.tar.gz"; @@ -16,6 +14,6 @@ python2Packages.buildPythonPackage { 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; + license = lib.licenses.asl20; }; } diff --git a/pkgs/development/interpreters/python/conda/default.nix b/pkgs/development/interpreters/python/conda/default.nix new file mode 100644 index 00000000000..77bda13f266 --- /dev/null +++ b/pkgs/development/interpreters/python/conda/default.nix @@ -0,0 +1,25 @@ +{ pkgs }: { + + # List of libraries that are needed for conda binary packages. + # When installing a conda binary package, just extend + # the `buildInputs` with `condaAutopatchLibs`. + condaPatchelfLibs = builtins.map (p: p.lib or p) ([ + pkgs.alsa-lib + pkgs.cups + pkgs.gcc-unwrapped + pkgs.libGL + ] ++ (with pkgs.xorg; [ + libSM + libICE + libX11 + libXau + libXdamage + libXi + libXrender + libXrandr + libXcomposite + libXcursor + libXtst + libXScrnSaver]) + ); +} diff --git a/pkgs/development/interpreters/python/cpython/2.7/CVE-2021-23336.patch b/pkgs/development/interpreters/python/cpython/2.7/CVE-2021-23336.patch new file mode 100644 index 00000000000..760d0e7eed8 --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/2.7/CVE-2021-23336.patch @@ -0,0 +1,390 @@ +From e7b005c05dbdbce967a409abd71641281a8604bf Mon Sep 17 00:00:00 2001 +From: Senthil Kumaran <senthil@uthcode.com> +Date: Mon, 15 Feb 2021 11:16:43 -0800 +Subject: [PATCH 24/26] [3.6] bpo-42967: only use '&' as a query string + separator (GH-24297) (GH-24532) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +bpo-42967: [security] Address a web cache-poisoning issue reported in +urllib.parse.parse_qsl(). + +urllib.parse will only us "&" as query string separator by default +instead of both ";" and "&" as allowed in earlier versions. An optional +argument seperator with default value "&" is added to specify the +separator. + +Co-authored-by: Éric Araujo <merwok@netwok.org> +Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> +Co-authored-by: Adam Goldschmidt <adamgold7@gmail.com> + +Rebased for Python 2.7 by Michał Górny +--- + Doc/library/cgi.rst | 7 +++- + Doc/library/urlparse.rst | 23 ++++++++++- + Lib/cgi.py | 20 +++++++--- + Lib/test/test_cgi.py | 29 +++++++++++--- + Lib/test/test_urlparse.py | 38 +++++++++---------- + Lib/urlparse.py | 22 ++++++++--- + .../2021-02-14-15-59-16.bpo-42967.YApqDS.rst | 1 + + 7 files changed, 100 insertions(+), 40 deletions(-) + create mode 100644 Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst + +diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst +index ecd62c8c01..b85cdd8b61 100644 +--- a/Doc/library/cgi.rst ++++ b/Doc/library/cgi.rst +@@ -285,10 +285,10 @@ These are useful if you want more control, or if you want to employ some of the + algorithms implemented in this module in other circumstances. + + +-.. function:: parse(fp[, environ[, keep_blank_values[, strict_parsing]]]) ++.. function:: parse(fp[, environ[, keep_blank_values[, strict_parsing]]], separator="&") + + Parse a query in the environment or from a file (the file defaults to +- ``sys.stdin`` and environment defaults to ``os.environ``). The *keep_blank_values* and *strict_parsing* parameters are ++ ``sys.stdin`` and environment defaults to ``os.environ``). The *keep_blank_values*, *strict_parsing* and *separator* parameters are + passed to :func:`urlparse.parse_qs` unchanged. + + +@@ -316,6 +316,9 @@ algorithms implemented in this module in other circumstances. + Note that this does not parse nested multipart parts --- use + :class:`FieldStorage` for that. + ++ .. versionchanged:: 3.6.13 ++ Added the *separator* parameter. ++ + + .. function:: parse_header(string) + +diff --git a/Doc/library/urlparse.rst b/Doc/library/urlparse.rst +index 0989c88c30..2f8e4c5a44 100644 +--- a/Doc/library/urlparse.rst ++++ b/Doc/library/urlparse.rst +@@ -136,7 +136,7 @@ The :mod:`urlparse` module defines the following functions: + now raise :exc:`ValueError`. + + +-.. function:: parse_qs(qs[, keep_blank_values[, strict_parsing[, max_num_fields]]]) ++.. function:: parse_qs(qs[, keep_blank_values[, strict_parsing[, max_num_fields]]], separator='&') + + Parse a query string given as a string argument (data of type + :mimetype:`application/x-www-form-urlencoded`). Data are returned as a +@@ -157,6 +157,9 @@ The :mod:`urlparse` module defines the following functions: + read. If set, then throws a :exc:`ValueError` if there are more than + *max_num_fields* fields read. + ++ The optional argument *separator* is the symbol to use for separating the ++ query arguments. It defaults to ``&``. ++ + Use the :func:`urllib.urlencode` function to convert such dictionaries into + query strings. + +@@ -166,7 +169,14 @@ The :mod:`urlparse` module defines the following functions: + .. versionchanged:: 2.7.16 + Added *max_num_fields* parameter. + +-.. function:: parse_qsl(qs[, keep_blank_values[, strict_parsing[, max_num_fields]]]) ++ .. versionchanged:: 2.7.18-gentoo ++ Added *separator* parameter with the default value of ``&``. Earlier ++ Python versions allowed using both ``;`` and ``&`` as query parameter ++ separator. This has been changed to allow only a single separator key, ++ with ``&`` as the default separator. ++ ++ ++.. function:: parse_qsl(qs[, keep_blank_values[, strict_parsing[, max_num_fields]]], separator='&') + + Parse a query string given as a string argument (data of type + :mimetype:`application/x-www-form-urlencoded`). Data are returned as a list of +@@ -186,6 +196,9 @@ The :mod:`urlparse` module defines the following functions: + read. If set, then throws a :exc:`ValueError` if there are more than + *max_num_fields* fields read. + ++ The optional argument *separator* is the symbol to use for separating the ++ query arguments. It defaults to ``&``. ++ + Use the :func:`urllib.urlencode` function to convert such lists of pairs into + query strings. + +@@ -195,6 +208,12 @@ The :mod:`urlparse` module defines the following functions: + .. versionchanged:: 2.7.16 + Added *max_num_fields* parameter. + ++ .. versionchanged:: 2.7.18-gentoo ++ Added *separator* parameter with the default value of ``&``. Earlier ++ Python versions allowed using both ``;`` and ``&`` as query parameter ++ separator. This has been changed to allow only a single separator key, ++ with ``&`` as the default separator. ++ + .. function:: urlunparse(parts) + + Construct a URL from a tuple as returned by ``urlparse()``. The *parts* argument +diff --git a/Lib/cgi.py b/Lib/cgi.py +index 5b903e0347..9d0848b6b1 100755 +--- a/Lib/cgi.py ++++ b/Lib/cgi.py +@@ -121,7 +121,8 @@ log = initlog # The current logging function + # 0 ==> unlimited input + maxlen = 0 + +-def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0): ++def parse(fp=None, environ=os.environ, keep_blank_values=0, ++ strict_parsing=0, separator='&'): + """Parse a query in the environment or from a file (default stdin) + + Arguments, all optional: +@@ -140,6 +141,9 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0): + strict_parsing: flag indicating what to do with parsing errors. + If false (the default), errors are silently ignored. + If true, errors raise a ValueError exception. ++ ++ separator: str. The symbol to use for separating the query arguments. ++ Defaults to &. + """ + if fp is None: + fp = sys.stdin +@@ -171,7 +175,8 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0): + else: + qs = "" + environ['QUERY_STRING'] = qs # XXX Shouldn't, really +- return urlparse.parse_qs(qs, keep_blank_values, strict_parsing) ++ return urlparse.parse_qs(qs, keep_blank_values, strict_parsing, ++ separator=separator) + + + # parse query string function called from urlparse, +@@ -395,7 +400,7 @@ class FieldStorage: + + def __init__(self, fp=None, headers=None, outerboundary="", + environ=os.environ, keep_blank_values=0, strict_parsing=0, +- max_num_fields=None): ++ max_num_fields=None, separator='&'): + """Constructor. Read multipart/* until last part. + + Arguments, all optional: +@@ -430,6 +435,7 @@ class FieldStorage: + self.keep_blank_values = keep_blank_values + self.strict_parsing = strict_parsing + self.max_num_fields = max_num_fields ++ self.separator = separator + if 'REQUEST_METHOD' in environ: + method = environ['REQUEST_METHOD'].upper() + self.qs_on_post = None +@@ -613,7 +619,8 @@ class FieldStorage: + if self.qs_on_post: + qs += '&' + self.qs_on_post + query = urlparse.parse_qsl(qs, self.keep_blank_values, +- self.strict_parsing, self.max_num_fields) ++ self.strict_parsing, self.max_num_fields, ++ separator=self.separator) + self.list = [MiniFieldStorage(key, value) for key, value in query] + self.skip_lines() + +@@ -629,7 +636,8 @@ class FieldStorage: + query = urlparse.parse_qsl(self.qs_on_post, + self.keep_blank_values, + self.strict_parsing, +- self.max_num_fields) ++ self.max_num_fields, ++ separator=self.separator) + self.list.extend(MiniFieldStorage(key, value) + for key, value in query) + FieldStorageClass = None +@@ -649,7 +657,7 @@ class FieldStorage: + headers = rfc822.Message(self.fp) + part = klass(self.fp, headers, ib, + environ, keep_blank_values, strict_parsing, +- max_num_fields) ++ max_num_fields, separator=self.separator) + + if max_num_fields is not None: + max_num_fields -= 1 +diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py +index 743c2afbd4..f414faa23b 100644 +--- a/Lib/test/test_cgi.py ++++ b/Lib/test/test_cgi.py +@@ -61,12 +61,9 @@ parse_strict_test_cases = [ + ("", ValueError("bad query field: ''")), + ("&", ValueError("bad query field: ''")), + ("&&", ValueError("bad query field: ''")), +- (";", ValueError("bad query field: ''")), +- (";&;", ValueError("bad query field: ''")), + # Should the next few really be valid? + ("=", {}), + ("=&=", {}), +- ("=;=", {}), + # This rest seem to make sense + ("=a", {'': ['a']}), + ("&=a", ValueError("bad query field: ''")), +@@ -81,8 +78,6 @@ parse_strict_test_cases = [ + ("a=a+b&b=b+c", {'a': ['a b'], 'b': ['b c']}), + ("a=a+b&a=b+a", {'a': ['a b', 'b a']}), + ("x=1&y=2.0&z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}), +- ("x=1;y=2.0&z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}), +- ("x=1;y=2.0;z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}), + ("Hbc5161168c542333633315dee1182227:key_store_seqid=400006&cuyer=r&view=bustomer&order_id=0bb2e248638833d48cb7fed300000f1b&expire=964546263&lobale=en-US&kid=130003.300038&ss=env", + {'Hbc5161168c542333633315dee1182227:key_store_seqid': ['400006'], + 'cuyer': ['r'], +@@ -188,6 +183,30 @@ class CgiTests(unittest.TestCase): + self.assertEqual(expect[k], v) + self.assertItemsEqual(expect.values(), d.values()) + ++ def test_separator(self): ++ parse_semicolon = [ ++ ("x=1;y=2.0", {'x': ['1'], 'y': ['2.0']}), ++ ("x=1;y=2.0;z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}), ++ (";", ValueError("bad query field: ''")), ++ (";;", ValueError("bad query field: ''")), ++ ("=;a", ValueError("bad query field: 'a'")), ++ (";b=a", ValueError("bad query field: ''")), ++ ("b;=a", ValueError("bad query field: 'b'")), ++ ("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}), ++ ("a=a+b;a=b+a", {'a': ['a b', 'b a']}), ++ ] ++ for orig, expect in parse_semicolon: ++ env = {'QUERY_STRING': orig} ++ fs = cgi.FieldStorage(separator=';', environ=env) ++ if isinstance(expect, dict): ++ for key in expect.keys(): ++ expect_val = expect[key] ++ self.assertIn(key, fs) ++ if len(expect_val) > 1: ++ self.assertEqual(fs.getvalue(key), expect_val) ++ else: ++ self.assertEqual(fs.getvalue(key), expect_val[0]) ++ + def test_log(self): + cgi.log("Testing") + +diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py +index 86c4a0595c..0b2107339a 100644 +--- a/Lib/test/test_urlparse.py ++++ b/Lib/test/test_urlparse.py +@@ -24,16 +24,20 @@ parse_qsl_test_cases = [ + ("&a=b", [('a', 'b')]), + ("a=a+b&b=b+c", [('a', 'a b'), ('b', 'b c')]), + ("a=1&a=2", [('a', '1'), ('a', '2')]), +- (";", []), +- (";;", []), +- (";a=b", [('a', 'b')]), +- ("a=a+b;b=b+c", [('a', 'a b'), ('b', 'b c')]), +- ("a=1;a=2", [('a', '1'), ('a', '2')]), +- (b";", []), +- (b";;", []), +- (b";a=b", [(b'a', b'b')]), +- (b"a=a+b;b=b+c", [(b'a', b'a b'), (b'b', b'b c')]), +- (b"a=1;a=2", [(b'a', b'1'), (b'a', b'2')]), ++ (b"", []), ++ (b"&", []), ++ (b"&&", []), ++ (b"=", [(b'', b'')]), ++ (b"=a", [(b'', b'a')]), ++ (b"a", [(b'a', b'')]), ++ (b"a=", [(b'a', b'')]), ++ (b"&a=b", [(b'a', b'b')]), ++ (b"a=a+b&b=b+c", [(b'a', b'a b'), (b'b', b'b c')]), ++ (b"a=1&a=2", [(b'a', b'1'), (b'a', b'2')]), ++ (";a=b", [(';a', 'b')]), ++ ("a=a+b;b=b+c", [('a', 'a b;b=b c')]), ++ (b";a=b", [(b';a', b'b')]), ++ (b"a=a+b;b=b+c", [(b'a', b'a b;b=b c')]), + ] + + parse_qs_test_cases = [ +@@ -57,16 +61,10 @@ parse_qs_test_cases = [ + (b"&a=b", {b'a': [b'b']}), + (b"a=a+b&b=b+c", {b'a': [b'a b'], b'b': [b'b c']}), + (b"a=1&a=2", {b'a': [b'1', b'2']}), +- (";", {}), +- (";;", {}), +- (";a=b", {'a': ['b']}), +- ("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}), +- ("a=1;a=2", {'a': ['1', '2']}), +- (b";", {}), +- (b";;", {}), +- (b";a=b", {b'a': [b'b']}), +- (b"a=a+b;b=b+c", {b'a': [b'a b'], b'b': [b'b c']}), +- (b"a=1;a=2", {b'a': [b'1', b'2']}), ++ (";a=b", {';a': ['b']}), ++ ("a=a+b;b=b+c", {'a': ['a b;b=b c']}), ++ (b";a=b", {b';a': [b'b']}), ++ (b"a=a+b;b=b+c", {b'a':[ b'a b;b=b c']}), + ] + + class UrlParseTestCase(unittest.TestCase): +diff --git a/Lib/urlparse.py b/Lib/urlparse.py +index 798b467b60..6c32727fce 100644 +--- a/Lib/urlparse.py ++++ b/Lib/urlparse.py +@@ -382,7 +382,8 @@ def unquote(s): + append(item) + return ''.join(res) + +-def parse_qs(qs, keep_blank_values=0, strict_parsing=0, max_num_fields=None): ++def parse_qs(qs, keep_blank_values=0, strict_parsing=0, max_num_fields=None, ++ separator='&'): + """Parse a query given as a string argument. + + Arguments: +@@ -402,17 +403,22 @@ def parse_qs(qs, keep_blank_values=0, strict_parsing=0, max_num_fields=None): + + max_num_fields: int. If set, then throws a ValueError if there + are more than n fields read by parse_qsl(). ++ ++ separator: str. The symbol to use for separating the query arguments. ++ Defaults to &. ++ + """ + dict = {} + for name, value in parse_qsl(qs, keep_blank_values, strict_parsing, +- max_num_fields): ++ max_num_fields, separator=separator): + if name in dict: + dict[name].append(value) + else: + dict[name] = [value] + return dict + +-def parse_qsl(qs, keep_blank_values=0, strict_parsing=0, max_num_fields=None): ++def parse_qsl(qs, keep_blank_values=0, strict_parsing=0, max_num_fields=None, ++ separator='&'): + """Parse a query given as a string argument. + + Arguments: +@@ -432,17 +438,23 @@ def parse_qsl(qs, keep_blank_values=0, strict_parsing=0, max_num_fields=None): + max_num_fields: int. If set, then throws a ValueError if there + are more than n fields read by parse_qsl(). + ++ separator: str. The symbol to use for separating the query arguments. ++ Defaults to &. ++ + Returns a list, as G-d intended. + """ ++ if not separator or (not isinstance(separator, (str, bytes))): ++ raise ValueError("Separator must be of type string or bytes.") ++ + # If max_num_fields is defined then check that the number of fields + # is less than max_num_fields. This prevents a memory exhaustion DOS + # attack via post bodies with many fields. + if max_num_fields is not None: +- num_fields = 1 + qs.count('&') + qs.count(';') ++ num_fields = 1 + qs.count(separator) + if max_num_fields < num_fields: + raise ValueError('Max number of fields exceeded') + +- pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')] ++ pairs = [s1 for s1 in qs.split(separator)] + r = [] + for name_value in pairs: + if not name_value and not strict_parsing: +diff --git a/Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst b/Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst +new file mode 100644 +index 0000000000..f08489b414 +--- /dev/null ++++ b/Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst +@@ -0,0 +1 @@ ++Fix web cache poisoning vulnerability by defaulting the query args separator to ``&``, and allowing the user to choose a custom separator. +-- +2.31.1 + diff --git a/pkgs/development/interpreters/python/cpython/2.7/CVE-2021-3177.patch b/pkgs/development/interpreters/python/cpython/2.7/CVE-2021-3177.patch new file mode 100644 index 00000000000..6c0ae468461 --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/2.7/CVE-2021-3177.patch @@ -0,0 +1,181 @@ +From fab838b2ee7cfb9037c24f0f18dfe01aa379b3f7 Mon Sep 17 00:00:00 2001 +From: Benjamin Peterson <benjamin@python.org> +Date: Mon, 18 Jan 2021 15:11:46 -0600 +Subject: [3.6] closes bpo-42938: Replace snprintf with Python unicode + formatting in ctypes param reprs. (GH-24250) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +(cherry picked from commit 916610ef90a0d0761f08747f7b0905541f0977c7) + +Co-authored-by: Benjamin Peterson <benjamin@python.org> +Rebased for Python 2.7 by Michał Górny <mgorny@gentoo.org> +--- + Lib/ctypes/test/test_parameters.py | 43 +++++++++++++++++++ + .../2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst | 2 + + Modules/_ctypes/callproc.c | 49 +++++++++++----------- + 3 files changed, 69 insertions(+), 25 deletions(-) + create mode 100644 Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst + +diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py +index 23c1b6e225..3456882ccb 100644 +--- a/Lib/ctypes/test/test_parameters.py ++++ b/Lib/ctypes/test/test_parameters.py +@@ -206,6 +206,49 @@ class SimpleTypesTestCase(unittest.TestCase): + with self.assertRaises(ZeroDivisionError): + WorseStruct().__setstate__({}, b'foo') + ++ def test_parameter_repr(self): ++ from ctypes import ( ++ c_bool, ++ c_char, ++ c_wchar, ++ c_byte, ++ c_ubyte, ++ c_short, ++ c_ushort, ++ c_int, ++ c_uint, ++ c_long, ++ c_ulong, ++ c_longlong, ++ c_ulonglong, ++ c_float, ++ c_double, ++ c_longdouble, ++ c_char_p, ++ c_wchar_p, ++ c_void_p, ++ ) ++ self.assertRegexpMatches(repr(c_bool.from_param(True)), r"^<cparam '\?' at 0x[A-Fa-f0-9]+>$") ++ self.assertEqual(repr(c_char.from_param('a')), "<cparam 'c' (a)>") ++ self.assertRegexpMatches(repr(c_wchar.from_param('a')), r"^<cparam 'u' at 0x[A-Fa-f0-9]+>$") ++ self.assertEqual(repr(c_byte.from_param(98)), "<cparam 'b' (98)>") ++ self.assertEqual(repr(c_ubyte.from_param(98)), "<cparam 'B' (98)>") ++ self.assertEqual(repr(c_short.from_param(511)), "<cparam 'h' (511)>") ++ self.assertEqual(repr(c_ushort.from_param(511)), "<cparam 'H' (511)>") ++ self.assertRegexpMatches(repr(c_int.from_param(20000)), r"^<cparam '[li]' \(20000\)>$") ++ self.assertRegexpMatches(repr(c_uint.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$") ++ self.assertRegexpMatches(repr(c_long.from_param(20000)), r"^<cparam '[li]' \(20000\)>$") ++ self.assertRegexpMatches(repr(c_ulong.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$") ++ self.assertRegexpMatches(repr(c_longlong.from_param(20000)), r"^<cparam '[liq]' \(20000\)>$") ++ self.assertRegexpMatches(repr(c_ulonglong.from_param(20000)), r"^<cparam '[LIQ]' \(20000\)>$") ++ self.assertEqual(repr(c_float.from_param(1.5)), "<cparam 'f' (1.5)>") ++ self.assertEqual(repr(c_double.from_param(1.5)), "<cparam 'd' (1.5)>") ++ self.assertEqual(repr(c_double.from_param(1e300)), "<cparam 'd' (1e+300)>") ++ self.assertRegexpMatches(repr(c_longdouble.from_param(1.5)), r"^<cparam ('d' \(1.5\)|'g' at 0x[A-Fa-f0-9]+)>$") ++ self.assertRegexpMatches(repr(c_char_p.from_param(b'hihi')), "^<cparam 'z' \(0x[A-Fa-f0-9]+\)>$") ++ self.assertRegexpMatches(repr(c_wchar_p.from_param('hihi')), "^<cparam 'Z' \(0x[A-Fa-f0-9]+\)>$") ++ self.assertRegexpMatches(repr(c_void_p.from_param(0x12)), r"^<cparam 'P' \(0x0*12\)>$") ++ + ################################################################ + + if __name__ == '__main__': +diff --git a/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst +new file mode 100644 +index 0000000000..7df65a156f +--- /dev/null ++++ b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst +@@ -0,0 +1,2 @@ ++Avoid static buffers when computing the repr of :class:`ctypes.c_double` and ++:class:`ctypes.c_longdouble` values. +diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c +index 066fefc0cc..421addf353 100644 +--- a/Modules/_ctypes/callproc.c ++++ b/Modules/_ctypes/callproc.c +@@ -460,50 +460,51 @@ PyCArg_dealloc(PyCArgObject *self) + static PyObject * + PyCArg_repr(PyCArgObject *self) + { +- char buffer[256]; + switch(self->tag) { + case 'b': + case 'B': +- sprintf(buffer, "<cparam '%c' (%d)>", ++ return PyString_FromFormat("<cparam '%c' (%d)>", + self->tag, self->value.b); +- break; + case 'h': + case 'H': +- sprintf(buffer, "<cparam '%c' (%d)>", ++ return PyString_FromFormat("<cparam '%c' (%d)>", + self->tag, self->value.h); +- break; + case 'i': + case 'I': +- sprintf(buffer, "<cparam '%c' (%d)>", ++ return PyString_FromFormat("<cparam '%c' (%d)>", + self->tag, self->value.i); +- break; + case 'l': + case 'L': +- sprintf(buffer, "<cparam '%c' (%ld)>", ++ return PyString_FromFormat("<cparam '%c' (%ld)>", + self->tag, self->value.l); +- break; + + #ifdef HAVE_LONG_LONG + case 'q': + case 'Q': +- sprintf(buffer, ++ return PyString_FromFormat( + "<cparam '%c' (%" PY_FORMAT_LONG_LONG "d)>", + self->tag, self->value.q); +- break; + #endif + case 'd': +- sprintf(buffer, "<cparam '%c' (%f)>", +- self->tag, self->value.d); +- break; +- case 'f': +- sprintf(buffer, "<cparam '%c' (%f)>", +- self->tag, self->value.f); +- break; +- ++ case 'f': { ++ PyObject *f = PyFloat_FromDouble((self->tag == 'f') ? self->value.f : self->value.d); ++ if (f == NULL) { ++ return NULL; ++ } ++ PyObject *r = PyObject_Repr(f); ++ if (r == NULL) { ++ Py_DECREF(f); ++ return NULL; ++ } ++ PyObject *result = PyString_FromFormat( ++ "<cparam '%c' (%s)>", self->tag, PyString_AsString(r)); ++ Py_DECREF(r); ++ Py_DECREF(f); ++ return result; ++ } + case 'c': +- sprintf(buffer, "<cparam '%c' (%c)>", ++ return PyString_FromFormat("<cparam '%c' (%c)>", + self->tag, self->value.c); +- break; + + /* Hm, are these 'z' and 'Z' codes useful at all? + Shouldn't they be replaced by the functionality of c_string +@@ -512,16 +513,14 @@ PyCArg_repr(PyCArgObject *self) + case 'z': + case 'Z': + case 'P': +- sprintf(buffer, "<cparam '%c' (%p)>", ++ return PyString_FromFormat("<cparam '%c' (%p)>", + self->tag, self->value.p); + break; + + default: +- sprintf(buffer, "<cparam '%c' at %p>", ++ return PyString_FromFormat("<cparam '%c' at %p>", + self->tag, self); +- break; + } +- return PyString_FromString(buffer); + } + + static PyMemberDef PyCArgType_members[] = { +-- +cgit v1.2.3 + diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix index 2cfaa69a4c8..5ee88ebb881 100644 --- a/pkgs/development/interpreters/python/cpython/2.7/default.nix +++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, fetchpatch +{ lib, stdenv, fetchurl, fetchpatch , bzip2 , expat , libffi @@ -18,12 +18,20 @@ , ucsEncoding ? 4 # For the Python package set , packageOverrides ? (self: super: {}) -, buildPackages +, pkgsBuildBuild +, pkgsBuildHost +, pkgsBuildTarget +, pkgsHostHost +, pkgsTargetTarget , sourceVersion , sha256 , passthruFun , static ? false -, enableOptimizations ? (!stdenv.isDarwin) +, stripBytecode ? reproducibleBuild +, rebuildBytecode ? true +, reproducibleBuild ? true +, enableOptimizations ? false +, pythonAttr ? "python${sourceVersion.major}${sourceVersion.minor}" }: assert x11Support -> tcl != null @@ -31,11 +39,25 @@ assert x11Support -> tcl != null && xlibsWrapper != null && libX11 != null; -with stdenv.lib; +assert lib.assertMsg (enableOptimizations -> (!stdenv.cc.isClang)) + "Optimizations with clang are not supported. configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found."; + +assert lib.assertMsg (reproducibleBuild -> stripBytecode) + "Deterministic builds require stripping bytecode."; + +assert lib.assertMsg (reproducibleBuild -> (!enableOptimizations)) + "Deterministic builds are not achieved when optimizations are enabled."; + + +with lib; let + buildPackages = pkgsBuildHost; + inherit (passthru) pythonForBuild; - pythonForBuild = buildPackages.${"python${sourceVersion.major}${sourceVersion.minor}"}; + pythonForBuildInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then + "$out/bin/python" + else pythonForBuild.interpreter; passthru = passthruFun rec { inherit self sourceVersion packageOverrides; @@ -44,7 +66,12 @@ let executable = libPrefix; pythonVersion = with sourceVersion; "${major}.${minor}"; sitePackages = "lib/${libPrefix}/site-packages"; - inherit hasDistutilsCxxPatch pythonForBuild; + inherit hasDistutilsCxxPatch; + pythonOnBuildForBuild = pkgsBuildBuild.${pythonAttr}; + pythonOnBuildForHost = pkgsBuildHost.${pythonAttr}; + pythonOnBuildForTarget = pkgsBuildTarget.${pythonAttr}; + pythonOnHostForHost = pkgsHostHost.${pythonAttr}; + pythonOnTargetForTarget = pkgsTargetTarget.${pythonAttr} or {}; } // { inherit ucsEncoding; }; @@ -93,6 +120,17 @@ let # Patch is likely to go away in the next release (if there is any) ./CVE-2019-20907.patch + + ./CVE-2021-3177.patch + + ./CVE-2021-23336.patch + + # The workaround is for unittests on Win64, which we don't support. + # It does break aarch64-darwin, which we do support. See: + # * https://bugs.python.org/issue35523 + # * https://github.com/python/cpython/commit/e6b247c8e524 + ../3.7/no-win64-workaround.patch + ] ++ optionals (x11Support && stdenv.isDarwin) [ ./use-correct-tcl-tk-on-darwin.patch ] ++ optionals stdenv.isLinux [ @@ -104,6 +142,9 @@ let # libuuid, slowing down program startup a lot). ./no-ldconfig.patch + # Fix ctypes.util.find_library with gcc10. + ./find_library-gcc10.patch + ] ++ optionals stdenv.hostPlatform.isCygwin [ ./2.5.2-ctypes-util-find_library.patch ./2.5.2-tkinter-x11.patch @@ -202,7 +243,7 @@ let }; # Python 2.7 needs this - crossCompileEnv = stdenv.lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) + crossCompileEnv = lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) { _PYTHON_HOST_PLATFORM = stdenv.hostPlatform.config; }; # Build the basic Python interpreter without modules that have @@ -214,10 +255,10 @@ in with passthru; stdenv.mkDerivation ({ inherit src patches buildInputs nativeBuildInputs preConfigure configureFlags; - LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s"; + LDFLAGS = lib.optionalString (!stdenv.isDarwin) "-lgcc_s"; inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH; - NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2" + NIX_CFLAGS_COMPILE = optionalString (stdenv.targetPlatform.system == "x86_64-darwin") "-msse2" + optionalString stdenv.hostPlatform.isMusl " -DTHREAD_STACK_SIZE=0x100000"; DETERMINISTIC_BUILD = 1; @@ -250,14 +291,15 @@ in with passthru; stdenv.mkDerivation ({ # 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 stripBytecode '' + # Determinism: deterministic bytecode + # First we delete all old bytecode. + find $out -name "*.pyc" -delete + '' + optionalString rebuildBytecode '' + # Then, we build for the two optimization levels. + # We do not build unoptimized bytecode, because its not entirely deterministic yet. + 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 stdenv.hostPlatform.isCygwin '' cp libpython2.7.dll.a $out/lib ''; @@ -285,9 +327,9 @@ in with passthru; stdenv.mkDerivation ({ 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 ]; + license = lib.licenses.psfl; + platforms = lib.platforms.all; + maintainers = with 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; diff --git a/pkgs/development/interpreters/python/cpython/2.7/find_library-gcc10.patch b/pkgs/development/interpreters/python/cpython/2.7/find_library-gcc10.patch new file mode 100644 index 00000000000..4627baf119c --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/2.7/find_library-gcc10.patch @@ -0,0 +1,79 @@ +Backport https://github.com/python/cpython/commit/82df3b3071bb003247c33eac4670775e9883c994 +and https://github.com/python/cpython/commit/27ac19cca2c639caaf6fedf3632fe6beb265f24f + +Fixes the check phase of python2Packages.cffi. + +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -87,6 +87,12 @@ elif os.name == "posix": + # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump + import re, tempfile, errno + ++ def _is_elf(filename): ++ "Return True if the given file is an ELF file" ++ elf_header = b'\x7fELF' ++ with open(filename, 'rb') as thefile: ++ return thefile.read(4) == elf_header ++ + 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 +@@ -110,10 +116,17 @@ elif os.name == "posix": + # the normal behaviour of GCC if linking fails + if e.errno != errno.ENOENT: + raise +- res = re.search(expr, trace) ++ res = re.findall(expr, trace) + if not res: + return None +- return res.group(0) ++ ++ for file in res: ++ # Check if the given file is an elf file: gcc can report ++ # some files that are linker scripts and not actual ++ # shared objects. See bpo-41976 for more details ++ if not _is_elf(file): ++ continue ++ return file + + + if sys.platform == "sunos5": +@@ -237,8 +250,37 @@ 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.findall(expr, out) ++ for file in res: ++ # Check if the given file is an elf file: gcc can report ++ # some files that are linker scripts and not actual ++ # shared objects. See bpo-41976 for more details ++ if not _is_elf(file): ++ continue ++ return file ++ except Exception: ++ 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 _get_soname(_findLib_ld(name)) + + ################################################################ + # test code diff --git a/pkgs/development/interpreters/python/cpython/3.10/no-ldconfig.patch b/pkgs/development/interpreters/python/cpython/3.10/no-ldconfig.patch new file mode 100644 index 00000000000..c259aed72b9 --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.10/no-ldconfig.patch @@ -0,0 +1,107 @@ +From 084c6dd6352077e64f10cf7aa168f95d800f3819 Mon Sep 17 00:00:00 2001 +From: Jonathan Ringer <jonringer117@gmail.com> +Date: Mon, 9 Nov 2020 10:24:35 -0800 +Subject: [PATCH] CPython: Don't use ldconfig + +--- + Lib/ctypes/util.py | 77 ++-------------------------------------------- + 1 file changed, 2 insertions(+), 75 deletions(-) + +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 0c2510e..7fb98af 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -100,53 +100,7 @@ elif os.name == "posix": + return thefile.read(4) == elf_header + + 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.findall(expr, trace) +- if not res: +- return None +- +- for file in res: +- # Check if the given file is an elf file: gcc can report +- # some files that are linker scripts and not actual +- # shared objects. See bpo-41976 for more details +- if not _is_elf(file): +- continue +- return os.fsdecode(file) ++ return None + + + if sys.platform == "sunos5": +@@ -268,34 +222,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.28.0 + diff --git a/pkgs/development/interpreters/python/cpython/3.6/find_library.patch b/pkgs/development/interpreters/python/cpython/3.6/find_library.patch new file mode 100644 index 00000000000..97fb66662d0 --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.6/find_library.patch @@ -0,0 +1,105 @@ +From 9b5a023a5dc3127da15253f7acad71019395ebe1 Mon Sep 17 00:00:00 2001 +From: Pablo Galindo <Pablogsal@gmail.com> +Date: Thu, 8 Oct 2020 19:50:37 +0100 +Subject: [PATCH] [3.7] bpo-41976: Fix the fallback to gcc of + ctypes.util.find_library when using gcc>9 (GH-22598). (GH-22601) + +(cherry picked from commit 27ac19cca2c639caaf6fedf3632fe6beb265f24f) + +Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> +--- + Lib/ctypes/test/test_find.py | 12 ++++++- + Lib/ctypes/util.py | 32 +++++++++++++++---- + .../2020-10-08-18-22-28.bpo-41976.Svm0wb.rst | 3 ++ + 3 files changed, 39 insertions(+), 8 deletions(-) + create mode 100644 Misc/NEWS.d/next/Library/2020-10-08-18-22-28.bpo-41976.Svm0wb.rst + +diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py +index b99fdcba7b28f..92ac1840ad7d4 100644 +--- a/Lib/ctypes/test/test_find.py ++++ b/Lib/ctypes/test/test_find.py +@@ -1,4 +1,5 @@ + import unittest ++import unittest.mock + import os.path + import sys + import test.support +@@ -72,7 +73,7 @@ def test_shell_injection(self): + + @unittest.skipUnless(sys.platform.startswith('linux'), + 'Test only valid for Linux') +-class LibPathFindTest(unittest.TestCase): ++class FindLibraryLinux(unittest.TestCase): + def test_find_on_libpath(self): + import subprocess + import tempfile +@@ -111,6 +112,15 @@ def test_find_on_libpath(self): + # LD_LIBRARY_PATH) + self.assertEqual(find_library(libname), 'lib%s.so' % libname) + ++ def test_find_library_with_gcc(self): ++ with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None): ++ self.assertNotEqual(find_library('c'), None) ++ ++ def test_find_library_with_ld(self): ++ with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None), \ ++ unittest.mock.patch("ctypes.util._findLib_gcc", lambda *args: None): ++ self.assertNotEqual(find_library('c'), None) ++ + + if __name__ == "__main__": + unittest.main() +diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py +index 97973bce001d9..0c2510e1619c8 100644 +--- a/Lib/ctypes/util.py ++++ b/Lib/ctypes/util.py +@@ -93,6 +93,12 @@ def find_library(name): + # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump + import re, tempfile + ++ def _is_elf(filename): ++ "Return True if the given file is an ELF file" ++ elf_header = b'\x7fELF' ++ with open(filename, 'br') as thefile: ++ return thefile.read(4) == elf_header ++ + 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 +@@ -299,17 +312,22 @@ def _findLib_ld(name): + 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: ++ res = re.findall(expr, os.fsdecode(out)) ++ for file in res: ++ # Check if the given file is an elf file: gcc can report ++ # some files that are linker scripts and not actual ++ # shared objects. See bpo-41976 for more details ++ if not _is_elf(file): ++ continue ++ return os.fsdecode(file) ++ except Exception: + pass # result will be None + return result + + def find_library(name): + # See issue #9998 + return _findSoname_ldconfig(name) or \ +- _get_soname(_findLib_gcc(name) or _findLib_ld(name)) ++ _get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name)) + + ################################################################ + # test code +diff --git a/Misc/NEWS.d/next/Library/2020-10-08-18-22-28.bpo-41976.Svm0wb.rst b/Misc/NEWS.d/next/Library/2020-10-08-18-22-28.bpo-41976.Svm0wb.rst +new file mode 100644 +index 0000000000000..c8b3fc771845e +--- /dev/null ++++ b/Misc/NEWS.d/next/Library/2020-10-08-18-22-28.bpo-41976.Svm0wb.rst +@@ -0,0 +1,3 @@ ++Fixed a bug that was causing :func:`ctypes.util.find_library` to return ++``None`` when triying to locate a library in an environment when gcc>=9 is ++available and ``ldconfig`` is not. Patch by Pablo Galindo diff --git a/pkgs/development/interpreters/python/cpython/3.6/fix-finding-headers-when-cross-compiling.patch b/pkgs/development/interpreters/python/cpython/3.6/fix-finding-headers-when-cross-compiling.patch new file mode 100644 index 00000000000..d324d10b39f --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.6/fix-finding-headers-when-cross-compiling.patch @@ -0,0 +1,54 @@ +From 45dfbbb4f5b67ab83e4365564ea569334e979f8e Mon Sep 17 00:00:00 2001 +From: Ben Wolsieffer <benwolsieffer@gmail.com> +Date: Fri, 25 Sep 2020 16:49:16 -0400 +Subject: [PATCH] Fix finding headers when cross compiling + +When cross-compiling third-party extensions, get_python_inc() may be called to +return the path to Python's headers. However, it uses the sys.prefix or +sys.exec_prefix of the build Python, which returns incorrect paths when +cross-compiling (paths pointing to build system headers). + +To fix this, we use the INCLUDEPY and CONFINCLUDEPY conf variables, which can +be configured to point at host Python by setting _PYTHON_SYSCONFIGDATA_NAME. +The existing behavior is maintained on non-POSIX platforms or if a prefix is +manually specified. +--- + Lib/distutils/sysconfig.py | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 2bcd1dd288..567375e488 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -84,8 +84,6 @@ def get_python_inc(plat_specific=0, prefix=None): + If 'prefix' is supplied, use it instead of sys.base_prefix or + sys.base_exec_prefix -- i.e., ignore 'plat_specific'. + """ +- if prefix is None: +- prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX + if os.name == "posix": + if python_build: + # Assume the executable is in the build directory. The +@@ -98,9 +96,17 @@ def get_python_inc(plat_specific=0, prefix=None): + else: + incdir = os.path.join(get_config_var('srcdir'), 'Include') + return os.path.normpath(incdir) +- python_dir = 'python' + get_python_version() + build_flags +- return os.path.join(prefix, "include", python_dir) ++ if prefix is None: ++ if plat_specific: ++ return get_config_var('CONFINCLUDEPY') ++ else: ++ return get_config_var('INCLUDEPY') ++ else: ++ python_dir = 'python' + get_python_version() + build_flags ++ return os.path.join(prefix, "include", python_dir) + elif os.name == "nt": ++ if prefix is None: ++ prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX + return os.path.join(prefix, "include") + else: + raise DistutilsPlatformError( +-- +2.28.0 + diff --git a/pkgs/development/interpreters/python/cpython/3.7/fix-finding-headers-when-cross-compiling.patch b/pkgs/development/interpreters/python/cpython/3.7/fix-finding-headers-when-cross-compiling.patch new file mode 100644 index 00000000000..543e267e94b --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.7/fix-finding-headers-when-cross-compiling.patch @@ -0,0 +1,54 @@ +From debccd4be0a8d619770f63622d9de1b451dd02ac Mon Sep 17 00:00:00 2001 +From: Ben Wolsieffer <benwolsieffer@gmail.com> +Date: Fri, 25 Sep 2020 16:49:16 -0400 +Subject: [PATCH] Fix finding headers when cross compiling + +When cross-compiling third-party extensions, get_python_inc() may be called to +return the path to Python's headers. However, it uses the sys.prefix or +sys.exec_prefix of the build Python, which returns incorrect paths when +cross-compiling (paths pointing to build system headers). + +To fix this, we use the INCLUDEPY and CONFINCLUDEPY conf variables, which can +be configured to point at host Python by setting _PYTHON_SYSCONFIGDATA_NAME. +The existing behavior is maintained on non-POSIX platforms or if a prefix is +manually specified. +--- + Lib/distutils/sysconfig.py | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py +index 37feae5df7..6d4ad06696 100644 +--- a/Lib/distutils/sysconfig.py ++++ b/Lib/distutils/sysconfig.py +@@ -95,8 +95,6 @@ def get_python_inc(plat_specific=0, prefix=None): + If 'prefix' is supplied, use it instead of sys.base_prefix or + sys.base_exec_prefix -- i.e., ignore 'plat_specific'. + """ +- if prefix is None: +- prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX + if os.name == "posix": + if python_build: + # Assume the executable is in the build directory. The +@@ -109,9 +107,17 @@ def get_python_inc(plat_specific=0, prefix=None): + else: + incdir = os.path.join(get_config_var('srcdir'), 'Include') + return os.path.normpath(incdir) +- python_dir = 'python' + get_python_version() + build_flags +- return os.path.join(prefix, "include", python_dir) ++ if prefix is None: ++ if plat_specific: ++ return get_config_var('CONFINCLUDEPY') ++ else: ++ return get_config_var('INCLUDEPY') ++ else: ++ python_dir = 'python' + get_python_version() + build_flags ++ return os.path.join(prefix, "include", python_dir) + elif os.name == "nt": ++ if prefix is None: ++ prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX + if python_build: + # Include both the include and PC dir to ensure we can find + # pyconfig.h +-- +2.28.0 + diff --git a/pkgs/development/interpreters/python/cpython/3.7/no-ldconfig.patch b/pkgs/development/interpreters/python/cpython/3.7/no-ldconfig.patch index a1f9d68eb16..4324fc5ea61 100644 --- a/pkgs/development/interpreters/python/cpython/3.7/no-ldconfig.patch +++ b/pkgs/development/interpreters/python/cpython/3.7/no-ldconfig.patch @@ -1,18 +1,18 @@ -From 597e73f2a4b2f0b508127931b36d5540d6941823 Mon Sep 17 00:00:00 2001 +From ba458f33f335b217d078fdce56e9c6f9f93adb49 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(-) + Lib/ctypes/util.py | 78 ++-------------------------------------------- + 1 file changed, 2 insertions(+), 76 deletions(-) diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py -index 5e8b31a854..7b45ce6c15 100644 +index 0c2510e..79635a8 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py -@@ -94,46 +94,7 @@ elif os.name == "posix": - import re, tempfile +@@ -100,54 +100,7 @@ elif os.name == "posix": + return thefile.read(4) == elf_header def _findLib_gcc(name): - # Run GCC's linker with the -t (aka --trace) option and examine the @@ -51,15 +51,23 @@ index 5e8b31a854..7b45ce6c15 100644 - # Raised if the file was already removed, which is the normal - # behaviour of GCC if linking fails - pass -- res = re.search(expr, trace) +- res = re.findall(expr, trace) - if not res: - return None -- return os.fsdecode(res.group(0)) +- +- for file in res: +- # Check if the given file is an elf file: gcc can report +- # some files that are linker scripts and not actual +- # shared objects. See bpo-41976 for more details +- if not _is_elf(file): +- continue +- return os.fsdecode(file) +- + return None - if sys.platform == "sunos5": -@@ -255,34 +216,7 @@ elif os.name == "posix": + # use /usr/ccs/bin/dump on solaris +@@ -268,34 +221,7 @@ elif os.name == "posix": else: def _findSoname_ldconfig(name): @@ -96,5 +104,5 @@ index 5e8b31a854..7b45ce6c15 100644 def _findLib_ld(name): # See issue #9998 for why this is needed -- -2.15.0 +2.30.0 diff --git a/pkgs/development/interpreters/python/cpython/3.7/no-win64-workaround.patch b/pkgs/development/interpreters/python/cpython/3.7/no-win64-workaround.patch new file mode 100644 index 00000000000..685b1e83944 --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/3.7/no-win64-workaround.patch @@ -0,0 +1,37 @@ +From e6b247c8e524dbe5fc03b3492f628d0d5348bc49 Mon Sep 17 00:00:00 2001 +From: Victor Stinner <vstinner@redhat.com> +Date: Tue, 18 Dec 2018 14:47:21 +0100 +Subject: [PATCH] bpo-35523: Remove ctypes callback workaround (GH-11211) + +Remove ctypes callback workaround: no longer create a callback at startup. +Avoid SELinux alert on "import ctypes" and "import uuid". +--- + Lib/ctypes/__init__.py | 5 ----- + .../next/Library/2018-12-18-13-52-13.bpo-35523.SkoMno.rst | 2 ++ + 2 files changed, 2 insertions(+), 5 deletions(-) + create mode 100644 Misc/NEWS.d/next/Library/2018-12-18-13-52-13.bpo-35523.SkoMno.rst + +diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py +index 6146773988648..5f78beda5866e 100644 +--- a/Lib/ctypes/__init__.py ++++ b/Lib/ctypes/__init__.py +@@ -266,11 +266,6 @@ def _reset_cache(): + # _SimpleCData.c_char_p_from_param + POINTER(c_char).from_param = c_char_p.from_param + _pointer_type_cache[None] = c_void_p +- # XXX for whatever reasons, creating the first instance of a callback +- # function is needed for the unittests on Win64 to succeed. This MAY +- # be a compiler bug, since the problem occurs only when _ctypes is +- # compiled with the MS SDK compiler. Or an uninitialized variable? +- CFUNCTYPE(c_int)(lambda: None) + + def create_unicode_buffer(init, size=None): + """create_unicode_buffer(aString) -> character array +diff --git a/Misc/NEWS.d/next/Library/2018-12-18-13-52-13.bpo-35523.SkoMno.rst b/Misc/NEWS.d/next/Library/2018-12-18-13-52-13.bpo-35523.SkoMno.rst +new file mode 100644 +index 0000000000000..94a9fd257383e +--- /dev/null ++++ b/Misc/NEWS.d/next/Library/2018-12-18-13-52-13.bpo-35523.SkoMno.rst +@@ -0,0 +1,2 @@ ++Remove :mod:`ctypes` callback workaround: no longer create a callback at ++startup. Avoid SELinux alert on ``import ctypes`` and ``import uuid``. diff --git a/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch b/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch index a1f9d68eb16..41d3ab52345 100644 --- a/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch +++ b/pkgs/development/interpreters/python/cpython/3.8/no-ldconfig.patch @@ -1,19 +1,19 @@ -From 597e73f2a4b2f0b508127931b36d5540d6941823 Mon Sep 17 00:00:00 2001 -From: Frederik Rietdijk <fridh@fridh.nl> -Date: Mon, 28 Aug 2017 09:24:06 +0200 +From 66f492d2eda94bd64db833839a325caf6ba0fed5 Mon Sep 17 00:00:00 2001 +From: Greg Roodt <greg@canva.com> +Date: Wed, 9 Dec 2020 17:59:24 +1100 Subject: [PATCH] Don't use ldconfig --- - Lib/ctypes/util.py | 70 ++---------------------------------------------------- - 1 file changed, 2 insertions(+), 68 deletions(-) + Lib/ctypes/util.py | 77 ++-------------------------------------------- + 1 file changed, 2 insertions(+), 75 deletions(-) diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py -index 5e8b31a854..7b45ce6c15 100644 +index 0c2510e161..7fb98af308 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py -@@ -94,46 +94,7 @@ elif os.name == "posix": - import re, tempfile - +@@ -100,53 +100,7 @@ elif os.name == "posix": + return thefile.read(4) == elf_header + 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 @@ -51,17 +51,24 @@ index 5e8b31a854..7b45ce6c15 100644 - # Raised if the file was already removed, which is the normal - # behaviour of GCC if linking fails - pass -- res = re.search(expr, trace) +- res = re.findall(expr, trace) - if not res: - return None -- return os.fsdecode(res.group(0)) +- +- for file in res: +- # Check if the given file is an elf file: gcc can report +- # some files that are linker scripts and not actual +- # shared objects. See bpo-41976 for more details +- if not _is_elf(file): +- continue +- return os.fsdecode(file) + return None - - + + if sys.platform == "sunos5": -@@ -255,34 +216,7 @@ elif os.name == "posix": +@@ -268,34 +222,7 @@ elif os.name == "posix": else: - + def _findSoname_ldconfig(name): - import struct - if struct.calcsize('l') == 4: @@ -92,9 +99,8 @@ index 5e8b31a854..7b45ce6c15 100644 - except OSError: - pass + return None - + def _findLib_ld(name): # See issue #9998 for why this is needed --- -2.15.0 - +-- +2.24.3 (Apple Git-128) diff --git a/pkgs/development/interpreters/python/cpython/3.9/no-ldconfig.patch b/pkgs/development/interpreters/python/cpython/3.9/no-ldconfig.patch index a1f9d68eb16..41d3ab52345 100644 --- a/pkgs/development/interpreters/python/cpython/3.9/no-ldconfig.patch +++ b/pkgs/development/interpreters/python/cpython/3.9/no-ldconfig.patch @@ -1,19 +1,19 @@ -From 597e73f2a4b2f0b508127931b36d5540d6941823 Mon Sep 17 00:00:00 2001 -From: Frederik Rietdijk <fridh@fridh.nl> -Date: Mon, 28 Aug 2017 09:24:06 +0200 +From 66f492d2eda94bd64db833839a325caf6ba0fed5 Mon Sep 17 00:00:00 2001 +From: Greg Roodt <greg@canva.com> +Date: Wed, 9 Dec 2020 17:59:24 +1100 Subject: [PATCH] Don't use ldconfig --- - Lib/ctypes/util.py | 70 ++---------------------------------------------------- - 1 file changed, 2 insertions(+), 68 deletions(-) + Lib/ctypes/util.py | 77 ++-------------------------------------------- + 1 file changed, 2 insertions(+), 75 deletions(-) diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py -index 5e8b31a854..7b45ce6c15 100644 +index 0c2510e161..7fb98af308 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py -@@ -94,46 +94,7 @@ elif os.name == "posix": - import re, tempfile - +@@ -100,53 +100,7 @@ elif os.name == "posix": + return thefile.read(4) == elf_header + 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 @@ -51,17 +51,24 @@ index 5e8b31a854..7b45ce6c15 100644 - # Raised if the file was already removed, which is the normal - # behaviour of GCC if linking fails - pass -- res = re.search(expr, trace) +- res = re.findall(expr, trace) - if not res: - return None -- return os.fsdecode(res.group(0)) +- +- for file in res: +- # Check if the given file is an elf file: gcc can report +- # some files that are linker scripts and not actual +- # shared objects. See bpo-41976 for more details +- if not _is_elf(file): +- continue +- return os.fsdecode(file) + return None - - + + if sys.platform == "sunos5": -@@ -255,34 +216,7 @@ elif os.name == "posix": +@@ -268,34 +222,7 @@ elif os.name == "posix": else: - + def _findSoname_ldconfig(name): - import struct - if struct.calcsize('l') == 4: @@ -92,9 +99,8 @@ index 5e8b31a854..7b45ce6c15 100644 - except OSError: - pass + return None - + def _findLib_ld(name): # See issue #9998 for why this is needed --- -2.15.0 - +-- +2.24.3 (Apple Git-128) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index b25d613eb7f..f52255f4748 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -1,9 +1,10 @@ -{ stdenv, fetchurl, fetchpatch +{ lib, stdenv, fetchurl, fetchpatch , bzip2 , expat , libffi , gdbm -, lzma +, xz +, mime-types ? null, mimetypesSupport ? true , ncurses , openssl , readline @@ -11,15 +12,20 @@ , tcl ? null, tk ? null, tix ? null, libX11 ? null, xorgproto ? null, x11Support ? false , bluez ? null, bluezSupport ? false , zlib +, tzdata ? null , self , configd , autoreconfHook +, autoconf-archive , python-setup-hook , nukeReferences # For the Python package set , packageOverrides ? (self: super: {}) -, buildPackages -, pythonForBuild ? buildPackages.${"python${sourceVersion.major}${sourceVersion.minor}"} +, pkgsBuildBuild +, pkgsBuildHost +, pkgsBuildTarget +, pkgsHostHost +, pkgsTargetTarget , sourceVersion , sha256 , passthruFun @@ -29,12 +35,19 @@ , stripTests ? false , stripTkinter ? false , rebuildBytecode ? true -, stripBytecode ? false +, stripBytecode ? reproducibleBuild , 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) +, static ? stdenv.hostPlatform.isStatic +, enableOptimizations ? false +# enableNoSemanticInterposition is a subset of the enableOptimizations flag that doesn't harm reproducibility. +# clang starts supporting `-fno-sematic-interposition` with version 10 +, enableNoSemanticInterposition ? (!stdenv.cc.isClang || (stdenv.cc.isClang && lib.versionAtLeast stdenv.cc.version "10")) +# enableLTO is a subset of the enableOptimizations flag that doesn't harm reproducibility. +# enabling LTO on 32bit arch causes downstream packages to fail when linking +# enabling LTO on *-darwin causes python3 to fail when linking. +, enableLTO ? stdenv.is64bit && stdenv.isLinux +, reproducibleBuild ? true +, pythonAttr ? "python${sourceVersion.major}${sourceVersion.minor}" }: # Note: this package is used for bootstrapping fetchurl, and thus @@ -49,9 +62,24 @@ assert x11Support -> tcl != null assert bluezSupport -> bluez != null; -with stdenv.lib; +assert mimetypesSupport -> mime-types != null; + +assert lib.assertMsg (enableOptimizations -> (!stdenv.cc.isClang)) + "Optimizations with clang are not supported. configure: error: llvm-profdata is required for a --enable-optimizations build but could not be found."; + +assert lib.assertMsg (reproducibleBuild -> stripBytecode) + "Deterministic builds require stripping bytecode."; + +assert lib.assertMsg (reproducibleBuild -> (!enableOptimizations)) + "Deterministic builds are not achieved when optimizations are enabled."; + +with lib; let + buildPackages = pkgsBuildHost; + inherit (passthru) pythonForBuild; + + tzdataSupport = tzdata != null && passthru.pythonAtLeast "3.9"; passthru = passthruFun rec { inherit self sourceVersion packageOverrides; @@ -60,34 +88,92 @@ let executable = libPrefix; pythonVersion = with sourceVersion; "${major}.${minor}"; sitePackages = "lib/${libPrefix}/site-packages"; - inherit hasDistutilsCxxPatch pythonForBuild; + inherit hasDistutilsCxxPatch; + pythonOnBuildForBuild = pkgsBuildBuild.${pythonAttr}; + pythonOnBuildForHost = pkgsBuildHost.${pythonAttr}; + pythonOnBuildForTarget = pkgsBuildTarget.${pythonAttr}; + pythonOnHostForHost = pkgsHostHost.${pythonAttr}; + pythonOnTargetForTarget = pkgsTargetTarget.${pythonAttr} or {}; }; version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; nativeBuildInputs = optionals (!stdenv.isDarwin) [ autoreconfHook + ] ++ optionals (!stdenv.isDarwin && passthru.pythonAtLeast "3.10") [ + autoconf-archive # needed for AX_CHECK_COMPILE_FLAG ] ++ [ nukeReferences ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ buildPackages.stdenv.cc pythonForBuild + ] ++ optionals (stdenv.cc.isClang && enableLTO) [ + stdenv.cc.cc.libllvm.out ]; buildInputs = filter (p: p != null) ([ - zlib bzip2 expat lzma libffi gdbm sqlite readline ncurses openssl ] + zlib bzip2 expat xz libffi gdbm sqlite readline ncurses openssl ] ++ optionals x11Support [ tcl tk libX11 xorgproto ] ++ optionals (bluezSupport && stdenv.isLinux) [ bluez ] - ++ optionals stdenv.isDarwin [ configd ]); + ++ optionals stdenv.isDarwin [ configd ]) + ++ optionals tzdataSupport [ tzdata ]; # `zoneinfo` module hasDistutilsCxxPatch = !(stdenv.cc.isGNU or false); - inherit pythonForBuild; - pythonForBuildInterpreter = if stdenv.hostPlatform == stdenv.buildPlatform then "$out/bin/python" else pythonForBuild.interpreter; + # The CPython interpreter contains a _sysconfigdata_<platform specific suffix> + # module that is imported by the sysconfig and distutils.sysconfig modules. + # The sysconfigdata module is generated at build time and contains settings + # required for building Python extension modules, such as include paths and + # other compiler flags. By default, the sysconfigdata module is loaded from + # the currently running interpreter (ie. the build platform interpreter), but + # when cross-compiling we want to load it from the host platform interpreter. + # This can be done using the _PYTHON_SYSCONFIGDATA_NAME environment variable. + # The _PYTHON_HOST_PLATFORM variable also needs to be set to get the correct + # platform suffix on extension modules. The correct values for these variables + # are not documented, and must be derived from the configure script (see links + # below). + sysconfigdataHook = with stdenv.hostPlatform; with passthru; let + # https://github.com/python/cpython/blob/e488e300f5c01289c10906c2e53a8e43d6de32d8/configure.ac#L428 + # The configure script uses "arm" as the CPU name for all 32-bit ARM + # variants when cross-compiling, but native builds include the version + # suffix, so we do the same. + pythonHostPlatform = "${parsed.kernel.name}-${parsed.cpu.name}"; + + # https://github.com/python/cpython/blob/e488e300f5c01289c10906c2e53a8e43d6de32d8/configure.ac#L724 + multiarchCpu = + if isAarch32 then + if parsed.cpu.significantByte.name == "littleEndian" then "arm" else "armeb" + else if isx86_32 then "i386" + else parsed.cpu.name; + pythonAbiName = + # python's build doesn't differentiate between musl and glibc in its + # abi detection, our wrapper should match. + if stdenv.hostPlatform.isMusl then + replaceStrings [ "musl" ] [ "gnu" ] parsed.abi.name + else parsed.abi.name; + multiarch = + if isDarwin then "darwin" + else "${multiarchCpu}-${parsed.kernel.name}-${pythonAbiName}"; + + abiFlags = optionalString (isPy36 || isPy37) "m"; + + # https://github.com/python/cpython/blob/e488e300f5c01289c10906c2e53a8e43d6de32d8/configure.ac#L78 + pythonSysconfigdataName = "_sysconfigdata_${abiFlags}_${parsed.kernel.name}_${multiarch}"; + in '' + sysconfigdataHook() { + if [ "$1" = '${placeholder "out"}' ]; then + export _PYTHON_HOST_PLATFORM='${pythonHostPlatform}' + export _PYTHON_SYSCONFIGDATA_NAME='${pythonSysconfigdataName}' + fi + } + + addEnvHooks "$hostOffset" sysconfigdataHook + ''; + in with passthru; stdenv.mkDerivation { pname = "python3"; inherit version; @@ -113,6 +199,13 @@ in with passthru; stdenv.mkDerivation { # (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") + # Make sure that the virtualenv activation scripts are + # owner-writable, so venvs can be recreated without permission + # errors. + ./virtualenv-permissions.patch + ] ++ optionals mimetypesSupport [ + # Make the mimetypes module refer to the right file + ./mimetypes.patch ] ++ optionals (isPy35 || isPy36) [ # Determinism: Write null timestamps when compiling python files. ./3.5/force_bytecode_determinism.patch @@ -123,7 +216,12 @@ in with passthru; stdenv.mkDerivation { # 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) [ + # The workaround is for unittests on Win64, which we don't support. + # It does break aarch64-darwin, which we do support. See: + # * https://bugs.python.org/issue35523 + # * https://github.com/python/cpython/commit/e6b247c8e524 + ./3.7/no-win64-workaround.patch + ] ++ optionals (pythonAtLeast "3.7") [ # Fix darwin build https://bugs.python.org/issue34027 ./3.7/darwin-libutil.patch ] ++ optionals (pythonOlder "3.8") [ @@ -142,7 +240,7 @@ in with passthru; stdenv.mkDerivation { ( if isPy35 then ./3.5/python-3.x-distutils-C++.patch - else if isPy37 || isPy38 || isPy39 then + else if pythonAtLeast "3.7" then ./3.7/python-3.x-distutils-C++.patch else fetchpatch { @@ -153,11 +251,24 @@ in with passthru; stdenv.mkDerivation { ] ++ [ # 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 + # Use sysconfigdata to find headers. Fixes cross-compilation of extension modules. + ( + if isPy36 then + ./3.6/fix-finding-headers-when-cross-compiling.patch + else + ./3.7/fix-finding-headers-when-cross-compiling.patch + ) + ] ++ optionals (isPy36) [ + # Backport a fix for ctypes.util.find_library. + ./3.6/find_library.patch ]; postPatch = '' substituteInPlace Lib/subprocess.py \ --replace "'/bin/sh'" "'${bash}/bin/sh'" + '' + optionalString mimetypesSupport '' + substituteInPlace Lib/mimetypes.py \ + --replace "@mime-types@" "${mime-types}" '' + optionalString (x11Support && (tix != null)) '' substituteInPlace "Lib/tkinter/tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'" ''; @@ -176,6 +287,8 @@ in with passthru; stdenv.mkDerivation { "--with-system-ffi" ] ++ optionals enableOptimizations [ "--enable-optimizations" + ] ++ optionals enableLTO [ + "--with-lto" ] ++ optionals (pythonOlder "3.7") [ # This is unconditionally true starting in CPython 3.7. "--with-threads" @@ -208,6 +321,8 @@ in with passthru; stdenv.mkDerivation { # Never even try to use lchmod on linux, # don't rely on detecting glibc-isms. "ac_cv_func_lchmod=no" + ] ++ optionals tzdataSupport [ + "--with-tzpath=${tzdata}/share/zoneinfo" ] ++ optional static "LDFLAGS=-static"; preConfigure = '' @@ -223,11 +338,29 @@ in with passthru; stdenv.mkDerivation { export DETERMINISTIC_BUILD=1; '' + optionalString stdenv.hostPlatform.isMusl '' export NIX_CFLAGS_COMPILE+=" -DTHREAD_STACK_SIZE=0x100000" + '' + + + # enableNoSemanticInterposition essentially sets that CFLAG -fno-semantic-interposition + # which changes how symbols are looked up. This essentially means we can't override + # libpython symbols via LD_PRELOAD anymore. This is common enough as every build + # that uses --enable-optimizations has the same "issue". + # + # The Fedora wiki has a good article about their journey towards enabling this flag: + # https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup + optionalString enableNoSemanticInterposition '' + export CFLAGS_NODIST="-fno-semantic-interposition" ''; setupHook = python-setup-hook sitePackages; - postInstall = '' + postInstall = let + # References *not* to nuke from (sys)config files + keep-references = concatMapStringsSep " " (val: "-e ${val}") ([ + (placeholder "out") + ] ++ optionals tzdataSupport [ + tzdata + ]); + in '' # needed for some packages, especially packages that backport functionality # to 2.x from 3.x for item in $out/lib/${libPrefix}/test/*; do @@ -263,9 +396,13 @@ in with passthru; stdenv.mkDerivation { 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 '{}' + + find $out/lib/python*/config-* -type f -print -exec nuke-refs ${keep-references} '{}' + + find $out/lib -name '_sysconfigdata*.py*' -print -exec nuke-refs ${keep-references} '{}' + + # Make the sysconfigdata module accessible on PYTHONPATH + # This allows build Python to import host Python's sysconfigdata + mkdir -p "$out/${sitePackages}" + ln -s "$out/lib/${libPrefix}/"_sysconfigdata*.py "$out/${sitePackages}/" '' + optionalString stripConfig '' rm -R $out/bin/python*-config $out/lib/python*/config-* '' + optionalString stripIdlelib '' @@ -279,44 +416,44 @@ in with passthru; stdenv.mkDerivation { '' + 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 + '' + optionalString stripBytecode '' + # Determinism: deterministic bytecode + # First we delete all old bytecode. + find $out -type d -name __pycache__ -print0 | xargs -0 -I {} rm -rf "{}" + '' + optionalString rebuildBytecode '' + # Then, we build for the two optimization levels. + # We do not build unoptimized bytecode, because its not entirely deterministic yet. # 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 - + # compileall uses this checked-hash method by default when `SOURCE_DATE_EPOCH` is set. + # We exclude lib2to3 because that's Python 2 code which fails 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) '' + preFixup = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' # Ensure patch-shebangs uses shebangs of host interpreter. - export PATH=${stdenv.lib.makeBinPath [ "$out" bash ]}:$PATH + export PATH=${lib.makeBinPath [ "$out" bash ]}:$PATH + ''; + + # Add CPython specific setup-hook that configures distutils.sysconfig to + # always load sysconfigdata from host Python. + postFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' + cat << "EOF" >> "$out/nix-support/setup-hook" + ${sysconfigdataHook} + EOF ''; # 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) [ + lib.optionals (openssl != null && !static) [ openssl.dev ] + ++ 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; diff --git a/pkgs/development/interpreters/python/cpython/mimetypes.patch b/pkgs/development/interpreters/python/cpython/mimetypes.patch new file mode 100644 index 00000000000..4ea700a1f2a --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/mimetypes.patch @@ -0,0 +1,23 @@ +diff --git i/Lib/mimetypes.py w/Lib/mimetypes.py +index f3343c8..ab5b886 100644 +--- i/Lib/mimetypes.py ++++ w/Lib/mimetypes.py +@@ -40,16 +40,8 @@ + ] + + knownfiles = [ +- "/etc/mime.types", +- "/etc/httpd/mime.types", # Mac OS X +- "/etc/httpd/conf/mime.types", # Apache +- "/etc/apache/mime.types", # Apache 1 +- "/etc/apache2/mime.types", # Apache 2 +- "/usr/local/etc/httpd/conf/mime.types", +- "/usr/local/lib/netscape/mime.types", +- "/usr/local/etc/httpd/conf/mime.types", # Apache 1.2 +- "/usr/local/etc/mime.types", # Apache 1.3 +- ] ++ "@mime-types@/etc/mime.types", ++] + + inited = False + _db = None diff --git a/pkgs/development/interpreters/python/cpython/virtualenv-permissions.patch b/pkgs/development/interpreters/python/cpython/virtualenv-permissions.patch new file mode 100644 index 00000000000..c686f21bfbb --- /dev/null +++ b/pkgs/development/interpreters/python/cpython/virtualenv-permissions.patch @@ -0,0 +1,13 @@ +diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py +index caa7285..ad666ac 100644 +--- a/Lib/venv/__init__.py ++++ b/Lib/venv/__init__.py +@@ -379,7 +379,7 @@ class EnvBuilder: + if data is not None: + with open(dstfile, 'wb') as f: + f.write(data) +- shutil.copymode(srcfile, dstfile) ++ os.chmod(dstfile, 0o644) + + + def create(env_dir, system_site_packages=False, clear=False, diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix index 76963587c20..f1784c834c2 100644 --- a/pkgs/development/interpreters/python/default.nix +++ b/pkgs/development/interpreters/python/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib }: +{ pkgs }: with pkgs; @@ -14,13 +14,78 @@ with pkgs; , packageOverrides , sitePackages , hasDistutilsCxxPatch - , pythonForBuild - , self + , pythonOnBuildForBuild + , pythonOnBuildForHost + , pythonOnBuildForTarget + , pythonOnHostForHost + , pythonOnTargetForTarget + , self # is pythonOnHostForTarget }: let - pythonPackages = callPackage ../../../top-level/python-packages.nix { - python = self; - overrides = packageOverrides; - }; + pythonPackages = callPackage + ({ pkgs, stdenv, python, overrides }: let + pythonPackagesFun = import ../../../top-level/python-packages.nix { + inherit stdenv pkgs lib; + python = self; + }; + otherSplices = { + selfBuildBuild = pythonOnBuildForBuild.pkgs; + selfBuildHost = pythonOnBuildForHost.pkgs; + selfBuildTarget = pythonOnBuildForTarget.pkgs; + selfHostHost = pythonOnHostForHost.pkgs; + selfTargetTarget = pythonOnTargetForTarget.pkgs or {}; # There is no Python TargetTarget. + }; + keep = self: { + # TODO maybe only define these here so nothing is needed to be kept in sync. + inherit (self) + isPy27 isPy35 isPy36 isPy37 isPy38 isPy39 isPy3k isPyPy pythonAtLeast pythonOlder + python bootstrapped-pip buildPythonPackage buildPythonApplication + fetchPypi + hasPythonModule requiredPythonModules makePythonPath disabledIf + toPythonModule toPythonApplication + buildSetupcfg + + condaInstallHook + condaUnpackHook + eggUnpackHook + eggBuildHook + eggInstallHook + flitBuildHook + pipBuildHook + pipInstallHook + pytestCheckHook + pythonCatchConflictsHook + pythonImportsCheckHook + pythonNamespacesHook + pythonRecompileBytecodeHook + pythonRemoveBinBytecodeHook + pythonRemoveTestsDirHook + setuptoolsBuildHook + setuptoolsCheckHook + venvShellHook + wheelUnpackHook + + wrapPython + + pythonPackages + + recursivePthLoader + ; + }; + extra = _: {}; + optionalExtensions = cond: as: if cond then as else []; + python2Extension = import ../../../top-level/python2-packages.nix; + extensions = lib.composeManyExtensions ((optionalExtensions (!self.isPy3k) [python2Extension]) ++ [ overrides ]); + aliases = self: super: lib.optionalAttrs (config.allowAliases or true) (import ../../../top-level/python-aliases.nix lib self super); + in lib.makeScopeWithSplicing + pkgs.splicePackages + pkgs.newScope + otherSplices + keep + extra + (lib.extends (lib.composeExtensions aliases extensions) pythonPackagesFun)) + { + overrides = packageOverrides; + }; in rec { isPy27 = pythonVersion == "2.7"; isPy35 = pythonVersion == "3.5"; @@ -28,6 +93,7 @@ with pkgs; isPy37 = pythonVersion == "3.7"; isPy38 = pythonVersion == "3.8"; isPy39 = pythonVersion == "3.9"; + isPy310 = pythonVersion == "3.10"; isPy2 = lib.strings.substring 0 1 pythonVersion == "2"; isPy3 = lib.strings.substring 0 1 pythonVersion == "3"; isPy3k = isPy3; @@ -41,13 +107,37 @@ with pkgs; inherit sourceVersion; pythonAtLeast = lib.versionAtLeast pythonVersion; pythonOlder = lib.versionOlder pythonVersion; - inherit hasDistutilsCxxPatch pythonForBuild; + inherit hasDistutilsCxxPatch; + # TODO: rename to pythonOnBuild + # Not done immediately because its likely used outside Nixpkgs. + pythonForBuild = pythonOnBuildForHost.override { inherit packageOverrides; self = pythonForBuild; }; tests = callPackage ./tests.nix { python = self; }; }; + sources = { + python38 = { + sourceVersion = { + major = "3"; + minor = "8"; + patch = "10"; + suffix = ""; + }; + sha256 = "1n8rjb3jn0j8dvi1qn94rxayc9rh982d8wgkrjy41n1x15k4mwka"; + }; + python39 = { + sourceVersion = { + major = "3"; + minor = "9"; + patch = "5"; + suffix = ""; + }; + sha256 = "10vdf46q5ldnzkprm8pldvr5a9hrdpxjv7mpzgdw6vj3cl318nhc"; + }; + }; + in { python27 = callPackage ./cpython/2.7 { @@ -68,10 +158,10 @@ in { sourceVersion = { major = "3"; minor = "6"; - patch = "11"; + patch = "13"; suffix = ""; }; - sha256 = "dB69y8Tjk3pf8jUX3UVev31UPqn+9vXPb0blddbE/aQ="; + sha256 = "pHpDpTq7QihqLBGWU0P/VnEbnmTo0RvyxnAaT7jOGg8="; inherit (darwin) configd; inherit passthruFun; }; @@ -81,44 +171,44 @@ in { sourceVersion = { major = "3"; minor = "7"; - patch = "8"; + patch = "10"; suffix = ""; }; - sha256 = "Q6VDQEs2PwA3+J34R48Z2y28DW8//uMQvCmX+nGFSmM="; + sha256 = "+NgudXLIbsnVXIYnquUEAST9IgOvQAw4PIIbmAMG7ms="; inherit (darwin) configd; inherit passthruFun; }; - python38 = callPackage ./cpython { + python38 = callPackage ./cpython ({ self = python38; - sourceVersion = { - major = "3"; - minor = "8"; - patch = "5"; - suffix = ""; - }; - sha256 = "1c43dbv9lvlp3ynqmgdi4rh8q94swanhqarqrdx62zmigpakw073"; inherit (darwin) configd; inherit passthruFun; - }; + } // sources.python38); - python39 = callPackage ./cpython { + python39 = callPackage ./cpython ({ self = python39; + inherit (darwin) configd; + inherit passthruFun; + } // sources.python39); + + python310 = callPackage ./cpython { + self = python310; sourceVersion = { major = "3"; - minor = "9"; + minor = "10"; patch = "0"; - suffix = "b5"; + suffix = "b3"; }; - sha256 = "0r0m82srq4z44dahczd1cv6wgmxcpqbn5dyd8czcpk2pp9ydgqbc"; + sha256 = "05fc4mp2ysb372bzkwbn1b1z01bfldnaqig6rxmif58hs3aawrr2"; inherit (darwin) configd; inherit passthruFun; }; # Minimal versions of Python (built without optional dependencies) - python3Minimal = (python38.override { + python3Minimal = (callPackage ./cpython ({ self = python3Minimal; - pythonForBuild = pkgs.buildPackages.python3Minimal; + inherit passthruFun; + pythonAttr = "python3Minimal"; # strip down that python version as much as possible openssl = null; readline = null; @@ -126,6 +216,7 @@ in { gdbm = null; sqlite = null; configd = null; + tzdata = null; stripConfig = true; stripIdlelib = true; stripTests = true; @@ -134,7 +225,9 @@ in { stripBytecode = true; includeSiteCustomize = false; enableOptimizations = false; - }).overrideAttrs(old: { + enableLTO = false; + mimetypesSupport = false; + } // sources.python39)).overrideAttrs(old: { pname = "python3-minimal"; meta = old.meta // { maintainers = []; @@ -146,9 +239,9 @@ in { sourceVersion = { major = "7"; minor = "3"; - patch = "1"; + patch = "5"; }; - sha256 = "08ckkhd0ix6j9873a7gr507c72d4cmnv5lwvprlljdca9i8p2dzs"; + sha256 = "sha256-wERP2YcwWMHA2Z4TqTTpIoXLBZksmWi/Ujwyv5vsCp0="; pythonVersion = "2.7"; db = db.override { dbmSupport = !stdenv.isDarwin; }; python = python27; @@ -157,15 +250,15 @@ in { inherit (darwin.apple_sdk.frameworks) Security; }; - pypy36 = callPackage ./pypy { - self = pypy36; + pypy37 = callPackage ./pypy { + self = pypy37; sourceVersion = { major = "7"; minor = "3"; - patch = "1"; + patch = "5"; }; - sha256 = "10zsk8jby8j6visk5mzikpb1cidvz27qq4pfpa26jv53klic6b0c"; - pythonVersion = "3.6"; + sha256 = "sha256-2SD+QJqeytnQdKqFaMpfPtNYG+ZvZuXYmIt+xm5tmaI="; + pythonVersion = "3.7"; db = db.override { dbmSupport = !stdenv.isDarwin; }; python = python27; inherit passthruFun; @@ -179,9 +272,9 @@ in { sourceVersion = { major = "7"; minor = "3"; - patch = "1"; + patch = "3"; }; - sha256 = "18xc5kwidj5hjwbr0w8v1nfpg5l4lk01z8cn804zfyyz8xjqhx5y"; # linux64 + sha256 = "1cfpdyvbvzwc0ynjr7248jhwgcpl7073wlp7w3g2v4fnrh1bc4pl"; # linux64 pythonVersion = "2.7"; inherit passthruFun; }; @@ -192,9 +285,9 @@ in { sourceVersion = { major = "7"; minor = "3"; - patch = "1"; + patch = "3"; }; - sha256 = "04nv0mkalaliphbjw7y0pmb372bxwjzwmcsqkf9kwsik99kg2z7n"; # linux64 + sha256 = "02lys9bjky9bqg6ggv8djirbd3zzcsq7755v4yvwm0k4a7fmzf2g"; # linux64 pythonVersion = "3.6"; inherit passthruFun; }; diff --git a/pkgs/development/interpreters/python/fetchpypi.nix b/pkgs/development/interpreters/python/fetchpypi.nix index e60c9df1f8b..ebd277cd2bd 100644 --- a/pkgs/development/interpreters/python/fetchpypi.nix +++ b/pkgs/development/interpreters/python/fetchpypi.nix @@ -5,10 +5,10 @@ let computeUrl = {format ? "setuptools", ... } @attrs: let - computeWheelUrl = {pname, version, python ? "py2.py3", abi ? "none", platform ? "any"}: + computeWheelUrl = {pname, version, dist ? "py2.py3", 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"; + "https://files.pythonhosted.org/packages/${dist}/${builtins.substring 0 1 pname}/${pname}/${pname}-${version}-${python}-${abi}-${platform}.whl"; computeSourceUrl = {pname, version, extension ? "tar.gz"}: # Fetch a source tarball. diff --git a/pkgs/development/interpreters/python/hooks/conda-install-hook.sh b/pkgs/development/interpreters/python/hooks/conda-install-hook.sh new file mode 100644 index 00000000000..af9ed60a038 --- /dev/null +++ b/pkgs/development/interpreters/python/hooks/conda-install-hook.sh @@ -0,0 +1,27 @@ +# Setup hook to use in case a conda binary package is installed +echo "Sourcing conda install hook" + +condaInstallPhase(){ + echo "Executing condaInstallPhase" + runHook preInstall + + # There are two different formats of conda packages. + # It either contains only a site-packages directory + # or multiple top level directories. + siteDir=@pythonSitePackages@ + if [ -e ./site-packages ]; then + mkdir -p $out/$siteDir + cp -r ./site-packages/* $out/$siteDir + else + cp -r . $out + rm $out/env-vars + fi + + runHook postInstall + echo "Finished executing condaInstallPhase" +} + +if [ -z "${installPhase-}" ]; then + echo "Using condaInstallPhase" + installPhase=condaInstallPhase +fi diff --git a/pkgs/development/interpreters/python/hooks/conda-unpack-hook.sh b/pkgs/development/interpreters/python/hooks/conda-unpack-hook.sh new file mode 100644 index 00000000000..6204c13b722 --- /dev/null +++ b/pkgs/development/interpreters/python/hooks/conda-unpack-hook.sh @@ -0,0 +1,18 @@ +# Setup hook to use in case a conda binary package is fetched +echo "Sourcing conda unpack hook" + +condaUnpackPhase(){ + echo "Executing condaUnpackPhase" + runHook preUnpack + + # use lbzip2 for parallel decompression (bz2 is slow) + lbzip2 -dc -n $NIX_BUILD_CORES $src | tar --exclude='info' -x + + # runHook postUnpack # Calls find...? + echo "Finished executing condaUnpackPhase" +} + +if [ -z "${unpackPhase-}" ]; then + echo "Using condaUnpackPhase" + unpackPhase=condaUnpackPhase +fi diff --git a/pkgs/development/interpreters/python/hooks/default.nix b/pkgs/development/interpreters/python/hooks/default.nix index d14eb9cbb09..1a0618225a3 100644 --- a/pkgs/development/interpreters/python/hooks/default.nix +++ b/pkgs/development/interpreters/python/hooks/default.nix @@ -1,20 +1,36 @@ # Hooks for building Python packages. { python , lib -, callPackage , makeSetupHook , disabledIf , isPy3k , ensureNewerSourcesForZipFilesHook +, findutils }: let + callPackage = python.pythonForBuild.pkgs.callPackage; pythonInterpreter = python.pythonForBuild.interpreter; pythonSitePackages = python.sitePackages; pythonCheckInterpreter = python.interpreter; setuppy = ../run_setup.py; in rec { + condaInstallHook = callPackage ({ gnutar, lbzip2 }: + makeSetupHook { + name = "conda-install-hook"; + deps = [ gnutar lbzip2 ]; + substitutions = { + inherit pythonSitePackages; + }; + } ./conda-install-hook.sh) {}; + + condaUnpackHook = callPackage ({}: + makeSetupHook { + name = "conda-unpack-hook"; + deps = []; + } ./conda-unpack-hook.sh) {}; + eggBuildHook = callPackage ({ }: makeSetupHook { name = "egg-build-hook.sh"; @@ -94,7 +110,7 @@ in rec { makeSetupHook { name = "python-namespaces-hook.sh"; substitutions = { - inherit pythonSitePackages; + inherit pythonSitePackages findutils; }; } ./python-namespaces-hook.sh) {}; diff --git a/pkgs/development/interpreters/python/hooks/pip-build-hook.sh b/pkgs/development/interpreters/python/hooks/pip-build-hook.sh index 6dd384b4847..745f02e8c9b 100644 --- a/pkgs/development/interpreters/python/hooks/pip-build-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pip-build-hook.sh @@ -7,7 +7,7 @@ pipBuildPhase() { mkdir -p dist echo "Creating a wheel..." - @pythonInterpreter@ -m pip wheel --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist . + @pythonInterpreter@ -m pip wheel --verbose --no-index --no-deps --no-clean --no-build-isolation --wheel-dir dist . echo "Finished creating a wheel..." runHook postBuild diff --git a/pkgs/development/interpreters/python/hooks/pip-install-hook.sh b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh index 770739b36bd..a4f08b8b14c 100644 --- a/pkgs/development/interpreters/python/hooks/pip-install-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pip-install-hook.sh @@ -11,9 +11,7 @@ pipInstallPhase() { 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 + @pythonInterpreter@ -m pip install ./*.whl --no-index --no-warn-script-location --prefix="$out" --no-cache $pipInstallFlags popd || return 1 runHook postInstall diff --git a/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh index bfd2bfa7583..0f708f88829 100644 --- a/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pytest-check-hook.sh @@ -2,6 +2,7 @@ echo "Sourcing pytest-check-hook" declare -ar disabledTests +declare -a disabledTestPaths function _concatSep { local result @@ -36,6 +37,18 @@ function pytestCheckPhase() { disabledTestsString=$(_pytestComputeDisabledTestsString "${disabledTests[@]}") args+=" -k \""$disabledTestsString"\"" fi + + if [ -n "${disabledTestPaths-}" ]; then + eval "disabledTestPaths=($disabledTestPaths)" + fi + + for path in ${disabledTestPaths[@]}; do + if [ ! -e "$path" ]; then + echo "Disabled tests path \"$path\" does not exist. Aborting" + exit 1 + fi + args+=" --ignore=\"$path\"" + done args+=" ${pytestFlagsArray[@]}" eval "@pythonCheckInterpreter@ $args" diff --git a/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh b/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh index 50f21819d17..15d2bd0eb34 100644 --- a/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh +++ b/pkgs/development/interpreters/python/hooks/python-namespaces-hook.sh @@ -17,16 +17,17 @@ pythonNamespacesHook() { for pathSegment in ${pathSegments[@]}; do constructedPath=${constructedPath}/${pathSegment} pathToRemove=${constructedPath}/__init__.py - pycachePath=${constructedPath}/__pycache__/__init__* + pycachePath=${constructedPath}/__pycache__/ + # remove __init__.py if [ -f "$pathToRemove" ]; then - echo "Removing $pathToRemove" - rm "$pathToRemove" + rm -v "$pathToRemove" fi - if [ -f "$pycachePath" ]; then - echo "Removing $pycachePath" - rm "$pycachePath" + # remove __pycache__/ entry, can be interpreter specific. E.g. __init__.cpython-38.pyc + # use null characters to perserve potential whitespace in filepath + if [ -d "$pycachePath" ]; then + @findutils@/bin/find "$pycachePath" -name '__init__*' -exec rm -v "{}" + fi done done diff --git a/pkgs/development/interpreters/python/hooks/python-remove-tests-dir-hook.sh b/pkgs/development/interpreters/python/hooks/python-remove-tests-dir-hook.sh index 83bea786db6..ad9e3c07cf2 100644 --- a/pkgs/development/interpreters/python/hooks/python-remove-tests-dir-hook.sh +++ b/pkgs/development/interpreters/python/hooks/python-remove-tests-dir-hook.sh @@ -5,6 +5,7 @@ pythonRemoveTestsDir() { echo "Executing pythonRemoveTestsDir" rm -rf $out/@pythonSitePackages@/tests + rm -rf $out/@pythonSitePackages@/test echo "Finished executing pythonRemoveTestsDir" } @@ -12,4 +13,3 @@ pythonRemoveTestsDir() { if [ -z "${dontUsePythonRemoveTestsDir-}" ]; then postFixupHooks+=(pythonRemoveTestsDir) fi - diff --git a/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh index 311590425e6..cc037744925 100644 --- a/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh +++ b/pkgs/development/interpreters/python/hooks/setuptools-build-hook.sh @@ -31,6 +31,13 @@ setuptoolsShellHook() { mkdir -p "$tmp_path/@pythonSitePackages@" eval "@pythonInterpreter@ -m pip install -e . --prefix $tmp_path \ --no-build-isolation >&2" + + # Process pth file installed in tmp path. This allows one to + # actually import the editable installation. Note site.addsitedir + # appends, not prepends, new paths. Hence, it is not possible to override + # an existing installation of the package. + # https://github.com/pypa/setuptools/issues/2612 + export NIX_PYTHONPATH="$tmp_path/@pythonSitePackages@:${NIX_PYTHONPATH-}" fi runHook postShellHook diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index df945c645a8..963073df620 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -17,7 +17,6 @@ , pythonCatchConflictsHook , pythonImportsCheckHook , pythonNamespacesHook -, pythonRecompileBytecodeHook , pythonRemoveBinBytecodeHook , pythonRemoveTestsDirHook , setuptoolsBuildHook @@ -54,7 +53,9 @@ , disabled ? false # Raise an error if two packages are installed with the same name -, catchConflicts ? true +# TODO: For cross we probably need a different PYTHONPATH, or not +# add the runtime deps until after buildPhase. +, catchConflicts ? (python.stdenv.hostPlatform == python.stdenv.buildPlatform) # Additional arguments to pass to the makeWrapper function, which wraps # generated binaries. @@ -81,6 +82,8 @@ # "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" @@ -90,6 +93,8 @@ , doCheck ? config.doCheckByDefault or false +, disabledTestPaths ? [] + , ... } @ attrs: @@ -101,17 +106,19 @@ else let inherit (python) stdenv; + name_ = name; + self = toPythonModule (stdenv.mkDerivation ((builtins.removeAttrs attrs [ "disabled" "checkPhase" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "format" + "disabledTestPaths" ]) // { - name = namePrefix + name; + 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 @@ -160,23 +167,24 @@ let postFixup = lib.optionalString (!dontWrapPythonPrograms) '' wrapPythonPrograms - '' + attrs.postFixup or ''''; + '' + 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; + } // lib.optionalAttrs (attrs?pname) { + mainProgram = attrs.pname; } // 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; + } // lib.optionalAttrs (disabledTestPaths != []) { + disabledTestPaths = lib.escapeShellArgs disabledTestPaths; })); passthru.updateScript = let diff --git a/pkgs/development/interpreters/python/pypy/default.nix b/pkgs/development/interpreters/python/pypy/default.nix index 10073602071..668a4e24b39 100644 --- a/pkgs/development/interpreters/python/pypy/default.nix +++ b/pkgs/development/interpreters/python/pypy/default.nix @@ -1,19 +1,25 @@ -{ stdenv, substituteAll, fetchurl -, zlib ? null, zlibSupport ? true, bzip2, pkgconfig, libffi, libunwind, Security +{ lib, stdenv, substituteAll, fetchurl +, zlib ? null, zlibSupport ? true, bzip2, pkg-config, libffi, libunwind, Security , sqlite, openssl, ncurses, python, expat, tcl, tk, tix, xlibsWrapper, libX11 -, self, gdbm, db, lzma +, self, gdbm, db, xz , python-setup-hook # For the Python package set , packageOverrides ? (self: super: {}) +, pkgsBuildBuild +, pkgsBuildHost +, pkgsBuildTarget +, pkgsHostHost +, pkgsTargetTarget , sourceVersion , pythonVersion , sha256 , passthruFun +, pythonAttr ? "pypy${lib.substring 0 1 pythonVersion}${lib.substring 2 3 pythonVersion}" }: assert zlibSupport -> zlib != null; -with stdenv.lib; +with lib; let isPy3k = substring 0 1 pythonVersion == "3"; @@ -22,9 +28,14 @@ let implementation = "pypy"; libPrefix = "pypy${pythonVersion}"; executable = "pypy${if isPy3k then "3" else ""}"; - pythonForBuild = self; # No cross-compiling for now. sitePackages = "site-packages"; hasDistutilsCxxPatch = false; + + pythonOnBuildForBuild = pkgsBuildBuild.${pythonAttr}; + pythonOnBuildForHost = pkgsBuildHost.${pythonAttr}; + pythonOnBuildForTarget = pkgsBuildTarget.${pythonAttr}; + pythonOnHostForHost = pkgsHostHost.${pythonAttr}; + pythonOnTargetForTarget = pkgsTargetTarget.${pythonAttr} or {}; }; pname = passthru.executable; version = with sourceVersion; "${major}.${minor}.${patch}"; @@ -34,15 +45,15 @@ 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"; + url = "https://downloads.python.org/pypy/pypy${pythonVersion}-v${version}-src.tar.bz2"; inherit sha256; }; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ bzip2 openssl pythonForPypy libffi ncurses expat sqlite tk tcl xlibsWrapper libX11 gdbm db ] ++ optionals isPy3k [ - lzma + xz ] ++ optionals (stdenv ? cc && stdenv.cc.libc != null) [ stdenv.cc.libc ] ++ optionals zlibSupport [ @@ -62,6 +73,8 @@ in with passthru; stdenv.mkDerivation rec { LD_LIBRARY_PATH = makeLibraryPath (filter (x : x.outPath != stdenv.cc.libc.outPath or "") buildInputs); patches = [ + ./dont_fetch_vendored_deps.patch + (substituteAll { src = ./tk_tcl_paths.patch; inherit tk tcl; @@ -70,12 +83,18 @@ in with passthru; stdenv.mkDerivation rec { tk_libprefix = tk.libPrefix; tcl_libprefix = tcl.libPrefix; }) + + (substituteAll { + src = ./sqlite_paths.patch; + inherit (sqlite) out dev; + }) ]; 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'" + substituteInPlace lib_pypy/pypy_tools/build_cffi_imports.py \ + --replace "multiprocessing.cpu_count()" "$NIX_BUILD_CORES" - sed -i "s@libraries=\['sqlite3'\]\$@libraries=['sqlite3'], include_dirs=['${sqlite.dev}/include'], library_dirs=['${sqlite.out}/lib']@" lib_pypy/_sqlite3_build.py + 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'" ''; buildPhase = '' @@ -133,7 +152,7 @@ in with passthru; stdenv.mkDerivation rec { 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 '' + ${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} ''} @@ -147,11 +166,11 @@ in with passthru; stdenv.mkDerivation rec { inherit passthru; enableParallelBuilding = true; # almost no parallelization without STM - meta = with stdenv.lib; { + meta = with 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" ]; + platforms = [ "aarch64-linux" "i686-linux" "x86_64-linux" "x86_64-darwin" ]; maintainers = with maintainers; [ andersk ]; }; } diff --git a/pkgs/development/interpreters/python/pypy/dont_fetch_vendored_deps.patch b/pkgs/development/interpreters/python/pypy/dont_fetch_vendored_deps.patch new file mode 100644 index 00000000000..bc959e15d1a --- /dev/null +++ b/pkgs/development/interpreters/python/pypy/dont_fetch_vendored_deps.patch @@ -0,0 +1,12 @@ +diff -ur a/lib_pypy/pypy_tools/build_cffi_imports.py b/lib_pypy/pypy_tools/build_cffi_imports.py +--- a/lib_pypy/pypy_tools/build_cffi_imports.py 2021-04-12 01:11:48.000000000 -0400 ++++ b/lib_pypy/pypy_tools/build_cffi_imports.py 2021-07-16 06:37:03.000000000 -0400 +@@ -225,6 +225,8 @@ + + print('*', ' '.join(args), file=sys.stderr) + if embed_dependencies and key in cffi_dependencies: ++ print("Nixpkgs: skipping fetching/building dependency", key) ++ elif False: + status, stdout, stderr = _build_dependency(key) + if status != 0: + failures.append((key, module)) diff --git a/pkgs/development/interpreters/python/pypy/prebuilt.nix b/pkgs/development/interpreters/python/pypy/prebuilt.nix index 1522047a380..460af1cc67b 100644 --- a/pkgs/development/interpreters/python/pypy/prebuilt.nix +++ b/pkgs/development/interpreters/python/pypy/prebuilt.nix @@ -1,4 +1,5 @@ -{ stdenv +{ lib +, stdenv , fetchurl , python-setup-hook , self @@ -22,7 +23,7 @@ # This version of PyPy is primarily added to speed-up translation of # our PyPy source build when developing that expression. -with stdenv.lib; +with lib; let isPy3k = majorVersion == "3"; @@ -31,9 +32,15 @@ let 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; + + # Not possible to cross-compile with. + pythonOnBuildForBuild = throw "${pname} does not support cross compilation"; + pythonOnBuildForHost = self; + pythonOnBuildForTarget = throw "${pname} does not support cross compilation"; + pythonOnHostForHost = throw "${pname} does not support cross compilation"; + pythonOnTargetForTarget = throw "${pname} does not support cross compilation"; }; pname = "${passthru.executable}_prebuilt"; version = with sourceVersion; "${major}.${minor}.${patch}"; @@ -54,7 +61,7 @@ in with passthru; stdenv.mkDerivation { inherit pname version; src = fetchurl { - url = "https://bitbucket.org/pypy/pypy/downloads/pypy${pythonVersion}-v${version}-linux64.tar.bz2"; + url = "https://downloads.python.org/pypy/pypy${pythonVersion}-v${version}-linux64.tar.bz2"; inherit sha256; }; @@ -78,7 +85,7 @@ in with passthru; stdenv.mkDerivation { 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 {} \; + find {lib,lib_pypy*} -name "*.so" -exec patchelf --set-rpath ${lib.makeLibraryPath deps}:$out/lib {} \; echo "Removing bytecode" find . -name "__pycache__" -type d -depth -exec rm -rf {} \; @@ -115,7 +122,7 @@ in with passthru; stdenv.mkDerivation { inherit passthru; - meta = with stdenv.lib; { + meta = with lib; { homepage = "http://pypy.org/"; description = "Fast, compliant alternative implementation of the Python language (${pythonVersion})"; license = licenses.mit; diff --git a/pkgs/development/interpreters/python/pypy/sqlite_paths.patch b/pkgs/development/interpreters/python/pypy/sqlite_paths.patch new file mode 100644 index 00000000000..42de7efb3ea --- /dev/null +++ b/pkgs/development/interpreters/python/pypy/sqlite_paths.patch @@ -0,0 +1,12 @@ +diff -ur a/lib_pypy/_sqlite3_build.py b/lib_pypy/_sqlite3_build.py +--- a/lib_pypy/_sqlite3_build.py 2021-04-12 01:11:48.000000000 -0400 ++++ b/lib_pypy/_sqlite3_build.py 2021-07-14 18:08:33.000000000 -0400 +@@ -301,6 +301,8 @@ + else: + extra_args = dict( + libraries=libraries, ++ include_dirs=['@dev@/include'], ++ library_dirs=['@out@/lib'] + ) + + SOURCE = """ diff --git a/pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch b/pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch index 0b78caf7e07..15d03830e07 100644 --- a/pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch +++ b/pkgs/development/interpreters/python/pypy/tk_tcl_paths.patch @@ -1,13 +1,14 @@ ---- 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 @@ +--- a/lib_pypy/_tkinter/tklib_build.py ++++ b/lib_pypy/_tkinter/tklib_build.py +@@ -17,19 +17,14 @@ elif sys.platform == 'win32': incdirs = [] linklibs = ['tcl85', 'tk85'] libdirs = [] -elif sys.platform == 'darwin': -- incdirs = ['/System/Library/Frameworks/Tk.framework/Versions/Current/Headers/'] -- linklibs = ['tcl', 'tk'] -- libdirs = [] +- # homebrew +- incdirs = ['/usr/local/opt/tcl-tk/include'] +- linklibs = ['tcl8.6', 'tk8.6'] +- libdirs = ['/usr/local/opt/tcl-tk/lib'] else: # On some Linux distributions, the tcl and tk libraries are # stored in /usr/include, so we must check this case also diff --git a/pkgs/development/interpreters/python/tests.nix b/pkgs/development/interpreters/python/tests.nix index 03a3b953709..872123338f8 100644 --- a/pkgs/development/interpreters/python/tests.nix +++ b/pkgs/development/interpreters/python/tests.nix @@ -1,4 +1,12 @@ -{ python +# Tests for the Python interpreters, package sets and environments. +# +# Each Python interpreter has a `passthru.tests` which is the attribute set +# returned by this function. For example, for Python 3 the tests are run with +# +# $ nix-build -A python3.tests +# +{ stdenv +, python , runCommand , substituteAll , lib @@ -6,68 +14,85 @@ }: 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"; - }; + # Test whether the interpreter behaves in the different types of environments + # we aim to support. + 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"; + } // 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; + + # Integration tests involving the package set. # 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 @@ -76,15 +101,57 @@ let }; }; - testfun = name: attrs: runCommand "${python.name}-tests-${name}" ({ - inherit (python) pythonVersion; - } // attrs) '' - cp -r ${./tests} 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 - ''; + # Tests to ensure overriding works as expected. + overrideTests = let + extension = self: super: { + foobar = super.numpy; + }; + in { + test-packageOverrides = let + myPython = let + self = python.override { + packageOverrides = extension; + inherit self; + }; + in self; + in assert myPython.pkgs.foobar == myPython.pkgs.numpy; myPython.withPackages(ps: with ps; [ foobar ]); + # overrideScope is broken currently + # test-overrideScope = let + # myPackages = python.pkgs.overrideScope extension; + # in assert myPackages.foobar == myPackages.numpy; myPackages.python.withPackages(ps: with ps; [ foobar ]); + }; + + condaTests = let + requests = callPackage ({ + autoPatchelfHook, + fetchurl, + pythonCondaPackages, + }: + python.pkgs.buildPythonPackage { + pname = "requests"; + version = "2.24.0"; + format = "other"; + src = fetchurl { + url = "https://repo.anaconda.com/pkgs/main/noarch/requests-2.24.0-py_0.tar.bz2"; + sha256 = "02qzaf6gwsqbcs69pix1fnjxzgnngwzvrsy65h1d521g750mjvvp"; + }; + nativeBuildInputs = [ autoPatchelfHook ] ++ (with python.pkgs; [ + condaUnpackHook condaInstallHook + ]); + buildInputs = [ + pythonCondaPackages.condaPatchelfLibs + ]; + propagatedBuildInputs = with python.pkgs; [ + chardet idna urllib3 certifi + ]; + } + ) {}; + pythonWithRequests = requests.pythonModule.withPackages (ps: [ requests ]); + in + { + condaExamplePackage = runCommand "import-requests" {} '' + ${pythonWithRequests.interpreter} -c "import requests" > $out + ''; + }; -in lib.mapAttrs testfun envs // integrationTests +in lib.optionalAttrs (stdenv.hostPlatform == stdenv.buildPlatform ) (environmentTests // integrationTests // overrideTests // condaTests) diff --git a/pkgs/development/interpreters/python/tests/test_python.py b/pkgs/development/interpreters/python/tests/test_environments/test_python.py index 0fc4b8a9e91..0fc4b8a9e91 100644 --- a/pkgs/development/interpreters/python/tests/test_python.py +++ b/pkgs/development/interpreters/python/tests/test_environments/test_python.py diff --git a/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/default.nix b/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/default.nix index 05798cbaf1b..572cbdccbfb 100644 --- a/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/default.nix +++ b/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/default.nix @@ -4,7 +4,7 @@ let python = let packageOverrides = self: super: { - typeddep = super.callPackage ./typeddep {}; + typeddep = self.callPackage ./typeddep {}; }; in interpreter.override {inherit packageOverrides; self = python;}; diff --git a/pkgs/development/interpreters/python/update-python-libraries/default.nix b/pkgs/development/interpreters/python/update-python-libraries/default.nix index 762ca2bdd34..81975bc5250 100644 --- a/pkgs/development/interpreters/python/update-python-libraries/default.nix +++ b/pkgs/development/interpreters/python/update-python-libraries/default.nix @@ -9,4 +9,4 @@ runCommand "update-python-libraries" { 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/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py b/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py index b568ee6751d..d3642592ae4 100755 --- a/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py +++ b/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py @@ -12,11 +12,10 @@ to update all non-pinned libraries in that folder. """ import argparse -import logging import os +import pathlib 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 @@ -34,6 +33,8 @@ PRERELEASES = False GIT = "git" +NIXPGKS_ROOT = subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).decode('utf-8').strip() + import logging logging.basicConfig(level=logging.INFO) @@ -101,6 +102,7 @@ def _replace_value(attribute, value, text): 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: @@ -109,6 +111,19 @@ def _fetch_page(url): raise ValueError("request for {} failed".format(url)) +def _fetch_github(url): + headers = {} + token = os.environ.get('GITHUB_API_TOKEN') + if token: + headers["Authorization"] = f"token {token}" + r = requests.get(url, headers=headers) + + if r.status_code == requests.codes.ok: + return r.json() + else: + raise ValueError("request for {} failed".format(url)) + + SEMVER = { 'major' : 0, 'minor' : 1, @@ -167,11 +182,52 @@ def _get_latest_version_pypi(package, extension, current_version, target): break else: sha256 = None - return version, sha256 + return version, sha256, None def _get_latest_version_github(package, extension, current_version, target): - raise ValueError("updating from GitHub is not yet supported.") + def strip_prefix(tag): + return re.sub("^[^0-9]*", "", tag) + + def get_prefix(string): + matches = re.findall(r"^([^0-9]*)", string) + return next(iter(matches), "") + + # when invoked as an updateScript, UPDATE_NIX_ATTR_PATH will be set + # this allows us to work with packages which live outside of python-modules + attr_path = os.environ.get("UPDATE_NIX_ATTR_PATH", f"python3Packages.{package}") + try: + homepage = subprocess.check_output( + ["nix", "eval", "-f", f"{NIXPGKS_ROOT}/default.nix", "--raw", f"{attr_path}.src.meta.homepage"])\ + .decode('utf-8') + except Exception as e: + raise ValueError(f"Unable to determine homepage: {e}") + owner_repo = homepage[len("https://github.com/"):] # remove prefix + owner, repo = owner_repo.split("/") + + url = f"https://api.github.com/repos/{owner}/{repo}/releases" + all_releases = _fetch_github(url) + releases = list(filter(lambda x: not x['prerelease'], all_releases)) + + if len(releases) == 0: + raise ValueError(f"{homepage} does not contain any stable releases") + + versions = map(lambda x: strip_prefix(x['tag_name']), releases) + version = _determine_latest_version(current_version, target, versions) + + release = next(filter(lambda x: strip_prefix(x['tag_name']) == version, releases)) + prefix = get_prefix(release['tag_name']) + try: + sha256 = subprocess.check_output(["nix-prefetch-url", "--type", "sha256", "--unpack", f"{release['tarball_url']}"], stderr=subprocess.DEVNULL)\ + .decode('utf-8').strip() + except: + # this may fail if they have both a branch and a tag of the same name, attempt tag name + tag_url = str(release['tarball_url']).replace("tarball","tarball/refs/tags") + sha256 = subprocess.check_output(["nix-prefetch-url", "--type", "sha256", "--unpack", tag_url], stderr=subprocess.DEVNULL)\ + .decode('utf-8').strip() + + + return version, sha256, prefix FETCHERS = { @@ -240,7 +296,9 @@ def _determine_extension(text, fetcher): raise ValueError('url does not point to PyPI.') elif fetcher == 'fetchFromGitHub': - raise ValueError('updating from GitHub is not yet implemented.') + if "fetchSubmodules" in text: + raise ValueError("fetchFromGitHub fetcher doesn't support submodules") + extension = "tar.gz" return extension @@ -262,7 +320,7 @@ def _update_package(path, target): extension = _determine_extension(text, fetcher) - new_version, new_sha256 = FETCHERS[fetcher](pname, extension, version, target) + new_version, new_sha256, prefix = FETCHERS[fetcher](pname, extension, version, target) if new_version == version: logging.info("Path {}: no update available for {}.".format(path, pname)) @@ -274,6 +332,10 @@ def _update_package(path, target): text = _replace_value('version', new_version, text) text = _replace_value('sha256', new_sha256, text) + if fetcher == 'fetchFromGitHub': + text = _replace_value('rev', f"{prefix}${{version}}", text) + # incase there's no prefix, just rewrite without interpolation + text = text.replace('"${version}";', 'version;') with open(path, 'w') as f: f.write(text) @@ -333,7 +395,11 @@ def _commit(path, pname, old_version, new_version, pkgs_prefix="python: ", **kwa def main(): - parser = argparse.ArgumentParser() + epilog = """ +environment variables: + GITHUB_API_TOKEN\tGitHub API token used when updating github packages + """ + parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, epilog=epilog) 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') diff --git a/pkgs/development/interpreters/python/wrapper.nix b/pkgs/development/interpreters/python/wrapper.nix index dffad6b98f5..514930db359 100644 --- a/pkgs/development/interpreters/python/wrapper.nix +++ b/pkgs/development/interpreters/python/wrapper.nix @@ -1,10 +1,15 @@ -{ stdenv, python, buildEnv, makeWrapper +{ lib, stdenv, buildEnv, makeWrapper + +# manually pased +, python +, requiredPythonModules + +# extra opts , extraLibs ? [] , extraOutputsToInstall ? [] , postBuild ? "" , ignoreCollisions ? false , permitUserSite ? false -, requiredPythonModules # Wrap executables with the given argument. , makeWrapperArgs ? [] , }: @@ -22,22 +27,22 @@ let inherit ignoreCollisions; extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall; - postBuild = '' - . "${makeWrapper}/nix-support/setup-hook" + nativeBuildInputs = [ makeWrapper ]; + postBuild = '' if [ -L "$out/bin" ]; then unlink "$out/bin" fi mkdir -p "$out/bin" - for path in ${stdenv.lib.concatStringsSep " " paths}; do + for path in ${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} + 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"''} ${lib.concatStringsSep " " makeWrapperArgs} fi fi done diff --git a/pkgs/development/interpreters/qnial/default.nix b/pkgs/development/interpreters/qnial/default.nix index 1762edbbdb7..1173315192e 100644 --- a/pkgs/development/interpreters/qnial/default.nix +++ b/pkgs/development/interpreters/qnial/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, unzip, pkgconfig, makeWrapper, ncurses }: +{ lib, stdenv, fetchFromGitHub, unzip, pkg-config, makeWrapper, ncurses }: stdenv.mkDerivation { pname = "qnial"; @@ -11,7 +11,7 @@ stdenv.mkDerivation { owner = "vrthra"; }; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper unzip ]; preConfigure = '' cd build; @@ -25,16 +25,15 @@ stdenv.mkDerivation { ''; buildInputs = [ - unzip - pkgconfig + pkg-config 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; + license = lib.licenses.artistic1; + maintainers = [ lib.maintainers.vrthra ]; + platforms = lib.platforms.linux; }; } diff --git a/pkgs/development/interpreters/quickjs/default.nix b/pkgs/development/interpreters/quickjs/default.nix index b1d03252d7e..4bc0ec528a0 100644 --- a/pkgs/development/interpreters/quickjs/default.nix +++ b/pkgs/development/interpreters/quickjs/default.nix @@ -1,17 +1,37 @@ -{ stdenv, fetchurl }: +{ lib +, stdenv +, fetchFromGitHub +, texinfo +}: stdenv.mkDerivation rec { pname = "quickjs"; - version = "2019-12-21"; + version = "2021-03-27"; - src = fetchurl { - url = "https://bellard.org/${pname}/${pname}-${version}.tar.xz"; - sha256 = "13hlx6qwrrxmlvvqcr3irxba6zmf05cf54l32vj50wc66s1qd41p"; + src = fetchFromGitHub { + owner = "bellard"; + repo = pname; + rev = "b5e62895c619d4ffc75c9d822c8d85f1ece77e5b"; + hash = "sha256-VMaxVVQuJ3DAwYrC14uJqlRBg0//ugYvtyhOXsTUbCA="; }; - makeFlags = [ "prefix=${placeholder ''out''}" ]; + makeFlags = [ "prefix=${placeholder "out"}" ]; enableParallelBuilding = true; + nativeBuildInputs = [ + texinfo + ]; + + postBuild = '' + (cd doc + makeinfo *texi) + ''; + + postInstall = '' + (cd doc + install -Dt $out/share/doc *texi *info) + ''; + doInstallCheck = true; installCheckPhase = '' PATH="$out/bin:$PATH" @@ -19,7 +39,6 @@ stdenv.mkDerivation rec { # 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 @@ -27,15 +46,13 @@ stdenv.mkDerivation rec { 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; { + meta = with lib; { description = "A small and embeddable Javascript engine"; homepage = "https://bellard.org/quickjs/"; - maintainers = with maintainers; [ stesie ]; + maintainers = with maintainers; [ stesie AndersonTorres ]; platforms = platforms.linux; license = licenses.mit; }; diff --git a/pkgs/development/interpreters/racket/default.nix b/pkgs/development/interpreters/racket/default.nix index b62df6e837b..0b5084d4358 100644 --- a/pkgs/development/interpreters/racket/default.nix +++ b/pkgs/development/interpreters/racket/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, makeFontsConf +{ lib, stdenv, fetchurl, makeFontsConf , cacert , cairo, coreutils, fontconfig, freefont_ttf , glib, gmp @@ -8,6 +8,7 @@ , libGL , libGLU , libjpeg +, ncurses , libpng, libtool, mpfr, openssl, pango, poppler , readline, sqlite , disableDocs ? false @@ -22,7 +23,7 @@ let fontDirectories = [ freefont_ttf ]; }; - libPath = stdenv.lib.makeLibraryPath [ + libPath = lib.makeLibraryPath [ cairo fontconfig glib @@ -46,34 +47,39 @@ in stdenv.mkDerivation rec { pname = "racket"; - version = "7.8"; # always change at once with ./minimal.nix + version = "8.1"; # always change at once with ./minimal.nix - src = (stdenv.lib.makeOverridable ({ name, sha256 }: + src = (lib.makeOverridable ({ name, sha256 }: fetchurl { url = "https://mirror.racket-lang.org/installers/${version}/${name}-src.tgz"; inherit sha256; } )) { name = "${pname}-${version}"; - sha256 = "19z3dayybcra277s4gk2mppalwawd93f2b16xyrb6d7rbbfz7j9j"; + sha256 = "0wlgp9dlibhv1d181arz309fszz31l5gb5gl94bqzfcav014g3k8"; }; 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") + NIX_LDFLAGS = lib.concatStringsSep " " [ + (lib.optionalString (stdenv.cc.isGNU && ! stdenv.isDarwin) "-lgcc_s") + (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 ]; + ++ lib.optionals stdenv.isDarwin [ libiconv CoreFoundation ncurses ]; 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 + for f in src/lt/configure src/cs/c/configure src/bc/src/string.c src/ChezScheme/workarea; do + substituteInPlace "$f" \ + --replace /usr/bin/uname ${coreutils}/bin/uname \ + --replace /bin/cp ${coreutils}/bin/cp \ + --replace /bin/ln ${coreutils}/bin/ln \ + --replace /bin/rm ${coreutils}/bin/rm \ + --replace /bin/true ${coreutils}/bin/true done mkdir src/build cd src/build @@ -83,15 +89,15 @@ stdenv.mkDerivation rec { 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" ]; + ++ lib.optional disableDocs [ "--disable-docs" ] + ++ lib.optional stdenv.isDarwin [ "--enable-xonx" ]; configureScript = "../configure"; enableParallelBuilding = false; - meta = with stdenv.lib; { + meta = with lib; { description = "A programmable programming language"; longDescription = '' Racket is a full-spectrum programming language. It goes beyond diff --git a/pkgs/development/interpreters/racket/minimal.nix b/pkgs/development/interpreters/racket/minimal.nix index 02aed6e8929..4cfb178d42d 100644 --- a/pkgs/development/interpreters/racket/minimal.nix +++ b/pkgs/development/interpreters/racket/minimal.nix @@ -5,11 +5,11 @@ racket.overrideAttrs (oldAttrs: rec { name = "racket-minimal-${oldAttrs.version}"; src = oldAttrs.src.override { inherit name; - sha256 = "0bbglf9vfacpm2hn3lskhvc8cpg6z088fbnzpqsn17z8qdk8yvb3"; + sha256 = "1q54n16s0hmnry8q381wd7zfpyjndfjswn97vsbd4isngwz3w12k"; }; meta = oldAttrs.meta // { - description = "Racket without bundled packages, such as Dr. Racket."; + 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. diff --git a/pkgs/development/interpreters/rakudo/default.nix b/pkgs/development/interpreters/rakudo/default.nix index fb33743dc9a..eabbdf0b757 100644 --- a/pkgs/development/interpreters/rakudo/default.nix +++ b/pkgs/development/interpreters/rakudo/default.nix @@ -1,14 +1,16 @@ -{ stdenv, fetchurl, perl, icu, zlib, gmp, lib, nqp }: +{ stdenv, fetchurl, perl, icu, zlib, gmp, lib, nqp, removeReferencesTo }: stdenv.mkDerivation rec { pname = "rakudo"; - version = "2020.08.1"; + version = "2021.07"; src = fetchurl { - url = "https://www.rakudo.org/dl/rakudo/rakudo-${version}.tar.gz"; - sha256 = "1jwlqppm2g6ivzpipkcyihsxzsii3qyx1f35n7wj5dsf99b3hkfm"; + url = "https://rakudo.org/dl/rakudo/rakudo-${version}.tar.gz"; + sha256 = "0lmbgw24f8277b9kj725v3grwh1524p4iy5jbqajxwxjr16zx2hp"; }; + nativeBuildInputs = [ removeReferencesTo ]; + buildInputs = [ icu zlib gmp perl ]; configureScript = "perl ./Configure.pl"; configureFlags = [ @@ -16,12 +18,14 @@ stdenv.mkDerivation rec { "--with-nqp=${nqp}/bin/nqp" ]; - # Some tests fail on Darwin - doCheck = !stdenv.isDarwin; + disallowedReferences = [ stdenv.cc.cc ]; + postFixup = '' + remove-references-to -t ${stdenv.cc.cc} "$(readlink -f $out/share/perl6/runtime/dynext/libperl6_ops_moar.so)" + ''; - meta = with stdenv.lib; { + meta = with lib; { description = "Raku implementation on top of Moar virtual machine"; - homepage = "https://www.rakudo.org"; + homepage = "https://rakudo.org"; license = licenses.artistic2; platforms = platforms.unix; maintainers = with maintainers; [ thoughtpolice vrthra sgo ]; diff --git a/pkgs/development/interpreters/rakudo/moarvm.nix b/pkgs/development/interpreters/rakudo/moarvm.nix index 702fccd7b6b..73dac18a597 100644 --- a/pkgs/development/interpreters/rakudo/moarvm.nix +++ b/pkgs/development/interpreters/rakudo/moarvm.nix @@ -1,23 +1,23 @@ -{ stdenv, fetchurl, perl +{ lib, stdenv, fetchurl, perl , CoreServices, ApplicationServices }: stdenv.mkDerivation rec { pname = "moarvm"; - version = "2020.08"; + version = "2021.07"; src = fetchurl { - url = "https://www.moarvm.org/releases/MoarVM-${version}.tar.gz"; - sha256 = "1gq7z4z5lnkai01721waawkkal82sdmyra05nnbfb1986mq5xpiy"; + url = "https://moarvm.org/releases/MoarVM-${version}.tar.gz"; + sha256 = "1zk3dpvgrgg4kam3hx9pq1a2l2kgw822dci8hg7x0cn1lppwwdw4"; }; - buildInputs = [ perl ] ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices ApplicationServices ]; + buildInputs = [ perl ] ++ 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; { + meta = with lib; { description = "VM with adaptive optimization and JIT compilation, built for Rakudo"; - homepage = "https://www.moarvm.org/"; + homepage = "https://moarvm.org"; license = licenses.artistic2; platforms = platforms.unix; maintainers = with maintainers; [ thoughtpolice vrthra sgo ]; diff --git a/pkgs/development/interpreters/rakudo/nqp.nix b/pkgs/development/interpreters/rakudo/nqp.nix index 93b42d2b8e1..d34f5ac71a0 100644 --- a/pkgs/development/interpreters/rakudo/nqp.nix +++ b/pkgs/development/interpreters/rakudo/nqp.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "nqp"; - version = "2020.08.1"; + version = "2021.07"; src = fetchurl { - url = "https://github.com/perl6/nqp/releases/download/${version}/nqp-${version}.tar.gz"; - sha256 = "0pxmg22dx6rhfgrxq4gbwqf6d2nahw6iprjvrg8brkbcbyj3ryhd"; + url = "https://github.com/raku/nqp/releases/download/${version}/nqp-${version}.tar.gz"; + sha256 = "191y6r6qxpib52h3drc5pbjrgf65pn5ahis1dyz55dxk7ajg5anw"; }; buildInputs = [ perl ]; @@ -19,7 +19,7 @@ stdenv.mkDerivation rec { doCheck = true; - meta = with stdenv.lib; { + meta = with lib; { description = "Not Quite Perl -- a lightweight Raku-like environment for virtual machines"; homepage = "https://github.com/perl6/nqp"; license = licenses.artistic2; diff --git a/pkgs/development/interpreters/rakudo/zef.nix b/pkgs/development/interpreters/rakudo/zef.nix index c8205344693..350eea43160 100644 --- a/pkgs/development/interpreters/rakudo/zef.nix +++ b/pkgs/development/interpreters/rakudo/zef.nix @@ -1,17 +1,18 @@ -{ stdenv, fetchFromGitHub, rakudo, makeWrapper }: +{ lib, stdenv, fetchFromGitHub, rakudo, makeWrapper }: stdenv.mkDerivation rec { pname = "zef"; - version = "0.8.5"; + version = "0.11.9"; src = fetchFromGitHub { owner = "ugexe"; repo = "zef"; rev = "v${version}"; - sha256 = "17a5ns0ph8626q3b4wv9v2n0zqmhqbqyzjzxa387kr19qs933yy6"; + sha256 = "1x1jj9k80lza1b3aidw9ybi26kjf30mvqkmnnmxf27302ipq69jy"; }; - buildInputs = [ rakudo makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ rakudo ]; installPhase = '' mkdir -p "$out" @@ -24,7 +25,7 @@ stdenv.mkDerivation rec { wrapProgram $out/bin/zef --prefix RAKUDOLIB , "inst#$out" ''; - meta = with stdenv.lib; { + meta = with lib; { description = "Raku / Perl6 Module Management"; homepage = "https://github.com/ugexe/zef"; license = licenses.artistic2; diff --git a/pkgs/development/interpreters/rascal/default.nix b/pkgs/development/interpreters/rascal/default.nix index 8b802043fe3..6ba92a041eb 100644 --- a/pkgs/development/interpreters/rascal/default.nix +++ b/pkgs/development/interpreters/rascal/default.nix @@ -1,14 +1,16 @@ -{ stdenv, fetchurl, makeWrapper, jdk }: +{ lib, stdenv, fetchurl, makeWrapper, jdk }: stdenv.mkDerivation rec { - name = "rascal-0.6.2"; + pname = "rascal"; + version = "0.6.2"; src = fetchurl { - url = "https://update.rascal-mpl.org/console/${name}.jar"; + url = "https://update.rascal-mpl.org/console/${pname}-${version}.jar"; sha256 = "1z4mwdbdc3r24haljnxng8znlfg2ihm9bf9zq8apd9a32ipcw4i6"; }; - buildInputs = [ makeWrapper jdk ]; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ jdk ]; dontUnpack = true; @@ -22,8 +24,8 @@ stdenv.mkDerivation rec { 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; + license = lib.licenses.epl10; + maintainers = [ lib.maintainers.eelco ]; + platforms = lib.platforms.unix; }; } diff --git a/pkgs/development/interpreters/rebol/default.nix b/pkgs/development/interpreters/rebol/default.nix deleted file mode 100644 index b26af7f0b1b..00000000000 --- a/pkgs/development/interpreters/rebol/default.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ 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/pkgs/development/interpreters/red/default.nix b/pkgs/development/interpreters/red/default.nix index 554dc81bffb..6689f7eb5c3 100644 --- a/pkgs/development/interpreters/red/default.nix +++ b/pkgs/development/interpreters/red/default.nix @@ -1,4 +1,4 @@ -{ stdenv, stdenv_32bit, pkgsi686Linux, fetchFromGitHub, fetchurl }: +{ lib, stdenv, stdenv_32bit, pkgsi686Linux, fetchFromGitHub, fetchurl }: stdenv.mkDerivation rec { pname = "red"; @@ -77,7 +77,7 @@ stdenv.mkDerivation rec { ''; - meta = with stdenv.lib; { + meta = with lib; { description = '' New programming language strongly inspired by Rebol, but with a broader field of usage thanks to its native-code compiler, from system diff --git a/pkgs/development/interpreters/regina/default.nix b/pkgs/development/interpreters/regina/default.nix index ec19b0679f4..79258d2cc0f 100644 --- a/pkgs/development/interpreters/regina/default.nix +++ b/pkgs/development/interpreters/regina/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, ncurses }: +{ lib, stdenv, fetchurl, ncurses }: stdenv.mkDerivation rec { pname = "Regina-REXX"; @@ -15,7 +15,7 @@ stdenv.mkDerivation rec { "--libdir=$(out)/lib" ]; - meta = with stdenv.lib; { + meta = with lib; { description = "REXX interpreter"; maintainers = [ maintainers.raskin ]; platforms = platforms.linux; diff --git a/pkgs/development/interpreters/renpy/default.nix b/pkgs/development/interpreters/renpy/default.nix index 41cf4c221c6..b0c10c8a652 100644 --- a/pkgs/development/interpreters/renpy/default.nix +++ b/pkgs/development/interpreters/renpy/default.nix @@ -1,5 +1,5 @@ -{ stdenv, fetchurl, python2Packages, pkgconfig, SDL2 -, libpng, ffmpeg_3, freetype, glew, libGL, libGLU, fribidi, zlib +{ lib, stdenv, fetchurl, python2Packages, pkg-config, SDL2 +, libpng, ffmpeg, freetype, glew, libGL, libGLU, fribidi, zlib , glib }: @@ -9,7 +9,7 @@ stdenv.mkDerivation rec { pname = "renpy"; version = "7.3.5"; - meta = with stdenv.lib; { + meta = with lib; { description = "Ren'Py Visual Novel Engine"; homepage = "https://renpy.org/"; license = licenses.mit; @@ -29,16 +29,16 @@ stdenv.mkDerivation rec { substituteInPlace launcher/game/choose_directory.rpy --replace /usr/bin/python ${python.interpreter} ''; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ python cython wrapPython tkinter - SDL2 libpng ffmpeg_3 freetype glew libGLU libGL fribidi zlib pygame_sdl2 glib + SDL2 libpng ffmpeg 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 + RENPY_DEPS_INSTALL = lib.concatStringsSep "::" (map (path: path) [ + SDL2 SDL2.dev libpng ffmpeg ffmpeg.out freetype glew.dev glew.out libGLU libGL fribidi zlib ]); buildPhase = '' diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix index dbfea17437d..ba132acf722 100644 --- a/pkgs/development/interpreters/ruby/default.nix +++ b/pkgs/development/interpreters/ruby/default.nix @@ -1,6 +1,6 @@ { stdenv, buildPackages, lib , fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub -, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison +, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, jemalloc, autoreconfHook, bison , autoconf, libiconv, libobjc, libunwind, Foundation , buildEnv, bundler, bundix , makeWrapper, buildRubyGem, defaultGemConfig, removeReferencesTo @@ -12,7 +12,7 @@ let opString = lib.optionalString; patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; }; config = import ./config.nix { inherit fetchFromSavannah; }; - rubygems = import ./rubygems { inherit stdenv lib fetchurl fetchpatch; }; + rubygems = import ./rubygems { inherit stdenv lib fetchurl; }; # Contains the ruby version heuristics rubyVersion = import ./ruby-version.nix { inherit lib; }; @@ -27,6 +27,7 @@ let ver = version; tag = ver.gitTag; atLeast27 = lib.versionAtLeast ver.majMin "2.7"; + atLeast30 = lib.versionAtLeast ver.majMin "3.0"; baseruby = self.override { useRailsExpress = false; docSupport = false; @@ -44,11 +45,17 @@ let , 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 + , jemalloc, jemallocSupport ? false + # By default, ruby has 3 observed references to stdenv.cc: + # + # - If you run: + # ruby -e "puts RbConfig::CONFIG['configure_args']" + # - In: + # $out/${passthru.libPath}/${stdenv.hostPlatform.system}/rbconfig.rb + # Or (usually): + # $(nix-build -A ruby)/lib/ruby/2.6.0/x86_64-linux/rbconfig.rb + # - In $out/lib/libruby.so and/or $out/lib/libruby.dylib + , removeReferencesTo, jitSupport ? false , autoreconfHook, bison, autoconf , buildEnv, bundler, bundix , libiconv, libobjc, libunwind, Foundation @@ -83,6 +90,7 @@ let ++ (op opensslSupport openssl) ++ (op gdbmSupport gdbm) ++ (op yamlSupport libyaml) + ++ (op jemallocSupport jemalloc) # 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 @@ -96,7 +104,19 @@ let (import ./patchsets.nix { inherit patchSet useRailsExpress ops fetchpatch; patchLevel = ver.patchLevel; - }).${ver.majMinTiny}; + }).${ver.majMinTiny} + ++ op atLeast27 ./do-not-regenerate-revision.h.patch + ++ op (atLeast30 && useRailsExpress) ./do-not-update-gems-baseruby.patch + # Ruby prior to 3.0 has a bug the installer (tools/rbinstall.rb) but + # the resulting error was swallowed. Newer rubygems no longer swallows + # this error. We upgrade rubygems when rubygemsSupport is enabled, so + # we have to fix this bug to prevent the install step from failing. + # See https://github.com/ruby/ruby/pull/2930 + ++ op (!atLeast30 && rubygemsSupport) + (fetchpatch { + url = "https://github.com/ruby/ruby/commit/261d8dd20afd26feb05f00a560abd99227269c1c.patch"; + sha256 = "0wrii25cxcz2v8bgkrf7ibcanjlxwclzhayin578bf0qydxdm9qy"; + }); postUnpack = opString rubygemsSupport '' rm -rf $sourceRoot/{lib,test}/rubygems* @@ -108,17 +128,17 @@ let sed -i configure.ac -e '/config.guess/d' cp --remove-destination ${config}/config.guess tool/ cp --remove-destination ${config}/config.sub tool/ + '' + opString (!atLeast30) '' + # Make the build reproducible for ruby <= 2.7 + # See https://github.com/ruby/io-console/commit/679a941d05d869f5e575730f6581c027203b7b26#diff-d8422f096931c58d4463e2489f62a228b0f24f0492950ba88c8c89a0d741cfe6 + sed -i ext/io/console/io-console.gemspec -e '/s\.date/d' ''; - # 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 (!jitSupport) "--disable-jit-support" ++ op (!docSupport) "--disable-install-doc" + ++ op (jemallocSupport) "--with-jemalloc" ++ ops stdenv.isDarwin [ # on darwin, we have /usr/include/tk.h -- so the configure script detects # that tk is installed @@ -131,6 +151,10 @@ let preConfigure = opString docSupport '' configureFlagsArray+=("--with-ridir=$devdoc/share/ri") + + # rdoc creates XDG_DATA_DIR (defaulting to $HOME/.local/share) even if + # it's not going to be used. + export HOME=$TMPDIR ''; # fails with "16993 tests, 2229489 assertions, 105 failures, 14 errors, 89 skips" @@ -144,17 +168,22 @@ let export GEM_HOME="$out/${passthru.gemPath}" ''; - installFlags = stdenv.lib.optional docSupport "install-doc"; + installFlags = lib.optional docSupport "install-doc"; # Bundler tries to create this directory postInstall = '' + rbConfig=$(find $out/lib/ruby -name rbconfig.rb) # Remove unnecessary groff reference from runtime closure, since it's big - sed -i '/NROFF/d' $out/lib/ruby/*/*/rbconfig.rb + sed -i '/NROFF/d' $rbConfig ${ - lib.optionalString removeReferenceToCC '' + lib.optionalString (!jitSupport) '' # Get rid of the CC runtime dependency ${removeReferencesTo}/bin/remove-references-to \ -t ${stdenv.cc} \ $out/lib/libruby* + ${removeReferencesTo}/bin/remove-references-to \ + -t ${stdenv.cc} \ + $rbConfig + sed -i '/CC_VERSION_MESSAGE/d' $rbConfig '' } # Bundler tries to create this directory @@ -166,14 +195,12 @@ let 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} + addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby/${ver.libDir}/${stdenv.hostPlatform.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 @@ -188,11 +215,13 @@ let sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig ''; - meta = with stdenv.lib; { + disallowedRequisites = op (!jitSupport) stdenv.cc.cc; + + meta = with lib; { description = "The Ruby language"; homepage = "http://www.ruby-lang.org/en/"; license = licenses.ruby; - maintainers = with maintainers; [ vrthra manveru ]; + maintainers = with maintainers; [ vrthra manveru marsam ]; platforms = platforms.all; }; @@ -223,27 +252,27 @@ let ) args; in self; in { - ruby_2_5 = generic { - version = rubyVersion "2" "5" "8" ""; + ruby_2_6 = generic { + version = rubyVersion "2" "6" "8" ""; sha256 = { - src = "16md4jspjwixjlbhx3pnd5iwpca07p23ghkxkqd82sbchw3xy2vc"; - git = "19gkk3q9l33cwkfsp5k8f8fipq7gkyqkqirm9farbvy425519rv2"; + src = "0vfam28ifl6h2wxi6p70j0hm3f1pvsp432hf75m5j25wfy2vf1qq"; + git = "0rc3n6sk8632r0libpv8jwslc7852hgk64rvbdrspc9razjwx21c"; }; }; - ruby_2_6 = generic { - version = rubyVersion "2" "6" "6" ""; + ruby_2_7 = generic { + version = rubyVersion "2" "7" "4" ""; sha256 = { - src = "1492x795qzgp3zhpl580kd1sdp50n5hfsmpbfhdsq2rnxwyi8jrn"; - git = "1jr9v99a7awssqmw7531afbx4a8i9x5yfqyffha545g7r4s7kj50"; + src = "0nxwkxh7snmjqf787qsp4i33mxd1rbf9yzyfiky5k230i680jhrh"; + git = "1prsrqwkla4k5japlm54k0j700j4824rg8z8kpswr9r3swrmrf5p"; }; }; - ruby_2_7 = generic { - version = rubyVersion "2" "7" "1" ""; + ruby_3_0 = generic { + version = rubyVersion "3" "0" "2" ""; sha256 = { - src = "0674x98f542y02r7n2yv2qhmh97blqhi2mvh2dn5f000vlxlh66l"; - git = "0qk729kr5wm67xmwpljpdprwhp5wvn5y4ikqy00p1zcgwlwdcs33"; + src = "1wg6yyzc6arzikcy48igqbxfcdc79bmfpiyfi9m9j1lzmphdx1ah"; + git = "1kbkxqichi11vli080jgyvjf2xgnlbl9l2f2n1hv4s8b31gjib3r"; }; }; } diff --git a/pkgs/development/interpreters/ruby/do-not-regenerate-revision.h.patch b/pkgs/development/interpreters/ruby/do-not-regenerate-revision.h.patch new file mode 100644 index 00000000000..ddeb368ee8a --- /dev/null +++ b/pkgs/development/interpreters/ruby/do-not-regenerate-revision.h.patch @@ -0,0 +1,23 @@ +Do not regenerate revision.h + +Ruby's makefile compares the shipped version with the git revision to regenerate +revision.h [1], but since we don't include git in buildInputs, this comparison +fails and it can't find $(REVISION_H). + +[1] https://github.com/ruby/ruby/commit/97a5af62a318fcd93a4e5e4428d576c0280ddbae + +diff -Naur ruby.old/defs/gmake.mk ruby.new/defs/gmake.mk +--- ruby.old/defs/gmake.mk ++++ ruby.new/defs/gmake.mk +@@ -325,11 +325,9 @@ + + REVISION_IN_HEADER := $(shell sed -n 's/^\#define RUBY_FULL_REVISION "\(.*\)"/\1/p' $(srcdir)/revision.h 2>/dev/null) + REVISION_LATEST := $(shell $(CHDIR) $(srcdir) && git log -1 --format=%H 2>/dev/null) +-ifneq ($(REVISION_IN_HEADER),$(REVISION_LATEST)) + # GNU make treat the target as unmodified when its dependents get + # updated but it is not updated, while others may not. + $(srcdir)/revision.h: $(REVISION_H) +-endif + + # Query on the generated rdoc + # diff --git a/pkgs/development/interpreters/ruby/do-not-update-gems-baseruby.patch b/pkgs/development/interpreters/ruby/do-not-update-gems-baseruby.patch new file mode 100644 index 00000000000..2de1977630c --- /dev/null +++ b/pkgs/development/interpreters/ruby/do-not-update-gems-baseruby.patch @@ -0,0 +1,14 @@ +Do not update gems when building with base ruby + +diff -Naur ruby.old/defs/gmake.mk ruby.new/defs/gmake.mk +--- ruby.old/common.mk ++++ ruby.new/common.mk +@@ -1298,7 +1298,7 @@ update-config_files: PHONY + config.guess config.sub + + refresh-gems: update-bundled_gems prepare-gems +-prepare-gems: $(HAVE_BASERUBY:yes=update-gems) $(HAVE_BASERUBY:yes=extract-gems) ++prepare-gems: + + update-gems$(gnumake:yes=-nongnumake): PHONY + $(ECHO) Downloading bundled gem files... diff --git a/pkgs/development/interpreters/ruby/patchsets.nix b/pkgs/development/interpreters/ruby/patchsets.nix index b0c26e19e13..5c2992bb859 100644 --- a/pkgs/development/interpreters/ruby/patchsets.nix +++ b/pkgs/development/interpreters/ruby/patchsets.nix @@ -1,19 +1,18 @@ { patchSet, useRailsExpress, ops, patchLevel, fetchpatch }: { - "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 [ + "2.6.8" = 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 [ + "2.7.4" = 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" ]; + "3.0.2" = ops useRailsExpress [ + "${patchSet}/patches/ruby/3.0/head/railsexpress/01-improve-gc-stats.patch" + "${patchSet}/patches/ruby/3.0/head/railsexpress/02-malloc-trim.patch" + ]; } diff --git a/pkgs/development/interpreters/ruby/rubygems/default.nix b/pkgs/development/interpreters/ruby/rubygems/default.nix index 0bbcadba3f5..6f089e51221 100644 --- a/pkgs/development/interpreters/ruby/rubygems/default.nix +++ b/pkgs/development/interpreters/ruby/rubygems/default.nix @@ -1,23 +1,18 @@ -{ stdenv, lib, fetchurl, fetchpatch }: +{ stdenv, lib, fetchurl }: stdenv.mkDerivation rec { name = "rubygems"; - version = "3.1.2"; + version = "3.2.24"; src = fetchurl { url = "https://rubygems.org/rubygems/rubygems-${version}.tgz"; - sha256 = "0h7ij4jpj8rgnpkl63cwh2lnav73pw5wpfqra3va7077lsyadlgd"; + sha256 = "09ff830a043y6s7390hsg3k55ffpifb1zsvs0dhz8z8pypwgiscl"; }; 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 = '' @@ -30,6 +25,6 @@ stdenv.mkDerivation rec { description = "Package management framework for Ruby"; homepage = "https://rubygems.org/"; license = with licenses; [ mit /* or */ ruby ]; - maintainers = with maintainers; [ qyliss zimbatm ]; + maintainers = with maintainers; [ zimbatm ]; }; } diff --git a/pkgs/development/interpreters/ruby/rvm-patchsets.nix b/pkgs/development/interpreters/ruby/rvm-patchsets.nix index 331dda5d050..88b75a5aa06 100644 --- a/pkgs/development/interpreters/ruby/rvm-patchsets.nix +++ b/pkgs/development/interpreters/ruby/rvm-patchsets.nix @@ -3,6 +3,6 @@ fetchFromGitHub { owner = "skaes"; repo = "rvm-patchsets"; - rev = "6d8888d34a321198f7fd9253343b78c209efb046"; - sha256 = "0xczl0nng1649km3bcbjn6zrr591l6m2kkwgnknh1fnwmmrdaya7"; + rev = "0251817e2b9d5f73370bbbb12fdf7f7089bd1ac3"; + sha256 = "1biiq5xzzdfb4hr1sgmx14i2nr05xa9w21pc7dl8c5n4f2ilg8ss"; } diff --git a/pkgs/development/interpreters/s9fes/default.nix b/pkgs/development/interpreters/s9fes/default.nix new file mode 100644 index 00000000000..a05dde8f1f5 --- /dev/null +++ b/pkgs/development/interpreters/s9fes/default.nix @@ -0,0 +1,35 @@ +{ stdenv, lib, fetchurl, ncurses, buildPackages }: + +let + isCrossCompiling = stdenv.hostPlatform != stdenv.buildPlatform; +in + +stdenv.mkDerivation rec { + pname = "s9fes"; + version = "20181205"; + + src = fetchurl { + url = "https://www.t3x.org/s9fes/s9fes-${version}.tgz"; + sha256 = "sha256-Lp/akaDy3q4FmIE6x0fj9ae/SOD7tdsmzy2xdcCh13o="; + }; + + # Fix cross-compilation + postPatch = '' + substituteInPlace Makefile \ + --replace 'ar q' '${stdenv.cc.targetPrefix}ar q' \ + --replace 'strip' '${stdenv.cc.targetPrefix}strip' + ${lib.optionalString isCrossCompiling "substituteInPlace Makefile --replace ./s9 '${buildPackages.s9fes}/bin/s9'"} + ''; + + buildInputs = [ ncurses ]; + makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" "PREFIX=$(out)" ]; + enableParallelBuilding = true; + + meta = with lib; { + description = "Scheme 9 From Empty Space, an interpreter for R4RS Scheme"; + homepage = "http://www.t3x.org/s9fes/index.html"; + license = licenses.publicDomain; + maintainers = with maintainers; [ siraben ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/development/interpreters/scheme48/default.nix b/pkgs/development/interpreters/scheme48/default.nix index 5a1e3f265b2..883b0b2f39a 100644 --- a/pkgs/development/interpreters/scheme48/default.nix +++ b/pkgs/development/interpreters/scheme48/default.nix @@ -1,17 +1,24 @@ -{ stdenv, fetchurl }: +{ lib, 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; - }; +stdenv.mkDerivation rec { + pname = "scheme48"; + version = "1.9.2"; src = fetchurl { - url = "http://s48.org/1.9.2/scheme48-1.9.2.tgz"; + url = "http://s48.org/${version}/scheme48-${version}.tgz"; sha256 = "1x4xfm3lyz2piqcw1h01vbs1iq89zq7wrsfjgh3fxnlm1slj2jcw"; }; + + # Make more reproducible by removing build user and date. + postPatch = '' + substituteInPlace build/build-usual-image --replace '"(made by $USER on $date)"' '""' + ''; + + meta = with lib; { + homepage = "http://s48.org/"; + description = "Scheme 48 interpreter for R5RS"; + platforms = platforms.unix; + license = licenses.bsd3; + maintainers = [ maintainers.siraben ]; + }; } diff --git a/pkgs/development/interpreters/scsh/default.nix b/pkgs/development/interpreters/scsh/default.nix index bb4f418f502..6dcb8bd27c5 100644 --- a/pkgs/development/interpreters/scsh/default.nix +++ b/pkgs/development/interpreters/scsh/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchgit, autoreconfHook, scheme48 }: +{ lib, stdenv, fetchgit, autoreconfHook, scheme48 }: stdenv.mkDerivation { name = "scsh-0.7pre"; @@ -14,7 +14,7 @@ stdenv.mkDerivation { buildInputs = [ scheme48 ]; configureFlags = [ "--with-scheme48=${scheme48}" ]; - meta = with stdenv.lib; { + meta = with lib; { description = "A Scheme shell"; homepage = "http://www.scsh.net/"; license = licenses.bsd3; diff --git a/pkgs/development/interpreters/self/default.nix b/pkgs/development/interpreters/self/default.nix index ccf85f1d1c4..58cac6bbe9b 100644 --- a/pkgs/development/interpreters/self/default.nix +++ b/pkgs/development/interpreters/self/default.nix @@ -1,26 +1,28 @@ -{ fetchgit, stdenv, xorg, makeWrapper, ncurses, cmake }: +{ lib, stdenv, fetchFromGitHub, libX11, libXext, makeWrapper, ncurses, cmake }: -stdenv.mkDerivation { - # The Self wrapper stores source in $XDG_DATA_HOME/self or ~/.local/share/self +stdenv.mkDerivation rec { + # The Self wrapper stores source in $XDG_DATA_HOME/self or ~/.local/share/self # so that it can be written to when using the Self transposer. Running 'Self' # after installation runs without an image. You can then build a Self image with: # $ cd ~/.local/share/self/objects - # $ Self + # $ Self # > 'worldBuilder.self' _RunScript # # This image can later be started with: # $ Self -s myimage.snap # - version = "4.5.0"; pname = "self"; + version = "2017.1"; - src = fetchgit { - url = "https://github.com/russellallen/self"; - rev = "d16bcaad3c5092dae81ad0b16d503f2a53b8ef86"; - sha256 = "1dhs6209407j0ll9w9id31vbawdrm9nz1cjak8g8hixrw1nid4i5"; + src = fetchFromGitHub { + owner = "russellallen"; + repo = pname; + rev = version; + sha256 = "C/1Q6yFmoXx2F97xuvkm8DxFmmvuBS7uYZOxq/CRNog="; }; - buildInputs = [ ncurses xorg.libX11 xorg.libXext makeWrapper cmake ]; + nativeBuildInputs = [ cmake makeWrapper ]; + buildInputs = [ ncurses libX11 libXext ]; selfWrapper = ./self; @@ -33,12 +35,11 @@ stdenv.mkDerivation { --set SELF_ROOT "$out" ''; - meta = { + meta = with lib; { 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 + homepage = "https://selflanguage.org/"; + license = licenses.bsd3; + maintainers = [ maintainers.doublec ]; + platforms = platforms.linux; }; } diff --git a/pkgs/development/interpreters/shen-sbcl/default.nix b/pkgs/development/interpreters/shen-sbcl/default.nix new file mode 100644 index 00000000000..f93e0ae5d95 --- /dev/null +++ b/pkgs/development/interpreters/shen-sbcl/default.nix @@ -0,0 +1,32 @@ +{ lib, 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 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/pkgs/development/interpreters/shen-sources/default.nix b/pkgs/development/interpreters/shen-sources/default.nix new file mode 100644 index 00000000000..84839cf42de --- /dev/null +++ b/pkgs/development/interpreters/shen-sources/default.nix @@ -0,0 +1,28 @@ +{ lib, 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 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/pkgs/development/interpreters/sollya/default.nix b/pkgs/development/interpreters/sollya/default.nix new file mode 100644 index 00000000000..5c439347f07 --- /dev/null +++ b/pkgs/development/interpreters/sollya/default.nix @@ -0,0 +1,29 @@ +{ lib +, stdenv +, fetchurl +, gmp +, mpfr +, mpfi +, libxml2 +, fplll +}: + +stdenv.mkDerivation rec { + pname = "sollya"; + version = "7.0"; + + src = fetchurl { + url = "https://www.sollya.org/releases/sollya-${version}/sollya-${version}.tar.gz"; + sha256 = "0amrxg7567yy5xqpgchxggjpfr11xyl27vy29c7vlh7v8a17nj1h"; + }; + + buildInputs = [ gmp mpfr mpfi libxml2 fplll ]; + + meta = with lib; { + description = "A tool environment for safe floating-point code development"; + homepage = "https://www.sollya.org/"; + license = licenses.cecill-c; + platforms = platforms.linux; + maintainers = with maintainers; [ eduardosm ]; + }; +} diff --git a/pkgs/development/interpreters/spidermonkey/1.8.5.nix b/pkgs/development/interpreters/spidermonkey/1.8.5.nix deleted file mode 100644 index 37efeba3f9b..00000000000 --- a/pkgs/development/interpreters/spidermonkey/1.8.5.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ 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/pkgs/development/interpreters/spidermonkey/38.nix b/pkgs/development/interpreters/spidermonkey/38.nix deleted file mode 100644 index d2aabfe64d9..00000000000 --- a/pkgs/development/interpreters/spidermonkey/38.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ 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/pkgs/development/interpreters/spidermonkey/60.nix b/pkgs/development/interpreters/spidermonkey/60.nix deleted file mode 100644 index 42731421d81..00000000000 --- a/pkgs/development/interpreters/spidermonkey/60.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ 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/pkgs/development/interpreters/spidermonkey/68.nix b/pkgs/development/interpreters/spidermonkey/68.nix index 36d28f62e2e..420c3d72f89 100644 --- a/pkgs/development/interpreters/spidermonkey/68.nix +++ b/pkgs/development/interpreters/spidermonkey/68.nix @@ -1,7 +1,7 @@ -{ stdenv, fetchurl, fetchpatch, autoconf213, pkgconfig, perl, python2, python3, zip, buildPackages +{ lib, stdenv, fetchurl, fetchpatch, autoconf213, pkg-config, perl, python2, python3, zip, buildPackages , which, readline, zlib, icu, cargo, rustc, llvmPackages }: -with stdenv.lib; +with lib; let python3Env = buildPackages.python3.withPackages (p: [p.six]); @@ -14,12 +14,21 @@ in stdenv.mkDerivation rec { sha256 = "0azdinwqjfv2q37gqpxmfvzsk86pvsi6cjaq1310zs26gric5j1f"; }; + patches = [ + # Backport a change from Firefox 75 that fixes finding the + # location of clang and libclang. + (fetchpatch { + url = "https://hg.mozilla.org/mozilla-central/raw-rev/ccd1356fc8f1d0bfa9d896e88d3cc924425623da"; + sha256 = "005g3mfmal9nw32khrgyiv3221z7pazfhhm2qvgc8d48i2yzj3j0"; + }) + ]; + outputs = [ "out" "dev" ]; setOutputFlags = false; # Configure script only understands --includedir nativeBuildInputs = [ autoconf213 - pkgconfig + pkg-config perl which python2 @@ -55,9 +64,6 @@ in stdenv.mkDerivation rec { "--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 @@ -85,11 +91,12 @@ in stdenv.mkDerivation rec { enableParallelBuilding = true; - meta = with stdenv.lib; { + meta = with 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 ]; + badPlatforms = [ "riscv32-linux" "riscv64-linux" ]; platforms = platforms.linux; }; } diff --git a/pkgs/development/interpreters/spidermonkey/78.nix b/pkgs/development/interpreters/spidermonkey/78.nix new file mode 100644 index 00000000000..9b81dcc55e7 --- /dev/null +++ b/pkgs/development/interpreters/spidermonkey/78.nix @@ -0,0 +1,125 @@ +{ lib, stdenv +, fetchurl +, fetchpatch +, autoconf213 +, pkg-config +, perl +, python3 +, zip +, buildPackages +, which +, readline +, zlib +, icu67 +, cargo +, rustc +, rust-cbindgen +, yasm +, llvmPackages_11 +, nspr +}: + +stdenv.mkDerivation rec { + pname = "spidermonkey"; + version = "78.11.0"; + + src = fetchurl { + url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz"; + sha256 = "0zjpzkxx3wc2840d7q4b9lnkj1kwk1qps29s9c83jf5y6xclnf9q"; + }; + + patches = [ + # Fix build failure on armv7l using Debian patch + # Upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1526653 + (fetchpatch { + url = "https://salsa.debian.org/mozilla-team/firefox/commit/fd6847c9416f9eebde636e21d794d25d1be8791d.patch"; + sha256 = "02b7zwm6vxmk61aj79a6m32s1k5sr0hwm3q1j4v6np9jfyd10g1j"; + }) + ]; + + outputs = [ "out" "dev" ]; + setOutputFlags = false; # Configure script only understands --includedir + + nativeBuildInputs = [ + autoconf213 + cargo + llvmPackages_11.llvm # for llvm-objdump + perl + pkg-config + python3 + rust-cbindgen + rustc + which + yasm # to buid icu? seems weird + zip + ]; + + buildInputs = [ + icu67 + nspr + readline + zlib + ]; + + preConfigure = '' + export CXXFLAGS="-fpermissive" + export LIBXUL_DIST=$out + export PYTHON="${buildPackages.python3.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-nspr" + "--with-system-icu" + "--with-intl-api" + "--enable-readline" + "--enable-shared-js" + "--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" + ] ++ lib.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/js78-config "$dev" + rm $out/lib/libjs_static.ajs + ln -s $out/bin/js78 $out/bin/js + ''; + + enableParallelBuilding = true; + + postPatch = '' + # This patch is a manually applied fix of + # https://bugzilla.mozilla.org/show_bug.cgi?id=1644600 + # Once that bug is fixed, this can be removed. + # This is needed in, for example, `zeroad`. + substituteInPlace js/public/StructuredClone.h \ + --replace "class SharedArrayRawBufferRefs {" \ + "class JS_PUBLIC_API SharedArrayRawBufferRefs {" + ''; + + meta = with lib; { + description = "Mozilla's JavaScript engine written in C/C++"; + homepage = "https://spidermonkey.dev/"; + license = licenses.gpl2; # TODO: MPL/GPL/LGPL tri-license. + maintainers = with maintainers; [ abbradar lostnet ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/development/interpreters/supercollider/default.nix b/pkgs/development/interpreters/supercollider/default.nix index eed0bdc5807..fc8d8f1652d 100644 --- a/pkgs/development/interpreters/supercollider/default.nix +++ b/pkgs/development/interpreters/supercollider/default.nix @@ -1,20 +1,19 @@ -{ stdenv, mkDerivation, fetchurl, cmake, pkgconfig, alsaLib +{ lib, stdenv, mkDerivation, fetchurl, cmake, pkg-config, alsa-lib , libjack2, libsndfile, fftw, curl, gcc , libXt, qtbase, qttools, qtwebengine , readline, qtwebsockets, useSCEL ? false, emacs }: -let optional = stdenv.lib.optional; +let + inherit (lib) optional; in - mkDerivation rec { pname = "supercollider"; - version = "3.11.0"; - + version = "3.11.2"; src = fetchurl { url = "https://github.com/supercollider/supercollider/releases/download/Version-${version}/SuperCollider-${version}-Source.tar.bz2"; - sha256 = "0l5j7sqrjlm85ql91ybcrvdykfkkwfqd7w3m4llbymw720r2ln9p"; + sha256 = "wiwyxrxIJnHU+49RZy33Etl6amJ3I1xNojEpEDA6BQY="; }; hardeningDisable = [ "stackprotector" ]; @@ -24,20 +23,18 @@ mkDerivation rec { "-DSC_EL=${if useSCEL then "ON" else "OFF"}" ]; - nativeBuildInputs = [ cmake pkgconfig qttools ]; - - enableParallelBuilding = true; + nativeBuildInputs = [ cmake pkg-config qttools ]; buildInputs = [ gcc libjack2 libsndfile fftw curl libXt qtbase qtwebengine qtwebsockets readline ] - ++ optional (!stdenv.isDarwin) alsaLib + ++ optional (!stdenv.isDarwin) alsa-lib ++ optional useSCEL emacs; - meta = with stdenv.lib; { + meta = with lib; { description = "Programming language for real time audio synthesis"; homepage = "https://supercollider.github.io"; maintainers = with maintainers; [ mrmebelman ]; - license = licenses.gpl3; + license = licenses.gpl3Plus; platforms = [ "x686-linux" "x86_64-linux" ]; }; } diff --git a/pkgs/development/interpreters/tcl/8.6.nix b/pkgs/development/interpreters/tcl/8.6.nix index d76ceb3421d..37a7fee8a85 100644 --- a/pkgs/development/interpreters/tcl/8.6.nix +++ b/pkgs/development/interpreters/tcl/8.6.nix @@ -2,10 +2,10 @@ callPackage ./generic.nix (args // rec { release = "8.6"; - version = "${release}.9"; + version = "${release}.11"; src = fetchurl { url = "mirror://sourceforge/tcl/tcl${version}-src.tar.gz"; - sha256 = "0kjzj7mkzfnb7ksxanbibibfpciyvsh5ffdlhs0bmfc75kgd435d"; + sha256 = "0n4211j80mxr6ql0xx52rig8r885rcbminfpjdb2qrw6hmk8c14c"; }; }) diff --git a/pkgs/development/interpreters/tcl/generic.nix b/pkgs/development/interpreters/tcl/generic.nix index 9aaf8223837..beb95d51d2c 100644 --- a/pkgs/development/interpreters/tcl/generic.nix +++ b/pkgs/development/interpreters/tcl/generic.nix @@ -1,55 +1,67 @@ -{ stdenv +{ lib, stdenv, callPackage, makeSetupHook, makeWrapper # 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}"; - }; -} +let + baseInterp = + stdenv.mkDerivation { + pname = "tcl"; + inherit version 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" + ] ++ 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 lib; { + description = "The Tcl scripting language"; + homepage = "https://www.tcl.tk/"; + license = licenses.tcltk; + platforms = platforms.all; + maintainers = with maintainers; [ agbrooks ]; + }; + + passthru = rec { + inherit release version; + libPrefix = "tcl${release}"; + libdir = "lib/${libPrefix}"; + tclPackageHook = callPackage ({}: makeSetupHook { + name = "tcl-package-hook"; + deps = [ makeWrapper ]; + } ./tcl-package-hook.sh) {}; + }; + }; + + mkTclDerivation = callPackage ./mk-tcl-derivation.nix { tcl = baseInterp; }; + +in baseInterp.overrideAttrs (self: { + passthru = self.passthru // { + inherit mkTclDerivation; + }; +}) diff --git a/pkgs/development/interpreters/tcl/mk-tcl-derivation.nix b/pkgs/development/interpreters/tcl/mk-tcl-derivation.nix new file mode 100644 index 00000000000..4f3ffe6f995 --- /dev/null +++ b/pkgs/development/interpreters/tcl/mk-tcl-derivation.nix @@ -0,0 +1,69 @@ +# Generic builder for tcl packages/applications, generally based on mk-python-derivation.nix +{ tcl +, lib +, makeWrapper +, runCommand +, writeScript +}: + +{ buildInputs ? [] +, nativeBuildInputs ? [] +, propagatedBuildInputs ? [] +, checkInputs ? [] + +# true if we should skip the configuration phase altogether +, dontConfigure ? false + +# Extra flags passed to configure step +, configureFlags ? [] + +# Whether or not we should add common Tcl-related configure flags +, addTclConfigureFlags ? true + +, meta ? {} +, passthru ? {} +, doCheck ? true +, ... } @ attrs: + +let + inherit (tcl) stdenv; + inherit (lib) getBin optionalAttrs optionals; + + defaultTclPkgConfigureFlags = [ + "--with-tcl=${tcl}/lib" + "--with-tclinclude=${tcl}/include" + "--exec-prefix=\${out}" + ]; + + self = (stdenv.mkDerivation ((builtins.removeAttrs attrs [ + "addTclConfigureFlags" "checkPhase" "checkInputs" "doCheck" + ]) // { + + buildInputs = buildInputs ++ [ makeWrapper tcl.tclPackageHook ]; + nativeBuildInputs = nativeBuildInputs ++ [ tcl ]; + propagatedBuildInputs = propagatedBuildInputs ++ [ tcl ]; + + TCLSH = "${getBin tcl}/bin/tclsh"; + + # Run tests after install, at which point we've done all TCLLIBPATH setup + doCheck = false; + doInstallCheck = attrs.doCheck or ((attrs ? doInstallCheck) && attrs.doInstallCheck); + installCheckInputs = checkInputs ++ (optionals (attrs ? installCheckInputs) attrs.installCheckInputs); + + # Add typical values expected by TEA for configureFlags + configureFlags = + if (!dontConfigure && addTclConfigureFlags) + then (configureFlags ++ defaultTclPkgConfigureFlags) + else configureFlags; + + meta = { + platforms = tcl.meta.platforms; + } // meta; + + + } // optionalAttrs (attrs?checkPhase) { + installCheckPhase = attrs.checkPhase; + } + )); + +in lib.extendDerivation true passthru self diff --git a/pkgs/development/interpreters/tcl/tcl-package-hook.sh b/pkgs/development/interpreters/tcl/tcl-package-hook.sh new file mode 100644 index 00000000000..41603037931 --- /dev/null +++ b/pkgs/development/interpreters/tcl/tcl-package-hook.sh @@ -0,0 +1,78 @@ +# This hook ensures that we do the following in post-fixup: +# * wrap any installed executables with a wrapper that configures TCLLIBPATH +# * write a setup hook that extends the TCLLIBPATH of any anti-dependencies + +tclWrapperArgs=( ${tclWrapperArgs-} ) + +# Add a directory to TCLLIBPATH, provided that it exists +_addToTclLibPath() { + local tclPkg="$1" + if [[ -z "$tclPkg" ]]; then + return + fi + + if [[ ! -d "$tclPkg" ]]; then + >&2 echo "can't add $tclPkg to TCLLIBPATH; that directory doesn't exist" + exit 1 + fi + + if [[ "$tclPkg" == *" "* ]]; then + tclPkg="{$tclPkg}" + fi + + if [[ -z "${TCLLIBPATH-}" ]]; then + export TCLLIBPATH="$tclPkg" + else + if [[ "$TCLLIBPATH" != *"$tclPkg "* && "$TCLLIBPATH" != *"$tclPkg" ]]; then + export TCLLIBPATH="${TCLLIBPATH} $tclPkg" + fi + fi +} + +# Locate any directory containing an installed pkgIndex file +findInstalledTclPkgs() { + local -r newLibDir="${!outputLib}/lib" + if [[ ! -d "$newLibDir" ]]; then + >&2 echo "Assuming no loadable tcl packages installed ($newLibDir does not exist)" + return + fi + echo "$(find "$newLibDir" -name pkgIndex.tcl -exec dirname {} \;)" +} + +# Wrap any freshly-installed binaries and set up their TCLLIBPATH +wrapTclBins() { + if [[ -z "${TCLLIBPATH-}" ]]; then + echo "skipping automatic Tcl binary wrapping (nothing to do)" + return + fi + + local -r tclBinsDir="${!outputBin}/bin" + if [[ ! -d "$tclBinsDir" ]]; then + echo "No outputBin found, not using any TCLLIBPATH wrapper" + return + fi + + tclWrapperArgs+=(--prefix TCLLIBPATH ' ' "$TCLLIBPATH") + + find "$tclBinsDir" -type f -executable -print | + while read -r someBin; do + echo "Adding TCLLIBPATH wrapper for $someBin" + wrapProgram "$someBin" "${tclWrapperArgs[@]}" + done +} + +# Generate hook to adjust TCLLIBPATH in anti-dependencies +writeTclLibPathHook() { + local -r hookPath="${!outputLib}/nix-support/setup-hook" + mkdir -p "$(dirname "$hookPath")" + + typeset -f _addToTclLibPath >> "$hookPath" + local -r tclPkgs=$(findInstalledTclPkgs) + while IFS= read -r tclPkg; do + echo "_addToTclLibPath \"$tclPkg\"" >> "$hookPath" + _addToTclLibPath "$tclPkg" true + done <<< "$tclPkgs" +} + +postFixupHooks+=(writeTclLibPathHook) +postFixupHooks+=(wrapTclBins) diff --git a/pkgs/development/interpreters/tclreadline/default.nix b/pkgs/development/interpreters/tclreadline/default.nix new file mode 100644 index 00000000000..de671bab573 --- /dev/null +++ b/pkgs/development/interpreters/tclreadline/default.nix @@ -0,0 +1,66 @@ +{ lib, stdenv +, fetchFromGitHub +, automake +, autoconf +, libtool +, readline +, tcl +, tk +}: + +tcl.mkTclDerivation rec { + pname = "tclreadline"; + version = "2.3.8"; + + src = fetchFromGitHub { + owner = "flightaware"; + repo = "tclreadline"; + rev = "v${version}"; + sha256 = "18jl56p0hwgynxpvr0v7b5mvvzc1m64fn61c0957bgb45mc250yq"; + }; + + nativeBuildInputs = [ + automake + autoconf + libtool + ]; + buildInputs = [ + readline + tk + ]; + + preConfigure = "NOCONFIGURE=1 ./autogen.sh"; + + configureFlags = [ + "--enable-tclshrl" + "--enable-wishrl" + "--with-tk=${tk}/lib" + "--with-readline-includes=${readline.dev}/include/readline" + "--with-libtool=${libtool}" + ]; + + # The provided makefile leaves a wrong reference to /build/ in RPATH, + # so we fix it after checking that everything is also present in $out + preFixup = lib.optionalString stdenv.isLinux '' + needed_libraries=$(ls .libs | grep '\.\(so\|la\)$') + for lib in $needed_libraries; do + if ! ls $out/lib | grep "$lib"; then + echo "$lib was not installed correctly" + exit 1 + fi + done + for executable in $out/bin/{wishrl,tclshrl}; do + patchelf --set-rpath \ + "$(patchelf --print-rpath "$executable" | sed "s@$builddir/.libs@$out/lib@")" \ + "$executable" + done + ''; + + meta = with lib; { + description = "GNU readline for interactive tcl shells"; + homepage = "https://github.com/flightaware/tclreadline"; + license = licenses.bsd3; + maintainers = with maintainers; [ fgaz ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/development/interpreters/tinyscheme/default.nix b/pkgs/development/interpreters/tinyscheme/default.nix index b49a37a7285..3d4cfea465a 100644 --- a/pkgs/development/interpreters/tinyscheme/default.nix +++ b/pkgs/development/interpreters/tinyscheme/default.nix @@ -1,12 +1,12 @@ -{ stdenv, fetchurl }: +{ lib, stdenv, fetchurl }: stdenv.mkDerivation rec { pname = "tinyscheme"; - version = "1.41"; + version = "1.42"; src = fetchurl { url = "mirror://sourceforge/tinyscheme/${pname}-${version}.tar.gz"; - sha256 = "168rk4zrlhsknbvldq2jsgabpwlqkx6la44gkqmijmf7jhs11h7a"; + sha256 = "sha256-F7Cxv/0i89SdWDPiKhILM5A50s/aC0bW/FHdLwG0B60="; }; patchPhase = '' @@ -19,7 +19,7 @@ stdenv.mkDerivation rec { cp scheme $out/bin/tinyscheme ''; - meta = with stdenv.lib; { + meta = with lib; { description = "Lightweight Scheme implementation"; longDescription = '' TinyScheme is a lightweight Scheme interpreter that implements as large a diff --git a/pkgs/development/interpreters/trealla/default.nix b/pkgs/development/interpreters/trealla/default.nix new file mode 100644 index 00000000000..f72c8b69eb1 --- /dev/null +++ b/pkgs/development/interpreters/trealla/default.nix @@ -0,0 +1,48 @@ +{ lib, stdenv, fetchFromGitHub, readline, openssl, withThread ? true, withSSL ? true, xxd }: + +stdenv.mkDerivation rec { + pname = "trealla"; + version = "1.9.37"; + + src = fetchFromGitHub { + owner = "infradig"; + repo = "trealla"; + rev = "v${version}"; + sha256 = "sha256-0cj4FGaYKIKCgWwRyLUw1DcvNnioQPOtqZhSvWSaojU="; + }; + + postPatch = '' + substituteInPlace Makefile \ + --replace '-I/usr/local/include' "" \ + --replace '-L/usr/local/lib' "" \ + --replace 'GIT_VERSION :=' 'GIT_VERSION ?=' + ''; + + makeFlags = [ + "GIT_VERSION=\"v${version}\"" + (lib.optionalString withThread "THREADS=1") + (lib.optionalString (!withSSL) "NOSSL=1") + (lib.optionalString stdenv.isDarwin "NOLDLIBS=1") + ]; + + nativeBuildInputs = [ xxd ]; + buildInputs = [ readline openssl ]; + + installPhase = '' + install -Dm755 -t $out/bin tpl + ''; + + doCheck = true; + preCheck = '' + # Disable test 81 due to floating point error + rm tests/issues/test081.expected tests/issues/test081.pl + ''; + + meta = with lib; { + description = "A compact, efficient Prolog interpreter written in ANSI C"; + homepage = "https://github.com/infradig/trealla"; + license = licenses.mit; + maintainers = with maintainers; [ siraben ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/development/interpreters/unicon-lang/default.nix b/pkgs/development/interpreters/unicon-lang/default.nix index d908346f196..c399ef223de 100644 --- a/pkgs/development/interpreters/unicon-lang/default.nix +++ b/pkgs/development/interpreters/unicon-lang/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, unzip, libX11, libXt }: +{ lib, stdenv, fetchurl, unzip, libX11, libXt, libnsl }: stdenv.mkDerivation { pname = "unicon-lang"; @@ -7,7 +7,8 @@ stdenv.mkDerivation { url = "http://unicon.org/dist/uni-2-4-2010.zip"; sha256 = "1g9l2dfp99dqih2ir2limqfjgagh3v9aqly6x0l3qavx3qkkwf61"; }; - buildInputs = [ libX11 libXt unzip ]; + nativeBuildInputs = [ unzip ]; + buildInputs = [ libnsl libX11 libXt ]; hardeningDisable = [ "fortify" ]; @@ -33,12 +34,11 @@ stdenv.mkDerivation { cp -r bin $out/ ''; - meta = with stdenv.lib; { - description = ''A very high level, goal-directed, object-oriented, general purpose applications language''; + meta = with 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/pkgs/development/interpreters/wasm3/default.nix b/pkgs/development/interpreters/wasm3/default.nix new file mode 100644 index 00000000000..b16dc78ac08 --- /dev/null +++ b/pkgs/development/interpreters/wasm3/default.nix @@ -0,0 +1,33 @@ +{ lib, stdenv, cmake, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "wasm3"; + version = "0.5.0"; + + src = fetchFromGitHub { + owner = "wasm3"; + repo = "wasm3"; + rev = "v${version}"; + sha256 = "07zzmk776j8ydyxhrnnjiscbhhmz182a62r6aix6kfk5kq2cwia2"; + }; + + nativeBuildInputs = [ cmake ]; + + cmakeFlags = [ + "-DBUILD_WASI=simple" + ]; + + installPhase = '' + runHook preInstal + install -Dm755 wasm3 -t $out/bin + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://github.com/wasm3/wasm3"; + description = "The fastest WebAssembly interpreter, and the most universal runtime."; + platforms = platforms.all; + maintainers = with maintainers; [ malbarbo ]; + license = licenses.mit; + }; +} diff --git a/pkgs/development/interpreters/wasmer/default.nix b/pkgs/development/interpreters/wasmer/default.nix index c620b1686ea..4dcb70bd3ec 100644 --- a/pkgs/development/interpreters/wasmer/default.nix +++ b/pkgs/development/interpreters/wasmer/default.nix @@ -8,21 +8,36 @@ rustPlatform.buildRustPackage rec { pname = "wasmer"; - version = "0.17.0"; + version = "2.0.0"; src = fetchFromGitHub { owner = "wasmerio"; repo = pname; rev = version; - sha256 = "05g4h0xkqd14wnmijiiwmhk6l909fjxr6a2zplrjfxk5bypdalpm"; + sha256 = "191f60db2y1f3xw1x81mw88vclf1c4kgvnfv74g5vb3vn7n57c5j"; fetchSubmodules = true; }; - cargoSha256 = "1ssmgx9fjvkq7ycyzjanqmlm5b80akllq6qyv3mj0k5fvs659wcq"; + cargoSha256 = "0hhwixqhrl79hpzmvq7ga3kp2cfrwr4i8364cwnr7195xwnfxb0k"; nativeBuildInputs = [ cmake pkg-config ]; - LIBCLANG_PATH = "${llvmPackages.libclang}/lib"; + cargoBuildFlags = [ + # cranelift+jit works everywhere, see: + # https://github.com/wasmerio/wasmer/blob/master/Makefile#L22 + "--features" "cranelift,jit" + # must target manifest and desired output bin, otherwise output is empty + "--manifest-path" "lib/cli/Cargo.toml" + "--bin" "wasmer" + ]; + + cargoTestFlags = [ + "--features" "test-cranelift" + # Can't use test-jit : + # error: Package `wasmer-workspace v2.0.0 (/build/source)` does not have the feature `test-jit` + ]; + + LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; meta = with lib; { description = "The Universal WebAssembly Runtime"; @@ -34,6 +49,6 @@ rustPlatform.buildRustPackage rec { ''; homepage = "https://wasmer.io/"; license = licenses.mit; - maintainers = with maintainers; [ filalex77 ]; + maintainers = with maintainers; [ Br1ght0ne shamilton ]; }; } diff --git a/pkgs/development/interpreters/wasmtime/default.nix b/pkgs/development/interpreters/wasmtime/default.nix index f7ef111bc66..675a7cdd6bc 100644 --- a/pkgs/development/interpreters/wasmtime/default.nix +++ b/pkgs/development/interpreters/wasmtime/default.nix @@ -2,28 +2,28 @@ rustPlatform.buildRustPackage rec { pname = "wasmtime"; - version = "0.19.0"; + version = "0.21.0"; src = fetchFromGitHub { owner = "bytecodealliance"; - repo = "${pname}"; + repo = pname; rev = "v${version}"; - sha256 = "0gb8xk27ych553b7knflbbks9q64m39v40sdirycm6prqfnfrnm8"; + sha256 = "0q7wsnq5zdskxwzsxwm98jfnv2frnwca1dkhwndcn9yyz2gyw57m"; fetchSubmodules = true; }; - cargoSha256 = "1dqaxpwfm234yjwrhglzvsqhh2fr5nsx7bpk7bmycyk6lml8vxy7"; + cargoSha256 = "1wlig9gls7s1k1swxwhl82vfga30bady8286livxc4y2zp0vb18w"; nativeBuildInputs = [ python cmake clang ]; buildInputs = [ llvmPackages.libclang ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]; - LIBCLANG_PATH = "${llvmPackages.libclang}/lib"; + LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; doCheck = true; meta = with lib; { description = "Standalone JIT-style runtime for WebAssembly, using Cranelift"; - homepage = "https://github.com/CraneStation/wasmtime"; + homepage = "https://github.com/bytecodealliance/wasmtime"; license = licenses.asl20; maintainers = [ maintainers.matthewbauer ]; platforms = platforms.unix; diff --git a/pkgs/development/interpreters/yabasic/default.nix b/pkgs/development/interpreters/yabasic/default.nix new file mode 100644 index 00000000000..414171082e3 --- /dev/null +++ b/pkgs/development/interpreters/yabasic/default.nix @@ -0,0 +1,43 @@ +{ lib +, stdenv +, fetchurl +, libSM +, libX11 +, libXt +, libffi +, ncurses +}: + +stdenv.mkDerivation rec { + pname = "yabasic"; + version = "2.89.1"; + + src = fetchurl { + url = "http://www.yabasic.de/download/${pname}-${version}.tar.gz"; + hash = "sha256-k8QmQCpszLyotEiWDrG878RM2wqSq7I4W9j6Z2Ub3Yg="; + }; + + buildInputs = [ + libSM + libX11 + libXt + libffi + ncurses + ]; + + meta = with lib; { + homepage = "http://www.yabasic.de/"; + description = "Yet another BASIC"; + longDescription = '' + Yabasic is a traditional basic-interpreter. It comes with goto and various + loops and allows to define subroutines and libraries. It does simple + graphics and printing. Yabasic can call out to libraries written in C and + allows to create standalone programs. Yabasic runs under Unix and Windows + and has a comprehensive documentation; it is small, simple, open-source + and free. + ''; + license = licenses.mit; + maintainers = with maintainers; [ AndersonTorres ]; + platforms = platforms.all; + }; +} |