All pastes #735409 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-10-13 16:22 UTC
rendered paste body
#!/bin/sh
#
# compile.sh
#
# Search for all SlackBuilds under slackware-$VERSION/source
# and change the CFLAGS/CXXFLAGS
#
# You can get information about your specific CPU with
# cat /proc/cpuinfo
# and then have a look at http://gentoo-wiki.com/Safe_Cflags
#
# TODO: get newest gcc to compile with...
#       upgrade to newer packages?
#       newer kernel
#       iso/dvd image
#       CHOST einbauen
# different styles:
# 1: > grep -v??? > löschen oder ersetzen?
# if [ "$ARCH" = "i386" ]; then
#  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
#elif [ "$ARCH" = "i486" ]; then
#  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
#elif [ "$ARCH" = "s390" ]; then
#  SLKCFLAGS="-O2"
#elif [ "$ARCH" = "x86_64" ]; then
#  SLKCFLAGS="-O2"
#fi
#
# 2:
#ARCH=${ARCH:-i486}
#
# 3: no ./configure
#
# 4: no ARCH
#
# 5: no CFLAGS with ./configure

##
# variables
##

CWD=`pwd`

CHOST="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

VERSION=12.0
SRCDIR=/source
SLOCATEDB=tmp.db
SLACKBUILDDB=sb.db

##
# create slocate db and search for all slackbuilds
##
#slocate -U $CWD/slackware-$VERSION/source -l 0 -o $SLOCATEDB
#slocate -d $SLOCATEDB SlackBuild >$SLACKBUILDDB
#rm -f $SLOCATEDB
slocate -U $CWD/source -l 0 -o $SLOCATEDB
slocate -d $SLOCATEDB SlackBuild >$SLACKBUILDDB


##
# ersetzen der arch zeile für pkg
##
STRING='ARCH=${ARCH:-i486}'
REPLACE='ARCH=${ARCH:-i686}'

for item in `slocate -d $SLOCATEDB SlackBuild`
do
 sed -e s/$STRING/$REPLACE/g < $item > $item.tmp || exit 1
 mv $item.tmp $item
done

##
# ersetzen von if...
##
STRING2='if [ "$ARCH" = "i386" ]; then'
REPLACE2='if [ "$ARCH" = "i686" ]; then'
> HIER krieg ich immer den fuck fehler: sed: -e expression #1, char 4: unterminated `s' command
> bzw. mittlerweile tut er garnichts mehr.. er arbeitet alles ohne fehler ab

for item in `slocate -d $SLOCATEDB SlackBuild`
do
 sed -e 's/$STRING2/$REPLACE2/g' < $item > $item.tmp
 mv $item.tmp $item
done

#STRING='  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"'
#REPLACE='  SLKCFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"'

#for item in `slocate -d $SLOCATEDB SlackBuild`
#do
# sed -e s/$STRING/$REPLACE/g < $item > $item.tmp || exit 1
# mv $item.tmp $item
#done

##
# ersetzen von ./configure
##
#STRING='CFLAGS="$SLKCFLAGS" \'
#REPLACE='CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" \'

#for item in `slocate -d $SLOCATEDB SlackBuild`
#do
# sed -e s/$STRING/$REPLACE/g < $item > $item.tmp || exit 1
# mv $item.tmp $item
#done