Skip to content

Commit abf1076

Browse files
committed
rust-cg-gcc: adjust build scripture
Use latest instructions from the project. Don't build gcc anymore and fetch the libgccjit prebuilt by the project. Signed-off-by: Marc Poulhiès <[email protected]>
1 parent 7db05a7 commit abf1076

File tree

1 file changed

+9
-62
lines changed

1 file changed

+9
-62
lines changed

rust-cg-gcc/build.sh

Lines changed: 9 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -68,74 +68,18 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
6868

6969
source "$PWD/rustup/env"
7070

71-
##
72-
## Build customized GCC with libgccjit
73-
##
74-
75-
git clone --depth 1 "${GCC_URL}" --branch "${GCC_BRANCH}"
76-
77-
# clean
78-
rm -rf gcc-build gcc-install
79-
mkdir -p gcc-build gcc-install
80-
81-
echo "Downloading prerequisites"
82-
pushd gcc
83-
./contrib/download_prerequisites
84-
popd
85-
86-
pushd gcc-build
87-
LANGUAGES=jit,c++
88-
PKGVERSION="Compiler-Explorer-Build-${REVISION}"
89-
90-
CONFIG=("--enable-checking=release"
91-
"--enable-host-shared"
92-
"--build=x86_64-linux-gnu"
93-
"--host=x86_64-linux-gnu"
94-
"--target=x86_64-linux-gnu"
95-
"--disable-bootstrap"
96-
"--enable-multiarch"
97-
"--with-abi=m64"
98-
"--with-multilib-list=m32,m64,mx32"
99-
"--enable-multilib"
100-
"--enable-clocale=gnu"
101-
"--enable-languages=${LANGUAGES}"
102-
"--enable-ld=yes"
103-
"--enable-gold=yes"
104-
"--enable-libstdcxx-debug"
105-
"--enable-libstdcxx-time=yes"
106-
"--enable-linker-build-id"
107-
"--enable-lto"
108-
"--enable-plugins"
109-
"--enable-threads=posix"
110-
"--with-pkgversion=\"${PKGVERSION}\""
111-
## this is needed for all libs (gmp, mpfr, …) to be PIC so as to not cause issue
112-
## when they are statically linked in the libgccjit.so
113-
"--with-pic")
114-
115-
../gcc/configure --prefix="${PREFIX}" "${CONFIG[@]}"
116-
117-
make -j"$(nproc)"
118-
make -j"$(nproc)" install-strip
119-
popd
120-
121-
libgccjit_path=$(dirname $(readlink -f `find "$PREFIX" -name libgccjit.so`))
122-
123-
##
124-
## Back to rustc_cg_gcc for building
125-
##
12671
pushd rustc_codegen_gcc
12772

128-
echo "gcc-path = \"$libgccjit_path\"" > config.toml
73+
74+
# Do default config, as described in the "Quick start" guide on the project's
75+
# page.
76+
cp config.example.toml config.toml
12977

13078
./y.sh prepare
13179
./y.sh build --sysroot --release
13280

13381
popd
13482

135-
##
136-
## Everything should be correctly built
137-
##
138-
13983
##
14084
## Before packaging, remove build deps
14185
##
@@ -158,7 +102,11 @@ mkdir -p toolroot
158102
mv rustup/toolchains/*/* toolroot/
159103

160104
# libgccjit
161-
mv ./gcc-install/lib/libgccjit.so* toolroot/lib
105+
find -name "libgccjit.so" -exec mv {} toolroot/lib ';'
106+
107+
pushd toolroot/lib
108+
ln -s libgccjit.so libgccjit.so.0
109+
popd
162110

163111
# cg_gcc backend
164112
mv ./rustc_codegen_gcc/target/release/librustc_codegen_gcc.so toolroot/lib
@@ -178,7 +126,6 @@ patchelf --set-rpath '$ORIGIN/' toolroot/lib/librustc_codegen_gcc.so
178126
## - check for assembly output
179127
## - check for correct exec output
180128

181-
182129
echo "fn main() -> Result<(), &'static str> { Ok(()) }" > /tmp/test.rs
183130

184131
(export LD_LIBRARY_PATH="$PWD/toolroot/lib";

0 commit comments

Comments
 (0)