sys-process/cpu-x: version bump

mhiretskiy 1870
Alexander Tratsevskiy 4 years ago
parent cc39588702
commit a655b625ab

@ -0,0 +1 @@
DIST libcpuid-0.4.1.tar.gz 132126 BLAKE2B 9697ef1eda72a3412243c55c4695216fc6a82421a89b60f7c33d2405fe7bde727d95fd6bfb1d4b0ee216efd47fa03cac4f34815b0394c8ddb5e9d6821fd7f2f7 SHA512 2644d6f6c12f7290f2b562726fa66becb77f0ebcc415bac41458513b9f1b5b5a9afdaa5e68a6766b7fe3d7e242ada3c42ecae61ff111dc1f118e56a4edc3abb2

@ -0,0 +1,24 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit autotools
DESCRIPTION="A small C library for x86 (and x86_64) CPU detection and feature extraction"
HOMEPAGE="http://libcpuid.sourceforge.net"
SRC_URI="https://github.com/anrieff/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="BSD-2"
SLOT="0/14"
KEYWORDS="-* amd64 x86"
IUSE="test"
RESTRICT="primaryuri"
src_prepare() {
default
eautoreconf
}
src_test() {
emake test
}

@ -0,0 +1 @@
DIST cpu-x-3.2.4.tar.gz 1834895 BLAKE2B 834e6a11bfcff24c19fb284c4e5769dcf57d6734094bdb9d4b29114d8838da9ff249758f20f21dc44adbae1e9669d3e1be061767605eb7a33f77342056ce28a4 SHA512 67b3d9f3fe29f1164bfb4ffcd686196974300feebf702b4c4bf45490a0c5107b7d32f5800a279fc7d570c9830cf8881df15c09e5ce5389fdf1e947a3c877fa0c

@ -0,0 +1,76 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit cmake-utils xdg
MY_PN="CPU-X"
DESCRIPTION="A Free software that gathers information on CPU, motherboard and more"
HOMEPAGE="https://x0rg.github.io/CPU-X"
SRC_URI="https://github.com/X0rg/${MY_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="-* amd64 x86"
IUSE="+bandwidth check-update +dmidecode force-libstatgrab +gtk ignore-staticlibs +libcpuid +libpci +ncurses +nls portable"
REQUIRED_USE="ignore-staticlibs? ( portable )"
RESTRICT="primaryuri"
DEPEND="
check-update? (
dev-libs/json-c:=
net-misc/curl
)
!force-libstatgrab? ( sys-process/procps:= )
force-libstatgrab? ( sys-libs/libstatgrab )
gtk? ( >=x11-libs/gtk+-3.12:3 )
libcpuid? ( >=sys-libs/libcpuid-0.3.0:= )
libpci? ( sys-apps/pciutils )
ncurses? ( sys-libs/ncurses:= )
"
BDEPEND="
dev-lang/nasm
nls? ( sys-devel/gettext )
"
RDEPEND="${DEPEND}"
S="${WORKDIR}/${MY_PN}-${PV}"
PATCHES=(
"${FILESDIR}/${P}-custom-build-fix.patch"
"${FILESDIR}/${P}-static-libs-fix.patch"
)
src_prepare() {
cmake-utils_src_prepare
}
src_configure() {
local mycmakeargs=(
-DWITH_GTK=$(usex gtk)
-DWITH_NCURSES=$(usex ncurses)
-DWITH_GETTEXT=$(usex nls)
-DWITH_LIBCURL=$(usex check-update)
-DWITH_LIBJSONC=$(usex check-update)
-DWITH_LIBCPUID=$(usex libcpuid)
-DWITH_LIBPCI=$(usex libpci)
-DWITH_LIBSTATGRAB=OFF
-DWITH_DMIDECODE=$(usex dmidecode)
-DWITH_BANDWIDTH=$(usex bandwidth)
-DFORCE_LIBSTATGRAB=$(usex force-libstatgrab)
-DPORTABLE_BINARY=$(usex portable)
-DIGNORE_STATICLIBS=$(usex ignore-staticlibs)
)
cmake-utils_src_configure
}
pkg_postinst() {
xdg_pkg_postinst
ewarn "Please make sure that \`lm_sensors\` is correctly configured."
ewarn "Otherwise \`cpu-x\` may have some difficulty in obtaining the CPU temperature or voltage."
ewarn "For more information, see https://wiki.gentoo.org/wiki/Lm_sensors."
}

@ -0,0 +1,68 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit cmake-utils git-r3 xdg
MY_PN="CPU-X"
DESCRIPTION="A Free software that gathers information on CPU, motherboard and more"
HOMEPAGE="https://x0rg.github.io/CPU-X"
EGIT_REPO_URI="https://github.com/X0rg/${MY_PN}.git"
LICENSE="GPL-3+"
SLOT="0"
IUSE="+bandwidth check-update +dmidecode force-libstatgrab +gtk +libcpuid +libpci +ncurses +nls"
DEPEND="
check-update? (
dev-libs/json-c:=
net-misc/curl
)
force-libstatgrab? ( sys-libs/libstatgrab )
!force-libstatgrab? ( sys-process/procps:= )
gtk? ( >=x11-libs/gtk+-3.12:3 )
libcpuid? ( >=sys-libs/libcpuid-0.3.0:= )
libpci? ( sys-apps/pciutils )
ncurses? ( sys-libs/ncurses:= )
"
BDEPEND="
dev-lang/nasm
nls? ( sys-devel/gettext )
"
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}/${P}-custom-build-fix.patch"
)
src_prepare() {
cmake-utils_src_prepare
}
src_configure() {
local mycmakeargs=(
-DWITH_GTK=$(usex gtk)
-DWITH_NCURSES=$(usex ncurses)
-DWITH_GETTEXT=$(usex nls)
-DWITH_LIBCURL=$(usex check-update)
-DWITH_LIBJSONC=$(usex check-update)
-DWITH_LIBCPUID=$(usex libcpuid)
-DWITH_LIBPCI=$(usex libpci)
-DWITH_LIBSTATGRAB=OFF
-DWITH_DMIDECODE=$(usex dmidecode)
-DWITH_BANDWIDTH=$(usex bandwidth)
-DFORCE_LIBSTATGRAB=$(usex force-libstatgrab)
)
cmake-utils_src_configure
}
pkg_postinst() {
xdg_pkg_postinst
ewarn "Please make sure that \`lm_sensors\` is correctly configured."
ewarn "Otherwise \`cpu-x\` may have some difficulty in obtaining the CPU temperature or voltage."
ewarn "For more information, see https://wiki.gentoo.org/wiki/Lm_sensors."
}

