-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdo
115 lines (95 loc) · 2.36 KB
/
do
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
#!/bin/bash
echo "This script builds net2o from scratch"
GFORTH=gforth-0.7.9_20250305
if [ "$(uname -o)" = "Cygwin" ]
then
CONFOPT="--prefix=/usr $*"
else
CONFOPT="$*"
fi
# helper functions
if which sudo >/dev/null
then
echo "sudo available"
else
if which su >/dev/null
then
function sudo {
su --command="$*"
}
else
function sudo {
eval "$@"
}
fi
export sudo
fi
function git-get {
echo "=== git clone $purl/$pname.git $* ==="
purl=$1
pname=$2
shift; shift
if [ -d $pname ]
then
(cd $pname; git pull -f)
else
git clone $purl/$pname.git $*
fi
}
function build {
pname=$1
(cd $pname; ./autogen.sh && ./configure $CONFOPT && make && sudo make install)
}
function build-clean {
pname=$1
(cd $pname; ./autogen.sh $CONFOPT && ./configure $CONFOPT && make clean && make && sudo make install)
}
# ask for sudo password
echo "We'll install several things, caching root password..."
sudo true
# get net2o itself
if [ ! -f net2o.fossil ]
then
fossil clone https://fossil.net2o.de/net2o net2o.fossil
fossil open net2o.fossil
else
if [ ! -f n2o.fs ]
then
fossil open net2o.fossil
fi
fossil up
fi
# get, build, and install ed25519-donna, keccak and threefish
./autogen.sh
make configs
make no-config
sudo make install-libs
# get, build, and install Gforth if needed
which gforth 1>/dev/null 2>/dev/null && GF=$(gforth --version 2>&1 | cut -f1-2 -d' ' | tr ' ' '-')
(which gforth 1>/dev/null 2>/dev/null && test '!' "$GF" "<" "$GFORTH") || (
wget -c http://www.complang.tuwien.ac.at/forth/gforth/Snapshots/${GFORTH#gforth-}/$GFORTH.tar.xz
tar Jxf $GFORTH.tar.xz
if swig -forth $GFORTH/unix/test.i
then
echo "A Forth-capable swig is found, everything fine"
else
echo "Build a Forth-capable swig"
git-get https://github.com/GeraldWodni swig
build swig
fi
build $GFORTH
)
# clean up set to root stuff
sudo chown -R "$(whoami)" ~/.gforth .
# make sure libraries are found
test "$(uname -o)" = "Cygwin" || sudo /sbin/ldconfig
# we test for an existing Gforth that can load net2o.fs
# if the snapshot doesn't, try the git version
gforth-fast n2o.fs -e bye 1>/dev/null 2>/dev/null || (
git-get git://git.savannah.gnu.org gforth
build-clean gforth
)
./configure # reconfigure, as we now have a working Gforth
make libcc
sudo make install
make TAGS