cosmopolitan/third_party/gcc/upgrade-cosmo-gcc.sh
Justine Tunney 23e235b7a5
Fix bugs in cosmocc toolchain
This change integrates e58abc1110b335a3341e8ad5821ad8e3880d9bb2 from
https://github.com/ahgamut/musl-cross-make/ which fixes the issues we
were having with our C language extension for symbolic constants. This
change also performs some code cleanup and bug fixes to getaddrinfo().
It's now possible to compile projects like ncurses, readline and python
without needing to patch anything upstream, except maybe a line or two.
Pretty soon it should be possible to build a Linux distro on Cosmo.
2023-06-08 23:44:03 -07:00

49 lines
1.4 KiB
Bash
Executable file

#!/bin/sh
ARCH=${1:-aarch64}
IMPORT=${2:-/opt/cross11portcosmo}
PREFIX=third_party/gcc
OLDVERSION=11.2.0
NEWVERSION=11.2.0
rm -rf o/third_party/gcc
if [ $OLDVERSION != $NEWVERSION ]; then
mv $PREFIX/libexec/gcc/$ARCH-linux-musl/$OLDVERSION $PREFIX/libexec/gcc/$ARCH-linux-musl/$NEWVERSION
mv $PREFIX/lib/gcc/$ARCH-linux-musl/$OLDVERSION $PREFIX/lib/gcc/$ARCH-linux-musl/$NEWVERSION
sed -i -e "s/$OLDVERSION/$NEWVERSION/g" $(find $PREFIX -name \*.sym | grep $ARCH)
fi
FILES="
$ARCH-linux-musl/bin/ld.bfd
libexec/gcc/$ARCH-linux-musl/$NEWVERSION/collect2
libexec/gcc/$ARCH-linux-musl/$NEWVERSION/cc1
libexec/gcc/$ARCH-linux-musl/$NEWVERSION/cc1plus
bin/$ARCH-linux-musl-elfedit
bin/$ARCH-linux-musl-nm
bin/$ARCH-linux-musl-objcopy
bin/$ARCH-linux-musl-gcc
bin/$ARCH-linux-musl-c++filt
bin/$ARCH-linux-musl-gcc-ranlib
bin/$ARCH-linux-musl-addr2line
bin/$ARCH-linux-musl-objdump
bin/$ARCH-linux-musl-gcov
bin/$ARCH-linux-musl-ranlib
bin/$ARCH-linux-musl-gcc-nm
bin/$ARCH-linux-musl-strip
bin/$ARCH-linux-musl-gcov-tool
bin/$ARCH-linux-musl-gprof
bin/$ARCH-linux-musl-strings
bin/$ARCH-linux-musl-gcov-dump
bin/$ARCH-linux-musl-cpp
bin/$ARCH-linux-musl-ar
bin/$ARCH-linux-musl-readelf
bin/$ARCH-linux-musl-size
bin/$ARCH-linux-musl-as
bin/$ARCH-linux-musl-g++
bin/$ARCH-linux-musl-gcc-ar
"
for f in $FILES; do
cp -f $IMPORT/$f $PREFIX/$f || exit
gzip -f9 $PREFIX/$f || exit
done