mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-13 11:19:50 +03:00
33 lines
1.4 KiB
Diff
33 lines
1.4 KiB
Diff
From: Jakub Jirutka <jakub@jirutka.cz>
|
|
Date: Sat, 11 Dec 2021 23:20:00 +0100
|
|
Subject: [PATCH] Allow to override default_platform
|
|
|
|
`getauxval(AT_PLATFORM)` works as intended only on x86_64 and aarch64.
|
|
It returns v8lmain on armhf and armv7, power9main on ppc64le, i686main
|
|
on x86.
|
|
|
|
This is a low-effort patch, a better solution would be utsname.
|
|
|
|
--- a/src/main.cpp
|
|
+++ b/src/main.cpp
|
|
@@ -18,7 +21,9 @@
|
|
int main(int argc, char ** argv) {
|
|
cxxopts::Options options("libtree", "Show the dependency tree of binaries and optionally bundle them into a single folder.");
|
|
|
|
-#if defined(LIBTREE_HAS_AUXV_HEADER)
|
|
+#if defined(LIBTREE_DEFAULT_PLATFORM)
|
|
+ auto default_platform = LIBTREE_DEFAULT_PLATFORM;
|
|
+#elif defined(LIBTREE_HAS_AUXV_HEADER)
|
|
auto default_platform = reinterpret_cast<char const *>(getauxval(AT_PLATFORM));
|
|
#else
|
|
// Default to x86_64 substitution for PLATFORM if getauxval is not available.
|
|
--- a/CMakeLists.txt
|
|
+++ b.CMakeLists.txt
|
|
@@ -35,6 +35,7 @@
|
|
add_executable(libtree ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
|
|
target_link_libraries(libtree libtree_lib cxxopts::cxxopts)
|
|
target_compile_definitions(libtree PRIVATE $<$<BOOL:${LIBTREE_HAS_AUXV_HEADER}>:LIBTREE_HAS_AUXV_HEADER>)
|
|
+target_compile_definitions(libtree PRIVATE LIBTREE_DEFAULT_PLATFORM=\"${LIBTREE_DEFAULT_PLATFORM}\")
|
|
|
|
set_property(TARGET libtree_lib PROPERTY CXX_STANDARD 17)
|
|
set_property(TARGET libtree PROPERTY CXX_STANDARD 17)
|