Skip to content

Commit

Permalink
Add linux-ppc build support
Browse files Browse the repository at this point in the history
  • Loading branch information
hpckurt committed Dec 21, 2024
1 parent 6e6515e commit b6d11b3
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 12 deletions.
29 changes: 21 additions & 8 deletions libmamba/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,18 +463,31 @@ macro(libmamba_create_target target_name linkage output_name)
mamba_target_check_type(reproc STATIC_LIBRARY FATAL_ERROR)
mamba_target_check_type(reproc++ STATIC_LIBRARY FATAL_ERROR)

target_link_libraries(
${target_name}
PUBLIC fmt::fmt-header-only spdlog::spdlog_header_only yaml-cpp::yaml-cpp
PRIVATE
if(PPC32)
target_link_libraries(
${target_name}
PUBLIC fmt::fmt-header-only spdlog::spdlog_header_only yaml-cpp::yaml-cpp
PRIVATE
reproc
reproc++
simdjson::simdjson_static
solv::libsolv_static
solv::libsolvext_static
simdjson
libsolv
libsolvext
solv::cpp
)

else()
target_link_libraries(
${target_name}
PUBLIC fmt::fmt-header-only spdlog::spdlog_header_only yaml-cpp::yaml-cpp
PRIVATE
reproc
reproc++
simdjson::simdjson_static
solv::libsolv_static
solv::libsolvext_static
solv::cpp
)
endif()
if(UNIX)

set(
Expand Down
2 changes: 2 additions & 0 deletions libmamba/ext/solv-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ find_package(Libsolv REQUIRED)
if(BUILD_SHARED)
set(LIBSOLV_DEPS solv::libsolv solv::libsolvext)
set_target_properties(solv-cpp PROPERTIES POSITION_INDEPENDENT_CODE ON)
elseif(BUILD_PPC32)
set(LIBSOLV_DEPS libsolv libsolvext)
else()
set(LIBSOLV_DEPS solv::libsolv_static solv::libsolvext_static)
endif()
Expand Down
3 changes: 3 additions & 0 deletions libmamba/include/mamba/specs/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace mamba::specs
linux_aarch64,
linux_ppc64le,
linux_ppc64,
linux_ppc,
linux_s390x,
linux_riscv32,
linux_riscv64,
Expand Down Expand Up @@ -181,6 +182,8 @@ namespace mamba::specs
return "linux-ppc64";
case KnownPlatform::linux_ppc64le:
return "linux-ppc64le";
case KnownPlatform::linux_ppc:
return "linux-ppc";
case KnownPlatform::linux_s390x:
return "linux-s390x";
case KnownPlatform::linux_riscv32:
Expand Down
18 changes: 14 additions & 4 deletions libmamba/src/specs/conda_url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#include "mamba/util/encoding.hpp"
#include "mamba/util/string.hpp"


namespace mamba::specs

{
/**
* Find the location of "/os-arch"-like subsring.
Expand Down Expand Up @@ -377,10 +379,17 @@ namespace mamba::specs
// Must not decode to find the meaningful '/' separators
if (has_archive_extension(path(Decode::no)))
{
auto l_path = clear_path();
const auto pos = std::min(std::min(l_path.rfind('/'), l_path.size()) + 1ul, l_path.size());
l_path.replace(pos, std::string::npos, pkg);
Base::set_path(std::move(l_path), Encode::no);
#ifdef __powerpc__
//The other three lines from below result in a failed build on ppc32
auto l_path = clear_path();
#else


auto l_path = clear_path();
const auto pos = std::min(std::min(l_path.rfind('/'), l_path.size()) + 1ul, l_path.size());
l_path.replace(pos, std::string::npos, pkg);
Base::set_path(std::move(l_path), Encode::no);
#endif
}
else
{
Expand Down Expand Up @@ -540,6 +549,7 @@ namespace mamba::specs
}
}
}
#undef PPC32

auto
std::hash<mamba::specs::CondaURL>::operator()(const mamba::specs::CondaURL& u) const -> std::size_t
Expand Down
3 changes: 3 additions & 0 deletions libmamba/src/specs/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace mamba::specs
|| (plat == KnownPlatform::linux_aarch64) //
|| (plat == KnownPlatform::linux_ppc64le) //
|| (plat == KnownPlatform::linux_ppc64) //
|| (plat == KnownPlatform::linux_ppc) //
|| (plat == KnownPlatform::linux_s390x) //
|| (plat == KnownPlatform::linux_riscv32) //
|| (plat == KnownPlatform::linux_riscv64);
Expand Down Expand Up @@ -101,6 +102,8 @@ namespace mamba::specs
#else
return KnownPlatform::linux_ppc64le;
#endif
#elif defined(__powerpc__) || defined(__ppc__)
return KnownPlatform::linux_ppc;
#elif defined(__s390x__)
return KnownPlatform::linux_s390x;
#elif defined(__riscv) && defined(__riscv_xlen) && (__riscv_xlen == 32)
Expand Down
1 change: 1 addition & 0 deletions libmambapy/src/libmambapy/bindings/specs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ namespace mambapy
.value("linux_aarch64", KnownPlatform::linux_aarch64)
.value("linux_ppc64le", KnownPlatform::linux_ppc64le)
.value("linux_ppc64", KnownPlatform::linux_ppc64)
.value("linux_ppc", KnownPlatform::linux_ppc)
.value("linux_s390x", KnownPlatform::linux_s390x)
.value("linux_riscv32", KnownPlatform::linux_riscv32)
.value("linux_riscv64", KnownPlatform::linux_riscv64)
Expand Down

0 comments on commit b6d11b3

Please sign in to comment.