[gentoo-commits] repo/gentoo:master commit in: games-util/basis_universal/, games-util/basis_universal/files/

2023-02-03 Thread Sam James
commit: 7b30162d5662f0ec77c702d7919e2ea3dacccd1c
Author: Sam James  gentoo  org>
AuthorDate: Fri Feb  3 19:40:03 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Feb  3 19:50:32 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b30162d

games-util/basis_universal: fix build w/ AVX

Closes: https://bugs.gentoo.org/892727
Signed-off-by: Sam James  gentoo.org>

 .../basis_universal/basis_universal-1.16.3.ebuild  |  1 +
 .../basis_universal-1.16.3-SSE4.1-AVX-checks.patch | 40 ++
 2 files changed, 41 insertions(+)

diff --git a/games-util/basis_universal/basis_universal-1.16.3.ebuild 
b/games-util/basis_universal/basis_universal-1.16.3.ebuild
index 298c8ecdb705..239d01901831 100644
--- a/games-util/basis_universal/basis_universal-1.16.3.ebuild
+++ b/games-util/basis_universal/basis_universal-1.16.3.ebuild
@@ -24,6 +24,7 @@ RDEPEND="${RDEPEND}"
 PATCHES=(
"${FILESDIR}"/${PN}-1.16.3-respect-CFLAGS.patch
"${FILESDIR}"/${PN}-1.16.3-fix-RPATH.patch
+   "${FILESDIR}"/${PN}-1.16.3-SSE4.1-AVX-checks.patch
 )
 
 src_configure() {

diff --git 
a/games-util/basis_universal/files/basis_universal-1.16.3-SSE4.1-AVX-checks.patch
 
b/games-util/basis_universal/files/basis_universal-1.16.3-SSE4.1-AVX-checks.patch
new file mode 100644
index ..89be7b13482e
--- /dev/null
+++ 
b/games-util/basis_universal/files/basis_universal-1.16.3-SSE4.1-AVX-checks.patch
@@ -0,0 +1,40 @@
+https://bugs.gentoo.org/892727
+https://github.com/BinomialLLC/basis_universal/issues/342
+https://github.com/BinomialLLC/basis_universal/pull/343
+
+From e61fe1e4ff66decbb14f86a1bf8ec4ea40d23bbf Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= 
+Date: Tue, 31 Jan 2023 14:39:17 +0100
+Subject: [PATCH] SIMD: disable compile time checks
+
+SSE4.1 support is checked at runtime, so compile time checks are
+redundant at best and harmful when compiling for a different machine.
+
+Further more, a logic error prevented the use of SSE4.1 on systems with
+any version of AVX available. This is fixed now.
+--- a/encoder/basisu_kernels_sse.cpp
 b/encoder/basisu_kernels_sse.cpp
+@@ -22,22 +22,6 @@
+ #include 
+ #endif
+ 
+-#if !defined(_MSC_VER)
+-  #if __AVX__ || __AVX2__ || __AVX512F__
+-  #error Please check your compiler options
+-  #endif
+-  
+-  #if CPPSPMD_SSE2
+-  #if __SSE4_1__ || __SSE3__ || __SSE4_2__ || __SSSE3__
+-  #error SSE4.1/SSE3/SSE4.2/SSSE3 cannot be enabled to 
use this file
+-  #endif
+-  #else
+-  #if !__SSE4_1__ || !__SSE3__ || !__SSSE3__
+-  #error Please check your compiler options
+-  #endif
+-  #endif
+-#endif
+-
+ #include "cppspmd_sse.h"
+ 
+ #include "cppspmd_type_aliases.h"
+



[gentoo-commits] repo/gentoo:master commit in: games-util/basis_universal/, games-util/basis_universal/files/

2023-01-27 Thread Sam James
commit: 5144810b848e0bf43bbdd7185e4405f5cc5cea2b
Author: Sam James  gentoo  org>
AuthorDate: Sat Jan 28 05:01:23 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Jan 28 05:10:53 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5144810b

games-util/basis_universal: new package, add 1.16.3

Bug: https://bugs.gentoo.org/879319
Signed-off-by: Sam James  gentoo.org>

 games-util/basis_universal/Manifest|  1 +
 .../basis_universal/basis_universal-1.16.3.ebuild  | 43 ++
 .../files/basis_universal-1.16.3-fix-RPATH.patch   | 10 +
 .../basis_universal-1.16.3-respect-CFLAGS.patch| 11 ++
 games-util/basis_universal/metadata.xml| 14 +++
 5 files changed, 79 insertions(+)

diff --git a/games-util/basis_universal/Manifest 
b/games-util/basis_universal/Manifest
new file mode 100644
index ..58fd6f56d6b3
--- /dev/null
+++ b/games-util/basis_universal/Manifest
@@ -0,0 +1 @@
+DIST basis_universal-1.16.3.tar.gz 29151155 BLAKE2B 
e3ef3ead6223aa73012bd74e51dae269746cfcf2720c524be8096ce864323888f98a140d2e28c881ed60ab54b7ea6fef4205b72757d72e766f85806b4484
 SHA512 
3dca02ad6c14e74df7a89d3b2a59b970635cf5e268b96eb91b10033e2b8e635c83aca6b8e9b34a1b689ed5ffe7c8348d15b8524385f6d07a51cc34a46246a0b7

diff --git a/games-util/basis_universal/basis_universal-1.16.3.ebuild 
b/games-util/basis_universal/basis_universal-1.16.3.ebuild
new file mode 100644
index ..d89b78821f60
--- /dev/null
+++ b/games-util/basis_universal/basis_universal-1.16.3.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake toolchain-funcs
+
+DESCRIPTION="Basis Universal GPU Texture Codec"
+HOMEPAGE="https://github.com/BinomialLLC/basis_universal;
+# dist .zip is just a exe for windows
+SRC_URI="https://github.com/BinomialLLC/basis_universal/archive/refs/tags/${PV}.tar.gz
 -> ${P}.tar.gz"
+
+LICENSE="Apache-2.0 zstd? ( BSD )"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="cpu_flags_x86_sse4_1 opencl zstd"
+
+# zstd is bundled, see https://github.com/BinomialLLC/basis_universal/pull/228
+DEPEND="
+   opencl? ( virtual/opencl )
+"
+RDEPEND="${RDEPEND}"
+
+PATCHES=(
+   "${FILESDIR}"/${PN}-1.16.3-respect-CFLAGS.patch
+   "${FILESDIR}"/${PN}-1.16.3-fix-RPATH.patch
+)
+
+src_configure() {
+   local x64=ON
+   if $(tc-getCC) -dM -E  -x c - < <(echo 'int main() { }') | grep -qi 
"#define __PTRDIFF_WIDTH__ 32" ; then
+   x64=OFF
+   fi
+
+   local mycmakeargs=(
+   -DBUILD_X64=${x64}
+   -DOPENCL=$(usex opencl)
+   -DSSE=$(usex cpu_flags_x86_sse4_1)
+   -DZSTD=$(usex zstd)
+   )
+
+   cmake_src_configure
+}

diff --git 
a/games-util/basis_universal/files/basis_universal-1.16.3-fix-RPATH.patch 
b/games-util/basis_universal/files/basis_universal-1.16.3-fix-RPATH.patch
new file mode 100644
index ..d15ba0d4ddfb
--- /dev/null
+++ b/games-util/basis_universal/files/basis_universal-1.16.3-fix-RPATH.patch
@@ -0,0 +1,10 @@
+--- a/CMakeLists.txt
 b/CMakeLists.txt
+@@ -103,7 +103,6 @@ if (NOT MSVC)
+   set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} 
-DBASISU_SUPPORT_SSE=0")
+ endif()
+ 
+-set(CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} 
${GCC_LINK_FLAGS} -Wl,-rpath .")
+endif()
+ 
+set(CMAKE_C_FLAGS  "${CMAKE_C_FLAGS} ${GCC_COMPILE_FLAGS}")

