Unverified Commit 24a5d438 authored by Doron Behar's avatar Doron Behar Committed by GitHub
Browse files

surge-XT: fix build; add build options, mrtnvgr to maintainers; no with lib; in meta (#455919)

parents 02eb14f0 67e64ebc
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)
+42 −18
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  stdenv,
  lib,
  fetchFromGitHub,
  gitUpdater,
  cmake,
  pkg-config,
  alsa-lib,
@@ -13,20 +14,42 @@
  libXext,
  libXinerama,
  libXrandr,

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

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "surge-XT";
  version = "1.3.4";

  src = fetchFromGitHub {
    owner = "surge-synthesizer";
    repo = "surge";
    tag = "release_xt_${version}";
    tag = "${finalAttrs.finalPackage.passthru.rev-prefix}${finalAttrs.version}";
    fetchSubmodules = true;
    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)

    # Required for CMake 4
    # NOTE: libsamplerate is no longer used in Surge-XT, remove on package update
    substituteInPlace libs/libsamplerate/CMakeLists.txt --replace-fail \
      'cmake_minimum_required(VERSION 3.1..3.18)' \
      'cmake_minimum_required(VERSION 4.0)'
  '';

  nativeBuildInputs = [
    cmake
    pkg-config
@@ -36,23 +59,21 @@ stdenv.mkDerivation rec {
    alsa-lib
    freetype
    libjack2
    lv2
    libX11
    libXcursor
    libXext
    libXinerama
    libXrandr
  ];
  ]
  ++ lib.optionals buildLV2 [ lv2 ];

  enableParallelBuilding = true;

  cmakeFlags = [
    "-DSURGE_BUILD_LV2=TRUE"
  ];

  CXXFLAGS = [
    # GCC 13: error: 'uint32_t' has not been declared
    "-include cstdint"
    (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
@@ -66,19 +87,22 @@ stdenv.mkDerivation rec {
    ]
  );

  # see https://github.com/NixOS/nixpkgs/pull/149487#issuecomment-991747333
  postPatch = ''
    export XDG_DOCUMENTS_DIR=$(mktemp -d)
  '';
  passthru = {
    rev-prefix = "release_xt_";
    updateScript = gitUpdater {
      inherit (finalAttrs.finalPackage.passthru) rev-prefix;
    };
  };

  meta = with lib; {
  meta = {
    description = "LV2 & VST3 synthesizer plug-in (previously released as Vember Audio Surge)";
    homepage = "https://surge-synthesizer.github.io";
    license = licenses.gpl3;
    license = lib.licenses.gpl3;
    platforms = [ "x86_64-linux" ];
    maintainers = with maintainers; [
    maintainers = with lib.maintainers; [
      magnetophon
      orivej
      mrtnvgr
    ];
  };
}
})