diff options
author | Camil Staps | 2020-09-05 11:19:22 +0200 |
---|---|---|
committer | Camil Staps | 2020-09-05 11:19:22 +0200 |
commit | 72a23d0efbc406610eb6d852782f6a1bf911b101 (patch) | |
tree | 9460837de85ac2e69580f970ee8d4343b48fc562 | |
parent | Fix git gutter highlights (diff) |
install_clean: install both x64 and x86 by default; be less verbose
-rwxr-xr-x | clean/bin/install_clean | 174 |
1 files changed, 99 insertions, 75 deletions
diff --git a/clean/bin/install_clean b/clean/bin/install_clean index 78d949e..74025c9 100755 --- a/clean/bin/install_clean +++ b/clean/bin/install_clean @@ -1,95 +1,119 @@ #!/bin/bash -PLATFORM="$1" -if [ -z "$PLATFORM" ]; then - PLATFORM="x64" -fi +DEFAULT_PLATFORMS="x64 x86" +PACKAGES="base + abc-interpreter + lib-argenv + lib-directory + lib-dynamics + lib-gast + lib-graphcopy + lib-itasks + lib-platform + lib-stdlib + lib-tcpip + test" -if [ -d "$CLEAN_HOME" ]; then - rm -rf "$CLEAN_HOME.bak" - mv "$CLEAN_HOME" "$CLEAN_HOME.bak" -else - rm -rf "$CLEAN_HOME" -fi +link_local_file () +{ + DIR="$1" + FROM="$2" + TO="$3" -mkdir -p "$CLEAN_HOME" -for pkg in \ - base \ - abc-interpreter \ - lib-argenv \ - lib-directory \ - lib-dynamics \ - lib-gast \ - lib-graphcopy \ - lib-itasks \ - lib-platform \ - lib-stdlib \ - lib-tcpip \ - test -do - curl ftp://ftp.cs.ru.nl/pub/Clean/builds/linux-$PLATFORM/clean-$pkg-linux-$PLATFORM-latest.tgz\ - | tar xz --strip-components=1 -C "$CLEAN_HOME" -done + mkdir -p "$(dirname "$DIR/$FROM")" + if [ -f "$DIR/$FROM" ]; then + mv "$DIR/$FROM" "$DIR/$FROM.org" + ln -s "$(realpath --no-symlinks "$TO")" "$DIR/$FROM.new" + ln -s "$(basename "$FROM").new" "$DIR/$FROM" + else + ln -s "$(realpath --no-symlinks "$TO")" "$DIR/$FROM" + fi +} -grep -h '^[[:space:]]' "$CLEAN_HOME"/etc/*.env >> "$CLEAN_HOME/etc/IDEEnvs" -if [[ "$PLATFORM" = "x86" ]]; then - sed \ - -e 's/gc-sections/gc-sections -m32/' \ - -e 's/Linux-64/Linux-32/' \ - -e 's/Environment64BitProcessor:\tTrue/Environment64BitProcessor:\tFalse/' \ - ~/.clean/iTasksDev.env >> "$CLEAN_HOME/etc/IDEEnvs" -else - cat ~/.clean/iTasksDev.env >> "$CLEAN_HOME/etc/IDEEnvs" -fi -tail -n +3 ~/projects/viia/config/IDEEnvs >> "$CLEAN_HOME/etc/IDEEnvs" -ln -s lib/exe "$CLEAN_HOME/exe" +install () +{ + PLATFORM="$1" + PACKAGES="$2" + DIR="$3" + + if [ -d "$DIR" ]; then + rm -rf "$DIR.bak" + mv "$DIR" "$DIR.bak" + else + rm -rf "$DIR" + fi -# cloogletags -cloogletags -a -c -d "$CLEAN_HOME/lib" -o "$CLEAN_HOME/lib/tags" + mkdir -p "$DIR" + for pkg in $PACKAGES + do + echo "Fetching $pkg..." + curl -# ftp://ftp.cs.ru.nl/pub/Clean/builds/linux-$PLATFORM/clean-$pkg-linux-$PLATFORM-latest.tgz\ + | tar xz --strip-components=1 -C "$DIR" + done -link_local_file(){ - echo "$1 -> $2" - mkdir -p "$(dirname "$CLEAN_HOME/$1")" - if [ -f "$CLEAN_HOME/$1" ]; then - mv "$CLEAN_HOME/$1" "$CLEAN_HOME/$1.org" - ln -s "$(realpath --no-symlinks "$2")" "$CLEAN_HOME/$1.new" - ln -s "$(basename "$1").new" "$CLEAN_HOME/$1" + grep -h '^[[:space:]]' "$DIR"/etc/*.env >> "$DIR/etc/IDEEnvs" + if [[ "$PLATFORM" = "x86" ]]; then + sed \ + -e 's/gc-sections/gc-sections -m32/' \ + -e 's/Linux-64/Linux-32/' \ + -e 's/Environment64BitProcessor:\tTrue/Environment64BitProcessor:\tFalse/' \ + ~/.clean/iTasksDev.env >> "$DIR/etc/IDEEnvs" else - ln -s "$(realpath --no-symlinks "$2")" "$CLEAN_HOME/$1" + cat ~/.clean/iTasksDev.env >> "$DIR/etc/IDEEnvs" fi -} + tail -n +3 ~/projects/viia/config/IDEEnvs >> "$DIR/etc/IDEEnvs" + + ln -s lib/exe "$DIR/exe" + + # cloogletags + cloogletags -q -q -a -c -d "$DIR/lib" -o "$DIR/lib/tags" + + # Local versions of binaries + #link_local_file "$DIR" bin/cpm ~/projects/clean/ide/cpm/cpm -# Local versions of binaries -#link_local_file bin/cpm ~/projects/clean/ide/cpm/cpm + link_local_file "$DIR" lib/exe/cocl /home/camil/projects/clean/compiler/cocl + rm "$DIR/lib/exe/cocl" + ln -s cocl.org "$DIR/lib/exe/cocl" -link_local_file lib/exe/cocl /home/camil/projects/clean/compiler/cocl -rm $CLEAN_HOME/lib/exe/cocl -ln -s cocl.org $CLEAN_HOME/lib/exe/cocl + #link_local_file "$DIR" lib/exe/cg /home/camil/projects/clean/code-generator/cg -#link_local_file lib/exe/cg /home/camil/projects/clean/code-generator/cg + link_local_file "$DIR" bin/cleantest ~/projects/clean/test/cleantest + link_local_file "$DIR" bin/testproperties ~/projects/clean/test-properties/src/testproperties -link_local_file bin/cleantest ~/projects/clean/test/cleantest -link_local_file bin/testproperties ~/projects/clean/test-properties/src/testproperties + link_local_file "$DIR" data/cleandoc-default ~/projects/clean/doc/data/cleandoc-default + link_local_file "$DIR" bin/cleandoc ~/projects/clean/doc/src/cleandoc -link_local_file data/cleandoc-default ~/projects/clean/doc/data/cleandoc-default -link_local_file bin/cleandoc ~/projects/clean/doc/src/cleandoc + link_local_file "$DIR" bin/cleanprof2callgrind ~/projects/clean/prof2callgrind/cleanprof2callgrind -link_local_file bin/cleanprof2callgrind ~/projects/clean/prof2callgrind/cleanprof2callgrind + # ABC interpreter binaries + link_local_file "$DIR" lib/exe/abcopt ~/projects/clean/abc-interpreter/src/abcopt + link_local_file "$DIR" lib/exe/bcgen ~/projects/clean/abc-interpreter/src/bcgen + link_local_file "$DIR" lib/exe/bclink ~/projects/clean/abc-interpreter/src/bclink + link_local_file "$DIR" lib/exe/bcprelink ~/projects/clean/abc-interpreter/src/bcprelink + link_local_file "$DIR" lib/exe/bcstrip ~/projects/clean/abc-interpreter/src/bcstrip -# ABC interpreter binaries -link_local_file lib/exe/abcopt ~/projects/clean/abc-interpreter/src/abcopt -link_local_file lib/exe/bcgen ~/projects/clean/abc-interpreter/src/bcgen -link_local_file lib/exe/bclink ~/projects/clean/abc-interpreter/src/bclink -link_local_file lib/exe/bcprelink ~/projects/clean/abc-interpreter/src/bcprelink -link_local_file lib/exe/bcstrip ~/projects/clean/abc-interpreter/src/bcstrip + # completion + for f in ~/projects/clean/bash-completion/*; do + [ -f "$f" ] || continue + base="$(basename "$f")" + if [[ "$base" == "Makefile" ]] || [[ "$base" == "README.md" ]] || [[ "$base" =~ .tar.gz$ ]]; then + continue + fi + link_local_file $DIR "etc/completion/$base" "$f" + done +} + +PLATFORMS=$@ +if [ -z "$PLATFORMS" ]; then + PLATFORMS="$DEFAULT_PLATFORMS" +fi + +for PLATFORM in $PLATFORMS +do + install $PLATFORM "$PACKAGES" "$CLEAN_HOME-$PLATFORM" -# completion -for f in ~/projects/clean/bash-completion/*; do - [ -f "$f" ] || continue - base="$(basename "$f")" - if [[ "$base" == "Makefile" ]] || [[ "$base" == "README.md" ]] || [[ "$base" =~ .tar.gz$ ]]; then - continue + if [ ! -e "$CLEAN_HOME" ]; then + ln -s "$CLEAN_HOME-$PLATFORM" "$CLEAN_HOME" fi - link_local_file "etc/completion/$base" "$f" done |