Merge pull request #26410 from kierdavis/hooks

Fix hooks not being called when overriding phases in various packages
This commit is contained in:
Jörg Thalheim 2017-06-05 22:23:01 +01:00 committed by GitHub
commit dffec16abd
4 changed files with 30 additions and 0 deletions

View File

@ -51,20 +51,30 @@ in
]; ];
unpackPhase = '' unpackPhase = ''
runHook preUnpack
cp $src extractor.run cp $src extractor.run
chmod +x extractor.run chmod +x extractor.run
./extractor.run --target $sourceRoot ./extractor.run --target $sourceRoot
runHook postUnpack
''; '';
patchPhase = '' patchPhase = ''
runHook prePatch
# Patch ELF files. # Patch ELF files.
elfs=$(find bin -type f | xargs file | grep ELF | cut -d ':' -f 1) elfs=$(find bin -type f | xargs file | grep ELF | cut -d ':' -f 1)
for elf in $elfs; do for elf in $elfs; do
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 $elf || true patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 $elf || true
done done
runHook postPatch
''; '';
installPhase = '' installPhase = ''
runHook preInstall
instdir=$out/${instPath} instdir=$out/${instPath}
# Install executables and libraries # Install executables and libraries
@ -86,6 +96,8 @@ in
wrapProgram $out/bin/valley \ wrapProgram $out/bin/valley \
--run "cd $instdir" \ --run "cd $instdir" \
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$instdir/bin:$libPath --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$instdir/bin:$libPath
runHook postInstall
''; '';
stripDebugList = ["${instPath}/bin"]; stripDebugList = ["${instPath}/bin"];

View File

@ -28,6 +28,8 @@ stdenv.mkDerivation rec {
''; '';
patchPhase = '' patchPhase = ''
runHook prePatch
# Remove libOpenCL.so, since we use ocl-icd's libOpenCL.so instead and this would cause a clash. # Remove libOpenCL.so, since we use ocl-icd's libOpenCL.so instead and this would cause a clash.
rm opt/intel/opencl/libOpenCL.so* rm opt/intel/opencl/libOpenCL.so*
@ -35,18 +37,28 @@ stdenv.mkDerivation rec {
for lib in opt/intel/opencl/*.so; do for lib in opt/intel/opencl/*.so; do
patchelf --set-rpath "${libPath}:$out/lib/intel-ocl" $lib || true patchelf --set-rpath "${libPath}:$out/lib/intel-ocl" $lib || true
done done
runHook postPatch
''; '';
buildPhase = '' buildPhase = ''
runHook preBuild
# Create ICD file, which just contains the path of the corresponding shared library. # Create ICD file, which just contains the path of the corresponding shared library.
echo "$out/lib/intel-ocl/libintelocl.so" > intel.icd echo "$out/lib/intel-ocl/libintelocl.so" > intel.icd
runHook postBuild
''; '';
installPhase = '' installPhase = ''
runHook preInstall
install -D -m 0755 opt/intel/opencl/*.so* -t $out/lib/intel-ocl install -D -m 0755 opt/intel/opencl/*.so* -t $out/lib/intel-ocl
install -D -m 0644 opt/intel/opencl/*.{o,rtl,bin} -t $out/lib/intel-ocl install -D -m 0644 opt/intel/opencl/*.{o,rtl,bin} -t $out/lib/intel-ocl
install -D -m 0644 opt/intel/opencl/{LICENSE,NOTICES} -t $out/share/doc/intel-ocl install -D -m 0644 opt/intel/opencl/{LICENSE,NOTICES} -t $out/share/doc/intel-ocl
install -D -m 0644 intel.icd -t $out/etc/OpenCL/vendors install -D -m 0644 intel.icd -t $out/etc/OpenCL/vendors
runHook postInstall
''; '';
dontStrip = true; dontStrip = true;

View File

@ -29,8 +29,12 @@ stdenv.mkDerivation rec {
doCheck = false; doCheck = false;
installPhase = '' installPhase = ''
runHook preInstall
install -D --mode 0755 --target-directory $out/bin bin/ckb-daemon bin/ckb install -D --mode 0755 --target-directory $out/bin bin/ckb-daemon bin/ckb
install -D --mode 0755 --target-directory $out/libexec/ckb-animations bin/ckb-animations/* install -D --mode 0755 --target-directory $out/libexec/ckb-animations bin/ckb-animations/*
runHook postInstall
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -18,7 +18,9 @@ stdenv.mkDerivation rec {
# $out is not known until the build has started. # $out is not known until the build has started.
configurePhase = '' configurePhase = ''
runHook preConfigure
makeFlags="$makeFlags PREFIX=$out" makeFlags="$makeFlags PREFIX=$out"
runHook postConfigure
''; '';
postFixup = '' postFixup = ''