#!/bin/bash # read the CFLAGS line from a debian rules file and prune out unneeded stuff and do corrections FOUND_LINE=0 while read LINE ; do (( LINE_COUNT++ )) CHUNK=$LINE #echo $LINE if [[ $(echo $CHUNK |grep "./configure" ) != "" ]] && [[ $FOUND_LINE -eq 0 ]] ; then # the configure options are everything to the right of ./configure CHUNK=${CHUNK#*./configure} # remove the --host stuff CHUNK=${CHUNK/--host=/} CHUNK=${CHUNK/\$\(DEB_HOST_GNU_TYPE\)/} # remove the --host stuff CHUNK=${CHUNK/--build=/} CHUNK=${CHUNK/\$\(DEB_BUILD_GNU_TYPE\)/} # remove the --prefix stuff CHUNK=${CHUNK/--prefix=/} # if --prefix was hard coded above then it still remains (/usr) # so skip to the next '--'option to the right CHUNK=--${CHUNK#*--} # substitute these debian options with slackware defaults CHUNK=${CHUNK/usr\/share\/info/usr\/info} CHUNK=${CHUNK/usr\/share\/man/usr\/man} CHUNK=${CHUNK/usr\/share\/doc/usr\/doc} echo $CHUNK FOUND_LINE=1 fi done