#!/bin/sh [ `id -u` != 0 ] && { echo "fail"; exit 1; } export CFLAGS="-march=i486 -mtune=i686 -Os -pipe" export CXXFLAGS="-march=i486 -mtune=i686 -Os -pipe -fno-exceptions -fno-rtti" export CPPFLAGS="-I/usr/local/include" export LDFLAGS="-L/usr/local/lib" export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig mirror="http://www.ibiblio.org/pub/linux/games/amusements/fortune/" basename="fortune-mod" sep="-" version="9708" description="Fortune (TESTING)" author="Denis L. Clarke, Amy A. Lewis, Ken Arnold" license="BSD" homepage=${mirror} extensionby="Kingdomcome" comments="The famous fortune program\n\t\t\tAdd \"/usr/local/bin/fortune\" to ~/.ashrc\n\t\t\tto have a fortune displayed in new shells" ppicompat="\n\n\t\t\tThis extension is PPI compatible" date=`date +%Y/%m/%d` tce="tce" tcz="tcz" compiledeps="compiletc.tce advcomp.tce cramfs-utils.tce" #eval ${tce}deps="" #eval ${tcz}deps="" #builddeps="" #writeables="" #flags="" editMake='sed -i -e s_/usr/local/games_/usr/local/bin_ -e s_/usr/local/share/_/usr/local/_ Makefile' #postinstall='#!/bin/sh\n\n' ## prepare environment for i in ${compiledeps} ${builddeps}; do su - tc -c "tce-load ${i} wget install"; done mkdir -p ${basename}/tmp/package/ && cd ${basename}/ pwd=`pwd` #download and extract source wget ${mirror}${basename}${sep}${version}.tar.gz && tar xzf ${basename}${sep}${version}.tar.gz cd ${basename}${sep}${version}/ ## build, locate and strip package if [ "${flags}" ]; then ./configure ${flags} else ${editMake} fi make touch /tmp/mark sleep 2 make DESTDIR=${pwd}/tmp/package install sleep 3 if [ "$(ls -A ${pwd}/tmp/package/)" ]; then rm /tmp/mark fi if [ -e /tmp/mark ]; then cd / else cd ${pwd}/tmp/package/ fi find usr/local/ | xargs file | grep "executable" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find usr/local/ | xargs file | grep "shared object" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip -g 2> /dev/null ## remove build files, docs and create post-install script rm -rf ${pwd}/${basename}${sep}${version}/ ${pwd}/${basename}${sep}${version}.tar.gz rm -rf usr/local/man/ if [ "${postinstall}" ]; then mkdir usr/local/tce.installed/ echo -e "${postinstall}" > usr/local/tce.installed/${basename} chmod 755 usr/local/tce.installed/${basename} fi ## create tce if [ -e /tmp/mark ]; then find usr -newer /tmp/mark -not -type d > ${pwd}/${basename}.${tce}.list else find usr -not -type d > ${pwd}/${basename}.${tce}.list fi tar czvf ${pwd}/${basename}.${tce} --numeric-owner -T ${pwd}/${basename}.${tce}.list advdef -z4 ${pwd}/${basename}.${tce} ## create tcz if [ -e /tmp/mark ]; then cd ${pwd}/tmp/package && tar xzf ${pwd}/${basename}.${tce} fi if [ "${writables}" ]; then [ -e ../rwfiles.list ] && rm -f ../rwfiles.list for files in ${writeables}; do find usr -not -type d -name ${files} >> ../rwfiles.list; done tar czvf user.tar.gz --numeric-owner -T ../rwfiles.list && advdef -z4 user.tar.gz for files in `cat ../rwfiles.list`; do rm -f ${files}; done rm -f ../rwfiles.list fi mkfs.cramfs ./ ${pwd}/${basename}.${tcz} cp ${pwd}/${basename}.${tce}.list ${pwd}/${basename}.${tcz}.list ## md5, dep, and info files for ext in ${tce} ${tcz}; do md5sum ${pwd}/${basename}.${ext} > ${pwd}/${basename}.${ext}.md5.txt eval deps=\${${ext}deps} if [ "${deps}" ]; then for files in ${deps}; do echo ${files} >> ${pwd}/${basename}.${ext}.dep; done fi eval ${tce}comments="'${comments}${ppicompat}'" eval ${tcz}comments="'${comments}'" eval thecomments=\${${ext}comments} echo -e "Title:\t\t\t${basename}.${ext}\nDescription:\t\t${description}\nVersion:\t\t${version}\nAuthor:\t\t\t${author}" > ${pwd}/${basename}.${ext}.info echo -en "Original-site:\t\t${homepage}\nCopying-policy:\t\t${license}\nSize:\t\t\t" >> ${pwd}/${basename}.${ext}.info du -sh ${pwd}/${basename}.${ext} | cut -f 1 >> ${pwd}/${basename}.${ext}.info echo -e "Extension_by:\t\t${extensionby}\nComments:\t\t${thecomments}\nChange-log:\t\t----\nCurrent:\t\t${date} First Version" >> ${pwd}/${basename}.${ext}.info done ## clean up package files rm -rf ${pwd}/tmp/ /tmp/mark && echo "Everything is in ${basename}/" exit 0