diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1aac33..1d463a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,10 +3,10 @@ name: Build on: push: branches: [ main ] - paths: [ .github/workflows/build.yml, config/**, docker/**, scripts/**] + paths: [ .github/workflows/build.yml, cconfig/**, config/**, docker/**, scripts/**] pull_request: branches: [ main ] - paths: [ .github/workflows/build.yml, config/**, docker/**, scripts/**] + paths: [ .github/workflows/build.yml, cconfig/**, config/**, docker/**, scripts/**] workflow_dispatch: permissions: { } @@ -16,7 +16,9 @@ jobs: strategy: fail-fast: false matrix: - platform: [ amd64, arm64 ] + cross: + - aarch64-linux-gnu + - x86_64-linux-gnu target: - aarch64-unknown-linux-musl - armv7-unknown-linux-musleabihf @@ -42,13 +44,15 @@ jobs: push: false load: true tags: ink-toolchain:dev - platforms: linux/${{ matrix.platform }} + build-args: | + CCONFIG=x86_64-linux-gnu---${{ matrix.cross }} + platforms: linux/amd64 builder: ${{ steps.buildx.outputs.name }} - name: Extract - run: TARGETARCH='${{ matrix.platform }}' ./scripts/extract.sh + run: ./scripts/extract.sh - name: Artifact uses: actions/upload-artifact@v4 with: - name: "${{ matrix.platform }}+${{ matrix.target }}" + name: "${{ matrix.cross }}+${{ matrix.target }}" path: | export/*.tar.gz diff --git a/README.md b/README.md index edaaa32..51967e4 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ Cross compiling toolchains meant for [ink-cross-images](https://github.com/cargo ### 2024.01 (Upcoming) -#### Platform Support +#### Host Platform Support -- aarch64-unknown-linux-gnu -- x86_64-unknown-linux-gnu +- aarch64-linux-gnu +- x86_64-linux-gnu #### Versions diff --git a/cconfig/.config b/cconfig/.config new file mode 100644 index 0000000..e69de29 diff --git a/cconfig/aarch64-linux-gnu---aarch64-linux-gnu.config b/cconfig/aarch64-linux-gnu---aarch64-linux-gnu.config new file mode 100644 index 0000000..e69de29 diff --git a/cconfig/aarch64-linux-gnu---x86_64-linux-gnu.config b/cconfig/aarch64-linux-gnu---x86_64-linux-gnu.config new file mode 100644 index 0000000..14ec32c --- /dev/null +++ b/cconfig/aarch64-linux-gnu---x86_64-linux-gnu.config @@ -0,0 +1,10 @@ +CT_CANADIAN=y +CT_TOOLCHAIN_TYPE="canadian" + +CT_BUILD="aarch64-linux-gnu" +CT_BUILD_PREFIX="aarch64-linux-gnu-" +CT_BUILD_SUFFIX="" + +CT_HOST="x86_64-linux-gnu" +CT_HOST_PREFIX="x86_64-linux-gnu-" +CT_HOST_SUFFIX="" diff --git a/cconfig/x86_64-linux-gnu---aarch64-linux-gnu.config b/cconfig/x86_64-linux-gnu---aarch64-linux-gnu.config new file mode 100644 index 0000000..147b28d --- /dev/null +++ b/cconfig/x86_64-linux-gnu---aarch64-linux-gnu.config @@ -0,0 +1,10 @@ +CT_CANADIAN=y +CT_TOOLCHAIN_TYPE="canadian" + +CT_BUILD="x86_64-linux-gnu" +CT_BUILD_PREFIX="x86_64-linux-gnu-" +CT_BUILD_SUFFIX="" + +CT_HOST="aarch64-linux-gnu" +CT_HOST_PREFIX="aarch64-linux-gnu-" +CT_HOST_SUFFIX="" diff --git a/cconfig/x86_64-linux-gnu---x86_64-linux-gnu.config b/cconfig/x86_64-linux-gnu---x86_64-linux-gnu.config new file mode 100644 index 0000000..e69de29 diff --git a/docker/aarch64-unknown-linux-musl.Dockerfile b/docker/aarch64-unknown-linux-musl.Dockerfile index 3de1619..b0920c8 100644 --- a/docker/aarch64-unknown-linux-musl.Dockerfile +++ b/docker/aarch64-unknown-linux-musl.Dockerfile @@ -18,6 +18,8 @@ RUN --mount=type=bind,source=./scripts/manage-apt.sh,target=/run.sh /run.sh RUN --mount=type=bind,source=./scripts/build-crosstool.sh,target=/run.sh /run.sh COPY ./config/${RUST_TARGET}.config /.config +ARG CCONFIG="" +COPY ./cconfig/${CCONFIG}.config /.cconfig RUN --mount=type=bind,source=./scripts/build-cross.sh,target=/run.sh /run.sh RUN --mount=type=bind,source=./scripts/package.sh,target=/run.sh /run.sh diff --git a/docker/armv7-unknown-linux-musleabihf.Dockerfile b/docker/armv7-unknown-linux-musleabihf.Dockerfile index d920926..2dea0af 100644 --- a/docker/armv7-unknown-linux-musleabihf.Dockerfile +++ b/docker/armv7-unknown-linux-musleabihf.Dockerfile @@ -18,6 +18,8 @@ RUN --mount=type=bind,source=./scripts/manage-apt.sh,target=/run.sh /run.sh RUN --mount=type=bind,source=./scripts/build-crosstool.sh,target=/run.sh /run.sh COPY ./config/${RUST_TARGET}.config /.config +ARG CCONFIG="" +COPY ./cconfig/${CCONFIG}.config /.cconfig RUN --mount=type=bind,source=./scripts/build-cross.sh,target=/run.sh /run.sh RUN --mount=type=bind,source=./scripts/package.sh,target=/run.sh /run.sh diff --git a/docker/x86_64-unknown-linux-musl.Dockerfile b/docker/x86_64-unknown-linux-musl.Dockerfile index c59f16a..33c0164 100644 --- a/docker/x86_64-unknown-linux-musl.Dockerfile +++ b/docker/x86_64-unknown-linux-musl.Dockerfile @@ -18,6 +18,8 @@ RUN --mount=type=bind,source=./scripts/manage-apt.sh,target=/run.sh /run.sh RUN --mount=type=bind,source=./scripts/build-crosstool.sh,target=/run.sh /run.sh COPY ./config/${RUST_TARGET}.config /.config +ARG CCONFIG="" +COPY ./cconfig/${CCONFIG}.config /.cconfig RUN --mount=type=bind,source=./scripts/build-cross.sh,target=/run.sh /run.sh RUN --mount=type=bind,source=./scripts/package.sh,target=/run.sh /run.sh diff --git a/scripts/build-cross.sh b/scripts/build-cross.sh index c175db3..d54484c 100755 --- a/scripts/build-cross.sh +++ b/scripts/build-cross.sh @@ -6,20 +6,10 @@ mkdir -p /tmp/build pushd /tmp/build mv /.config . +cat /.cconfig >> ./.config + ct-ng olddefconfig ct-ng build -# Package -#pushd /tmp/crosstoolchains -# -#tar -czvf "$CROSS_TOOLCHAIN".tar.gz . -# -#mkdir -p /export -#mv *.tar.gz /export -#mv /export/*.tar.gz /export/export.tar.gz - -#popd -#rm -rf /tmp/crosstoolchains - popd rm -rf /temp/build diff --git a/scripts/extract.sh b/scripts/extract.sh index 72f9815..0cdd8c1 100755 --- a/scripts/extract.sh +++ b/scripts/extract.sh @@ -2,21 +2,7 @@ set -euxo pipefail -if [ -z "${TARGETARCH+x}" ]; then - case "$(uname -m)" in - x86_64|amd64) - export TARGETARCH=amd64 - ;; - aarch64|arm64) - export TARGETARCH=arm64 - ;; - *) - echo "Unsupported Arch: $TARGETARCH" && exit 1 - ;; - esac -fi - -ID="$(docker create --pull=never --platform=linux/"$TARGETARCH" ink-toolchain:dev sh)" +ID="$(docker create --pull=never ink-toolchain:dev sh)" docker cp "$ID":/export . diff --git a/scripts/manage-apt.sh b/scripts/manage-apt.sh index 4518596..43cd0ca 100755 --- a/scripts/manage-apt.sh +++ b/scripts/manage-apt.sh @@ -31,4 +31,8 @@ apt install -y \ meson \ ninja-build +apt install -y \ + g++-aarch64-linux-gnu \ + g++-x86-64-linux-gnu + rm -rf /var/lib/apt/lists/* diff --git a/scripts/package.sh b/scripts/package.sh index 1dc64fd..d59eece 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -9,6 +9,5 @@ tar -czvf "$CROSS_TOOLCHAIN".tar.gz "$CROSS_TOOLCHAIN" mkdir -p /export mv "$CROSS_TOOLCHAIN".tar.gz /export -#mv /export/*.tar.gz /export/export.tar.gz popd