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# build the AOOJavaDownloader 58mkdir -p "$SOLARENV/$INPATH/class" 59"$JAVACOMPILER" "$SOLARENV/javadownloader/AOOJavaDownloader.java" -d "$SOLARENV/$INPATH/class" 60if [ "$?" != "0" ]; then 61 echo "*** Failed to build AOOJavaDownloader, aborting! ***" 62 exit 1 63fi 64 65# fetch or update external tarballs 66if [ "$DO_FETCH_TARBALLS" = "yes" ]; then 67# check perl include locations 68 "$PERL" -e 'print "\nInclude locations: @INC\n\n"'; 69 "$PERL" "$SOLARENV/bin/download_external_dependencies.pl" $SRC_ROOT/external_deps.lst 70 if [ "$?" != "0" ]; then 71 echo "*** Error downloading external dependencies, please fix the previous problems and try again ***" 72 exit 1 73 fi 74fi 75 76# ------------------------------------------------------------------------------ 77# Build dmake 78 79if test -n "$DMAKE_URL" -a ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then 80 81 # Assume that the dmake archive has been downloaded 82 # Determine the name of the downloaded file. 83 dmake_package_name=`echo $DMAKE_URL | sed "s/^\(.*\/\)//"` 84 85 tmp_build_dir="$SOLARENV/$INPATH/misc/build/" 86 echo "making and entering $tmp_build_dir" 87 # Clean up any residues from a previous and unsuccessful build. 88 rm -rf "$tmp_build_dir" 89 mkdir -p "$tmp_build_dir" 90 cd "$tmp_build_dir" || exit 91 92 dmake_full_package_name=$(find $TARFILE_LOCATION -type f -name "*-$dmake_package_name") 93 if [ -z "$dmake_full_package_name" ]; then 94 echo "can not find the dmake package" 95 exit 96 fi 97 if test "$GUI" = "WNT"; then 98 dmake_full_package_name=`cygpath -u "$dmake_full_package_name"` 99 fi 100 echo "unpacking $dmake_full_package_name" 101 102 # Unpack it. 103 case $dmake_package_name in 104 *.tar.gz) 105 tar -xzf "$dmake_full_package_name" 106 dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.gz\)//"` 107 ;; 108 *.tgz) 109 tar -xzf "$dmake_full_package_name" 110 dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tgz\)//"` 111 ;; 112 *.tar.bz2) 113 tar -xjf "$dmake_full_package_name" 114 dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.bz2\)//"` 115 ;; 116 *.zip) 117 unzip "$dmake_full_package_name" 118 dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.zip\)//"` 119 ;; 120 *) 121 echo "can not unpack the dmake source" 122 dmake_directory_name= 123 exit 1 124 ;; 125 esac 126 127 echo "entering $dmake_directory_name" 128 cd "$dmake_directory_name" || exit 129 130 # Special case! The w32/tcsh build needs CC pointing to the MSVC++ compiler 131 # but we need a cygwin/gcc build dmake to understand the posix paths 132 if test "$GUI" = "WNT"; then 133 CC="" 134 CXX="" 135 export CC 136 export CXX 137 DMAKE_CONF="--enable-spawn" 138 else 139 DMAKE_CONF="" 140 fi 141 142 # For unixy systems 143 if test -f "Makefile" ; then 144 $GNUMAKE distclean || exit 145 fi 146 147 ./configure $DMAKE_CONF || exit 148 149 ## invoke the gnu make command set by configure. 150 $GNUMAKE || exit 151 152 153 # Deploy the dmake executable to solenv 154 cp -f "$tmp_build_dir/$dmake_directory_name/dmake$EXEEXT" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit 155 echo "" 156 echo "dmake successfully built and copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT" 157 echo "" 158 159 # Clean up. Note that this is skipped when one of the exits is executed above. 160 rm -rf "$tmp_build_dir" 161 162elif test "$IS_SYSTEM_DMAKE" = "YES"; then 163 164 echo "" 165 echo "dmake is located in search path" 166 echo "" 167 168elif test -n "$DMAKE_PATH" -a -x "$DMAKE_PATH" -a ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then 169 170 cp -f "$DMAKE_PATH" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit 171 172 echo "" 173 echo "dmake copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT" 174 echo "" 175 176else 177 178 if test -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then 179 echo "" 180 echo "dmake present in $SOLARENV/$INPATH/bin/dmake$EXEEXT" 181 fi 182 183fi 184 185# Download missing extensions. 186"$PERL" "$SOLARENV/bin/download_missing_extensions.pl" 187