1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-15 12:06:38 +00:00
termux-packages/packages/boinc/client-hostinfo_unix.cpp.patch
Jia Yuan Lo 0d7b8df172 enhance(main): enable LTO for boinc and boinctui
* cleanup the patch to be less reliant build arguments
2022-11-27 15:23:29 +08:00

55 lines
1.8 KiB
Diff

diff -uNr boinc/client/hostinfo_unix.cpp boinc.mod/client/hostinfo_unix.cpp
--- boinc/client/hostinfo_unix.cpp 2022-11-09 18:26:42.000000000 +0800
+++ boinc.mod/client/hostinfo_unix.cpp 2022-11-18 14:59:05.689992523 +0800
@@ -169,6 +169,16 @@
#include <OS.h>
#endif
+#ifdef __ANDROID__
+#include <sys/system_properties.h> // PROP_VALUE_MAX
+#endif
+
+#ifdef __TERMUX__
+#ifndef TERMUX_PKG_ANDROID_VERSION
+#define TERMUX_PKG_ANDROID_VERSION "7.0"
+#endif
+#endif
+
// Some OS define _SC_PAGE_SIZE instead of _SC_PAGESIZE
#if defined(_SC_PAGE_SIZE) && !defined(_SC_PAGESIZE)
#define _SC_PAGESIZE _SC_PAGE_SIZE
@@ -1536,12 +1546,21 @@
#if HAVE_SYS_UTSNAME_H
struct utsname u;
uname(&u);
-#ifdef ANDROID
+#ifdef __ANDROID__
safe_strcpy(os_name, "Android");
#else
safe_strcpy(os_name, u.sysname);
-#endif //ANDROID
-#if defined(__EMX__) // OS2: version is in u.version
+#endif
+#ifdef __ANDROID__
+ // remove the need of query Android version through Java API
+ // which then process in client/gui_rpc_server_ops.cpp, handle_set_host_info()
+ char android_version[PROP_VALUE_MAX];
+ __system_property_get("ro.build.version.release", android_version);
+#ifdef __TERMUX__
+ if (strlen(android_version) == 0) { safe_strcpy(android_version, TERMUX_PKG_ANDROID_VERSION); }
+#endif
+ snprintf(os_version, sizeof(os_version), "%s (Android %s)", u.release, android_version);
+#elif defined(__EMX__) // OS2: version is in u.version
safe_strcpy(os_version, u.version);
#elif defined(__HAIKU__)
snprintf(os_version, sizeof(os_version), "%s, %s", u.release, u.version);
@@ -1698,7 +1717,7 @@
return false;
}
} tty_patterns[] = {
-#if defined(LINUX_LIKE_SYSTEM) and !defined(ANDROID)
+#if defined(LINUX_LIKE_SYSTEM) and !defined(__ANDROID__)
{ "/dev", "tty",
{"ttyS", "ttyACM"},
},