#!/bin/sh # ###################################################### # Build script # # # # See .info for details # ###################################################### tce-load -i compiletc squashfs-tools openssl-dev cmake libxslt-dev.tcz ###################################################### # Configure extension creation parameters # ###################################################### SRCPATH="../../../sources" SRCNAM=mosquitto-2.0.18.tar.gz WRKDIR=mosquitto-2.0.18 EXTNAM=mosquitto TMPDIR=/tmp/$EXTNAM ###################################################### # Prepare extension creation # ###################################################### # Remove dirs and files left from previous creation rm -r -f $WRKDIR rm -r -f $TMPDIR rm -r -f $TMPDIR-dev # Crete temporary directory mkdir -p $TMPDIR ###################################################### # Compile extension # ###################################################### # Export variables needed for compilation case $(uname -m) in armv*) 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" ;; aarch64) 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" ;; esac export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig # Unpack source in current directory tar xf ${SRCPATH}/${SRCNAM} # Configure it cd $WRKDIR mkdir build && cd build cmake -LAH -DCMAKE_C_FLAGS_RELEASE="$CFLAGS" -DCMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \ -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=TRUE \ -DCMAKE_INSTALL_LIBDIR:PATH=lib ../ # Compile make -j6 # Install in base temp dir make install DESTDIR=$TMPDIR # Delete compilation work directory cd ../.. rm -r -f $WRKDIR # 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 # Move files to dev extension mkdir -p $TMPDIR-dev/usr/local/lib mv $TMPDIR/usr/local/include $TMPDIR-dev/usr/local mv $TMPDIR/usr/local/lib/pkgconfig $TMPDIR-dev/usr/local/lib/ rm -f $TMPDIR/usr/local/lib/*.a rm -f $TMPDIR/usr/local/lib/*.la # Remove docs rm -rf $TMPDIR/usr/local/share ################################################### # Create base extension in temp dir # ################################################### cd $TMPDIR cd .. mksquashfs $TMPDIR $EXTNAM.tcz -b 16384 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 dev extension in temp dir # ################################################### cd $TMPDIR-dev cd .. mksquashfs $TMPDIR-dev $EXTNAM-dev.tcz -b 16384 cd $TMPDIR-dev find usr -not -type d > $EXTNAM-dev.tcz.list mv ../$EXTNAM-dev.tcz . # Create md5 file md5sum $EXTNAM-dev.tcz > $EXTNAM-dev.tcz.md5.txt # Cleanup temp directory rm -r -f usr