cosmopolitan/tool/cosmocc/package.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

304 lines
11 KiB
Bash
Raw Normal View History

#!/bin/sh
# cosmopolitan toolchain packager
#
# tool/cosmocc/package.sh
2024-01-08 22:23:43 +00:00
# cd cosmocc
# zip -ry9 ../cosmocc.zip .
#
set -ex
mode() {
case $(uname -m) in
arm64|aarch64) echo aarch64 ;;
*) echo ;;
esac
}
2024-01-08 22:23:43 +00:00
OUTDIR=${1:-cosmocc}
APELINK=o/$(mode)/tool/build/apelink
AMD64=${2:-x86_64}
ARM64=${3:-aarch64}
2024-07-31 08:21:27 +00:00
NPROC=$(($(nproc)/2))
GCCVER=14.1.0
2024-07-31 08:21:27 +00:00
make -j$NPROC m= \
$APELINK
2024-07-31 08:21:27 +00:00
make -j$NPROC m=$AMD64 \
o/cosmocc.h.txt \
o/$AMD64/ape/ape.lds \
o/$AMD64/libc/crt/crt.o \
o/$AMD64/ape/ape.elf \
o/$AMD64/ape/ape.macho \
o/$AMD64/ape/ape.o \
o/$AMD64/ape/ape-copy-self.o \
o/$AMD64/ape/ape-no-modify-self.o \
o/$AMD64/cosmopolitan.a \
o/$AMD64/third_party/libcxx/libcxx.a \
o/$AMD64/tool/build/assimilate.dbg \
o/$AMD64/tool/build/march-native.dbg \
o/$AMD64/tool/build/mktemper.dbg \
o/$AMD64/tool/build/fixupobj.dbg \
o/$AMD64/tool/build/zipcopy.dbg \
o/$AMD64/tool/build/mkdeps.dbg \
o/$AMD64/tool/build/zipobj.dbg \
o/$AMD64/tool/build/apelink.dbg \
o/$AMD64/tool/build/pecheck.dbg \
Include more programs in cosmocc The Cosmopolitan Compiler Collection now includes the following programs - `ar.ape` is a faster alternative to `ar rcsD` for creating determistic static archives. It's ~10x faster than GNU because it isn't quadratic. It'll even outperform LLVM ar by 2x, thanks to writev/copy_file_range. - `sha256sum.ape` is a faster alternative to the `sha256sum` command. It goes 2x faster since it leverages vectorized assembly implementations. - `resymbol` is a brand new program we invented, like objcopy, that lets you rename all the global symbols in a .o file to have a new suffix or prefix. In the future, this will be used by cosmocc automatically when building -O3 math kernels, that need to be vectorized for all hardware - `gzip.ape` is a faster version of the `gzip` command, that is included by most Linux distros. It gains better performance using Chromium Zlib which, once again, includes highly optimized assembly, that Mark Adler won't merge into the official MS-DOS compatible zlib codebase. - `cocmd` is the cosmopolitan shell. It can function as a faster `sh -c` alternative than bash and dash as the `SHELL = /opt/cosmocc/bin/cocmd` at the top of your Makefile. Please note you should be using the cosmo fork of GNU make (already included), since normal make won't recognize this as a bourne-compatible shell and remove the execve() optimization which makes things slower. In some ways that's true. This doesn't have a complete POSIX shell implementation. However it's enough for cosmo's mono repo. It also implements faster behaviors in some respects. The following programs are also introduced, which aren't as interesting. The main reason why they're here is so Cosmopolitan's mono repo shall be able to remove build/bootstrap/ in future editions. That way we can keep build utilities better up to date, without bloating the git history much - `chmod.ape` for hermeticity - `cp.ape` for hermeticity - `echo.ape` for hermeticity - `objbincopy` is an objcopy-like tool that's used to build ape loader - `package.ape` is used for strict dependency checking of object graph - `rm.ape` for hermeticity - `touch.ape` for hermeticity
2024-07-01 08:32:25 +00:00
o/$AMD64/tool/build/ar.dbg \
o/$AMD64/tool/build/chmod.dbg \
o/$AMD64/tool/build/cocmd.dbg \
o/$AMD64/tool/build/compile.dbg \
2024-07-20 23:43:48 +00:00
o/$AMD64/tool/build/mkdir.dbg \
Include more programs in cosmocc The Cosmopolitan Compiler Collection now includes the following programs - `ar.ape` is a faster alternative to `ar rcsD` for creating determistic static archives. It's ~10x faster than GNU because it isn't quadratic. It'll even outperform LLVM ar by 2x, thanks to writev/copy_file_range. - `sha256sum.ape` is a faster alternative to the `sha256sum` command. It goes 2x faster since it leverages vectorized assembly implementations. - `resymbol` is a brand new program we invented, like objcopy, that lets you rename all the global symbols in a .o file to have a new suffix or prefix. In the future, this will be used by cosmocc automatically when building -O3 math kernels, that need to be vectorized for all hardware - `gzip.ape` is a faster version of the `gzip` command, that is included by most Linux distros. It gains better performance using Chromium Zlib which, once again, includes highly optimized assembly, that Mark Adler won't merge into the official MS-DOS compatible zlib codebase. - `cocmd` is the cosmopolitan shell. It can function as a faster `sh -c` alternative than bash and dash as the `SHELL = /opt/cosmocc/bin/cocmd` at the top of your Makefile. Please note you should be using the cosmo fork of GNU make (already included), since normal make won't recognize this as a bourne-compatible shell and remove the execve() optimization which makes things slower. In some ways that's true. This doesn't have a complete POSIX shell implementation. However it's enough for cosmo's mono repo. It also implements faster behaviors in some respects. The following programs are also introduced, which aren't as interesting. The main reason why they're here is so Cosmopolitan's mono repo shall be able to remove build/bootstrap/ in future editions. That way we can keep build utilities better up to date, without bloating the git history much - `chmod.ape` for hermeticity - `cp.ape` for hermeticity - `echo.ape` for hermeticity - `objbincopy` is an objcopy-like tool that's used to build ape loader - `package.ape` is used for strict dependency checking of object graph - `rm.ape` for hermeticity - `touch.ape` for hermeticity
2024-07-01 08:32:25 +00:00
o/$AMD64/tool/build/cp.dbg \
o/$AMD64/tool/build/echo.dbg \
o/$AMD64/tool/build/gzip.dbg \
o/$AMD64/tool/build/objbincopy.dbg \
o/$AMD64/tool/build/package.dbg \
o/$AMD64/tool/build/rm.dbg \
o/$AMD64/tool/build/touch.dbg \
o/$AMD64/tool/build/sha256sum.dbg \
o/$AMD64/tool/build/resymbol.dbg \
o/$AMD64/third_party/make/make.dbg \
o/$AMD64/third_party/ctags/ctags.dbg
2024-07-31 08:21:27 +00:00
make -j$NPROC m=$AMD64-tiny \
o/cosmocc.h.txt \
o/$AMD64-tiny/ape/ape.lds \
o/$AMD64-tiny/libc/crt/crt.o \
o/$AMD64-tiny/ape/ape.elf \
o/$AMD64-tiny/ape/ape.macho \
o/$AMD64-tiny/ape/ape.o \
o/$AMD64-tiny/ape/ape-copy-self.o \
o/$AMD64-tiny/ape/ape-no-modify-self.o \
o/$AMD64-tiny/cosmopolitan.a \
o/$AMD64-tiny/third_party/libcxx/libcxx.a \
2024-07-31 08:21:27 +00:00
make -j$NPROC m=$AMD64-dbg \
o/cosmocc.h.txt \
o/$AMD64-dbg/ape/ape.lds \
o/$AMD64-dbg/libc/crt/crt.o \
o/$AMD64-dbg/ape/ape.elf \
o/$AMD64-dbg/ape/ape.macho \
o/$AMD64-dbg/ape/ape.o \
o/$AMD64-dbg/ape/ape-copy-self.o \
o/$AMD64-dbg/ape/ape-no-modify-self.o \
o/$AMD64-dbg/cosmopolitan.a \
o/$AMD64-dbg/third_party/libcxx/libcxx.a \
2024-07-31 08:21:27 +00:00
make CONFIG_TARGET_ARCH= -j$NPROC m=$AMD64-optlinux \
o/cosmocc.h.txt \
o/$AMD64-optlinux/ape/ape.lds \
o/$AMD64-optlinux/libc/crt/crt.o \
o/$AMD64-optlinux/ape/ape.elf \
o/$AMD64-optlinux/ape/ape.macho \
o/$AMD64-optlinux/ape/ape.o \
o/$AMD64-optlinux/ape/ape-copy-self.o \
o/$AMD64-optlinux/ape/ape-no-modify-self.o \
o/$AMD64-optlinux/cosmopolitan.a \
o/$AMD64-optlinux/third_party/libcxx/libcxx.a \
2024-07-31 08:21:27 +00:00
make -j$NPROC m=$ARM64 \
o/$ARM64/ape/ape.elf \
o/$ARM64/ape/aarch64.lds \
o/$ARM64/libc/crt/crt.o \
o/$ARM64/ape/ape-copy-self.o \
o/$ARM64/ape/ape-no-modify-self.o \
o/$ARM64/cosmopolitan.a \
o/$ARM64/third_party/libcxx/libcxx.a \
o/$ARM64/tool/build/assimilate.dbg \
o/$ARM64/tool/build/march-native.dbg \
o/$ARM64/tool/build/mktemper.dbg \
o/$ARM64/tool/build/fixupobj.dbg \
o/$ARM64/tool/build/zipcopy.dbg \
o/$ARM64/tool/build/mkdeps.dbg \
o/$ARM64/tool/build/zipobj.dbg \
o/$ARM64/tool/build/apelink.dbg \
o/$ARM64/tool/build/pecheck.dbg \
Include more programs in cosmocc The Cosmopolitan Compiler Collection now includes the following programs - `ar.ape` is a faster alternative to `ar rcsD` for creating determistic static archives. It's ~10x faster than GNU because it isn't quadratic. It'll even outperform LLVM ar by 2x, thanks to writev/copy_file_range. - `sha256sum.ape` is a faster alternative to the `sha256sum` command. It goes 2x faster since it leverages vectorized assembly implementations. - `resymbol` is a brand new program we invented, like objcopy, that lets you rename all the global symbols in a .o file to have a new suffix or prefix. In the future, this will be used by cosmocc automatically when building -O3 math kernels, that need to be vectorized for all hardware - `gzip.ape` is a faster version of the `gzip` command, that is included by most Linux distros. It gains better performance using Chromium Zlib which, once again, includes highly optimized assembly, that Mark Adler won't merge into the official MS-DOS compatible zlib codebase. - `cocmd` is the cosmopolitan shell. It can function as a faster `sh -c` alternative than bash and dash as the `SHELL = /opt/cosmocc/bin/cocmd` at the top of your Makefile. Please note you should be using the cosmo fork of GNU make (already included), since normal make won't recognize this as a bourne-compatible shell and remove the execve() optimization which makes things slower. In some ways that's true. This doesn't have a complete POSIX shell implementation. However it's enough for cosmo's mono repo. It also implements faster behaviors in some respects. The following programs are also introduced, which aren't as interesting. The main reason why they're here is so Cosmopolitan's mono repo shall be able to remove build/bootstrap/ in future editions. That way we can keep build utilities better up to date, without bloating the git history much - `chmod.ape` for hermeticity - `cp.ape` for hermeticity - `echo.ape` for hermeticity - `objbincopy` is an objcopy-like tool that's used to build ape loader - `package.ape` is used for strict dependency checking of object graph - `rm.ape` for hermeticity - `touch.ape` for hermeticity
2024-07-01 08:32:25 +00:00
o/$ARM64/tool/build/ar.dbg \
o/$ARM64/tool/build/chmod.dbg \
o/$ARM64/tool/build/cocmd.dbg \
o/$ARM64/tool/build/compile.dbg \
o/$ARM64/tool/build/cp.dbg \
o/$ARM64/tool/build/echo.dbg \
o/$ARM64/tool/build/gzip.dbg \
o/$ARM64/tool/build/objbincopy.dbg \
o/$ARM64/tool/build/package.dbg \
o/$ARM64/tool/build/rm.dbg \
o/$ARM64/tool/build/touch.dbg \
2024-07-20 18:21:26 +00:00
o/$ARM64/tool/build/mkdir.dbg \
Include more programs in cosmocc The Cosmopolitan Compiler Collection now includes the following programs - `ar.ape` is a faster alternative to `ar rcsD` for creating determistic static archives. It's ~10x faster than GNU because it isn't quadratic. It'll even outperform LLVM ar by 2x, thanks to writev/copy_file_range. - `sha256sum.ape` is a faster alternative to the `sha256sum` command. It goes 2x faster since it leverages vectorized assembly implementations. - `resymbol` is a brand new program we invented, like objcopy, that lets you rename all the global symbols in a .o file to have a new suffix or prefix. In the future, this will be used by cosmocc automatically when building -O3 math kernels, that need to be vectorized for all hardware - `gzip.ape` is a faster version of the `gzip` command, that is included by most Linux distros. It gains better performance using Chromium Zlib which, once again, includes highly optimized assembly, that Mark Adler won't merge into the official MS-DOS compatible zlib codebase. - `cocmd` is the cosmopolitan shell. It can function as a faster `sh -c` alternative than bash and dash as the `SHELL = /opt/cosmocc/bin/cocmd` at the top of your Makefile. Please note you should be using the cosmo fork of GNU make (already included), since normal make won't recognize this as a bourne-compatible shell and remove the execve() optimization which makes things slower. In some ways that's true. This doesn't have a complete POSIX shell implementation. However it's enough for cosmo's mono repo. It also implements faster behaviors in some respects. The following programs are also introduced, which aren't as interesting. The main reason why they're here is so Cosmopolitan's mono repo shall be able to remove build/bootstrap/ in future editions. That way we can keep build utilities better up to date, without bloating the git history much - `chmod.ape` for hermeticity - `cp.ape` for hermeticity - `echo.ape` for hermeticity - `objbincopy` is an objcopy-like tool that's used to build ape loader - `package.ape` is used for strict dependency checking of object graph - `rm.ape` for hermeticity - `touch.ape` for hermeticity
2024-07-01 08:32:25 +00:00
o/$ARM64/tool/build/sha256sum.dbg \
o/$ARM64/tool/build/resymbol.dbg \
o/$ARM64/third_party/make/make.dbg \
o/$ARM64/third_party/ctags/ctags.dbg
2024-07-31 08:21:27 +00:00
make -j$NPROC m=$ARM64-tiny \
o/$ARM64-tiny/ape/ape.elf \
o/$ARM64-tiny/ape/aarch64.lds \
o/$ARM64-tiny/libc/crt/crt.o \
o/$ARM64-tiny/ape/ape-copy-self.o \
o/$ARM64-tiny/ape/ape-no-modify-self.o \
o/$ARM64-tiny/cosmopolitan.a \
o/$ARM64-tiny/third_party/libcxx/libcxx.a \
2024-07-31 08:21:27 +00:00
make -j$NPROC m=$ARM64-dbg \
o/$ARM64-dbg/ape/ape.elf \
o/$ARM64-dbg/ape/aarch64.lds \
o/$ARM64-dbg/libc/crt/crt.o \
o/$ARM64-dbg/ape/ape-copy-self.o \
o/$ARM64-dbg/ape/ape-no-modify-self.o \
o/$ARM64-dbg/cosmopolitan.a \
o/$ARM64-dbg/third_party/libcxx/libcxx.a \
2024-07-31 08:21:27 +00:00
make -j$NPROC m=$ARM64-optlinux \
o/$ARM64-optlinux/ape/ape.elf \
o/$ARM64-optlinux/ape/aarch64.lds \
o/$ARM64-optlinux/libc/crt/crt.o \
o/$ARM64-optlinux/ape/ape-copy-self.o \
o/$ARM64-optlinux/ape/ape-no-modify-self.o \
o/$ARM64-optlinux/cosmopolitan.a \
o/$ARM64-optlinux/third_party/libcxx/libcxx.a \
mkdir -p "$OUTDIR/bin/"
cp tool/cosmocc/README.md "$OUTDIR/"
cp tool/cosmocc/LICENSE.* "$OUTDIR/"
mkdir -p "$OUTDIR/include/"
cp -R libc/isystem/* "$OUTDIR/include/"
cp -R libc/integral "$OUTDIR/include/libc/"
for x in $(cat o/cosmocc.h.txt); do
mkdir -p "$OUTDIR/include/${x%/*}/"
cp -f $x "$OUTDIR/include/${x%/*}/"
done
fetch() {
if command -v wget >/dev/null; then
wget $1
else
curl -LO $1
fi
}
OLD=$PWD
cd "$OUTDIR/"
if [ ! -x bin/x86_64-linux-cosmo-gcc ]; then
fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.53/aarch64-gcc.zip &
fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.53/x86_64-gcc.zip &
fetch https://github.com/ahgamut/superconfigure/releases/download/z0.0.53/llvm.zip &
wait
unzip aarch64-gcc.zip &
unzip x86_64-gcc.zip &
unzip llvm.zip bin/clang-18 &
wait
rm -f aarch64-gcc.zip
rm -f x86_64-gcc.zip
mv bin/clang-18 bin/cosmo-clang
fi
rm -f bin/*-cpp
rm -f bin/*-gcc-*
rm -f bin/*-gprof
rm -f bin/*-strings
for arch in aarch64 x86_64; do
2023-11-13 06:04:07 +00:00
ln -sf $arch-linux-cosmo-addr2line bin/$arch-unknown-cosmo-addr2line
ln -sf $arch-linux-cosmo-ar bin/$arch-unknown-cosmo-ar
ln -sf $arch-linux-cosmo-as bin/$arch-unknown-cosmo-as
ln -sf $arch-linux-cosmo-c++filt bin/$arch-unknown-cosmo-c++filt
ln -sf $arch-linux-cosmo-g++ bin/$arch-linux-cosmo-c++
2023-11-13 06:04:07 +00:00
ln -sf $arch-linux-cosmo-gcc bin/$arch-linux-cosmo-cc
ln -sf $arch-linux-cosmo-gcc bin/$arch-linux-cosmo-cpp
2023-11-13 06:04:07 +00:00
ln -sf $arch-linux-cosmo-nm bin/$arch-unknown-cosmo-nm
ln -sf $arch-linux-cosmo-objcopy bin/$arch-unknown-cosmo-objcopy
ln -sf $arch-linux-cosmo-objdump bin/$arch-unknown-cosmo-objdump
ln -sf $arch-linux-cosmo-readelf bin/$arch-unknown-cosmo-readelf
ln -sf $arch-linux-cosmo-strip bin/$arch-unknown-cosmo-strip
# cmp -s libexec/gcc/$arch-linux-cosmo/$GCCVER/ld.bfd libexec/gcc/$arch-linux-cosmo/$GCCVER/ld
# ln -sf ld.bfd libexec/gcc/$arch-linux-cosmo/$GCCVER/ld
# cmp -s libexec/gcc/$arch-linux-cosmo/$GCCVER/ld.bfd bin/$arch-linux-cosmo-ld
# ln -sf ../libexec/gcc/$arch-linux-cosmo/$GCCVER/ld.bfd bin/$arch-linux-cosmo-ld
Release Cosmopolitan v3.3 This change upgrades to GCC 12.3 and GNU binutils 2.42. The GNU linker appears to have changed things so that only a single de-duplicated str table is present in the binary, and it gets placed wherever the linker wants, regardless of what the linker script says. To cope with that we need to stop using .ident to embed licenses. As such, this change does significant work to revamp how third party licenses are defined in the codebase, using `.section .notice,"aR",@progbits`. This new GCC 12.3 toolchain has support for GNU indirect functions. It lets us support __target_clones__ for the first time. This is used for optimizing the performance of libc string functions such as strlen and friends so far on x86, by ensuring AVX systems favor a second codepath that uses VEX encoding. It shaves some latency off certain operations. It's a useful feature to have for scientific computing for the reasons explained by the test/libcxx/openmp_test.cc example which compiles for fifteen different microarchitectures. Thanks to the upgrades, it's now also possible to use newer instruction sets, such as AVX512FP16, VNNI. Cosmo now uses the %gs register on x86 by default for TLS. Doing it is helpful for any program that links `cosmo_dlopen()`. Such programs had to recompile their binaries at startup to change the TLS instructions. That's not great, since it means every page in the executable needs to be faulted. The work of rewriting TLS-related x86 opcodes, is moved to fixupobj.com instead. This is great news for MacOS x86 users, since we previously needed to morph the binary every time for that platform but now that's no longer necessary. The only platforms where we need fixup of TLS x86 opcodes at runtime are now Windows, OpenBSD, and NetBSD. On Windows we morph TLS to point deeper into the TIB, based on a TlsAlloc assignment, and on OpenBSD/NetBSD we morph %gs back into %fs since the kernels do not allow us to specify a value for the %gs register. OpenBSD users are now required to use APE Loader to run Cosmo binaries and assimilation is no longer possible. OpenBSD kernel needs to change to allow programs to specify a value for the %gs register, or it needs to stop marking executable pages loaded by the kernel as mimmutable(). This release fixes __constructor__, .ctor, .init_array, and lastly the .preinit_array so they behave the exact same way as glibc. We no longer use hex constants to define math.h symbols like M_PI.
2024-02-20 19:12:09 +00:00
cmp -s libexec/gcc/$arch-linux-cosmo/$GCCVER/as bin/$arch-linux-cosmo-as
ln -sf ../libexec/gcc/$arch-linux-cosmo/$GCCVER/as bin/$arch-linux-cosmo-as
cmp -s libexec/gcc/$arch-linux-cosmo/$GCCVER/ld.bfd bin/$arch-linux-cosmo-ld.bfd
ln -sf ../libexec/gcc/$arch-linux-cosmo/$GCCVER/ld.bfd bin/$arch-linux-cosmo-ld.bfd
done
cd "$OLD"
for arch in $AMD64 $ARM64; do
mkdir -p "$OUTDIR/$arch-linux-cosmo/lib/"
mkdir -p "$OUTDIR/$arch-linux-cosmo/lib/dbg"
mkdir -p "$OUTDIR/$arch-linux-cosmo/lib/tiny"
mkdir -p "$OUTDIR/$arch-linux-cosmo/lib/optlinux"
cp -f o/$arch/libc/crt/crt.o "$OUTDIR/$arch-linux-cosmo/lib/"
cp -f o/$arch-dbg/libc/crt/crt.o "$OUTDIR/$arch-linux-cosmo/lib/dbg/"
cp -f o/$arch-tiny/libc/crt/crt.o "$OUTDIR/$arch-linux-cosmo/lib/tiny/"
cp -f o/$arch-optlinux/libc/crt/crt.o "$OUTDIR/$arch-linux-cosmo/lib/optlinux/"
cp -f o/$arch/cosmopolitan.a "$OUTDIR/$arch-linux-cosmo/lib/libcosmo.a"
cp -f o/$arch-dbg/cosmopolitan.a "$OUTDIR/$arch-linux-cosmo/lib/dbg/libcosmo.a"
cp -f o/$arch-tiny/cosmopolitan.a "$OUTDIR/$arch-linux-cosmo/lib/tiny/libcosmo.a"
cp -f o/$arch-optlinux/cosmopolitan.a "$OUTDIR/$arch-linux-cosmo/lib/optlinux/libcosmo.a"
cp -f o/$arch/third_party/libcxx/libcxx.a "$OUTDIR/$arch-linux-cosmo/lib/"
cp -f o/$arch-dbg/third_party/libcxx/libcxx.a "$OUTDIR/$arch-linux-cosmo/lib/dbg/"
cp -f o/$arch-tiny/third_party/libcxx/libcxx.a "$OUTDIR/$arch-linux-cosmo/lib/tiny/"
cp -f o/$arch-optlinux/third_party/libcxx/libcxx.a "$OUTDIR/$arch-linux-cosmo/lib/optlinux/"
2024-02-23 15:39:44 +00:00
for lib in c dl gcc_s m crypt pthread resolv rt dl unwind gomp stdc++; do
printf '\041\074\141\162\143\150\076\012' >"$OUTDIR/$arch-linux-cosmo/lib/lib$lib.a"
done
mkdir -p "$OUTDIR/lib/gcc/"
touch "$OUTDIR/lib/gcc/libgomp.spec" # needed if user passes -fopenmp but not -lgomp
done
cp -f o/$AMD64/ape/ape.o "$OUTDIR/x86_64-linux-cosmo/lib/"
cp -f o/$AMD64-dbg/ape/ape.o "$OUTDIR/x86_64-linux-cosmo/lib/dbg/"
cp -f o/$AMD64-tiny/ape/ape.o "$OUTDIR/x86_64-linux-cosmo/lib/tiny/"
cp -f o/$AMD64-optlinux/ape/ape.o "$OUTDIR/x86_64-linux-cosmo/lib/optlinux/"
cp -f o/$AMD64/ape/ape.lds "$OUTDIR/x86_64-linux-cosmo/lib/"
cp -f o/$AMD64-dbg/ape/ape.lds "$OUTDIR/x86_64-linux-cosmo/lib/dbg/"
cp -f o/$AMD64-tiny/ape/ape.lds "$OUTDIR/x86_64-linux-cosmo/lib/tiny/"
cp -f o/$AMD64-optlinux/ape/ape.lds "$OUTDIR/x86_64-linux-cosmo/lib/optlinux/"
cp -f o/$ARM64/ape/aarch64.lds "$OUTDIR/aarch64-linux-cosmo/lib/"
cp -f o/$ARM64-dbg/ape/aarch64.lds "$OUTDIR/aarch64-linux-cosmo/lib/dbg/"
cp -f o/$ARM64-tiny/ape/aarch64.lds "$OUTDIR/aarch64-linux-cosmo/lib/tiny/"
cp -f o/$ARM64-optlinux/ape/aarch64.lds "$OUTDIR/aarch64-linux-cosmo/lib/optlinux/"
cp -f o/$AMD64/ape/ape-no-modify-self.o "$OUTDIR/x86_64-linux-cosmo/lib/"
cp -f o/$AMD64-dbg/ape/ape-no-modify-self.o "$OUTDIR/x86_64-linux-cosmo/lib/dbg/"
cp -f o/$AMD64-tiny/ape/ape-no-modify-self.o "$OUTDIR/x86_64-linux-cosmo/lib/tiny/"
cp -f o/$AMD64-optlinux/ape/ape-no-modify-self.o "$OUTDIR/x86_64-linux-cosmo/lib/optlinux/"
cp -f ape/ape-m1.c "$OUTDIR/bin/"
cp -af tool/cosmocc/bin/* "$OUTDIR/bin/"
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/$ARM64/ape/ape.elf "$OUTDIR/bin/ape-aarch64.elf"
Include more programs in cosmocc The Cosmopolitan Compiler Collection now includes the following programs - `ar.ape` is a faster alternative to `ar rcsD` for creating determistic static archives. It's ~10x faster than GNU because it isn't quadratic. It'll even outperform LLVM ar by 2x, thanks to writev/copy_file_range. - `sha256sum.ape` is a faster alternative to the `sha256sum` command. It goes 2x faster since it leverages vectorized assembly implementations. - `resymbol` is a brand new program we invented, like objcopy, that lets you rename all the global symbols in a .o file to have a new suffix or prefix. In the future, this will be used by cosmocc automatically when building -O3 math kernels, that need to be vectorized for all hardware - `gzip.ape` is a faster version of the `gzip` command, that is included by most Linux distros. It gains better performance using Chromium Zlib which, once again, includes highly optimized assembly, that Mark Adler won't merge into the official MS-DOS compatible zlib codebase. - `cocmd` is the cosmopolitan shell. It can function as a faster `sh -c` alternative than bash and dash as the `SHELL = /opt/cosmocc/bin/cocmd` at the top of your Makefile. Please note you should be using the cosmo fork of GNU make (already included), since normal make won't recognize this as a bourne-compatible shell and remove the execve() optimization which makes things slower. In some ways that's true. This doesn't have a complete POSIX shell implementation. However it's enough for cosmo's mono repo. It also implements faster behaviors in some respects. The following programs are also introduced, which aren't as interesting. The main reason why they're here is so Cosmopolitan's mono repo shall be able to remove build/bootstrap/ in future editions. That way we can keep build utilities better up to date, without bloating the git history much - `chmod.ape` for hermeticity - `cp.ape` for hermeticity - `echo.ape` for hermeticity - `objbincopy` is an objcopy-like tool that's used to build ape loader - `package.ape` is used for strict dependency checking of object graph - `rm.ape` for hermeticity - `touch.ape` for hermeticity
2024-07-01 08:32:25 +00:00
for x in assimilate march-native mktemper fixupobj zipcopy apelink pecheck mkdeps zipobj \
2024-07-20 18:21:26 +00:00
ar chmod cocmd cp echo gzip objbincopy package rm touch mkdir compile sha256sum \
resymbol; do
ape $APELINK \
-l o/$AMD64/ape/ape.elf \
-l o/$ARM64/ape/ape.elf \
-M ape/ape-m1.c \
-o "$OUTDIR/bin/$x" \
o/$AMD64/tool/build/$x.dbg \
o/$ARM64/tool/build/$x.dbg
done
Include more programs in cosmocc The Cosmopolitan Compiler Collection now includes the following programs - `ar.ape` is a faster alternative to `ar rcsD` for creating determistic static archives. It's ~10x faster than GNU because it isn't quadratic. It'll even outperform LLVM ar by 2x, thanks to writev/copy_file_range. - `sha256sum.ape` is a faster alternative to the `sha256sum` command. It goes 2x faster since it leverages vectorized assembly implementations. - `resymbol` is a brand new program we invented, like objcopy, that lets you rename all the global symbols in a .o file to have a new suffix or prefix. In the future, this will be used by cosmocc automatically when building -O3 math kernels, that need to be vectorized for all hardware - `gzip.ape` is a faster version of the `gzip` command, that is included by most Linux distros. It gains better performance using Chromium Zlib which, once again, includes highly optimized assembly, that Mark Adler won't merge into the official MS-DOS compatible zlib codebase. - `cocmd` is the cosmopolitan shell. It can function as a faster `sh -c` alternative than bash and dash as the `SHELL = /opt/cosmocc/bin/cocmd` at the top of your Makefile. Please note you should be using the cosmo fork of GNU make (already included), since normal make won't recognize this as a bourne-compatible shell and remove the execve() optimization which makes things slower. In some ways that's true. This doesn't have a complete POSIX shell implementation. However it's enough for cosmo's mono repo. It also implements faster behaviors in some respects. The following programs are also introduced, which aren't as interesting. The main reason why they're here is so Cosmopolitan's mono repo shall be able to remove build/bootstrap/ in future editions. That way we can keep build utilities better up to date, without bloating the git history much - `chmod.ape` for hermeticity - `cp.ape` for hermeticity - `echo.ape` for hermeticity - `objbincopy` is an objcopy-like tool that's used to build ape loader - `package.ape` is used for strict dependency checking of object graph - `rm.ape` for hermeticity - `touch.ape` for hermeticity
2024-07-01 08:32:25 +00:00
2024-07-20 18:21:26 +00:00
for x in ar chmod cp echo gzip package rm touch mkdir compile sha256sum; do
Include more programs in cosmocc The Cosmopolitan Compiler Collection now includes the following programs - `ar.ape` is a faster alternative to `ar rcsD` for creating determistic static archives. It's ~10x faster than GNU because it isn't quadratic. It'll even outperform LLVM ar by 2x, thanks to writev/copy_file_range. - `sha256sum.ape` is a faster alternative to the `sha256sum` command. It goes 2x faster since it leverages vectorized assembly implementations. - `resymbol` is a brand new program we invented, like objcopy, that lets you rename all the global symbols in a .o file to have a new suffix or prefix. In the future, this will be used by cosmocc automatically when building -O3 math kernels, that need to be vectorized for all hardware - `gzip.ape` is a faster version of the `gzip` command, that is included by most Linux distros. It gains better performance using Chromium Zlib which, once again, includes highly optimized assembly, that Mark Adler won't merge into the official MS-DOS compatible zlib codebase. - `cocmd` is the cosmopolitan shell. It can function as a faster `sh -c` alternative than bash and dash as the `SHELL = /opt/cosmocc/bin/cocmd` at the top of your Makefile. Please note you should be using the cosmo fork of GNU make (already included), since normal make won't recognize this as a bourne-compatible shell and remove the execve() optimization which makes things slower. In some ways that's true. This doesn't have a complete POSIX shell implementation. However it's enough for cosmo's mono repo. It also implements faster behaviors in some respects. The following programs are also introduced, which aren't as interesting. The main reason why they're here is so Cosmopolitan's mono repo shall be able to remove build/bootstrap/ in future editions. That way we can keep build utilities better up to date, without bloating the git history much - `chmod.ape` for hermeticity - `cp.ape` for hermeticity - `echo.ape` for hermeticity - `objbincopy` is an objcopy-like tool that's used to build ape loader - `package.ape` is used for strict dependency checking of object graph - `rm.ape` for hermeticity - `touch.ape` for hermeticity
2024-07-01 08:32:25 +00:00
mv "$OUTDIR/bin/$x" "$OUTDIR/bin/$x.ape"
done
for x in make ctags; do
ape $APELINK \
-l o/$AMD64/ape/ape.elf \
-l o/$ARM64/ape/ape.elf \
-M ape/ape-m1.c \
-o "$OUTDIR/bin/$x" \
o/$AMD64/third_party/$x/$x.dbg \
o/$ARM64/third_party/$x/$x.dbg
done