forked from qbit/rust-cross-openbsd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstage4-openbsd.sh
executable file
·62 lines (55 loc) · 1.4 KB
/
stage4-openbsd.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
if [ `uname -s` != "OpenBSD" ]; then
echo "You have to run this on OpenBSD!"
exit 1
fi
if [ ! -e "stage3-openbsd/bin/rustc" ]; then
echo "stage3-openbsd does not exist!"
exit 1
fi
mkdir -p stage4-openbsd
cd stage4-openbsd
TOP=`pwd`
export AS="/usr/local/bin/egcc-as"
export CC="/usr/local/bin/egcc"
export CXX="/usr/local/bin/eg++"
export LDFLAGS="-L/usr/local/lib"
export CFLAGS="-I/usr/local/include"
export CXXFLAGS="-I/usr/local/include/c++/4.8.3/"
PREFIX="/usr/local"
if [ ! -e rust ]; then
if [ -e ${TOP}/../stage1-openbsd/rust ]; then
git clone --reference ${TOP}/stage1-openbsd/rust https://github.com/rust-lang/rust.git
else
git clone https://github.com/rust-lang/rust.git
fi
fi
cd rust
git submodule init
git submodule update
if [ ! -e .patched ]; then
patch -p1 < ${TOP}/../patch-rust
date > .patched
else
echo "Rust already patched on:" `cat .patched`
fi
cd src/jemalloc
if [ ! -e .patched ]; then
patch -p1 < ${TOP}/../patch-jemalloc
date > .patched
else
echo "jemalloc already patched on:" `cat .patched`
fi
cd ../llvm
if [ ! -e .patched ]; then
patch -p1 < ${TOP}/../patch-llvm
date > .patched
else
echo "LLVM already patched on:" `cat .patched`
fi
cd ..
mkdir -p llvm-build
cd llvm-build
../llvm/configure --enable-local-rust --local-rust-root=${TOP}/../stage3-openbsd --prefix=${PREFIX}
gmake VERBOSE=1
p=`pwd`
echo "To install to ${PREFIX}: cd $p && gmake install"