yum-mirror/glslang

git clone https://git.yummers.dev/yum-mirror/glslang

dnetoMake GN builds work again7754c375

main
3.3 KiB97 linesraw
1#!/bin/bash
2
3# Copyright 2026 Google LLC.
4#
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
9# are met:
10#
11#    Redistributions of source code must retain the above copyright
12#    notice, this list of conditions and the following disclaimer.
13#
14#    Redistributions in binary form must reproduce the above
15#    copyright notice, this list of conditions and the following
16#    disclaimer in the documentation and/or other materials provided
17#    with the distribution.
18#
19#    Neither the name of Google Inc. nor the names of its
20#    contributors may be used to endorse or promote products derived
21#    from this software without specific prior written permission.
22#
23# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34# POSSIBILITY OF SUCH DAMAGE.
35
36set -e # Fail on any error.
37
38# 'true' or 'false'
39GLSLANG_ENABLE_HLSL=${GLSLANG_ENABLE_HLSL-true}
40
41. /bin/using.sh # Declare the bash `using` function for configuring toolchains.
42
43using ninja-1.10.0
44using python-3.12.4
45
46# Don't set the compiler here
47# The GN build uses the g++ compiler that it downloads from the sysroot.
48# See DEPS for details.
49
50set -x # Display commands being run.
51
52# Disable git's "detected dubious ownership" error - kokoro checks out the repo
53# with a different user, and we don't care about this warning.
54git config --global --add safe.directory '*'
55
56echo "Fetching external projects..."
57./update_glslang_sources.py
58
59echo "Fetching depot_tools..."
60rm -rf /tmp/depot_tools
61mkdir -p /tmp/depot_tools
62git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git /tmp/depot_tools
63export PATH="/tmp/depot_tools:$PATH"
64
65
66echo "Syncing client..."
67
68# Silence gn related babble
69export GCLIENT_SUPPRESS_GIT_VERSION_WARNING=1
70# For the 'root' user, silence gclient metrics collection.
71if [[ -z "$USER" ]]; then
72  mkdir -p $HOME/.config/depot_tools
73  cat  >$HOME/.config/depot_tools/metrics.cfg <<'EOF'
74  {"is-googler": false, "countdown": 0, "opt-in": false, "version": 1}
75EOF
76fi
77
78# Erase the GN args from any previous run of gclient.
79# This is important for local testing.
80rm -f build/config/gclient_args.gni
81
82# Sync dependencies and generate default GN args from the DEPS file.
83gclient sync -D --gclientfile=standalone.gclient
84
85echo "Generate ninja build plan..."
86
87# Ensure the gn binary is on the path
88export PATH=$(pwd)/buildtools/linux64:$PATH
89# which -a gn  # There should be two
90
91BUILD_DIR=out/Default-hlsl-${GLSLANG_ENABLE_HLSL}
92
93rm -rf "$BUILD_DIR"
94gn gen "$BUILD_DIR" --args="glslang_enable_hlsl=${GLSLANG_ENABLE_HLSL}"
95
96echo "Building..."
97ninja -v -C "$BUILD_DIR"