Unverified Commit ca426678 authored by Martin Weinelt's avatar Martin Weinelt Committed by GitHub
Browse files

Merge pull request #220421 from ckiee/in-formant-update-qt6

in-formant: 2021-06-30 -> unstable-2022-09-15; unbreak
parents cd22034f 3e272a4f
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
From 42eda1afc1cfb0506b02baae894fb32f7e21755d Mon Sep 17 00:00:00 2001
From: ckie <git-525ff67@ckie.dev>
Date: Fri, 10 Mar 2023 04:39:38 +0200
Subject: [PATCH] Avoid using vendored dependencies we have in nixpkgs

---
 CMakeLists.txt | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 136e7b0..5416da1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -246,8 +246,6 @@ qt6_add_resources(RESOURCES_OBJ resources/qml.qrc)
 qt6_add_big_resources(RESOURCES_OBJ resources/other.qrc)
 set_property(SOURCE "${RESOURCES_OBJ}" PROPERTY SKIP_AUTOMOC ON)
 
-set(ARMADILLO_INCLUDE_DIR external/armadillo/include)
-set(TOMLPP_INCLUDE_DIR external/tomlplusplus/include)
 
 ### SEARCH AUDIO MODULES 
 
@@ -334,17 +332,15 @@ target_include_directories(in-formant SYSTEM PRIVATE ${ARMADILLO_INCLUDE_DIR} ${
 target_link_libraries(in-formant PRIVATE Eigen3::Eigen ${FFTW_LIBRARIES} Qt6::Charts Qt6::Quick Qt6::QuickControls2 Qt6::QuickTemplates2 Qt6::Qml Qt6::Widgets Qt6::OpenGL Qt6::Gui Qt6::Core)
 target_link_directories(in-formant PRIVATE ${FFTW_LIBRARY_DIRS})
 
-set(BUILD_SHARED_LIBS TRUE)
-add_subdirectory(external/freetype EXCLUDE_FROM_ALL)
+find_package(Freetype)
 target_link_libraries(in-formant PRIVATE freetype)
-set(BUILD_SHARED_LIBS)
 
 add_subdirectory(external/rpmalloc EXCLUDE_FROM_ALL)
 target_link_libraries(in-formant PRIVATE rpcxx_only)
 
-add_subdirectory(external/libsamplerate)
-target_link_libraries(in-formant PRIVATE lsr)
-target_include_directories(in-formant PRIVATE external/libsamplerate/src)
+
+find_library(LIBSAMPLERATE_LIBRARY NAMES samplerate libsamplerate-0 samplerate-0)
+target_link_libraries(in-formant PRIVATE ${LIBSAMPLERATE_LIBRARY})
 
 target_compile_definitions(in-formant PRIVATE
     -DINFORMANT_VERSION=${CUR_VERSION} -DARMA_DONT_USE_WRAPPER
-- 
2.39.0
+36 −15
Original line number Diff line number Diff line
{ stdenv, cmake, lib, fetchFromGitHub, qt5, fftw, libtorch-bin, portaudio, eigen
, xorg, pkg-config, autoPatchelfHook, soxr
{ stdenv
, cmake
, lib
, fetchFromGitHub
, wrapQtAppsHook
, qtbase
, qtcharts
, fftw
, libtorch-bin
, portaudio
, eigen
, xorg
, pkg-config
, autoPatchelfHook
, soxr
, freetype
, libsamplerate
, armadillo
, tomlplusplus
}:

stdenv.mkDerivation rec {
  pname = "in-formant";
  version = "2021-06-30";
  version = "unstable-2022-09-15";

  # no Qt6 yet, so we're stuck in the last Qt5-supporting commit: https://github.com/NixOS/nixpkgs/issues/108008
  src = fetchFromGitHub {
    owner = "in-formant";
    repo = "in-formant";
    rev = "e28e628cf5ff0949a7b046d220cc884f6035f31a";
    sha256 = "sha256-YvtV0wGUNmI/+GGxrIfTk/l8tqUsWgc/LAI17X+AWGI=";
    rev = "e0606feecff70f0fd4226ff8f116e46817dd7462";
    hash = "sha256-/4eKny9M2e8Lb9LOiKBj9QLE00CAaD+2ZAwn48lnvKQ=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [ cmake pkg-config qt5.wrapQtAppsHook autoPatchelfHook ];
  patches = [
    # Ignore the freetype sources bundled as a submodule:
    # /nix/store/…-harfbuzz-7.0.0/lib/libharfbuzz.so.0: undefined reference to `FT_Get_Transform'
    ./0001-Avoid-using-vendored-dependencies-we-have-in-nixpkgs.patch
  ];

  nativeBuildInputs = [ cmake pkg-config wrapQtAppsHook autoPatchelfHook ];

  buildInputs = [
    qt5.qtbase
    qt5.qtquickcontrols
    qt5.qtquickcontrols2
    qt5.qtcharts
    qtbase
    qtcharts
    fftw
    libtorch-bin
    portaudio
    eigen
    xorg.libxcb
    soxr
    libsamplerate
    armadillo
    tomlplusplus
  ];

  installPhase = ''
@@ -35,14 +58,12 @@ stdenv.mkDerivation rec {
    cp in-formant $out/bin
  '';

  # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
  cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=ON" ];

  meta = with lib; {
    description = "A real-time pitch and formant tracking software";
    homepage = "https://github.com/in-formant/in-formant";
    license = licenses.asl20;
    platforms = platforms.linux;
    # currently broken on i686-linux and aarch64-linux due to other nixpkgs dependencies
    platforms = [ "x86_64-linux" ];
    maintainers = with maintainers; [ ckie ];
  };
}
+1 −1
Original line number Diff line number Diff line
@@ -8638,7 +8638,7 @@ with pkgs;
  imgurbash2 = callPackage ../tools/graphics/imgurbash2 { };
  in-formant = callPackage ../applications/audio/in-formant { };
  in-formant = qt6Packages.callPackage ../applications/audio/in-formant { };
  inadyn = callPackage ../tools/networking/inadyn { };