Build micromamba win with feedstock (#2859)

* Try CI

* Remove useless header

* Try mixing static windows build with Conda

* More packages from conda-forge

* Move to yaml-cpp>=0.8.0

* Ensure proper yaml-cpp target

* Use yaml-cpp-static on Windows

* Fix versions

* Use libsolv-static from Conda-Forge
This commit is contained in:
Antoine Prouvost 2023-09-27 10:32:47 +02:00 committed by GitHub
parent f720e2d7fa
commit be30af600a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 45 additions and 174 deletions

View File

@ -119,17 +119,29 @@ jobs:
shell: cmd
# remove libsolv overlay-ports once https://github.com/microsoft/vcpkg/pull/31275 is released
run: |
vcpkg install --overlay-ports=.\ports\libsolv --triplet x64-windows-static-md
vcpkg install --triplet x64-windows-static-md
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: sccache-${{ github.job }}-win-64
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
- uses: mamba-org/setup-micromamba@v1
with:
environment-name: mambabuild
init-shell: bash cmd.exe
create-args: >-
cli11>=2.2,<3
cpp-expected
nlohmann_json
spdlog
fmt
yaml-cpp-static>=0.8.0
libsolv-static>=0.7.24
- name: build micromamba
shell: cmd
shell: cmd /C call {0}
run: |
set CMAKE_PREFIX_PATH=.\vcpkg_installed\x64-windows-static-md
set CMAKE_PREFIX_PATH=.\vcpkg_installed\x64-windows-static-md;%CONDA_PREFIX%\Library
cmake -S . ^
-B build ^
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache ^

View File

@ -23,6 +23,7 @@ set(MAMBA_LTO "Default" CACHE STRING "Apply Link Time Optimization to targets")
include("cmake/CompilerWarnings.cmake")
include("cmake/LinkTimeOptimization.cmake")
include("cmake/Checks.cmake")
if (MSVC)
# NOMINMAX : prevent tons of code to be included when having to `#include <windows.h>`

16
cmake/Checks.cmake Normal file
View File

@ -0,0 +1,16 @@
# Module to make checks/assertions
# Check that the target has the proper type.
#
# This is useful for targets that can be either static or dynamic but have the
# same name.
function(mamba_target_check_type target expected_type log_level)
get_target_property(actual_type ${target} TYPE)
if(NOT actual_type STREQUAL expected_type)
message(
${log_level}
"Expected type \"${expected_type}\" for target \"${target}\""
" but found \"${actual_type}\""
)
endif()
endfunction()

View File

@ -319,6 +319,7 @@ find_package(fmt REQUIRED)
find_package(spdlog REQUIRED)
find_package(tl-expected REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(yaml-cpp REQUIRED)
macro(libmamba_create_target target_name linkage output_name)
string(TOUPPER "${linkage}" linkage_upper)
@ -351,6 +352,9 @@ macro(libmamba_create_target target_name linkage output_name)
if (${linkage_upper} STREQUAL "STATIC")
message(" -> Statically linking against libmamba (static) dependencies")
mamba_target_check_type(yaml-cpp::yaml-cpp STATIC_LIBRARY FATAL_ERROR)
if (UNIX)
set(REQUIRED_STATIC_DEPS
@ -380,8 +384,6 @@ macro(libmamba_create_target target_name linkage output_name)
libnghttp2.a
libyaml-cpp.a
libreproc++.a
libreproc.a
)
@ -436,6 +438,7 @@ macro(libmamba_create_target target_name linkage output_name)
${MAMBA_FORCE_DYNAMIC_LIBS}
fmt::fmt-header-only
spdlog::spdlog_header_only
yaml-cpp::yaml-cpp
)
elseif (WIN32)
@ -445,7 +448,6 @@ macro(libmamba_create_target target_name linkage output_name)
# For Windows we have a vcpkg based build system right now.
find_package(LibArchive REQUIRED)
find_package(CURL CONFIG REQUIRED)
find_package(yaml-cpp CONFIG REQUIRED)
find_library(LIBLZMA_LIBRARIES lzma REQUIRED)
find_library(LZ4_LIBRARY NAMES lz4)
find_library(LZO2_LIBRARY NAMES lzo2)
@ -479,7 +481,7 @@ macro(libmamba_create_target target_name linkage output_name)
# header only version to avoid chasing after the correct fmt version mathching
# the one used in the bundle
spdlog::spdlog_header_only
yaml-cpp
yaml-cpp::yaml-cpp
${LIBSOLV_BUILD_STATICRARIES}
${LIBSOLVEXT_BUILD_STATICRARIES}
${sodium_LIBRARY_RELEASE}
@ -499,6 +501,8 @@ macro(libmamba_create_target target_name linkage output_name)
else ()
message(" -> Dynamically linking against libmamba (shared) dependencies")
mamba_target_check_type(yaml-cpp::yaml-cpp SHARED_LIBRARY WARNING)
find_library(LIBSOLV_LIBRARIES NAMES solv)
find_library(LIBSOLVEXT_LIBRARIES NAMES solvext)
find_package(CURL REQUIRED)
@ -506,7 +510,6 @@ macro(libmamba_create_target target_name linkage output_name)
find_package(zstd REQUIRED)
find_package(BZip2 REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(yaml-cpp CONFIG REQUIRED)
find_package(reproc++ CONFIG REQUIRED)
set(LIBMAMBA_LIBRARIES_DEPS
@ -518,7 +521,7 @@ macro(libmamba_create_target target_name linkage output_name)
${OPENSSL_LIBRARIES}
zstd::libzstd_shared
BZip2::BZip2
yaml-cpp
yaml-cpp::yaml-cpp
reproc++
reproc
fmt::fmt

View File

@ -13,7 +13,7 @@ dependencies:
- doctest
- cpp-expected
- reproc-cpp
- yaml-cpp
- yaml-cpp >=0.8.0
- cli11 >=2.2
- spdlog
- fmt

View File

@ -14,7 +14,7 @@ dependencies:
- gmock
- cpp-expected
- reproc-cpp
- yaml-cpp
- yaml-cpp >=0.8.0
- cli11 >=2.2
- spdlog
- fmt

View File

@ -14,7 +14,7 @@ dependencies:
- gmock
- cpp-expected
- reproc-cpp
- yaml-cpp
- yaml-cpp >= 0.8.0
- cli11 >=2.2
- spdlog
- fmt

View File

@ -15,7 +15,7 @@ dependencies:
- gmock
- cpp-expected
- reproc-cpp
- yaml-cpp
- yaml-cpp >=0.8.0
- cli11 >=2.2
- pytest >=7.3.0
- pytest-asyncio

View File

@ -21,7 +21,6 @@
#include "mamba/core/output.hpp"
#include "mamba/core/thread_utils.hpp"
#include "mamba/core/util_os.hpp"
#include "mamba/core/util_scope.hpp"
#include "mamba/version.hpp"
#include "umamba.hpp"

View File

@ -1,59 +0,0 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO openSUSE/libsolv
REF "${VERSION}"
SHA512 a0975d3f80ae8c364d5b32df4c26bc7eb5abb3be81259595848f1f5f74b00e708af3153074041d49383547718e68cee2e82cf4bdeab6221dfdcc605812689d37
HEAD_REF master
PATCHES
windows.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_DYNAMIC_LIBS)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS)
if (NOT BUILD_DYNAMIC_LIBS)
set(DISABLE_SHARED ON)
else()
set(DISABLE_SHARED OFF)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
perl ENABLE_PERL
python ENABLE_PYTHON
ruby ENABLE_RUBY
tcl ENABLE_TCL
comps ENABLE_COMPS
helixrepo ENABLE_HELIXREPO
debian ENABLE_DEBIAN
cudfrepo ENABLE_CUDFREPO
conda ENABLE_CONDA
lzma-compression ENABLE_LZMA_COMPRESSION
bzip2-compression ENABLE_BZIP2_COMPRESSION
zstd-compression ENABLE_ZSTD_COMPRESSION
)
if(WIN32)
list(APPEND FEATURE_OPTIONS "-DWITHOUT_COOKIEOPEN=ON")
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
${FEATURE_OPTIONS}
-DDISABLE_SHARED=${DISABLE_SHARED}
-DENABLE_STATIC=${BUILD_STATIC_LIBS}
-DMULTI_SEMANTICS=ON
..
)
vcpkg_install_cmake()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.BSD")

