[beignet] 03/03: Fix FTBFS on kfreebsd-*
Rebecca Palmer
rnpalmer-guest at moszumanska.debian.org
Tue Mar 17 19:11:13 UTC 2015
This is an automated email from the git hooks/post-receive script.
rnpalmer-guest pushed a commit to branch master
in repository beignet.
commit 5c28247cf1a099161407af79c3386d6db8a3b0c7
Author: Rebecca N. Palmer <rebecca_palmer at zoho.com>
Date: Sun Mar 8 22:29:26 2015 +0000
Fix FTBFS on kfreebsd-*
---
debian/changelog | 1 +
debian/patches/series | 1 +
debian/patches/support-kfreebsd.patch | 55 +++++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 90f9e3e..8542e6e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ beignet (1.0.1-4) UNRELEASED; urgency=medium
* Make transitional dummy arch:all.
* Enable building on hurd-i386 and x32.
+ * Fix FTBFS on kfreebsd-*.
-- Rebecca N. Palmer <rebecca_palmer at zoho.com> Sat, 07 Mar 2015 22:17:11 +0000
diff --git a/debian/patches/series b/debian/patches/series
index fa4d80d..83d1add 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -12,3 +12,4 @@ fixcrash-24b2ad.patch
fixcrash-779213.patch
fix-buffer-overflow.patch
Enable-multiarch.patch
+support-kfreebsd.patch
diff --git a/debian/patches/support-kfreebsd.patch b/debian/patches/support-kfreebsd.patch
new file mode 100644
index 0000000..50ba450
--- /dev/null
+++ b/debian/patches/support-kfreebsd.patch
@@ -0,0 +1,55 @@
+Description: Don't try to use sysinfo on non-Linux
+
+Fixes FTBFS on kfreebsd due to use of a Linux-specific system call:
+https://buildd.debian.org/status/fetch.php?pkg=beignet&arch=kfreebsd-amd64&ver=1.0.1-3&stamp=1425101150
+
+Origin: https://github.com/freebsd/freebsd-ports-graphics/blob/opencl/lang/beignet/files/patch-src_cl__device__id.c
+Author: Koop Mast, Rebecca Palmer
+
+--- a/src/cl_device_id.c
++++ b/src/cl_device_id.c
+@@ -33,7 +33,12 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
++#if defined(linux) || defined(__linux__) || defined(__LINUX__)
+ #include <sys/sysinfo.h>
++#else
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#endif
+
+ #ifndef CL_VERSION_1_2
+ #define CL_DEVICE_BUILT_IN_KERNELS 0x103F
+@@ -424,6 +429,7 @@ skl_gt4_break:
+ cl_driver_delete(dummy);
+ #endif
+
++#if defined(linux) || defined(__linux__) || defined(__LINUX__)
+ struct sysinfo info;
+ if (sysinfo(&info) == 0) {
+ uint64_t two_gb = 2 * 1024 * 1024 * 1024ul;
+@@ -432,6 +438,22 @@ skl_gt4_break:
+ two_gb : info.totalram;
+ ret->max_mem_alloc_size = ret->global_mem_size / 2;
+ }
++#else
++ int mib[2];
++
++ mib[0] = CTL_HW;
++ mib[1] = HW_USERMEM;
++
++ uint64_t totalram;
++ size_t len;
++ len = sizeof(totalram);
++ sysctl(mib, 2, &totalram, &len, NULL, 0);
++
++ uint64_t two_gb = 2 * 1024 * 1024 * 1024ul;
++ ret->global_mem_size = (totalram > two_gb) ?
++ two_gb : totalram;
++ ret->max_mem_alloc_size = ret->global_mem_size / 2;
++#endif
+
+ return ret;
+ }
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/beignet.git
More information about the Pkg-opencl-commits
mailing list