contour: 0.3.1.200 -> 0.3.12.262

- use qt6 by default
  - codesign macOS bundle executable
  - install terminfo for Darwin
  - install shell completions for zsh and fish
This commit is contained in:
fortuneteller2k 2023-06-20 14:59:01 +08:00
parent 9041c780be
commit 1769cf416e
5 changed files with 93 additions and 48 deletions

View File

@ -23,9 +23,8 @@ with pkgs.lib;
let tests = { let tests = {
alacritty.pkg = p: p.alacritty; alacritty.pkg = p: p.alacritty;
# times out after spending many hours contour.pkg = p: p.contour;
#contour.pkg = p: p.contour; contour.cmd = "contour early-exit-threshold 0 execute $command";
#contour.cmd = "contour $command";
cool-retro-term.pkg = p: p.cool-retro-term; cool-retro-term.pkg = p: p.cool-retro-term;
cool-retro-term.colourTest = false; # broken by gloss effect cool-retro-term.colourTest = false; # broken by gloss effect

View File

@ -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()

View File

@ -1,12 +1,16 @@
{ lib { lib
, stdenv , stdenv
, mkDerivation
, fetchFromGitHub , fetchFromGitHub
, fetchurl
, cmake , cmake
, pkg-config , pkg-config
, freetype , freetype
, fontconfig , fontconfig
, libGL , libunicode
, libutempter
, termbench-pro
, qtmultimedia
, wrapQtAppsHook
, pcre , pcre
, boost , boost
, catch2 , catch2
@ -16,50 +20,43 @@
, yaml-cpp , yaml-cpp
, ncurses , ncurses
, file , file
, darwin , utmp
, sigtool
, nixosTests , nixosTests
, installShellFiles
}: }:
let stdenv.mkDerivation (final: {
# 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 {
pname = "contour"; pname = "contour";
version = "0.3.1.200"; version = "0.3.12.262";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "contour-terminal"; owner = "contour-terminal";
repo = pname; repo = "contour";
rev = "v${version}"; rev = "v${final.version}";
sha256 = "sha256-TpxVC0GFZD3jGISnDWHKEetgVVpznm5k/Vc2dwVfSG4="; hash = "sha256-4R0NyUtsyr3plYfVPom+EjJ5W0Cb/uuaSB5zyJ0yIB4=";
}; };
outputs = [ "out" "terminfo" ]; outputs = [ "out" "terminfo" ];
# fix missing <QtMultimedia/QAudioSink> on Darwin and codesign the binary
patches = [ ./contour-cmakelists.diff ./macos-codesign.diff ];
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
pkg-config pkg-config
ncurses ncurses
file file
]; wrapQtAppsHook
installShellFiles
] ++ lib.optionals stdenv.isDarwin [ sigtool ];
buildInputs = [ buildInputs = [
fontconfig fontconfig
freetype freetype
libGL libunicode
termbench-pro
qtmultimedia
pcre pcre
boost boost
catch2 catch2
@ -67,38 +64,37 @@ mkDerivation rec {
microsoft-gsl microsoft-gsl
range-v3 range-v3
yaml-cpp yaml-cpp
] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.libs.utmp ]; ]
++ lib.optionals stdenv.isLinux [ libutempter ]
++ lib.optionals stdenv.isDarwin [ utmp ];
cmakeFlags = [ "-DCONTOUR_QT_VERSION=6" ];
preConfigure = '' preConfigure = ''
mkdir -p _deps/sources
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
# Don't fix Darwin app bundle # Don't fix Darwin app bundle
sed -i '/fixup_bundle/d' src/contour/CMakeLists.txt sed -i '/fixup_bundle/d' src/contour/CMakeLists.txt
''; '';
postInstall = '' postInstall = ''
mkdir -p $out/nix-support $terminfo/share 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/ 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 echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
''; '';
passthru.tests.test = nixosTests.terminal-emulators.contour; passthru.tests.test = nixosTests.terminal-emulators.contour;
meta = with lib; { 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"; description = "Modern C++ Terminal Emulator";
homepage = "https://github.com/contour-terminal/contour"; homepage = "https://github.com/contour-terminal/contour";
changelog = "https://github.com/contour-terminal/contour/raw/v${version}/Changelog.md"; changelog = "https://github.com/contour-terminal/contour/raw/v${version}/Changelog.md";
@ -106,4 +102,4 @@ mkDerivation rec {
maintainers = with maintainers; [ moni ]; maintainers = with maintainers; [ moni ];
platforms = platforms.unix; platforms = platforms.unix;
}; };
} })

View File

@ -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")

View File

@ -3027,7 +3027,12 @@ with pkgs;
blackbox-terminal = callPackage ../applications/terminal-emulators/blackbox-terminal { }; blackbox-terminal = callPackage ../applications/terminal-emulators/blackbox-terminal { };
contour = libsForQt5.callPackage ../applications/terminal-emulators/contour { fmt = fmt_8; }; contour = qt6.callPackage ../applications/terminal-emulators/contour {
inherit (darwin.apple_sdk_11_0.libs) utmp;
inherit (darwin) sigtool;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
fmt = fmt_9;
};
cool-retro-term = libsForQt5.callPackage ../applications/terminal-emulators/cool-retro-term { }; cool-retro-term = libsForQt5.callPackage ../applications/terminal-emulators/cool-retro-term { };
@ -23624,6 +23629,8 @@ with pkgs;
libuldaq = callPackage ../development/libraries/libuldaq { }; libuldaq = callPackage ../development/libraries/libuldaq { };
libunicode = callPackage ../development/libraries/libunicode { fmt = fmt_8; };
libunwind = libunwind =
if stdenv.isDarwin then darwin.libunwind if stdenv.isDarwin then darwin.libunwind
else if stdenv.hostPlatform.system == "riscv32-linux" then llvmPackages_14.libunwind else if stdenv.hostPlatform.system == "riscv32-linux" then llvmPackages_14.libunwind
@ -25313,6 +25320,8 @@ with pkgs;
tepl = callPackage ../development/libraries/tepl { }; tepl = callPackage ../development/libraries/tepl { };
termbench-pro = callPackage ../development/libraries/termbench-pro { fmt = fmt_8; };
telepathy-glib = callPackage ../development/libraries/telepathy/glib { }; telepathy-glib = callPackage ../development/libraries/telepathy/glib { };
telepathy-farstream = callPackage ../development/libraries/telepathy/farstream { }; telepathy-farstream = callPackage ../development/libraries/telepathy/farstream { };