commit:     ce15ee2538d76f6c59be35bfd4e8f2db7ef3c3bc
Author:     g3ngr33n <gengreen <AT> tutanota <DOT> com>
AuthorDate: Wed Apr  8 16:52:01 2020 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed Apr  8 18:15:58 2020 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=ce15ee25

x11-apps/igt-gpu-tools: Musl patch

- Patch to allow build on musl for igt-gpu-tools-1.24
- Build log : https://pastebin.com/21UzLgvL

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 x11-apps/igt-gpu-tools/Manifest                    |   1 +
 .../files/0001-igt-gpu-tools-1.24-musl.patch       | 169 +++++++++++++++++++++
 x11-apps/igt-gpu-tools/igt-gpu-tools-1.24.ebuild   | 106 +++++++++++++
 x11-apps/igt-gpu-tools/metadata.xml                |  17 +++
 4 files changed, 293 insertions(+)

diff --git a/x11-apps/igt-gpu-tools/Manifest b/x11-apps/igt-gpu-tools/Manifest
new file mode 100644
index 0000000..da385bc
--- /dev/null
+++ b/x11-apps/igt-gpu-tools/Manifest
@@ -0,0 +1 @@
+DIST igt-gpu-tools-1.24.tar.xz 1207436 BLAKE2B 
0b04033be0195a4fee5611aeae2f47334ce1de5df65c652ebc0b36d1185286268bb426f472e3c1311ff576e8184e7a4efb95ef3181006ed8c448ea76452940d7
 SHA512 
22c25e27ead64f561fe8f46b132d6c7562a90d7bff09dc2618a532b16d7b8fdf54ed94d986a45655657b54219d350ce1b1e6c89da2b6073024e9bbe0973fa190

