Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Update source for glslang and LLVM |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 3 | |
Cody Northrop | a8ac135 | 2015-05-12 16:23:59 -0600 | [diff] [blame] | 4 | set -e |
| 5 | |
| 6 | LUNARGLASS_REVISION=$(cat $PWD/LunarGLASS_revision) |
| 7 | GLSLANG_REVISION=$(cat $PWD/glslang_revision) |
| 8 | echo "LUNARGLASS_REVISION=$LUNARGLASS_REVISION" |
| 9 | echo "GLSLANG_REVISION=$GLSLANG_REVISION" |
Courtney Goeltzenleuchter | 90a6f4b | 2014-10-29 17:50:15 -0600 | [diff] [blame] | 10 | |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 11 | BUILDDIR=$PWD |
| 12 | BASEDIR=$BUILDDIR/.. |
| 13 | |
| 14 | function create_glslang () { |
| 15 | rm -rf $BASEDIR/glslang |
Courtney Goeltzenleuchter | 4f57261 | 2015-01-07 13:35:32 -0700 | [diff] [blame] | 16 | echo "Creating local glslang repository ($BASEDIR/glslang)." |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 17 | mkdir -p $BASEDIR/glslang |
| 18 | cd $BASEDIR/glslang |
Cody Northrop | a195136 | 2015-07-02 11:33:41 -0600 | [diff] [blame] | 19 | git clone https://github.com/KhronosGroup/glslang.git . |
| 20 | git checkout $GLSLANG_REVISION |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | function update_glslang () { |
| 24 | echo "Updating $BASEDIR/glslang" |
| 25 | cd $BASEDIR/glslang |
Cody Northrop | 139ec4f | 2015-07-08 09:53:03 -0600 | [diff] [blame] | 26 | git fetch --all |
Cody Northrop | a195136 | 2015-07-02 11:33:41 -0600 | [diff] [blame] | 27 | git checkout $GLSLANG_REVISION |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | function create_LunarGLASS () { |
| 31 | rm -rf $BASEDIR/LunarGLASS |
Courtney Goeltzenleuchter | 4f57261 | 2015-01-07 13:35:32 -0700 | [diff] [blame] | 32 | echo "Creating local LunarGLASS repository ($BASEDIR/LunarGLASS)." |
GregF | 425a7e0 | 2015-09-21 17:53:57 -0600 | [diff] [blame^] | 33 | mkdir -p $BASEDIR/LunarGLASS |
| 34 | cd $BASEDIR/LunarGLASS |
| 35 | git clone https://github.com/LunarG/LunarGLASS.git . |
| 36 | mkdir -p Core/LLVM |
| 37 | cd Core/LLVM |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 38 | wget http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz |
| 39 | tar --gzip -xf llvm-3.4.src.tar.gz |
GregF | 425a7e0 | 2015-09-21 17:53:57 -0600 | [diff] [blame^] | 40 | git checkout -f . # put back the LunarGLASS versions of some LLVM files |
| 41 | git checkout $LUNARGLASS_REVISION |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 42 | } |
| 43 | |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 44 | function update_LunarGLASS () { |
| 45 | echo "Updating $BASEDIR/LunarGLASS" |
| 46 | cd $BASEDIR/LunarGLASS |
GregF | 425a7e0 | 2015-09-21 17:53:57 -0600 | [diff] [blame^] | 47 | git fetch |
| 48 | git checkout $LUNARGLASS_REVISION |& tee gitout |
| 49 | # Figure out how to do this with git |
| 50 | #if grep --quiet LLVM gitout ; then |
| 51 | # rm -rf $BASEDIR/LunarGLASS/Core/LLVM/llvm-3.4/build |
| 52 | #fi |
| 53 | rm -rf gitout |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 54 | } |
| 55 | |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 56 | function build_glslang () { |
Courtney Goeltzenleuchter | 4f57261 | 2015-01-07 13:35:32 -0700 | [diff] [blame] | 57 | echo "Building $BASEDIR/glslang" |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 58 | cd $BASEDIR/glslang |
| 59 | mkdir -p build |
| 60 | cd build |
| 61 | cmake -D CMAKE_BUILD_TYPE=Release .. |
| 62 | cmake -D CMAKE_BUILD_TYPE=Release .. |
| 63 | make |
| 64 | make install |
| 65 | } |
| 66 | |
| 67 | function build_LunarGLASS () { |
Courtney Goeltzenleuchter | 4f57261 | 2015-01-07 13:35:32 -0700 | [diff] [blame] | 68 | echo "Building $BASEDIR/LunarGLASS" |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 69 | cd $BASEDIR/LunarGLASS/Core/LLVM/llvm-3.4 |
| 70 | if [ ! -d "$BASEDIR/LunarGLASS/Core/LLVM/llvm-3.4/build" ]; then |
| 71 | mkdir -p build |
| 72 | cd build |
| 73 | ../configure --enable-terminfo=no --enable-curses=no |
| 74 | REQUIRES_RTTI=1 make -j $(nproc) && make install DESTDIR=`pwd`/install |
| 75 | fi |
| 76 | cd $BASEDIR/LunarGLASS |
| 77 | mkdir -p build |
| 78 | cd build |
| 79 | cmake -D CMAKE_BUILD_TYPE=Release .. |
| 80 | cmake -D CMAKE_BUILD_TYPE=Release .. |
| 81 | make |
| 82 | make install |
| 83 | } |
| 84 | |
Courtney Goeltzenleuchter | 3d108ae | 2015-07-15 11:15:37 -0600 | [diff] [blame] | 85 | if [ ! -d "$BASEDIR/glslang" -o ! -d "$BASEDIR/glslang/.git" ]; then |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 86 | create_glslang |
| 87 | fi |
GregF | 425a7e0 | 2015-09-21 17:53:57 -0600 | [diff] [blame^] | 88 | if [ ! -d "$BASEDIR/LunarGLASS" -o ! -d "$BASEDIR/LunarGLASS/.git" ]; then |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 89 | create_LunarGLASS |
| 90 | fi |
Courtney Goeltzenleuchter | 4f57261 | 2015-01-07 13:35:32 -0700 | [diff] [blame] | 91 | |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 92 | update_glslang |
| 93 | update_LunarGLASS |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 94 | |
Courtney Goeltzenleuchter | 8709496 | 2014-10-17 18:21:42 -0600 | [diff] [blame] | 95 | build_glslang |
Courtney Goeltzenleuchter | 90a6f4b | 2014-10-29 17:50:15 -0600 | [diff] [blame] | 96 | build_LunarGLASS |