diff options
Diffstat (limited to 'pkgs/development')
74 files changed, 998 insertions, 1049 deletions
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index fecdd85cd415..add9b30fb629 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -63,7 +63,8 @@ let version = "4.9.3"; enableParallelBuilding = true; - patches = [ ] + patches = + [ ../use-source-date-epoch.patch ] ++ optionals enableParallelBuilding [ ../parallel-bconfig.patch ./parallel-strsignal.patch ] ++ optional (cross != null) ../libstdc++-target.patch ++ optional noSysDirs ../no-sys-dirs.patch diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index f3dda7d13f7c..3b105143c0bf 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -64,7 +64,8 @@ let version = "5.3.0"; enableParallelBuilding = true; - patches = [ ] + patches = + [ ../use-source-date-epoch.patch ] ++ optional (cross != null) ../libstdc++-target.patch ++ optional noSysDirs ../no-sys-dirs.patch # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its diff --git a/pkgs/development/compilers/gcc/use-source-date-epoch.patch b/pkgs/development/compilers/gcc/use-source-date-epoch.patch new file mode 100644 index 000000000000..65a5ab028c1c --- /dev/null +++ b/pkgs/development/compilers/gcc/use-source-date-epoch.patch @@ -0,0 +1,52 @@ +https://gcc.gnu.org/ml/gcc-patches/2015-06/msg02210.html + +diff --git a/libcpp/macro.c b/libcpp/macro.c +index 1e0a0b5..a52e3cb 100644 +--- a/libcpp/macro.c ++++ b/libcpp/macro.c +@@ -349,14 +349,38 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node) + slow on some systems. */ + time_t tt; + struct tm *tb = NULL; ++ char *source_date_epoch; + +- /* (time_t) -1 is a legitimate value for "number of seconds +- since the Epoch", so we have to do a little dance to +- distinguish that from a genuine error. */ +- errno = 0; +- tt = time(NULL); +- if (tt != (time_t)-1 || errno == 0) +- tb = localtime (&tt); ++ /* Allow the date and time to be set externally by an exported ++ environment variable to enable reproducible builds. */ ++ source_date_epoch = getenv ("SOURCE_DATE_EPOCH"); ++ if (source_date_epoch) ++ { ++ errno = 0; ++ tt = (time_t) strtol (source_date_epoch, NULL, 10); ++ if (errno == 0) ++ { ++ tb = gmtime (&tt); ++ if (tb == NULL) ++ cpp_error (pfile, CPP_DL_ERROR, ++ "SOURCE_DATE_EPOCH=\"%s\" is not a valid date", ++ source_date_epoch); ++ } ++ else ++ cpp_error (pfile, CPP_DL_ERROR, ++ "SOURCE_DATE_EPOCH=\"%s\" is not a valid number", ++ source_date_epoch); ++ } ++ else ++ { ++ /* (time_t) -1 is a legitimate value for "number of seconds ++ since the Epoch", so we have to do a little dance to ++ distinguish that from a genuine error. */ ++ errno = 0; ++ tt = time(NULL); ++ if (tt != (time_t)-1 || errno == 0) ++ tb = localtime (&tt); ++ } + + if (tb) + { diff --git a/pkgs/development/compilers/llvm/3.7/clang/default.nix b/pkgs/development/compilers/llvm/3.7/clang/default.nix index 9fb212b9c054..e6369b1167e7 100644 --- a/pkgs/development/compilers/llvm/3.7/clang/default.nix +++ b/pkgs/development/compilers/llvm/3.7/clang/default.nix @@ -6,7 +6,7 @@ in stdenv.mkDerivation { name = "clang-${version}"; unpackPhase = '' - unpackFile ${fetch "cfe" "1k517b0jj74c4vgnnd4ikbrpb96na541bi8q845ckw8xm72l1msf"} + unpackFile ${fetch "cfe" "0x065d0w9b51xvdjxwfzjxng0gzpbx45fgiaxpap45ragi61dqjn"} mv cfe-${version}.src clang sourceRoot=$PWD/clang unpackFile ${clang-tools-extra_src} diff --git a/pkgs/development/compilers/llvm/3.7/default.nix b/pkgs/development/compilers/llvm/3.7/default.nix index cbd0f89ae086..d7864d11d7bf 100644 --- a/pkgs/development/compilers/llvm/3.7/default.nix +++ b/pkgs/development/compilers/llvm/3.7/default.nix @@ -2,7 +2,7 @@ let callPackage = newScope (self // { inherit stdenv isl version fetch; }); - version = "3.7.0"; + version = "3.7.1"; fetch = fetch_v version; fetch_v = ver: name: sha256: fetchurl { @@ -10,8 +10,8 @@ let inherit sha256; }; - compiler-rt_src = fetch "compiler-rt" "02rbsqdnj1dw9q3d8w5wwmvz5gfraiv8xp18lis4kj8baacajzr2"; - clang-tools-extra_src = fetch "clang-tools-extra" "1k894zkx4w8grigmgv5y4q9zrcic2ypz0zfn28270ykbm6is1s4a"; + compiler-rt_src = fetch "compiler-rt" "10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx"; + clang-tools-extra_src = fetch "clang-tools-extra" "0sxw2l3q5msbrwxv1ck72arggdw6n5ysi929gi69ikniranfv4aa"; self = { llvm = callPackage ./llvm.nix { diff --git a/pkgs/development/compilers/llvm/3.7/libc++/default.nix b/pkgs/development/compilers/llvm/3.7/libc++/default.nix index db1475cfc14f..00bfb3518b10 100644 --- a/pkgs/development/compilers/llvm/3.7/libc++/default.nix +++ b/pkgs/development/compilers/llvm/3.7/libc++/default.nix @@ -3,7 +3,7 @@ stdenv.mkDerivation rec { name = "libc++-${version}"; - src = fetch "libcxx" "13nh78zp5d2jf732mxnalw679zjywbjpz9942j66fznd6f1kr3y1"; + src = fetch "libcxx" "0i7iyzk024krda5spfpfi8jksh83yp3bxqkal0xp76ffi11bszrm"; postUnpack = '' unpackFile ${libcxxabi.src} diff --git a/pkgs/development/compilers/llvm/3.7/libc++abi.nix b/pkgs/development/compilers/llvm/3.7/libc++abi.nix index 97f182a9af81..ec0be51a11cf 100644 --- a/pkgs/development/compilers/llvm/3.7/libc++abi.nix +++ b/pkgs/development/compilers/llvm/3.7/libc++abi.nix @@ -3,9 +3,9 @@ stdenv.mkDerivation { name = "libc++abi-${version}"; - src = fetch "libcxxabi" "1swvnhrf9g67579c5picg0l869f8l2bwi4xqpbcb4n296gyp9c28"; + src = fetch "libcxxabi" "0ambfcmr2nh88hx000xb7yjm9lsqjjz49w5mlf6dlxzmj3nslzx4"; - buildInputs = [ cmake ] ++ stdenv.lib.optional (!stdenv.isDarwin) libunwind; + buildInputs = [ cmake ] ++ stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind; postUnpack = '' unpackFile ${libcxx.src} diff --git a/pkgs/development/compilers/llvm/3.7/lldb.nix b/pkgs/development/compilers/llvm/3.7/lldb.nix index 60f1550dd447..fe69130e71a7 100644 --- a/pkgs/development/compilers/llvm/3.7/lldb.nix +++ b/pkgs/development/compilers/llvm/3.7/lldb.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation { name = "lldb-${version}"; - src = fetch "lldb" "1sbi9c6c4m73wfw249dn0n2974p444i03brk82m4w10iq5dm1mzl"; + src = fetch "lldb" "008fdbyza13ym3v0xpans4z4azw4y16hcbgrrnc4rx2mxwaw62ws"; patchPhase = '' sed -i 's|/usr/bin/env||' \ diff --git a/pkgs/development/compilers/llvm/3.7/llvm.nix b/pkgs/development/compilers/llvm/3.7/llvm.nix index bbeb0c858e57..393e889024be 100644 --- a/pkgs/development/compilers/llvm/3.7/llvm.nix +++ b/pkgs/development/compilers/llvm/3.7/llvm.nix @@ -18,15 +18,10 @@ }: let - src = fetch "llvm" "0lrirklh4nrcb078qc2f6vbmmc34kxqgsy9s18a1xbfdkmgqjidb"; + src = fetch "llvm" "1masakdp9g2dan1yrazg7md5am2vacbkb3nahb3dchpc1knr8xxy"; in stdenv.mkDerivation rec { name = "llvm-${version}"; - patches = [ - # Backport for Rust, remove when 3.7.1 is released - ./r242372-fix-LLVMBuildLandingPad.patch - ]; - unpackPhase = '' unpackFile ${src} mv llvm-${version}.src llvm diff --git a/pkgs/development/compilers/llvm/3.7/r242372-fix-LLVMBuildLandingPad.patch b/pkgs/development/compilers/llvm/3.7/r242372-fix-LLVMBuildLandingPad.patch deleted file mode 100644 index 749de6e9b6a1..000000000000 --- a/pkgs/development/compilers/llvm/3.7/r242372-fix-LLVMBuildLandingPad.patch +++ /dev/null @@ -1,60 +0,0 @@ -Index: llvm/bindings/ocaml/llvm/llvm_ocaml.c -=================================================================== ---- llvm/bindings/ocaml/llvm/llvm_ocaml.c (revision 242371) -+++ llvm/bindings/ocaml/llvm/llvm_ocaml.c (revision 242372) -@@ -1745,7 +1745,7 @@ - CAMLprim LLVMValueRef llvm_build_landingpad(LLVMTypeRef Ty, LLVMValueRef PersFn, - value NumClauses, value Name, - value B) { -- return LLVMBuildLandingPad(Builder_val(B), Ty, Int_val(NumClauses), -+ return LLVMBuildLandingPad(Builder_val(B), Ty, PersFn, Int_val(NumClauses), - String_val(Name)); - } - -Index: llvm/bindings/go/llvm/ir.go -=================================================================== ---- llvm/bindings/go/llvm/ir.go (revision 242371) -+++ llvm/bindings/go/llvm/ir.go (revision 242372) -@@ -1731,7 +1731,7 @@ - func (b Builder) CreateLandingPad(t Type, nclauses int, name string) (l Value) { - cname := C.CString(name) - defer C.free(unsafe.Pointer(cname)) -- l.C = C.LLVMBuildLandingPad(b.C, t.C, C.unsigned(nclauses), cname) -+ l.C = C.LLVMBuildLandingPad(b.C, t.C, nil, C.unsigned(nclauses), cname) - return l - } - -Index: llvm/lib/IR/Core.cpp -=================================================================== ---- llvm/lib/IR/Core.cpp (revision 242371) -+++ llvm/lib/IR/Core.cpp (revision 242372) -@@ -2257,7 +2257,14 @@ - } - - LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, -- unsigned NumClauses, const char *Name) { -+ LLVMValueRef PersFn, unsigned NumClauses, -+ const char *Name) { -+ // The personality used to live on the landingpad instruction, but now it -+ // lives on the parent function. For compatibility, take the provided -+ // personality and put it on the parent function. -+ if (PersFn) -+ unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn( -+ cast<Function>(unwrap(PersFn))); - return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses, Name)); - } - -Index: llvm/include/llvm-c/Core.h -=================================================================== ---- llvm/include/llvm-c/Core.h (revision 242371) -+++ llvm/include/llvm-c/Core.h (revision 242372) -@@ -2675,7 +2675,8 @@ - LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, - const char *Name); - LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty, -- unsigned NumClauses, const char *Name); -+ LLVMValueRef PersFn, unsigned NumClauses, -+ const char *Name); - LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn); - LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef); - diff --git a/pkgs/development/compilers/rustc/head.nix b/pkgs/development/compilers/rustc/head.nix index ccbfc51b671a..2cefc4cfc137 100644 --- a/pkgs/development/compilers/rustc/head.nix +++ b/pkgs/development/compilers/rustc/head.nix @@ -2,11 +2,11 @@ { stdenv, callPackage }: callPackage ./generic.nix { - shortVersion = "2015-12-09"; + shortVersion = "2016-01-10"; isRelease = false; - forceBundledLLVM = true; - srcRev = "462ec0576"; - srcSha = "1mci0hxwnqb24j4k68rgffqk8ccznz2iddfmyhi8wxa094hqgghp"; + forceBundledLLVM = false; + srcRev = "d70ab2bdf16c22b9f3ff0230089b44855e3f1593"; + srcSha = "13ssis1bdgg8sdkgrvxcbd1qcfmf7q6bv4akfxrjgdm44l1n1l97"; /* Rust is bootstrapped from an earlier built version. We need to fetch these earlier versions, which vary per platform. @@ -15,12 +15,12 @@ callPackage ./generic.nix { with the set you want at the top. */ - snapshotHashLinux686 = "e2553bf399cd134a08ef3511a0a6ab0d7a667216"; - snapshotHashLinux64 = "7df8ba9dec63ec77b857066109d4b6250f3d222f"; - snapshotHashDarwin686 = "29750870c82a0347f8b8b735a4e2e0da26f5098d"; - snapshotHashDarwin64 = "c9f2c588238b4c6998190c3abeb33fd6164099a2"; - snapshotDate = "2015-08-11"; - snapshotRev = "1af31d4"; + snapshotHashLinux686 = "a09c4a4036151d0cb28e265101669731600e01f2"; + snapshotHashLinux64 = "97e2a5eb8904962df8596e95d6e5d9b574d73bf4"; + snapshotHashDarwin686 = "ca52d2d3ba6497ed007705ee3401cf7efc136ca1"; + snapshotHashDarwin64 = "3c44ffa18f89567c2b81f8d695e711c86d81ffc7"; + snapshotDate = "2015-12-18"; + snapshotRev = "3391630"; patches = [ ./patches/remove-uneeded-git.patch ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch; diff --git a/pkgs/development/compilers/sbcl/bootstrap.nix b/pkgs/development/compilers/sbcl/bootstrap.nix index 0114f014a51e..f8352f0a362e 100644 --- a/pkgs/development/compilers/sbcl/bootstrap.nix +++ b/pkgs/development/compilers/sbcl/bootstrap.nix @@ -24,6 +24,11 @@ let }; armv6l-linux = armv7l-linux; x86_64-solaris = x86_64-linux; + x86_64-freebsd = rec { + version = "1.2.7"; + system = "x86-64-freebsd"; + sha256 = "14k42xiqd2rrim4pd5k5pjcrpkac09qnpynha8j1v4jngrvmw7y6"; + }; }; cfg = options.${stdenv.system}; in diff --git a/pkgs/development/interpreters/perl/5.20/default.nix b/pkgs/development/interpreters/perl/5.20/default.nix index 9cc8af5f427d..c91a43963d49 100644 --- a/pkgs/development/interpreters/perl/5.20/default.nix +++ b/pkgs/development/interpreters/perl/5.20/default.nix @@ -93,6 +93,14 @@ stdenv.mkDerivation rec { substituteInPlace dist/PathTools/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'" ''; + # Inspired by nuke-references, which I can't depend on because it uses perl. Perhaps it should just use sed :) + postInstall = '' + self=$(echo $out | sed -n "s|^$NIX_STORE/\\([a-z0-9]\{32\}\\)-.*|\1|p") + + sed -i "/$self/b; s|$NIX_STORE/[a-z0-9]\{32\}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" "$out"/lib/perl5/*/*/Config.pm + sed -i "/$self/b; s|$NIX_STORE/[a-z0-9]\{32\}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" "$out"/lib/perl5/*/*/Config_heavy.pl + ''; + setupHook = ./setup-hook.sh; passthru.libPrefix = "lib/perl5/site_perl"; diff --git a/pkgs/development/interpreters/ruby/build-ruby-gem/default.nix b/pkgs/development/interpreters/ruby/build-ruby-gem/default.nix new file mode 100644 index 000000000000..d050faca2454 --- /dev/null +++ b/pkgs/development/interpreters/ruby/build-ruby-gem/default.nix @@ -0,0 +1,208 @@ +# This builds gems in a way that is compatible with bundler. +# +# Bundler installs gems from git sources _very_ differently from how RubyGems +# installes gem packages, though they both install gem packages similarly. +# +# We monkey-patch Bundler to remove any impurities and then drive its internals +# to install git gems. +# +# For the sake of simplicity, gem packages are installed with the standard `gem` +# program. +# +# Note that bundler does not support multiple prefixes; it assumes that all +# gems are installed in a common prefix, and has no support for specifying +# otherwise. Therefore, if you want to be able to use the resulting derivations +# with bundler, you need to create a symlink forrest first, which is what +# `bundlerEnv` does for you. +# +# Normal gem packages can be used outside of bundler; a binstub is created in +# $out/bin. + +{ lib, ruby, rubygems, bundler, fetchurl, fetchgit, makeWrapper, git, buildRubyGem +} @ defs: + +lib.makeOverridable ( + +{ name ? null +, gemName +, version ? null +, type ? "gem" +, document ? [] # e.g. [ "ri" "rdoc" ] +, platform ? "ruby" +, ruby ? defs.ruby +, stdenv ? ruby.stdenv +, namePrefix ? "${ruby.name}" + "-" +, buildInputs ? [] +, doCheck ? false +, meta ? {} +, patches ? [] +, gemPath ? [] +, dontStrip ? true +, remotes ? ["https://rubygems.org"] +# Assume we don't have to build unless strictly necessary (e.g. the source is a +# git checkout). +# If you need to apply patches, make sure to set `dontBuild = false`; +, dontBuild ? true +, propagatedBuildInputs ? [] +, propagatedUserEnvPkgs ? [] +, buildFlags ? null +, passthru ? {} +, ...} @ attrs: + +if ! builtins.elem type [ "git" "gem" ] +then throw "buildRubyGem: don't know how to build a gem of type \"${type}\"" +else + +let + shellEscape = x: "'${lib.replaceChars ["'"] [("'\\'" + "'")] x}'"; + rubygems = (attrs.rubygems or defs.rubygems).override { + inherit ruby; + }; + src = attrs.src or ( + if type == "gem" + then fetchurl { + urls = map (remote: "${remote}/gems/${gemName}-${version}.gem") remotes; + inherit (attrs) sha256; + } else fetchgit { + inherit (attrs) url rev sha256 fetchSubmodules; + leaveDotGit = true; + } + ); + documentFlag = + if document == [] + then "-N" + else "--document ${lib.concatStringsSep "," document}"; + +in + +stdenv.mkDerivation (attrs // { + inherit ruby rubygems; + inherit doCheck; + inherit dontBuild; + inherit dontStrip; + inherit type; + + buildInputs = [ + ruby rubygems makeWrapper + ] ++ lib.optionals (type == "git") [ git bundler ] + ++ buildInputs; + + name = attrs.name or (namePrefix + gemName); + + inherit src; + + phases = attrs.phases or [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" "fixupPhase" ]; + + unpackPhase = attrs.unpackPhase or '' + runHook preUnpack + + if [[ -f $src && $src == *.gem ]]; then + if [[ -z "$dontBuild" ]]; then + # we won't know the name of the directory that RubyGems creates, + # so we'll just use a glob to find it and move it over. + gempkg="$src" + sourceRoot=source + gem unpack $gempkg --target=container + cp -r container/* $sourceRoot + rm -r container + + # copy out the original gemspec, for convenience during patching / + # overrides. + gem specification $gempkg --ruby > original.gemspec + gemspec=$(readlink -f .)/original.gemspec + else + gempkg="$src" + fi + else + # Fall back to the original thing for everything else. + dontBuild="" + preUnpack="" postUnpack="" unpackPhase + fi + + runHook postUnpack + ''; + + buildPhase = attrs.buildPhase or '' + runHook preBuild + + if [[ "$type" == "gem" ]]; then + if [[ -z "$gemspec" ]]; then + gemspec="$(find . -name '*.gemspec')" + echo "found the following gemspecs:" + echo "$gemspec" + gemspec="$(echo "$gemspec" | head -n1)" + fi + + exec 3>&1 + output="$(gem build $gemspec | tee >(cat - >&3))" + exec 3>&- + + gempkg=$(echo "$output" | grep -oP 'File: \K(.*)') + + echo "gem package built: $gempkg" + fi + + runHook postBuild + ''; + + # Note: + # We really do need to keep the $out/${ruby.gemPath}/cache. + # This is very important in order for many parts of RubyGems/Bundler to not blow up. + # See https://github.com/bundler/bundler/issues/3327 + installPhase = attrs.installPhase or '' + runHook preInstall + + export GEM_HOME=$out/${ruby.gemPath} + mkdir -p $GEM_HOME + + echo "buildFlags: $buildFlags" + + ${lib.optionalString (type == "git") '' + ruby ${./nix-bundle-install.rb} \ + ${gemName} \ + ${attrs.url} \ + ${src} \ + ${attrs.rev} \ + ${version} \ + ${shellEscape (toString buildFlags)} + ''} + + ${lib.optionalString (type == "gem") '' + if [[ -z "$gempkg" ]]; then + echo "failure: \$gempkg path unspecified" 1>&2 + exit 1 + elif [[ ! -f "$gempkg" ]]; then + echo "failure: \$gempkg path invalid" 1>&2 + exit 1 + fi + + gem install \ + --local \ + --force \ + --http-proxy 'http://nodtd.invalid' \ + --ignore-dependencies \ + --build-root '/' \ + --backtrace \ + ${documentFlag} \ + $gempkg $gemFlags -- $buildFlags + + # looks like useless files which break build repeatability and consume space + rm -fv $out/${ruby.gemPath}/doc/*/*/created.rid || true + rm -fv $out/${ruby.gemPath}/gems/*/ext/*/mkmf.log || true + + # write out metadata and binstubs + spec=$(echo $out/${ruby.gemPath}/specifications/*.gemspec) + ruby ${./gem-post-build.rb} "$spec" + ''} + + runHook postInstall + ''; + + propagatedBuildInputs = gemPath ++ propagatedBuildInputs; + propagatedUserEnvPkgs = gemPath ++ propagatedUserEnvPkgs; + + passthru = passthru // { isRubyGem = true; }; + inherit meta; +}) + +) diff --git a/pkgs/development/interpreters/ruby/build-ruby-gem/gem-post-build.rb b/pkgs/development/interpreters/ruby/build-ruby-gem/gem-post-build.rb new file mode 100644 index 000000000000..112a9accc335 --- /dev/null +++ b/pkgs/development/interpreters/ruby/build-ruby-gem/gem-post-build.rb @@ -0,0 +1,77 @@ +require 'rbconfig' +require 'rubygems' +require 'rubygems/specification' +require 'fileutils' + +ruby = File.join(ENV["ruby"], "bin", RbConfig::CONFIG['ruby_install_name']) +out = ENV["out"] +bin_path = File.join(ENV["out"], "bin") +gem_home = ENV["GEM_HOME"] +gem_path = ENV["GEM_PATH"].split(":") +install_path = Dir.glob("#{gem_home}/gems/*").first +gemspec_path = ARGV[0] + +if defined?(Encoding.default_internal) + Encoding.default_internal = Encoding::UTF_8 + Encoding.default_external = Encoding::UTF_8 +end + +gemspec_content = File.read(gemspec_path) +spec = nil +if gemspec_content[0..2] == "---" # YAML header + spec = Gem::Specification.from_yaml(gemspec_content) +else + spec = Gem::Specification.load(gemspec_path) +end + +FileUtils.mkdir_p("#{out}/nix-support") + +# write meta-data +meta = "#{out}/nix-support/gem-meta" +FileUtils.mkdir_p(meta) +FileUtils.ln_s(gemspec_path, "#{meta}/spec") +File.open("#{meta}/name", "w") do |f| + f.write(spec.name) +end +File.open("#{meta}/install-path", "w") do |f| + f.write(install_path) +end +File.open("#{meta}/require-paths", "w") do |f| + f.write(spec.require_paths.join(" ")) +end +File.open("#{meta}/executables", "w") do |f| + f.write(spec.executables.join(" ")) +end + +# add this gem to the GEM_PATH for dependencies +File.open("#{out}/nix-support/setup-hook", "a") do |f| + f.puts("addToSearchPath GEM_PATH #{gem_home}") + spec.require_paths.each do |dir| + f.puts("addToSearchPath RUBYLIB #{install_path}/#{dir}") + end +end + +# create regular rubygems binstubs +FileUtils.mkdir_p(bin_path) +spec.executables.each do |exe| + File.open("#{bin_path}/#{exe}", "w") do |f| + f.write(<<-EOF) +#!#{ruby} +# +# This file was generated by Nix. +# +# The application '#{exe}' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +gem_path = ENV["GEM_PATH"] +ENV["GEM_PATH"] = "\#{gem_path}\#{":" unless gem_path.nil? || gem_path.empty?}#{(gem_path+[gem_home]).join(":")}" + +require 'rubygems' + +load Gem.bin_path(#{spec.name.inspect}, #{exe.inspect}) + EOF + end + + FileUtils.chmod("+x", "#{bin_path}/#{exe}") +end diff --git a/pkgs/development/interpreters/ruby/build-ruby-gem/nix-bundle-install.rb b/pkgs/development/interpreters/ruby/build-ruby-gem/nix-bundle-install.rb new file mode 100644 index 000000000000..647b83b52c38 --- /dev/null +++ b/pkgs/development/interpreters/ruby/build-ruby-gem/nix-bundle-install.rb @@ -0,0 +1,153 @@ +require 'rbconfig' +require 'bundler/vendored_thor' +require 'bundler' +require 'rubygems/command' +require 'fileutils' +require 'pathname' +require 'tmpdir' + +# Options: +# +# name - the gem name +# uri - git repo uri +# repo - path to local checkout +# ref - the commit hash +# version - gem version +# build-flags - build arguments + +ruby = File.join(ENV["ruby"], "bin", RbConfig::CONFIG['ruby_install_name']) +out = ENV["out"] +bin_dir = File.join(ENV["out"], "bin") + +name = ARGV[0] +uri = ARGV[1] +REPO = ARGV[2] +ref = ARGV[3] +version = ARGV[4] +build_flags = ARGV[5] + +# options to pass to bundler +options = { + "name" => name, + "uri" => uri, + "ref" => ref, + "version" => version, +} + +# Monkey-patch Bundler to use our local checkout. +# I wish we didn't have to do this, but bundler does not expose an API to do +# these kinds of things. +Bundler.module_eval do + def self.requires_sudo? + false + end + + def self.root + # we don't have a Gemfile, so it doesn't make sense to try to make paths + # relative to the (non existent) parent directory thereof, so we give a + # nonsense path here. + Pathname.new("/no-root-path") + end + + def self.bundle_path + Pathname.new(ENV["GEM_HOME"]) + end + + def self.locked_gems + nil + end +end + +Bundler::Source::Git.class_eval do + def allow_git_ops? + true + end +end + +Bundler::Source::Git::GitProxy.class_eval do + def checkout + unless path.exist? + FileUtils.mkdir_p(path.dirname) + FileUtils.cp_r(File.join(REPO, ".git"), path) + system("chmod -R +w #{path}") + end + end + + def copy_to(destination, submodules=false) + unless File.exist?(destination.join(".git")) + FileUtils.mkdir_p(destination.dirname) + FileUtils.cp_r(REPO, destination) + system("chmod -R +w #{destination}") + end + end +end + +# UI +verbose = false +no_color = false +Bundler.ui = Bundler::UI::Shell.new({"no-color" => no_color}) +Bundler.ui.level = "debug" if verbose + +# Install +source = Bundler::Source::Git.new(options) +spec = source.specs.search_all(name).first +Bundler.rubygems.with_build_args [build_flags] do + source.install(spec) +end + +msg = spec.post_install_message +if msg + Bundler.ui.confirm "Post-install message from #{name}:" + Bundler.ui.info msg +end + +# Write out the binstubs +if spec.executables.any? + FileUtils.mkdir_p(bin_dir) + spec.executables.each do |exe| + wrapper = File.join(bin_dir, exe) + File.open(wrapper, "w") do |f| + stub = generate_stub(spec.name, exe) + f.write(<<-EOF) +#!#{ruby} +# +# This file was generated by Nix. +# +# The application '#{exe}' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path(#{spec.name.inspect}, #{exe.inspect}) +EOF + end + + FileUtils.chmod("+x", wrapper) + end +end + +# Write out metadata +meta = "#{out}/nix-support/gem-meta" +FileUtils.mkdir_p(meta) +FileUtils.ln_s(spec.loaded_from.to_s, "#{meta}/spec") +File.open("#{meta}/name", "w") do |f| + f.write spec.name +end +File.open("#{meta}/install-path", "w") do |f| + f.write source.install_path.to_s +end +File.open("#{meta}/require-paths", "w") do |f| + f.write spec.require_paths.join(" ") +end +File.open("#{meta}/executables", "w") do |f| + f.write spec.executables.join(" ") +end + +# make the lib available during bundler/git installs +File.open("#{out}/nix-support/setup-hook", "a") do |f| + spec.require_paths.each do |dir| + f.puts("addToSearchPath RUBYLIB #{source.install_path}/#{dir}") + end +end diff --git a/pkgs/development/interpreters/ruby/bundix/Gemfile b/pkgs/development/interpreters/ruby/bundix/Gemfile deleted file mode 100644 index 4899cafc3738..000000000000 --- a/pkgs/development/interpreters/ruby/bundix/Gemfile +++ /dev/null @@ -1,4 +0,0 @@ -source "http://rubygems.org" -gem "bundix", - :git => "https://github.com/cstrahan/bundix.git", - :ref => "v1.0.3" diff --git a/pkgs/development/interpreters/ruby/bundix/Gemfile.lock b/pkgs/development/interpreters/ruby/bundix/Gemfile.lock deleted file mode 100644 index f241a3bafd4f..000000000000 --- a/pkgs/development/interpreters/ruby/bundix/Gemfile.lock +++ /dev/null @@ -1,18 +0,0 @@ -GIT - remote: https://github.com/cstrahan/bundix.git - revision: c879cf901ff8084b4c97aaacfb5ecbdb0f95cc03 - ref: v1.0.3 - specs: - bundix (1.0.2) - thor (~> 0.19.1) - -GEM - remote: http://rubygems.org/ - specs: - thor (0.19.1) - -PLATFORMS - ruby - -DEPENDENCIES - bundix! diff --git a/pkgs/development/interpreters/ruby/bundix/default.nix b/pkgs/development/interpreters/ruby/bundix/default.nix index 0196adb8f4c8..b5a49043c60b 100644 --- a/pkgs/development/interpreters/ruby/bundix/default.nix +++ b/pkgs/development/interpreters/ruby/bundix/default.nix @@ -1,9 +1,20 @@ -{ ruby, bundlerEnv }: +{ ruby, fetchgit, buildRubyGem, bundler }: -bundlerEnv { - name = "bundix"; - inherit ruby; - gemset = ./gemset.nix; - gemfile = ./Gemfile; - lockfile = ./Gemfile.lock; +let + thor = buildRubyGem { + gemName = "thor"; + version = "0.19.1"; + type = "gem"; + sha256 = "08p5gx18yrbnwc6xc0mxvsfaxzgy2y9i78xq7ds0qmdm67q39y4z"; + }; + +in buildRubyGem { + gemName = "bundix"; + version = "1.0.4"; + gemPath = [ thor bundler ]; + src = fetchgit { + url = "https://github.com/cstrahan/bundix.git"; + rev = "6dcf1f71c61584f5c9b919ee9df7b0c554862076"; + sha256 = "1w17bvc9srcgr4ry81ispcj35g9kxihbyknmqp8rnd4h5090b7b2"; + }; } diff --git a/pkgs/development/interpreters/ruby/bundix/gemset.nix b/pkgs/development/interpreters/ruby/bundix/gemset.nix deleted file mode 100644 index f8f6546671d9..000000000000 --- a/pkgs/development/interpreters/ruby/bundix/gemset.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - "bundix" = { - version = "1.0.2"; - source = { - type = "git"; - url = "https://github.com/cstrahan/bundix.git"; - rev = "c879cf901ff8084b4c97aaacfb5ecbdb0f95cc03"; - sha256 = "05kmdnq4qa5h8l3asv05cjpnyplnqqx6hrqybj2cjlzmdxnkkgyj"; - fetchSubmodules = false; - }; - dependencies = [ - "thor" - ]; - }; - "thor" = { - version = "0.19.1"; - source = { - type = "gem"; - sha256 = "08p5gx18yrbnwc6xc0mxvsfaxzgy2y9i78xq7ds0qmdm67q39y4z"; - }; - }; -} \ No newline at end of file diff --git a/pkgs/development/interpreters/ruby/bundler-env/default.nix b/pkgs/development/interpreters/ruby/bundler-env/default.nix index 9fa6e52c4557..c7570d815e3b 100644 --- a/pkgs/development/interpreters/ruby/bundler-env/default.nix +++ b/pkgs/development/interpreters/ruby/bundler-env/default.nix @@ -1,312 +1,75 @@ { stdenv, runCommand, writeText, writeScript, writeScriptBin, ruby, lib -, callPackage, defaultGemConfig, fetchurl, fetchgit, buildRubyGem , bundler_HEAD +, callPackage, defaultGemConfig, fetchurl, fetchgit, buildRubyGem, buildEnv +, rubygems , git +, makeWrapper +, bundler +, tree }@defs: -# This is a work-in-progress. -# The idea is that his will replace load-ruby-env.nix. - { name, gemset, gemfile, lockfile, ruby ? defs.ruby, gemConfig ? defaultGemConfig -, enableParallelBuilding ? false # TODO: this might not work, given the env-var shinanigans. -, postInstall ? null -, documentation ? false +, postBuild ? null +, document ? [] , meta ? {} +, ignoreCollisions ? false , ... }@args: let shellEscape = x: "'${lib.replaceChars ["'"] [("'\\'" + "'")] x}'"; - const = x: y: x; - bundler = bundler_HEAD.override { inherit ruby; }; - inherit (builtins) attrValues; - - gemName = attrs: "${attrs.name}-${attrs.version}.gem"; - - fetchers.path = attrs: attrs.source.path; - fetchers.gem = attrs: fetchurl { - url = "${attrs.source.source or "https://rubygems.org"}/downloads/${gemName attrs}"; - inherit (attrs.source) sha256; - }; - fetchers.git = attrs: fetchgit { - inherit (attrs.source) url rev sha256 fetchSubmodules; - leaveDotGit = true; - }; - - applySrc = attrs: - attrs // { - src = (fetchers."${attrs.source.type}" attrs); - }; - + importedGemset = import gemset; applyGemConfigs = attrs: - if gemConfig ? "${attrs.name}" - then attrs // gemConfig."${attrs.name}" attrs - else attrs; - - needsPatch = attrs: - (attrs ? patches) || (attrs ? prePatch) || (attrs ? postPatch); - - # patch a gem or source tree. - # for gems, the gem is unpacked, patched, and then repacked. - # see: https://github.com/fedora-ruby/gem-patch/blob/master/lib/rubygems/patcher.rb - applyPatches = attrs: - if !needsPatch attrs - then attrs - else attrs // { src = - stdenv.mkDerivation { - name = gemName attrs; - phases = [ "unpackPhase" "patchPhase" "installPhase" ]; - buildInputs = [ ruby ] ++ attrs.buildInputs or []; - patches = attrs.patches or [ ]; - prePatch = attrs.prePatch or "true"; - postPatch = attrs.postPatch or "true"; - unpackPhase = '' - runHook preUnpack - - if [[ -f ${attrs.src} ]]; then - isGem=1 - # we won't know the name of the directory that RubyGems creates, - # so we'll just use a glob to find it and move it over. - gem unpack ${attrs.src} --target=container - cp -r container/* contents - rm -r container - else - cp -r ${attrs.src} contents - chmod -R +w contents - fi - - cd contents - runHook postUnpack - ''; - installPhase = '' - runHook preInstall - - if [[ -n "$isGem" ]]; then - ${writeScript "repack.rb" '' - #!${ruby}/bin/ruby - require 'rubygems' - require 'rubygems/package' - require 'fileutils' - - Encoding.default_internal = Encoding::UTF_8 - Encoding.default_external = Encoding::UTF_8 - - if Gem::VERSION < '2.0' - load "${./package-1.8.rb}" - end - - out = ENV['out'] - files = Dir['**/{.[^\.]*,*}'] - - package = Gem::Package.new("${attrs.src}") - patched_package = Gem::Package.new(package.spec.file_name) - patched_package.spec = package.spec.clone - patched_package.spec.files = files - - patched_package.build(false) - - FileUtils.cp(patched_package.spec.file_name, out) - ''} - else - cp -r . $out - fi - - runHook postInstall - ''; - }; - }; - - instantiate = (attrs: - applyPatches (applyGemConfigs (applySrc attrs)) - ); - - instantiated = lib.flip lib.mapAttrs (import gemset) (name: attrs: - instantiate (attrs // { inherit name; }) + (if gemConfig ? "${attrs.gemName}" + then attrs // gemConfig."${attrs.gemName}" attrs + else attrs); + configuredGemset = lib.flip lib.mapAttrs importedGemset (name: attrs: + applyGemConfigs (attrs // { gemName = name; }) ); - - needsPreInstall = attrs: - (attrs ? preInstall) || (attrs ? buildInputs) || (attrs ? nativeBuildInputs); - - # TODO: support cross compilation? look at stdenv/generic/default.nix. - runPreInstallers = lib.fold (next: acc: - if !needsPreInstall next - then acc - else acc + '' - ${writeScript "${next.name}-pre-install" '' - #!${stdenv.shell} - - export nativeBuildInputs="${toString ((next.nativeBuildInputs or []) ++ (next.buildInputs or []))}" - - source ${stdenv}/setup - - header "running pre-install script for ${next.name}" - - ${next.preInstall or ""} - - ${ruby}/bin/ruby -e 'print ENV.inspect' > env/${next.name} - - stopNest - ''} - '' - ) "" (attrValues instantiated); - - # copy *.gem to ./gems - copyGems = lib.fold (next: acc: - if next.source.type == "gem" - then acc + "cp ${next.src} gems/${gemName next}\n" - else acc - ) "" (attrValues instantiated); - - runRuby = name: env: command: - runCommand name env '' - ${ruby}/bin/ruby ${writeText name command} - ''; - - # TODO: include json_pure, so the version of ruby doesn't matter. - # not all rubies have support for JSON built-in, - # so we'll convert JSON to ruby expressions. - json2rb = writeScript "json2rb" '' - #!${ruby}/bin/ruby - begin - require 'json' - rescue LoadError => ex - require 'json_pure' - end - - puts JSON.parse(STDIN.read).inspect - ''; - - # dump the instantiated gemset as a ruby expression. - serializedGemset = runCommand "gemset.rb" { json = builtins.toJSON instantiated; } '' - printf '%s' "$json" | ${json2rb} > $out - ''; - - # this is a mapping from a source type and identifier (uri/path/etc) - # to the pure store path. - # we'll use this from the patched bundler to make fetching sources pure. - sources = runRuby "sources.rb" { gemset = serializedGemset; } '' - out = ENV['out'] - gemset = eval(File.read(ENV['gemset'])) - - sources = { - "git" => { }, - "path" => { }, - "gem" => { }, - "svn" => { } - } - - gemset.each_value do |spec| - type = spec["source"]["type"] - val = spec["src"] - key = - case type - when "gem" - spec["name"] - when "git" - spec["source"]["url"] - when "path" - spec["source"]["originalPath"] - when "svn" - nil # TODO - end - - sources[type][key] = val if key - end - - File.open(out, "wb") do |f| - f.print sources.inspect - end + hasBundler = builtins.hasAttr "bundler" importedGemset; + bundler = if hasBundler then gems.bundler else defs.bundler.override (attrs: { inherit ruby; }); + rubygems = defs.rubygems.override (attrs: { inherit ruby; }); + gems = lib.flip lib.mapAttrs configuredGemset (name: attrs: + buildRubyGem ((removeAttrs attrs ["source"]) // attrs.source // { + inherit ruby rubygems; + gemName = name; + gemPath = map (gemName: gems."${gemName}") (attrs.dependencies or []); + })); + # We have to normalize the Gemfile.lock, otherwise bundler tries to be + # helpful by doing so at run time, causing executables to immediately bail + # out. Yes, I'm serious. + confFiles = runCommand "gemfile-and-lockfile" {} '' + mkdir -p $out + cp ${gemfile} $out/Gemfile + cp ${lockfile} $out/Gemfile.lock + + cd $out + chmod +w Gemfile.lock + source ${rubygems}/nix-support/setup-hook + export GEM_PATH=${bundler}/${ruby.gemPath} + ${ruby}/bin/ruby -rubygems -e \ + "require 'bundler'; Bundler.definition.lock('Gemfile.lock')" ''; - - # rewrite PATH sources to point into the nix store. - purifiedLockfile = runRuby "purifiedLockfile" {} '' - out = ENV['out'] - sources = eval(File.read("${sources}")) - paths = sources["path"] - - lockfile = File.read("${lockfile}") - - paths.each_pair do |impure, pure| - lockfile.gsub!(/^ remote: #{Regexp.escape(impure)}/, " remote: #{pure}") - end - - File.open(out, "wb") do |f| - f.print lockfile - end - ''; - - needsBuildFlags = attrs: attrs ? buildFlags; - - mkBuildFlags = spec: - "export BUNDLE_BUILD__${lib.toUpper spec.name}='${lib.concatStringsSep " " (map shellEscape spec.buildFlags)}'"; - - allBuildFlags = - lib.concatStringsSep "\n" - (map mkBuildFlags - (lib.filter needsBuildFlags (attrValues instantiated))); - - derivation = stdenv.mkDerivation { - inherit name; - - buildInputs = [ - ruby - bundler - git - ] ++ args.buildInputs or []; - - phases = [ "installPhase" "fixupPhase" ]; - - outputs = [ - "out" # the installed libs/bins - "bundle" # supporting files for bundler - ]; - - installPhase = '' - mkdir -p $bundle - export BUNDLE_GEMFILE=$bundle/Gemfile - cp ${gemfile} $BUNDLE_GEMFILE - cp ${purifiedLockfile} $BUNDLE_GEMFILE.lock - - export NIX_GEM_SOURCES=${sources} - export NIX_BUNDLER_GEMPATH=${bundler}/${ruby.gemPath} - - export GEM_HOME=$out/${ruby.gemPath} - export GEM_PATH=$NIX_BUNDLER_GEMPATH:$GEM_HOME - mkdir -p $GEM_HOME - - ${allBuildFlags} - - mkdir gems - cp ${bundler}/${bundler.ruby.gemPath}/cache/bundler-*.gem gems - ${copyGems} - - ${lib.optionalString (!documentation) '' - mkdir home - HOME="$(pwd -P)/home" - echo "gem: --no-rdoc --no-ri" > $HOME/.gemrc - ''} - - mkdir env - ${runPreInstallers} - - mkdir $out/bin - cp ${./monkey_patches.rb} monkey_patches.rb - export RUBYOPT="-rmonkey_patches.rb -I $(pwd -P)" - bundler install --frozen --binstubs ${lib.optionalString enableParallelBuilding "--jobs $NIX_BUILD_CORES"} - RUBYOPT="" - - runHook postInstall - ''; - - inherit postInstall; - + envPaths = lib.attrValues gems ++ lib.optional (!hasBundler) bundler; + bundlerEnv = buildEnv { + inherit name ignoreCollisions; + paths = envPaths; + pathsToLink = [ "/lib" ]; + postBuild = '' + source ${rubygems}/nix-support/setup-hook + + ${ruby}/bin/ruby ${./gen-bin-stubs.rb} \ + "${ruby}/bin/ruby" \ + "${confFiles}/Gemfile" \ + "$out/${ruby.gemPath}" \ + "${bundler}/${ruby.gemPath}" \ + ${shellEscape (toString envPaths)} + '' + lib.optionalString (postBuild != null) postBuild; passthru = { - inherit ruby; - inherit bundler; - + inherit ruby bundler meta gems; env = let irbrc = builtins.toFile "irbrc" '' - if not ENV["OLD_IRBRC"].empty? + if !(ENV["OLD_IRBRC"].nil? || ENV["OLD_IRBRC"].empty?) require ENV["OLD_IRBRC"] end require 'rubygems' @@ -314,12 +77,12 @@ let ''; in stdenv.mkDerivation { name = "interactive-${name}-environment"; - nativeBuildInputs = [ ruby derivation ]; + nativeBuildInputs = [ ruby bundlerEnv ]; shellHook = '' - export BUNDLE_GEMFILE=${derivation.bundle}/Gemfile - export GEM_HOME=${derivation}/${ruby.gemPath} - export NIX_BUNDLER_GEMPATH=${bundler}/${ruby.gemPath} - export GEM_PATH=$NIX_BUNDLER_GEMPATH:$GEM_HOME + export BUNDLE_GEMFILE=${confFiles}/Gemfile + export BUNDLE_PATH=${bundlerEnv}/${ruby.gemPath} + export GEM_HOME=${bundlerEnv}/${ruby.gemPath} + export GEM_PATH=${bundlerEnv}/${ruby.gemPath} export OLD_IRBRC="$IRBRC" export IRBRC=${irbrc} ''; @@ -331,8 +94,8 @@ let ''; }; }; - - inherit meta; }; -in derivation +in + +bundlerEnv diff --git a/pkgs/development/interpreters/ruby/bundler-env/gen-bin-stubs.rb b/pkgs/development/interpreters/ruby/bundler-env/gen-bin-stubs.rb new file mode 100644 index 000000000000..fac9c9ad9446 --- /dev/null +++ b/pkgs/development/interpreters/ruby/bundler-env/gen-bin-stubs.rb @@ -0,0 +1,46 @@ +require 'rbconfig' +require 'rubygems' +require 'rubygems/specification' +require 'fileutils' + +# args/settings +out = ENV["out"] +ruby = ARGV[0] +gemfile = ARGV[1] +bundle_path = ARGV[2] +bundler_gem_path = ARGV[3] +paths = ARGV[4].split + +# generate binstubs +FileUtils.mkdir_p("#{out}/bin") +paths.each do |path| + next unless File.directory?("#{path}/nix-support/gem-meta") + + name = File.read("#{path}/nix-support/gem-meta/name") + executables = File.read("#{path}/nix-support/gem-meta/executables").split + executables.each do |exe| + File.open("#{out}/bin/#{exe}", "w") do |f| + f.write(<<-EOF) +#!#{ruby} +# +# This file was generated by Nix. +# +# The application '#{exe}' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] = "#{gemfile}" +ENV["BUNDLE_PATH"] = "#{bundle_path}" + +gem_path = ENV["GEM_PATH"] +ENV["GEM_PATH"] = "\#{gem_path}\#{":" unless gem_path.nil? || gem_path.empty?}#{bundler_gem_path}" + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path(#{name.inspect}, #{exe.inspect}) +EOF + FileUtils.chmod("+x", "#{out}/bin/#{exe}") + end + end +end diff --git a/pkgs/development/interpreters/ruby/bundler-env/monkey_patches.rb b/pkgs/development/interpreters/ruby/bundler-env/monkey_patches.rb deleted file mode 100644 index f68a20212cee..000000000000 --- a/pkgs/development/interpreters/ruby/bundler-env/monkey_patches.rb +++ /dev/null @@ -1,246 +0,0 @@ -require 'bundler' - -# Undo the RUBYOPT trickery. -opt = ENV['RUBYOPT'].dup -opt.gsub!(/-rmonkey_patches.rb -I [^ ]*/, '') -ENV['RUBYOPT'] = opt - -Bundler.module_eval do - class << self - # mappings from original uris to store paths. - def nix_gem_sources - @nix_gem_sources ||= - begin - src = ENV['NIX_GEM_SOURCES'] - eval(Bundler.read_file(src)) - end - end - - # extract the gemspecs from the gems pulled from Rubygems. - def nix_gemspecs - @nix_gemspecs ||= Dir.glob("gems/*.gem").map do |path| - Bundler.rubygems.spec_from_gem(path) - end - end - - # swap out ENV - def nix_with_env(env, &block) - if env - old_env = ENV.to_hash - begin - ENV.replace(env) - block.call - ensure - ENV.replace(old_env) - end - else - block.call - end - end - - # map a git uri to a fetchgit store path. - def nix_git(uri) - Pathname.new(nix_gem_sources["git"][uri]) - end - end -end - -Bundler::Source::Git::GitProxy.class_eval do - def checkout - unless path.exist? - FileUtils.mkdir_p(path.dirname) - FileUtils.cp_r(Bundler.nix_git(@uri).join(".git"), path) - system("chmod -R +w #{path}") - end - end - - def copy_to(destination, submodules=false) - unless File.exist?(destination.join(".git")) - FileUtils.mkdir_p(destination.dirname) - FileUtils.cp_r(Bundler.nix_git(@uri), destination) - system("chmod -R +w #{destination}") - end - end -end - -Bundler::Fetcher.class_eval do - def use_api - true - end - - def fetch_dependency_remote_specs(gem_names) - Bundler.ui.debug "Query Gemcutter Dependency Endpoint API: #{gem_names.join(',')}" - deps_list = [] - - spec_list = gem_names.map do |name| - spec = Bundler.nix_gemspecs.detect {|spec| spec.name == name } - if spec.nil? - msg = "WARNING: Could not find gemspec for '#{name}'" - Bundler.ui.warn msg - nil - else - dependencies = spec.dependencies. - select {|dep| dep.type != :development}. - map do |dep| - deps_list << dep.name - dep - end - - [spec.name, spec.version, spec.platform, dependencies] - end - end - - spec_list.compact! - - [spec_list, deps_list.uniq] - end -end - -Bundler::Source::Rubygems.class_eval do - # We copy all gems into $PWD/gems, and this allows RubyGems to find those - # gems during installation. - def fetchers - @fetchers ||= [ - Bundler::Fetcher.new(URI.parse("file://#{File.expand_path(Dir.pwd)}")) - ] - end - - # Look-up gems that were originally from RubyGems. - def remote_specs - @remote_specs ||= - begin - lockfile = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile)) - gem_names = lockfile.specs. - select {|spec| spec.source.is_a?(Bundler::Source::Rubygems)}. - map {|spec| spec.name} - idx = Bundler::Index.new - api_fetchers.each do |f| - Bundler.ui.info "Fetching source index from #{f.uri}" - idx.use f.specs(gem_names, self) - end - idx - end - end -end - -Bundler::Installer.class_eval do - - # WHY: - # This allows us to provide a typical Nix experience, where - # `buildInputs` and/or `preInstall` may set up the $PATH and other env-vars - # as needed. By swapping out the environment per install, we can have finer - # grained control than we would have otherwise. - # - # HOW: - # This is a wrapper around the original `install_gem_from_spec`. - # We expect that a "pre-installer" might exist at `pre-installers/<gem-name>`, - # and if it does, we execute it. - # The pre-installer is expected to dump its environment variables as a Ruby - # hash to `env/<gem-name>`. - # We then swap out the environment for the duration of the install, - # and then set it back to what it was originally. - alias original_install_gem_from_spec install_gem_from_spec - def install_gem_from_spec(spec, standalone = false, worker = 0) - env_dump = "env/#{spec.name}" - if File.exist?(env_dump) - env = eval(Bundler.read_file(env_dump)) - unless env - Bundler.ui.error "The environment variables for #{spec.name} could not be loaded!" - exit 1 - end - Bundler.nix_with_env(env) do - original_install_gem_from_spec(spec, standalone, worker) - end - else - original_install_gem_from_spec(spec, standalone, worker) - end - end - - def generate_bundler_executable_stubs(spec, options = {}) - return if spec.executables.empty? - - out = ENV['out'] - - spec.executables.each do |executable| - next if executable == "bundle" || executable == "bundler" - - binstub_path = "#{out}/bin/#{executable}" - - File.open(binstub_path, 'w', 0777 & ~File.umask) do |f| - f.print <<-TEXT -#!#{RbConfig.ruby} - -old_gemfile = ENV["BUNDLE_GEMFILE"] -old_gem_home = ENV["GEM_HOME"] -old_gem_path = ENV["GEM_PATH"] - -ENV["BUNDLE_GEMFILE"] = - "#{ENV["BUNDLE_GEMFILE"]}" -ENV["GEM_HOME"] = - "#{ENV["GEM_HOME"]}" -ENV["GEM_PATH"] = - "#{ENV["NIX_BUNDLER_GEMPATH"]}:\#{ENV["GEM_HOME"]}\#{old_gem_path ? ":\#{old_gem_path}" : ""}}" - -require 'rubygems' -require 'bundler/setup' - -ENV["BUNDLE_GEMFILE"] = old_gemfile -ENV["GEM_HOME"] = old_gem_home -ENV["GEM_PATH"] = old_gem_path - -load Gem.bin_path('#{spec.name}', '#{executable}') -TEXT - end - end - end -end - -Gem::Installer.class_eval do - # Make the wrappers automagically use bundler. - # - # Stage 1. - # Set $BUNDLE_GEMFILE so bundler knows what gems to load. - # Set $GEM_HOME to the installed gems, because bundler looks there for - # non-Rubygems installed gems (e.g. git/svn/path sources). - # Set $GEM_PATH to include both bundler and installed gems. - # - # Stage 2. - # Setup bundler, locking down the gem versions. - # - # Stage 3. - # Reset $BUNDLE_GEMFILE, $GEM_HOME, $GEM_PATH. - # - # Stage 4. - # Run the actual executable. - def app_script_text(bin_file_name) - return <<-TEXT -#!#{RbConfig.ruby} -# -# This file was generated by Nix's RubyGems. -# -# The application '#{spec.name}' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -old_gemfile = ENV["BUNDLE_GEMFILE"] -old_gem_home = ENV["GEM_HOME"] -old_gem_path = ENV["GEM_PATH"] - -ENV["BUNDLE_GEMFILE"] = - "#{ENV["BUNDLE_GEMFILE"]}" -ENV["GEM_HOME"] = - "#{ENV["GEM_HOME"]}" -ENV["GEM_PATH"] = - "#{ENV["NIX_BUNDLER_GEMPATH"]}:\#{ENV["GEM_HOME"]}\#{old_gem_path ? ":\#{old_gem_path}" : ""}}" - -require 'rubygems' -require 'bundler/setup' - -ENV["BUNDLE_GEMFILE"] = old_gemfile -ENV["GEM_HOME"] = old_gem_home -ENV["GEM_PATH"] = old_gem_path - -load Gem.bin_path('#{spec.name}', '#{bin_file_name}') -TEXT - end -end diff --git a/pkgs/development/interpreters/ruby/bundler-env/package-1.8.rb b/pkgs/development/interpreters/ruby/bundler-env/package-1.8.rb deleted file mode 100644 index 079b65f97ece..000000000000 --- a/pkgs/development/interpreters/ruby/bundler-env/package-1.8.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'rubygems/installer' -require 'rubygems/builder' - -# Simulate RubyGems 2.0 behavior. - -module Gem::Package - def self.new(gem) - @gem = gem - self - end - - def self.extract_files(dir) - installer = Gem::Installer.new @gem - installer.unpack(dir) - end - - def self.build(skip_validation=false) - builder = Gem::Builder.new(spec) - builder.build - end - - def self.spec=(spec) - @spec = spec - end - - def self.spec - @spec ||= Gem::Installer.new(@gem).spec - end -end diff --git a/pkgs/development/interpreters/ruby/bundler.nix b/pkgs/development/interpreters/ruby/bundler.nix index 3789170f57fe..cdcd12990e27 100644 --- a/pkgs/development/interpreters/ruby/bundler.nix +++ b/pkgs/development/interpreters/ruby/bundler.nix @@ -1,17 +1,10 @@ { buildRubyGem, makeWrapper, ruby, coreutils }: -buildRubyGem { - name = "bundler-1.10.6"; - namePrefix = ""; +buildRubyGem rec { + inherit ruby; + name = "${gemName}-${version}"; + gemName = "bundler"; + version = "1.10.6"; sha256 = "1vlzfq0bkkj4jyq6av0y55mh5nj5n0f3mfbmmifwgkh44g8k6agv"; dontPatchShebangs = true; - postInstall = '' - find $out -type f -perm -0100 | while read f; do - substituteInPlace $f \ - --replace "/usr/bin/env" "${coreutils}/bin/env" - done - - wrapProgram $out/bin/bundler \ - --prefix PATH ":" ${ruby}/bin - ''; } diff --git a/pkgs/development/interpreters/ruby/gem.nix b/pkgs/development/interpreters/ruby/gem.nix deleted file mode 100644 index bbc38226266b..000000000000 --- a/pkgs/development/interpreters/ruby/gem.nix +++ /dev/null @@ -1,136 +0,0 @@ -{ lib, ruby, rubygemsFun, fetchurl, makeWrapper, git } @ defs: - -lib.makeOverridable ( - -{ name -, ruby ? defs.ruby -, rubygems ? (rubygemsFun ruby) -, stdenv ? ruby.stdenv -, namePrefix ? "${lib.replaceStrings ["-"] ["_"] ruby.name}" + "-" -, buildInputs ? [] -, doCheck ? false -, dontBuild ? true -, meta ? {} -, gemPath ? [] -, ...} @ attrs: - -stdenv.mkDerivation (attrs // { - inherit ruby rubygems; - inherit doCheck; - - buildInputs = [ ruby rubygems makeWrapper git ] ++ buildInputs; - - name = namePrefix + name; - - src = if attrs ? src - then attrs.src - else fetchurl { - url = "http://rubygems.org/downloads/${attrs.name}.gem"; - inherit (attrs) sha256; - }; - - phases = [ "unpackPhase" "patchPhase" "buildPhase" "checkPhase" "installPhase" "fixupPhase" ]; - - # The source is expected to either be a gem package or a directory. - # - # - Gem packages are already built, so they don't even need to be unpacked. - # They will skip the buildPhase. - # - A directory containing the sources will need to go through all of the - # usual phases. - unpackPhase= '' - gemRegex="\.gem" - if [[ $src =~ $gemRegex ]] - then - runHook preUnpack - echo "source is a gem package, won't unpack" - gempkg=$src - dontBuild=1 - runHook postUnpack - else - # Fall back to the original thing for everything else. - unpackPhase - fi - ''; - - checkPhase = "true"; - - buildPhase = '' - runHook preBuild - - # TODO: Investigate. The complete working tree is touched by fetchgit. - if [ -d .git ]; then - git reset - fi - - gemspec=$(find . -name '*.gemspec') - echo "found the following gemspecs:" - echo "$gemspec" - - gemspec=$(echo "$gemspec" | head -n1) - echo "building $gemspec" - - exec 3>&1 - output=$(gem build $gemspec | tee >(cat - >&3)) - exec 3>&- - - gempkg=$(echo "$output" | grep -oP 'File: \K(.*)') - - echo "gem package built: $gempkg" - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - # NOTE: This does NOT build the unpacked gem, but installs $src directly. - # Gems that have not been downloaded from rubygems.org may need a - # separate buildPhase. - # --ignore-dependencies is necessary as rubygems otherwise always - # connects to the repository, thus breaking pure builds. - GEM_HOME=$out/${ruby.gemPath} \ - gem install \ - --local \ - --force \ - --http-proxy "http://nodtd.invalid" \ - --ignore-dependencies \ - --build-root "/" \ - --backtrace \ - $gempkg $gemFlags -- $buildFlags - - # Yes, we really do need the $out/${ruby.gemPath}/cache. - # This is very important in order for many parts of RubyGems/Bundler to not blow up. - # See https://github.com/bundler/bundler/issues/3327 - - mkdir -p $out/bin - for prog in $out/${ruby.gemPath}/gems/*/bin/*; do - makeWrapper $prog $out/bin/$(basename $prog) \ - --prefix GEM_PATH : "$out/${ruby.gemPath}:$GEM_PATH" \ - --prefix RUBYLIB : "${rubygems}/lib" \ - $extraWrapperFlags ''${extraWrapperFlagsArray[@]} - done - #--prefix RUBYOPT rubygems \ - - # looks like useless files which break build repeatability and consume space - rm -fv $out/${ruby.gemPath}/doc/*/*/created.rid || true - rm -fv $out/${ruby.gemPath}/gems/*/ext/*/mkmf.log || true - - mkdir -p $out/nix-support - - cat > $out/nix-support/setup-hook <<EOF - if [[ "\$GEM_PATH" != *$out* ]]; then - addToSearchPath GEM_PATH $out/${ruby.gemPath} - fi - EOF - - runHook postInstall - ''; - - propagatedBuildInputs = gemPath; - propagatedUserEnvPkgs = gemPath; - - passthru.isRubyGem = true; - inherit meta; -}) - -) diff --git a/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix b/pkgs/development/interpreters/ruby/gemconfig/default.nix index 36925bcdf558..ae8c0ee6e6ad 100644 --- a/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix +++ b/pkgs/development/interpreters/ruby/gemconfig/default.nix @@ -20,7 +20,7 @@ { lib, fetchurl, writeScript, ruby, kerberos, libxml2, libxslt, python, stdenv, which , libiconv, postgresql, v8_3_16_14, clang, sqlite, zlib, imagemagick , pkgconfig , ncurses, xapian, gpgme, utillinux, fetchpatch, tzdata, icu, libffi -, cmake, libssh2, openssl, mysql, darwin +, cmake, libssh2, openssl, mysql, darwin, git, perl, gecode_3, curl }: let @@ -32,6 +32,14 @@ in buildInputs = [ which icu zlib ]; }; + dep-selector-libgecode = attrs: { + USE_SYSTEM_GECODE = true; + postInstall = '' + installPath=$(cat $out/nix-support/gem-meta/install-path) + sed -i $installPath/lib/dep-selector-libgecode.rb -e 's@VENDORED_GECODE_DIR =.*@VENDORED_GECODE_DIR = "${gecode_3}"@' + ''; + }; + ffi = attrs: { buildInputs = [ libffi pkgconfig ]; }; @@ -40,11 +48,12 @@ in buildInputs = [ gpgme ]; }; + # note that you need version >= v3.16.14.8, + # otherwise the gem will fail to link to the libv8 binary. + # see: https://github.com/cowboyd/libv8/pull/161 libv8 = attrs: { buildInputs = [ which v8 python ]; - buildFlags = [ - "--with-system-v8=true" - ]; + buildFlags = [ "--with-system-v8=true" ]; }; mysql2 = attrs: { @@ -73,12 +82,20 @@ in buildInputs = lib.optional stdenv.isDarwin darwin.libobjc; }; + patron = attrs: { + buildInputs = [ curl ]; + }; + pg = attrs: { buildFlags = [ "--with-pg-config=${postgresql}/bin/pg_config" ]; }; + puma = attrs: { + buildInputs = [ openssl ]; + }; + rmagick = attrs: { buildInputs = [ imagemagick pkgconfig ]; }; @@ -95,6 +112,7 @@ in }; sup = attrs: { + dontBuild = false; # prevent sup from trying to dynamically install `xapian-ruby`. postPatch = '' cp ${./mkrf_conf_xapian.rb} ext/mkrf_conf_xapian.rb @@ -118,6 +136,7 @@ in }; tzinfo = attrs: { + dontBuild = false; postPatch = '' substituteInPlace lib/tzinfo/zoneinfo_data_source.rb \ --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo" @@ -130,6 +149,7 @@ in xapian-ruby = attrs: { # use the system xapian + dontBuild = false; buildInputs = [ xapian pkgconfig zlib ]; postPatch = '' cp ${./xapian-Rakefile} Rakefile diff --git a/pkgs/development/interpreters/ruby/bundler-env/mkrf_conf_xapian.rb b/pkgs/development/interpreters/ruby/gemconfig/mkrf_conf_xapian.rb index e19f06e23ac2..e19f06e23ac2 100644 --- a/pkgs/development/interpreters/ruby/bundler-env/mkrf_conf_xapian.rb +++ b/pkgs/development/interpreters/ruby/gemconfig/mkrf_conf_xapian.rb diff --git a/pkgs/development/interpreters/ruby/bundler-env/xapian-Rakefile b/pkgs/development/interpreters/ruby/gemconfig/xapian-Rakefile index 9f0b8e72f08c..9f0b8e72f08c 100644 --- a/pkgs/development/interpreters/ruby/bundler-env/xapian-Rakefile +++ b/pkgs/development/interpreters/ruby/gemconfig/xapian-Rakefile diff --git a/pkgs/development/interpreters/ruby/load-ruby-env.nix b/pkgs/development/interpreters/ruby/load-ruby-env.nix deleted file mode 100644 index c4356ed5f50f..000000000000 --- a/pkgs/development/interpreters/ruby/load-ruby-env.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ ruby, lib, callPackage, gemFixes, fetchurl, fetchgit, buildRubyGem }@defs: - -# This function builds a set of gems. You first convert your Gemfile to an attrset -# called a "gemset", and then use this function to build the gemset. -# -# A gemset looks like the following: -# -# { -# libv8 = { -# version = "3.16.14.7"; -# src = { -# type = "gem"; -# sha256 = "..."; -# }; -# }; -# therubyracer = { -# version = "0.12.1"; -# dependencies = [ "libv8" ]; -# src = { -# type = "gem"; -# sha256 = "..."; -# }; -# }; -# } -# -# If you use these gems as build inputs, the GEM_PATH will be updated -# appropriately, and command like `bundle exec` should work out of the box. - -{ gemset, ruby ? defs.ruby, fixes ? gemFixes }@args: - -let - const = x: y: x; - - fetchers.path = attrs: attrs.src.path; - fetchers.gem = attrs: fetchurl { - url = "${attrs.src.source or "https://rubygems.org"}/downloads/${attrs.name}-${attrs.version}.gem"; - inherit (attrs.src) sha256; - }; - fetchers.git = attrs: fetchgit { - inherit (attrs.src) url rev sha256 fetchSubmodules; - leaveDotGit = true; - }; - - instantiate = (attrs: - let - defaultAttrs = { - name = "${attrs.name}-${attrs.version}"; - inherit ruby gemPath; - }; - gemPath = map (name: gemset''."${name}") (attrs.dependencies or []); - fixedAttrs = attrs // (fixes."${attrs.name}" or (const {})) attrs; - withSource = fixedAttrs // - (if (lib.isDerivation fixedAttrs.src || builtins.isString fixedAttrs.src) - then {} - else { src = (fetchers."${fixedAttrs.src.type}" fixedAttrs); }); - - in - buildRubyGem (withSource // defaultAttrs) - ); - - gemset' = if builtins.isAttrs gemset then gemset else import gemset; - - gemset'' = lib.flip lib.mapAttrs gemset' (name: attrs: - if (lib.isDerivation attrs) - then attrs - else instantiate (attrs // { inherit name; }) - ); - -in gemset'' diff --git a/pkgs/development/interpreters/ruby/rubygems.nix b/pkgs/development/interpreters/ruby/rubygems.nix index f4942b840919..b6ac04808979 100644 --- a/pkgs/development/interpreters/ruby/rubygems.nix +++ b/pkgs/development/interpreters/ruby/rubygems.nix @@ -1,37 +1,35 @@ -args @ { makeWrapper, ruby, ... }: with args; +{ stdenv, lib, fetchurl, makeWrapper, ruby }: -rec { - name = "rubygems-" + version; +stdenv.mkDerivation rec { + name = "rubygems-${version}"; version = "2.4.1"; src = fetchurl { url = "http://production.cf.rubygems.org/rubygems/${name}.tgz"; sha256 = "0cpr6cx3h74ykpb0cp4p4xg7a8j0bhz3sk271jq69l4mm4zy4h4f"; }; + patches = [ ./gem_hook.patch ]; + buildInputs = [ruby makeWrapper]; - configureFlags = []; - doInstall = fullDepEntry ('' + buildPhase = ":"; + + installPhase = '' ruby setup.rb --prefix=$out/ + wrapProgram $out/bin/gem --prefix RUBYLIB : $out/lib - find $out -type f -name "*.rb" | xargs sed -i "s@/usr/bin/env@$(type -p env)@g" + + find $out -type f -name "*.rb" | + xargs sed -i "s@/usr/bin/env@$(type -p env)@g" + mkdir -pv $out/nix-support cat > $out/nix-support/setup-hook <<EOF export RUBYOPT=rubygems addToSearchPath RUBYLIB $out/lib - EOF'') ["minInit" "addInputs" "doUnpack" "defEnsureDir"]; - - /* doConfigure should be specified separately */ - phaseNames = ["doPatch" "doInstall"]; + EOF + ''; meta = { - description = "Ruby gems package collection"; - longDescription = '' - Nix can create nix packages from gems. - - To use it by installing gem-nix package. - ''; + description = "A package management framework for Ruby"; }; - - patches = [ ./gem_hook.patch ]; } diff --git a/pkgs/development/libraries/apr-util/default.nix b/pkgs/development/libraries/apr-util/default.nix index c35520f22fd3..c123740f5c12 100644 --- a/pkgs/development/libraries/apr-util/default.nix +++ b/pkgs/development/libraries/apr-util/default.nix @@ -3,6 +3,7 @@ , bdbSupport ? false, db , ldapSupport ? !stdenv.isCygwin, openldap , libiconv +, cyrus_sasl, autoreconfHook }: assert sslSupport -> openssl != null; @@ -19,19 +20,25 @@ stdenv.mkDerivation rec { sha256 = "0bn81pfscy9yjvbmyx442svf43s6dhrdfcsnkpxz43fai5qk5kx6"; }; - configureFlags = '' - --with-apr=${apr} --with-expat=${expat} - ${optionalString (!stdenv.isCygwin) "--with-crypto"} - ${stdenv.lib.optionalString sslSupport "--with-openssl=${openssl}"} - ${stdenv.lib.optionalString bdbSupport "--with-berkeley-db=${db}"} - ${stdenv.lib.optionalString ldapSupport "--with-ldap"}${ - optionalString stdenv.isCygwin "--without-pgsql --without-sqlite2 --without-sqlite3 --without-freetds --without-berkeley-db --without-crypto"} - ''; + patches = optional stdenv.isFreeBSD ./include-static-dependencies.patch; + + buildInputs = optional stdenv.isFreeBSD autoreconfHook; + + configureFlags = [ "--with-apr=${apr}" "--with-expat=${expat}" ] + ++ optional (!stdenv.isCygwin) "--with-crypto" + ++ optional sslSupport "--with-openssl=${openssl}" + ++ optional bdbSupport "--with-berkeley-db=${db}" + ++ optional ldapSupport "--with-ldap=ldap" + ++ optionals stdenv.isCygwin + [ "--without-pgsql" "--without-sqlite2" "--without-sqlite3" + "--without-freetds" "--without-berkeley-db" "--without-crypto" ] + ; propagatedBuildInputs = [ makeWrapper apr expat libiconv ] ++ optional sslSupport openssl ++ optional bdbSupport db - ++ optional ldapSupport openldap; + ++ optional ldapSupport openldap + ++ optional stdenv.isFreeBSD cyrus_sasl; # Give apr1 access to sed for runtime invocations postInstall = '' diff --git a/pkgs/development/libraries/apr-util/include-static-dependencies.patch b/pkgs/development/libraries/apr-util/include-static-dependencies.patch new file mode 100644 index 000000000000..1813c7217810 --- /dev/null +++ b/pkgs/development/libraries/apr-util/include-static-dependencies.patch @@ -0,0 +1,12 @@ +diff --git a/build/apu-conf.m4 b/build/apu-conf.m4 +index 8943f10..aa44305 100644 +--- a/build/apu-conf.m4 ++++ b/build/apu-conf.m4 +@@ -279,6 +279,7 @@ AC_ARG_WITH(ldap,[ --with-ldap=library ldap library to use], + APU_FIND_LDAPLIB("ldap", "-llber -lresolv -lsocket -lnsl") + APU_FIND_LDAPLIB("ldap", "-ldl -lpthread") + else ++ APU_FIND_LDAPLIB($LIBLDAP, "-llber -lcrypto -lssl -lsasl2") + APU_FIND_LDAPLIB($LIBLDAP) + APU_FIND_LDAPLIB($LIBLDAP, "-lresolv") + APU_FIND_LDAPLIB($LIBLDAP, "-lresolv -lsocket -lnsl") diff --git a/pkgs/development/libraries/at-spi2-atk/default.nix b/pkgs/development/libraries/at-spi2-atk/default.nix index f5d806ff67a5..f3538a122218 100644 --- a/pkgs/development/libraries/at-spi2-atk/default.nix +++ b/pkgs/development/libraries/at-spi2-atk/default.nix @@ -3,13 +3,13 @@ stdenv.mkDerivation rec { versionMajor = "2.18"; - versionMinor = "0"; + versionMinor = "1"; moduleName = "at-spi2-atk"; name = "${moduleName}-${versionMajor}.${versionMinor}"; src = fetchurl { url = "mirror://gnome/sources/${moduleName}/${versionMajor}/${name}.tar.xz"; - sha256 = "0xgkrnx04vaklbkzc7bzym9s0qhj8aiz4knqlxgx3vxnacsb6vaa"; + sha256 = "0bf1g5cj84rmx7p1q547vwbc0hlpcs2wrxnmv96lckfkhs9mzcf4"; }; buildInputs = [ python pkgconfig popt atk libX11 libICE xorg.libXtst libXi diff --git a/pkgs/development/libraries/at-spi2-core/default.nix b/pkgs/development/libraries/at-spi2-core/default.nix index b49d1ddb8040..808de07c52fd 100644 --- a/pkgs/development/libraries/at-spi2-core/default.nix +++ b/pkgs/development/libraries/at-spi2-core/default.nix @@ -3,13 +3,13 @@ stdenv.mkDerivation rec { versionMajor = "2.18"; - versionMinor = "0"; + versionMinor = "3"; moduleName = "at-spi2-core"; name = "${moduleName}-${versionMajor}.${versionMinor}"; src = fetchurl { url = "mirror://gnome/sources/${moduleName}/${versionMajor}/${name}.tar.xz"; - sha256 = "0xna0gnlqvzy6209klirywcm7ianazshg6pkk828g07bnrywgvhs"; + sha256 = "0afn4x04j5l352vj0dccb2hkpzg3l2vhr8h1yv89fpqmjkfnm8md"; }; outputs = [ "out" "doc" ]; diff --git a/pkgs/development/libraries/avahi/default.nix b/pkgs/development/libraries/avahi/default.nix index 6c8fe6e112b7..199379ad401f 100644 --- a/pkgs/development/libraries/avahi/default.nix +++ b/pkgs/development/libraries/avahi/default.nix @@ -36,12 +36,15 @@ stdenv.mkDerivation rec { avahi-core/socket.c ''; - postInstall = '' + postInstall = # Maintain compat for mdnsresponder and howl - ${if withLibdnssdCompat then "ln -s avahi-compat-libdns_sd/dns_sd.h $out/include/dns_sd.h" else ""} + stdenv.lib.optionalString withLibdnssdCompat '' + ln -s avahi-compat-libdns_sd/dns_sd.h "$out/include/dns_sd.h" + ''; + /* # these don't exist (anymore?) ln -s avahi-compat-howl $out/include/howl ln -s avahi-compat-howl.pc $out/lib/pkgconfig/howl.pc - ''; + */ meta = with stdenv.lib; { description = "mDNS/DNS-SD implementation"; diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 2a83d7c4142d..90e60d59da0c 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -1,5 +1,5 @@ { stdenv, icu, expat, zlib, bzip2, python, fixDarwinDylibNames -, toolset ? if stdenv.isDarwin then "clang" else null +, toolset ? if stdenv.cc.isClang then "clang" else null , enableRelease ? true , enableDebug ? false , enableSingleThreaded ? false diff --git a/pkgs/development/libraries/cyrus-sasl/default.nix b/pkgs/development/libraries/cyrus-sasl/default.nix index 2be98f3d5e87..059b0ab0042a 100644 --- a/pkgs/development/libraries/cyrus-sasl/default.nix +++ b/pkgs/development/libraries/cyrus-sasl/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, openssl, kerberos, db, gettext, pam, fixDarwinDylibNames }: +{ lib, stdenv, fetchurl, openssl, kerberos, db, gettext, pam, fixDarwinDylibNames, autoreconfHook }: with stdenv.lib; stdenv.mkDerivation rec { @@ -11,11 +11,18 @@ stdenv.mkDerivation rec { buildInputs = [ openssl db gettext kerberos ] + ++ lib.optional stdenv.isFreeBSD autoreconfHook ++ lib.optional stdenv.isLinux pam ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - patches = [ ./missing-size_t.patch ]; # https://bugzilla.redhat.com/show_bug.cgi?id=906519 - patchFlags = "-p0"; + patches = [ + ./missing-size_t.patch # https://bugzilla.redhat.com/show_bug.cgi?id=906519 + ] ++ lib.optional stdenv.isFreeBSD ( + fetchurl { + url = "http://www.linuxfromscratch.org/patches/blfs/svn/cyrus-sasl-2.1.26-fixes-3.patch"; + sha256 = "1vh4pc2rxxm6yvykx0b7kg09jbcwcxwv5rs6yq2ag3y8p6a9x86w"; + } + ); configureFlags = [ "--with-openssl=${openssl}" diff --git a/pkgs/development/libraries/cyrus-sasl/missing-size_t.patch b/pkgs/development/libraries/cyrus-sasl/missing-size_t.patch index 42f20fb8096b..da96818ca267 100644 --- a/pkgs/development/libraries/cyrus-sasl/missing-size_t.patch +++ b/pkgs/development/libraries/cyrus-sasl/missing-size_t.patch @@ -1,6 +1,6 @@ Gentoo bug #458790 ---- include/sasl.h 2012-10-12 17:05:48.000000000 +0300 -+++ include/sasl.h 2013-02-23 16:56:44.648786268 +0200 +--- a/include/sasl.h 2012-10-12 17:05:48.000000000 +0300 ++++ b/include/sasl.h 2013-02-23 16:56:44.648786268 +0200 @@ -121,6 +121,9 @@ #ifndef SASL_H #define SASL_H 1 diff --git a/pkgs/development/libraries/db/clang-4.8.patch b/pkgs/development/libraries/db/clang-4.8.patch new file mode 100644 index 000000000000..c53160a82970 --- /dev/null +++ b/pkgs/development/libraries/db/clang-4.8.patch @@ -0,0 +1,22 @@ +diff --git a/dbinc/atomic.h b/dbinc/atomic.h +index 0034dcc..fa7ba93 100644 +--- a/dbinc/atomic.h ++++ b/dbinc/atomic.h +@@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val; + #define atomic_inc(env, p) __atomic_inc(p) + #define atomic_dec(env, p) __atomic_dec(p) + #define atomic_compare_exchange(env, p, o, n) \ +- __atomic_compare_exchange((p), (o), (n)) ++ __db_atomic_compare_exchange((p), (o), (n)) + static inline int __atomic_inc(db_atomic_t *p) + { + int temp; +@@ -176,7 +176,7 @@ static inline int __atomic_dec(db_atomic_t *p) + * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html + * which configure could be changed to use. + */ +-static inline int __atomic_compare_exchange( ++static inline int __db_atomic_compare_exchange( + db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval) + { + atomic_value_t was; diff --git a/pkgs/development/libraries/db/osx.patch b/pkgs/development/libraries/db/clang-5.3.patch index 438fa7eedd71..438fa7eedd71 100644 --- a/pkgs/development/libraries/db/osx.patch +++ b/pkgs/development/libraries/db/clang-5.3.patch diff --git a/pkgs/development/libraries/db/db-4.8.nix b/pkgs/development/libraries/db/db-4.8.nix index 9b5e8cb39bda..6a161b0b72d8 100644 --- a/pkgs/development/libraries/db/db-4.8.nix +++ b/pkgs/development/libraries/db/db-4.8.nix @@ -2,6 +2,7 @@ import ./generic.nix (args // rec { version = "4.8.30"; + extraPatches = [ ./clang-4.8.patch ]; sha256 = "0ampbl2f0hb1nix195kz1syrqqxpmvnvnfvphambj7xjrl3iljg0"; branch = "4.8"; }) diff --git a/pkgs/development/libraries/db/db-5.3.nix b/pkgs/development/libraries/db/db-5.3.nix index b5e62ee686f0..98002c244612 100644 --- a/pkgs/development/libraries/db/db-5.3.nix +++ b/pkgs/development/libraries/db/db-5.3.nix @@ -3,6 +3,6 @@ import ./generic.nix (args // rec { version = "5.3.28"; sha256 = "0a1n5hbl7027fbz5lm0vp0zzfp1hmxnz14wx3zl9563h83br5ag0"; - extraPatches = [ ./osx.patch ]; + extraPatches = [ ./clang-5.3.patch ]; branch = "5.3"; }) diff --git a/pkgs/development/libraries/db/generic.nix b/pkgs/development/libraries/db/generic.nix index 077bd4e03a32..f5ee4e440ff0 100644 --- a/pkgs/development/libraries/db/generic.nix +++ b/pkgs/development/libraries/db/generic.nix @@ -23,6 +23,7 @@ stdenv.mkDerivation rec { (if cxxSupport then "--enable-cxx" else "--disable-cxx") (if compat185 then "--enable-compat185" else "--disable-compat185") "--enable-dbm" + (stdenv.lib.optionalString stdenv.isFreeBSD "--with-pic") ]; preConfigure = '' diff --git a/pkgs/development/libraries/exiv2/default.nix b/pkgs/development/libraries/exiv2/default.nix index 0702d24a80b8..e1af46cc3ed0 100644 --- a/pkgs/development/libraries/exiv2/default.nix +++ b/pkgs/development/libraries/exiv2/default.nix @@ -1,28 +1,20 @@ -{stdenv, fetchurl, fetchpatch, zlib, expat}: +{ stdenv, fetchurl, fetchpatch, zlib, expat, gettext }: stdenv.mkDerivation rec { - name = "exiv2-0.24"; + name = "exiv2-0.25"; src = fetchurl { url = "http://www.exiv2.org/${name}.tar.gz"; - sha256 = "13pgvz14kyapxl89pxjaq3274k56d5lzfckpg1g9z7gvqzk4797l"; + sha256 = "197g6vgcpyf9p2cwn5p5hb1r714xsk1v4p96f5pv1z8mi9vzq2y8"; }; + postPatch = "patchShebangs ./src/svn_version.sh"; - patches = [(fetchpatch { - name = "CVE-2014-9449.diff"; - url = "http://dev.exiv2.org/projects/exiv2/repository/revisions/3264/diff?format=diff&rev_to=3263"; - sha256 = "02w0fksl966d4v6bkg6rq3wmvv8xjpvfp47qr0nv1xq0bphxqzag"; - })]; - - propagatedBuildInputs = [zlib expat]; - -# configure script finds zlib&expat but it thinks that they're in /usr - configureFlags = "--with-zlib=${zlib} --with-expat=${expat}"; + nativeBuildInputs = [ gettext ]; + propagatedBuildInputs = [ zlib expat ]; meta = { homepage = http://www.exiv2.org/; description = "A library and command-line utility to manage image metadata"; - maintainers = [stdenv.lib.maintainers.urkud]; platforms = stdenv.lib.platforms.all; }; } diff --git a/pkgs/development/libraries/expat/default.nix b/pkgs/development/libraries/expat/default.nix index 05cfeaee4232..96d46649d916 100644 --- a/pkgs/development/libraries/expat/default.nix +++ b/pkgs/development/libraries/expat/default.nix @@ -10,6 +10,8 @@ stdenv.mkDerivation rec { patches = [ ./CVE-2015-1283.patch ]; + configureFlags = stdenv.lib.optional stdenv.isFreeBSD "--with-pic"; + meta = with stdenv.lib; { homepage = http://www.libexpat.org/; description = "A stream-oriented XML parser library written in C"; diff --git a/pkgs/development/libraries/ffmpeg-full/default.nix b/pkgs/development/libraries/ffmpeg-full/default.nix index fadb3feb4cc0..eed6a3bc763c 100644 --- a/pkgs/development/libraries/ffmpeg-full/default.nix +++ b/pkgs/development/libraries/ffmpeg-full/default.nix @@ -235,11 +235,11 @@ assert x11grabExtlib -> libX11 != null && libXv != null; stdenv.mkDerivation rec { name = "ffmpeg-full-${version}"; - version = "2.8.1"; + version = "2.8.5"; src = fetchurl { url = "https://www.ffmpeg.org/releases/ffmpeg-${version}.tar.bz2"; - sha256 = "1qk6g2h993i0wgs9d2p3ahdc5bqr03mp74bk6r1zj6pfinr5mvg2"; + sha256 = "0nk1j3i7qc1k3dygpq74pxq382vqg9kaf2hxl9jfw8rkad8rjv9v"; }; patchPhase = ''patchShebangs .''; diff --git a/pkgs/development/libraries/ffmpeg/2.8.nix b/pkgs/development/libraries/ffmpeg/2.8.nix index e585ea14997f..2f911b26ca19 100644 --- a/pkgs/development/libraries/ffmpeg/2.8.nix +++ b/pkgs/development/libraries/ffmpeg/2.8.nix @@ -1,7 +1,7 @@ { callPackage, ... } @ args: callPackage ./generic.nix (args // rec { - version = "${branch}.1"; + version = "${branch}.5"; branch = "2.8"; - sha256 = "1qk6g2h993i0wgs9d2p3ahdc5bqr03mp74bk6r1zj6pfinr5mvg2"; + sha256 = "0nk1j3i7qc1k3dygpq74pxq382vqg9kaf2hxl9jfw8rkad8rjv9v"; }) diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix index dbd3a679d482..18562d1d12e3 100644 --- a/pkgs/development/libraries/gdk-pixbuf/default.nix +++ b/pkgs/development/libraries/gdk-pixbuf/default.nix @@ -3,14 +3,14 @@ let ver_maj = "2.32"; - ver_min = "1"; + ver_min = "3"; in stdenv.mkDerivation rec { name = "gdk-pixbuf-${ver_maj}.${ver_min}"; src = fetchurl { url = "mirror://gnome/sources/gdk-pixbuf/${ver_maj}/${name}.tar.xz"; - sha256 = "1g7kjxv67jcdasi14n7jan4icrnnppd1m99wrdmpv32k4m7vfcj4"; + sha256 = "0cfh87aqyqbfcwpbv1ihgmgfcn66il5q2n8yjyl8gxkjmkqp2rrb"; }; setupHook = ./setup-hook.sh; diff --git a/pkgs/development/libraries/gecode/3.nix b/pkgs/development/libraries/gecode/3.nix new file mode 100644 index 000000000000..a0f3dc636f92 --- /dev/null +++ b/pkgs/development/libraries/gecode/3.nix @@ -0,0 +1,21 @@ +{ stdenv, fetchurl, perl }: + +stdenv.mkDerivation rec { + name = "gecode-${version}"; + version = "3.7.3"; + + src = fetchurl { + url = "http://www.gecode.org/download/${name}.tar.gz"; + sha256 = "0k45jas6p3cyldgyir1314ja3174sayn2h2ly3z9b4dl3368pk77"; + }; + + buildInputs = [ perl ]; + + meta = with stdenv.lib; { + license = licenses.mit; + homepage = http://www.gecode.org; + description = "Toolkit for developing constraint-based systems"; + platforms = platforms.all; + maintainers = [ maintainers.manveru ]; + }; +} diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix index e53775464e03..538a40615f14 100644 --- a/pkgs/development/libraries/glib/default.nix +++ b/pkgs/development/libraries/glib/default.nix @@ -7,7 +7,7 @@ with stdenv.lib; -assert !stdenv.isDarwin -> stdenv.cc.isGNU; +assert stdenv.isFreeBSD || stdenv.isDarwin || stdenv.cc.isGNU; # TODO: # * Add gio-module-fam @@ -63,8 +63,12 @@ stdenv.mkDerivation rec { propagatedBuildInputs = [ pcre zlib libffi libiconv ] ++ libintlOrEmpty; + LIBELF_CFLAGS = optional stdenv.isFreeBSD "-I${libelf}"; + LIBELF_LIBS = optional stdenv.isFreeBSD "-L${libelf} -lelf"; + configureFlags = optional stdenv.isDarwin "--disable-compile-warnings" + ++ optional stdenv.isFreeBSD "--with-libiconv=gnu" ++ optional stdenv.isSunOS ["--disable-modular-tests" "--with-libiconv"]; NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin " -lintl" diff --git a/pkgs/development/libraries/gnutls/generic.nix b/pkgs/development/libraries/gnutls/generic.nix index f1eb62e0083e..ebaef47ca140 100644 --- a/pkgs/development/libraries/gnutls/generic.nix +++ b/pkgs/development/libraries/gnutls/generic.nix @@ -30,7 +30,7 @@ stdenv.mkDerivation { enableParallelBuilding = !guileBindings; buildInputs = [ lzo lzip nettle libtasn1 libidn p11_kit zlib gmp autogen ] - ++ lib.optional (stdenv.isDarwin) libiconv + ++ lib.optional (stdenv.isFreeBSD || stdenv.isDarwin) libiconv ++ lib.optional (tpmSupport && stdenv.isLinux) trousers ++ [ unbound ] ++ lib.optional guileBindings guile; diff --git a/pkgs/development/libraries/gtk+/2.x.nix b/pkgs/development/libraries/gtk+/2.x.nix index e821e693b0ce..8830e1425b68 100644 --- a/pkgs/development/libraries/gtk+/2.x.nix +++ b/pkgs/development/libraries/gtk+/2.x.nix @@ -8,11 +8,11 @@ assert xineramaSupport -> xorg.libXinerama != null; assert cupsSupport -> cups != null; stdenv.mkDerivation rec { - name = "gtk+-2.24.28"; + name = "gtk+-2.24.29"; src = fetchurl { url = "mirror://gnome/sources/gtk+/2.24/${name}.tar.xz"; - sha256 = "0mj6xn40py9r9lvzg633fal81xfwfm89d9mvz7jk4lmwk0g49imj"; + sha256 = "1f1ifv1ijrda4jx831l24d3ww65v5gf56r464fi11n6k02bcah87"; }; enableParallelBuilding = true; diff --git a/pkgs/development/libraries/harfbuzz/default.nix b/pkgs/development/libraries/harfbuzz/default.nix index 26c5d2fa8254..d2546ebd496d 100644 --- a/pkgs/development/libraries/harfbuzz/default.nix +++ b/pkgs/development/libraries/harfbuzz/default.nix @@ -8,11 +8,11 @@ # (icu is a ~30 MB dependency, the rest is very small in comparison) stdenv.mkDerivation rec { - name = "harfbuzz-1.0.6"; + name = "harfbuzz-1.1.2"; src = fetchurl { url = "http://www.freedesktop.org/software/harfbuzz/release/${name}.tar.bz2"; - sha256 = "09ivk5m4y09ar4zi9r6db7gp234cy05h0ach7w22g9kqvkxsf5pn"; + sha256 = "07s6z3hbrb4rdfgzmln169wxz4nm5y7qbr02ik5c7drxpn85fb2a"; }; outputs = [ "out" "doc" ]; diff --git a/pkgs/development/libraries/icu/default.nix b/pkgs/development/libraries/icu/default.nix index a2196d26524e..148e4f02a94f 100644 --- a/pkgs/development/libraries/icu/default.nix +++ b/pkgs/development/libraries/icu/default.nix @@ -30,7 +30,7 @@ stdenv.mkDerivation { ''; configureFlags = "--disable-debug" + - stdenv.lib.optionalString stdenv.isDarwin " --enable-rpath"; + stdenv.lib.optionalString (stdenv.isFreeBSD || stdenv.isDarwin) " --enable-rpath"; # remove dependency on bootstrap-tools in early stdenv build postInstall = stdenv.lib.optionalString stdenv.isDarwin '' diff --git a/pkgs/development/libraries/kerberos/heimdal.nix b/pkgs/development/libraries/kerberos/heimdal.nix index 0569c0bf5b31..175d0c7bc3b2 100644 --- a/pkgs/development/libraries/kerberos/heimdal.nix +++ b/pkgs/development/libraries/kerberos/heimdal.nix @@ -23,7 +23,8 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ autoreconfHook pkgconfig python perl yacc flex ] ++ (with perlPackages; [ JSON ]) ++ optional (!libOnly) texinfo; - buildInputs = [ libcap_ng sqlite openssl db libedit ] + buildInputs = optionals (!stdenv.isFreeBSD) [ libcap_ng db ] + ++ [ sqlite openssl libedit ] ++ optionals (!libOnly) [ openldap pam ]; ## ugly, X should be made an option @@ -31,14 +32,15 @@ stdenv.mkDerivation rec { "--sysconfdir=/etc" "--localstatedir=/var" "--enable-hdb-openldap-module" - "--with-capng" "--with-sqlite3=${sqlite}" - "--with-berkeley-db=${db}" "--with-libedit=${libedit}" "--with-openssl=${openssl}" "--without-x" + "--with-berkeley-db=${db}" ] ++ optionals (!libOnly) [ "--with-openldap=${openldap}" + ] ++ optionals (!stdenv.isFreeBSD) [ + "--with-capng" ]; buildPhase = optionalString libOnly '' @@ -83,7 +85,7 @@ stdenv.mkDerivation rec { meta = { description = "An implementation of Kerberos 5 (and some more stuff)"; license = licenses.bsd3; - platforms = platforms.linux; + platforms = platforms.linux ++ platforms.freebsd; maintainers = with maintainers; [ wkennington ]; }; diff --git a/pkgs/development/libraries/kerberos/krb5.nix b/pkgs/development/libraries/kerberos/krb5.nix index 2e5e48891b82..5b2b09542037 100644 --- a/pkgs/development/libraries/kerberos/krb5.nix +++ b/pkgs/development/libraries/kerberos/krb5.nix @@ -11,24 +11,22 @@ in with stdenv.lib; stdenv.mkDerivation rec { name = "${type}krb5-${version}"; - version = "1.13.2"; + version = "1.14"; src = fetchurl { - url = "${meta.homepage}dist/krb5/1.13/krb5-${version}-signed.tar"; - sha256 = "1qbdzyrws7d0q4filsibh28z54pd5l987jr0ygv43iq9085w6a75"; + url = "${meta.homepage}dist/krb5/1.14/krb5-${version}.tar.gz"; + sha256 = "1sgr61cnkgc5xazijaww6wpn5fnxl9vyj9ixk3r3y7ikv3x0gnyf"; }; + configureFlags = optional stdenv.isFreeBSD ''WARN_CFLAGS=""''; + nativeBuildInputs = [ pkgconfig perl yacc ] # Provides the mig command used by the build scripts - ++ stdenv.lib.optional stdenv.isDarwin bootstrap_cmds; + ++ optional stdenv.isDarwin bootstrap_cmds; buildInputs = [ openssl ] ++ optionals (!libOnly) [ openldap libedit ]; - unpackPhase = '' - tar -xf $src - tar -xzf krb5-${version}.tar.gz - cd krb5-${version}/src - ''; + preConfigure = "cd ./src"; buildPhase = optionalString libOnly '' (cd util; make -j $NIX_BUILD_CORES) diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix index 533512e9b689..154277f9cc66 100644 --- a/pkgs/development/libraries/libdrm/default.nix +++ b/pkgs/development/libraries/libdrm/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, pkgconfig, libpthreadstubs, libpciaccess, udev, valgrind }: stdenv.mkDerivation rec { - name = "libdrm-2.4.65"; + name = "libdrm-2.4.66"; src = fetchurl { url = "http://dri.freedesktop.org/libdrm/${name}.tar.bz2"; - sha256 = "71960ac8bde7d710992b1bc8879935e8300a870c36bd06f22412d0447e3d96c4"; + sha256 = "79cb8e988749794edfb2d777b298d5292eff353bbbb71ed813589e61d2bc2d76"; }; nativeBuildInputs = [ pkgconfig ]; diff --git a/pkgs/development/libraries/libedit/default.nix b/pkgs/development/libraries/libedit/default.nix index dc8ecf7e95d8..6e8d85cb88d9 100644 --- a/pkgs/development/libraries/libedit/default.nix +++ b/pkgs/development/libraries/libedit/default.nix @@ -11,23 +11,21 @@ stdenv.mkDerivation rec { # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds. NROFF = "${groff}/bin/nroff"; - patches = if stdenv.isCygwin then [ - ./01-cygwin.patch - ] else null; + patches = [ ./01-cygwin.patch ./freebsd-wchar.patch ]; + + propagatedBuildInputs = [ ncurses ]; + + configureFlags = [ "--enable-widec" ]; postInstall = '' find $out/lib -type f | grep '\.\(la\|pc\)''$' | xargs sed -i \ -e 's,-lncurses[a-z]*,-L${ncurses}/lib -lncursesw,g' ''; - configureFlags = [ "--enable-widec" ]; - - propagatedBuildInputs = [ ncurses ]; - meta = with stdenv.lib; { homepage = "http://www.thrysoee.dk/editline/"; description = "A port of the NetBSD Editline library (libedit)"; - license = licenses.bsd3; + license = licenses.bsd3; platforms = platforms.all; }; } diff --git a/pkgs/development/libraries/libedit/freebsd-wchar.patch b/pkgs/development/libraries/libedit/freebsd-wchar.patch new file mode 100644 index 000000000000..6bf7fb0ef69a --- /dev/null +++ b/pkgs/development/libraries/libedit/freebsd-wchar.patch @@ -0,0 +1,13 @@ +diff --git a/src/chartype.h b/src/chartype.h +index 0beee17..4ac86f3 100644 +--- a/src/chartype.h ++++ b/src/chartype.h +@@ -44,7 +44,7 @@ + * supports non-BMP code points without requiring UTF-16, but nothing + * seems to actually advertise this properly, despite Unicode 3.1 having + * been around since 2001... */ +-#if !defined(__NetBSD__) && !defined(__sun) && !(defined(__APPLE__) && defined(__MACH__)) && !defined(__OpenBSD__) ++#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__sun) && !(defined(__APPLE__) && defined(__MACH__)) && !defined(__OpenBSD__) + #ifndef __STDC_ISO_10646__ + /* In many places it is assumed that the first 127 code points are ASCII + * compatible, so ensure wchar_t indeed does ISO 10646 and not some other diff --git a/pkgs/development/libraries/libelf-freebsd/default.nix b/pkgs/development/libraries/libelf-freebsd/default.nix new file mode 100644 index 000000000000..26fe2d90963a --- /dev/null +++ b/pkgs/development/libraries/libelf-freebsd/default.nix @@ -0,0 +1,37 @@ +{ fetchsvn, stdenv, gnum4, tet }: + +stdenv.mkDerivation (rec { + version = "3258"; + name = "libelf-freebsd-${version}"; + + src = fetchsvn { + url = svn://svn.code.sf.net/p/elftoolchain/code/trunk; + rev = (stdenv.lib.strings.toInt version); + name = "elftoolchain-${version}"; + }; + + buildInputs = [ gnum4 tet ]; + + buildPhase = '' + PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:$PATH # use BSD install(1) instead of coreutils and make(1) instead of GNU Make + cp -vr ${tet} test/tet/tet3.8 + chmod -R a+w test/tet/tet3.8 + make libelf + ''; + + installPhase = '' + cp -vr libelf $out + cp -vr common/. $out/ + ''; + + meta = { + description = "Essential compilation tools and libraries for building and analyzing ELF based program images"; + + homepage = https://sourceforge.net/p/elftoolchain/wiki/Home/; + + license = stdenv.lib.licenses.bsd2; + + platforms = stdenv.lib.platforms.freebsd; + maintainers = [ ]; + }; +}) diff --git a/pkgs/development/libraries/libiconv/default.nix b/pkgs/development/libraries/libiconv/default.nix index 70b0574a7b46..f5818c3bf4c9 100644 --- a/pkgs/development/libraries/libiconv/default.nix +++ b/pkgs/development/libraries/libiconv/default.nix @@ -1,4 +1,4 @@ -{ fetchurl, stdenv }: +{ fetchurl, stdenv, lib }: assert (!stdenv.isLinux); @@ -10,16 +10,18 @@ stdenv.mkDerivation rec { sha256 = "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj"; }; - patches = if stdenv.isCygwin then [ + patches = lib.optionals stdenv.isCygwin [ ./libiconv-1.14-reloc.patch ./libiconv-1.14-wchar.patch - ] else null; + ]; + configureFlags = # On Cygwin, Libtool produces a `.dll.a', which is not a "real" DLL # (Windows' linker would need to be used somehow to produce an actual # DLL.) Thus, build the static library too, and this is what Gettext # will actually use. - configureFlags = if stdenv.isCygwin then [ "--enable-static" ] else null; + lib.optional stdenv.isCygwin "--enable-static" + ++ lib.optional stdenv.isFreeBSD "--with-pic"; crossAttrs = { # Disable stripping to avoid "libiconv.a: Archive has no index" (MinGW). @@ -41,11 +43,11 @@ stdenv.mkDerivation rec { ''; homepage = http://www.gnu.org/software/libiconv/; - license = stdenv.lib.licenses.lgpl2Plus; + license = lib.licenses.lgpl2Plus; maintainers = [ ]; # This library is not needed on GNU platforms. - hydraPlatforms = stdenv.lib.platforms.cygwin ++ stdenv.lib.platforms.darwin ++ stdenv.lib.platforms.freebsd; + hydraPlatforms = with lib.platforms; cygwin ++ darwin ++ freebsd; }; } diff --git a/pkgs/development/libraries/libossp-uuid/default.nix b/pkgs/development/libraries/libossp-uuid/default.nix index 119f41116668..ddfc2a5132c7 100644 --- a/pkgs/development/libraries/libossp-uuid/default.nix +++ b/pkgs/development/libraries/libossp-uuid/default.nix @@ -10,6 +10,8 @@ stdenv.mkDerivation { sha256= "11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0"; }; + configureFlags = stdenv.lib.optional stdenv.isFreeBSD "--with-pic"; + meta = with stdenv.lib; { homepage = http://www.ossp.org/pkg/lib/uuid/; description = "OSSP uuid ISO-C and C++ shared library"; diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix index 2fdc198aa115..cac8f10d37aa 100644 --- a/pkgs/development/libraries/libxml2/default.nix +++ b/pkgs/development/libraries/libxml2/default.nix @@ -4,16 +4,13 @@ assert pythonSupport -> python != null; #TODO: share most stuff between python and non-python builds, perhaps via multiple-output -let - version = "2.9.2"; -in - stdenv.mkDerivation (rec { name = "libxml2-${version}"; + version = "2.9.3"; src = fetchurl { url = "http://xmlsoft.org/sources/${name}.tar.gz"; - sha256 = "1g6mf03xcabmk5ing1lwqmasr803616gb2xhn7pll10x2l5w6y2i"; + sha256 = "0bd17g6znn2r98gzpjppsqjg33iraky4px923j3k8kdl8qgy7sad"; }; outputs = [ "out" "doc" ]; @@ -48,4 +45,3 @@ stdenv.mkDerivation (rec { } // stdenv.lib.optionalAttrs (!pythonSupport) { configureFlags = "--with-python=no"; # otherwise build impurity bites us }) - diff --git a/pkgs/development/libraries/openldap/default.nix b/pkgs/development/libraries/openldap/default.nix index 253f74ecc6a8..7d836cd5a0df 100644 --- a/pkgs/development/libraries/openldap/default.nix +++ b/pkgs/development/libraries/openldap/default.nix @@ -9,7 +9,16 @@ stdenv.mkDerivation rec { }; # Should be removed with >=2.4.43 - patches = [ ./CVE-2015-6908.patch ]; + patches = [ + ./CVE-2015-6908.patch + ( + fetchurl { + sha256 = "5bcb3f9fb7186b380efa0a1c2d31ad755e190134b5c4dac07c65bbf7c0b6b3b3"; + url = "https://github.com/LMDB/lmdb/commit/3360cbad668f678fb23c064ca4efcc5c9ae95d10.patch"; + name = "openldap-clang-compilation.patch"; + } + ) + ]; outputs = [ "out" "man" ]; @@ -19,7 +28,8 @@ stdenv.mkDerivation rec { [ "--enable-overlays" "--disable-dependency-tracking" # speeds up one-time build ] ++ stdenv.lib.optional (openssl == null) "--without-tls" - ++ stdenv.lib.optional (cyrus_sasl == null) "--without-cyrus-sasl"; + ++ stdenv.lib.optional (cyrus_sasl == null) "--without-cyrus-sasl" + ++ stdenv.lib.optional stdenv.isFreeBSD "--with-pic"; dontPatchELF = 1; # !!! diff --git a/pkgs/development/libraries/pango/default.nix b/pkgs/development/libraries/pango/default.nix index e7106b9877e0..07a987c8ff66 100644 --- a/pkgs/development/libraries/pango/default.nix +++ b/pkgs/development/libraries/pango/default.nix @@ -4,14 +4,14 @@ let ver_maj = "1.38"; - ver_min = "0"; + ver_min = "1"; in stdenv.mkDerivation rec { name = "pango-${ver_maj}.${ver_min}"; src = fetchurl { url = "mirror://gnome/sources/pango/${ver_maj}/${name}.tar.xz"; - sha256 = "0v12gi7f01iq3z852pclpnmkbcksbvpcmiazmklkx1dd9fbpakhx"; + sha256 = "1dsf45m51i4rcyvh5wlxxrjfhvn5b67d5ckjc6vdcxbddjgmc80k"; }; buildInputs = with stdenv.lib; [ gobjectIntrospection ] diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix index 25b547bf1cf6..17e0485b29fe 100644 --- a/pkgs/development/libraries/qt-4.x/4.8/default.nix +++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix @@ -85,7 +85,7 @@ stdenv.mkDerivation rec { -datadir $out/share/${name} -translationdir $out/share/${name}/translations " - '' + optionalString stdenv.isDarwin '' + '' + optionalString stdenv.cc.isClang '' sed -i 's/QMAKE_CC = gcc/QMAKE_CC = clang/' mkspecs/common/g++-base.conf sed -i 's/QMAKE_CXX = g++/QMAKE_CXX = clang++/' mkspecs/common/g++-base.conf ''; @@ -95,7 +95,7 @@ stdenv.mkDerivation rec { '' -v -no-separate-debug-info -release -no-fast -confirm-license -opensource - -opengl -xrender -xrandr -xinerama -xcursor -xinput -xfixes -fontconfig + -${if stdenv.isFreeBSD then "no-" else ""}opengl -xrender -xrandr -xinerama -xcursor -xinput -xfixes -fontconfig -qdbus -${if cups == null then "no-" else ""}cups -glib -dbus-linked -openssl-linked ${if mysql != null then "-plugin" else "-no"}-sql-mysql -system-sqlite @@ -122,17 +122,18 @@ stdenv.mkDerivation rec { # The following libraries are only used in plugins buildInputs = [ cups # Qt dlopen's libcups instead of linking to it - mysql.lib postgresql sqlite libjpeg libmng libtiff icu ] + postgresql sqlite libjpeg libmng libtiff icu ] + ++ optionals (mysql != null) [ mysql.lib ] ++ optionals gtkStyle [ gtk gdk_pixbuf ]; nativeBuildInputs = [ perl pkgconfig which ]; enableParallelBuilding = false; - NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin + NIX_CFLAGS_COMPILE = optionalString (stdenv.isFreeBSD || stdenv.isDarwin) "-I${glib}/include/glib-2.0 -I${glib}/lib/glib-2.0/include"; - NIX_LDFLAGS = optionalString stdenv.isDarwin + NIX_LDFLAGS = optionalString (stdenv.isFreeBSD || stdenv.isDarwin) "-lglib-2.0"; preBuild = optionalString stdenv.isDarwin '' diff --git a/pkgs/development/libraries/serf/default.nix b/pkgs/development/libraries/serf/default.nix index 580460d5fc09..20ce1dabf9a1 100644 --- a/pkgs/development/libraries/serf/default.nix +++ b/pkgs/development/libraries/serf/default.nix @@ -21,7 +21,7 @@ stdenv.mkDerivation rec { buildPhase = '' scons PREFIX="$out" OPENSSL="${openssl}" ZLIB="${zlib}" APR="$(echo "${apr}"/bin/*-config)" \ APU="$(echo "${aprutil}"/bin/*-config)" CC="${ - if stdenv.isDarwin then "clang" else "${stdenv.cc}/bin/gcc" + if stdenv.cc.isClang then "clang" else "${stdenv.cc}/bin/gcc" }" ${ if (stdenv.isDarwin || stdenv.isCygwin) then "" else "GSSAPI=\"${kerberos}\"" } diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix index 93474d14344e..7a6f480215c7 100644 --- a/pkgs/development/libraries/zlib/default.nix +++ b/pkgs/development/libraries/zlib/default.nix @@ -31,7 +31,8 @@ stdenv.mkDerivation (rec { # As zlib takes part in the stdenv building, we don't want references # to the bootstrap-tools libgcc (as uses to happen on arm/mips) - NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!stdenv.isDarwin) "-static-libgcc"; + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!stdenv.isDarwin) "-static-libgcc " + + stdenv.lib.optionalString (stdenv.isFreeBSD) "-fPIC"; crossAttrs = { dontStrip = static; diff --git a/pkgs/development/tools/build-managers/cargo/head.nix b/pkgs/development/tools/build-managers/cargo/head.nix new file mode 100644 index 000000000000..d5a2dce66828 --- /dev/null +++ b/pkgs/development/tools/build-managers/cargo/head.nix @@ -0,0 +1,39 @@ +{ stdenv, fetchgit, rustPlatform, file, curl, python, pkgconfig, openssl +, cmake, zlib, makeWrapper }: + +with rustPlatform; + +with ((import ./common.nix) { + inherit stdenv rustc; + version = "2016-01-10"; +}); + +buildRustPackage rec { + inherit name version meta passthru; + + # Needs to use fetchgit instead of fetchFromGitHub to fetch submodules + src = fetchgit { + url = "git://github.com/rust-lang/cargo"; + rev = "ca373452de159491354cf38279dbc19308c91e72"; + sha256 = "0fx88b3ndvzhfwq159xavs0z5c7jww231kd65cbzyih9g0ab9x65"; + }; + + depsSha256 = "0csagk2dnwg5z0vbxilz1kzcygd4llw7s81ka0xn1g05x30jqrnn"; + + buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper ]; + + configurePhase = '' + ./configure --enable-optimize --prefix=$out --local-cargo=${cargo}/bin/cargo + ''; + + buildPhase = "make"; + + # Disable check phase as there are lots of failures (some probably due to + # trying to access the network). + doCheck = false; + + installPhase = '' + make install + ${postInstall} + ''; +} diff --git a/pkgs/development/tools/guile/g-wrap/default.nix b/pkgs/development/tools/guile/g-wrap/default.nix index ed492a0b82df..14777b95b85e 100644 --- a/pkgs/development/tools/guile/g-wrap/default.nix +++ b/pkgs/development/tools/guile/g-wrap/default.nix @@ -14,7 +14,7 @@ stdenv.mkDerivation rec { propagatedBuildInputs = [ libffi ]; - doCheck = true; + doCheck = !stdenv.isFreeBSD; # XXX: 00-socket.test hangs meta = { description = "G-Wrap, a wrapper generator for Guile"; diff --git a/pkgs/development/tools/misc/gnum4/default.nix b/pkgs/development/tools/misc/gnum4/default.nix index 7174f4b41c3c..7216e1e169d0 100644 --- a/pkgs/development/tools/misc/gnum4/default.nix +++ b/pkgs/development/tools/misc/gnum4/default.nix @@ -10,7 +10,8 @@ stdenv.mkDerivation rec { doCheck = !stdenv.isDarwin && !stdenv.isCygwin # XXX: `test-dup2' fails on Cygwin - && !stdenv.isSunOS; # XXX: `test-setlocale2.sh' fails + && !stdenv.isSunOS # XXX: `test-setlocale2.sh' fails + && !stdenv.isFreeBSD; # XXX: test 084 fails configureFlags = "--with-syscmd-shell=${stdenv.shell}"; diff --git a/pkgs/development/tools/misc/tet/default.nix b/pkgs/development/tools/misc/tet/default.nix new file mode 100644 index 000000000000..77b362c712c2 --- /dev/null +++ b/pkgs/development/tools/misc/tet/default.nix @@ -0,0 +1,29 @@ +{ fetchurl, stdenv }: + +stdenv.mkDerivation (rec { + version = "3.8"; + name = "tet-${version}"; + + src = fetchurl { + url = http://tetworks.opengroup.org/downloads/38/software/Sources/3.8/tet3.8-src.tar.gz ; + sha256 = "1j57hv56df38w249l595b8rsgmsyvjkbysai03a9724gax5jl9av" ; + }; + + buildInputs = [ ]; + + patchPhase = ''chmod +x configure''; + + configurePhase = ''./configure -t lite''; + + buildPhase = ''cd src; make; cd -''; + + installPhase = ''cd src; make install; cd -; cp -vr $PWD $out''; + + meta = { + description = "The Test Environment Toolkit is used in test applications like The Open Group's UNIX Certification program and the Free Standards Group's LSB Certification program"; + homepage = http://tetworks.opengroup.org/Products/tet.htm ; + license = stdenv.lib.licenses.artistic1; + platforms = stdenv.lib.platforms.unix; + maintainers = [ ]; + }; +}) diff --git a/pkgs/development/tools/vagrant/default.nix b/pkgs/development/tools/vagrant/default.nix index b3b2040559aa..36df8bba1b9f 100644 --- a/pkgs/development/tools/vagrant/default.nix +++ b/pkgs/development/tools/vagrant/default.nix @@ -7,7 +7,8 @@ let version = "1.8.0"; rake = buildRubyGem { inherit ruby; - name = "rake-10.4.2"; + gemName = "rake"; + version = "10.4.2"; sha256 = "1rn03rqlf1iv6n87a78hkda2yqparhhaivfjpizblmxvlw2hk5r8"; }; |