mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
cpuid: new recipe.
This commit is contained in:
45
sys-apps/cpuid/cpuid-1.8.3.recipe
Normal file
45
sys-apps/cpuid/cpuid-1.8.3.recipe
Normal file
@@ -0,0 +1,45 @@
|
||||
SUMMARY="Dump and extract information from the x86 CPUID instruction"
|
||||
DESCRIPTION="cpuid is capable of dumping all CPUID leaves (except any unknown leaves which \
|
||||
require special ECX values to dump all information). cpuid can only decode certain leaves, \
|
||||
but this functionality will be expanded as the CPUID specifications provided by AMD and Intel \
|
||||
change."
|
||||
HOMEPAGE="https://github.com/tycho/cpuid/"
|
||||
COPYRIGHT="2010-2025 Steven Noonan"
|
||||
LICENSE="ISC"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/tycho/cpuid/archive/refs/tags/$portVersion.tar.gz"
|
||||
SOURCE_FILENAME="$portBaseName-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="d7edd2771476aab2f56ba950be0b0433dc136fd827507e81d9a68b83adaa1a9a"
|
||||
PATCHES="$portBaseName-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="all !x86_gcc2"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
PROVIDES="
|
||||
cpuid$secondaryArchSuffix = $portVersion
|
||||
cmd:cpuid = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:make
|
||||
cmd:perl
|
||||
cmd:which
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
make $jobArgs
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
mkdir -p $prefix/bin
|
||||
cp -a cpuid $prefix/bin
|
||||
}
|
||||
15
sys-apps/cpuid/licenses/ISC
Normal file
15
sys-apps/cpuid/licenses/ISC
Normal file
@@ -0,0 +1,15 @@
|
||||
ISC license
|
||||
|
||||
Copyright (c) 2010-2025, Steven Noonan <steven@uplinklabs.net>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
76
sys-apps/cpuid/patches/cpuid-1.8.3.patchset
Normal file
76
sys-apps/cpuid/patches/cpuid-1.8.3.patchset
Normal file
@@ -0,0 +1,76 @@
|
||||
From 9c8cad858d712e36468c8925eb3fd5ceb5d7d337 Mon Sep 17 00:00:00 2001
|
||||
From: Oscar Lesta <oscar.lesta@gmail.com>
|
||||
Date: Thu, 11 Sep 2025 12:27:29 -0300
|
||||
Subject: Initial Haiku support.
|
||||
|
||||
Built and tested on:
|
||||
|
||||
- Haiku beta5 x86_64 bits.
|
||||
- Haiku nightly (hrev59030) x86_32 bits.
|
||||
|
||||
On bare-metal, VBox, and under VMware.
|
||||
|
||||
diff --git a/GNUmakefile b/GNUmakefile
|
||||
index 19f5a04..8215c9a 100644
|
||||
--- a/GNUmakefile
|
||||
+++ b/GNUmakefile
|
||||
@@ -103,6 +103,10 @@ CFLAGS += -pthread
|
||||
LDFLAGS += -pthread
|
||||
endif
|
||||
|
||||
+ifeq ($(uname_S),Haiku)
|
||||
+LDFLAGS += -lgnu
|
||||
+endif
|
||||
+
|
||||
ifneq ($(findstring MINGW,$(uname_S))$(findstring MSYS,$(uname_S)),)
|
||||
LDFLAGS += -lpthread -lwinmm
|
||||
endif
|
||||
diff --git a/threads.c b/threads.c
|
||||
index a42016a..f096b34 100644
|
||||
--- a/threads.c
|
||||
+++ b/threads.c
|
||||
@@ -49,6 +49,20 @@
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
|
||||
+#elif defined(TARGET_OS_HAIKU)
|
||||
+
|
||||
+#include <pthread.h>
|
||||
+#include <sched.h>
|
||||
+
|
||||
+#define CPUSET_T cpuset_t
|
||||
+#define CPUSET_MASK_T cpuset_mask
|
||||
+
|
||||
+#include <BeBuild.h>
|
||||
+
|
||||
+#if (B_HAIKU_VERSION <= B_HAIKU_VERSION_1_BETA_5)
|
||||
+ #define CPU_ZERO CPUSET_ZERO
|
||||
+#endif
|
||||
+
|
||||
#elif defined(TARGET_OS_SOLARIS)
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@@ -195,7 +209,7 @@ int thread_bind_native(__unused_variable struct cpuid_state_t *state, uint32_t i
|
||||
|
||||
return (ret != FALSE) ? 0 : 1;
|
||||
|
||||
-#elif defined(TARGET_OS_LINUX) || defined(TARGET_OS_FREEBSD)
|
||||
+#elif defined(TARGET_OS_LINUX) || defined(TARGET_OS_FREEBSD) || defined(TARGET_OS_HAIKU)
|
||||
|
||||
int ret;
|
||||
|
||||
@@ -232,7 +246,11 @@ int thread_bind_native(__unused_variable struct cpuid_state_t *state, uint32_t i
|
||||
|
||||
mask = 1ULL << (unsigned long long)id;
|
||||
|
||||
+#if defined(TARGET_OS_HAIKU)
|
||||
+ ((unsigned long *)set[set_id].bits)[subset_id] |= mask;
|
||||
+#else
|
||||
((unsigned long *)set[set_id].__bits)[subset_id] |= mask;
|
||||
+#endif
|
||||
ret = pthread_setaffinity_np(pth, setsize, set);
|
||||
free(set);
|
||||
#endif
|
||||
--
|
||||
2.50.1
|
||||
|
||||
Reference in New Issue
Block a user