bootstrap: swap around downloaders, add message.
[oweals/gnunet.git] / bootstrap
1 #!/bin/sh
2 # This file is in the public domain.
3 echo "Removing folder 'libltdl'..."
4 rm -rf libltdl
5
6 # This is more portable than `which' but comes with
7 # the caveat of not(?) properly working on busybox's ash:
8 existence()
9 {
10     command -v "$1" >/dev/null 2>&1
11 }
12
13 if existence uncrustify; then
14     echo "Installing uncrustify hook and configuration"
15     # Install uncrustify format symlink (if possible)
16     ln -s contrib/uncrustify.cfg uncrustify.cfg 2> /dev/null
17     # Install pre-commit hook (if possible)
18     ln -s ../../contrib/uncrustify_precommit .git/hooks/pre-commit 2> /dev/null
19 else
20     echo "Uncrustify not detected, hook not installed. Please install uncrustify if you plan on doing development"
21 fi
22
23
24 # yapf can be a suffixed binary, don't change the essential logic
25 # of this if you change it.
26 if existence yapf || existence yapf3.0 || existence yapf3.1 || existence yapf3.2 || existence yapf3.3 || existence yapf3.4 || existence yapf3.5 || existence yapf3.6 || existence yapf3.7 || existence yapf3.8 || existence yapf3.9 || existence yapf4.0; then
27     echo "Installing yapf symlink"
28     # Install yapf style symlink (if possible)
29     ln -s contrib/conf/.style.yapf 2> /dev/null
30 else
31     echo "yapf not detected, please install yapf if you plan on contributing python code"
32 fi
33
34 if test $1 = "-d"; then
35     if existence texi2mdoc; then
36         echo "texi2mdoc: exists, pass --enable-texi2mdoc-generation to configure"
37     else
38         dir=$(dirname "$(readlink -f -- "$0")")
39         mkdir -p $dir/contrib/vendored
40         cd contrib/vendored
41         if existence curl; then
42             curl --output texi2mdoc-0.1.2.tgz https://mandoc.bsd.lv/texi2mdoc/snapshots/texi2mdoc-0.1.2.tgz
43         elif existence wget; then
44             wget https://mandoc.bsd.lv/texi2mdoc/snapshots/texi2mdoc-0.1.2.tgz
45         elif existence ftp; then
46             ftp https://mandoc.bsd.lv/texi2mdoc/snapshots/texi2mdoc-0.1.2.tgz
47         elif existence fetch; then
48             fetch https://mandoc.bsd.lv/texi2mdoc/snapshots/texi2mdoc-0.1.2.tgz
49         else
50             echo "skipping texi2mdoc build, no ftp or curl or wget or fetch found"
51         fi
52         if test -e texi2mdoc-0.1.2.tgz; then
53             tar xzf texi2mdoc-0.1.2.tgz
54             cd texi2mdoc-0.1.2
55             dir=$(dirname "$(readlink -f -- "$0")")
56             make
57             echo "please prepend or append $dir/contrib/vendored/texi2mdoc/ to your PATH before running configure"
58             echo "and pass --enable-texi2mdoc-generation to configure"
59         else
60             echo "no texi2mdoc, skipping"
61         fi
62     fi
63 fi
64
65
66 echo "checking for libtoolize / libtool... "
67
68 if existence libtool || existence libtoolize || existence glibtoolize || existence slibtool; then
69     autoreconf -if
70     . "bin/pogen.sh"
71 else
72     echo "*** No libtoolize (libtool) or libtool found, please install it ***" >&2;
73     exit 1
74 fi