Last active
November 28, 2016 14:04
-
-
Save pstjvn/6896ceeecfa165001c030afbb32913c2 to your computer and use it in GitHub Desktop.
Provides closure compatible environment but instead of compiling from source uses pre-built binaries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Allows the usage of prebuilt binaries to be used. | |
APPSDIR=apps/ | |
SRCDIR=src/ | |
LIBDIR=library/ | |
GCCDIR=compiler/ | |
SOYDIR=templates/ | |
GSSDIR=stylesheets/ | |
PSTJLIBDIR=pstj/ | |
SMJSLIBDIR=smjs/ | |
EXTERNSDIR=externs/ | |
[email protected]:google/closure-library.git | |
[email protected]:google/closure-compiler.git | |
[email protected]:google/closure-templates.git | |
[email protected]:google/closure-stylesheets.git | |
[email protected]:pstjvn/pstj-closure.git | |
[email protected]:pstjvn/smjslib.git | |
[email protected]:pstjvn/gcc-externs.git | |
GCC_BINARY_LINK=http://dl.google.com/closure-compiler/compiler-latest.tar.gz | |
GSS_BINARY_LINK=https://github.com/google/closure-stylesheets/releases/download/v1.4.0/closure-stylesheets.jar | |
SOY_BINARY_LINK=http://dl.google.com/closure-templates/closure-templates-for-javascript-latest.zip | |
MSG_EXTRACTOR_LINK=https://dl.google.com/closure-templates/closure-templates-msg-extractor-latest.zip | |
CLANG_BINARY_LINK=http://llvm.org/releases/3.9.0/clang+llvm-3.9.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz | |
#### Helper functions | |
function closurecompiler { | |
if [[ ! -d $GCCDIR ]]; then | |
mkdir $GCCDIR | |
fi | |
cd $GCCDIR | |
rm -rf closure-* | |
wget $GCC_BINARY_LINK | |
tar xf compiler-latest.tar.gz | |
rm compiler-latest.tar.gz | |
ln -sf closure-compiler* compiler.jar | |
cd ../ | |
} | |
function soycompiler { | |
if [[ ! -d $SOYDIR ]]; then | |
mkdir $SOYDIR | |
fi | |
cd $SOYDIR | |
wget $SOY_BINARY_LINK | |
wget $MSG_EXTRACTOR_LINK | |
unzip -o closure-templates-for-javascript-latest.zip | |
unzip -o closure-templates-msg-extractor-latest.zip | |
rm closure-templates-for-javascript-latest.zip | |
rm closure-templates-msg-extractor-latest.zip | |
python ../library/closure/bin/build/depswriter.py \ | |
--path_with_depspath="./soyutils_usegoog.js ../../../templates/soyutils_usegoog.js" \ | |
--output_file=deps.js | |
cd ../ | |
} | |
function gsscompiler { | |
if [[ ! -d $GSSDIR ]]; then | |
mkdir $GSSDIR | |
fi | |
cd $GSSDIR | |
rm -rf closure-stylesheets.jar | |
wget $GSS_BINARY_LINK | |
cd ../ | |
} | |
function compilers { | |
closurecompiler | |
soycompiler | |
gsscompiler | |
} | |
### Library helpers - download / update any library code. | |
function alib { | |
if [[ ! -d $1 ]]; then | |
git clone $2 $1 | |
else | |
cd $1 | |
git pull | |
cd ../ | |
fi | |
} | |
function closurelibrary { | |
alib $LIBDIR $LIBREPO | |
} | |
function pstjlibrary { | |
alib $PSTJLIBDIR $PSTJLIBREPO | |
cd $PSTJLIBDIR | |
cd nodejs | |
npm install | |
cd ../../ | |
} | |
function smjslibrary { | |
alib $SMJSLIBDIR $SMJSLIBREPO | |
} | |
function externslibrary { | |
alib $EXTERNSDIR $EXTERNSREPO | |
} | |
function enterapps { | |
if [[ ! -d $APPSDIR ]]; then mkdir $APPSDIR; fi | |
cd $APPSDIR | |
} | |
function exitapps { | |
cd ../ | |
} | |
function libs { | |
closurelibrary | |
enterapps | |
pstjlibrary | |
smjslibrary | |
externslibrary | |
exitapps | |
} | |
function clang { | |
if [[ ! -e clang/bin/clang-format ]]; then | |
rm -rf clang* | |
wget $CLANG_BINARY_LINK | |
tar xf clang+llvm-3.* | |
rm clang+llvm-3.*.xz | |
mv clang+llvm-3.* clang | |
fi | |
} | |
### Main entry point | |
compilers | |
libs | |
# clang |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment