#!/bin/sh # ###################################################### # Build script for piCore64-15.x # # # # See .info for details # ###################################################### # During Testing packages there are a number of timeouts. # Running separate tests are ok # /mnt/mmcblk0p2/tce/submit/go/usr/local/go/bin/go test -test.short -test.v encoding/gob # ok encoding/gob 511.084s # /mnt/mmcblk0p2/tce/submit/go/usr/local/go/bin/go test -test.short -test.v internal/trace # ok internal/trace 83.546s # /mnt/mmcblk0p2/tce/submit/go/usr/local/go/bin/go test -test.short -test.v runtime # ok runtime 418.470s # /mnt/mmcblk0p2/tce/submit/go/usr/local/go/bin/go test -test.short -test.v cmd/compile/internal/loopvar # ok cmd/compile/internal/loopvar 172.004s # /mnt/mmcblk0p2/tce/submit/go/usr/local/go/bin/go test -test.short -test.v cmd/compile/internal/ssa # ok cmd/compile/internal/ssa 209.291s # /mnt/mmcblk0p2/tce/submit/go/usr/local/go/bin/go test -test.short -test.v cmd/go # ok cmd/go 470.330s ###################################################### # Prepare extension creation # ###################################################### #download and install dependencies tce-load -wi bash #download and install the compile tools tce-load -wi compiletc.tcz tce-load -wi squashfs-tools.tcz ###################################################### # Configure extension creation parameters # ###################################################### # Variables TODAY=`date +%Y/%m/%d` PACKAGE="go" VERSION="1.23.1" DESCRIPTION="The Go Programming Language" DOCDESCRIPTION="Documentation part of go" DEVDESCRIPTION="Development files part of go" AUTHORS="see homepage" HOMEPAGE="https://go.dev/" LICENSE="https://github.com/golang/go?tab=BSD-3-Clause-1-ov-file" ME="rhermsen" TAGS="go programming" DOCTAGS="man pages go programming" DEVTAGS="development go programming" DESTDIR=/mnt/mmcblk0p2/tce/dest/${PACKAGE} TMPDIR=/mnt/mmcblk0p2/tce/submit/${PACKAGE} BOOTSTRAPDIR=/mnt/mmcblk0p2/tce/BS/${PACKAGE} ARCH=`uname -m` # With RPi3b the tmp dir isn't big enough. Compile from disk. if [ $ARCH == "armhf" ] then SRCDIR=/mnt/mmcblk0p2/tce/${PACKAGE} elif [ $ARCH == "aarch64" ] then SRCDIR=/mnt/mmcblk0p2/tce/${PACKAGE} fi # Needed for internal linking if [ $ARCH == "aarch64" ] then sudo ln -s /lib /lib64 fi # Workdir sudo rm -r ${SRCDIR} 2>/dev/null mkdir ${SRCDIR} # Bootstrapdir sudo rm -r ${BOOTSTRAPDIR} 2>/dev/null mkdir -p ${BOOTSTRAPDIR} # Bootstrap build cd ${BOOTSTRAPDIR} if [ $ARCH == "armhf" ] then wget https://go.dev/dl/go${VERSION}.linux-armv6l.tar.gz tar xzf go${VERSION}.linux-armv6l.tar.gz elif [ $ARCH == "aarch64" ] then wget https://go.dev/dl/go${VERSION}.linux-arm64.tar.gz tar xzf go${VERSION}.linux-arm64.tar.gz fi # Source cd ${SRCDIR} wget https://go.dev/dl/go${VERSION}.src.tar.gz tar xzf go${VERSION}.src.tar.gz cd ${SRCDIR}/${PACKAGE} ###################################################### # Compile extension # ###################################################### # Export variables needed for compilation ARCH=`uname -m` if [ $ARCH == "armhf" ] then echo export CFLAGS="-flto=auto -Os -pipe -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" export CXXFLAGS="-flto=auto -Os -pipe -fno-exceptions -fno-rtti -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" BITS="linux32" # no specific arch dependent parameters elif [ $ARCH == "aarch64" ] then export CFLAGS="-flto=auto -Os -pipe -march=armv8-a+crc -mtune=cortex-a72" export CXXFLAGS="-flto=auto -Os -pipe -fno-exceptions -fno-rtti -march=armv8-a+crc -mtune=cortex-a72" BITS="" echo # no specific arch dependent parameters else exit 1 fi export LDFLAGS="-Wl,-O1" export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig # Environment variables # go env sudo -r rm /mnt/mmcblk0p2/go 2>/dev/null [ ! -d /mnt/mmcblk0p2/go ] && sudo mkdir /mnt/mmcblk0p2/go cd /mnt/mmcblk0p2 sudo chown tc:staff go export GOPATH=/mnt/mmcblk0p2/go sudo -r rm /mnt/mmcblk0p2/go-build 2>/dev/null [ ! -d /mnt/mmcblk0p2/go-build ] && sudo mkdir /mnt/mmcblk0p2/go-build cd /mnt/mmcblk0p2 sudo chown tc:staff go-build export GOCACHE=/mnt/mmcblk0p2/go-build sudo -r rm /mnt/mmcblk0p2/tmp 2>/dev/null [ ! -d /mnt/mmcblk0p2/tmp ] && sudo mkdir /mnt/mmcblk0p2/tmp cd /mnt/mmcblk0p2 sudo chown tc:staff tmp export GOTMPDIR=/mnt/mmcblk0p2/tmp # Compile cd /${SRCDIR}/${PACKAGE}/src # sudo GOROOT_BOOTSTRAP=/mnt/mmcblk0p2/tce/BS/go/go ./all.bash GOROOT_BOOTSTRAP=/mnt/mmcblk0p2/tce/BS/go/go ./all.bash # Below lines just for savekeeping in case make is used in a build script, and needs troubleshooting. # https://stackoverflow.com/questions/5820303/how-do-i-force-make-gcc-to-show-me-the-commands # make -n install # make SHELL='sh -x' DESTDIR=$DESTDIR install ###################################################### # Base extension # ###################################################### sudo rm -r ${TMPDIR}* 2>/dev/null mkdir -p ${TMPDIR}/usr/local/${PACKAGE} mkdir -p ${TMPDIR}/usr/local/bin mkdir -p ${TMPDIR}/usr/local/share/doc/${PACKAGE} cp ${SRCDIR}/${PACKAGE}/LICENSE ${TMPDIR}/usr/local/share/doc/${PACKAGE}/ mv ${SRCDIR}/${PACKAGE}/bin ${TMPDIR}/usr/local/${PACKAGE} mv ${SRCDIR}/${PACKAGE}/lib ${TMPDIR}/usr/local/${PACKAGE} mv ${SRCDIR}/${PACKAGE}/misc ${TMPDIR}/usr/local/${PACKAGE} mv ${SRCDIR}/${PACKAGE}/pkg ${TMPDIR}/usr/local/${PACKAGE} mv ${SRCDIR}/${PACKAGE}/src ${TMPDIR}/usr/local/${PACKAGE} mv ${SRCDIR}/${PACKAGE}/test ${TMPDIR}/usr/local/${PACKAGE} mv ${SRCDIR}/${PACKAGE}/go.env ${TMPDIR}/usr/local/${PACKAGE} mv ${SRCDIR}/${PACKAGE}/VERSION ${TMPDIR}/usr/local/${PACKAGE} mv ${SRCDIR}/${PACKAGE}/codereview.cfg ${TMPDIR}/usr/local/${PACKAGE} # Add symlinks cd $TMPDIR/usr/local/bin ln -s ../go/bin/go ln -s ../go/bin/gofmt ################################################### # Create info file # ################################################### cd /mnt/mmcblk0p2/tce/submit/ if [ $ARCH == "armhf" ] then cat < ${PACKAGE}.tcz.info Title: ${PACKAGE}.tcz Description: ${DESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: bmarkus, (${ME}) Tags: ${TAGS} Comments: Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. (consider using disk in case /tmp runs out of space) (e.g. export TMPDIR=/mnt//) Change-log: ${TODAY} updated version, ${VERSION} (${ME}) Current: ${TODAY} updated version, ${VERSION} (${ME}) EOF elif [ $ARCH == "aarch64" ] then cat < ${PACKAGE}.tcz.info Title: ${PACKAGE}.tcz Description: ${DESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: ${ME} Tags: ${TAGS} Comments: Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. Change-log: ${TODAY} Updated version, ${VERSION} (${ME}) Current: ${TODAY} Updated version, ${VERSION} (${ME}) EOF fi # Move files to doc extension mkdir -p $TMPDIR-doc/usr/local/share/${PACKAGE} mv ${SRCDIR}/${PACKAGE}/doc ${TMPDIR}-doc/usr/local/share/${PACKAGE}/ mv ${SRCDIR}/${PACKAGE}/api ${TMPDIR}-doc/usr/local/share/${PACKAGE}/ ################################################### # Create info file # ################################################### cat < ${PACKAGE}-doc.tcz.info Title: ${PACKAGE}-doc.tcz Description: ${DOCDESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: ${ME} Tags: ${DOCTAGS} Comments: Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. Change-log: ${TODAY} first version, ${VERSION} (${ME}) Current: ${TODAY} first version, ${VERSION} (${ME}) EOF ################################################### # Create base extension in temp dir # ################################################### find $TMPDIR/ -type d | xargs chmod -v 755; find $TMPDIR | xargs file | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded cd $TMPDIR find $TMPDIR -perm 777 -exec chmod 755 {} \; find $TMPDIR -perm 555 -exec chmod 755 {} \; find $TMPDIR -perm 444 -exec chmod 644 {} \; find $TMPDIR -perm 666 -exec chmod 644 {} \; find $TMPDIR -perm 664 -exec chmod 644 {} \; sudo chown -R root:root $TMPDIR cd /mnt/mmcblk0p2/tce/submit/ mksquashfs $TMPDIR ${PACKAGE}.tcz cd $TMPDIR sudo sh -c "find usr -not -type d | sed 's/\(.*$\)/\/\1/g' > ${PACKAGE}.tcz.list" sudo mv ../${PACKAGE}.tcz . # sudo mv ../${PACKAGE}.tcz.dep . sudo mv ../${PACKAGE}.tcz.info . # Create md5 file sudo sh -c "md5sum ${PACKAGE}.tcz > ${PACKAGE}.tcz.md5.txt" # Cleanup temp directory sudo rm -r -f usr ################################################### # Create doc extension in temp dir # ################################################### cd $TMPDIR-doc find $TMPDIR-doc -perm 777 -exec chmod 755 {} \; find $TMPDIR-doc -perm 555 -exec chmod 755 {} \; find $TMPDIR-doc -perm 444 -exec chmod 644 {} \; find $TMPDIR-doc -perm 666 -exec chmod 644 {} \; find $TMPDIR-doc -perm 664 -exec chmod 644 {} \; sudo chown -R root:root $TMPDIR-doc cd .. mksquashfs $TMPDIR-doc ${PACKAGE}-doc.tcz cd $TMPDIR-doc sudo sh -c "find usr -not -type d | sed 's/\(.*$\)/\/\1/g' > ${PACKAGE}-doc.tcz.list" sudo mv ../${PACKAGE}-doc.tcz* . #sudo mv /mnt/mmcblk0p2/tce/${PACKAGE}/${PACKAGE}-doc.tcz.info . # Create md5 file sudo sh -c "md5sum ${PACKAGE}-doc.tcz > ${PACKAGE}-doc.tcz.md5.txt" # Cleanup temp directory sudo rm -r -f usr