blob: b40a367a1655a976c79f66f12ba51d03c354ee6d [file] [log] [blame]
Cody Northropb3106db2016-03-29 10:06:49 -06001#!/bin/bash
2# Update source for glslang, spirv-tools, shaderc
3
4# Copyright 2016 The Android Open Source Project
5# Copyright (C) 2015 Valve Corporation
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18
19set -e
20
21ANDROIDBUILDDIR=$PWD
22BUILDDIR=$ANDROIDBUILDDIR/..
23BASEDIR=$BUILDDIR/..
24
Cody Northrop4bf55d72016-03-31 16:33:00 -060025GLSLANG_REVISION=$(cat $ANDROIDBUILDDIR/glslang_revision_android)
26SPIRV_TOOLS_REVISION=$(cat $ANDROIDBUILDDIR/spirv-tools_revision_android)
27SHADERC_REVISION=$(cat $ANDROIDBUILDDIR/shaderc_revision_android)
Cody Northropb3106db2016-03-29 10:06:49 -060028
29echo "GLSLANG_REVISION=$GLSLANG_REVISION"
30echo "SPIRV_TOOLS_REVISION=$SPIRV_TOOLS_REVISION"
31echo "SHADERC_REVISION=$SHADERC_REVISION"
32
33function create_glslang () {
34 rm -rf $BASEDIR/glslang
35 echo "Creating local glslang repository ($BASEDIR/glslang)."
36 mkdir -p $BASEDIR/glslang
37 cd $BASEDIR/glslang
38 git clone https://github.com/KhronosGroup/glslang.git .
39 git checkout $GLSLANG_REVISION
40}
41
42function update_glslang () {
43 echo "Updating $BASEDIR/glslang"
44 cd $BASEDIR/glslang
45 git fetch --all
46 git checkout $GLSLANG_REVISION
47}
48
49function create_spirv-tools () {
50 rm -rf $BASEDIR/spirv-tools
51 echo "Creating local spirv-tools repository ($BASEDIR/spirv-tools)."
52 mkdir -p $BASEDIR/spirv-tools
53 cd $BASEDIR/spirv-tools
54 git clone https://github.com/KhronosGroup/SPIRV-Tools.git .
55 git checkout $SPIRV_TOOLS_REVISION
56}
57
58function update_spirv-tools () {
59 echo "Updating $BASEDIR/spirv-tools"
60 cd $BASEDIR/spirv-tools
61 git fetch --all
62 git checkout $SPIRV_TOOLS_REVISION
63}
64
65function create_shaderc () {
66 rm -rf $BASEDIR/shaderc
67 echo "Creating local shaderc repository ($BASEDIR/shaderc)."
68 cd $BASEDIR
69 git clone git@github.com:google/shaderc.git
70 cd shaderc
71 git checkout $SHADERC_REVISION
72}
73
74function update_shaderc () {
75 echo "Updating $BASEDIR/shaderc"
76 cd $BASEDIR/shaderc
77 git fetch --all
78 git checkout $SHADERC_REVISION
79}
80
81function build_shaderc () {
82 echo "Building $BASEDIR/shaderc"
83 cd $BASEDIR/shaderc/android_test
84 ndk-build THIRD_PARTY_PATH=../.. -j 4
85}
86
87if [ ! -d "$BASEDIR/glslang" -o ! -d "$BASEDIR/glslang/.git" -o -d "$BASEDIR/glslang/.svn" ]; then
88 create_glslang
89fi
90 update_glslang
91
92
93if [ ! -d "$BASEDIR/spirv-tools" -o ! -d "$BASEDIR/spirv-tools/.git" ]; then
94 create_spirv-tools
95fi
96update_spirv-tools
97
98if [ ! -d "$BASEDIR/shaderc" -o ! -d "$BASEDIR/shaderc/.git" ]; then
99 create_shaderc
100fi
101update_shaderc
102build_shaderc
103
104echo ""
105echo "${0##*/} finished."
106