diff --git 
a/games-util/basis_universal/files/basis_universal-1.16.3-respect-CFLAGS.patch 
b/games-util/basis_universal/files/basis_universal-1.16.3-respect-CFLAGS.patch
new file mode 100644
index ..e7c1db7ea2bf
--- /dev/null
+++ 
b/games-util/basis_universal/files/basis_universal-1.16.3-respect-CFLAGS.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
 b/CMakeLists.txt
+@@ -72,7 +72,7 @@ if (NOT MSVC)
+   set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fsanitize=address 
-fno-omit-frame-pointer -fsanitize=undefined")
+endif()
+ 
+-   set(CMAKE_CXX_FLAGS -std=c++11)
++   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+set(GCC_COMPILE_FLAGS "-fvisibility=hidden -fPIC -fno-strict-aliasing 
-D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -Wextra 
-Wno-unused-local-typedefs -Wno-unused-value -Wno-unused-parameter 
-Wno-unused-variable")
+ 
+if (NOT BUILD_X64)

diff --git a/games-util/basis_universal/metadata.xml 
b/games-util/basis_universal/metadata.xml
new file mode 100644
index ..20e5846d4192
--- /dev/null
+++ b/games-util/basis_universal/metadata.xml
@@ -0,0 +1,14 @@
+
+https://www.gentoo.org/dtd/metadata.dtd;>
+
+   
+   ga...@gentoo.org
+   Gentoo Games Project
+   
+   
+   Enable OpenCL support
+   
+   
+   BinomialLLC/basis_universal
+   
+