mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Get tool/cosmocc/package.sh working on M1 (#970)
On aarch64 hosts, MODE= is changed to MODE=aarch64, so o// targets don't work. So On aarch64, get apelink.com out of o/aarch64/. Also prepend ape when calling it. And finally, fetch with curl when wget isn't installed.
This commit is contained in:
parent
d1a745c17c
commit
7845495a93
1 changed files with 21 additions and 5 deletions
|
@ -8,12 +8,20 @@
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
mode() {
|
||||||
|
case $(uname -m) in
|
||||||
|
arm64|aarch64) echo aarch64 ;;
|
||||||
|
*) echo ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
OUTDIR=${1:-cosmocc}
|
OUTDIR=${1:-cosmocc}
|
||||||
|
APELINK=o/$(mode)/tool/build/apelink.com
|
||||||
AMD64=${2:-x86_64}
|
AMD64=${2:-x86_64}
|
||||||
ARM64=${3:-aarch64}
|
ARM64=${3:-aarch64}
|
||||||
|
|
||||||
make -j8 m= \
|
make -j8 m= \
|
||||||
o//tool/build/apelink.com
|
$APELINK
|
||||||
|
|
||||||
make -j8 m=$AMD64 \
|
make -j8 m=$AMD64 \
|
||||||
o/cosmocc.h.txt \
|
o/cosmocc.h.txt \
|
||||||
|
@ -70,13 +78,21 @@ for x in $(cat o/cosmocc.h.txt); do
|
||||||
cp -f $x "$OUTDIR/include/${x%/*}/"
|
cp -f $x "$OUTDIR/include/${x%/*}/"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
fetch() {
|
||||||
|
if command -v wget >/dev/null; then
|
||||||
|
wget $1
|
||||||
|
else
|
||||||
|
curl -LO $1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
OLD=$PWD
|
OLD=$PWD
|
||||||
cd "$OUTDIR/"
|
cd "$OUTDIR/"
|
||||||
if [ ! -x bin/x86_64-linux-cosmo-gcc ]; then
|
if [ ! -x bin/x86_64-linux-cosmo-gcc ]; then
|
||||||
wget https://github.com/ahgamut/superconfigure/releases/download/z0.0.24/aarch64-gcc.zip
|
fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.24/aarch64-gcc.zip
|
||||||
unzip aarch64-gcc.zip
|
unzip aarch64-gcc.zip
|
||||||
rm -f aarch64-gcc.zip
|
rm -f aarch64-gcc.zip
|
||||||
wget https://github.com/ahgamut/superconfigure/releases/download/z0.0.24/x86_64-gcc.zip
|
fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.24/x86_64-gcc.zip
|
||||||
unzip x86_64-gcc.zip
|
unzip x86_64-gcc.zip
|
||||||
rm -f x86_64-gcc.zip
|
rm -f x86_64-gcc.zip
|
||||||
fi
|
fi
|
||||||
|
@ -128,7 +144,7 @@ cp -f o/$AMD64/ape/ape.elf "$OUTDIR/bin/ape-x86_64.elf"
|
||||||
cp -f o/$AMD64/ape/ape.macho "$OUTDIR/bin/ape-x86_64.macho"
|
cp -f o/$AMD64/ape/ape.macho "$OUTDIR/bin/ape-x86_64.macho"
|
||||||
cp -f o/$ARM64/ape/ape.elf "$OUTDIR/bin/ape-aarch64.elf"
|
cp -f o/$ARM64/ape/ape.elf "$OUTDIR/bin/ape-aarch64.elf"
|
||||||
for x in assimilate march-native mktemper fixupobj zipcopy apelink pecheck mkdeps zipobj; do
|
for x in assimilate march-native mktemper fixupobj zipcopy apelink pecheck mkdeps zipobj; do
|
||||||
o//tool/build/apelink.com \
|
ape $APELINK \
|
||||||
-l o/$AMD64/ape/ape.elf \
|
-l o/$AMD64/ape/ape.elf \
|
||||||
-l o/$ARM64/ape/ape.elf \
|
-l o/$ARM64/ape/ape.elf \
|
||||||
-M ape/ape-m1.c \
|
-M ape/ape-m1.c \
|
||||||
|
@ -137,7 +153,7 @@ for x in assimilate march-native mktemper fixupobj zipcopy apelink pecheck mkdep
|
||||||
o/$ARM64/tool/build/$x.com.dbg
|
o/$ARM64/tool/build/$x.com.dbg
|
||||||
done
|
done
|
||||||
for x in make ctags; do
|
for x in make ctags; do
|
||||||
o//tool/build/apelink.com \
|
ape $APELINK \
|
||||||
-l o/$AMD64/ape/ape.elf \
|
-l o/$AMD64/ape/ape.elf \
|
||||||
-l o/$ARM64/ape/ape.elf \
|
-l o/$ARM64/ape/ape.elf \
|
||||||
-M ape/ape-m1.c \
|
-M ape/ape-m1.c \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue