#!/bin/sh # ###################################################### # Build script for piCore64-15.x # # # # See .info for details # ###################################################### ###################################################### # Prepare extension creation # ###################################################### #download and install dependencies #download and install the compile tools tce-load -wi bash.tcz tce-load -wi autoconf.tcz tce-load -wi automake.tcz tce-load -wi libtool-dev.tcz tce-load -wi intltool.tcz tce-load -wi libffi7.tcz tce-load -wi llvm-bin.tcz tce-load -wi compiletc.tcz tce-load -wi squashfs-tools.tcz ###################################################### # Configure extension creation parameters # ###################################################### # Variables TODAY=`date +%Y/%m/%d` PACKAGE="libuv" VERSION="1.50.0" DESCRIPTION="libuv is a multi-platform support library with a focus on asynchronous I/O" DOCDESCRIPTION="Documentation part of libuv" DEVDESCRIPTION="Development files part of libuv" AUTHORS="https://github.com/libuv/libuv/blob/v1.x/AUTHORS" HOMEPAGE="https://libuv.org/" LICENSE="https://github.com/libuv/libuv/blob/v1.x/LICENSE" ME="rhermsen" TAGS="libuv asynchronous" DOCTAGS="man pages libuv asynchronous" DEVTAGS="development libuv asynchronous" DESTDIR=/mnt/mmcblk0p2/tce/dest/${PACKAGE} TMPDIR=/mnt/mmcblk0p2/tce/submit/${PACKAGE} SRCDIR=/mnt/mmcblk0p2/tce/${PACKAGE} ARCH=`uname -m` # Workdir sudo rm -r ${SRCDIR}/${PACKAGE}-v${VERSION} 2>/dev/null [ ! -d ${SRCDIR} ] && mkdir ${SRCDIR} # Source cd ${SRCDIR} [ ! -f ${SRCDIR}/${PACKAGE}-v${VERSION}.tar.gz ] && wget https://dist.libuv.org/dist/v${VERSION}/${PACKAGE}-v${VERSION}.tar.gz tar xzf ${PACKAGE}-v${VERSION}.tar.gz cd ${SRCDIR}/${PACKAGE}-v${VERSION} ###################################################### # Compile extension # ###################################################### # Export variables needed for compilation ARCH=`uname -m` if [ $ARCH == "armhf" ] then echo export CFLAGS="-Os -pipe -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" export CXXFLAGS="-Os -pipe -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" elif [ $ARCH == "aarch64" ] then # export CFLAGS="-Os -pipe -march=armv8-a+crc -mtune=cortex-a72" export CFLAGS="-Os -pipe -march=armv8-a+crc -mtune=cortex-a72 -flto -fuse-linker-plugin -fno-exceptions" # export CXXFLAGS="-Os -pipe -march=armv8-a+crc -mtune=cortex-a72" export CXXFLAGS="-Os -pipe -march=armv8-a+crc -mtune=cortex-a72 -flto -fuse-linker-plugin -fno-exceptions -fno-rtti" echo else exit 1 fi export LDFLAGS="-Wl,-O1" export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig # Compile cd /${SRCDIR}/${PACKAGE}-v${VERSION} sh autogen.sh ./configure --prefix=/usr/local \ --localstatedir=/var \ # --verbose # make time make -j4 mkdir -p $DESTDIR time make DESTDIR=$DESTDIR install # 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/lib mkdir -p ${TMPDIR}/usr/local/share/doc/${PACKAGE} cp ${SRCDIR}/${PACKAGE}-v${VERSION}/LICENSE ${TMPDIR}/usr/local/share/doc/${PACKAGE}/ mv ${DESTDIR}/usr/local/lib/libuv.so* ${TMPDIR}/usr/local/lib/ ################################################### # 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: polikuo Tags: ${TAGS} Comments: libuv is a multi-platform support library with a focus on asynchronous I/O. on asynchronous I/O. Change-log: 2019/11/21 first version (juanito) 2020/06/30 updated 1.33.1 -> 1.38.0 (juanito) 2023/08/22 1.38.0 --> 1.46.0 (polikuo) ${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: polikuo Tags: ${TAGS} Comments: libuv is a multi-platform support library with a focus on asynchronous I/O. on asynchronous I/O. Change-log: 2020/08/21 first version (juanito) 2022/03/04 1.38.1 --> 1.43.0 (polikuo) ${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 ${DESTDIR}/usr/local/share/man ${TMPDIR}-doc/usr/local/share/${PACKAGE}/ # mv ${DESTDIR}/usr/local/share/doc ${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: libuv is a multi-platform support library with a focus on asynchronous I/O. on asynchronous I/O. Change-log: ${TODAY} first version, ${VERSION} (${ME}) Current: ${TODAY} first version, ${VERSION} (${ME}) EOF # Move files to dev extension mkdir -p $TMPDIR-dev/usr/local/lib/pkgconfig mv ${DESTDIR}/usr/local/include ${TMPDIR}-dev/usr/local/ mv ${DESTDIR}/usr/local/lib/*.a ${TMPDIR}-dev/usr/local/lib mv ${DESTDIR}/usr/local/lib/pkgconfig/*.pc ${TMPDIR}-dev/usr/local/lib/pkgconfig ################################################### # Create info file # ################################################### if [ $ARCH == "armhf" ] then cat < ${PACKAGE}-dev.tcz.info Title: ${PACKAGE}-dev.tcz Description: ${DEVDESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: polikuo Tags: ${DEVTAGS} Comments: libuv is a multi-platform support library with a focus on asynchronous I/O. on asynchronous I/O. Change-log: 2019/11/21 first version (juanito) 2020/06/30 updated 1.33.1 -> 1.38.0 (juanito) 2023/08/22 1.38.0 --> 1.46.0 (polikuo) ${TODAY} updated version, ${VERSION} (${ME}) Current: ${TODAY} updated version, ${VERSION} (${ME}) EOF elif [ $ARCH == "aarch64" ] then cat < ${PACKAGE}-dev.tcz.info Title: ${PACKAGE}-dev.tcz Description: ${DEVDESCRIPTION} Version: ${VERSION} Author: ${AUTHORS} Original-site: ${HOMEPAGE} Copying-policy: ${LICENSE} Size: ${size} Extension_by: polikuo Tags: ${DEVTAGS} Comments: libuv is a multi-platform support library with a focus on asynchronous I/O. on asynchronous I/O. Change-log: 2020/08/21 first version (juanito) 2022/03/04 1.38.1 --> 1.43.0 (polikuo) --enable-static ${TODAY} updated version, ${VERSION} (${ME}) Current: ${TODAY} updated version, ${VERSION} (${ME}) EOF fi ################################################### # Create .dep file # ################################################### cat < /mnt/mmcblk0p2/tce/submit/${PACKAGE}-dev.tcz.dep ${PACKAGE}.tcz 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 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 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 ################################################### # Create dev extension in temp dir # ################################################### llvm-strip --strip-debug $TMPDIR-dev/usr/local/lib/libuv.a cd $TMPDIR-dev find $TMPDIR-dev -perm 777 -exec chmod 755 {} \; find $TMPDIR-dev -perm 555 -exec chmod 755 {} \; find $TMPDIR-dev -perm 444 -exec chmod 644 {} \; find $TMPDIR-dev -perm 666 -exec chmod 644 {} \; find $TMPDIR-dev -perm 664 -exec chmod 644 {} \; sudo chown -R root:root $TMPDIR-dev cd .. # mksquashfs $TMPDIR-dev ${PACKAGE}-dev.tcz mksquashfs $TMPDIR-dev ${PACKAGE}-dev.tcz cd $TMPDIR-dev sudo sh -c "find usr -not -type d | sed 's/\(.*$\)/\/\1/g' > ${PACKAGE}-dev.tcz.list" sudo mv ../${PACKAGE}-dev.tcz* . #sudo mv /mnt/mmcblk0p2/tce/${PACKAGE}/${PACKAGE}-dev.tcz.info . # Create md5 file sudo sh -c "md5sum ${PACKAGE}-dev.tcz > ${PACKAGE}-dev.tcz.md5.txt" # Cleanup temp directory sudo rm -r -f usr