mirror of
https://github.com/janet-lang/janet
synced 2025-01-12 08:30:26 +00:00
simplify build to use only cosmocc
This commit is contained in:
parent
eebb4c3ade
commit
983c2e5499
42
.github/cosmo/build
vendored
42
.github/cosmo/build
vendored
@ -1,12 +1,38 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
# copy janet recipe
|
COSMO_DIR="/sc/cosmocc"
|
||||||
mkdir -p /sc/superconfigure/janet
|
|
||||||
cp ./.github/cosmo/recipe.mk /sc/superconfigure/janet/BUILD.mk
|
|
||||||
echo 'include janet/BUILD.mk' >> /sc/superconfigure/custom.mk
|
|
||||||
|
|
||||||
# build janet with cosmopolitan libc
|
# build x86_64
|
||||||
export SOURCE_DIR=$(realpath .)
|
X86_64_CC="/sc/cosmocc/bin/x86_64-unknown-cosmo-cc"
|
||||||
cd /sc/superconfigure
|
X86_64_AR="/sc/cosmocc/bin/x86_64-unknown-cosmo-ar"
|
||||||
make o/janet/built.fat
|
mkdir -p /sc/cosmocc/x86_64
|
||||||
|
make CC="$X86_64_CC" AR="$X86_64_AR" HAS_SHARED=0 JANET_NO_AMALG=1
|
||||||
|
cp build/janet /sc/cosmocc/x86_64/janet
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# build aarch64
|
||||||
|
AARCH64_CC="/sc/cosmocc/bin/aarch64-unknown-cosmo-cc"
|
||||||
|
AARCH64_AR="/sc/cosmocc/bin/aarch64-unknown-cosmo-ar"
|
||||||
|
mkdir -p /sc/cosmocc/arch64
|
||||||
|
make CC="$AARCH64_CC" AR="$AARCH64_AR" HAS_SHARED=0 JANET_NO_AMALG=1
|
||||||
|
cp build/janet /sc/cosmocc/aarch64/janet
|
||||||
|
make clean
|
||||||
|
|
||||||
|
# fat binary
|
||||||
|
apefat () {
|
||||||
|
OUTPUT="$1"
|
||||||
|
OLDNAME_X86_64="$(basename -- "$2")"
|
||||||
|
OLDNAME_AARCH64="$(basename -- "$3")"
|
||||||
|
TARG_FOLD="$(dirname "$OUTPUT")"
|
||||||
|
"$APELINK" -l "$COSMO_DIR/bin/ape-x86_64.elf" \
|
||||||
|
-l "$COSMO_DIR/bin/ape-aarch64.elf" \
|
||||||
|
-M "$COSMO_DIR/bin/ape-m1.c" \
|
||||||
|
-o "$OUTPUT" \
|
||||||
|
"$2" \
|
||||||
|
"$3"
|
||||||
|
cp "$2" "$TARG_FOLD/$OLDNAME_X86_64.x86_64"
|
||||||
|
cp "$3" "$TARG_FOLD/$OLDNAME_AARCH64.aarch64"
|
||||||
|
}
|
||||||
|
|
||||||
|
apefat ./janet.com /sc/cosmocc/x86_64/janet /sc/cosmocc/aarch64/janet
|
||||||
|
23
.github/cosmo/setup
vendored
23
.github/cosmo/setup
vendored
@ -8,21 +8,14 @@ sudo apt-get install -y ca-certificates libssl-dev\
|
|||||||
cmake ninja-build bison zip\
|
cmake ninja-build bison zip\
|
||||||
pkg-config build-essential autoconf re2c
|
pkg-config build-essential autoconf re2c
|
||||||
|
|
||||||
# clone superconfigure
|
# download cosmocc
|
||||||
cd /sc
|
cd /sc
|
||||||
git clone https://github.com/ahgamut/superconfigure --depth=1 --branch=z0.0.39
|
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
|
||||||
|
|
||||||
# the zip folder
|
# register
|
||||||
sudo mkdir -p /zip
|
cd /sc/cosmocc
|
||||||
sudo chmod -R 0777 /zip
|
sudo cp ./bin/ape-x86_64.elf /usr/bin/ape
|
||||||
|
|
||||||
# clone cosmo
|
|
||||||
cd /sc/superconfigure
|
|
||||||
git clone https://github.com/jart/cosmopolitan --depth=1 --branch=3.3.3 cosmopolitan
|
|
||||||
sudo cp cosmopolitan/build/bootstrap/ape.elf /usr/bin/ape
|
|
||||||
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
|
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
|
||||||
# ls /proc/sys/fs/binfmt_misc/
|
|
||||||
|
|
||||||
# build cosmo
|
|
||||||
cd /sc/superconfigure
|
|
||||||
./.github/scripts/cosmo
|
|
||||||
|
Loading…
Reference in New Issue
Block a user