Commit 61dfeb6d authored by Bart Brouns's avatar Bart Brouns
Browse files

ardour: 8.12 -> 9.0

parent 06d15922
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
  libusb1,
  libuv,
  libwebsockets,
  libxi,
  libxml2,
  libxslt,
  lilv,
@@ -71,14 +72,14 @@ stdenv.mkDerivation (
  in
  {
    pname = "ardour";
    version = "8.12";
    version = "9.0";

    # We can't use `fetchFromGitea` here, as attempting to fetch release archives from git.ardour.org
    # result in an empty archive. See https://tracker.ardour.org/view.php?id=7328 for more info.
    src = fetchgit {
      url = "git://git.ardour.org/ardour/ardour.git";
      rev = finalAttrs.version;
      hash = "sha256-4IgBQ53cwPA35YwNQyo+qBqsMGv+TLn6w1zaDX97erE=";
      hash = "sha256-zgWNKYN45qa2xLWnL3W/UWfRVBJN3+hya9dpIZLLJvo=";
    };

    bundledContent = fetchzip {
@@ -146,6 +147,7 @@ stdenv.mkDerivation (
      libusb1
      libuv
      libwebsockets
      libxi
      libxml2
      libxslt
      lilv
@@ -190,6 +192,15 @@ stdenv.mkDerivation (
    ]
    ++ lib.optional optimize "--optimize";

    env.NIX_CFLAGS_COMPILE = toString [
      # 'ioprio_set' syscall support:
      "-D_GNU_SOURCE"
      # compiler doesn't find headers without these:
      "-I${lib.getDev serd}/include/serd-0"
      "-I${lib.getDev sratom}/include/sratom-0"
      "-I${lib.getDev sord}/include/sord-0"
    ];

    postInstall = ''
      # wscript does not install these for some reason
      install -vDm 644 "build/gtk2_ardour/ardour.xml" \
@@ -231,7 +242,7 @@ stdenv.mkDerivation (
      '';
      homepage = "https://ardour.org/";
      license = lib.licenses.gpl2Plus;
      mainProgram = "ardour8";
      mainProgram = "ardour9";
      platforms = lib.platforms.linux;
      maintainers = with lib.maintainers; [
        magnetophon
+12 −0
Original line number Diff line number Diff line
--- a/libs/ardour/wscript
+++ b/libs/ardour/wscript
@@ -379,8 +379,7 @@ def build(bld):

     # remove '${DEFINES_ST:DEFINES}' from run_str.
     # x86_64-w64-mingw32-as (mingw) -D flag is for debug messages
-    if bld.env['build_target'] == 'mingw':
-        class asm(Task.classes['asm']): run_str = '${AS} ${ASFLAGS} ${ASMPATH_ST:INCPATHS} ${AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}'
+    class asm(Task.classes['asm']): run_str = '${AS} ${ASFLAGS} ${ASMPATH_ST:INCPATHS} ${AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}'

     # operate on copy to avoid adding sources twice
     sources = list(libardour_sources)
+55 −0
Original line number Diff line number Diff line
From 1217722e4bf6c65b5c24da17a7de4bf712ca6775 Mon Sep 17 00:00:00 2001
From: Tamara Schmitz <tamara.zoe.schmitz@posteo.de>
Date: Sat, 17 Jun 2023 14:05:53 +0200
Subject: [PATCH] add NixOS plugin paths as default search paths

Since NixOS uses unusual paths, we should tell Ardour about this. During
first launch, Ardour does indeed check for environmentals but not when
you press the "Reset to Defaults" button in the Settings menu. This
path fixes this by including NixOS paths in the defaults.
---
 libs/ardour/plugin_manager.cc | 5 +++--
 libs/ardour/search_paths.cc   | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc
index a572ed55dd..3dd6c2fda6 100644
--- a/libs/ardour/plugin_manager.cc
+++ b/libs/ardour/plugin_manager.cc
@@ -305,7 +305,8 @@ PluginManager::PluginManager ()
 	if (lxvst_path.length() == 0) {
 		lxvst_path = "/usr/local/lib64/lxvst:/usr/local/lib/lxvst:/usr/lib64/lxvst:/usr/lib/lxvst:"
 			"/usr/local/lib64/linux_vst:/usr/local/lib/linux_vst:/usr/lib64/linux_vst:/usr/lib/linux_vst:"
-			"/usr/lib/vst:/usr/local/lib/vst";
+			"/usr/lib/vst:/usr/local/lib/vst:$HOME/.nix-profile/lib/vst:"
+			"$HOME/.lxvst:$HOME/.nix-profile/lib/lxvst:/run/current-system/sw/lib/lxvst:/etc/profiles/per-user/$USER/lib/lxvst";
 	}
 
 	/* first time setup, use 'default' path */
@@ -2040,7 +2041,7 @@ PluginManager::vst3_refresh (bool cache_only)
 	std::string prog = PBD::get_win_special_folder_path (CSIDL_PROGRAM_FILES);
 	vst3_discover_from_path (Glib::build_filename (prog, "Common Files", "VST3"), cache_only);
 #else
-	vst3_discover_from_path ("~/.vst3:/usr/local/lib/vst3:/usr/lib/vst3", cache_only);
+	vst3_discover_from_path ("~/.vst3:/usr/local/lib/vst3:/usr/lib/vst3:~/.nix-profile/lib/vst3:/run/current-system/sw/lib/vst3:/etc/profiles/per-user/$USER/lib/vst3", cache_only);
 #endif
 }
 
diff --git a/libs/ardour/search_paths.cc b/libs/ardour/search_paths.cc
index e6d8744369..b9774cb006 100644
--- a/libs/ardour/search_paths.cc
+++ b/libs/ardour/search_paths.cc
@@ -112,6 +112,10 @@ ladspa_search_path ()
 	spath.push_back ("/usr/local/lib/ladspa");
 	spath.push_back ("/usr/lib64/ladspa");
 	spath.push_back ("/usr/lib/ladspa");
+	spath.push_back ("/run/current-system/sw/lib/ladspa");
+	spath.push_back (path_expand ("$HOME/.ladspa"));
+	spath.push_back (path_expand ("$HOME/.nix-profile/lib/ladspa"));
+	spath.push_back (path_expand ("/etc/profiles/per-user/$USER/lib/ladspa"));
 #endif
 
 #ifdef __APPLE__
-- 
2.40.1
+243 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchgit,
  fetchzip,
  alsa-lib,
  aubio,
  boost,
  cairomm,
  cppunit,
  curl,
  dbus,
  doxygen,
  ffmpeg,
  fftw,
  fftwSinglePrec,
  flac,
  fluidsynth,
  glibc,
  glibmm,
  graphviz,
  harvid,
  hidapi,
  itstool,
  kissfft,
  libarchive,
  libjack2,
  liblo,
  libltc,
  libogg,
  libpulseaudio,
  librdf_rasqal,
  libsamplerate,
  libsigcxx,
  libsndfile,
  libusb1,
  libuv,
  libwebsockets,
  libxml2,
  libxslt,
  lilv,
  lrdf,
  lv2,
  makeWrapper,
  pango,
  pangomm,
  perl,
  pkg-config,
  python3,
  qm-dsp,
  readline,
  rubberband,
  serd,
  sord,
  soundtouch,
  sratom,
  suil,
  taglib,
  vamp-plugin-sdk,
  wafHook,
  xjadeo,
  libxrandr,
  libxinerama,
  optimize ? true, # disable to print Lua DSP script output to stdout
  videoSupport ? true,
}:
stdenv.mkDerivation (
  finalAttrs:
  let
    majorVersion = lib.versions.major finalAttrs.version;
  in
  {
    pname = "ardour";
    version = "8.12";

    # We can't use `fetchFromGitea` here, as attempting to fetch release archives from git.ardour.org
    # result in an empty archive. See https://tracker.ardour.org/view.php?id=7328 for more info.
    src = fetchgit {
      url = "git://git.ardour.org/ardour/ardour.git";
      rev = finalAttrs.version;
      hash = "sha256-4IgBQ53cwPA35YwNQyo+qBqsMGv+TLn6w1zaDX97erE=";
    };

    bundledContent = fetchzip {
      url = "https://web.archive.org/web/20221026200824/http://stuff.ardour.org/loops/ArdourBundledMedia.zip";
      hash = "sha256-IbPQWFeyMuvCoghFl1ZwZNNcSvLNsH84rGArXnw+t7A=";
      # archive does not contain a single folder at the root
      stripRoot = false;
    };

    patches = [
      # AS=as in the environment causes build failure https://tracker.ardour.org/view.php?id=8096
      ./as-flags.patch
      ./default-plugin-search-paths.patch
    ];

    # Ardour's wscript requires git revision and date to be available.
    # Since they are not, let's generate the file manually.
    postPatch = ''
      printf '#include "libs/ardour/ardour/revision.h"\nnamespace ARDOUR { const char* revision = "${finalAttrs.version}"; const char* date = ""; }\n' > libs/ardour/revision.cc
      sed 's|/usr/include/libintl.h|${glibc.dev}/include/libintl.h|' -i wscript
      patchShebangs ./tools/
      substituteInPlace libs/ardour/video_tools_paths.cc \
        --replace-fail 'ffmpeg_exe = X_("");' 'ffmpeg_exe = X_("${ffmpeg}/bin/ffmpeg");' \
        --replace-fail 'ffprobe_exe = X_("");' 'ffprobe_exe = X_("${ffmpeg}/bin/ffprobe");'
    '';

    nativeBuildInputs = [
      doxygen
      graphviz # for dot
      itstool
      makeWrapper
      perl
      pkg-config
      python3
      wafHook
    ];

    buildInputs = [
      alsa-lib
      aubio
      boost
      cairomm
      cppunit
      curl
      dbus
      ffmpeg
      fftw
      fftwSinglePrec
      flac
      fluidsynth
      glibmm
      hidapi
      itstool
      kissfft
      libarchive
      libjack2
      liblo
      libltc
      libogg
      libpulseaudio
      librdf_rasqal
      libsamplerate
      libsigcxx
      libsndfile
      libusb1
      libuv
      libwebsockets
      libxml2
      libxslt
      lilv
      lrdf
      lv2
      pango
      pangomm
      perl
      python3
      qm-dsp
      readline
      rubberband
      serd
      sord
      soundtouch
      sratom
      suil
      taglib
      vamp-plugin-sdk
      libxinerama
      libxrandr
    ]
    ++ lib.optionals videoSupport [
      harvid
      xjadeo
    ];

    wafConfigureFlags = [
      "--cxx17"
      "--docs"
      "--freedesktop"
      "--no-phone-home"
      "--ptformat"
      "--run-tests"
      "--test"
      # since we don't have https://github.com/agfline/LibAAF yet,
      # we need to use some of ardours internal libs, see:
      # https://discourse.ardour.org/t/ardour-8-2-released/109615/6
      # and
      # https://discourse.ardour.org/t/ardour-8-2-released/109615/8
      # "--use-external-libs"
    ]
    ++ lib.optional optimize "--optimize";

    postInstall = ''
      # wscript does not install these for some reason
      install -vDm 644 "build/gtk2_ardour/ardour.xml" \
        -t "$out/share/mime/packages"
      install -vDm 644 "build/gtk2_ardour/ardour${majorVersion}.desktop" \
        -t "$out/share/applications"
      for size in 16 22 32 48 256 512; do
        install -vDm 644 "gtk2_ardour/resources/Ardour-icon_''${size}px.png" \
          "$out/share/icons/hicolor/''${size}x''${size}/apps/ardour${majorVersion}.png"
      done
      install -vDm 644 "ardour.1"* -t "$out/share/man/man1"

      # install additional bundled beats, chords and progressions
      cp -rp "${finalAttrs.bundledContent}"/* "$out/share/ardour${majorVersion}/media"
    ''
    + lib.optionalString videoSupport ''
      # `harvid` and `xjadeo` must be accessible in `PATH` for video to work.
      wrapProgram "$out/bin/ardour${majorVersion}" \
        --prefix PATH : "${
          lib.makeBinPath [
            harvid
            xjadeo
          ]
        }"
    '';

    LINKFLAGS = "-lpthread";

    meta = {
      description = "Multi-track hard disk recording software";
      longDescription = ''
        Ardour is a digital audio workstation (DAW), You can use it to
        record, edit and mix multi-track audio and midi. Produce your
        own CDs. Mix video soundtracks. Experiment with new ideas about
        music and sound.

        Please consider supporting the ardour project financially:
        https://community.ardour.org/donate
      '';
      homepage = "https://ardour.org/";
      license = lib.licenses.gpl2Plus;
      mainProgram = "ardour8";
      platforms = lib.platforms.linux;
      maintainers = with lib.maintainers; [
        magnetophon
        mitchmindtree
        ryand56
      ];
    };
  }
)