|
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + fetchFromGitHub, |
| 5 | + puredata, |
| 6 | + pkg-config, |
| 7 | + cmake, |
| 8 | + openssl, |
| 9 | + libogg, |
| 10 | + libvorbis, |
| 11 | + opusfile, |
| 12 | + ffmpeg, |
| 13 | + zlib, |
| 14 | +}: |
| 15 | + |
| 16 | +stdenv.mkDerivation rec { |
| 17 | + pname = "pd-else"; |
| 18 | + version = "1.0-rc13"; |
| 19 | + |
| 20 | + src = fetchFromGitHub { |
| 21 | + owner = "porres"; |
| 22 | + repo = "pd-else"; |
| 23 | + tag = "v.${version}"; |
| 24 | + hash = "sha256-WebjdozcFup2xk3cS9LPTiA6m0l1sR6sj3hHlt6ScfU="; |
| 25 | + }; |
| 26 | + |
| 27 | + nativeBuildInputs = [ |
| 28 | + pkg-config |
| 29 | + cmake |
| 30 | + ]; |
| 31 | + |
| 32 | + buildInputs = [ |
| 33 | + puredata |
| 34 | + openssl |
| 35 | + libogg |
| 36 | + libvorbis |
| 37 | + opusfile |
| 38 | + ffmpeg |
| 39 | + zlib |
| 40 | + ]; |
| 41 | + |
| 42 | + # Set up Pure Data headers and configure with system libraries |
| 43 | + preConfigure = '' |
| 44 | + substituteInPlace CMakeLists.txt \ |
| 45 | + --replace-fail 'add_subdirectory(Source/Shared/ffmpeg)' '# add_subdirectory(Source/Shared/ffmpeg) - using system FFmpeg' \ |
| 46 | + --replace-fail 'target_link_libraries(play.file_tilde PRIVATE ffmpeg)' 'target_link_libraries(play.file_tilde PRIVATE avformat avcodec avutil swresample z)' \ |
| 47 | + --replace-fail 'target_link_libraries(sfload PRIVATE ffmpeg)' 'target_link_libraries(sfload PRIVATE avformat avcodec avutil swresample z)' \ |
| 48 | + --replace-fail 'target_link_libraries(sfinfo PRIVATE ffmpeg)' 'target_link_libraries(sfinfo PRIVATE avformat avcodec avutil swresample z)' |
| 49 | + ''; |
| 50 | + |
| 51 | + cmakeFlags = [ |
| 52 | + "-DCMAKE_C_FLAGS=-I${puredata}/include/pd" |
| 53 | + "-DCMAKE_CXX_FLAGS=-I${puredata}/include/pd" |
| 54 | + "-DUSE_LTO=ON" |
| 55 | + "-DOPENSSL_CRYPTO_LIBRARY=${lib.getLib openssl}/lib/libcrypto.so" |
| 56 | + "-DOPENSSL_SSL_LIBRARY=${lib.getLib openssl}/lib/libssl.so" |
| 57 | + ]; |
| 58 | + |
| 59 | + postInstall = '' |
| 60 | + mv else/ $out/else/ |
| 61 | + rm -rf $out/include/ $out/lib/ |
| 62 | + ''; |
| 63 | + |
| 64 | + postFixup = '' |
| 65 | + interpreter=$(cat $NIX_CC/nix-support/dynamic-linker) |
| 66 | + find $out -type f -executable -exec patchelf --set-interpreter "$interpreter" --set-rpath ${lib.makeLibraryPath buildInputs} {} \; |
| 67 | + ''; |
| 68 | + |
| 69 | + meta = { |
| 70 | + description = "EL Locus Solus' Externals for Pure Data"; |
| 71 | + longDescription = '' |
| 72 | + ELSE is a library of externals and abstractions for Pure Data. |
| 73 | + It provides a comprehensive set of tools for signal processing, |
| 74 | + MIDI, GUI, and more in Pure Data. |
| 75 | + ''; |
| 76 | + homepage = "https://github.com/porres/pd-else"; |
| 77 | + license = lib.licenses.wtfpl; |
| 78 | + platforms = lib.platforms.unix; |
| 79 | + broken = stdenv.hostPlatform.isDarwin; |
| 80 | + maintainers = [ lib.maintainers.kugland ]; |
| 81 | + }; |
| 82 | +} |
0 commit comments