Skip to content

Commit

Permalink
refactor: clone git repos using Docker
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Aug 20, 2024
1 parent e975fa9 commit a49882b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 30 deletions.
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
bison \
git \
flex \
libgmp-dev \
libisl-dev \
Expand All @@ -14,8 +13,15 @@ RUN set -eux; \
; \
rm -rf /var/lib/apt/lists/*;

WORKDIR /root/
ADD ./toolchain.sh /root/toolchain.sh
WORKDIR /root

ADD --link https://github.com/hermit-os/binutils.git binutils
ADD --link https://github.com/hermit-os/gcc.git gcc
ADD --link https://github.com/hermit-os/kernel.git kernel
ADD --link https://github.com/hermit-os/newlib.git newlib
ADD --link https://github.com/hermit-os/pthread-embedded.git pte
ADD --link ./toolchain.sh ./toolchain.sh

RUN ./toolchain.sh x86_64-hermit /opt/hermit


Expand Down
27 changes: 0 additions & 27 deletions toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
# exit when any command fails
set -e

BUILDDIR=build
CLONE_DEPTH="--depth=50"
PREFIX="$2"
TARGET=$1
NJOBS=-j"$(nproc)"
Expand All @@ -24,29 +22,6 @@ export CXXFLAGS_FOR_TARGET="-fPIE -pie"

echo "Build bootstrap toolchain for $TARGET with $NJOBS jobs for $PREFIX"

mkdir -p $BUILDDIR
cd $BUILDDIR

if [ ! -d "binutils" ]; then
git clone $CLONE_DEPTH https://github.com/hermit-os/binutils.git
fi

if [ ! -d "gcc" ]; then
git clone $CLONE_DEPTH https://github.com/hermit-os/gcc.git
fi

if [ ! -d "kernel" ]; then
git clone https://github.com/hermit-os/kernel
fi

if [ ! -d "newlib" ]; then
git clone $CLONE_DEPTH -b path2rs https://github.com/hermit-os/newlib.git
fi

if [ ! -d "pte" ]; then
git clone $CLONE_DEPTH -b path2rs https://github.com/hermit-os/pthread-embedded.git pte
fi

if [ ! -d "tmp/binutils" ]; then
mkdir -p tmp/binutils
cd tmp/binutils
Expand Down Expand Up @@ -149,5 +124,3 @@ make -O $NJOBS
make install
cd -
fi

cd ..

0 comments on commit a49882b

Please sign in to comment.