This repository has been archived by the owner on May 29, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgnstand-build.sh
53 lines (44 loc) · 1.48 KB
/
gnstand-build.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
#!/bin/sh
# gnstand-build.sh: magic to build a standalone GN
# Jashank Jeremy <[email protected]>
set -e
cd gn.stand
if [ `uname -s` = 'Linux' ]
then
if [ `uname -m` = 'x86_64' ]
then
GN=buildtools/linux64/gn
elif [ `uname -m` = 'i386' ]
then
GN=buildtools/linux32/gn
else
echo "=== unsupported architecture!"
fi
elif [ `uname -s` = 'Darwin' ]
then
GN=buildtools/mac/gn
else
echo "=== unsupported OS!"
fi
# Notes:
#
# - force !Clang because this depends on in-tree LLVM and other magic;
#
# - force GCC to use ld.gold, not ld.bfd;
# Use buildtools GN to build a bootstrap version
$GN gen --args='is_clang=false' out/GNBoot && \
sed -i.bak -e 's/g++ \$ldflags/g++ -fuse-ld=gold \$ldflags/' \
-e 's/g++ -shared/g++ -fuse-ld=gold -shared/' out/GNBoot/toolchain.ninja && \
ninja -C out/GNBoot gn -j 4
# Use bootstrapped GN to build GN
out/GNBoot/gn gen --args='is_clang=false' out/GNStrap && \
sed -i.bak -e 's/g++ \$ldflags/g++ -fuse-ld=gold \$ldflags/' \
-e 's/g++ -shared/g++ -fuse-ld=gold -shared/' out/GNStrap/toolchain.ninja && \
ninja -C out/GNStrap gn -j 15
# Use built GN to build GN
out/GNStrap/gn gen --args='is_clang=false' out/GNStand && \
sed -i.bak -e 's/g++ \$ldflags/g++ -fuse-ld=gold \$ldflags/' \
-e 's/g++ -shared/g++ -fuse-ld=gold -shared/' out/GNStand/toolchain.ninja && \
ninja -C out/GNStand gn gn_unittests -j 15
out/GNStand/gn_unittests
# if we've gotten this far, it worked