View File

@ -1,76 +0,0 @@
{
"dependencies": [
{
"host": true,
"name": "vcpkg-cmake"
},
{
"host": true,
"name": "vcpkg-cmake-config"
},
"zlib"
],
"description": "Library for solving packages and reading repositories",
"features": {
"bzip2-compression": {
"dependencies": [
"bzip2"
],
"description": "Build with bzip2 compression support"
},
"comps": {
"dependencies": [
"expat"
],
"description": "Build with fedora comps support"
},
"conda": {
"description": "Build with conda dependency support"
},
"cudfrepo": {
"description": "Build with cudf repository support"
},
"debian": {
"description": "Build with debian database/repository support"
},
"helixrepo": {
"description": "Build with helix repository support"
},
"lzma-compression": {
"dependencies": [
"liblzma"
],
"description": "Build with lzma/xz compression support"
},
"perl": {
"description": "Build perl bindings"
},
"python": {
"dependencies": [
"python3",
{
"host": true,
"name": "python3"
}
],
"description": "Enable Python bindings"
},
"ruby": {
"description": "Build ruby bindings"
},
"tcl": {
"description": "Build Tcl bindings"
},
"zstd-compression": {
"dependencies": [
"zstd"
],
"description": "Build with zstd compression support"
}
},
"homepage": "https://github.com/openSUSE/libsolv",
"license": "BSD-3-Clause",
"name": "libsolv",
"supports": "!uwp",
"version": "0.7.24"
}

View File

@ -1,13 +0,0 @@
diff --git a/src/repo_write.c b/src/repo_write.c
index a73eebff..9e0622e3 100644
--- a/src/repo_write.c
+++ b/src/repo_write.c
@@ -188,7 +188,7 @@ write_compressed_blob(Repodata *data, void *blob, int len)
write_u8(data, clen);
write_blob(data, cpage, clen);
}
- blob += chunk;
+ blob = (char*) blob + chunk;
len -= chunk;
}
}

View File

@ -1,21 +1,9 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"dependencies": [
{
"features": [
"conda"
],
"name": "libsolv"
},
"zstd",
"nlohmann-json",
"tl-expected",
"curl",
"yaml-cpp",
"reproc",
"fmt",
"spdlog",
"cli11",
{
"name": "winreg",
"platform": "windows"