@ -0,0 +1,81 @@
diff --git a/src/core.c b/src/core.c
index 04da983..c275231 100644
--- a/src/core.c
+++ b/src/core.c
@@ -75,10 +75,16 @@ int fill_labels(Labels *data)
int i, err = 0;
const uint8_t selected_page = opts->selected_page;
+#if HAS_LIBCPUID
if(HAS_LIBCPUID) err += call_libcpuid_static (data);
if(HAS_LIBCPUID) err += call_libcpuid_msr_static(data);
+#endif
+#if HAS_DMIDECODE
if(HAS_DMIDECODE) err += call_dmidecode (data);
+#endif
+#if HAS_LIBPCI
if(HAS_LIBPCI) err += find_devices (data);
+#endif
casprintf(&data->tab_cpu[VALUE][BUSSPEED], true, "%.2f MHz", data->bus_freq);
err += system_static (data);
@@ -103,15 +109,19 @@ int do_refresh(Labels *data)
switch(opts->selected_page)
{
case NO_CPU:
+#if HAS_LIBCPUID
if(HAS_LIBCPUID) err += err_func(call_libcpuid_dynamic, data);
if(HAS_LIBCPUID) err += err_func(call_libcpuid_msr_dynamic, data);
+#endif
err += err_func(cpu_usage, data);
err += fallback_mode_dynamic(data);
err += err_func(cputab_fill_multipliers, data);
break;
+#if HAS_BANDWIDTH
case NO_CACHES:
if(HAS_BANDWIDTH) err += err_func(call_bandwidth, data);
break;
+#endif
case NO_SYSTEM:
if(HAS_LIBSYSTEM) err += err_func(system_dynamic, data);
break;
@@ -1299,11 +1309,13 @@ static int fallback_mode_static(Labels *data)
{
int err = 0;
+#if HAS_LIBCPUID
if(HAS_LIBCPUID &&
(string_is_empty(data->tab_cpu[VALUE][PACKAGE]) ||
strstr(data->tab_cpu[VALUE][PACKAGE], "CPU") != NULL ||
strstr(data->tab_cpu[VALUE][PACKAGE], "Microprocessor") != NULL))
err += cputab_package_fallback(data);
+#endif
if(data->cpu_min_mult <= 0.0 || data->cpu_max_mult <= 0.0)
err += cputab_multipliers_fallback(data);
diff --git a/src/main.c b/src/main.c
index 6ed50f9..3674611 100644
--- a/src/main.c
+++ b/src/main.c
@@ -647,8 +647,10 @@ static void version(void)
{ false, NULL, NULL }
};
+#if HAS_WEB_SUPPORT
if(HAS_WEB_SUPPORT)
check_new_version();
+#endif
MSG_STDOUT("%s %s %s", PRGNAME, PRGVER, new_version[1]);
MSG_STDOUT("%s\n", PRGCPRGHT);
@@ -972,8 +974,10 @@ int main(int argc, char *argv[])
labels_setname(data);
fill_labels (data);
+#if HAS_WEB_SUPPORT
if(HAS_WEB_SUPPORT)
check_new_version();
+#endif
/* Show data */
if(HAS_GTK && (opts->output_type == OUT_GTK))

@ -0,0 +1,22 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9149a6c..cc1a03f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -16,7 +16,7 @@ if(WITH_GTK)
set(GRESOURCES "gtk_resources.c")
include_directories(${CMAKE_BINARY_DIR}/src)
endif(PORTABLE_BINARY)
- add_library(gui_gtk
+ add_library(gui_gtk STATIC
gui_gtk.c
gui_gtk.h
gui_gtk_id.h
@@ -35,7 +35,7 @@ if(WITH_NCURSES)
if(NCURSES_FOUND)
include_directories(${NCURSES_INCLUDE_DIRS})
link_directories(${NCURSES_LIBRARY_DIRS})
- add_library(tui_ncurses
+ add_library(tui_ncurses STATIC
tui_ncurses.c
tui_ncurses.h
)

@ -0,0 +1,132 @@
diff --git a/src/core.c b/src/core.c
index 18eef79..9974da9 100644
--- a/src/core.c
+++ b/src/core.c
@@ -73,10 +73,16 @@ int fill_labels(Labels *data)
int i, err = 0;
const uint8_t selected_page = opts->selected_page;
+#if HAS_LIBCPUID
if(HAS_LIBCPUID) err += call_libcpuid_static (data);
if(HAS_LIBCPUID && DAEMON_UP) err += call_libcpuid_msr_static(data);
+#endif
+#if HAS_DMIDECODE
if(HAS_DMIDECODE && DAEMON_UP) err += call_dmidecode (data);
+#endif
+#if HAS_LIBPCI
if(HAS_LIBPCI) err += find_devices (data);
+#endif
casprintf(&data->tab_cpu[VALUE][BUSSPEED], true, "%.2f MHz", data->bus_freq);
err += system_static (data);
@@ -101,15 +107,19 @@ int do_refresh(Labels *data)
switch(opts->selected_page)
{
case NO_CPU:
+#if HAS_LIBCPUID
if(HAS_LIBCPUID) err += err_func(call_libcpuid_dynamic, data);
if(HAS_LIBCPUID && DAEMON_UP) err += err_func(call_libcpuid_msr_dynamic, data);
+#endif
err += err_func(cpu_usage, data);
err += fallback_mode_dynamic(data);
err += err_func(cputab_fill_multipliers, data);
break;
+#if HAS_BANDWIDTH
case NO_CACHES:
if(HAS_BANDWIDTH) err += err_func(call_bandwidth, data);
break;
+#endif
case NO_SYSTEM:
if(HAS_LIBSYSTEM) err += err_func(system_dynamic, data);
break;
@@ -1339,11 +1349,13 @@ static int fallback_mode_static(Labels *data)
{
int err = 0;
+#if HAS_LIBCPUID
if(HAS_LIBCPUID &&
(string_is_empty(data->tab_cpu[VALUE][PACKAGE]) ||
strstr(data->tab_cpu[VALUE][PACKAGE], "CPU") != NULL ||
strstr(data->tab_cpu[VALUE][PACKAGE], "Microprocessor") != NULL))
err += cputab_package_fallback(data);
+#endif
if(data->cpu_min_mult <= 0.0 || data->cpu_max_mult <= 0.0)
err += cputab_multipliers_fallback(data);
diff --git a/src/core.h b/src/core.h
index c461cf3..ab1a018 100644
--- a/src/core.h
+++ b/src/core.h
@@ -54,21 +54,27 @@ static int cputab_fill_multipliers(Labels *data);
/* Required: none
Both normal and fallback mode provide CPU multipliers, need to be call after */
+#if HAS_DMIDECODE
/* Elements provided by dmidecode */
static int call_dmidecode(Labels *data);
/* Required: HAS_DMIDECODE && DAEMON_UP */
+#endif
+#if HAS_BANDWIDTH
/* Compute CPU cache speed */
static int call_bandwidth(Labels *data);
/* Required: HAS_BANDWIDTH */
+#endif
/* Calculate total CPU usage */
static int cpu_usage(Labels *data);
/* Required: none */
+#if HAS_LIBPCI
/* Find some PCI devices, like chipset and GPU */
static int find_devices(Labels *data);
/* Required: HAS_LIBPCI */
+#endif
/* Retrieve GPU temperature */
static int gpu_temperature(Labels *data);
diff --git a/src/daemon.c b/src/daemon.c
index f4b77b8..ea9ef9b 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -225,10 +225,16 @@ static void *request_handler(void *p_data)
switch(cmd)
{
+#if HAS_LIBCPUID
case LIBCPUID_MSR_STATIC: if(HAS_LIBCPUID) __call_libcpuid_msr_static(&td->fd); break;
case LIBCPUID_MSR_DYNAMIC: if(HAS_LIBCPUID) __call_libcpuid_msr_dynamic(&td->fd); break;
+#endif
+#if HAS_DMIDECODE
case DMIDECODE: if(HAS_DMIDECODE) __call_dmidecode(&td->fd); break;
+#endif
+#if HAS_LIBPCI
case ACCESS_DEV_PCI: if(HAS_LIBPCI) __find_devices(&td->fd); break;
+#endif
case ACCESS_SYS_DEBUG: __sys_debug_ok(&td->fd); break;
case LOAD_MODULE: __load_module(&td->fd); break;
}
@@ -299,8 +305,10 @@ int main(void)
/* Logs */
unlink(LOG_FILE);
+#if HAS_LIBCPUID
if(HAS_LIBCPUID && getenv("CPUX_DAEMON_DEBUG"))
libcpuid_msr_serialize();
+#endif
freopen(LOG_FILE, "a", stdout);
setvbuf(stdout, NULL, _IONBF, 0);
dup2(STDOUT_FILENO, STDERR_FILENO);
diff --git a/src/main.c b/src/main.c
index 1aba775..0ac605d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -557,7 +557,7 @@ static void help(char *binary_name)
MSG_STDOUT(_("\nInfluenceable environment variables:"));
for(i = 0; cpux_env_vars[i].var_name != NULL; i++)
{
- if(!cpux_options[i].has_mod)
+ if(!cpux_env_vars[i].has_mod)
continue;
MSG_STDOUT(" %-20s %s", cpux_env_vars[i].var_name, _(cpux_env_vars[i].description));
}
Loading…
Cancel
Save