linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / libraries / portmidi / default.nix
blobe9a868240bb3e8774585ed054985e93d5ad50920
1 { lib, stdenv, fetchurl, unzip, cmake, /*jdk,*/ alsaLib }:
3 stdenv.mkDerivation rec {
4   pname = "portmidi";
5   version = "217";
7   src = fetchurl {
8     url = "mirror://sourceforge/portmedia/portmidi-src-${version}.zip";
9     sha256 = "03rfsk7z6rdahq2ihy5k13qjzgx757f75yqka88v3gc0pn9ais88";
10   };
12   cmakeFlags = let
13     #base = "${jdk}/jre/lib/${jdk.architecture}";
14   in [
15     "-DPORTMIDI_ENABLE_JAVA=0"
16     /* TODO: Fix Java support.
17     "-DJAVA_AWT_LIBRARY=${base}/libawt.so"
18     "-DJAVA_JVM_LIBRARY=${base}/server/libjvm.so"
19     */
20     "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=Release"
21     "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=Release"
22     "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=Release"
23   ];
25   # XXX: This is to deactivate Java support.
26   patches = lib.singleton (fetchurl {
27     url = "https://raw.github.com/Rogentos/argent-gentoo/master/media-libs/"
28         + "portmidi/files/portmidi-217-cmake-libdir-java-opts.patch";
29     sha256 = "1jbjwan61iqq9fqfpq2a4fd30k3clg7a6j0gfgsw87r8c76kqf6h";
30   });
32   postPatch = ''
33     sed -i -e 's|/usr/local/|'"$out"'|' -e 's|/usr/share/|'"$out"'/share/|' \
34       pm_common/CMakeLists.txt pm_dylib/CMakeLists.txt pm_java/CMakeLists.txt
35     sed -i \
36         -e 's|-classpath .|-classpath '"$(pwd)"'/pm_java|' \
37         -e 's|pmdefaults/|'"$(pwd)"'/pm_java/&|g' \
38         -e 's|jportmidi/|'"$(pwd)"'/pm_java/&|g' \
39         -e 's/WORKING_DIRECTORY pm_java//' \
40         pm_java/CMakeLists.txt
41   '';
43   postInstall = ''
44     ln -s libportmidi.so "$out/lib/libporttime.so"
45   '';
47   nativeBuildInputs = [ unzip cmake ];
48   buildInputs = [ alsaLib ];
50   hardeningDisable = [ "format" ];
52   meta = {
53     homepage = "http://portmedia.sourceforge.net/portmidi/";
54     description = "Platform independent library for MIDI I/O";
55     license = lib.licenses.mit;
56     platforms = lib.platforms.linux;
57   };