File: recompile-bash

package info (click to toggle)
firebuild 0.8.6-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 2,624 kB
  • sloc: cpp: 14,301; ansic: 6,429; python: 2,401; sh: 262; makefile: 40; awk: 33
file content (29 lines) | stat: -rw-r--r-- 1,077 bytes parent folder | download
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
#!/bin/sh

set -e

echo debconf firebuild/license-accepted select true | debconf-set-selections
apt-get -yqq install firebuild
firebuild --version

for i in 1 2; do
    rm -rf bash-*
    apt-get source bash 2>&1
    apt-get -yqq build-dep bash
    (cd bash-* && /usr/bin/time -f "real${i}=%e\nuser${i}=%U\nsys${i}=%S" -a --output=../time.log firebuild -s -- sh -c "make -f debian/rules bash-configure && make -j4 -f debian/rules bash-build")
done
echo "Build times:"
cat time.log
# ./configure is harder to accelerate, but the second run should still be at least 80% faster
CPU_TIME_PERCENT2=$( (cat time.log ; echo "(user2+sys2)*100/(user1+sys1)") | bc)
echo "CPU time of the second build was ${CPU_TIME_PERCENT2}% of the first build"
case $(dpkg-architecture -q DEB_HOST_ARCH) in
    armel)
        # armel results typically just below 20%, while the hit rate is similar to other architectures'
        [ $CPU_TIME_PERCENT2 -lt 30 ]
        ;;
    *)
        # 2nd builds are typically just below 10% of the first builds
        [ $CPU_TIME_PERCENT2 -lt 20 ]
        ;;
esac