| # Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net> |
| # Contributor: wirx6 <wirx654@gmail.com> |
| |
| _realname=glslang |
| pkgbase=mingw-w64-${_realname} |
| pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") |
| pkgver=11.4.0 |
| pkgrel=1 |
| pkgdesc='An OpenGL and OpenGL ES shader front end and validator (mingw-w64)' |
| arch=('any') |
| mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32') |
| url='https://github.com/KhronosGroup/glslang' |
| license=('BSD') |
| depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" |
| "${MINGW_PACKAGE_PREFIX}-spirv-tools") |
| makedepends=("${MINGW_PACKAGE_PREFIX}-cmake" |
| "${MINGW_PACKAGE_PREFIX}-ninja") |
| source=(${_realname}-${pkgver}.tar.gz::https://github.com/KhronosGroup/glslang/archive/${pkgver}.tar.gz |
| 002-remove-deprecated-mingw-secure-api.patch |
| 003-fix-shared-build.patch) |
| sha256sums=('9bae79c2b640b60474f8944a5ab4aff3af990074636ea2a0a3c97cb86be61dfa' |
| '8b9f56e57a892aa3e1617b7a268a6bb2a309a11c874ef11d9ad59aadf94ca932' |
| '129abf72b528f85f0d1b327763aad7d2aeed9df84fa15548a7b8975d524738f2') |
| |
| prepare() { |
| cd "${srcdir}/${_realname}-${pkgver}" |
| |
| patch -Np1 -i "${srcdir}/002-remove-deprecated-mingw-secure-api.patch" |
| |
| # https://github.com/KhronosGroup/glslang/commit/eaf2af6.patch |
| patch -Np1 -i "${srcdir}/003-fix-shared-build.patch" |
| } |
| |
| build() { |
| declare -a extra_config |
| if check_option "debug" "n"; then |
| extra_config+=("-DCMAKE_BUILD_TYPE=Release") |
| else |
| extra_config+=("-DCMAKE_BUILD_TYPE=Debug") |
| fi |
| |
| echo "Building static library" |
| [[ -d "${srcdir}"/build-${CARCH}-static ]] && rm -rf "${srcdir}"/build-${CARCH}-static |
| mkdir -p "${srcdir}"/build-${CARCH}-static && cd "${srcdir}"/build-${CARCH}-static |
| |
| MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ |
| ${MINGW_PREFIX}/bin/cmake.exe \ |
| -G "Ninja" \ |
| -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ |
| -DCMAKE_INSTALL_LIBDIR=lib \ |
| "${extra_config[@]}" \ |
| -DBUILD_SHARED_LIBS=OFF \ |
| ../${_realname}-${pkgver} |
| |
| ${MINGW_PREFIX}/bin/cmake.exe --build ./ |
| |
| echo "Building shared library" |
| [[ -d "${srcdir}"/build-${CARCH}-shared ]] && rm -rf "${srcdir}"/build-${CARCH}-shared |
| mkdir -p "${srcdir}"/build-${CARCH}-shared && cd "${srcdir}"/build-${CARCH}-shared |
| |
| MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \ |
| ${MINGW_PREFIX}/bin/cmake.exe \ |
| -G "Ninja" \ |
| -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \ |
| -DCMAKE_INSTALL_LIBDIR=lib \ |
| "${extra_config[@]}" \ |
| -DBUILD_SHARED_LIBS=ON \ |
| ../${_realname}-${pkgver} |
| |
| ${MINGW_PREFIX}/bin/cmake.exe --build ./ |
| } |
| |
| package() { |
| cd "${srcdir}"/build-${CARCH}-static |
| DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake.exe --build ./ --target install |
| |
| cd "${srcdir}"/build-${CARCH}-shared |
| DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake.exe --build ./ --target install |
| |
| install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.txt" |
| } |