mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-29 18:33:00 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
46 lines
1.2 KiB
Nix
46 lines
1.2 KiB
Nix
{ lib, stdenv, fetchFromGitHub, unzip, cmake, alsa-lib, Carbon, CoreAudio, CoreFoundation, CoreMIDI, CoreServices }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "portmidi";
|
|
version = "2.0.4";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = pname;
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
sha256 = "sha256-uqBeh9vBP6+V+FN4lfeGxePQcpZMDYUuAo/d9a5rQxU=";
|
|
};
|
|
|
|
cmakeFlags = [
|
|
"-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=Release"
|
|
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=Release"
|
|
"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=Release"
|
|
];
|
|
|
|
patches = [
|
|
# Add missing header include
|
|
./missing-header.diff
|
|
];
|
|
|
|
postInstall = let ext = stdenv.hostPlatform.extensions.sharedLibrary; in ''
|
|
ln -s libportmidi${ext} "$out/lib/libporttime${ext}"
|
|
'';
|
|
|
|
nativeBuildInputs = [ unzip cmake ];
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
|
|
alsa-lib
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
Carbon CoreAudio CoreFoundation CoreMIDI CoreServices
|
|
];
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/PortMidi/portmidi";
|
|
description = "Platform independent library for MIDI I/O";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ emilytrau ];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|