#!/bin/bash set -e while getopts "d:s:v" OPTION; do case $OPTION in d) dest_dir="$OPTARG" ;; s) version="$OPTARG" ;; v) set -x ;; esac done shift $((OPTIND-1)) if [ -e "$dest_dir" ]; then echo "ERROR: Cannot install into existing directory: $dest_dir" exit 1 fi mkdir -p "$dest_dir" case "$version" in "cpu2000"*) git_repo="CPU2000.git" ;; "cpu2006"*) git_repo="CPU2006.git" ;; "cpu2017"*) git_repo="CPU2017.git" ;; *) echo "UNKNOWN SPEC VERSION: $version" exit 1 ;; esac if [ $# -gt 0 ]; then echo "ERROR: Extra arguments: $@" exit 1 fi branch="" if [ x"$version" = x"${version%v*}" ]; then branch="-b master --single-branch" fi git clone $branch --reference "/home/shared/git/$git_repo" \ "ssh://dev-private-git.linaro.org/restricted-benchmarks/$git_repo" \ "$dest_dir" if [ x"$version" = x"${version%v*}" ]; then version="${version}v$(cat "$dest_dir/version.txt")" fi cpu="$(uname -m)" case "$cpu" in "armv8l") cpu=armv7l ;; esac case "$version" in "cpu2000"*) case "$cpu" in "x86_64") arch=linux-glibc22-x86_64 ;; "ia32") arch=linux-redhat62-ia32 ;; "armv7l") arch=linux-armv7l ;; "aarch64") arch=linux-aarch64 ;; esac ;; "cpu2006"*) case "$cpu" in "x86_64") arch=linux-suse10-amd64 ;; "ia32") arch=linux-redhat62-ia32 ;; "armv7l") arch=linux-armv7l ;; "aarch64") arch=linux-apm-arm64 ;; esac ;; "cpu2017"*) case "$cpu" in "x86_64") arch=linux-x86_64 ;; "ia32") arch=linux-x86_64 ;; "armv7l") arch=linux-armv7l ;; "aarch64") arch=linux-aarch64 ;; esac ;; esac case "$version" in "cpu2000"*) (cd $dest_dir && ./install.sh $arch) ;; "cpu2006"*|"cpu2017"*) (cd $dest_dir && ./install.sh -f -u $arch) ;; esac case "$version" in "cpu2006"*) # Add a Makefile rule that all sources should be generated before # starting compilation. This works around parallelization problem # when using rsync-based remote compilation. echo '$(OBJS): $(FINAL_SOURCES)' >> $dest_dir/benchspec/Makefile.defaults ;; esac