1 | #!/bin/sh |
---|
2 | |
---|
3 | PWD=`pwd` |
---|
4 | BRANCH="spielwiese" |
---|
5 | CFGOPTIONS="--with-gmp=yes" |
---|
6 | MKOPTIONS="-j9" |
---|
7 | # tempdir (absolute path!) |
---|
8 | SW="$PWD/SW" |
---|
9 | |
---|
10 | # we try to use log instead of consequent --quiet |
---|
11 | LOG="$PWD/`date`.log" |
---|
12 | |
---|
13 | # log or no log? |
---|
14 | echo >> $LOG || LOG="/dev/null" |
---|
15 | |
---|
16 | echo "DATE: `date`" >> $LOG |
---|
17 | |
---|
18 | CleanUp() |
---|
19 | { |
---|
20 | echo "Deleting tempdir: $SW" >> $LOG |
---|
21 | rm -f -R $SW 1>> $LOG 2>&1 |
---|
22 | } |
---|
23 | |
---|
24 | Build() |
---|
25 | { |
---|
26 | echo "Generating configure... " >> $LOG |
---|
27 | ./for_Hans_with_love.sh 1>> $LOG 2>&1 || { echo "Error: cannot run 'for_Hans_with_love.sh'" >> $LOG; CleanUp; exit 1; } |
---|
28 | |
---|
29 | [ -f ./configure ] || { echo "Error: cannot find './configure'" >> $LOG; return 1; } |
---|
30 | |
---|
31 | echo "Running './configure \"$CFGOPTIONS\" \"$@\"'... " >> $LOG |
---|
32 | ./configure "$CFGOPTIONS" "$@" 1>> $LOG 2>&1 || { echo "Error: could not run './configure \"$CFGOPTIONS\" \"$@\"'" >> $LOG; return 1; } |
---|
33 | |
---|
34 | echo "Making... " >> $LOG |
---|
35 | make "$MKOPTIONS" 1>> $LOG 2>&1 || { echo "Error: could not run 'make \"$MKOPTIONS\"'"5 >> $LOG; return 1; } |
---|
36 | } |
---|
37 | |
---|
38 | Check() |
---|
39 | { |
---|
40 | echo "Checking... " >> $LOG |
---|
41 | make -k -i check 1>> $LOG 2>&1 |
---|
42 | |
---|
43 | echo "Test Result: $?" >> $LOG |
---|
44 | |
---|
45 | [ -x libpolys/tests ] && { echo "The content of the test directory: " >> $LOG; ls -la libpolys/tests 1>> $LOG 2>&1; } |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | Reset() |
---|
50 | { |
---|
51 | echo "git reset/clean to the untouched state... " >> $LOG |
---|
52 | git reset --hard HEAD 1>> $LOG 2>&1 || echo "Error: could not git reset to HEAD..." >> $LOG |
---|
53 | git clean -f -d -x 1>> $LOG 2>&1 || echo "Error: could not git clean..." >> $LOG |
---|
54 | |
---|
55 | ## #should be VERY clean now... |
---|
56 | ## git status -uall >> $LOG |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | echo "Creating empty tempdir: $SW" >> $LOG |
---|
61 | [ -d $SW ] && { echo "Error: $SW exists... cleaning up..." >> $LOG; CleanUp; } |
---|
62 | |
---|
63 | mkdir -p $SW || { echo "Error: cannot create tempdir: $SW" >> $LOG; exit 1; } |
---|
64 | |
---|
65 | [ -d $SW ] || { echo "Error: cannot find tempdir '$SW'" >> $LOG; CleanUp; exit 1; } |
---|
66 | [ ! -x $SW ] && { chmod u+rwx $SW 1>> $LOG 2>&1 || { echo "Error: cannot set rxw permissions for $SW" >> $LOG; exit 1; }; } |
---|
67 | |
---|
68 | echo "Clonning... " >> $LOG |
---|
69 | git clone -v -b $BRANCH --depth 1 -- git://git.berlios.de/singular $SW 1>> $LOG 2>&1 || { echo "Error: cannot git clone..." >> $LOG; CleanUp; exit 1; } |
---|
70 | |
---|
71 | cd $SW || { echo "Error: cannot cd to the tempdir: $SW" >> $LOG; CleanUp; exit 1; } |
---|
72 | |
---|
73 | # latest commit? |
---|
74 | git log -1 HEAD >> $LOG |
---|
75 | |
---|
76 | [ -x ./for_Hans_with_love.sh ] || { echo "Error: cannot find './for_Hans_with_love.sh '" >> $LOG; CleanUp; exit 1; } |
---|
77 | |
---|
78 | |
---|
79 | # test two cases dynamic & static: |
---|
80 | # --enable-p-procs-static Enable statically compiled p_Procs-modules |
---|
81 | # --enable-p-procs-dynamic Enable dynamically compiled p_Procs-modules |
---|
82 | |
---|
83 | echo "Trying static version... " >> $LOG |
---|
84 | Build "--enable-p-procs-static" || { echo "Error: could not build with '--enable-p-procs-static'" >> $LOG; } && Check |
---|
85 | |
---|
86 | # return git repo to the untouched state: |
---|
87 | Reset |
---|
88 | |
---|
89 | echo "Trying dynamic version... " >> $LOG |
---|
90 | Build "--enable-p-procs-dynamic" || { echo "Error: could not build with '--enable-p-procs-dynamic'" >> $LOG; } && Check |
---|
91 | |
---|
92 | cd - || { CleanUp; exit 1; } |
---|
93 | |
---|
94 | CleanUp && exit 0 || exit 1 |
---|