#!/bin/sh # ###################################################### # Build script for Core 11 # # # # See .info for details # ###################################################### ###################################################### # Prepare extension creation # ###################################################### # download and install python tce-load -wi python-dev.tcz #tce-load -wi python.tcz # download and install other python dependencies tce-load -wi python-setuptools.tcz tce-load -wi libffi-dev.tcz #tce-load -wi libffi.tcz tce-load -i python-pycparser.tcz # 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="python-cffi" VERSION="1.14.2" SHA256="" DESCRIPTION="Foreign Function Interface for Python calling C code" DEVDESCRIPTION="Develoment part of CFFI, Foreign Function Interface for Python calling C code" AUTHORS="Armin Rigo, Maciej Fijalkowski" HOMEPAGE="http://cffi.readthedocs.org" LICENSE="MIT" ME="rhermsen" TAGS="python cffi" DEVTAGS="python cffi" DESTDIR=/tmp/dest/${PACKAGE} TMPDIR=/tmp/submit/${PACKAGE} DOWNLOAD="f7/09/88bbe20b76ca76be052c366fe77aa5e3cd6e5f932766e5597fecdd95b2a8/cffi-$VERSION.tar.gz" # Workdir sudo rm -r /tmp/${PACKAGE} 2>/dev/null mkdir /tmp/${PACKAGE} cd /tmp/${PACKAGE} # Source wget https://files.pythonhosted.org/packages/$DOWNLOAD -O cffi-$VERSION.tar.gz tar xf /tmp/${PACKAGE}/cffi-${VERSION}.tar.gz cd /tmp/${PACKAGE}/cffi-${VERSION} ###################################################### # Compile extension # ###################################################### export CFLAGS="-march=i486 -mtune=i686 -Os -pipe" export CXXFLAGS="-march=i486 -mtune=i686 -Os -pipe" export LDFLAGS="-Wl,-O1" python setup.py build sudo python setup.py install sudo rm -r ${TMPDIR}* 2>/dev/null mkdir -p ${TMPDIR}/usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/cffi mkdir -p ${TMPDIR}/usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/EGG-INFO mkdir -p $TMPDIR/usr/local/share/doc/python-cffi/ mkdir -p ${TMPDIR}/usr/local/tce.installed cp /usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/*.py ${TMPDIR}/usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/ cp /usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/*.so ${TMPDIR}/usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/ cp /usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/cffi/*.py ${TMPDIR}/usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/cffi/ cp /usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/EGG-INFO/* ${TMPDIR}/usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/EGG-INFO/ cp /tmp/${PACKAGE}/cffi-${VERSION}/LICENSE $TMPDIR/usr/local/share/doc/python-cffi/ ################################################### # Create info file # ################################################### cd /tmp/submit/ 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: CFFI Foreign Function Interface for Python calling C code. Please see the Documentation http://cffi.readthedocs.org/ Change-log: 2019/05/19 first verion, 1.12.3 ${TODAY} updated verion with libffi as added dependency, ${VERSION} Current: ${TODAY} updated verion with libffi as added dependency, ${VERSION} EOF ################################################### # Create .dep file # ################################################### cat < ${PACKAGE}.tcz.dep libffi.tcz python.tcz EOF ################################################### # Create install script file # ################################################### cat < $TMPDIR/usr/local/tce.installed/${PACKAGE} #!/bin/sh echo './cffi-${VERSION}-py2.7-linux-i686.egg' >> /usr/local/lib/python2.7/site-packages/easy-install.pth EOF ###################################################### # Dev extension # ###################################################### mkdir -p ${TMPDIR}-dev/usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/cffi cp -r /usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/cffi/*.h ${TMPDIR}-dev/usr/local/lib/python2.7/site-packages/cffi-${VERSION}-py2.7-linux-i686.egg/cffi/ ################################################### # Create info file # ################################################### cd /tmp/submit/ 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: ${ME} Tags: ${DEVTAGS} Comments: CFFI Foreign Function Interface for Python calling C code. Please see the Documentation http://cffi.readthedocs.org/ Change-log: 2019/05/19 first verion, 1.12.3 ${TODAY} updated verion with libffi as added dependency, ${VERSION} Current: ${TODAY} updated verion with libffi as added dependency, ${VERSION} EOF ################################################### # Create .dep file # ################################################### cat < ${PACKAGE}-dev.tcz.dep python-cffi.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 sudo chown -R root:staff $TMPDIR/usr/local/tce.installed sudo chmod -R 775 $TMPDIR/usr/local/tce.installed cd /tmp/submit/ mksquashfs $TMPDIR ${PACKAGE}.tcz cd $TMPDIR sudo sh -c "find usr -not -type d > ${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 development extension in temp dir # ################################################### 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 /tmp/submit/ mksquashfs $TMPDIR-dev ${PACKAGE}-dev.tcz cd $TMPDIR-dev sudo sh -c "find usr -not -type d > ${PACKAGE}-dev.tcz.list" sudo mv ../${PACKAGE}-dev.tcz . sudo mv ../${PACKAGE}-dev.tcz.dep . sudo mv ../${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