File: bootstrap

package info (click to toggle)
starlink-pal 0.9.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,808 kB
  • sloc: ansic: 6,689; makefile: 128; sh: 81
file content (134 lines) | stat: -rwxr-xr-x 4,843 bytes parent folder | download
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
130
131
132
133
134
#! /bin/sh -
# original bootstrap file, installed by starconf 1.3, rnum=1003000
# If you _need_ to change this file, delete `original' in the line above,
# or else starconf may overwrite it with an updated version.
#
# bootstrap.installed.  Generated from bootstrap.installed.in by configure.
#
# Bootstrap a checked-out component of the Starlink software tree.
# Run this script in a freshly checked-out directory to bring the
# system to the point where you can just type ./configure;make
#
# Usage:
#     ./bootstrap


# This script should be installed, by starconf, in all `component
# directories'.  A `component directory' is a directory which has a
# component.xml.in file in it.  All component directories will have a
# manifest file created and installed in .../manifests; non-component
# directories will not have manifest files.  Everything that's
# installed should be installed as part of some component
# or other.
#
# The ./bootstrap scripts will stop recursing when they find a
# component.xml.in file.  They'll warn if they find a component.xml.in
# file in any AC_CONFIG_SUBDIRS directory, but ignore it, and exit
# with an error if they do not find a component.xml.in file and there
# are no AC_CONFIG_SUBDIRS directories in which to search further.
# That is, the tree of directories which the top-level bootstrap
# traverses should have component.xml.in files at or above all its
# leaves.


# The starconf below might update bootstrap, if a newer version is
# available.  Unfortunately, this confuses sh, which appears _not_ to
# keep open the script it's reading, but to reopen it afresh, or reseek
# within the file, for each line (or something like that!?).
# So rewrite this script to a temporary file and exec it.
tempfile="${TMP-/tmp}/$0-$$.tmp"
rm -f $tempfile
echo "trap 'rm -f $tempfile' 0" >$tempfile   # remove temporary at exit
sed '1,/^--TRAMPOLINE--/d' $0 >>$tempfile    # strip out the trampoline
exec /bin/sh $tempfile                       # exec the temporary
--TRAMPOLINE--


echo "Bootstrapping `pwd` ..."

if test ! -f configure.ac; then
    echo "bootstrap: No configure.ac in directory `pwd`" >&2
    exit 1
fi

subdirs=`autoconf --trace=AC_CONFIG_SUBDIRS:$% configure.ac`

if test -f component.xml.in; then

    if starconf --show buildsupport >/dev/null 2>&1; then

        # starconf is in the path
        echo "...using starconf in " `starconf --show buildsupport`
        starconf || exit 1

    else

        # The temptation here is to use ./starconf.status to find the
        # starconf that it came from and invoke that explicitly.  Don't do
        # this, however: we don't want to be too clever, and it's better
        # to be consistent with the way the autotools behave (the first
        # one in your path is the one that works, and they don't have this
        # sort of `phone home' cleverness in them).

        echo "bootstrap error: The starconf application is not in your path"

        # This doesn't stop us being helpful, however.
        if test -f ./starconf.status; then
            starconf_home=`./starconf.status --show buildsupport`
            echo "This directory was last bootstrapped with $starconf_home/bin/starconf"
        fi

        exit 1
    fi

    # Check that there are no component.xml.in files in any subdirectories
    if test -n "$subdirs"; then
        for d in $subdirs
        do
            if test -d "$d" && test -f "$d/component.xml.in"; then
                echo "bootstrap: warning: ignoring child $d/component.xml.in" >&2
            fi
        done
    fi

    # If STAR_SUPPRESS_AUTORECONF is true in the environment, then we
    # suppress the call of `autoreconf'.  This is here _only_ so that
    # the top-level bootstrap file can suppress multiple calls of this
    # in bootstrap scripts in its children.  This mechanism must not
    # be used by users, as it is likely to change without warning. 
    if ${STAR_SUPPRESS_AUTORECONF-false}; then
        echo "Suppressing autoreconf in" `pwd`
    else
        echo autoreconf --install --symlink
        autoreconf --install --symlink || exit 1
    fi

else

    # This is not a component directory, so simply recurse into the children.

    # ...if there are any, that is.
    if test -z "$subdirs"; then
        echo "bootstrap: error: non-component directory `pwd` has no subdirs" >&2
        exit 1
    fi

    # Bootstrap the child directories mentioned in AC_CONFIG_SUBDIRS.
    # These bootstrap files must exist.
    for d in $subdirs
    do
        if test -d "$d"; then
            echo "Bootstrapping $d..."
            if test -f $d/bootstrap; then
                # good...
                (cd $d; /bin/sh ./bootstrap)
            else
                echo "bootstrap: no file $d/bootstrap" >&2
                exit 1
            fi
        fi
    done

fi

exit 0