blob: f5720320d22e3177d95b0a53b3aec67be8be1882 [file] [log] [blame]
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -06001#!/bin/bash
2# Update source for glslang and LLVM
3# Copy necessary BIL pieces into glslang and LLVM
4
Courtney Goeltzenleuchter8ec92b72015-02-05 15:35:26 -07005BIL_REVISION=29773
GregFcdcca512015-01-20 11:55:00 -07006LUNARGLASS_REVISION=1060
Courtney Goeltzenleuchter8ec92b72015-02-05 15:35:26 -07007GLSLANG_REVISION=29773
Courtney Goeltzenleuchter5120b842014-10-29 17:50:15 -06008
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -06009BUILDDIR=$PWD
10BASEDIR=$BUILDDIR/..
11
12function create_glslang () {
13 rm -rf $BASEDIR/glslang
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -070014 echo "Creating local glslang repository ($BASEDIR/glslang)."
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -060015 mkdir -p $BASEDIR/glslang
16 cd $BASEDIR/glslang
17 svn checkout https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang .
18}
19
20function update_glslang () {
21 echo "Updating $BASEDIR/glslang"
22 cd $BASEDIR/glslang
Courtney Goeltzenleuchter5120b842014-10-29 17:50:15 -060023 svn update -r "$GLSLANG_REVISION"
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -060024}
25
26function create_LunarGLASS () {
27 rm -rf $BASEDIR/LunarGLASS
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -070028 echo "Creating local LunarGLASS repository ($BASEDIR/LunarGLASS)."
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -060029 mkdir -p $BASEDIR/LunarGLASS/Core/LLVM
30 cd $BASEDIR/LunarGLASS/Core/LLVM
31 wget http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz
32 tar --gzip -xf llvm-3.4.src.tar.gz
33 cd $BASEDIR/LunarGLASS
34 svn checkout --force https://lunarglass.googlecode.com/svn/trunk/ .
35 svn revert --depth=infinity .
36}
37
38function create_BIL () {
39 rm -rf $BASEDIR/BIL
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -070040 echo "Creating local BIL repository ($BASEDIR/BIL)."
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -060041 mkdir -p $BASEDIR/BIL
42 cd $BASEDIR/BIL
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -070043 svn checkout --username "$KHRONOS_ACCOUNT_NAME" https://cvs.khronos.org/svn/repos/oglc/trunk/nextgen/proposals/BIL .
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -060044}
45
46function update_LunarGLASS () {
47 echo "Updating $BASEDIR/LunarGLASS"
48 cd $BASEDIR/LunarGLASS
Courtney Goeltzenleuchter5120b842014-10-29 17:50:15 -060049 svn update -r "$LUNARGLASS_REVISION"
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -060050}
51
52function update_BIL () {
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -070053 # Update source
54 cd $BASEDIR/BIL
55 echo "Updating $BASEDIR/BIL"
56 svn update -r "$BIL_REVISION"
57 # copy of necessary BIL pieces into glslang
Cody Northrop9b695dd2015-01-27 11:31:41 -070058 cp $BASEDIR/BIL/glslangOverlay_into_BIL/*.h $BASEDIR/glslang/BIL
59 cp $BASEDIR/BIL/glslangOverlay_into_BIL/*.cpp $BASEDIR/glslang/BIL
60 cp $BASEDIR/BIL/glslangOverlay_into_BIL/*.txt $BASEDIR/glslang/BIL
61 cp -r $BASEDIR/BIL/glslangOverlay_into_BIL/glslang/* $BASEDIR/glslang/glslang/
Courtney Goeltzenleuchter0e9abf02015-01-23 14:00:52 -070062 cp -uv $BASEDIR/BIL/Bil.h $BASEDIR/glslang/BIL
63 cp -uv $BASEDIR/BIL/GLSL450Lib.h $BASEDIR/glslang/BIL
64
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -070065 # copy of necessary BIL pieces into LLVM
Courtney Goeltzenleuchter0e9abf02015-01-23 14:00:52 -070066 cp -uv $BASEDIR/BIL/ToLLVM/CMakeLists.txt $BASEDIR/LunarGLASS
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -070067 cp -r $BASEDIR/BIL/ToLLVM/Standalone $BASEDIR/LunarGLASS
Courtney Goeltzenleuchter0e9abf02015-01-23 14:00:52 -070068
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -070069 cp -r $BASEDIR/BIL/ToLLVM/FrontEnds/* $BASEDIR/LunarGLASS/Frontends/
Courtney Goeltzenleuchter0e9abf02015-01-23 14:00:52 -070070 cp -uv $BASEDIR/BIL/ToLLVM/Backends/GLSL/BottomToGLSL.cpp $BASEDIR/LunarGLASS/Backends/GLSL
71
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -060072}
73
74function build_glslang () {
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -070075 echo "Building $BASEDIR/glslang"
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -060076 cd $BASEDIR/glslang
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
85function build_LunarGLASS () {
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -070086 echo "Building $BASEDIR/LunarGLASS"
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -060087 cd $BASEDIR/LunarGLASS/Core/LLVM/llvm-3.4
88 if [ ! -d "$BASEDIR/LunarGLASS/Core/LLVM/llvm-3.4/build" ]; then
89 mkdir -p build
90 cd build
91 ../configure --enable-terminfo=no --enable-curses=no
92 REQUIRES_RTTI=1 make -j $(nproc) && make install DESTDIR=`pwd`/install
93 fi
94 cd $BASEDIR/LunarGLASS
95 mkdir -p build
96 cd build
97 cmake -D CMAKE_BUILD_TYPE=Release ..
98 cmake -D CMAKE_BUILD_TYPE=Release ..
99 make
100 make install
101}
102
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -0700103if [ -z "$KHRONOS_ACCOUNT_NAME" ]; then
104 echo "Must define KHRONOS_ACCOUNT_NAME to access BIL component"
105 exit 1
106fi
107
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -0600108if [ ! -d "$BASEDIR/glslang" ]; then
109 create_glslang
110fi
111if [ ! -d "$BASEDIR/LunarGLASS" ]; then
112 create_LunarGLASS
113fi
114if [ ! -d "$BASEDIR/BIL" ]; then
115 create_BIL
116fi
117
Courtney Goeltzenleuchter19d4d492015-01-23 11:47:02 -0700118if [ ! -d "$BASEDIR/BIL" -o ! -f "$BASEDIR/BIL/Bil.h" ]; then
Courtney Goeltzenleuchterf000ccf2015-01-07 13:35:32 -0700119 echo "Missing BIL, is your Khronos account correct?"
120 exit 1
121fi
122
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -0600123update_glslang
124update_LunarGLASS
125update_BIL
126
Courtney Goeltzenleuchter7f0a7be2014-10-17 18:21:42 -0600127build_glslang
Courtney Goeltzenleuchter5120b842014-10-29 17:50:15 -0600128build_LunarGLASS