Loading pkgs/tools/virtualization/multipass/cmake_no_fetch.patch +0 −19 Original line number Diff line number Diff line diff --git a/3rd-party/CMakeLists.txt b/3rd-party/CMakeLists.txt index 188ebfc6..4a34a922 100644 --- a/3rd-party/CMakeLists.txt +++ b/3rd-party/CMakeLists.txt @@ -2,12 +2,8 @@ include(FetchContent) set(FETCHCONTENT_QUIET FALSE) FetchContent_Declare(gRPC - GIT_REPOSITORY https://github.com/CanonicalLtd/grpc.git - GIT_TAG e3acf245 - GIT_SHALLOW TRUE - GIT_SUBMODULES "third_party/abseil-cpp third_party/cares/cares third_party/protobuf third_party/re2 third_party/zlib" - GIT_SUBMODULES_RECURSE false - GIT_PROGRESS TRUE + DOWNLOAD_COMMAND true + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/grpc ) set(gRPC_SSL_PROVIDER "package" CACHE STRING "Provider of ssl library") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 52bd407f..a1100112 100644 --- a/tests/CMakeLists.txt Loading pkgs/tools/virtualization/multipass/default.nix +14 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ OVMF, pkg-config, qemu, poco, protobuf, qemu-utils, qtbase, qtwayland, Loading @@ -26,7 +28,7 @@ let pname = "multipass"; version = "1.13.1"; version = "1.14.0"; # 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 Loading @@ -46,7 +48,7 @@ stdenv.mkDerivation { owner = "canonical"; repo = "multipass"; rev = "refs/tags/v${version}"; hash = "sha256-QttgWSuhxcuOyMNF9Ve1w0ftT41+hNz3WW5Vag/88X4="; hash = "sha256-1g5Og4LkNujjT4KCXHmXaiTK58Bgb2KyYLKwTFFVEHE="; fetchSubmodules = true; leaveDotGit = true; postFetch = '' Loading @@ -60,6 +62,8 @@ stdenv.mkDerivation { ./lxd_socket_path.patch ./cmake_no_fetch.patch ./cmake_warning.patch ./vcpkg_no_install.patch ./test_unreachable_call.patch ]; postPatch = '' Loading @@ -68,6 +72,9 @@ stdenv.mkDerivation { --replace-fail "determine_version(MULTIPASS_VERSION)" "" \ --replace-fail 'set(MULTIPASS_VERSION ''${MULTIPASS_VERSION})' 'set(MULTIPASS_VERSION "v${version}")' # Don't build/use vcpkg rm -rf 3rd-party/vcpkg # Patch the patch of the OVMF binaries to use paths from the nix store. substituteInPlace ./src/platform/backends/qemu/linux/qemu_platform_detail_linux.cpp \ --replace-fail "OVMF.fd" "${OVMF.fd}/FV/OVMF.fd" \ Loading Loading @@ -97,6 +104,9 @@ stdenv.mkDerivation { EOF ''; # We'll build the flutter application seperately using buildFlutterApplication cmakeFlags = [ "-DMULTIPASS_ENABLE_FLUTTER_GUI=false" ]; buildInputs = [ gtest libapparmor Loading @@ -105,6 +115,8 @@ stdenv.mkDerivation { openssl qtbase qtwayland poco.dev protobuf ]; nativeBuildInputs = [ Loading pkgs/tools/virtualization/multipass/test_unreachable_call.patch 0 → 100644 +12 −0 Original line number Diff line number Diff line diff --git a/tests/test_common_callbacks.cpp b/tests/test_common_callbacks.cpp index ccae78e0..f9ab4423 100644 --- a/tests/test_common_callbacks.cpp +++ b/tests/test_common_callbacks.cpp @@ -73,6 +73,7 @@ struct TestLoggingSpinnerCallbacks : public TestSpinnerCallbacks, public WithPar default: assert(false && "shouldn't be here"); } + __builtin_unreachable(); } }; pkgs/tools/virtualization/multipass/vcpkg_no_install.patch 0 → 100644 +83 −0 Original line number Diff line number Diff line 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") endif() -set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/3rd-party/vcpkg/scripts/buildsystems/vcpkg.cmake" - CACHE STRING "Vcpkg toolchain file") - 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) Loading
pkgs/tools/virtualization/multipass/cmake_no_fetch.patch +0 −19 Original line number Diff line number Diff line diff --git a/3rd-party/CMakeLists.txt b/3rd-party/CMakeLists.txt index 188ebfc6..4a34a922 100644 --- a/3rd-party/CMakeLists.txt +++ b/3rd-party/CMakeLists.txt @@ -2,12 +2,8 @@ include(FetchContent) set(FETCHCONTENT_QUIET FALSE) FetchContent_Declare(gRPC - GIT_REPOSITORY https://github.com/CanonicalLtd/grpc.git - GIT_TAG e3acf245 - GIT_SHALLOW TRUE - GIT_SUBMODULES "third_party/abseil-cpp third_party/cares/cares third_party/protobuf third_party/re2 third_party/zlib" - GIT_SUBMODULES_RECURSE false - GIT_PROGRESS TRUE + DOWNLOAD_COMMAND true + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/grpc ) set(gRPC_SSL_PROVIDER "package" CACHE STRING "Provider of ssl library") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 52bd407f..a1100112 100644 --- a/tests/CMakeLists.txt Loading
pkgs/tools/virtualization/multipass/default.nix +14 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ OVMF, pkg-config, qemu, poco, protobuf, qemu-utils, qtbase, qtwayland, Loading @@ -26,7 +28,7 @@ let pname = "multipass"; version = "1.13.1"; version = "1.14.0"; # 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 Loading @@ -46,7 +48,7 @@ stdenv.mkDerivation { owner = "canonical"; repo = "multipass"; rev = "refs/tags/v${version}"; hash = "sha256-QttgWSuhxcuOyMNF9Ve1w0ftT41+hNz3WW5Vag/88X4="; hash = "sha256-1g5Og4LkNujjT4KCXHmXaiTK58Bgb2KyYLKwTFFVEHE="; fetchSubmodules = true; leaveDotGit = true; postFetch = '' Loading @@ -60,6 +62,8 @@ stdenv.mkDerivation { ./lxd_socket_path.patch ./cmake_no_fetch.patch ./cmake_warning.patch ./vcpkg_no_install.patch ./test_unreachable_call.patch ]; postPatch = '' Loading @@ -68,6 +72,9 @@ stdenv.mkDerivation { --replace-fail "determine_version(MULTIPASS_VERSION)" "" \ --replace-fail 'set(MULTIPASS_VERSION ''${MULTIPASS_VERSION})' 'set(MULTIPASS_VERSION "v${version}")' # Don't build/use vcpkg rm -rf 3rd-party/vcpkg # Patch the patch of the OVMF binaries to use paths from the nix store. substituteInPlace ./src/platform/backends/qemu/linux/qemu_platform_detail_linux.cpp \ --replace-fail "OVMF.fd" "${OVMF.fd}/FV/OVMF.fd" \ Loading Loading @@ -97,6 +104,9 @@ stdenv.mkDerivation { EOF ''; # We'll build the flutter application seperately using buildFlutterApplication cmakeFlags = [ "-DMULTIPASS_ENABLE_FLUTTER_GUI=false" ]; buildInputs = [ gtest libapparmor Loading @@ -105,6 +115,8 @@ stdenv.mkDerivation { openssl qtbase qtwayland poco.dev protobuf ]; nativeBuildInputs = [ Loading
pkgs/tools/virtualization/multipass/test_unreachable_call.patch 0 → 100644 +12 −0 Original line number Diff line number Diff line diff --git a/tests/test_common_callbacks.cpp b/tests/test_common_callbacks.cpp index ccae78e0..f9ab4423 100644 --- a/tests/test_common_callbacks.cpp +++ b/tests/test_common_callbacks.cpp @@ -73,6 +73,7 @@ struct TestLoggingSpinnerCallbacks : public TestSpinnerCallbacks, public WithPar default: assert(false && "shouldn't be here"); } + __builtin_unreachable(); } };
pkgs/tools/virtualization/multipass/vcpkg_no_install.patch 0 → 100644 +83 −0 Original line number Diff line number Diff line 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") endif() -set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/3rd-party/vcpkg/scripts/buildsystems/vcpkg.cmake" - CACHE STRING "Vcpkg toolchain file") - 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)