#!/bin/sh # ###################################################### # Build script for RPI # # # # See .info for details # ###################################################### tce-load -i compiletc squashfs-tools ###################################################### # Configure extension creation parameters # ###################################################### SRCPATH="../../../sources" SRCNAM=alsa-lib-1.2.12.tar.bz2 WRKDIR=alsa-lib-1.2.12 EXTNAM=libasound TMPDIR=/tmp/libasound ###################################################### # 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 $(find /lib | grep ld-linux) in *armhf*) export CFLAGS="-Os -pipe -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" export CXXFLAGS="-Os -pipe -fno-exceptions -fno-rtti -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" BITS="linux32" ;; *aarch64*) export CFLAGS="-Os -pipe -march=armv8-a+crc -mtune=cortex-a72" export CXXFLAGS="-Os -pipe -fno-exceptions -fno-rtti -march=armv8-a+crc -mtune=cortex-a72" BITS="" ;; esac export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig # Unpack source in current directory tar xf ${SRCPATH}/${SRCNAM} cd $WRKDIR # Configure it ${BITS} ./configure --prefix=/usr/local --enable-shared --disable-python \ --disable-topology # Compile ${BITS} make -j6 [ $? -ne 0 ] && exit 1 # Install in base temp dir ${BITS} 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 : | ${BITS} xargs strip --strip-unneeded # Pack dev extension mkdir -p $TMPDIR-dev/usr/local/share mkdir -p $TMPDIR-dev/usr/local/lib mv $TMPDIR/usr/local/include $TMPDIR-dev/usr/local mv $TMPDIR/usr/local/share/aclocal $TMPDIR-dev/usr/local/share mv $TMPDIR/usr/local/lib/pkgconfig $TMPDIR-dev/usr/local/lib rm $TMPDIR/usr/local/lib/*.la rm $TMPDIR/usr/local/lib/alsa-lib/smixer/*.la # Delete unneded files rm -r -f $TMPDIR/usr/local/bin rm -r -f $TMPDIR/usr/local/share ################################################### # 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 dev extension in temp dir # ################################################### cd $TMPDIR-dev cd .. mksquashfs $TMPDIR-dev $EXTNAM-dev.tcz 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