1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
#!/bin/sh
#
# Rebuild core libraries and QA apps in a git tree ...
# - run configure the same way Makepkgs does [not with -q]
# - turn off gcc optimization so gdb has a better chance
# (be aware that this may hide gcc optimizations in the real
# package builds)
# - make clean [not with -q]
# - make and install libraries over the installed libraries
# (if any)
# - build enough libraries so "make" in the qa directory works
# - using gdb for apps outside the qa directory should work well
# once those apps are rebuilt
#
tmp=/var/tmp/$$
sts=1 # failure is the default until the end
trap "rm -f $tmp.*; exit \$sts" 0 1 2 3 15
if [ ! -d .git ]
then
echo "Error: need to be at the top of the git tree, bozo!"
exit
fi
quick=false
while [ $# -gt 0 ]
do
case "$1"
in
-q)
quick=true
shift
;;
*)
echo "Error: no clue about arg \"$1\""
exit
;;
esac
done
# configure unless -q
#
if $quick
then
:
else
# -q here so we don't build after configure ... all the building
# is prescriptive in this script in the following sections
#
if qa/admin/myconfigure -q
then
:
else
echo "Error: myconfigure -q failed"
exit
fi
fi
if [ -f src/include/pcp.conf ]
then
. src/include/pcp.conf
else
echo "Error: myconfigure failed to make src/include/pcp.conf"
exit
fi
if [ -z "$PCP_MAKE_PROG" ]
then
echo "Error: myconfigure failed to set \$PCP_MAKE_PROG"
exit
fi
echo "Disable gcc optimization ..."
sed -e '/CFLAGS_OPT/s/-O2/-O0/' src/include/builddefs >$tmp.out
if diff src/include/builddefs $tmp.out >/dev/null
then
echo "Warning: failed to change CFLAGS_OPTS from -O2 to -O0"
grep CFLAGS_OPT src/include/builddefs
else
sudo cp $tmp.out src/include/builddefs
fi
# others that could be added to the list below ...
# src/libapp src/libpcp_qed src/libpcp_qwt
#
here=`pwd`
for dir in src/include src/libpcp src/libpcp_static src/libpcp_pmda \
src/pmcpp src/pmns \
src/newhelp \
src/libpcp_pmcd src/libpcp_gui \
src/libpcp_mmv src/libpcp_web src/libpcp_import src/libpcp_trace \
src/libpcp_qmc src/libpcp_fault
do
if [ ! -d "$dir" ]
then
echo "Arrgh! dir \"$dir\" does not exist"
exit
fi
echo "=== $dir ==="
cd $dir
[ -d src ] && cd src
# make clean except for -q
#
if $quick
then
:
else
case "$dir"
in
src/include|src/pmns)
;;
*)
$PCP_MAKE_PROG clean
;;
esac
fi
# make, then for libs sudo make install
#
if $PCP_MAKE_PROG
then
case "$dir"
in
src/lib*)
if sudo $PCP_MAKE_PROG install
then
:
else
echo "Error: sudo make install failed in `pwd`!"
exit
fi
;;
esac
else
echo "Error: make failed in `pwd`!"
exit
fi
cd $here
done
echo "=== qa ==="
if [ ! -d qa ]
then
echo "Arrgh! dir \"qa\" does not exist"
exit
fi
cd qa
if [ ! -d src ]
then
echo "Arrgh! dir \"qa/src\" does not exist"
exit
fi
cd src
$PCP_MAKE_PROG clean-exec
cd ..
if $PCP_MAKE_PROG
then
:
else
echo "Error: make failed!"
exit
fi
# success
#
sts=0
|