diff --git a/x11-apps/igt-gpu-tools/files/0001-igt-gpu-tools-1.24-musl.patch 
b/x11-apps/igt-gpu-tools/files/0001-igt-gpu-tools-1.24-musl.patch
new file mode 100644
index 0000000..2122725
--- /dev/null
+++ b/x11-apps/igt-gpu-tools/files/0001-igt-gpu-tools-1.24-musl.patch
@@ -0,0 +1,169 @@
+--- a/benchmarks/gem_syslatency.c
++++ b/benchmarks/gem_syslatency.c
+@@ -41,10 +41,10 @@
+ #include <time.h>
+ #include <limits.h>
+ #include "drm.h"
+-
++#include "signal_compat.h"
+ #include <linux/unistd.h>
+ 
+-#define sigev_notify_thread_id _sigev_un._tid
++#define sigev_notify_thread_id sigev_notify_function
+ 
+ static volatile int done;
+
+--- a/lib/igt_aux.c
++++ b/lib/igt_aux.c
+@@ -31,6 +31,7 @@
+ #endif
+ #include <stdio.h>
+ #include <fcntl.h>
++#include <limits.h>
+ #include <sys/stat.h>
+ #include <sys/ioctl.h>
+ #include <string.h>
+@@ -73,6 +74,8 @@
+ #include <libgen.h>   /* for dirname() */
+ #endif
+ 
++#include "signal_compat.h"
++
+ /**
+  * SECTION:igt_aux
+  * @short_description: Auxiliary libraries and support functions
+
+--- a/lib/igt_aux.h
++++ b/lib/igt_aux.h
+@@ -46,7 +46,7 @@
+ #  define gettid() (pid_t)(syscall(__NR_gettid))
+ # endif
+ #endif
+-#define sigev_notify_thread_id _sigev_un._tid
++#define sigev_notify_thread_id sigev_notify_function
+ 
+ /* auxialiary igt helpers from igt_aux.c */
+ /* generally useful helpers */
+
+--- a/lib/igt_halffloat.c
++++ b/lib/igt_halffloat.c
+@@ -162,7 +162,7 @@
+       return fi.f;
+ }
+ 
+-#if defined(__x86_64__) && !defined(__clang__)
++#if defined(__x86_64__) && !defined(__clang__) && defined(__GLIBC__)
+ #pragma GCC push_options
+ #pragma GCC target("f16c")
+
+--- a/lib/igt_x86.c
++++ b/lib/igt_x86.c
+@@ -190,7 +190,7 @@
+ }
+ #endif
+ 
+-#if defined(__x86_64__) && !defined(__clang__)
++#if defined(__x86_64__) && !defined(__clang__) && defined(__GLIBC__)
+ #pragma GCC push_options
+ #pragma GCC target("sse4.1")
+ #pragma GCC diagnostic ignored "-Wpointer-arith"
+
+--- /dev/null
++++ b/lib/signal_compat.h
+@@ -0,0 +1,8 @@
++#define SIGEV_SIGNAL 0
++#define SIGEV_NONE 1
++#define SIGEV_THREAD 2
++
++#define SIGEV_SIGNAL    0       /* notify via signal */
++#define SIGEV_NONE      1       /* other notification: meaningless */
++#define SIGEV_THREAD    2       /* deliver via thread creation */
++#define SIGEV_THREAD_ID 4       /* deliver to thread */
+
+--- a/tests/drm_read.c
++++ b/tests/drm_read.c
+@@ -220,7 +220,7 @@
+               pthread_mutex_unlock(&w.mutex);
+ 
+               /* Give each thread a chance to sleep in drm_read() */
+-              pthread_yield();
++              sched_yield();
+ 
+               /* One event should wake all threads as none consume */
+               generate_event(w.fd, pipe);
+
+--- a/tests/kms_hdmi_inject.c
++++ b/tests/kms_hdmi_inject.c
+@@ -26,6 +26,7 @@
+ 
+ #include <dirent.h>
+ 
++#include <limits.h>
+ #include "igt.h"
+ #include "igt_edid.h"
+ #include "igt_eld.h"
+
+--- a/tests/kms_sysfs_edid_timing.c
++++ b/tests/kms_sysfs_edid_timing.c
+@@ -24,6 +24,7 @@
+ 
+ #include <dirent.h>
+ #include <fcntl.h>
++#include <limits.h>
+ #include <sys/stat.h>
+ 
+ #define THRESHOLD_PER_CONNECTOR       10
+
+--- a/tools/aubdump.c
++++ b/tools/aubdump.c
+@@ -226,10 +226,10 @@
+ };
+ 
+ static int close_init_helper(int fd);
+-static int ioctl_init_helper(int fd, unsigned long request, ...);
++static int ioctl_init_helper(int fd, int request, ...);
+ 
+ static int (*libc_close)(int fd) = close_init_helper;
+-static int (*libc_ioctl)(int fd, unsigned long request, ...) = 
ioctl_init_helper;
++static int (*libc_ioctl)(int fd, int request, ...) = ioctl_init_helper;
+ 
+ static int drm_fd = -1;
+ static char *filename = NULL;
+@@ -856,7 +856,7 @@
+ }
+ 
+ static int
+-gem_ioctl(int fd, unsigned long request, void *argp)
++gem_ioctl(int fd, int request, void *argp)
+ {
+       int ret;
+ 
+@@ -1150,7 +1150,7 @@
+     DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct 
drm_i915_gem_execbuffer2)
+ 
+ int
+-ioctl(int fd, unsigned long request, ...)
++ioctl(int fd, int request, ...)
+ {
+       va_list args;
+       void *argp;
+@@ -1290,7 +1290,7 @@
+ }
+ 
+ static int
+-ioctl_init_helper(int fd, unsigned long request, ...)
++ioctl_init_helper(int fd, int request, ...)
+ {
+       va_list args;
+       void *argp;
+
+--- a/lib/igt_eld.c
++++ b/lib/igt_eld.c
+@@ -29,6 +29,7 @@
+ #include <stdint.h>
+ #include <stdio.h>
+ #include <string.h>
++#include <limits.h>
+ 
+ #include "igt_core.h"
+ #include "igt_eld.h"
\ No newline at end of file

diff --git a/x11-apps/igt-gpu-tools/igt-gpu-tools-1.24.ebuild 
b/x11-apps/igt-gpu-tools/igt-gpu-tools-1.24.ebuild
new file mode 100644
index 0000000..414e99f
--- /dev/null
+++ b/x11-apps/igt-gpu-tools/igt-gpu-tools-1.24.ebuild
@@ -0,0 +1,106 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+EGIT_REPO_URI="https://gitlab.freedesktop.org/drm/${PN}.git";
+if [[ ${PV} = *9999* ]]; then
+       GIT_ECLASS="git-r3"
+fi
+
+inherit ${GIT_ECLASS} meson
+
+DESCRIPTION="Intel GPU userland tools"
+
+HOMEPAGE="https://01.org/linuxgraphics 
https://gitlab.freedesktop.org/drm/igt-gpu-tools";
+if [[ ${PV} = *9999* ]]; then
+       SRC_URI=""
+else
+       KEYWORDS="~amd64 ~x86"
+       SRC_URI="https://www.x.org/releases/individual/app/${P}.tar.xz";
+fi
+LICENSE="MIT"
+SLOT="0"
+IUSE="chamelium doc man overlay runner unwind valgrind video_cards_amdgpu 
video_cards_intel video_cards_nouveau X xv"
+REQUIRED_USE="
+       || ( video_cards_amdgpu video_cards_intel video_cards_nouveau )
+       overlay? (
+               video_cards_intel
+               || ( X xv )
+       )
+"
+RESTRICT="test"
+
+RDEPEND="
+       dev-libs/elfutils
+       dev-libs/glib:2
+       sys-apps/kmod:=
+       sys-libs/libunwind:=
+       sys-libs/zlib:=
+       sys-process/procps:=
+       virtual/libudev:=
+       >=x11-libs/cairo-1.12.0[X?]
+       
>=x11-libs/libdrm-2.4.82[video_cards_amdgpu?,video_cards_intel?,video_cards_nouveau?]
+       >=x11-libs/libpciaccess-0.10
+       x11-libs/pixman
+       chamelium? (
+               dev-libs/xmlrpc-c[curl]
+               sci-libs/gsl
+               media-libs/alsa-lib:=
+       )
+       overlay? (
+               >=x11-libs/libXrandr-1.3
+               xv? (
+                       x11-libs/libX11
+                       x11-libs/libXext
+                       x11-libs/libXv
+               )
+       )
+       runner? ( dev-libs/json-c:= )
+       unwind? ( sys-libs/libunwind )
+       valgrind? ( dev-util/valgrind )
+       "
+DEPEND="${RDEPEND}
+       doc? ( >=dev-util/gtk-doc-1.25-r1 )
+       man? ( dev-python/docutils )
+       overlay? (
+               >=dev-util/peg-0.1.18
+               x11-base/xorg-proto
+       )
+       video_cards_intel? (
+               sys-devel/bison
+               sys-devel/flex
+       )
+"
+PATCHES=(
+       "${FILESDIR}"/0001-${PN}-1.24-musl.patch
+)
+
+src_prepare() {
+       sed -e "s/find_program('rst2man-3'/find_program('rst2man.py', 
'rst2man-3'/" -i man/meson.build
+       default_src_prepare
+}
+
+src_configure() {
+       local gpus=""
+       use video_cards_amdgpu  && gpus+="amdgpu,"
+       use video_cards_intel   && gpus+="intel,"
+       use video_cards_nouveau && gpus+="nouveau,"
+
+       local overlay_backends=""
+       use overlay && use xv && overlay_backends+="xv,"
+       use overlay && use X && overlay_backends+="x,"
+
+       local emesonargs=(
+               $(meson_feature chamelium build_chamelium)
+               $(meson_feature doc build_docs)
+               $(meson_feature man build_man)
+               $(meson_feature overlay build_overlay)
+               $(meson_feature runner build_runner)
+               $(meson_feature doc build_tests) # Test build is required for 
docs
+               $(meson_feature valgrind with_valgrind)
+               $(meson_feature unwind with_libunwind)
+               -Doverlay_backends=${overlay_backends%?}
+               -Dwith_libdrm=${gpus%?}
+       )
+       meson_src_configure
+}

diff --git a/x11-apps/igt-gpu-tools/metadata.xml 
b/x11-apps/igt-gpu-tools/metadata.xml
new file mode 100644
index 0000000..887359b
--- /dev/null
+++ b/x11-apps/igt-gpu-tools/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+<maintainer type="project">
+ <email>[email protected]</email>
+ <name>X11</name>
+</maintainer>
+<use>
+ <flag name="chamelium">Enables support for building Chamelium tests</flag>
+ <flag name="man">Build and install man pages</flag>
+ <flag name="overlay">Build the intel-gpu-overlay utility</flag>
+ <flag name="runner">Build the test runner</flag>
+ <flag name="valgrind">Support valgrind annotations</flag>
+ <flag name="xv">Enable intel-gpu-overlay xv backend</flag>
+ <flag name="X">Enable intel-gpu-overlay xlib/cairo backend</flag>
+</use>
+</pkgmetadata>

Reply via email to