#!/bin/bash # # Build a package with debug symbols in it, optionally overriding the # optimization level. # rpm=rpm rpmlib=/usr/lib/rpm rpmarch=`rpm --eval "%_arch"` optflags=`awk "/^optflags: $rpmarch/"'{$1="";$2="";print $0 }' $rpmlib/rpmrc` while [ $# -gt 0 ] ; do case $1 in -O*|-f|-g*) # Command line flag we interpret as an optflag. opts="$opts $1" ;; --rebuild|-b*|-t*) # Command line flag we interpret as an rpmbuild option. rpm="rpmbuild $1" ;; *) # Command line flag we interpret as the package name. packages="$packages $1" ;; esac shift done $rpm --define "__strip :" \ --define "__os_install_post $rpmlib/brp-compress" \ --define "optflags $optflags -g3 $opts" \ $packages