diff options
Diffstat (limited to 'user/glslang')
-rw-r--r-- | user/glslang/APKBUILD | 43 | ||||
-rw-r--r-- | user/glslang/remap-endian.patch | 46 |
2 files changed, 89 insertions, 0 deletions
diff --git a/user/glslang/APKBUILD b/user/glslang/APKBUILD new file mode 100644 index 000000000..afe29113f --- /dev/null +++ b/user/glslang/APKBUILD @@ -0,0 +1,43 @@ +# Contributor: Síle Ekaterin Liszka <sheila@vulpine.house> +# Maintainer: Síle Ekaterin Liszka <sheila@vulpine.house> +pkgname=glslang +pkgver=14.3.0 +pkgrel=0 +pkgdesc="OpenGL and OpenGL ES reference compiler for shading languages" +url="https://github.com/KhronosGroup/glslang" +arch="all" +license="BSD-3-Clause AND MIT AND BSD-2-Clause AND GPL-3.0+ WITH Bison-2.2-exception" +depends="spirv-tools" +makedepends="cmake python3 spirv-tools-dev" +subpackages="$pkgname-dev" +source="glslang-$pkgver.tar.gz::https://github.com/KhronosGroup/glslang/archive/$pkgver.tar.gz + remap-endian.patch + " + +build() { + if [ "$CBUILD" != "$CHOST" ]; then + CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" + fi + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_SHARED_LIBS=True \ + -DCMAKE_BUILD_TYPE=RelWithDebugInfo \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + -DCMAKE_C_FLAGS="$CFLAGS" \ + -DALLOW_EXTERNAL_SPIRV_TOOLS=YES \ + ${CMAKE_CROSSOPTS} \ + . + make +} + +check() { + CTEST_OUTPUT_ON_FAILURE=TRUE ctest +} + +package() { + make DESTDIR="$pkgdir" install +} + +sha512sums="ce6d09cc4d98b01d162ec5a196eec017c4a5f25eaf98c6612695d911f8d136c2f7193ff8f2c07931b2e94182d2c654833adc3b645f0c225e1d07c4e6e7abfd76 glslang-14.3.0.tar.gz +4745982dac709fc106f50e4f51800cefef07f11f609dfdaa234c3d61fab5f7bd2350720a294a686e88eb92916d1ccdfa203993419d697eb780ee741395bde8c2 remap-endian.patch" diff --git a/user/glslang/remap-endian.patch b/user/glslang/remap-endian.patch new file mode 100644 index 000000000..4c1fc78ff --- /dev/null +++ b/user/glslang/remap-endian.patch @@ -0,0 +1,46 @@ +Issue: https://github.com/KhronosGroup/glslang/issues/3799 + +--- glslang-14.3.0/StandAlone/spirv-remap.cpp.old 2024-06-25 17:42:43.000000000 -0500 ++++ glslang-14.3.0/StandAlone/spirv-remap.cpp 2024-11-22 15:27:02.655869572 -0600 +@@ -38,6 +38,7 @@ + #include <cstring> + #include <stdexcept> + #include <filesystem> ++#include <byteswap.h> + + // + // Include remapper +@@ -48,6 +49,8 @@ + + typedef unsigned int SpvWord; + ++ static const SpvWord MagicNumber = 0x07230203; ++ + // Poor man's basename: given a complete path, return file portion. + // E.g: + // Linux: /foo/bar/test -> test +@@ -82,6 +85,7 @@ + void read(std::vector<SpvWord>& spv, const std::string& inFilename, int verbosity) + { + std::ifstream fp; ++ bool isNativeEndian = true; + + if (verbosity > 0) + logHandler(std::string(" reading: ") + inFilename); +@@ -97,11 +101,16 @@ + spv.reserve(size_t(fp.tellg()) / sizeof(SpvWord)); + fp.seekg(0, fp.beg); + ++ char begin = fp.peek(); ++ char native_begin = reinterpret_cast<const char*>(&MagicNumber)[0]; ++ if (begin != native_begin) isNativeEndian = false; ++ + while (!fp.eof()) { + SpvWord inWord; + fp.read((char *)&inWord, sizeof(inWord)); + + if (!fp.eof()) { ++ if (!isNativeEndian) inWord = __bswap_32(inWord); + spv.push_back(inWord); + if (fp.fail()) + errHandler(std::string("error reading file: ") + inFilename); |