File tree Expand file tree Collapse file tree 2 files changed +76
-0
lines changed Expand file tree Collapse file tree 2 files changed +76
-0
lines changed Original file line number Diff line number Diff line change 1+ FROM ubuntu:20.04
2+
3+ ARG DEBIAN_FRONTEND=noninteractive
4+ RUN dpkg --add-architecture i386
5+ RUN apt update -y -q && apt upgrade -y -q && apt update -y -q && \
6+ apt install -y -q \
7+ build-essential \
8+ clang \
9+ cmake \
10+ curl \
11+ git \
12+ libclang-dev \
13+ libssl-dev \
14+ llvm \
15+ patchelf \
16+ pkg-config \
17+ python3
18+
19+ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
20+
21+ RUN mkdir -p /root
22+ COPY c2rust /root/
23+ COPY common.sh /root/
24+
25+ WORKDIR /root
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -exu
4+ source common.sh
5+ source $HOME /.cargo/env
6+
7+ # # $1 : version, like v0.9 (tag) or master (branch)
8+ # # $2 : destination: a directory or S3 path (eg. s3://...)
9+ # # $3 : last revision successfully built (optional)
10+
11+ VERSION=$1
12+
13+ # TODO: Add support for building tagged releases.
14+ if [[ " ${VERSION} " != " master" ]]; then
15+ echo " Only support building master"
16+ exit 1
17+ fi
18+
19+ VERSION=master-$( date +%Y%m%d)
20+ BRANCH=master
21+
22+ URL=https://github.com/immunant/c2rust
23+
24+ FULLNAME=c2rust-${VERSION} .tar.xz
25+ OUTPUT=$2 /${FULLNAME}
26+
27+ REVISION=" c2rust-$( get_remote_revision " ${URL} " " heads/${BRANCH} " ) "
28+ LAST_REVISION=" ${3:- } "
29+
30+ initialise " ${REVISION} " " ${OUTPUT} " " ${LAST_REVISION} "
31+
32+ OUT=$( pwd) /out
33+ DIR=$( pwd) /c2rust
34+ BUILD=${DIR} /target/release
35+
36+ git clone --depth 1 -b " ${BRANCH} " " ${URL} " " ${DIR} "
37+
38+ cd $DIR
39+ rustup toolchain install
40+ cargo build --release
41+ mkdir -p " ${OUT} "
42+
43+ cp " ${BUILD} /c2rust" " ${BUILD} /c2rust-transpile" " ${OUT} "
44+
45+ # Copy all dependency .so files into the output dir and then set the RPATH to
46+ # $ORIGIN so that the local version gets used instead of whatever is insalled
47+ # globally.
48+ cp $( ldd " ${OUT} " /* | grep -E ' => /' | grep -Ev ' lib(pthread|c|dl|rt)\.so' | awk ' {print $3}' | uniq) " ${OUT} "
49+ patchelf --set-rpath ' $ORIGIN' $" $OUT " /*
50+
51+ complete " ${OUT} " " c2rust-${VERSION} " " ${OUTPUT} "
You can’t perform that action at this time.
0 commit comments