# Maintainer: Daurnimator <daurnimator@archlinux.org>
# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Careful when upgrading this package! It usually breaks ABI without bumping
# soname. Also, be very mindful of the version of spirv-tools that this links
# to. Upstream actually expects the use of the particular commits of
# spirv-tools and spirv-headers that are provided in known_good.json. However,
# if we went that route, we'd have to vendor the resulting spirv-tools libs
# from this glslang build and they would be incompatible with system libs,
# resulting in us having to ship both. Instead, I recommend just waiting until
# upstream releases a compatible version of spirv-tools, then updating the
# spriv-tools system package and only then building glslang against that.
pkgname=glslang
pkgver=14.1.0
pkgrel=1
pkgdesc='OpenGL and OpenGL ES shader front end and validator'
arch=('armv7h' 'aarch64')
url='https://github.com/KhronosGroup/glslang'
license=('BSD-3-Clause')
depends=('gcc-libs' 'spirv-tools')
makedepends=('cmake' 'ninja' 'spirv-headers' 'python')
options=('staticlibs')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/KhronosGroup/glslang/archive/${pkgver}.tar.gz)
sha256sums=('b5e4c36d60eda7613f36cfee3489c6f507156829c707e1ecd7f48ca45b435322')
build() {
cd ${pkgname}-${pkgver}
# NEON breakage ("Bus Error" in test suite)
[[ $CARCH == "armv7h" ]] && CFLAGS=`echo $CFLAGS | sed -e 's/neon-vfpv4/vfpv3/'` && CXXFLAGS="$CFLAGS"
# we need fat LTO objects to not break consumers during linking
CXXFLAGS+=" -ffat-lto-objects"
cmake \
-Bbuild-static \
-GNinja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=None \
-DALLOW_EXTERNAL_SPIRV_TOOLS=ON \
-DBUILD_SHARED_LIBS=OFF
cmake --build build-static
cmake \
-Bbuild-shared \
-GNinja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=None \
-DALLOW_EXTERNAL_SPIRV_TOOLS=ON \
-DBUILD_SHARED_LIBS=ON \
-DGLSLANG_TESTS=ON
cmake --build build-shared
}
check() {
cd ${pkgname}-${pkgver}
ninja -Cbuild-shared test
}
package() {
cd ${pkgname}-${pkgver}
DESTDIR="${pkgdir}" cmake --install build-static
DESTDIR="${pkgdir}" cmake --install build-shared
install -Dm644 LICENSE.txt "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
cd "${pkgdir}"/usr/lib
for lib in *.so; do
ln -sf "${lib}" "${lib}.0"
done
}
# vim: ts=2 sw=2 et: