From 750c463abec49b61e6c94c8868e212d3ac434f06 Mon Sep 17 00:00:00 2001 From: Ali Somay Date: Mon, 20 Nov 2023 11:23:00 +0100 Subject: [PATCH] Add i686 linux target --- .cargo/config.toml | 11 +++-- .github/workflows/ci.yaml | 11 +++-- Cross.toml | 22 ++++------ docker/cross/Dockerfile | 44 ------------------- scripts/README.md | 6 +++ .../pre-build-linux.sh | 0 .../pre-build-win.ps1 | 0 7 files changed, 30 insertions(+), 64 deletions(-) delete mode 100644 docker/cross/Dockerfile create mode 100644 scripts/README.md rename pre-build-linux.sh => scripts/pre-build-linux.sh (100%) rename pre-build-win.ps1 => scripts/pre-build-win.ps1 (100%) diff --git a/.cargo/config.toml b/.cargo/config.toml index 595c627..a94cc1c 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -2,12 +2,17 @@ linker = "aarch64-linux-gnu-gcc" rustflags = [ "-C", "link-arg=-Bstatic", - # Other flags as needed ] [target.armv7-unknown-linux-gnueabihf] linker = "arm-linux-gnueabihf-gcc" rustflags = [ "-C", "link-arg=-Bstatic", - # Other flags as needed -] \ No newline at end of file +] + +[target.i686-unknown-linux-gnu] +linker = "i686-linux-gnu-gcc" +rustflags = [ + "-C", "link-arg=-Bstatic", +] + diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6eef2fb..4c2de4e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: Tests and release +name: CI/CD on: [push] env: CRATE_NAME: smrec @@ -18,6 +18,11 @@ jobs: target: x86_64-unknown-linux-gnu bin: smrec name: smrec-Linux-x86_64-gnu.tar.gz + - os_name: Linux-i686 + os: ubuntu-latest + target: i686-unknown-linux-gnu + bin: smrec + name: smrec-Linux-i686-gnu.tar.gz # Linux Gnu Arm - os_name: Linux-aarch64 @@ -68,15 +73,13 @@ jobs: skip_tests: true toolchain: - stable - # - beta - # - nightly steps: - uses: actions/checkout@v4 - name: Cache cargo & target directories uses: Swatinem/rust-cache@v2 with: key: "v2" - # Why? + - name: Configure Git run: | git config --global user.email "alisomay@runbox.com" diff --git a/Cross.toml b/Cross.toml index d61e4d3..ebd5ad9 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,29 +1,25 @@ -# [target.aarch64-unknown-linux-gnu.dockerfile] -# file = "./docker/cross/Dockerfile" -# context = "." -# build-args = {} - -# [target.armv7-unknown-linux-gnueabihf.dockerfile] -# file = "./docker/cross/Dockerfile" -# context = "." -# build-args = {} +# Install build dependencies for the right architecture per target +[target.i686-unknown-linux-gnu] +runner = "qemu-user" +pre-build = [ + "export BUILDKIT_PROGRESS=plain", + "dpkg --add-architecture $CROSS_DEB_ARCH", + "apt-get update && apt-get --assume-yes install libasound2-dev:$CROSS_DEB_ARCH libjack-jackd2-dev:$CROSS_DEB_ARCH" +] [target.aarch64-unknown-linux-gnu] runner = "qemu-user" -# pre-build = ["export BUILDKIT_PROGRESS=plain"] pre-build = [ "export BUILDKIT_PROGRESS=plain", "dpkg --add-architecture $CROSS_DEB_ARCH", "apt-get update && apt-get --assume-yes install libasound2-dev:$CROSS_DEB_ARCH libjack-jackd2-dev:$CROSS_DEB_ARCH" ] - [target.armv7-unknown-linux-gnueabihf] runner = "qemu-user" -# pre-build = ["export BUILDKIT_PROGRESS=plain"] - pre-build = [ "export BUILDKIT_PROGRESS=plain", "dpkg --add-architecture $CROSS_DEB_ARCH", "apt-get update && apt-get --assume-yes install libasound2-dev:$CROSS_DEB_ARCH libjack-jackd2-dev:$CROSS_DEB_ARCH" ] + diff --git a/docker/cross/Dockerfile b/docker/cross/Dockerfile deleted file mode 100644 index b12a897..0000000 --- a/docker/cross/Dockerfile +++ /dev/null @@ -1,44 +0,0 @@ -ARG CROSS_BASE_IMAGE -FROM $CROSS_BASE_IMAGE - -# Redefine ARG after FROM -ARG CROSS_DEB_ARCH -ARG DEBIAN_FRONTEND=noninteractive - -# Update and upgrade the base system -RUN apt-get update -y \ - && apt-get upgrade -y \ - && apt-get dist-upgrade -y - -# Install aptitude for more robust dependency resolution -RUN apt-get install -y aptitude - -# Run the command to get the current version of libc6 from focal-updates/main, store the result in a variable, -# and then write the export statement with that version to the envfile. -RUN export HOST_LIBC_VERSION=$(apt-cache madison libc6 | grep 'focal-updates/main' | awk '{print $3;}' | head -1) && \ - echo "export HOST_LIBC_VERSION=$HOST_LIBC_VERSION" > /envfile - -# Add sources for the specified architecture -RUN if echo "$CROSS_DEB_ARCH" | grep -q "arm"; then \ - echo "deb [arch=$CROSS_DEB_ARCH] http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe multiverse" > /etc/apt/sources.list && \ - echo "deb [arch=$CROSS_DEB_ARCH] http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe multiverse" >> /etc/apt/sources.list && \ - echo "deb [arch=$CROSS_DEB_ARCH] http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted universe multiverse" >> /etc/apt/sources.list && \ - echo "deb [arch=$CROSS_DEB_ARCH] http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse" >> /etc/apt/sources.list; \ - else \ - echo "deb [arch=$CROSS_DEB_ARCH] http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse" > /etc/apt/sources.list && \ - echo "deb [arch=$CROSS_DEB_ARCH] http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse" >> /etc/apt/sources.list && \ - echo "deb [arch=$CROSS_DEB_ARCH] http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse" >> /etc/apt/sources.list && \ - echo "deb [arch=$CROSS_DEB_ARCH] http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse" >> /etc/apt/sources.list; \ - fi - -RUN dpkg --add-architecture ${CROSS_DEB_ARCH} && apt-get update -y - -RUN cat /envfile; - -# # Update and install dependencies using bash shell for better subshell handling -# RUN apt-get update -y && \ -# apt-get install -y && \ -# . /envfile; libc6:${CROSS_DEB_ARCH}=$HOST_LIBC_VERSION - -# Install build dependencies -RUN aptitude install -y libasound2-dev:${CROSS_DEB_ARCH} libjack-jackd2-dev:${CROSS_DEB_ARCH} diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..75ff53f --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,6 @@ +# Pre build scripts + +These are about the become obsolete. +They are here for historical reasons. +Once ` cpal`` publishes a new version, we can remove them. +For linux users, we'll see how it works but I might make a PR to `cpal`` to automate installation of jack and alsa dependencies also if it makes sense. diff --git a/pre-build-linux.sh b/scripts/pre-build-linux.sh similarity index 100% rename from pre-build-linux.sh rename to scripts/pre-build-linux.sh diff --git a/pre-build-win.ps1 b/scripts/pre-build-win.ps1 similarity index 100% rename from pre-build-win.ps1 rename to scripts/pre-build-win.ps1