Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: toolchain into multiple bldr packages #8

Merged
merged 1 commit into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ endif

COMMON_ARGS = --progress=auto
COMMON_ARGS += --frontend=dockerfile.v0
COMMON_ARGS += --allow security.insecure
COMMON_ARGS += --local context=.
COMMON_ARGS += --local dockerfile=.
COMMON_ARGS += --opt filename=Pkgfile
Expand Down Expand Up @@ -74,8 +73,7 @@ ifneq ($(BUILDKIT_CONTAINER_RUNNING),$(BUILDKIT_CONTAINER_NAME))
--privileged \
-p 1234:1234 \
$(BUILDKIT_IMAGE) \
--addr $(BUILDKIT_HOST) \
--allow-insecure-entitlement security.insecure
--addr $(BUILDKIT_HOST)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need --addr, buildkit will respect BUILDKIT_HOST env var, but we can clean this up later.

@echo "Wait for buildkitd to become available"
@sleep 5
endif
Expand Down
36 changes: 35 additions & 1 deletion Pkgfile
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
# syntax = docker.io/autonomy/bldr:2b3b543-frontend
# syntax = docker.io/autonomy/bldr:v0.1.0-alpha.0-frontend

format: v1alpha2

vars:
BOOTSTRAP: /bootstrap

binutils_version: 2.33.1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got these exposed top-level to avoid duplication between multiple packages using same sources, and so that we can't forget to bump all of them

binutils_sha256: ab66fc2d1c3ec0359b8e08843c9f33b63e8707efdff5e4cc5c200eae24722cbf
binutils_sha512: b7a6767c6c7ca6b5cafa7080e6820b7bb3a53b7148348c438d99905defbdf0d30c9744a484ee01c9441a8153901808513366b15ba9533e20c9673c262ade36ac

gcc_version: 8.3.0
gcc_sha256: 64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c
gcc_sha512: 1811337ae3add9680cec64968a2509d085b6dc5b6783fc1e8c295e3e47416196fd1a3ad8dfe7e10be2276b4f62c357659ce2902f239f60a8648548231b4b5802

mpfr_version: 4.0.2
mpfr_sha256: 1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a
mpfr_sha512: d583555d08863bf36c89b289ae26bae353d9a31f08ee3894520992d2c26e5683c4c9c193d7ad139632f71c0a476d85ea76182702a98bf08dde7b6f65a54f8b88

gmp_version: 6.1.2
gmp_sha256: 87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912
gmp_sha512: 9f098281c0593b76ee174b722936952671fab1dae353ce3ed436a31fe2bc9d542eca752353f6645b7077c1f395ab4fdd355c58e08e2a801368f1375690eee2c6

mpc_version: 1.1.0
mpc_sha256: 6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e
mpc_sha512: 72d657958b07c7812dc9c7cbae093118ce0e454c68a585bfb0e2fa559f1bf7c5f49b93906f580ab3f1073e5b595d23c6494d4d76b765d16dde857a18dd239628

linux_series: v4.x
linux_version: 4.19.40
linux_sha256: 6fd8cd4d8a15d7bfb4a7968fbe104f97f8c5ff557c752aae43fe13a6ca073fb0
linux_sha512: b9f2bfd8366c7c8315ff27beffcc8e6c0b2c1a92ebc344af8eecfccec63c0fcf8243abc27a1c6297deac0ad69ab9d4ddfb312c9b58c567ff6755b487d8b13c28

musl_version: 1.1.24
musl_sha256: 1370c9a812b2cf2a7d92802510cca0058cc37e66a7bedd70051f0a34015022a3
musl_sha512: 8987f1e194ea616f34f4f21fe9def28fb7f81d7060e38619206c6349f79db3bbb76bae8b711f5f9b8ed038799c9aea1a4cbec69e0bc4131e246203e133149e77
44 changes: 44 additions & 0 deletions binutils/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: binutils
install:
- make
dependencies:
- stage: bootstrap
- stage: musl
steps:
- sources:
- url: https://ftp.gnu.org/gnu/binutils/binutils-{{ .binutils_version }}.tar.xz
destination: binutils.tar.xz
sha256: "{{ .binutils_sha256 }}"
sha512: "{{ .binutils_sha512 }}"
env:
PATH: "{{ .BOOTSTRAP }}/bin:{{ .PATH }}"
prepare:
- |
tar -xJf binutils.tar.xz --strip-components=1

mkdir build
cd build

export CFLAGS="-I${TOOLCHAIN}/include"

