-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2959ffa
commit 4b87fe2
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Chez build settings | ||
SCHEME_BIN="scheme.com" | ||
PREFIX=/zip/usr | ||
CONFIG_FLAGS="--prefix=$PREFIX --installabsolute --installschemename=$SCHEME_BIN --disable-x11 --disable-curses" | ||
|
||
# cosmocc toolchain | ||
COSMOCC=/opt/cosmocc | ||
export PATH="$COSMOCC/bin:$PATH" | ||
|
||
# need to disable zipos so we can use /zip as part of the install | ||
# prefix | ||
export COSMOPOLITAN_DISABLE_ZIPOS=1 | ||
|
||
# prefix and build dirs | ||
sudo mkdir -p $PREFIX | ||
sudo chown -R "$(id -u):$(id -g)" $PREFIX | ||
mkdir ./dist | ||
|
||
# build host amd64 Chez | ||
export CC=$COSMOCC/bin/x86_64-unknown-cosmo-cc | ||
export AR=$COSMOCC/bin/x86_64-unknown-cosmo-ar | ||
./configure ${CONFIG_FLAGS} | ||
make -j | ||
make install | ||
cp $PREFIX/bin/$SCHEME_BIN ./dist/$SCHEME_BIN.ta6le | ||
|
||
# cross compile aarch64 | ||
export CC=$COSMOCC/bin/aarch64-unknown-cosmo-cc | ||
export AR=$COSMOCC/bin/aarch64-unknown-cosmo-ar | ||
./configure -m=tarm64le ${CONFIG_FLAGS} | ||
make -j | ||
make install | ||
cp $PREFIX/bin/$SCHEME_BIN ./dist/$SCHEME_BIN.tarm64le | ||
|
||
# copy results and dump unnecessary files | ||
cp -r $PREFIX ./dist/ | ||
rm -rf ./dist/usr/bin ./dist/usr/share | ||
cd dist | ||
|
||
# produce the APE image | ||
apelink -o $SCHEME_BIN.zip $SCHEME_BIN.ta6le $SCHEME_BIN.tarm64le | ||
zip -q -r $SCHEME_BIN.zip usr/ | ||
mv ./$SCHEME_BIN.zip ./$SCHEME_BIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
COSMOCC_VERSION=3.3.10 | ||
COSMOCC_ZIP=/opt/cosmocc/cosmocc-$COSMOCC_VERSION.zip | ||
COSMOCC_SHA256="00d61c1215667314f66e288c8285bae38cc6137fca083e5bba6c74e3a52439de" | ||
|
||
function fail_sha | ||
{ | ||
>&2 echo "Downloaded file ${1} SHA256 does not match known hash." | ||
exit 1 | ||
} | ||
|
||
sudo mkdir -p /opt/cosmocc | ||
sudo chown -R "$(id -u):$(id -g)" /opt/cosmocc | ||
|
||
wget --quiet -O $COSMOCC_ZIP "https://cosmo.zip/pub/cosmocc/cosmocc-${COSMOCC_VERSION}.zip" | ||
(echo "${COSMOCC_SHA256} ${COSMOCC_ZIP}" | sha256sum --check --status) || fail_sha $COSMOCC_ZIP | ||
|
||
unzip -q $COSMOCC_ZIP -d /opt/cosmocc/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
release-ape: | ||
permissions: | ||
contents: write | ||
name: Build APE Chez image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@master | ||
|
||
- name: Install deps | ||
run: sudo apt install -y wget zip unzip | ||
|
||
- name: Cache cosmocc toolchain | ||
id: cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: /opt/cosmocc | ||
key: ${{ runner.os }}-${{ hashFiles('.github/cosmo/setup.sh') }} | ||
|
||
- name: Install cosmocc toolchain | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: bash .github/cosmo/setup.sh | ||
|
||
- name: Register APE handler for binfmt_misc | ||
run: | | ||
sudo cp /opt/cosmocc/bin/ape-x86_64.elf /usr/bin/ape | ||
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" | ||
- name: Build APE binary | ||
run: bash .github/cosmo/build-ape.sh | ||
|
||
- name: Push binary to github | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
draft: true | ||
files: ./dist/scheme.com |