diff --git a/.github/cosmo/build b/.github/cosmo/build new file mode 100755 index 0000000..baa7143 --- /dev/null +++ b/.github/cosmo/build @@ -0,0 +1,22 @@ +#!/bin/sh +set -eux + +GGUF_TOOLS_DIR="$(pwd)" + +# download cosmocc +cd /sc +wget https://github.com/jart/cosmopolitan/releases/download/3.3.3/cosmocc-3.3.3.zip +mkdir -p cosmocc +cd cosmocc +unzip ../cosmocc-3.3.3.zip + +# register +cd /sc/cosmocc +sudo cp ./bin/ape-x86_64.elf /usr/bin/ape +sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" + +# build fat binary +COSMO_DIR="/sc/cosmocc" +cd "$GGUF_TOOLS_DIR" +COSMOCC="/sc/cosmocc/bin/cosmocc" +make -j CC="$COSMOCC" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7c6165a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" + +permissions: + contents: read + +jobs: + + release-cosmo: + permissions: + contents: write # for softprops/action-gh-release to create GitHub release + name: Build release binaries for Cosmo + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@master + - name: create build folder + run: | + sudo mkdir -p /sc + sudo chmod -R 0777 /sc + - name: build APE binary of gguf-tools + run: bash ./.github/cosmo/build + - name: push binary to github + uses: softprops/action-gh-release@v1 + with: + draft: true + files: | + gguf-tools diff --git a/Makefile b/Makefile index fb79066..12202cd 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,8 @@ all: gguf-tools gguf-tools: gguf-tools.c gguflib.c gguflib.h sds.c sds.h sdsalloc.h fp16.h $(CC) gguf-tools.c gguflib.c sds.c fp16.c \ - -march=native -flto -ffast-math \ - -g -ggdb -Wall -W -pedantic -O3 -o gguf-tools + -ffast-math \ + -g3 -Wall -W -pedantic -O3 -o gguf-tools clean: rm -rf gguf-tools