#!/bin/sh # ###################################################### # Build script for TC4/RPI # # # # See .info for details # ###################################################### ###################################################### # Configure extension creation parameters # ###################################################### SRCNAM=Python-2.7.7.tar.xz WRKDIR=Python-2.7.7 EXTNAM=python TMPDIR=/mnt/mmcblk0p6/python ###################################################### # Prepare extension creation # ###################################################### # Remove dirs and files left from previous creation rm -r -f $WRKDIR rm -r -f $TMPDIR rm -r -f $TMPDIR-doc rm -r -f $TMPDIR-dev # Crete temporary directory mkdir -p $TMPDIR ###################################################### # Compile extension # ###################################################### # Export variables needed for compilation export CFLAGS="-O3 -pipe" export CXXFLAGS="-O3 -pipe -fno-rtti -fno-exceptions" export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig # Unpack source in current directory tar -xf $SRCNAM # Configure it cd $WRKDIR ./configure --prefix=/usr/local --enable-shared # Compile make # 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 # Delete unneded files and dirs find $TMPDIR -not -type d -name *.pyc | xargs rm -f find $TMPDIR -not -type d -name *.pyo | xargs rm -f find $TMPDIR -type d -name test | xargs rm -f -r # Add startup script mkdir -p $TMPDIR/usr/local/tce.installed cp python.ins $TMPDIR/usr/local/tce.installed/python chmod -R 775 $TMPDIR/usr/local/tce.installed chown -R root.staff $TMPDIR/usr/local/tce.installed # Move bin to archive mkdir -p $TMPDIR/usr/local/share/python/files cd $TMPDIR tar czf files.tar.gz usr/local/bin mv files.tar.gz $TMPDIR/usr/local/share/python/files rm -r -f $TMPDIR/usr/local/bin # Move files to doc extension mkdir -p $TMPDIR-doc/usr/local/share mv $TMPDIR/usr/local/share/man $TMPDIR-doc/usr/local/share # 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/*.a $TMPDIR-dev/usr/local/lib #mv $TMPDIR/usr/local/lib/*.la $TMPDIR-dev/usr/local/lib mv $TMPDIR/usr/local/lib/pkgconfig $TMPDIR-dev/usr/local/lib # Move pyconfig.h back to base mkdir -p $TMPDIR/usr/local/include/python2.7 mv $TMPDIR-dev/usr/local/include/python2.7/pyconfig.h $TMPDIR/usr/local/include/python2.7 ################################################### # 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 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 ################################################### # 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