xref: /aoo41x/main/bootstrap.1 (revision 1ba082f0)
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    "$PERL" "$SOLARENV/bin/download_external_dependencies.pl" $SRC_ROOT/external_deps.lst
43fi
44
45# ------------------------------------------------------------------------------
46# Build dmake
47
48if test -n "$DMAKE_URL" -a  ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
49
50    # Assume that the dmake archive has been downloaded by fetch_tarballs.sh
51    # Determine the name of the downloaded file.
52    dmake_package_name=`echo $DMAKE_URL | sed "s/^\(.*\/\)//"`
53
54    tmp_build_dir="$SOLARENV/$INPATH/misc/build/"
55    echo "making and entering $tmp_build_dir"
56    # Clean up any residues from a previous and unsuccessful build.
57    rm -rf "$tmp_build_dir"
58    mkdir -p "$tmp_build_dir"
59    cd "$tmp_build_dir" || exit
60
61    dmake_full_package_name=$(find $TARFILE_LOCATION -type f -name "*-$dmake_package_name")
62    if [ -z "$dmake_full_package_name" ]; then
63        echo "can not find the dmake package"
64        exit
65    fi
66    if test "$GUI" = "WNT"; then
67        dmake_full_package_name=`cygpath -u "$dmake_full_package_name"`
68    fi
69    echo "unpacking $dmake_full_package_name"
70
71    # Unpack it.
72    case $dmake_package_name in
73        *.tar.gz)
74            tar -xzf "$dmake_full_package_name"
75            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.gz\)//"`
76            ;;
77        *.tgz)
78            tar -xzf "$dmake_full_package_name"
79            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tgz\)//"`
80            ;;
81        *.tar.bz2)
82            tar -xjf "$dmake_full_package_name"
83            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.bz2\)//"`
84            ;;
85        *.zip)
86            unzip "$dmake_full_package_name"
87            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.zip\)//"`
88            ;;
89        *)
90            echo "can not unpack the dmake source"
91            dmake_directory_name=
92            exit 1
93            ;;
94    esac
95
96    echo "entering $dmake_directory_name"
97    cd "$dmake_directory_name" || exit
98
99    # Special case! The w32/tcsh build needs CC pointing to the MSVC++ compiler
100    # but we need a cygwin/gcc build dmake to understand the posix paths
101    if test "$GUI" = "WNT"; then
102        CC=""
103        CXX=""
104        export CC
105        export CXX
106        DMAKE_CONF="--enable-spawn"
107    else
108        DMAKE_CONF=""
109    fi
110
111    # For unixy systems
112    if test -f "Makefile" ; then
113        $GNUMAKE distclean || exit
114    fi
115
116    ./configure $DMAKE_CONF || exit
117
118    ## invoke the gnu make command set by configure.
119    $GNUMAKE || exit
120
121
122    # Deploy the dmake executable to solenv
123    cp -f "$tmp_build_dir/$dmake_directory_name/dmake$EXEEXT" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit
124    echo ""
125    echo "dmake successfully built and copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
126    echo ""
127
128    # Clean up.  Note that this is skipped when one of the exits is executed above.
129    rm -rf "$tmp_build_dir"
130
131elif test "$IS_SYSTEM_DMAKE" = "YES"; then
132
133    echo ""
134    echo "dmake is located in search path"
135    echo ""
136
137elif test -n "$DMAKE_PATH" -a -x "$DMAKE_PATH" -a  ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
138
139    cp -f "$DMAKE_PATH" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit
140
141    echo ""
142    echo "dmake copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
143    echo ""
144
145else
146
147    if test -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
148        echo ""
149        echo "dmake present in $SOLARENV/$INPATH/bin/dmake$EXEEXT"
150    fi
151
152fi
153
154# Download missing extensions.
155"$PERL" "$SOLARENV/bin/download_missing_extensions.pl"
156