multipass: 1.15.1 -> 1.16.0
This commit bumps Canonical Multipass to the 1.16.0 release. As part of this release, the upstream now uses upstream grpc, and thus some of the complexity in the package can be dropped. On this occasion, I have pulled a slightly newer pubspec.yaml from the upstream that is yet to be released which aided running the build with the Flutter toolchain available in nixpkgs.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
version,
|
||||
|
||||
autoPatchelfHook,
|
||||
flutter327,
|
||||
flutter,
|
||||
gtkmm3,
|
||||
keybinder3,
|
||||
lib,
|
||||
@@ -15,7 +15,7 @@
|
||||
protoc-gen-dart,
|
||||
qt6,
|
||||
}:
|
||||
flutter327.buildFlutterApplication {
|
||||
flutter.buildFlutterApplication {
|
||||
inherit version;
|
||||
pname = "multipass-gui";
|
||||
src = multipass_src;
|
||||
@@ -25,9 +25,9 @@ flutter327.buildFlutterApplication {
|
||||
pubspecLock = lib.importJSON ./pubspec.lock.json;
|
||||
|
||||
gitHashes = {
|
||||
dartssh2 = "sha256-2pypKwurziwGLZYuGaxlS2lzN3UvJp3bRTvvYYxEqRI=";
|
||||
dartssh2 = "sha256-9XrxxOamy0uS7kUz6mwWwp4yIBHLX/GSoyxMk/Wwa+4=";
|
||||
hotkey_manager_linux = "sha256-aO0h94YZvgV/ggVupNw8GjyZsnXrq3qTHRDtuhNv3oI=";
|
||||
tray_menu = "sha256-riiAiBEms+9ARog8i+MR1fto1Yqx+gwbBWyNbNq6VTM=";
|
||||
tray_menu = "sha256-TAlRW7VkZWAoHAVlrPeDqS3BsqhQTyCekYQ2b4AEqjU=";
|
||||
window_size = "sha256-71PqQzf+qY23hTJvcm0Oye8tng3Asr42E2vfF1nBmVA=";
|
||||
xterm = "sha256-h8vIonTPUVnNqZPk/A4ZV7EYCMyM0rrErL9ZOMe4ZBE=";
|
||||
};
|
||||
@@ -49,6 +49,11 @@ flutter327.buildFlutterApplication {
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
# Temporary fix which can be removed in the next release.
|
||||
# Already addressed upstream, but part of a larger patch
|
||||
# that did not trivially apply.
|
||||
substituteInPlace lib/main.dart --replace-fail 'TabBarTheme(' 'TabBarThemeData('
|
||||
|
||||
mkdir -p lib/generated
|
||||
|
||||
# Generate the Dart gRPC code for the Multipass GUI.
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
cmake,
|
||||
dnsmasq,
|
||||
fetchFromGitHub,
|
||||
fmt_11,
|
||||
git,
|
||||
grpc,
|
||||
gtest,
|
||||
iproute2,
|
||||
iptables,
|
||||
@@ -27,18 +29,6 @@
|
||||
xterm,
|
||||
}:
|
||||
|
||||
let
|
||||
# This is done here because a CMakeLists.txt from one of it's submodules tries
|
||||
# to modify a file, so we grab the source for the submodule here, copy it into
|
||||
# the source of the Multipass project which allows the modification to happen.
|
||||
grpc_src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "grpc";
|
||||
rev = "ba8e7f72a57b9e0b25783a4d3cea58c79379f194";
|
||||
hash = "sha256-DS1UNLCUdbipn5w4p2aVa8LgHHhdJiAfzfEdIXNO69o=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
inherit version;
|
||||
pname = "multipassd";
|
||||
@@ -54,8 +44,6 @@ stdenv.mkDerivation {
|
||||
# in the Nix build environment. This patch disables the fetch in favour of providing
|
||||
# the googletest library from nixpkgs.
|
||||
./cmake_no_fetch.patch
|
||||
# Ensures '-Wno-ignored-attributes' is supported by the compiler before attempting to build.
|
||||
./cmake_warning.patch
|
||||
# As of Multipass 1.14.0, the upstream started using vcpkg for grabbing C++ dependencies,
|
||||
# which doesn't work in the nix build environment. This patch reverts that change, in favour
|
||||
# of providing those dependencies manually in this derivation.
|
||||
@@ -83,9 +71,6 @@ stdenv.mkDerivation {
|
||||
--replace-fail "OVMF.fd" "${OVMF.fd}/FV/OVMF.fd" \
|
||||
--replace-fail "QEMU_EFI.fd" "${OVMF.fd}/FV/QEMU_EFI.fd"
|
||||
|
||||
# Copy the grpc submodule we fetched into the source code.
|
||||
cp -r --no-preserve=mode ${grpc_src} 3rd-party/grpc
|
||||
|
||||
# Configure CMake to use gtest from the nix store since we disabled fetching from the internet.
|
||||
cat >> tests/CMakeLists.txt <<'EOF'
|
||||
add_library(gtest INTERFACE)
|
||||
@@ -111,6 +96,8 @@ stdenv.mkDerivation {
|
||||
cmakeFlags = [ "-DMULTIPASS_ENABLE_FLUTTER_GUI=false" ];
|
||||
|
||||
buildInputs = [
|
||||
fmt_11
|
||||
grpc
|
||||
gtest
|
||||
libapparmor
|
||||
libvirt
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
|
||||
let
|
||||
name = "multipass";
|
||||
version = "1.15.1";
|
||||
version = "1.16.0";
|
||||
|
||||
multipass_src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "multipass";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-ckIvijNWav8gCL8b+Iw84tWS4cpTobJDdHwh/p+Y3NI=";
|
||||
hash = "sha256-7P7LZEvZ+ygM0G8C/gMIwq5BOSs4wSVEBNgsaZzBbOk=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -40,21 +40,6 @@ update_multipass_source() {
|
||||
sed -i "s|hash = \".*$|hash = \"${sri_hash}\";|" package.nix
|
||||
}
|
||||
|
||||
# Update the version/hash of the grpc source code in the Nix expression.
|
||||
update_grpc_source() {
|
||||
local version; version="$1"
|
||||
echo "Updating grpc source"
|
||||
|
||||
submodule_info="https://raw.githubusercontent.com/canonical/multipass/refs/tags/v${version}/3rd-party/submodule_info.md"
|
||||
commit_short="$(curl -s "${submodule_info}" | grep -Po "CanonicalLtd/grpc/compare/v[0-9]+\.[0-9]+\.[0-9]+\.\.\K[0-9a-f]+")"
|
||||
commit_hash="$(curl -s "https://github.com/canonical/grpc/commits/${commit_short}" | grep -Po "${commit_short}[0-9a-f]+" | head -n1)"
|
||||
sri_hash="$(nix-prefetch-github canonical grpc --rev "${commit_hash}" --fetch-submodules | jq -r '.hash')"
|
||||
|
||||
sed -i "s|rev = \".*$|rev = \"${commit_hash}\";|" multipassd.nix
|
||||
sed -i "s|hash = \".*$|hash = \"${sri_hash}\";|" multipassd.nix
|
||||
}
|
||||
|
||||
|
||||
LATEST_TAG="$(curl -s ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} https://api.github.com/repos/canonical/multipass/releases/latest | jq -r '.tag_name')"
|
||||
LATEST_VERSION="$(expr "$LATEST_TAG" : 'v\(.*\)')"
|
||||
CURRENT_VERSION="$(grep -Po "version = \"\K[^\"]+" package.nix)"
|
||||
@@ -66,12 +51,11 @@ fi
|
||||
|
||||
update_pubspec_json "$LATEST_VERSION"
|
||||
|
||||
update_dart_pkg_hash dartssh2 andrei-toterman dartssh2
|
||||
update_dart_pkg_hash hotkey_manager_linux andrei-toterman hotkey_manager
|
||||
update_dart_pkg_hash tray_menu andrei-toterman tray_menu
|
||||
update_dart_pkg_hash dartssh2 canonical dartssh2
|
||||
update_dart_pkg_hash hotkey_manager_linux canonical hotkey_manager
|
||||
update_dart_pkg_hash tray_menu canonical tray_menu
|
||||
update_dart_pkg_hash window_size google flutter-desktop-embedding
|
||||
update_dart_pkg_hash xterm levkropp xterm.dart
|
||||
|
||||
update_multipass_source "$LATEST_VERSION"
|
||||
|
||||
update_grpc_source "$LATEST_VERSION"
|
||||
|
||||
@@ -1,68 +1,9 @@
|
||||
diff --git a/3rd-party/CMakeLists.txt b/3rd-party/CMakeLists.txt
|
||||
index 73291f6c..c1a38198 100644
|
||||
--- a/3rd-party/CMakeLists.txt
|
||||
+++ b/3rd-party/CMakeLists.txt
|
||||
@@ -4,6 +4,24 @@ if (MSVC)
|
||||
add_compile_options(-wd5045) #Disable warning about Spectre mitigation
|
||||
endif()
|
||||
|
||||
+include(FetchContent)
|
||||
+set(FETCHCONTENT_QUIET FALSE)
|
||||
+
|
||||
+FetchContent_Declare(gRPC
|
||||
+ DOWNLOAD_COMMAND true
|
||||
+ SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/grpc
|
||||
+)
|
||||
+
|
||||
+set(gRPC_SSL_PROVIDER "package" CACHE STRING "Provider of ssl library")
|
||||
+
|
||||
+FetchContent_MakeAvailable(gRPC)
|
||||
+
|
||||
+# Workaround for zlib placing its generated zconf.h file in the build dir,
|
||||
+# and protobuf not knowing so finding the system version instead
|
||||
+include_directories(${grpc_SOURCE_DIR}/third_party/zlib)
|
||||
+
|
||||
+set_property(DIRECTORY ${grpc_SOURCE_DIR} PROPERTY EXCLUDE_FROM_ALL YES)
|
||||
+
|
||||
# Generates gRPC and protobuf C++ sources and headers from the given .proto files
|
||||
#
|
||||
# generate_grpc_cpp (<SRCS> <DEST> [<ARGN>...])
|
||||
@@ -34,9 +52,9 @@ function(generate_grpc_cpp SRCS DEST)
|
||||
"${DEST}/${FIL_WE}.grpc.pb.h"
|
||||
"${DEST}/${FIL_WE}.pb.cc"
|
||||
"${DEST}/${FIL_WE}.pb.h"
|
||||
- COMMAND $<TARGET_FILE:protobuf::protoc>
|
||||
- ARGS --grpc_out=${DEST} --cpp_out=${DEST} --proto_path=${FIL_DIR} --proto_path=${grpc_SOURCE_DIR}/third_party/protobuf/src --plugin=protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin> ${ABS_FIL}
|
||||
- DEPENDS ${ABS_FIL}
|
||||
+ COMMAND $<TARGET_FILE:protoc>
|
||||
+ ARGS --grpc_out=${DEST} --cpp_out=${DEST} --proto_path=${FIL_DIR} --proto_path=${grpc_SOURCE_DIR}/third_party/protobuf/src --plugin=protoc-gen-grpc=$<TARGET_FILE:grpc_cpp_plugin> ${ABS_FIL}
|
||||
+ DEPENDS ${ABS_FIL} protoc grpc_cpp_plugin
|
||||
COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}"
|
||||
VERBATIM)
|
||||
endforeach ()
|
||||
@@ -47,9 +65,14 @@ endfunction()
|
||||
|
||||
add_library(gRPC INTERFACE)
|
||||
|
||||
+target_include_directories(gRPC INTERFACE
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/grpc/include
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/grpc/third_party/protobuf/src)
|
||||
+
|
||||
target_link_libraries(gRPC INTERFACE
|
||||
- gRPC::grpc++
|
||||
- protobuf::libprotobuf)
|
||||
+ grpc++
|
||||
+ libprotobuf
|
||||
+ zlibstatic)
|
||||
|
||||
if (NOT MSVC)
|
||||
target_compile_options(gRPC INTERFACE "-Wno-unused-parameter" "-Wno-non-virtual-dtor" "-Wno-pedantic")
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 18e47b74..d5bf5dea 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -49,9 +49,6 @@ if(NOT DEFINED VCPKG_BUILD_DEFAULT)
|
||||
set(VCPKG_TARGET_TRIPLET "${VCPKG_HOST_ARCH}-${VCPKG_HOST_OS}-release")
|
||||
diff --git i/CMakeLists.txt w/CMakeLists.txt
|
||||
index fd8d446c8..870a2c19c 100644
|
||||
--- i/CMakeLists.txt
|
||||
+++ w/CMakeLists.txt
|
||||
@@ -83,9 +83,6 @@ else()
|
||||
message(STATUS "Bootstrapping vcpkg completed successfully.")
|
||||
endif()
|
||||
|
||||
-set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/3rd-party/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||
@@ -71,13 +12,3 @@ index 18e47b74..d5bf5dea 100644
|
||||
project(Multipass)
|
||||
|
||||
option(MULTIPASS_ENABLE_TESTS "Build tests" ON)
|
||||
@@ -125,9 +122,6 @@ endif()
|
||||
# OpenSSL config
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
-# gRPC config
|
||||
-find_package(gRPC CONFIG REQUIRED)
|
||||
-
|
||||
# Needs to be here before we set further compilation options
|
||||
add_subdirectory(3rd-party)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user