-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·81 lines (81 loc) · 2.46 KB
/
configure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
mkdir riscv
mkdir riscv/toolchain
export RISCV=$(readlink -f riscv/toolchain)
mkdir third_party
cd third_party
git clone --depth 1 --single-branch https://github.com/riscv/riscv-opcodes
git clone --depth 1 --single-branch https://github.com/riscv-software-src/riscv-isa-sim
git clone --depth 1 --single-branch https://github.com/riscv-software-src/riscv-tests
cd riscv-tests
git submodule update --init --recursive --progress --recommend-shallow --depth 1
cd ..
git clone --depth 1 --single-branch https://github.com/riscv-collab/riscv-gnu-toolchain
cd riscv-gnu-toolchain
git submodule update --init --recursive --progress --recommend-shallow --depth 1
cd ..
git clone --depth 1 --single-branch https://github.com/riscv-software-src/riscv-pk
git clone --depth 1 --single-branch https://github.com/llvm/llvm-project
git clone --depth 1 --single-branch https://github.com/ucb-bar/libgloss-htif
export MAKE=`command -v gmake || command -v make`
export PATH="$RISCV/bin:$PATH"
set -e
function build_project {
export PROJECT="$1"
shift
if [ -e "$PROJECT/build" ]
then
rm -rf "$PROJECT/build"
fi
if [ ! -e "$PROJECT/configure" ]
then
(
cd "$PROJECT"
find . -iname configure.ac | sed s/configure.ac/m4/ | xargs mkdir -p
autoreconf -i
)
fi
mkdir -p "$PROJECT/build"
cd "$PROJECT/build"
../configure $* > build.log
$MAKE >> build.log
$MAKE install >> build.log
cd - > /dev/null
}
build_project riscv-isa-sim --prefix=$RISCV
cd riscv-gnu-toolchain
sed -i .bak "s/.*=host-darwin.o$//" riscv-gcc/gcc/config.host
sed -i .bak "s/.* x-darwin.$//" riscv-gcc/gcc/config.host
cd ..
build_project riscv-gnu-toolchain --prefix=$RISCV --with-cmodel=medany
cd llvm-project
mkdir build
cd build
cmake -G "Unix Makefiles" \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;libc;libclc;libcxx;libcxxabi;libunwind;lld;lldb;openmp;polly;pstl" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$RISCV" \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-elf" \
-DDEFAULT_SYSROOT="$RISCV/riscv64-unknown-elf" \
-DGCC_INSTALL_PREFIX="$RISCV" \
../llvm
cmake --build .
cmake --build . --target install
cd ..
cd ..
cd riscv-pk
mkdir build
cd build
../configure --prefix=$RISCV --host=riscv64-unknown-elf --with-arch=rv64imafdcv
make
make install
cd ..
cd ..
cd libgloss-htif
mkdir build
cd build
CC=riscv64-unknown-elf-gcc CXX=riscv64-unknown-elf-g++ ../configure --prefix=$RISCV --host=riscv64-unknown-elf
make
cd ..
cd ..