about summary refs log tree commit diff
path: root/pkgs/applications/terminal-emulators
diff options
context:
space:
mode:
authorPeder Bergebakken Sundt <pbsds@hotmail.com>2023-12-04 00:10:19 +0100
committerGitHub <noreply@github.com>2023-12-04 00:10:19 +0100
commitd2852f5af0bee07c3865c03a7903acc3bc564f1d (patch)
treef860ed1c8b5ccd21674695a8387f07beb81964b8 /pkgs/applications/terminal-emulators
parent37b106f9b04cdb35d0b2cecd9858e7fa9c3e6625 (diff)
parent642e05439052539ed9053775ae5044da4d481912 (diff)
Merge pull request #238711 from moni-dz/contour
contour: 0.3.1.200 -> 0.3.12.262
Diffstat (limited to 'pkgs/applications/terminal-emulators')
-rw-r--r--pkgs/applications/terminal-emulators/contour/contour-cmakelists.diff20
-rw-r--r--pkgs/applications/terminal-emulators/contour/default.nix84
-rw-r--r--pkgs/applications/terminal-emulators/contour/macos-codesign.diff21
3 files changed, 81 insertions, 44 deletions
diff --git a/pkgs/applications/terminal-emulators/contour/contour-cmakelists.diff b/pkgs/applications/terminal-emulators/contour/contour-cmakelists.diff
new file mode 100644
index 0000000000000..2c958c4ce46d1
--- /dev/null
+++ b/pkgs/applications/terminal-emulators/contour/contour-cmakelists.diff
@@ -0,0 +1,20 @@
+diff --git a/src/contour/display/CMakeLists.txt b/src/contour/display/CMakeLists.txt
+index e2e9768c..fc1ea72f 100644
+--- a/src/contour/display/CMakeLists.txt
++++ b/src/contour/display/CMakeLists.txt
+@@ -1,5 +1,5 @@
+ if(CONTOUR_QT_VERSION EQUAL "6")
+-   find_package(Qt6 COMPONENTS Core Gui OpenGLWidgets Widgets REQUIRED)
++   find_package(Qt6 COMPONENTS Core Gui OpenGLWidgets Widgets Multimedia REQUIRED)
+ else()
+    find_package(Qt5 COMPONENTS Gui Widgets REQUIRED)  # apt install qtbase5-dev libqt5gui5
+ endif()
+@@ -31,7 +31,7 @@ endif()
+ target_include_directories(ContourTerminalDisplay PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../..")
+ target_link_libraries(ContourTerminalDisplay vtrasterizer)
+ if(CONTOUR_QT_VERSION EQUAL "6")
+-    target_link_libraries(ContourTerminalDisplay Qt6::Core Qt6::Gui Qt6::OpenGL Qt6::OpenGLWidgets Qt6::Widgets)
++    target_link_libraries(ContourTerminalDisplay Qt6::Core Qt6::Gui Qt6::OpenGL Qt6::OpenGLWidgets Qt6::Widgets Qt6::Multimedia)
+ else()
+     target_link_libraries(ContourTerminalDisplay Qt5::Gui Qt5::Widgets)
+ endif()
diff --git a/pkgs/applications/terminal-emulators/contour/default.nix b/pkgs/applications/terminal-emulators/contour/default.nix
index a1692dd255a2c..4a50625cc81eb 100644
--- a/pkgs/applications/terminal-emulators/contour/default.nix
+++ b/pkgs/applications/terminal-emulators/contour/default.nix
@@ -1,12 +1,16 @@
 { lib
 , stdenv
-, mkDerivation
 , fetchFromGitHub
+, fetchurl
 , cmake
 , pkg-config
 , freetype
 , fontconfig
-, libGL
+, libunicode
+, libutempter
+, termbench-pro
+, qtmultimedia
+, wrapQtAppsHook
 , pcre
 , boost
 , catch2
@@ -16,50 +20,43 @@
 , yaml-cpp
 , ncurses
 , file
-, darwin
+, utmp
+, sigtool
 , nixosTests
+, installShellFiles
 }:
 
-let
-  # Commits refs come from https://github.com/contour-terminal/contour/blob/master/scripts/install-deps.sh
-  libunicode-src = fetchFromGitHub {
-    owner = "contour-terminal";
-    repo = "libunicode";
-    rev = "c2369b6380df1197476b08d3e2d0e96b6446f776";
-    sha256 = "sha256-kq7GpFCkrJG7F9/YEGz3gMTgYzhp/QB8D5b9wwMaLvQ=";
-  };
-
-  termbench-pro-src = fetchFromGitHub {
-    owner = "contour-terminal";
-    repo = "termbench-pro";
-    rev = "cd571e3cebb7c00de9168126b28852f32fb204ed";
-    sha256 = "sha256-dNtOmBu63LFYfiGjXf34C2tiG8pMmsFT4yK3nBnK9WI=";
-  };
-in
-mkDerivation rec {
+stdenv.mkDerivation (final: {
   pname = "contour";
-  version = "0.3.1.200";
+  version = "0.3.12.262";
 
   src = fetchFromGitHub {
     owner = "contour-terminal";
-    repo = pname;
-    rev = "v${version}";
-    sha256 = "sha256-TpxVC0GFZD3jGISnDWHKEetgVVpznm5k/Vc2dwVfSG4=";
+    repo = "contour";
+    rev = "v${final.version}";
+    hash = "sha256-4R0NyUtsyr3plYfVPom+EjJ5W0Cb/uuaSB5zyJ0yIB4=";
   };
 
   outputs = [ "out" "terminfo" ];
 
+  # fix missing <QtMultimedia/QAudioSink> on Darwin and codesign the binary
+  patches = [ ./contour-cmakelists.diff ./macos-codesign.diff ];
+
   nativeBuildInputs = [
     cmake
     pkg-config
     ncurses
     file
-  ];
+    wrapQtAppsHook
+    installShellFiles
+  ] ++ lib.optionals stdenv.isDarwin [ sigtool ];
 
   buildInputs = [
     fontconfig
     freetype
-    libGL
+    libunicode
+    termbench-pro
+    qtmultimedia
     pcre
     boost
     catch2
@@ -67,38 +64,37 @@ mkDerivation rec {
     microsoft-gsl
     range-v3
     yaml-cpp
-  ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.libs.utmp ];
-
-  preConfigure = ''
-    mkdir -p _deps/sources
+  ]
+  ++ lib.optionals stdenv.isLinux [ libutempter ]
+  ++ lib.optionals stdenv.isDarwin [ utmp ];
 
-    cat > _deps/sources/CMakeLists.txt <<EOF
-    macro(ContourThirdParties_Embed_libunicode)
-        add_subdirectory(\''${ContourThirdParties_SRCDIR}/libunicode EXCLUDE_FROM_ALL)
-    endmacro()
-    macro(ContourThirdParties_Embed_termbench_pro)
-        add_subdirectory(\''${ContourThirdParties_SRCDIR}/termbench_pro EXCLUDE_FROM_ALL)
-    endmacro()
-    EOF
-
-    ln -s ${libunicode-src} _deps/sources/libunicode
-    ln -s ${termbench-pro-src} _deps/sources/termbench_pro
+  cmakeFlags = [ "-DCONTOUR_QT_VERSION=6" ];
 
+  preConfigure = ''
     # Don't fix Darwin app bundle
     sed -i '/fixup_bundle/d' src/contour/CMakeLists.txt
   '';
 
   postInstall = ''
     mkdir -p $out/nix-support $terminfo/share
+  '' + lib.optionalString stdenv.isDarwin ''
+    mkdir $out/Applications
+    installShellCompletion --zsh $out/contour.app/Contents/Resources/shell-integration/shell-integration.zsh
+    installShellCompletion --fish $out/contour.app/Contents/Resources/shell-integration/shell-integration.fish
+    cp -r $out/contour.app/Contents/Resources/terminfo $terminfo/share
+    mv $out/contour.app $out/Applications
+    ln -s $out/bin $out/Applications/contour.app/Contents/MacOS
+  '' + lib.optionalString stdenv.isLinux ''
     mv $out/share/terminfo $terminfo/share/
+    installShellCompletion --zsh $out/share/contour/shell-integration/shell-integration.zsh
+    installShellCompletion --fish $out/share/contour/shell-integration/shell-integration.fish
+  '' + ''
     echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
   '';
 
   passthru.tests.test = nixosTests.terminal-emulators.contour;
 
   meta = with lib; {
-    # never built on Hydra https://hydra.nixos.org/job/nixpkgs/staging-next/contour.x86_64-darwin
-    broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin;
     description = "Modern C++ Terminal Emulator";
     homepage = "https://github.com/contour-terminal/contour";
     changelog = "https://github.com/contour-terminal/contour/raw/v${version}/Changelog.md";
@@ -107,4 +103,4 @@ mkDerivation rec {
     platforms = platforms.unix;
     mainProgram = "contour";
   };
-}
+})
diff --git a/pkgs/applications/terminal-emulators/contour/macos-codesign.diff b/pkgs/applications/terminal-emulators/contour/macos-codesign.diff
new file mode 100644
index 0000000000000..8e449dd0a4939
--- /dev/null
+++ b/pkgs/applications/terminal-emulators/contour/macos-codesign.diff
@@ -0,0 +1,21 @@
+diff --git a/src/contour/CMakeLists.txt b/src/contour/CMakeLists.txt
+index 0eebd585..5d0bc3c0 100644
+--- a/src/contour/CMakeLists.txt
++++ b/src/contour/CMakeLists.txt
+@@ -145,6 +145,16 @@ if(CONTOUR_BUILD_WITH_MIMALLOC)
+     target_link_libraries(contour mimalloc)
+ endif()
+ 
++if(APPLE)
++  add_custom_command(
++    TARGET contour POST_BUILD
++    WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
++    COMMAND codesign --force --sign - contour.app/Contents/MacOS/contour
++    COMMENT "Codesigning macOS bundle executable"
++    VERBATIM
++  )
++endif()
++
+ if(NOT(WIN32))
+     set(terminfo_file "contour.terminfo")
+     set(terminfo_basedir "${CMAKE_CURRENT_BINARY_DIR}/terminfo")