mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
libcpuid, new recipe (#7941)
This commit is contained in:
83
dev-libs/libcpuid/libcpuid-0.6.3~git.recipe
Normal file
83
dev-libs/libcpuid/libcpuid-0.6.3~git.recipe
Normal file
@@ -0,0 +1,83 @@
|
||||
SUMMARY="A small C library for x86 (and x86_64) CPU detection and feature extraction"
|
||||
DESCRIPTION="libcpuid provides CPU identification for the x86 (and x86_64).
|
||||
For details about the programming API, you might want to take a look at the project's website \
|
||||
on sourceforge:
|
||||
* http://libcpuid.sourceforge.net/.
|
||||
There you'd find a short tutorial:
|
||||
* http://libcpuid.sf.net/documentation.html
|
||||
As well as the full API reference:
|
||||
* http://libcpuid.sf.net/doxy."
|
||||
HOMEPAGE="http://libcpuid.sourceforge.net/"
|
||||
COPYRIGHT="2008 Veselin Georgiev"
|
||||
LICENSE="BSD (2-clause)"
|
||||
REVISION="1"
|
||||
srcGitRev="54ed9a0a17797982c82a7053d1386e42cecf4a9f"
|
||||
SOURCE_URI="https://github.com/anrieff/libcpuid/archive/$srcGitRev.tar.gz"
|
||||
CHECKSUM_SHA256="77b8ec25a7c9ba21d6d330f80a07d4fd35d276e14712e5fc5c138f14a8ec943a"
|
||||
SOURCE_FILENAME="libcpuid-v$portVersion.tar.gz"
|
||||
SOURCE_DIR="libcpuid-$srcGitRev"
|
||||
PATCHES="186.patch
|
||||
libcpuid-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="all !x86_gcc2"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
commandBinDir=$binDir
|
||||
commandSuffix=$secondaryArchSuffix
|
||||
if [ "$targetArchitecture" = x86_gcc2 ]; then
|
||||
commandSuffix=
|
||||
commandBinDir=$prefix/bin
|
||||
fi
|
||||
|
||||
PROVIDES="
|
||||
libcpuid$secondaryArchSuffix = $portVersion
|
||||
cmd:cpuid_tool$commandSuffix
|
||||
lib:libcpuid$secondaryArchSuffix = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
"
|
||||
|
||||
PROVIDES_devel="
|
||||
libcpuid${secondaryArchSuffix}_devel = $portVersion
|
||||
devel:libcpuid$secondaryArchSuffix = $portVersion
|
||||
"
|
||||
REQUIRES_devel="
|
||||
libcpuid$secondaryArchSuffix == $portVersion base
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:cmake
|
||||
cmd:doxygen
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:make
|
||||
"
|
||||
|
||||
|
||||
BUILD()
|
||||
{
|
||||
cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=Release \
|
||||
$cmakeDirArgs \
|
||||
-DCMAKE_INSTALL_BINDIR=$commandBinDir
|
||||
make -C build
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
make -C build install
|
||||
|
||||
prepareInstalledDevelLib libcpuid
|
||||
fixPkgconfig
|
||||
|
||||
packageEntries devel \
|
||||
$developDir \
|
||||
$libDir/cmake
|
||||
}
|
||||
|
||||
TEST()
|
||||
{
|
||||
make check
|
||||
}
|
||||
22
dev-libs/libcpuid/patches/186.patch
Normal file
22
dev-libs/libcpuid/patches/186.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
From 6f4a723e6d44b44d1508c06d278d988522c04416 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Kausch <robert.kausch@freac.org>
|
||||
Date: Fri, 10 Mar 2023 00:59:04 +0100
|
||||
Subject: [PATCH] Query CPU info at least once even if set_cpu_affinity() fails
|
||||
|
||||
---
|
||||
libcpuid/cpuid_main.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libcpuid/cpuid_main.c b/libcpuid/cpuid_main.c
|
||||
index 358dedd..568ce92 100644
|
||||
--- a/libcpuid/cpuid_main.c
|
||||
+++ b/libcpuid/cpuid_main.c
|
||||
@@ -1076,7 +1076,7 @@ int cpuid_get_all_raw_data(struct cpu_raw_data_array_t* data)
|
||||
bool affinity_saved = save_cpu_affinity();
|
||||
|
||||
cpu_raw_data_array_t_constructor(data, true);
|
||||
- while (set_cpu_affinity(logical_cpu)) {
|
||||
+ while (set_cpu_affinity(logical_cpu) || logical_cpu == 0) {
|
||||
debugf(2, "Getting raw dump for logical CPU %i\n", logical_cpu);
|
||||
cpuid_grow_raw_data_array(data, logical_cpu + 1);
|
||||
raw_ptr = &data->raw[logical_cpu];
|
||||
39
dev-libs/libcpuid/patches/libcpuid-0.6.3~git.patchset
Normal file
39
dev-libs/libcpuid/patches/libcpuid-0.6.3~git.patchset
Normal file
@@ -0,0 +1,39 @@
|
||||
From 68d98bb470cf136dd39d19572ac3af758e7f8c65 Mon Sep 17 00:00:00 2001
|
||||
From: begasus <begasus@gmail.com>
|
||||
Date: Fri, 10 Mar 2023 19:10:44 +0100
|
||||
Subject: libcpuid, respect install paths given by $cmakeDirArgs
|
||||
|
||||
|
||||
diff --git a/libcpuid/CMakeLists.txt b/libcpuid/CMakeLists.txt
|
||||
index d285f8b..2713766 100644
|
||||
--- a/libcpuid/CMakeLists.txt
|
||||
+++ b/libcpuid/CMakeLists.txt
|
||||
@@ -58,7 +58,7 @@ endif()
|
||||
|
||||
# Configuration
|
||||
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
||||
-set(config_install_dir "lib/cmake/${PROJECT_NAME}")
|
||||
+set(config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
||||
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
|
||||
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
|
||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
||||
@@ -78,11 +78,11 @@ configure_package_config_file("${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in" "${p
|
||||
install(
|
||||
TARGETS cpuid
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
- LIBRARY DESTINATION "lib"
|
||||
- ARCHIVE DESTINATION "lib"
|
||||
- RUNTIME DESTINATION "bin"
|
||||
- INCLUDES DESTINATION "include/libcpuid"
|
||||
- PUBLIC_HEADER DESTINATION "include/libcpuid")
|
||||
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
+ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libcpuid"
|
||||
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libcpuid")
|
||||
|
||||
install(
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
--
|
||||
2.37.3
|
||||
|
||||
Reference in New Issue
Block a user