xref: /trunk/main/bootstrap.1 (revision 476148e5)
1# *************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20# *************************************************************
21
22if test -z "${SOLARENV}"; then
23    if test -f ./source_soenv.sh; then . ./source_soenv.sh; fi
24fi
25if test -z "${SOLARENV}"; then
26    echo "bootstrap: No environment set!"
27    exit 1
28fi
29
30# remove aliases set by *Env.Set.sh
31unalias mkout
32unalias deliver
33unalias build
34unalias build_client
35unalias zipdep
36unalias nmake
37unalias gunzip
38
39# executables are *.exe for WNT. This variable is necessary since Cygwin 1.5.x
40# Use spawn instead of fork when building dmake on cygwin.
41if test "$GUI" = "WNT"; then
42    EXEEXT=".exe"
43else
44    EXEEXT=""
45fi
46export EXEEXT
47
48mkdir -p "$SOLARENV/$INPATH/bin"
49
50#make sure build.pl is executable
51
52chmod +x "$SRC_ROOT/solenv/bin/build.pl"
53chmod +x "$SRC_ROOT/solenv/bin/build_client.pl"
54chmod +x "$SRC_ROOT/solenv/bin/zipdep.pl"
55chmod +x "$SRC_ROOT/solenv/bin/gccinstlib.pl"
56
57# fetch or update external tarballs
58if [ "$DO_FETCH_TARBALLS" = "yes" ]; then
59# check perl include locations
60    "$PERL" -e 'print "\nInclude locations: @INC\n\n"';
61    "$PERL" "$SOLARENV/bin/download_external_dependencies.pl" $SRC_ROOT/external_deps.lst
62    if [ "$?" != "0" ]; then
63        echo "*** Error downloading external dependencies, please fix the previous problems and try again ***"
64        exit 1
65    fi
66fi
67
68# ------------------------------------------------------------------------------
69# Build dmake
70
71if test -n "$DMAKE_URL" -a  ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
72
73    # Assume that the dmake archive has been downloaded
74    # Determine the name of the downloaded file.
75    dmake_package_name=`echo $DMAKE_URL | sed "s/^\(.*\/\)//"`
76
77    tmp_build_dir="$SOLARENV/$INPATH/misc/build/"
78    echo "making and entering $tmp_build_dir"
79    # Clean up any residues from a previous and unsuccessful build.
80    rm -rf "$tmp_build_dir"
81    mkdir -p "$tmp_build_dir"
82    cd "$tmp_build_dir" || exit
83
84    dmake_full_package_name=$(find $TARFILE_LOCATION -type f -name "*-$dmake_package_name")
85    if [ -z "$dmake_full_package_name" ]; then
86        echo "can not find the dmake package"
87        exit
88    fi
89    if test "$GUI" = "WNT"; then
90        dmake_full_package_name=`cygpath -u "$dmake_full_package_name"`
91    fi
92    echo "unpacking $dmake_full_package_name"
93
94    # Unpack it.
95    case $dmake_package_name in
96        *.tar.gz)
97            tar -xzf "$dmake_full_package_name"
98            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.gz\)//"`
99            ;;
100        *.tgz)
101            tar -xzf "$dmake_full_package_name"
102            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tgz\)//"`
103            ;;
104        *.tar.bz2)
105            tar -xjf "$dmake_full_package_name"
106            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.bz2\)//"`
107            ;;
108        *.zip)
109            unzip "$dmake_full_package_name"
110            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.zip\)//"`
111            ;;
112        *)
113            echo "can not unpack the dmake source"
114            dmake_directory_name=
115            exit 1
116            ;;
117    esac
118
119    echo "entering $dmake_directory_name"
120    cd "$dmake_directory_name" || exit
121
122    # Special case! The w32/tcsh build needs CC pointing to the MSVC++ compiler
123    # but we need a cygwin/gcc build dmake to understand the posix paths
124    if test "$GUI" = "WNT"; then
125        CC=""
126        CXX=""
127        export CC
128        export CXX
129        DMAKE_CONF="--enable-spawn"
130    else
131        DMAKE_CONF=""
132    fi
133
134    # For unixy systems
135    if test -f "Makefile" ; then
136        $GNUMAKE distclean || exit
137    fi
138
139    # config.guess and config.sub for dmake are too old, overwrite with ours:
140    cp $SOLARSRC/config.guess .
141    cp $SOLARSRC/config.sub .
142
143    ./configure $DMAKE_CONF || exit
144
145    ## invoke the gnu make command set by configure.
146    $GNUMAKE || exit
147
148
149    # Deploy the dmake executable to solenv
150    cp -f "$tmp_build_dir/$dmake_directory_name/dmake$EXEEXT" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit
151    echo ""
152    echo "dmake successfully built and copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
153    echo ""
154
155    # Clean up. Note that this is skipped when one of the exits is executed above.
156    rm -rf "$tmp_build_dir"
157
158elif test "$IS_SYSTEM_DMAKE" = "YES"; then
159
160    echo ""
161    echo "dmake is located in search path"
162    echo ""
163
164elif test -n "$DMAKE_PATH" -a -x "$DMAKE_PATH" -a  ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
165
166    cp -f "$DMAKE_PATH" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit
167
168    echo ""
169    echo "dmake copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
170    echo ""
171
172else
173
174    if test -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
175        echo ""
176        echo "dmake present in $SOLARENV/$INPATH/bin/dmake$EXEEXT"
177    fi
178
179fi
180
181# Download missing extensions.
182"$PERL" "$SOLARENV/bin/download_missing_extensions.pl"
183