summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarlson2k (Evgeny Grin) <k2k@narod.ru>2021-01-08 16:02:15 +0300
committerSam James <sam@gentoo.org>2021-01-11 20:13:24 +0000
commitfc9a6a46c2a9dbd3e0d72a9b30c4bb2a56665f79 (patch)
treee463322b594ad6b07a1056e62e8624bd280bbc64 /x11-libs
parentx11-libs/libva-intel-media-driver: 'set-as-default' USE flag (diff)
downloadgentoo-fc9a6a46c2a9dbd3e0d72a9b30c4bb2a56665f79.tar.gz
gentoo-fc9a6a46c2a9dbd3e0d72a9b30c4bb2a56665f79.tar.bz2
gentoo-fc9a6a46c2a9dbd3e0d72a9b30c4bb2a56665f79.zip
x11-libs/libva-intel-media-driver: "custom-cflags" USE flag
Added USE flags "custom-cflags" to prevent override of user CFLAGS Compile supported parts of the driver as C++17 code. Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'x11-libs')
-rw-r--r--x11-libs/libva-intel-media-driver/files/libva-intel-media-driver-20.4.5_custom_cflags.patch127
-rw-r--r--x11-libs/libva-intel-media-driver/libva-intel-media-driver-20.4.5.ebuild9
-rw-r--r--x11-libs/libva-intel-media-driver/libva-intel-media-driver-9999.ebuild9
-rw-r--r--x11-libs/libva-intel-media-driver/metadata.xml1
4 files changed, 142 insertions, 4 deletions
diff --git a/x11-libs/libva-intel-media-driver/files/libva-intel-media-driver-20.4.5_custom_cflags.patch b/x11-libs/libva-intel-media-driver/files/libva-intel-media-driver-20.4.5_custom_cflags.patch
new file mode 100644
index 000000000000..90051719f302
--- /dev/null
+++ b/x11-libs/libva-intel-media-driver/files/libva-intel-media-driver-20.4.5_custom_cflags.patch
@@ -0,0 +1,127 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -52,6 +52,8 @@ option (BUILD_CMRTLIB "Build and Install cmrtlib together with media driver" ON)
+
+ option (ENABLE_PRODUCTION_KMD "Enable Production KMD header files" OFF)
+
++option (OVERRIDE_COMPILER_FLAGS "Override user compiler FLAGS and use lib defaults" ON)
++
+ include(GNUInstallDirs)
+
+ if (BUILD_CMRTLIB)
+diff --git a/cmrtlib/linux/CMakeLists.txt b/cmrtlib/linux/CMakeLists.txt
+--- a/cmrtlib/linux/CMakeLists.txt
++++ b/cmrtlib/linux/CMakeLists.txt
+@@ -33,15 +33,19 @@ endif()
+
+ # Set up compile options that will be used for the Linux build
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPP_STANDARD_OPTION} -fPIC -fpermissive -fstack-protector-all -Werror")
++if (OVERRIDE_COMPILER_FLAGS)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
+ endif()
++endif()
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-strict-aliasing -D_FORTIFY_SOURCE=2")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -D__DEBUG -O0")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CPP_STANDARD_OPTION} -fPIC -fpermissive -fstack-protector-all -Werror")
++if (OVERRIDE_COMPILER_FLAGS)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1")
+ endif()
++endif()
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-strict-aliasing -D_FORTIFY_SOURCE=2")
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -D__DEBUG -O0")
+
+diff --git a/media_driver/cmake/linux/media_compile_flags_linux.cmake b/media_driver/cmake/linux/media_compile_flags_linux.cmake
+--- a/media_driver/cmake/linux/media_compile_flags_linux.cmake
++++ b/media_driver/cmake/linux/media_compile_flags_linux.cmake
+@@ -36,7 +36,10 @@ set(MEDIA_COMPILER_FLAGS_COMMON
+ -Werror=format-security
+ -Werror=non-virtual-dtor
+ -Werror=return-type
++)
+
++if (OVERRIDE_COMPILER_FLAGS)
++ list (APPEND MEDIA_COMPILER_FLAGS_COMMON
+ # General optimization options
+ -march=${UFO_MARCH}
+ -mpopcnt
+@@ -48,19 +51,29 @@ set(MEDIA_COMPILER_FLAGS_COMMON
+ -msse4.2
+ -msse4
+ -mfpmath=sse
++)
++endif(OVERRIDE_COMPILER_FLAGS)
++
++list (APPEND MEDIA_COMPILER_FLAGS_COMMON
+ -finline-functions
+ -funswitch-loops
+ -fno-short-enums
+ -Wa,--noexecstack
+ -fno-strict-aliasing
++)
+
++if (OVERRIDE_COMPILER_FLAGS)
++ list (APPEND MEDIA_COMPILER_FLAGS_COMMON
+ # Common defines
+ -DUSE_MMX
+ -DUSE_SSE
+ -DUSE_SSE2
+ -DUSE_SSE3
+ -DUSE_SSSE3
++)
++endif(OVERRIDE_COMPILER_FLAGS)
+
++list (APPEND MEDIA_COMPILER_FLAGS_COMMON
+ # Other common flags
+ -fmessage-length=0
+ -fvisibility=hidden
+@@ -68,16 +81,26 @@ set(MEDIA_COMPILER_FLAGS_COMMON
+ -fdata-sections
+ -ffunction-sections
+ -Wl,--gc-sections
++)
+
++if (OVERRIDE_COMPILER_FLAGS)
++ list (APPEND MEDIA_COMPILER_FLAGS_COMMON
+ # -m32 or -m64
+ -m${ARCH}
++)
++endif(OVERRIDE_COMPILER_FLAGS)
+
++list (APPEND MEDIA_COMPILER_FLAGS_COMMON
+ # Global defines
+ -DLINUX=1
+ -DLINUX
+ -DNO_RTTI
+ -DNO_EXCEPTION_HANDLING
+ -DINTEL_NOT_PUBLIC
++)
++
++if (OVERRIDE_COMPILER_FLAGS)
++ list (APPEND MEDIA_COMPILER_FLAGS_COMMON
+ -g
+ )
+
+@@ -90,6 +113,7 @@ if(${UFO_MARCH} STREQUAL "slm")
+ -mtune=atom
+ )
+ endif()
++endif(OVERRIDE_COMPILER_FLAGS)
+
+ if(${ARCH} STREQUAL "64")
+ set(MEDIA_COMPILER_FLAGS_COMMON
+@@ -206,9 +230,11 @@ include(${MEDIA_EXT_CMAKE}/ext/linux/media_compile_flags_linux_ext.cmake OPTIONA
+ if(${PLATFORM} STREQUAL "linux")
+ #set predefined compiler flags set
+ add_compile_options("${MEDIA_COMPILER_FLAGS_COMMON}")
++if (OVERRIDE_COMPILER_FLAGS)
+ add_compile_options("$<$<CONFIG:Debug>:${MEDIA_COMPILER_FLAGS_DEBUG}>")
+ add_compile_options("$<$<CONFIG:Release>:${MEDIA_COMPILER_FLAGS_RELEASE}>")
+ add_compile_options("$<$<CONFIG:ReleaseInternal>:${MEDIA_COMPILER_FLAGS_RELEASEINTERNAL}>")
++endif(OVERRIDE_COMPILER_FLAGS)
+
+ foreach (flag ${MEDIA_COMPILER_CXX_FLAGS_COMMON})
+ SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+
diff --git a/x11-libs/libva-intel-media-driver/libva-intel-media-driver-20.4.5.ebuild b/x11-libs/libva-intel-media-driver/libva-intel-media-driver-20.4.5.ebuild
index 5806c83688ef..6952394b5ebf 100644
--- a/x11-libs/libva-intel-media-driver/libva-intel-media-driver-20.4.5.ebuild
+++ b/x11-libs/libva-intel-media-driver/libva-intel-media-driver-20.4.5.ebuild
@@ -22,9 +22,12 @@ HOMEPAGE="https://github.com/intel/media-driver"
LICENSE="MIT BSD"
SLOT="0"
-IUSE="set-as-default X"
+IUSE="+custom-cflags set-as-default X"
-PATCHES=( "${FILESDIR}"/${PN}-20.2.0_x11_optional.patch )
+PATCHES=(
+ "${FILESDIR}"/${PN}-20.2.0_x11_optional.patch
+ "${FILESDIR}"/${PN}-20.4.5_custom_cflags.patch
+ )
DEPEND=">=media-libs/gmmlib-20.4.1
>=x11-libs/libva-2.10.0[X?]
@@ -39,6 +42,8 @@ src_configure() {
-DBUILD_TYPE=Release
-DPLATFORM=linux
-DUSE_X11=$(usex X)
+ -DLATEST_CPP_NEEDED=ON # Seems to be the best option for now
+ -DOVERRIDE_COMPILER_FLAGS=$(usex !custom-cflags)
)
cmake_src_configure
diff --git a/x11-libs/libva-intel-media-driver/libva-intel-media-driver-9999.ebuild b/x11-libs/libva-intel-media-driver/libva-intel-media-driver-9999.ebuild
index 5806c83688ef..6952394b5ebf 100644
--- a/x11-libs/libva-intel-media-driver/libva-intel-media-driver-9999.ebuild
+++ b/x11-libs/libva-intel-media-driver/libva-intel-media-driver-9999.ebuild
@@ -22,9 +22,12 @@ HOMEPAGE="https://github.com/intel/media-driver"
LICENSE="MIT BSD"
SLOT="0"
-IUSE="set-as-default X"
+IUSE="+custom-cflags set-as-default X"
-PATCHES=( "${FILESDIR}"/${PN}-20.2.0_x11_optional.patch )
+PATCHES=(
+ "${FILESDIR}"/${PN}-20.2.0_x11_optional.patch
+ "${FILESDIR}"/${PN}-20.4.5_custom_cflags.patch
+ )
DEPEND=">=media-libs/gmmlib-20.4.1
>=x11-libs/libva-2.10.0[X?]
@@ -39,6 +42,8 @@ src_configure() {
-DBUILD_TYPE=Release
-DPLATFORM=linux
-DUSE_X11=$(usex X)
+ -DLATEST_CPP_NEEDED=ON # Seems to be the best option for now
+ -DOVERRIDE_COMPILER_FLAGS=$(usex !custom-cflags)
)
cmake_src_configure
diff --git a/x11-libs/libva-intel-media-driver/metadata.xml b/x11-libs/libva-intel-media-driver/metadata.xml
index 6e208d8929cc..dfe0d9d8141b 100644
--- a/x11-libs/libva-intel-media-driver/metadata.xml
+++ b/x11-libs/libva-intel-media-driver/metadata.xml
@@ -10,5 +10,6 @@
</maintainer>
<use>
<flag name="set-as-default">Override libva automatic driver selection and set this (iHD) driver as default one.</flag>
+ <flag name="custom-cflags">Do not override user CFLAGS like -02, -march, -msse and similar with lib defaults. Not tested by upstream.</flag>
</use>
</pkgmetadata>