xref: /trunk/main/bootstrap.1 (revision 6eeb2f28)
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
22# executables are *.exe for WNT. This variable is necessary since Cygwin 1.5.x
23# Use spawn instead of fork when building dmake on cygwin.
24if test "$GUI" = "WNT"; then
25    EXEEXT=".exe"
26else
27    EXEEXT=""
28fi
29export EXEEXT
30
31mkdir -p "$SOLARENV/$INPATH/bin"
32
33#make sure build.pl is executable
34
35chmod +x "$SRC_ROOT/solenv/bin/build.pl"
36chmod +x "$SRC_ROOT/solenv/bin/build_client.pl"
37chmod +x "$SRC_ROOT/solenv/bin/zipdep.pl"
38chmod +x "$SRC_ROOT/solenv/bin/gccinstlib.pl"
39
40# fetch or update external tarballs
41if [ "$DO_FETCH_TARBALLS" = "yes" ]; then
42# check perl include locations
43    "$PERL" -e 'print "\nInclude locations: @INC\n\n"';
44
45    mkdir -p "$SOLARENV/$INPATH/class"
46    "$JAVACOMPILER" "$SOLARENV/javadownloader/AOOJavaDownloader.java" -d "$SOLARENV/$INPATH/class"
47    if [ "$?" != "0" ]; then
48        echo "*** Failed to build AOOJavaDownloader, aborting! ***"
49        exit 1
50    fi
51
52    "$PERL" "$SOLARENV/bin/download_external_dependencies.pl" $SRC_ROOT/external_deps.lst
53    if [ "$?" != "0" ]; then
54        echo "*** Error downloading external dependencies, please fix the previous problems and try again ***"
55        exit 1
56    fi
57fi
58
59# ------------------------------------------------------------------------------
60# Build dmake
61
62if test -n "$DMAKE_URL" -a  ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
63
64    # Assume that the dmake archive has been downloaded by fetch_tarballs.sh
65    # Determine the name of the downloaded file.
66    dmake_package_name=`echo $DMAKE_URL | sed "s/^\(.*\/\)//"`
67
68    tmp_build_dir="$SOLARENV/$INPATH/misc/build/"
69    echo "making and entering $tmp_build_dir"
70    # Clean up any residues from a previous and unsuccessful build.
71    rm -rf "$tmp_build_dir"
72    mkdir -p "$tmp_build_dir"
73    cd "$tmp_build_dir" || exit
74
75    dmake_full_package_name=$(find $TARFILE_LOCATION -type f -name "*-$dmake_package_name")
76    if [ -z "$dmake_full_package_name" ]; then
77        echo "can not find the dmake package"
78        exit
79    fi
80    if test "$GUI" = "WNT"; then
81        dmake_full_package_name=`cygpath -u "$dmake_full_package_name"`
82    fi
83    echo "unpacking $dmake_full_package_name"
84
85    # Unpack it.
86    case $dmake_package_name in
87        *.tar.gz)
88            tar -xzf "$dmake_full_package_name"
89            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.gz\)//"`
90            ;;
91        *.tgz)
92            tar -xzf "$dmake_full_package_name"
93            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tgz\)//"`
94            ;;
95        *.tar.bz2)
96            tar -xjf "$dmake_full_package_name"
97            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.bz2\)//"`
98            ;;
99        *.zip)
100            unzip "$dmake_full_package_name"
101            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.zip\)//"`
102            ;;
103        *)
104            echo "can not unpack the dmake source"
105            dmake_directory_name=
106            exit 1
107            ;;
108    esac
109
110    echo "entering $dmake_directory_name"
111    cd "$dmake_directory_name" || exit
112
113    # Special case! The w32/tcsh build needs CC pointing to the MSVC++ compiler
114    # but we need a cygwin/gcc build dmake to understand the posix paths
115    if test "$GUI" = "WNT"; then
116        CC=""
117        CXX=""
118        export CC
119        export CXX
120        DMAKE_CONF="--enable-spawn"
121    else
122        DMAKE_CONF=""
123    fi
124
125    # For unixy systems
126    if test -f "Makefile" ; then
127        $GNUMAKE distclean || exit
128    fi
129
130    ./configure $DMAKE_CONF || exit
131
132    ## invoke the gnu make command set by configure.
133    $GNUMAKE || exit
134
135
136    # Deploy the dmake executable to solenv
137    cp -f "$tmp_build_dir/$dmake_directory_name/dmake$EXEEXT" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit
138    echo ""
139    echo "dmake successfully built and copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
140    echo ""
141
142    # Clean up.  Note that this is skipped when one of the exits is executed above.
143    rm -rf "$tmp_build_dir"
144
145elif test "$IS_SYSTEM_DMAKE" = "YES"; then
146
147    echo ""
148    echo "dmake is located in search path"
149    echo ""
150
151elif test -n "$DMAKE_PATH" -a -x "$DMAKE_PATH" -a  ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
152
153    cp -f "$DMAKE_PATH" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit
154
155    echo ""
156    echo "dmake copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
157    echo ""
158
159else
160
161    if test -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
162        echo ""
163        echo "dmake present in $SOLARENV/$INPATH/bin/dmake$EXEEXT"
164    fi
165
166fi
167
168# Download missing extensions.
169"$PERL" "$SOLARENV/bin/download_missing_extensions.pl"
170