Skip to content

Commit

Permalink
Standardize path suffixes during build process
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Fasano committed Mar 27, 2024
1 parent e20102d commit ca9cda1
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 9 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
- name: Build
run: |
docker run --rm -v $PWD:/app -w /app ghcr.io/panda-re/embedded-toolchains:latest /app/build.sh
tar -czvf console-latest.tar.gz build
- name: Save package
uses: actions/upload-artifact@v3
Expand All @@ -50,13 +49,13 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./console-latest.tar.gz
asset_name: console-latest.tar.gz
asset_path: ./console.tar.gz
asset_name: console.tar.gz
asset_content_type: application/gzip

- name: Publish release
uses: StuYarrow/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
id: ${{ steps.create_release.outputs.id }}
id: ${{ steps.create_release.outputs.id }}
51 changes: 46 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
#!/bin/bash
TARGETLIST=(x86_64-linux-gnu i686-linux-musl mipseb-linux-musl mipsel-linux-musl arm-linux-musleabi aarch64-linux-musl mips64eb-linux-musl mips64el-linux-musl)
# rm -rf build
mkdir -p build
BUILDDIR=`realpath build`
echo "Built by $USER on $HOSTNAME at `date`" > build/buildinfo.txt

BUILDDIR=build
mkdir -p $BUILDDIR
echo "Built by $(whoami) on $HOSTNAME at `date`" > $BUILDDIR/buildinfo.txt

for TARGET in "${TARGETLIST[@]}"; do
echo "Building for $TARGET"
CC=$TARGET-gcc ARCH=$TARGET BUILD=$BUILDDIR make -j`nproc` all
done
done

OUT=console
mkdir -p $OUT

for x in $BUILDDIR/console-*; do
ARCH=$(basename $x | cut -d- -f2-)
case $ARCH in
x86_64-linux-gnu)
SUFFIX="x86_64"
;;
i686-linux-musl)
SUFFIX="x86"
;;
arm-linux-musleabi)
SUFFIX="armel"
;;
aarch64-linux-musl)
SUFFIX="aarch64"
;;
mipsel-linux-musl)
SUFFIX="mipsel"
;;
mipseb-linux-musl)
SUFFIX="mipseb"
;;
mips64eb-linux-musl)
SUFFIX="mips64eb"
;;
mips64el-linux-musl)
SUFFIX="mips64el"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
cp $x ${OUT}/console.${SUFFIX}
done

tar cvzf console.tar.gz ${OUT}

0 comments on commit ca9cda1

Please sign in to comment.