../configure \
--build=${BUILD} \
--host=${HOST} \
--prefix=${TOOLCHAIN} \
--with-lib-path=${TOOLCHAIN}/lib \
--disable-nls \
--disable-werror
build:
- |
cd build
make -j $(nproc)
install:
- |
cd build
make install
make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cp -v ld/ld-new ${TOOLCHAIN}/bin
finalize:
- from: "{{ .TOOLCHAIN }}"
to: "{{ .TOOLCHAIN }}"
31 changes: 31 additions & 0 deletions bootstrap/binutils/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: bootstrap-binutils
install:
- build-base
steps:
- sources:
- url: https://ftp.gnu.org/gnu/binutils/binutils-{{ .binutils_version }}.tar.xz
destination: binutils.tar.xz
sha256: "{{ .binutils_sha256 }}"
sha512: "{{ .binutils_sha512 }}"
prepare:
- |
tar -xJf binutils.tar.xz --strip-components=1
mkdir build
cd build
../configure \
--build=${BUILD} \
--host=${HOST} \
--prefix={{ .BOOTSTRAP }} \
--disable-nls \
--disable-werror
build:
- |
cd build
make -j $(nproc)
install:
- |
cd build
make install
finalize:
- from: "{{ .BOOTSTRAP }}"
to: "{{ .BOOTSTRAP }}"
7 changes: 7 additions & 0 deletions bootstrap/bootstrap/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: bootstrap
variant: scratch
dependencies:
- stage: bootstrap-libstdcxx
finalize:
- from: "{{ .BOOTSTRAP }}"
to: "{{ .BOOTSTRAP }}"
89 changes: 89 additions & 0 deletions bootstrap/gcc/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: bootstrap-gcc
install:
- build-base
steps:
- sources:
- url: https://ftp.gnu.org/gnu/gcc/gcc-{{ .gcc_version }}/gcc-{{ .gcc_version }}.tar.xz
destination: gcc.tar.xz
sha256: "{{ .gcc_sha256 }}"
sha512: "{{ .gcc_sha512 }}"
- url: https://ftp.gnu.org/gnu/mpfr/mpfr-{{ .mpfr_version }}.tar.xz
destination: mpfr.tar.xz
sha256: "{{ .mpfr_sha256 }}"
sha512: "{{ .mpfr_sha512 }}"
- url: https://ftp.gnu.org/gnu/gmp/gmp-{{ .gmp_version }}.tar.xz
destination: gmp.tar.xz
sha256: "{{ .gmp_sha256 }}"
sha512: "{{ .gmp_sha512 }}"
- url: https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
destination: mpc.tar.gz
sha256: "{{ .mpc_sha256 }}"
sha512: "{{ .mpc_sha512 }}"
prepare:
- |
mkdir mpfr
tar -xJf mpfr.tar.xz --strip-components=1 -C mpfr

mkdir gmp
tar -xJf gmp.tar.xz --strip-components=1 -C gmp

mkdir mpc
tar -xzf mpc.tar.gz --strip-components=1 -C mpc

tar -xJf gcc.tar.xz --strip-components=1
mkdir build
cd build

for file in ../gcc/config/{aarch64/aarch64-linux,arm/{linux-eabi,linux-elf},linux,i386/linux{,64}}.h; do
cp -uv $file{,.orig}
sed -e "s@/lib\(64\)\?\(32\)\?/ld@{{ .TOOLCHAIN }}&@g" \
-e "s@/usr@${{ .TOOLCHAIN }}@g" $file.orig > $file
cat >> $file <<EOF
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "{{ .TOOLCHAIN }}/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""
EOF
touch $file.orig
done

sed -e '/m64=/s/lib64/lib/' -i.orig ../gcc/config/i386/t-linux64
sed -e '/mabi.lp64=/s/lib64/lib/' -i.orig ../gcc/config/aarch64/t-aarch64-linux

../configure \
--build=${BUILD} \
--host=${HOST} \
--prefix={{ .BOOTSTRAP }} \
--with-newlib \
--without-headers \
--disable-bootstrap \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libmpx \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--disable-libcilkrts \
--disable-libstdcxx-pch \
--disable-symvers \
--disable-libitm \
--disable-gnu-indirect-function \
--disable-libmudflap \
--disable-libsanitizer \
--enable-languages=c,c++
build:
- |
cd build
make -j $(nproc)
install:
- |
cd build
make install-strip
finalize:
- from: "{{ .BOOTSTRAP }}"
to: "{{ .BOOTSTRAP }}"
39 changes: 39 additions & 0 deletions bootstrap/libstdcxx/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: bootstrap-libstdcxx
install:
- make
dependencies:
- stage: bootstrap-musl
steps:
- sources:
- url: https://ftp.gnu.org/gnu/gcc/gcc-{{ .gcc_version }}/gcc-{{ .gcc_version }}.tar.xz
destination: gcc.tar.xz
sha256: "{{ .gcc_sha256 }}"
sha512: "{{ .gcc_sha512 }}"
env:
PATH: "{{ .BOOTSTRAP }}/bin:{{ .PATH }}"
prepare:
- |
tar -xJf gcc.tar.xz --strip-components=1

mkdir build
cd build

../libstdc++-v3/configure \
--host=${HOST} \
--prefix={{ .BOOTSTRAP }} \
--with-gxx-include-dir={{ .BOOTSTRAP }}/include/c++/{{ .gcc_version }} \
--disable-multilib \
--disable-nls \
--disable-libstdcxx-threads \
--disable-libstdcxx-pch
build:
- |
cd build
make -j $(nproc)
install:
- |
cd build
make install
finalize:
- from: "{{ .BOOTSTRAP }}"
to: "{{ .BOOTSTRAP }}"
41 changes: 41 additions & 0 deletions bootstrap/musl/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: bootstrap-musl
install:
- make
dependencies:
- stage: bootstrap-binutils
- stage: bootstrap-gcc
steps:
- sources:
- url: https://www.musl-libc.org/releases/musl-{{ .musl_version }}.tar.gz
destination: musl.tar.gz
sha256: "{{ .musl_sha256 }}"
sha512: "{{ .musl_sha512 }}"
env:
PATH: "{{ .BOOTSTRAP }}/bin:{{ .PATH }}"
prepare:
- |
tar -xzf musl.tar.gz --strip-components=1

mkdir build
cd build

../configure \
--prefix={{ .BOOTSTRAP }} \
--syslibdir={{ .BOOTSTRAP }}/lib \
build:
- |
cd build
make -j $(nproc)
install:
- |
cd build
make install
test:
- |
echo 'int main(){}' > dummy.c

gcc dummy.c
readelf -l a.out | tee | grep ": {{ .TOOLCHAIN }}"
finalize:
- from: "{{ .BOOTSTRAP }}"
to: "{{ .BOOTSTRAP }}"
Binary file modified deps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading