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