forked from souffle-lang/souffle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.souffle-sh
131 lines (111 loc) · 3.33 KB
/
.souffle-sh
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
#!/bin/bash
#
# > .souffle_sh
#
# A quick and dirty bash script for developing souffle.
#
export SOUFFLE=$(pwd)
alias souffle=$SOUFFLE/src/souffle
alias souffle-profile=$SOUFFLE/src/souffle-profile
souffle_help() {
cat << EOF
> .souffle-sh
A quick and dirty bash script for developing souffle.
souffle Alias for souffle executable.
souffle-profile Alias for souffle-profile executable.
souffle_ubuntu Install all packages required by souffle for Ubuntu.
souffle_setup Fetch branches and tags, if no executable is found, run bootstrap, configure, and make.
souffle_make Run souffle_setup and then make.
souffle_reset Reset hard to last commit, delete untracked files, run souffle_setup.
souffle_commit Format with clang, repair permissions, add everything to git and commit.
souffle_format Format codebase with clang, according to .clang-format file.
souffle_push Push the current branch to the git remote.
souffle_pull Pull the current branch from the git remote.
souffle_test Run souffle_make and then the testsuite on the given tests.
souffle_debug Run souffle_make and then the test in directory \$SOUFFLE/\$1/\$2.
EOF
}
souffle_ubuntu() {
sudo apt-get update && \
sudo apt-get upgrade && \
sudo apt-get install $(echo $( \
cat README.md | \
grep "apt-get install" | \
sed 's/^.*apt-get install//g'));
}
souffle_setup() {
cd $SOUFFLE && \
git fetch origin && \
git fetch origin --tags && \
git fetch upstream && \
git fetch upstream --tags && \
if [ ! -e src/souffle ]
then
chmod 775 bootstrap && \
./bootstrap && \
chmod 775 configure && \
./configure
fi && \
cd -
}
souffle_make() {
souffle_setup && \
cd $SOUFFLE && \
make -j8 && \
cd -
}
souffle_reset() {
cd $SOUFFLE && \
git reset --hard HEAD && \
git clean -xdf && \
souffle_setup && \
cd -
}
souffle_format() {
cd $SOUFFLE && \
clang-format-3.8 -i -style=file \
$SOUFFLE/src/*.cpp \
$SOUFFLE/src/*.h \
$SOUFFLE/src/test/*.cpp \
$SOUFFLE/src/test/*.h && \
cd -
}
souffle_commit() {
cd $SOUFFLE && \
souffle_format && \
git checkout upstream/master -- src/mcpp*.[chCH] && \
chmod 775 bootstrap .travis/* debian/rules osx/preinstall && \
git add . && \
git commit -m "$(date)" && \
cd -
}
souffle_push() {
souffle_commit && \
cd $SOUFFLE && \
git push origin $(git branch | grep \* | sed 's/^\*\s//g') && \
cd -
}
souffle_pull() {
cd $SOUFFLE && \
git pull origin $(git branch | grep \* | sed 's/^\*\s//g') && \
cd -
}
souffle_test() {
souffle_make && \
cd $SOUFFLE/tests && \
./testsuite -j8 $@ && \
cd -
}
souffle_debug() {
souffle_make && \
mkdir -p $SOUFFLE/tests/testsuite.dir/$1/$2 && \
ln -sf $SOUFFLE/tests/$1/$2/$2.dl $SOUFFLE/tests/testsuite.dir/$1/$2/$2.dl && \
$SOUFFLE/src/souffle $SOUFFLE/tests/$1/$2/$2.dl \
-F $SOUFFLE/tests/$1/$2/facts \
-D $SOUFFLE/tests/testsuite.dir/$1/$2 \
-j8 \
--debug-report=$SOUFFLE/tests/testsuite.dir/$1/$2/$2.html \
$3 \
1> $SOUFFLE/tests/testsuite.dir/$1/$2/$2.out \
2> $SOUFFLE/tests/testsuite.dir/$1/$2/$2.err
}