From 03470789498a3a6b5ea4e525d06191815a0978f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9-Patrick=20Bubel?= Date: Sat, 19 Oct 2019 05:57:50 +0200 Subject: [PATCH] vcv-rack: Fix issues from missing upstream dependency The revision of the glfw fork that Rack depends on has been removed from GitHub. This causes cloning of the glfw submodule for the Rack git repository to fail. As the glfw fork just adds a function that is only needed on Darwin (and we don't support that platform at the moment) we remove the function call from the Rack source. We can then use the upstream version of glfw. We fetch the rest of the submodules manually as well. See https://github.com/NixOS/nixpkgs/issues/71189 for the context. --- pkgs/applications/audio/vcv-rack/default.nix | 54 ++++++++++++++----- pkgs/applications/audio/vcv-rack/glfw.patch | 13 ----- .../remove-custom-glfw-function.patch | 16 ++++++ 3 files changed, 57 insertions(+), 26 deletions(-) delete mode 100644 pkgs/applications/audio/vcv-rack/glfw.patch create mode 100644 pkgs/applications/audio/vcv-rack/remove-custom-glfw-function.patch diff --git a/pkgs/applications/audio/vcv-rack/default.nix b/pkgs/applications/audio/vcv-rack/default.nix index 4322bbcbc438..1beb68a3af30 100644 --- a/pkgs/applications/audio/vcv-rack/default.nix +++ b/pkgs/applications/audio/vcv-rack/default.nix @@ -7,16 +7,11 @@ let name = "glfw-git-${version}"; version = "2019-06-30"; src = fetchFromGitHub { - owner = "AndrewBelt"; + owner = "glfw"; repo = "glfw"; - rev = "d9ab59efc781c392128a449361a381fcc93cf6f3"; - sha256 = "1ykkq6qq8y6j5hlfj2zp1p87kr33vwhywziprz20v5avx1q7rjm8"; + rev = "d25248343e248337284dfbe5ecd1eddbd37ae66d"; + sha256 = "0gbz353bfmqbpm0af2nqf5draz3k4f3lqwiqj68s8nwn7878aqm3"; }; - # We patch the source to export a function that was added to the glfw fork - # for Rack so it is present when we build glfw as a shared library. - # See https://github.com/AndrewBelt/glfw/pull/1 for discussion of this issue - # with upstream. - patches = [ ./glfw.patch ]; buildInputs = oldAttrs.buildInputs ++ [ libXext libXi ]; }); pfft-source = fetchFromBitbucket { @@ -25,6 +20,30 @@ let rev = "29e4f76ac53bef048938754f32231d7836401f79"; sha256 = "084csgqa6f1a270bhybjayrh3mpyi2jimc87qkdgsqcp8ycsx1l1"; }; + nanovg-source = fetchFromGitHub { + owner = "memononen"; + repo = "nanovg"; + rev = "1f9c8864fc556a1be4d4bf1d6bfe20cde25734b4"; + sha256 = "08r15zrr6p1kxigxzxrg5rgya7wwbdx7d078r362qbkmws83wk27"; + }; + nanosvg-source = fetchFromGitHub { + owner = "memononen"; + repo = "nanosvg"; + rev = "25241c5a8f8451d41ab1b02ab2d865b01600d949"; + sha256 = "114qgfmazsdl53rm4pgqif3gv8msdmfwi91lyc2jfadgzfd83xkg"; + }; + osdialog-source = fetchFromGitHub { + owner = "AndrewBelt"; + repo = "osdialog"; + rev = "e5db5de6444f4b2c4e1390c67b3efd718080c3da"; + sha256 = "0iqxn1md053nl19hbjk8rqsdcmjwa5l5z0ci4fara77q43rc323i"; + }; + oui-blendish-source = fetchFromGitHub { + owner = "AndrewBelt"; + repo = "oui-blendish"; + rev = "79ec59e6bc7201017fc13a20c6e33380adca1660"; + sha256 = "17kd0lh2x3x12bxkyhq6z8sg6vxln8m9qirf0basvcsmylr6rb64"; + }; in with stdenv.lib; stdenv.mkDerivation rec { pname = "VCV-Rack"; @@ -34,17 +53,26 @@ with stdenv.lib; stdenv.mkDerivation rec { owner = "VCVRack"; repo = "Rack"; rev = "v${version}"; - sha256 = "172v66v2vb6l9dpsq6fb6xn035igwhpjci8w3kz2na3rvmz1bc5w"; - fetchSubmodules = true; + sha256 = "1g3mkghgiycbxyvzjhanc1b10jynkfkw03bpnha06qgd6gd9wv7k"; }; - patches = [ ./rack-minimize-vendoring.patch ]; + patches = [ + ./rack-minimize-vendoring.patch + # We patch out a call to a custom function, that is not needed on Linux. + # This avoids needing a patched version of glfw. The version we previously used disappeared + # on GitHub. See https://github.com/NixOS/nixpkgs/issues/71189 + ./remove-custom-glfw-function.patch + ]; prePatch = '' - cp -r ${pfft-source} dep/jpommier-pffft-source - mkdir -p dep/include + cp -r ${pfft-source} dep/jpommier-pffft-source + cp -r ${nanovg-source}/* dep/nanovg + cp -r ${nanosvg-source}/* dep/nanosvg + cp -r ${osdialog-source}/* dep/osdialog + cp -r ${oui-blendish-source}/* dep/oui-blendish + cp dep/jpommier-pffft-source/*.h dep/include cp dep/nanosvg/**/*.h dep/include cp dep/nanovg/src/*.h dep/include diff --git a/pkgs/applications/audio/vcv-rack/glfw.patch b/pkgs/applications/audio/vcv-rack/glfw.patch deleted file mode 100644 index 77875415160c..000000000000 --- a/pkgs/applications/audio/vcv-rack/glfw.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/init.c b/src/init.c -index af4a579e..317e25b8 100644 ---- a/src/init.c -+++ b/src/init.c -@@ -339,7 +339,7 @@ GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun) - - char glfwOpenedFilename[1024]; - --const char *glfwGetOpenedFilename() -+GLFWAPI const char *glfwGetOpenedFilename() - { - if (glfwOpenedFilename[0]) - { diff --git a/pkgs/applications/audio/vcv-rack/remove-custom-glfw-function.patch b/pkgs/applications/audio/vcv-rack/remove-custom-glfw-function.patch new file mode 100644 index 000000000000..ceb273b81af0 --- /dev/null +++ b/pkgs/applications/audio/vcv-rack/remove-custom-glfw-function.patch @@ -0,0 +1,16 @@ +diff --git a/src/main.cpp b/src/main.cpp +index 0954ae6..a8299f7 100644 +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -162,11 +162,6 @@ int main(int argc, char* argv[]) { + INFO("Initializing app"); + appInit(); + +- const char* openedFilename = glfwGetOpenedFilename(); +- if (openedFilename) { +- patchPath = openedFilename; +- } +- + if (!settings::headless) { + APP->patch->init(patchPath); + }