Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkgs/applications/misc/blender/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ stdenv.mkDerivation rec {
cmakeFlags =
[
"-DWITH_ALEMBIC=ON"
# Blender supplies its own FindAlembic.cmake (incompatible with the Alembic-supplied config file)
"-DALEMBIC_INCLUDE_DIR=${lib.getDev alembic}/include"
"-DALEMBIC_LIBRARY=${lib.getLib alembic}/lib/libAlembic.so"
"-DWITH_MOD_OCEANSIM=ON"
"-DWITH_CODEC_FFMPEG=ON"
"-DWITH_CODEC_SNDFILE=ON"
Expand Down
56 changes: 40 additions & 16 deletions pkgs/development/libraries/alembic/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, unzip, cmake, openexr, hdf5-threadsafe }:
{ lib, stdenv, fetchFromGitHub, cmake, openexr, hdf5-threadsafe, ilmbase }:

stdenv.mkDerivation rec
{
Expand All @@ -12,33 +12,57 @@ stdenv.mkDerivation rec
sha256 = "sha256-8dQhOQN0t2Y2kC2wOpQUqbu6Woy4DUmiLqXjf1D+mxE=";
};

# note: out is unused (but required for outputDoc anyway)
outputs = [ "bin" "dev" "out" "lib" ];

nativeBuildInputs = [ unzip cmake ];
buildInputs = [ openexr hdf5-threadsafe ];
# Prevent cycle between bin and dev (only occurs on Darwin for some reason)
propagatedBuildOutputs = [ "lib" ];

buildPhase = ''
cmake -DUSE_HDF5=ON -DCMAKE_INSTALL_PREFIX=$out/ -DUSE_TESTS=OFF .
nativeBuildInputs = [ cmake ];

mkdir $out
mkdir -p $bin/bin
mkdir -p $dev/include
mkdir -p $lib/lib
'';
# NOTE: Alembic also support imath instead of ilmbase, but some users of Alembic (e.g. Blender)
# are incompatible with the imath version of Alembic
buildInputs = [ openexr hdf5-threadsafe ilmbase ];

# Downstream packages trying to use Alembic via CMake need ilmbase as well
# For some reason this won't be picked up correctly otherwise
propagatedBuildInputs = [ ilmbase ];

# These flags along with the postPatch step ensure that all artifacts end up
# in the correct output without needing to move anything
#
# - bin: Uses CMAKE_INSTALL_BINDIR (set via CMake setup hooK)
# - lib (contains shared libraries): Uses ALEMBIC_LIB_INSTALL_DIR
# - dev (headers): Uses CMAKE_INSTALL_PREFIX
# (this works because every other install rule uses an absolute DESTINATION)
# - dev (CMake files): Uses ConfigPackageLocation

installPhase = ''
make install
cmakeFlags = [
"-DUSE_HDF5=ON"
"-DUSE_TESTS=ON"
"-DALEMBIC_LIB_INSTALL_DIR=${placeholder "lib"}/lib"
"-DConfigPackageLocation=${placeholder "dev"}/lib/cmake/Alembic"
"-DCMAKE_INSTALL_PREFIX=${placeholder "dev"}"
"-DQUIET=ON"
];

postPatch = ''
find bin/ -type f -name CMakeLists.txt -print -exec \
sed -i 's/INSTALL(TARGETS \([a-zA-Z ]*\) DESTINATION bin)/INSTALL(TARGETS \1)/' {} \;
'';

mv $out/bin $bin/
mv $out/lib $lib/
mv $out/include $dev/
doCheck = true;
checkPhase = ''
runHook preCheck
ctest -j 1
runHook postCheck
'';

meta = with lib; {
description = "An open framework for storing and sharing scene data";
homepage = "http://alembic.io/";
license = licenses.bsd3;
platforms = platforms.all;
maintainers = [ maintainers.guibou ];
maintainers = with maintainers; [ guibou tmarkus ];
};
}