further improvements to patches and build process
This commit is contained in:
parent
2dedbe6bbe
commit
289b7e5068
5 changed files with 115 additions and 117 deletions
|
@ -4,12 +4,10 @@
|
|||
, namePrefix ? "ruby${ruby.majorVersion}" + "-"
|
||||
, buildInputs ? []
|
||||
, doCheck ? false
|
||||
, doGitPrecheckHack ? false
|
||||
, dontBuild ? true
|
||||
, meta ? {}
|
||||
, gemPath ? []
|
||||
, testTask ? "test"
|
||||
, preCheck ? ""
|
||||
, postCheck ? ""
|
||||
, ...} @ attrs:
|
||||
|
||||
let
|
||||
|
@ -32,35 +30,23 @@ in ruby.stdenv.mkDerivation (attrs // {
|
|||
|
||||
unpackPhase = ''
|
||||
gem unpack $src --target=gem-build
|
||||
cd gem-build/*
|
||||
'';
|
||||
|
||||
dontBuild = true;
|
||||
|
||||
preCheckGit = ruby.stdenv.lib.optionalString doGitPrecheckHack ''
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
${git}/bin/git init
|
||||
${git}/bin/git add .
|
||||
if gem build *.gemspec; then
|
||||
export src=*.gem
|
||||
else
|
||||
echo >&2 "gemspec missing, not rebuilding gem"
|
||||
fi
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
preCheck = ''
|
||||
cd gem-build/*
|
||||
OLD_PATH="$GEM_PATH"
|
||||
export GEM_PATH="${depsPath}"
|
||||
'' + preCheck;
|
||||
|
||||
postCheck = ''
|
||||
GEM_PATH="$OLD_PATH"
|
||||
'' + postCheck;
|
||||
|
||||
checkPhase =
|
||||
if attrs ? checkPhase then attrs.checkPhase
|
||||
else ''
|
||||
runHook preCheckGit
|
||||
runHook preCheck
|
||||
test -f Rakefile && ${rake}/bin/rake ${testTask} -v
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
GEM_HOME=$out/${ruby.gemPath} \
|
||||
gem install -p http://nodtd.invalid \
|
||||
--build-root / -n "$out/bin" "$src" $gemFlags -- $buildFlags
|
||||
|
@ -85,7 +71,9 @@ in ruby.stdenv.mkDerivation (attrs // {
|
|||
mkdir -p $out/nix-support
|
||||
|
||||
cat > $out/nix-support/setup-hook <<EOF
|
||||
addToSearchPath GEM_PATH $out/${ruby.gemPath}
|
||||
if [[ "$GEM_PATH" != *$out/${ruby.gemPath}* ]]; then
|
||||
addToSearchPath GEM_PATH $out/${ruby.gemPath}
|
||||
fi
|
||||
EOF
|
||||
|
||||
runHook postInstall
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
let
|
||||
buildRubyGem = callPackage ./gem.nix {};
|
||||
patches = callPackage ./patches.nix { gems = self; };
|
||||
lib = ruby.stdenv.lib;
|
||||
self = rec {
|
||||
inherit buildRubyGem;
|
||||
|
@ -22,6 +21,7 @@ self = rec {
|
|||
# import an attrset full of gems, then override badly behaved ones
|
||||
importGems = file: args:
|
||||
let
|
||||
patches = callPackage ./patches.nix { gems = builtGems; };
|
||||
preBuilt = callPackage file ({ inherit buildRubyGem; self = builtGems; } // args);
|
||||
builtGems = self // (lib.mapAttrs (gem: deriv:
|
||||
if patches ? "${gem}"
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
{ fetchurl, writeScript, ruby, ncurses, sqlite, libxml2, libxslt, libffi
|
||||
, zlib, libuuid, gems, jdk, python, stdenv, libiconvOrEmpty, imagemagick
|
||||
, pkgconfig, libiconv }:
|
||||
, gnumake, pkgconfig, which, postgresql, v8_3_16_14, clang }:
|
||||
|
||||
let
|
||||
v8 = v8_3_16_14;
|
||||
|
||||
patchUsrBinEnv = writeScript "path-usr-bin-env" ''
|
||||
#!/bin/sh
|
||||
|
@ -14,111 +15,47 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
buildr = {
|
||||
# Many Buildfiles rely on RUBYLIB containing the current directory
|
||||
# (as was the default in Ruby < 1.9.2).
|
||||
extraWrapperFlags = "--prefix RUBYLIB : .";
|
||||
};
|
||||
|
||||
barber = { gemFlags = "--ignore-dependencies"; };
|
||||
barber = { gemFlags = "--ignore-dependencies"; dontBuild = 1; };
|
||||
ember_data_source = { gemFlags = "--ignore-dependencies"; };
|
||||
ember_rails = { gemFlags = "--ignore-dependencies"; };
|
||||
|
||||
fakes3 = {
|
||||
postInstall = ''
|
||||
cd $out/${ruby.gemPath}/gems/*
|
||||
patch -Np1 -i ${../../ruby-modules/fake-s3-list-bucket.patch}
|
||||
'';
|
||||
};
|
||||
rbtrace = { dontBuild = 1; };
|
||||
method_source = { dontBuild = 1; };
|
||||
|
||||
ffi = {
|
||||
postUnpack = "onetuh";
|
||||
buildFlags = ["--with-ffi-dir=${libffi}"];
|
||||
NIX_POST_EXTRACT_FILES_HOOK = patchUsrBinEnv;
|
||||
};
|
||||
|
||||
iconv = { buildInputs = [ libiconvOrEmpty ]; };
|
||||
|
||||
libv8 = {
|
||||
# This fix is needed to fool scons, which clears the environment by default.
|
||||
# It's ugly, but it works.
|
||||
#
|
||||
# We create a gcc wrapper wrapper, which reexposes the environment variables
|
||||
# that scons hides. Furthermore, they treat warnings as errors causing the
|
||||
# build to fail, due to an unused variable.
|
||||
#
|
||||
# Finally, we must set CC and AR explicitly to allow scons to find the
|
||||
# compiler and archiver
|
||||
|
||||
preBuild = ''
|
||||
cat > $TMPDIR/g++ <<EOF
|
||||
#! ${stdenv.shell}
|
||||
$(export)
|
||||
|
||||
g++ \$(echo \$@ | sed 's/-Werror//g')
|
||||
EOF
|
||||
chmod +x $TMPDIR/g++
|
||||
|
||||
export CXX=$TMPDIR/g++
|
||||
export AR=$(type -p ar)
|
||||
'';
|
||||
buildInputs = [ python ];
|
||||
NIX_POST_EXTRACT_FILES_HOOK = writeScript "patch-scons" ''
|
||||
#!/bin/sh
|
||||
for i in `find "$1" -name scons`
|
||||
do
|
||||
sed -i -e "s@/usr/bin/env@$(type -p env)@g" $i
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
ncurses = { propagatedBuildInputs = [ ncurses ]; };
|
||||
|
||||
ncursesw = { propagatedBuildInputs = [ ncurses ]; };
|
||||
|
||||
nix = {
|
||||
postInstall = ''
|
||||
cd $out/${ruby.gemPath}/gems/nix*
|
||||
patch -Np1 -i ${./fix-gem-nix-versions.patch}
|
||||
'';
|
||||
};
|
||||
pg = { buildInputs = [ postgresql ]; };
|
||||
|
||||
nokogiri = {
|
||||
buildInputs = [ libxml2 ];
|
||||
buildFlags =
|
||||
[ "--with-xml2-dir=${libxml2} --with-xml2-include=${libxml2}/include/libxml2"
|
||||
"--with-xslt-dir=${libxslt} --with-iconv-dir=${libiconv} --use-system-libraries"
|
||||
"--with-xslt-dir=${libxslt}" "--use-system-libraries"
|
||||
];
|
||||
};
|
||||
|
||||
pry = { gemFlags = "--no-ri --no-rdoc"; };
|
||||
therubyracer = {
|
||||
preBuild = ''
|
||||
addToSearchPath RUBYLIB "${gems.libv8}/${ruby.gemPath}/gems/libv8-3.16.14.3/lib"
|
||||
addToSearchPath RUBYLIB "${gems.libv8}/${ruby.gemPath}/gems/libv8-3.16.14.3/ext"
|
||||
ln -s ${clang}/bin/clang $TMPDIR/gcc
|
||||
ln -s ${clang}/bin/clang++ $TMPDIR/g++
|
||||
export PATH=$TMPDIR:$PATH
|
||||
'';
|
||||
|
||||
rails = { gemFlags = "--no-ri --no-rdoc"; };
|
||||
postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
cat >> $out/nix-support/setup-hook <<EOF
|
||||
addToSearchPath DYLD_INSERT_LIBRARIES "${v8}/lib/libv8.dylib"
|
||||
EOF
|
||||
'';
|
||||
|
||||
rjb = {
|
||||
buildInputs = [ jdk ];
|
||||
JAVA_HOME = jdk;
|
||||
buildFlags = [
|
||||
"--with-v8-dir=${v8}" "--with-v8-include=${v8}/include"
|
||||
"--with-v8-lib=${v8}/lib"
|
||||
];
|
||||
};
|
||||
|
||||
rmagick = {
|
||||
buildInputs = [ imagemagick pkgconfig ];
|
||||
|
||||
NIX_CFLAGS_COMPILE = "-I${imagemagick}/include/ImageMagick-6";
|
||||
};
|
||||
|
||||
sqlite3 = { propagatedBuildInputs = [ sqlite ]; };
|
||||
|
||||
xapian_full = {
|
||||
buildInputs = [ gems.rake zlib libuuid ];
|
||||
gemFlags = "--no-rdoc --no-ri";
|
||||
};
|
||||
|
||||
xapian_full_alaveteli = {
|
||||
buildInputs = [ zlib libuuid ];
|
||||
};
|
||||
|
||||
xapian_ruby = {
|
||||
buildInputs = [ zlib libuuid ];
|
||||
libv8 = {
|
||||
dontBuild = true;
|
||||
buildFlags = [ "--with-system-v8" ];
|
||||
};
|
||||
|
||||
xrefresh_server =
|
||||
|
|
69
pkgs/development/libraries/v8/3.16.14.nix
Normal file
69
pkgs/development/libraries/v8/3.16.14.nix
Normal file
|
@ -0,0 +1,69 @@
|
|||
{ stdenv, fetchurl, gyp, readline, python, which, icu }:
|
||||
|
||||
assert readline != null;
|
||||
|
||||
let
|
||||
arch = if stdenv.is64bit then "x64" else "ia32";
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "v8-${version}";
|
||||
version = "3.16.14";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://commondatastorage.googleapis.com/chromium-browser-official/"
|
||||
+ "${name}.tar.bz2";
|
||||
sha256 = "073f33zcb7205jp9g5ha5d7j2hfa98zs0jql572nb552z0xw3rkz";
|
||||
};
|
||||
|
||||
configurePhase = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
ln -s /usr/bin/xcodebuild $TMPDIR
|
||||
export PATH=$TMPDIR:$PATH
|
||||
'' + ''
|
||||
PYTHONPATH="tools/generate_shim_headers:$PYTHONPATH" \
|
||||
${gyp}/bin/gyp \
|
||||
-f make \
|
||||
--generator-output="out" \
|
||||
-Dflock_index=0 \
|
||||
-Dv8_enable_i18n_support=1 \
|
||||
-Duse_system_icu=1 \
|
||||
-Dconsole=readline \
|
||||
-Dcomponent=shared_library \
|
||||
-Dv8_target_arch=${arch} \
|
||||
--depth=. -Ibuild/standalone.gypi \
|
||||
build/all.gyp
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ which ];
|
||||
buildInputs = [ readline python icu ];
|
||||
|
||||
buildFlags = [
|
||||
"LINK=g++"
|
||||
"-C out"
|
||||
"builddir=$(CURDIR)/Release"
|
||||
"BUILDTYPE=Release"
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
installPhase = ''
|
||||
install -vD out/Release/d8 "$out/bin/d8"
|
||||
${if stdenv.system == "x86_64-darwin" then ''
|
||||
install -vD out/Release/libv8.dylib "$out/lib/libv8.dylib"
|
||||
'' else ''
|
||||
install -vD out/Release/libv8.so "$out/lib/libv8.so"
|
||||
''}
|
||||
cp -vr include "$out/"
|
||||
'';
|
||||
|
||||
postFixup = if stdenv.isDarwin then ''
|
||||
install_name_tool -change /usr/local/lib/libv8.dylib $out/lib/libv8.dylib -change /usr/lib/libgcc_s.1.dylib ${stdenv.gcc.gcc}/lib/libgcc_s.1.dylib $out/bin/d8
|
||||
install_name_tool -id $out/lib/libv8.dylib -change /usr/lib/libgcc_s.1.dylib ${stdenv.gcc.gcc}/lib/libgcc_s.1.dylib $out/lib/libv8.dylib
|
||||
'' else null;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "V8 is Google's open source JavaScript engine";
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
license = licenses.bsd3;
|
||||
};
|
||||
}
|
|
@ -6790,6 +6790,10 @@ let
|
|||
|
||||
ucommon = callPackage ../development/libraries/ucommon { };
|
||||
|
||||
v8_3_16_14 = callPackage ../development/libraries/v8/3.16.14.nix {
|
||||
inherit (pythonPackages) gyp;
|
||||
};
|
||||
|
||||
v8 = callPackage ../development/libraries/v8 {
|
||||
inherit (pythonPackages) gyp;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue