Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugdata: 0.8.0 -> 0.9.1 #372508

Merged
merged 1 commit into from
Jan 14, 2025
Merged
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
144 changes: 86 additions & 58 deletions pkgs/by-name/pl/plugdata/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
fetchFromGitHub,
ensureNewerSourcesForZipFilesHook,
makeDesktopItem,
imagemagick,
copyDesktopItems,
cmake,
pkg-config,
alsa-lib,
Expand All @@ -14,44 +14,48 @@
curl,
xorg,
python3,
libsysprof-capture,
pcre2,
util-linux,
libselinux,
libsepol,
libthai,
libxkbcommon,
libdatrie,
libepoxy,
libsoup_2_4,
libGL,
libjack2,
lerc,
sqlite,
expat,
makeWrapper,
nix-update-script,
}:

let
# data copied from build system: https://build.opensuse.org/package/view_file/home:plugdata/plugdata/PlugData.desktop
desktopItem = makeDesktopItem {
name = "PlugData";
desktopName = "PlugData";
exec = "plugdata";
icon = "plugdata_logo.png";
comment = "Pure Data as a plugin, with a new GUI";
type = "Application";
categories = [
"AudioVideo"
"Music"
];
};
version = "0.9.1";
in
stdenv.mkDerivation (finalAttrs: {
stdenv.mkDerivation {
pname = "plugdata";
version = "0.8.0";
inherit version;

src = fetchFromGitHub {
owner = "plugdata-team";
repo = "plugdata";
rev = "v${finalAttrs.version}";
hash = "sha256-qG9fH5C42jiHj03p/KM28jmDIkJkrQMe7fxg92Lg7B4=";
tag = "v${version}";
hash = "sha256-dcggq455lZiwl1lps11fuKX6sx0A8UtFwFoiBJWtwFQ=";
fetchSubmodules = true;
};

nativeBuildInputs = [
cmake
pkg-config
ensureNewerSourcesForZipFilesHook
imagemagick
copyDesktopItems
python3
makeWrapper
];

buildInputs = [
alsa-lib
curl
Expand All @@ -63,71 +67,95 @@ stdenv.mkDerivation (finalAttrs: {
xorg.libXinerama
xorg.libXrender
xorg.libXrandr
xorg.libXdmcp
xorg.libXtst
xorg.xvfb
libsysprof-capture
pcre2
util-linux
libGL
libselinux
libsepol
libthai
libxkbcommon
libdatrie
libepoxy
libsoup_2_4
lerc
libjack2
expat
sqlite
];

desktopItems = [
(makeDesktopItem {
name = "PlugData";
desktopName = "PlugData";
exec = "plugdata";
icon = "plugdata_logo";
comment = "Pure Data as a plugin, with a new GUI";
type = "Application";
categories = [
"AudioVideo"
"Music"
];
})
];
# Standard fix for JUCE programs: https://github.com/NixOS/nixpkgs/blob/5014727e62ae7b22fb1afc61d789ca6ad9170435/pkgs/applications/audio/bespokesynth/default.nix#L137
env.NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isLinux "-rpath ${
lib.makeLibraryPath ([
xorg.libX11
xorg.libXrandr
xorg.libXinerama
xorg.libXext
xorg.libXcursor
xorg.libXrender
])
}";
dontPatchELF = true; # needed or nix will try to optimize the binary by removing "useless" rpath

postPatch = ''
# Don't build LV2 plugin (it hangs), and don't automatically install
sed -i 's/ LV2 / /g' CMakeLists.txt
NIX_LDFLAGS = (
toString [
"-lX11"
"-lXext"
"-lXcomposite"
"-lXcursor"
"-lXinerama"
"-lXrandr"
"-lXtst"
"-lXdmcp"
]
);

preBuild = ''
# fix LV2 build
HOME=$(mktemp -d)
'';

installPhase = ''
runHook preInstall

cd .. # build artifacts are placed inside the source directory for some reason
mkdir -p $out/{bin,lib/{clap,vst3}}
mkdir -p $out/bin $out/lib/clap $out/lib/lv2 $out/lib/vst3
cp Plugins/Standalone/plugdata $out/bin
cp -r Plugins/CLAP/plugdata{,-fx}.clap $out/lib/clap
cp -r Plugins/VST3/plugdata{,-fx}.vst3 $out/lib/vst3
cp -r Plugins/LV2/plugdata{,-fx}.lv2 $out/lib/lv2

icon_name="plugdata_logo.png"
icon_path="Resources/Icons/$icon_name"

install -m644 -D "${desktopItem}"/share/applications/* -t $out/share/applications
for size in 16 24 32 48 64 128 256 512; do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
convert -resize "$size"x"$size" "$icon_path" $out/share/icons/hicolor/"$size"x"$size"/apps/"$icon_name"
done
install -Dm444 $src/Resources/Icons/plugdata_logo_linux.png $out/share/pixmaps/plugdata_logo.png

runHook postInstall
'';

postInstall = ''
# Ensure zenity is available, or it won't be able to open new files.
# These X11 libs get dlopen'd, they cause visual bugs when unavailable.
wrapProgram $out/bin/plugdata \
--prefix PATH : '${
lib.makeBinPath [
zenity
]
}' \
--prefix LD_LIBRARY_PATH : '${
lib.makeLibraryPath [
xorg.libXrandr
xorg.libXinerama
xorg.libXcursor
xorg.libXrender
]
}'
'';

meta = with lib; {
passthru.updateScript = nix-update-script { };

meta = {
description = "Plugin wrapper around Pure Data to allow patching in a wide selection of DAWs";
mainProgram = "plugdata";
homepage = "https://plugdata.org/";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = with maintainers; [ PowerUser64 ];
license = lib.licenses.gpl3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upstream does not specify GPL3-only vs. GPL3-plus. Seems okay to leave as is for now.

platforms = lib.platforms.linux;
maintainers = [
lib.maintainers.PowerUser64
lib.maintainers.l1npengtul
];
};
})
}