aboutsummarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 80b05a43c5036464b53219768689d1a2b330d2c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Maintainer: Alexandre Demers <alexandre.f.demers@gmail.com>

_setPrefix="/usr"
_setLibdir="lib32"
_setFullLibdir="${_setPrefix}/${_setLibdir}"
_pkgbasename=glslang

pkgname=lib32-$_pkgbasename
pkgver=15.0.0
pkgrel=1
pkgdesc='OpenGL and OpenGL ES shader front end and validator (32bit)'
arch=('x86_64')
url='https://github.com/KhronosGroup/glslang'
license=('BSD-3-Clause')
depends=(
  "$_pkgbasename>=$pkgver"
  'lib32-glibc'
  'lib32-gcc-libs'
  'lib32-spirv-tools'
)
makedepends=(
  'cmake'
  'git'
  'ninja'
  'python'
  'spirv-headers'
)
options=('staticlibs')
source=(
  ${pkgname}-${pkgver}.tar.gz::https://github.com/KhronosGroup/glslang/archive/${pkgver}.tar.gz
)
sha256sums=(
  'c31c8c2e89af907507c0631273989526ee7d5cdf7df95ececd628fd7b811e064'
)

prepare() {
  echo "Patching if needed"
  cd ${_pkgbasename}-${pkgver}

}

build() {
  export CCFLAGS="-m32"
  export CXXFLAGS="-m32"
  export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"

  cd ${_pkgbasename}-${pkgver}
  # we need fat LTO objects to not break consumers during linking
  export CXXFLAGS+=" -ffat-lto-objects"
  cmake \
    -Bbuild-static \
    -G Ninja \
    -DCMAKE_INSTALL_PREFIX="/usr" \
    -DCMAKE_INSTALL_LIBDIR="lib32" \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_CXX_FLAGS:STRING=-m32 \
    -DALLOW_EXTERNAL_SPIRV_TOOLS=ON \
    -DBUILD_SHARED_LIBS=OFF
  cmake --build build-static

  cmake \
    -Bbuild-shared \
    -G Ninja \
    -DCMAKE_INSTALL_PREFIX="/usr" \
    -DCMAKE_INSTALL_LIBDIR="lib32" \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_CXX_FLAGS:STRING=-m32 \
    -DALLOW_EXTERNAL_SPIRV_TOOLS=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DGLSLANG_TESTS=OFF
  cmake --build build-shared
}

check() {
  cd ${_pkgbasename}-${pkgver}

#  ninja -Cbuild-shared test
}

package() {
  cd ${_pkgbasename}-${pkgver}

  DESTDIR="${pkgdir}" cmake --install build-static
  DESTDIR="${pkgdir}" cmake --install build-shared

  cd "${pkgdir}/usr/lib32/"
  for lib in *.so; do
    ln -sf "${lib}" "${lib}.0"
  done

  for i in "${pkgdir}/usr/bin/"*; do
    mv "$i" "$i"32
  done

  rm -rf "${pkgdir}"/usr/{include,share}
}

# vim: ts=2 sw=2 et: