Unverified Commit f976571e authored by mrtnvgr's avatar mrtnvgr
Browse files

surge-XT: add build options

parent eafc20d2
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 31bee8d5..834ee6f6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -12,6 +12,8 @@ if (NOT SURGE_COMPILE_BLOCK_SIZE)
   set(SURGE_COMPILE_BLOCK_SIZE 32)
 endif()
 
+option(SURGE_BUILD_CLAP "Build Surge as a CLAP" ON)
+
 set(SURGE_JUCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../libs/JUCE" CACHE STRING "Path to JUCE library source tree")
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@@ -29,7 +31,6 @@ if(${CMAKE_VERSION} VERSION_LESS 3.21)
   set(SURGE_BUILD_CLAP FALSE)
 else()
   message(STATUS "CMake version ${CMAKE_VERSION} allows CLAP build")
-  set(SURGE_BUILD_CLAP TRUE)
 endif()
 
 if(SURGE_BUILD_CLAP)
+17 −3
Original line number Diff line number Diff line
@@ -13,6 +13,11 @@
  libXext,
  libXinerama,
  libXrandr,

  buildVST3 ? true,
  buildLV2 ? true,
  buildCLAP ? true,
  buildStandalone ? true,
}:

stdenv.mkDerivation (finalAttrs: {
@@ -27,6 +32,12 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-4b0H3ZioiXFc4KCeQReobwQZJBl6Ep2/8JlRIwvq/hQ=";
  };

  patches = [
    # NOTE: merged in upstream, remove on package update
    #     (https://github.com/surge-synthesizer/surge/pull/8202)
    ./clap-option.diff
  ];

  postPatch = ''
    # see https://github.com/NixOS/nixpkgs/pull/149487#issuecomment-991747333
    export XDG_DOCUMENTS_DIR=$(mktemp -d)
@@ -47,18 +58,21 @@ stdenv.mkDerivation (finalAttrs: {
    alsa-lib
    freetype
    libjack2
    lv2
    libX11
    libXcursor
    libXext
    libXinerama
    libXrandr
  ];
  ]
  ++ lib.optionals buildLV2 [ lv2 ];

  enableParallelBuilding = true;

  cmakeFlags = [
    "-DSURGE_BUILD_LV2=TRUE"
    (lib.cmakeBool "SURGE_SKIP_STANDALONE" (!buildStandalone))
    (lib.cmakeBool "SURGE_SKIP_VST3" (!buildVST3))
    (lib.cmakeBool "SURGE_SKIP_LV2" buildLV2)
    (lib.cmakeBool "SURGE_BUILD_CLAP" buildCLAP)
  ];

  # JUCE dlopen's these at runtime, crashes without them