diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index 851cf0d38f..9a872c71cf 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -70,6 +70,21 @@ jobs: run: | cd micromamba-feedstock/ sed -i '' '/conda_forge_output_validation/d' conda-forge.yml + # Already applied upstream in mamba; feedstock patch is for released tarballs only. + - name: Remove psl dependencies patch + run: | + python3 - <<'PY' + from pathlib import Path + + path = Path("micromamba-feedstock/recipe/meta.yaml") + path.write_text( + "".join( + line + for line in path.read_text().splitlines(keepends=True) + if "0001-psl-dependencies.patch" not in line + ) + ) + PY - name: Checkout mamba branch uses: actions/checkout@v7 with: @@ -178,6 +193,7 @@ jobs: reproc-cpp-static>=14.2.4.post0 libmsgpack-c-static libcurl-static>=8.4.0 + libpsl-static libarchive-minimal-static zstd-static zlib diff --git a/dev/environment-micromamba-static.yml b/dev/environment-micromamba-static.yml index 213a50a0d4..703333834d 100644 --- a/dev/environment-micromamba-static.yml +++ b/dev/environment-micromamba-static.yml @@ -24,6 +24,7 @@ dependencies: - reproc-cpp-static >=14.2.4.post0 - libcurl >=8.4.0 - libcurl-static >=8.4.0 + - libpsl-static - libmsgpack-c-static - xz-static - libssh2-static diff --git a/libmamba/CMakeLists.txt b/libmamba/CMakeLists.txt index f8fe3eb4ca..2f10878112 100644 --- a/libmamba/CMakeLists.txt +++ b/libmamba/CMakeLists.txt @@ -511,6 +511,7 @@ macro(libmamba_create_target target_name linkage output_name) set( REQUIRED_STATIC_DEPS libcurl.a + libpsl.a libssh2.a libgssapi_krb5.a libkrb5.a @@ -624,6 +625,7 @@ macro(libmamba_create_target target_name linkage output_name) libssl_static.lib libcrypto_static.lib libcurl_a.lib + libpsl.a ) set(STATIC_DEPS "") @@ -644,7 +646,19 @@ macro(libmamba_create_target target_name linkage output_name) target_link_libraries(${target_name} PUBLIC ${SYSTEM_PROVIDED_LIBRARIES} ${STATIC_DEPS}) - add_compile_definitions(LIBARCHIVE_STATIC CURL_STATICLIB) + # Necessary for properly linking static libraries. + add_compile_definitions( + # See: + # https://github.com/libarchive/libarchive/blob/19ff56da4f4790064346579a1a7f18a0230b0ac6/libarchive/archive_entry.h#L134-L158 + LIBARCHIVE_STATIC + # See: + # https://github.com/curl/curl/blob/1d7b8e6c29e22c88750fb53a01e30be03104a3fd/docs/FAQ.md?plain=1#L1074-L1077 + CURL_STATICLIB + # See: + # https://github.com/rockdaboot/libpsl/blob/8c06e95b8878f6b80613d7628486056728429d09/include/libpsl.h.in#L45-L55 + PSL_STATIC + ) + include_directories("${_mamba_deps_prefix}/include/") endif() else()