Artifact
f53dfb3a0fc578d660abf81c95425d3f74ae93b2:
- Executable file
do
— part of check-in
[c7456d90e9]
at
2019-08-22 11:22:10
on branch trunk
— Bump version number
(user:
bernd
size: 2463)
0000: 23 21 2f 62 69 6e 2f 62 61 73 68 0a 0a 65 63 68 #!/bin/bash..ech
0010: 6f 20 22 54 68 69 73 20 73 63 72 69 70 74 20 62 o "This script b
0020: 75 69 6c 64 73 20 6e 65 74 32 6f 20 66 72 6f 6d uilds net2o from
0030: 20 73 63 72 61 74 63 68 22 0a 0a 47 46 4f 52 54 scratch"..GFORT
0040: 48 3d 67 66 6f 72 74 68 2d 30 2e 37 2e 39 5f 32 H=gforth-0.7.9_2
0050: 30 31 39 30 38 32 32 0a 0a 69 66 20 5b 20 22 24 0190822..if [ "$
0060: 28 75 6e 61 6d 65 20 2d 6f 29 22 20 3d 20 22 43 (uname -o)" = "C
0070: 79 67 77 69 6e 22 20 5d 0a 74 68 65 6e 0a 20 20 ygwin" ].then.
0080: 20 20 43 4f 4e 46 4f 50 54 3d 22 2d 2d 70 72 65 CONFOPT="--pre
0090: 66 69 78 3d 2f 75 73 72 20 24 2a 22 0a 65 6c 73 fix=/usr $*".els
00a0: 65 0a 20 20 20 20 43 4f 4e 46 4f 50 54 3d 22 24 e. CONFOPT="$
00b0: 2a 22 0a 66 69 0a 0a 23 20 68 65 6c 70 65 72 20 *".fi..# helper
00c0: 66 75 6e 63 74 69 6f 6e 73 0a 0a 69 66 20 77 68 functions..if wh
00d0: 69 63 68 20 73 75 64 6f 20 3e 2f 64 65 76 2f 6e ich sudo >/dev/n
00e0: 75 6c 6c 0a 74 68 65 6e 0a 20 20 20 20 65 63 68 ull.then. ech
00f0: 6f 20 22 73 75 64 6f 20 61 76 61 69 6c 61 62 6c o "sudo availabl
0100: 65 22 0a 65 6c 73 65 0a 20 20 20 20 69 66 20 77 e".else. if w
0110: 68 69 63 68 20 73 75 20 3e 2f 64 65 76 2f 6e 75 hich su >/dev/nu
0120: 6c 6c 0a 20 20 20 20 74 68 65 6e 0a 09 66 75 6e ll. then..fun
0130: 63 74 69 6f 6e 20 73 75 64 6f 20 7b 0a 20 20 20 ction sudo {.
0140: 20 20 20 20 20 20 20 20 20 73 75 20 2d 2d 63 6f su --co
0150: 6d 6d 61 6e 64 3d 22 24 2a 22 0a 09 7d 0a 20 20 mmand="$*"..}.
0160: 20 20 65 6c 73 65 0a 09 66 75 6e 63 74 69 6f 6e else..function
0170: 20 73 75 64 6f 20 7b 0a 09 20 20 20 20 65 76 61 sudo {.. eva
0180: 6c 20 22 24 40 22 0a 09 7d 0a 20 20 20 20 66 69 l "$@"..}. fi
0190: 0a 20 20 20 20 65 78 70 6f 72 74 20 73 75 64 6f . export sudo
01a0: 0a 66 69 0a 0a 66 75 6e 63 74 69 6f 6e 20 67 69 .fi..function gi
01b0: 74 2d 67 65 74 20 7b 0a 20 20 20 20 65 63 68 6f t-get {. echo
01c0: 20 22 3d 3d 3d 20 67 69 74 20 63 6c 6f 6e 65 20 "=== git clone
01d0: 24 70 75 72 6c 2f 24 70 6e 61 6d 65 2e 67 69 74 $purl/$pname.git
01e0: 20 24 2a 20 3d 3d 3d 22 0a 20 20 20 20 70 75 72 $* ===". pur
01f0: 6c 3d 24 31 0a 20 20 20 20 70 6e 61 6d 65 3d 24 l=$1. pname=$
0200: 32 0a 20 20 20 20 73 68 69 66 74 3b 20 73 68 69 2. shift; shi
0210: 66 74 0a 20 20 20 20 69 66 20 5b 20 2d 64 20 24 ft. if [ -d $
0220: 70 6e 61 6d 65 20 5d 0a 20 20 20 20 74 68 65 6e pname ]. then
0230: 0a 09 28 63 64 20 24 70 6e 61 6d 65 3b 20 67 69 ..(cd $pname; gi
0240: 74 20 70 75 6c 6c 20 2d 66 29 0a 20 20 20 20 65 t pull -f). e
0250: 6c 73 65 0a 09 67 69 74 20 63 6c 6f 6e 65 20 24 lse..git clone $
0260: 70 75 72 6c 2f 24 70 6e 61 6d 65 2e 67 69 74 20 purl/$pname.git
0270: 24 2a 0a 20 20 20 20 66 69 0a 7d 0a 66 75 6e 63 $*. fi.}.func
0280: 74 69 6f 6e 20 62 75 69 6c 64 20 7b 0a 20 20 20 tion build {.
0290: 20 70 6e 61 6d 65 3d 24 31 0a 20 20 20 20 28 63 pname=$1. (c
02a0: 64 20 24 70 6e 61 6d 65 3b 20 2e 2f 61 75 74 6f d $pname; ./auto
02b0: 67 65 6e 2e 73 68 20 26 26 20 2e 2f 63 6f 6e 66 gen.sh && ./conf
02c0: 69 67 75 72 65 20 24 43 4f 4e 46 4f 50 54 20 26 igure $CONFOPT &
02d0: 26 20 6d 61 6b 65 20 26 26 20 73 75 64 6f 20 6d & make && sudo m
02e0: 61 6b 65 20 69 6e 73 74 61 6c 6c 29 0a 7d 0a 66 ake install).}.f
02f0: 75 6e 63 74 69 6f 6e 20 62 75 69 6c 64 2d 63 6c unction build-cl
0300: 65 61 6e 20 7b 0a 20 20 20 20 70 6e 61 6d 65 3d ean {. pname=
0310: 24 31 0a 20 20 20 20 28 63 64 20 24 70 6e 61 6d $1. (cd $pnam
0320: 65 3b 20 2e 2f 61 75 74 6f 67 65 6e 2e 73 68 20 e; ./autogen.sh
0330: 24 43 4f 4e 46 4f 50 54 20 26 26 20 2e 2f 63 6f $CONFOPT && ./co
0340: 6e 66 69 67 75 72 65 20 24 43 4f 4e 46 4f 50 54 nfigure $CONFOPT
0350: 20 26 26 20 6d 61 6b 65 20 63 6c 65 61 6e 20 26 && make clean &
0360: 26 20 6d 61 6b 65 20 26 26 20 73 75 64 6f 20 6d & make && sudo m
0370: 61 6b 65 20 69 6e 73 74 61 6c 6c 29 0a 7d 0a 0a ake install).}..
0380: 23 20 61 73 6b 20 66 6f 72 20 73 75 64 6f 20 70 # ask for sudo p
0390: 61 73 73 77 6f 72 64 0a 0a 65 63 68 6f 20 22 57 assword..echo "W
03a0: 65 27 6c 6c 20 69 6e 73 74 61 6c 6c 20 73 65 76 e'll install sev
03b0: 65 72 61 6c 20 74 68 69 6e 67 73 2c 20 63 61 63 eral things, cac
03c0: 68 69 6e 67 20 72 6f 6f 74 20 70 61 73 73 77 6f hing root passwo
03d0: 72 64 2e 2e 2e 22 0a 73 75 64 6f 20 74 72 75 65 rd...".sudo true
03e0: 0a 0a 23 20 67 65 74 20 6e 65 74 32 6f 20 69 74 ..# get net2o it
03f0: 73 65 6c 66 0a 0a 69 66 20 5b 20 21 20 2d 66 20 self..if [ ! -f
0400: 6e 65 74 32 6f 2e 66 6f 73 73 69 6c 20 5d 0a 74 net2o.fossil ].t
0410: 68 65 6e 0a 20 20 20 20 66 6f 73 73 69 6c 20 63 hen. fossil c
0420: 6c 6f 6e 65 20 68 74 74 70 73 3a 2f 2f 66 6f 73 lone https://fos
0430: 73 69 6c 2e 6e 65 74 32 6f 2e 64 65 2f 6e 65 74 sil.net2o.de/net
0440: 32 6f 20 6e 65 74 32 6f 2e 66 6f 73 73 69 6c 0a 2o net2o.fossil.
0450: 20 20 20 20 66 6f 73 73 69 6c 20 6f 70 65 6e 20 fossil open
0460: 6e 65 74 32 6f 2e 66 6f 73 73 69 6c 0a 65 6c 73 net2o.fossil.els
0470: 65 0a 20 20 20 20 69 66 20 5b 20 21 20 2d 66 20 e. if [ ! -f
0480: 6e 32 6f 2e 66 73 20 5d 0a 20 20 20 20 74 68 65 n2o.fs ]. the
0490: 6e 0a 09 66 6f 73 73 69 6c 20 6f 70 65 6e 20 6e n..fossil open n
04a0: 65 74 32 6f 2e 66 6f 73 73 69 6c 0a 20 20 20 20 et2o.fossil.
04b0: 66 69 0a 20 20 20 20 66 6f 73 73 69 6c 20 75 70 fi. fossil up
04c0: 0a 66 69 0a 0a 23 20 67 65 74 2c 20 62 75 69 6c .fi..# get, buil
04d0: 64 2c 20 61 6e 64 20 69 6e 73 74 61 6c 6c 20 65 d, and install e
04e0: 64 32 35 35 31 39 2d 64 6f 6e 6e 61 2c 20 6b 65 d25519-donna, ke
04f0: 63 63 61 6b 20 61 6e 64 20 74 68 72 65 65 66 69 ccak and threefi
0500: 73 68 0a 0a 67 69 74 2d 67 65 74 20 68 74 74 70 sh..git-get http
0510: 73 3a 2f 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 66 s://github.com/f
0520: 6f 72 74 68 79 34 32 20 65 64 32 35 35 31 39 2d orthy42 ed25519-
0530: 64 6f 6e 6e 61 0a 0a 2e 2f 61 75 74 6f 67 65 6e donna.../autogen
0540: 2e 73 68 0a 0a 6d 61 6b 65 20 63 6f 6e 66 69 67 .sh..make config
0550: 73 0a 6d 61 6b 65 20 6e 6f 2d 63 6f 6e 66 69 67 s.make no-config
0560: 0a 73 75 64 6f 20 6d 61 6b 65 20 69 6e 73 74 61 .sudo make insta
0570: 6c 6c 2d 6c 69 62 73 0a 0a 23 20 67 65 74 2c 20 ll-libs..# get,
0580: 62 75 69 6c 64 2c 20 61 6e 64 20 69 6e 73 74 61 build, and insta
0590: 6c 6c 20 47 66 6f 72 74 68 20 69 66 20 6e 65 65 ll Gforth if nee
05a0: 64 65 64 0a 0a 77 68 69 63 68 20 67 66 6f 72 74 ded..which gfort
05b0: 68 20 31 3e 2f 64 65 76 2f 6e 75 6c 6c 20 32 3e h 1>/dev/null 2>
05c0: 2f 64 65 76 2f 6e 75 6c 6c 20 26 26 20 47 46 3d /dev/null && GF=
05d0: 24 28 67 66 6f 72 74 68 20 2d 2d 76 65 72 73 69 $(gforth --versi
05e0: 6f 6e 20 32 3e 26 31 20 7c 20 63 75 74 20 2d 66 on 2>&1 | cut -f
05f0: 31 2d 32 20 2d 64 27 20 27 20 7c 20 74 72 20 27 1-2 -d' ' | tr '
0600: 20 27 20 27 2d 27 29 0a 28 77 68 69 63 68 20 67 ' '-').(which g
0610: 66 6f 72 74 68 20 31 3e 2f 64 65 76 2f 6e 75 6c forth 1>/dev/nul
0620: 6c 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 20 26 26 l 2>/dev/null &&
0630: 20 74 65 73 74 20 27 21 27 20 22 24 47 46 22 20 test '!' "$GF"
0640: 22 3c 22 20 22 24 47 46 4f 52 54 48 22 29 20 7c "<" "$GFORTH") |
0650: 7c 20 28 0a 20 20 20 20 77 67 65 74 20 2d 63 20 | (. wget -c
0660: 68 74 74 70 3a 2f 2f 77 77 77 2e 63 6f 6d 70 6c http://www.compl
0670: 61 6e 67 2e 74 75 77 69 65 6e 2e 61 63 2e 61 74 ang.tuwien.ac.at
0680: 2f 66 6f 72 74 68 2f 67 66 6f 72 74 68 2f 53 6e /forth/gforth/Sn
0690: 61 70 73 68 6f 74 73 2f 24 7b 47 46 4f 52 54 48 apshots/${GFORTH
06a0: 23 67 66 6f 72 74 68 2d 7d 2f 24 47 46 4f 52 54 #gforth-}/$GFORT
06b0: 48 2e 74 61 72 2e 78 7a 0a 20 20 20 20 74 61 72 H.tar.xz. tar
06c0: 20 4a 78 66 20 24 47 46 4f 52 54 48 2e 74 61 72 Jxf $GFORTH.tar
06d0: 2e 78 7a 0a 20 20 20 20 69 66 20 73 77 69 67 20 .xz. if swig
06e0: 2d 66 6f 72 74 68 20 24 47 46 4f 52 54 48 2f 75 -forth $GFORTH/u
06f0: 6e 69 78 2f 74 65 73 74 2e 69 0a 20 20 20 20 74 nix/test.i. t
0700: 68 65 6e 0a 09 65 63 68 6f 20 22 41 20 46 6f 72 hen..echo "A For
0710: 74 68 2d 63 61 70 61 62 6c 65 20 73 77 69 67 20 th-capable swig
0720: 69 73 20 66 6f 75 6e 64 2c 20 65 76 65 72 79 74 is found, everyt
0730: 68 69 6e 67 20 66 69 6e 65 22 0a 20 20 20 20 65 hing fine". e
0740: 6c 73 65 0a 09 65 63 68 6f 20 22 42 75 69 6c 64 lse..echo "Build
0750: 20 61 20 46 6f 72 74 68 2d 63 61 70 61 62 6c 65 a Forth-capable
0760: 20 73 77 69 67 22 0a 09 67 69 74 2d 67 65 74 20 swig"..git-get
0770: 68 74 74 70 73 3a 2f 2f 67 69 74 68 75 62 2e 63 https://github.c
0780: 6f 6d 2f 47 65 72 61 6c 64 57 6f 64 6e 69 20 73 om/GeraldWodni s
0790: 77 69 67 0a 09 62 75 69 6c 64 20 73 77 69 67 0a wig..build swig.
07a0: 20 20 20 20 66 69 0a 20 20 20 20 62 75 69 6c 64 fi. build
07b0: 20 24 47 46 4f 52 54 48 0a 29 0a 0a 23 20 63 6c $GFORTH.)..# cl
07c0: 65 61 6e 20 75 70 20 73 65 74 20 74 6f 20 72 6f ean up set to ro
07d0: 6f 74 20 73 74 75 66 66 0a 73 75 64 6f 20 63 68 ot stuff.sudo ch
07e0: 6f 77 6e 20 2d 52 20 22 24 28 77 68 6f 61 6d 69 own -R "$(whoami
07f0: 29 22 20 7e 2f 2e 67 66 6f 72 74 68 20 2e 0a 0a )" ~/.gforth ...
0800: 23 20 6d 61 6b 65 20 73 75 72 65 20 6c 69 62 72 # make sure libr
0810: 61 72 69 65 73 20 61 72 65 20 66 6f 75 6e 64 0a aries are found.
0820: 74 65 73 74 20 22 24 28 75 6e 61 6d 65 20 2d 6f test "$(uname -o
0830: 29 22 20 3d 20 22 43 79 67 77 69 6e 22 20 7c 7c )" = "Cygwin" ||
0840: 20 73 75 64 6f 20 2f 73 62 69 6e 2f 6c 64 63 6f sudo /sbin/ldco
0850: 6e 66 69 67 0a 0a 23 20 77 65 20 74 65 73 74 20 nfig..# we test
0860: 66 6f 72 20 61 6e 20 65 78 69 73 74 69 6e 67 20 for an existing
0870: 47 66 6f 72 74 68 20 74 68 61 74 20 63 61 6e 20 Gforth that can
0880: 6c 6f 61 64 20 6e 65 74 32 6f 2e 66 73 0a 23 20 load net2o.fs.#
0890: 69 66 20 74 68 65 20 73 6e 61 70 73 68 6f 74 20 if the snapshot
08a0: 64 6f 65 73 6e 27 74 2c 20 74 72 79 20 74 68 65 doesn't, try the
08b0: 20 67 69 74 20 76 65 72 73 69 6f 6e 0a 0a 67 66 git version..gf
08c0: 6f 72 74 68 2d 66 61 73 74 20 6e 32 6f 2e 66 73 orth-fast n2o.fs
08d0: 20 2d 65 20 62 79 65 20 31 3e 2f 64 65 76 2f 6e -e bye 1>/dev/n
08e0: 75 6c 6c 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 20 ull 2>/dev/null
08f0: 7c 7c 20 28 0a 20 20 20 20 67 69 74 2d 67 65 74 || (. git-get
0900: 20 67 69 74 3a 2f 2f 67 69 74 2e 73 61 76 61 6e git://git.savan
0910: 6e 61 68 2e 67 6e 75 2e 6f 72 67 20 67 66 6f 72 nah.gnu.org gfor
0920: 74 68 0a 20 20 20 20 62 75 69 6c 64 2d 63 6c 65 th. build-cle
0930: 61 6e 20 67 66 6f 72 74 68 0a 29 0a 0a 2e 2f 63 an gforth.).../c
0940: 6f 6e 66 69 67 75 72 65 20 23 20 72 65 63 6f 6e onfigure # recon
0950: 66 69 67 75 72 65 2c 20 61 73 20 77 65 20 6e 6f figure, as we no
0960: 77 20 68 61 76 65 20 61 20 77 6f 72 6b 69 6e 67 w have a working
0970: 20 47 66 6f 72 74 68 0a 6d 61 6b 65 20 6c 69 62 Gforth.make lib
0980: 63 63 0a 73 75 64 6f 20 6d 61 6b 65 20 69 6e 73 cc.sudo make ins
0990: 74 61 6c 6c 0a 6d 61 6b 65 20 54 41 47 53 0a tall.make TAGS.