xref: /AOO41X/main/bootstrap.1 (revision 37e6b05a80e4e64de66febf437f08f185994f74e)
15b501c92SAndrew Rist# *************************************************************
25b501c92SAndrew Rist#
35b501c92SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
45b501c92SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
55b501c92SAndrew Rist#  distributed with this work for additional information
65b501c92SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
75b501c92SAndrew Rist#  to you under the Apache License, Version 2.0 (the
85b501c92SAndrew Rist#  "License"); you may not use this file except in compliance
95b501c92SAndrew Rist#  with the License.  You may obtain a copy of the License at
105b501c92SAndrew Rist#
115b501c92SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
125b501c92SAndrew Rist#
135b501c92SAndrew Rist#  Unless required by applicable law or agreed to in writing,
145b501c92SAndrew Rist#  software distributed under the License is distributed on an
155b501c92SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b501c92SAndrew Rist#  KIND, either express or implied.  See the License for the
175b501c92SAndrew Rist#  specific language governing permissions and limitations
185b501c92SAndrew Rist#  under the License.
195b501c92SAndrew Rist#
205b501c92SAndrew Rist# *************************************************************
21cdf0e10cSrcweir
22cdf0e10cSrcweir# executables are *.exe for WNT. This variable is necessary since Cygwin 1.5.x
23cdf0e10cSrcweir# Use spawn instead of fork when building dmake on cygwin.
24cdf0e10cSrcweirif test "$GUI" = "WNT"; then
25cdf0e10cSrcweir    EXEEXT=".exe"
26cdf0e10cSrcweirelse
27cdf0e10cSrcweir    EXEEXT=""
28cdf0e10cSrcweirfi
29cdf0e10cSrcweirexport EXEEXT
30cdf0e10cSrcweir
31cdf0e10cSrcweirmkdir -p "$SOLARENV/$OUTPATH/bin"
32cdf0e10cSrcweir
33cdf0e10cSrcweir#make sure build.pl is executable
34cdf0e10cSrcweir
35cdf0e10cSrcweirchmod +x "$SRC_ROOT/solenv/bin/build.pl"
36cdf0e10cSrcweirchmod +x "$SRC_ROOT/solenv/bin/build_client.pl"
37cdf0e10cSrcweirchmod +x "$SRC_ROOT/solenv/bin/zipdep.pl"
38cdf0e10cSrcweirchmod +x "$SRC_ROOT/solenv/bin/gccinstlib.pl"
39cdf0e10cSrcweir
40cdf0e10cSrcweir# fetch or update external tarballs
41cdf0e10cSrcweirif [ "$DO_FETCH_TARBALLS" = "yes" ]; then
42*37e6b05aSAndre Fischer  if [ "X$USE_NEW_EXTLIB_DOWNLOAD" != "X" ]; then
43*37e6b05aSAndre Fischer      download_external_libraries.pl $SRC_ROOT/external_libs.lst
44*37e6b05aSAndre Fischer  else
45cdf0e10cSrcweir	  $SRC_ROOT/fetch_tarballs.sh $SRC_ROOT/ooo.lst
46cdf0e10cSrcweir  fi
47*37e6b05aSAndre Fischerfi
48fb6b49d1SJürgen Schmidt
49fb6b49d1SJürgen Schmidt# ------------------------------------------------------------------------------
50fb6b49d1SJürgen Schmidt# Build dmake
51fb6b49d1SJürgen Schmidt
52fb6b49d1SJürgen Schmidtif test -n "$DMAKE_URL" -a  ! -x "$SOLARENV/$OUTPATH/bin/dmake$EXEEXT"; then
53fb6b49d1SJürgen Schmidt
54fb6b49d1SJürgen Schmidt    # Assume that the dmake archive has been downloaded by fetch_tarballs.sh
55fb6b49d1SJürgen Schmidt    # Determine the name of the downloaded file.
56fb6b49d1SJürgen Schmidt    dmake_package_name=`echo $DMAKE_URL | sed "s/^\(.*\/\)//"`
57fb6b49d1SJürgen Schmidt
58fb6b49d1SJürgen Schmidt    tmp_build_dir="$SOLARENV/$OUTPATH/misc/build/"
59fb6b49d1SJürgen Schmidt    echo "making and entering $tmp_build_dir"
60fb6b49d1SJürgen Schmidt    # Clean up any residues from a previous and unsuccessful build.
61fb6b49d1SJürgen Schmidt    rm -rf "$tmp_build_dir"
62fb6b49d1SJürgen Schmidt    mkdir -p "$tmp_build_dir"
63fb6b49d1SJürgen Schmidt    cd "$tmp_build_dir" || exit
64fb6b49d1SJürgen Schmidt
65a6ff3988SAndre Fischer    dmake_full_package_name=$(find $TARFILE_LOCATION -type f -name "*-$dmake_package_name")
66a6ff3988SAndre Fischer    if [ -z "$dmake_full_package_name" ]; then
67a6ff3988SAndre Fischer        echo "can not find the dmake package"
68a6ff3988SAndre Fischer        exit
69a6ff3988SAndre Fischer    fi
70fb6b49d1SJürgen Schmidt    if test "$GUI" = "WNT"; then
71fb6b49d1SJürgen Schmidt        dmake_full_package_name=`cygpath -u "$dmake_full_package_name"`
72fb6b49d1SJürgen Schmidt    fi
73fb6b49d1SJürgen Schmidt    echo "unpacking $dmake_full_package_name"
74fb6b49d1SJürgen Schmidt
75fb6b49d1SJürgen Schmidt    # Unpack it.
76fb6b49d1SJürgen Schmidt    case $dmake_package_name in
77fb6b49d1SJürgen Schmidt        *.tar.gz)
78fb6b49d1SJürgen Schmidt            tar -xzf "$dmake_full_package_name"
79fb6b49d1SJürgen Schmidt            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.gz\)//"`
80fb6b49d1SJürgen Schmidt            ;;
81fb6b49d1SJürgen Schmidt        *.tgz)
82fb6b49d1SJürgen Schmidt            tar -xzf "$dmake_full_package_name"
83fb6b49d1SJürgen Schmidt            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tgz\)//"`
84fb6b49d1SJürgen Schmidt            ;;
85fb6b49d1SJürgen Schmidt        *.tar.bz2)
86fb6b49d1SJürgen Schmidt            tar -xjf "$dmake_full_package_name"
87fb6b49d1SJürgen Schmidt            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.bz2\)//"`
88fb6b49d1SJürgen Schmidt            ;;
89fb6b49d1SJürgen Schmidt        *.zip)
90fb6b49d1SJürgen Schmidt            unzip "$dmake_full_package_name"
91fb6b49d1SJürgen Schmidt            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.zip\)//"`
92fb6b49d1SJürgen Schmidt            ;;
93fb6b49d1SJürgen Schmidt        *)
94fb6b49d1SJürgen Schmidt            echo "can not unpack the dmake source"
95fb6b49d1SJürgen Schmidt            dmake_directory_name=
96fb6b49d1SJürgen Schmidt            exit 1
97fb6b49d1SJürgen Schmidt            ;;
98fb6b49d1SJürgen Schmidt    esac
99fb6b49d1SJürgen Schmidt
100fb6b49d1SJürgen Schmidt    echo "entering $dmake_directory_name"
101fb6b49d1SJürgen Schmidt    cd "$dmake_directory_name" || exit
102fb6b49d1SJürgen Schmidt
103fb6b49d1SJürgen Schmidt    # Special case! The w32/tcsh build needs CC pointing to the MSVC++ compiler
104fb6b49d1SJürgen Schmidt    # but we need a cygwin/gcc build dmake to understand the posix paths
105fb6b49d1SJürgen Schmidt    if test "$GUI" = "WNT"; then
106fb6b49d1SJürgen Schmidt        CC=""
107fb6b49d1SJürgen Schmidt        CXX=""
108fb6b49d1SJürgen Schmidt        export CC
109fb6b49d1SJürgen Schmidt        export CXX
110fb6b49d1SJürgen Schmidt        DMAKE_CONF="--enable-spawn"
111fb6b49d1SJürgen Schmidt    else
112fb6b49d1SJürgen Schmidt        DMAKE_CONF=""
113fb6b49d1SJürgen Schmidt    fi
114fb6b49d1SJürgen Schmidt
115fb6b49d1SJürgen Schmidt    # For unixy systems
116fb6b49d1SJürgen Schmidt    if test -f "Makefile" ; then
117fb6b49d1SJürgen Schmidt        $GNUMAKE distclean || exit
118fb6b49d1SJürgen Schmidt    fi
119fb6b49d1SJürgen Schmidt
120fb6b49d1SJürgen Schmidt    ./configure $DMAKE_CONF || exit
121fb6b49d1SJürgen Schmidt
122fb6b49d1SJürgen Schmidt    ## invoke the gnu make command set by configure.
123fb6b49d1SJürgen Schmidt    $GNUMAKE || exit
124fb6b49d1SJürgen Schmidt
125fb6b49d1SJürgen Schmidt
126fb6b49d1SJürgen Schmidt    # Deploy the dmake executable to solenv
127fb6b49d1SJürgen Schmidt    cp -f "$tmp_build_dir/$dmake_directory_name/dmake$EXEEXT" "$SOLARENV/$OUTPATH/bin/dmake$EXEEXT" || exit
128fb6b49d1SJürgen Schmidt    echo ""
129fb6b49d1SJürgen Schmidt    echo "dmake successfully built and copied to $SOLARENV/$OUTPATH/bin/dmake$EXEEXT"
130fb6b49d1SJürgen Schmidt    echo ""
131fb6b49d1SJürgen Schmidt
132fb6b49d1SJürgen Schmidt    # Clean up.  Note that this is skipped when one of the exits is executed above.
133fb6b49d1SJürgen Schmidt    rm -rf "$tmp_build_dir"
134fb6b49d1SJürgen Schmidt
135aee29faaSAriel Constenla-Haileelif test "$IS_SYSTEM_DMAKE" = "YES"; then
136aee29faaSAriel Constenla-Haile
137aee29faaSAriel Constenla-Haile    echo ""
138aee29faaSAriel Constenla-Haile    echo "dmake is located in search path"
139aee29faaSAriel Constenla-Haile    echo ""
140aee29faaSAriel Constenla-Haile
141aee29faaSAriel Constenla-Haileelif test -n "$DMAKE_PATH" -a -x "$DMAKE_PATH" -a  ! -x "$SOLARENV/$OUTPATH/bin/dmake$EXEEXT"; then
142aee29faaSAriel Constenla-Haile
143aee29faaSAriel Constenla-Haile    cp -f "$DMAKE_PATH" "$SOLARENV/$OUTPATH/bin/dmake$EXEEXT" || exit
144aee29faaSAriel Constenla-Haile
145aee29faaSAriel Constenla-Haile    echo ""
146aee29faaSAriel Constenla-Haile    echo "dmake copied to $SOLARENV/$OUTPATH/bin/dmake$EXEEXT"
147aee29faaSAriel Constenla-Haile    echo ""
148aee29faaSAriel Constenla-Haile
149fb6b49d1SJürgen Schmidtelse
150fb6b49d1SJürgen Schmidt
151fb6b49d1SJürgen Schmidt    if test -x "$SOLARENV/$OUTPATH/bin/dmake$EXEEXT"; then
152fb6b49d1SJürgen Schmidt        echo ""
153fb6b49d1SJürgen Schmidt        echo "dmake present in $SOLARENV/$OUTPATH/bin/dmake$EXEEXT"
154fb6b49d1SJürgen Schmidt    fi
155fb6b49d1SJürgen Schmidt
156fb6b49d1SJürgen Schmidtfi
157c6dedb65SAndre Fischer
158c6dedb65SAndre Fischer# Download missing extensions.
159c6dedb65SAndre Fischerdownload_missing_extensions.pl
160