#!/usr/local/bin/bash tce-load -i compiletc.tcz bash.tcz coreutils.tcz mpc-dev.tcz gmp-dev.tcz mpfr-dev.tcz isl-dev.tcz \ squashfs-tools.tcz export CFLAGS="-Os -march=armv8-a+crc -mtune=cortex-a72 -use-ld=gold -lpthread" export CXXFLAGS="-Os -march=armv8-a+crc -mtune=cortex-a72 -use-ld=gold" SRCNAM=gcc-10.2.0.tar.xz WRKDIR=gcc-10.2.0 EXTNAM=gcc TMPDIR=/tmp/$EXTNAM tar xf $SRCNAM cd $WRKDIR sed -e '/lp64=/s/lib64/lib/' -i.orig gcc/config/aarch64/t-aarch64-linux mkdir build && cd build # Configure ../configure \ --libdir=/usr/lib \ --libexecdir=/usr/local/lib \ --enable-shared \ --enable-threads=posix \ --enable-__cxa_atexit \ --enable-c99 \ --enable-long-long \ --enable-clocale=gnu \ --enable-languages=c,c++ \ --disable-multilib \ --disable-libstdcxx-pch \ --enable-cloog-backend=isl \ --with-isl=/usr/local \ --with-mpfr=/usr/local \ --with-gmp=/usr/local \ --with-mpc=/usr/local \ --with-system-zlib \ --enable-frame-pointer \ --disable-bootstrap \ --enable-lto \ --with-pkgversion=piCore64 \ --enable-fix-cortex-a53-843419 \ --with-gxx-include-dir=/usr/include/c++/10.2.0 # Build make -j4 make install DESTDIR=/tmp/gcc # remove copies and install links rm -f $TMPDIR/usr/local/bin/gcc rm -f $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-gcc rm -f $TMPDIR/usr/local/bin/g++ rm -f $TMPDIR/usr/local/bin/c++ rm -f $TMPDIR/usr/local/bin/cpp rm -f $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-c++ rm -f $TMPDIR/usr/local/bin/gcc-ar rm -f $TMPDIR/usr/local/bin/gcc-nm rm -f $TMPDIR/usr/local/bin/gcc-ranlib ln -sr $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-gcc-10.2.0 $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-gcc ln -sr $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-gcc-10.2.0 $TMPDIR/usr/local/bin/gcc ln -sr $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-gcc-10.2.0 $TMPDIR/usr/local/bin/cc ln -sr $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-g++ $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-c++ ln -sr $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-g++ $TMPDIR/usr/local/bin/g++ ln -sr $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-g++ $TMPDIR/usr/local/bin/c++ ln -sr $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-g++ $TMPDIR/usr/local/bin/cpp ln -sr $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-gcc-ar $TMPDIR/usr/local/bin/gcc-ar ln -sr $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-gcc-nm $TMPDIR/usr/local/bin/gcc-nm ln -sr $TMPDIR/usr/local/bin/aarch64-unknown-linux-gnu-gcc-ranlib $TMPDIR/usr/local/bin/gcc-ranlib # Adjust directory access rigths find $TMPDIR/ -type d | xargs chmod -v 755; # Strip executables find $TMPDIR | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded mkdir ${TMPDIR}_base mkdir ${TMPDIR}_base-dev mkdir ${TMPDIR}_libs-dev mkdir ${TMPDIR}_libs mkdir -p ${TMPDIR}-locale/usr/local/share mkdir -p ${TMPDIR}-doc/usr/local/share #move docs to doc extension mv -f ${TMPDIR}/usr/local/share/man ${TMPDIR}-doc/usr/local/share #move locale to extension mv -f ${TMPDIR}/usr/local/share/locale ${TMPDIR}-locale/usr/local/share #remove info files rm -rf ${TMPDIR}/usr/local/share/info #move files to the base-dev extension mkdir -p ${TMPDIR}_base-dev/usr/lib mkdir -p ${TMPDIR}_base-dev/usr/local mv -f ${TMPDIR}/usr/local/share ${TMPDIR}_base-dev/usr/local mv -f ${TMPDIR}/usr/lib/libstdc++.a ${TMPDIR}_base-dev/usr/lib mv -f ${TMPDIR}/usr/lib/libstdc++.la ${TMPDIR}_base-dev/usr/lib mv -f ${TMPDIR}/usr/lib/libstdc++*.py ${TMPDIR}_base-dev/usr/lib #move libs that will be in the base mkdir -p ${TMPDIR}_base/usr/lib mv -f ${TMPDIR}/usr/lib/libgcc*.so* ${TMPDIR}_base/usr/lib mv -f ${TMPDIR}/usr/lib/libstdc++*.so* ${TMPDIR}_base/usr/lib #move libs to lib extension mkdir -p ${TMPDIR}_libs/usr/lib mv ${TMPDIR}/usr/lib/*.so* ${TMPDIR}_libs/usr/lib #Move libs-dev to extension mkdir -p ${TMPDIR}_libs-dev/usr/lib mv ${TMPDIR}/usr/lib/lib* ${TMPDIR}_libs-dev/usr/lib rmdir $TMPDIR/usr/local/include ################################################### # Create base extension in temp dir # ################################################### cd $TMPDIR cd .. mksquashfs $TMPDIR $EXTNAM.tcz cd $TMPDIR find usr -not -type d > $EXTNAM.tcz.list mv ../$EXTNAM.tcz . # Create md5 file md5sum $EXTNAM.tcz > $EXTNAM.tcz.md5.txt # Cleanup temp directory rm -r -f usr ################################################### # Create _libs extension in temp dir # ################################################### cd ${TMPDIR}_libs cd .. mksquashfs ${TMPDIR}_libs ${EXTNAM}_libs.tcz cd ${TMPDIR}_libs find usr -not -type d > ${EXTNAM}_libs.tcz.list mv ../${EXTNAM}_libs.tcz . # Create md5 file md5sum ${EXTNAM}_libs.tcz > ${EXTNAM}_libs.tcz.md5.txt # Cleanup temp directory rm -r -f usr ################################################### # Create _libs-dev extension in temp dir # ################################################### cd ${TMPDIR}_libs-dev cd .. mksquashfs ${TMPDIR}_libs-dev ${EXTNAM}_libs-dev.tcz cd ${TMPDIR}_libs-dev find usr -not -type d > ${EXTNAM}_libs-dev.tcz.list mv ../${EXTNAM}_libs-dev.tcz . # Create md5 file md5sum ${EXTNAM}_libs-dev.tcz > ${EXTNAM}_libs-dev.tcz.md5.txt # Cleanup temp directory rm -r -f usr ################################################### # Create _base-dev extension in temp dir # ################################################### cd ${TMPDIR}_base-dev cd .. mksquashfs ${TMPDIR}_base-dev ${EXTNAM}_base-dev.tcz cd ${TMPDIR}_base-dev find usr -not -type d > ${EXTNAM}_base-dev.tcz.list mv ../${EXTNAM}_base-dev.tcz . # Create md5 file md5sum ${EXTNAM}_base-dev.tcz > ${EXTNAM}_base-dev.tcz.md5.txt # Cleanup temp directory rm -r -f usr ################################################### # Create locale extension in temp dir # ################################################### cd $TMPDIR-locale cd .. mksquashfs $TMPDIR-locale $EXTNAM-locale.tcz cd $TMPDIR-locale find usr -not -type d > $EXTNAM-locale.tcz.list mv ../$EXTNAM-locale.tcz . # Create md5 file md5sum $EXTNAM-locale.tcz > $EXTNAM-locale.tcz.md5.txt # Cleanup temp directory rm -r -f usr ################################################### # Create doc extension in temp dir # ################################################### cd $TMPDIR-doc cd .. mksquashfs $TMPDIR-doc $EXTNAM-doc.tcz cd $TMPDIR-doc find usr -not -type d > $EXTNAM-doc.tcz.list mv ../$EXTNAM-doc.tcz . # Create md5 file md5sum $EXTNAM-doc.tcz > $EXTNAM-doc.tcz.md5.txt # Cleanup temp directory rm -r -f usr ################################################### # Tar up the base files # ################################################### cd ${TMPDIR}_base tar zcvf gcc_base.tar.gz usr/ # Cleanup temp directory rm -r -f usr