]>
Commit | Line | Data |
---|---|---|
3148fdf1 | 1 | #!/bin/sh |
bea1ee2e | 2 | # |
ef57eb7b | 3 | ## Copyright (C) 1996-2016 The Squid Software Foundation and contributors |
4e0938ef AJ |
4 | ## |
5 | ## Squid software is distributed under GPLv2+ license and includes | |
6 | ## contributions from numerous individuals and organizations. | |
7 | ## Please see the COPYING and CONTRIBUTORS files for details. | |
8 | ## | |
9 | ||
bea1ee2e AJ |
10 | # Configure and run a test build against any given set of configure options |
11 | # or compile-time flags. | |
12 | # | |
13 | # Should be run from the source package root directory with paths relative to there. | |
14 | # | |
15 | ||
bc3d3d8c AJ |
16 | config="${1}" |
17 | base="`dirname ${0}`" | |
bea1ee2e | 18 | |
8182d08a FC |
19 | # cache_file may be set by environment variable |
20 | configcache="" | |
21 | if [ -n "$cache_file" ]; then | |
22 | configcache="--cache-file=$cache_file" | |
23 | fi | |
24 | ||
16c198db | 25 | #if we are on Linux, let's try parallelizing |
b890da41 | 26 | if [ -z "$pjobs" -a -e /proc/cpuinfo ]; then |
16c198db | 27 | ncpus=`grep '^processor' /proc/cpuinfo | tail -1|awk '{print $3}'` |
bc3d3d8c AJ |
28 | ncpus=`expr ${ncpus} + 1` |
29 | pjobs="-j${ncpus}" | |
16c198db | 30 | fi |
b890da41 FC |
31 | #if we are on FreeBSD, let's try parallelizing |
32 | if [ -z "$pjobs" -a -x /sbin/sysctl ]; then | |
33 | ncpus=`sysctl kern.smp.cpus | cut -f2 -d" "` | |
ff2167f5 | 34 | if [ $? -eq 0 -a -n "$ncpus" -a "$ncpus" -gt 1 ]; then |
b890da41 FC |
35 | pjobs="-j${ncpus}" |
36 | fi | |
37 | fi | |
16c198db | 38 | |
bc3d3d8c AJ |
39 | if test -e ${config} ; then |
40 | echo "BUILD: ${config}" | |
41 | . ${config} | |
bea1ee2e | 42 | else |
bc3d3d8c AJ |
43 | echo -n "BUILD ERROR: Unable to locate test configuration '${config}' from " && pwd |
44 | exit 1; | |
bea1ee2e AJ |
45 | fi |
46 | ||
47 | # | |
48 | # empty all the existing code, reconfigure and builds test code | |
e6f9e7b9 | 49 | # but skip if we have no files to remove. |
e6f9e7b9 | 50 | FILECOUNT=`ls -1 | grep -c .` |
bc3d3d8c | 51 | if test "${FILECOUNT}" != "0" ; then |
b01023dc | 52 | ${MAKE:-make} -k distclean || echo "distclean done. errors are unwanted but okay here." |
0039f2b3 AJ |
53 | ls -la . |
54 | rm -fr ./src/fs/aufs/.deps src/fs/diskd/.deps | |
e6f9e7b9 | 55 | fi |
bea1ee2e AJ |
56 | |
57 | # | |
58 | # above command currently encounters dependancy problems on cleanup. | |
59 | # | |
701fabcc | 60 | # do not build any of the install's ... |
4fe75473 FC |
61 | # |
62 | # eval is need to correctly handle quoted arguments | |
a3abddfd | 63 | eval "$base/../configure ${DISTCHECK_CONFIGURE_FLAGS} ${configcache}" \ |
4fe75473 | 64 | 2>&1 && \ |
b01023dc | 65 | ${MAKE:-make} ${pjobs} ${MAKETEST} 2>&1 |
bea1ee2e | 66 | |
701fabcc AR |
67 | # Remember and then explicitly return the result of the last command |
68 | # to the script caller. Probably not needed on most or all platforms. | |
69 | result=$? | |
70 | exit ${result} |