blob: 822f286416eb33bb8836e35577ad2e4b585d958b [file] [log] [blame]
Andrew Ristf941cbe2012-03-29 00:47:44 +00001# *************************************************************
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# *************************************************************
Kurt Zenker9647a332006-07-05 21:07:20 +000021
Damjan Jovanovicca68acd2016-08-07 19:24:03 +000022if 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
Rüdiger Timm87840aa2003-12-01 16:38:25 +000039# executables are *.exe for WNT. This variable is necessary since Cygwin 1.5.x
Oliver Bolteafb4d612006-09-15 10:18:41 +000040# Use spawn instead of fork when building dmake on cygwin.
Kurt Zenker9647a332006-07-05 21:07:20 +000041if test "$GUI" = "WNT"; then
Vladimir Glazounovc64d4c52006-09-27 09:25:09 +000042 EXEEXT=".exe"
Rüdiger Timm87840aa2003-12-01 16:38:25 +000043else
Vladimir Glazounovc64d4c52006-09-27 09:25:09 +000044 EXEEXT=""
Kurt Zenker9647a332006-07-05 21:07:20 +000045fi
Kurt Zenkerb2ffa9c2006-07-19 08:36:10 +000046export EXEEXT
Jens-Heiner Rechtien11cb1ba2000-09-18 15:18:56 +000047
Ariel Constenla-Haile82079902012-06-10 19:59:43 +000048mkdir -p "$SOLARENV/$INPATH/bin"
Kurt Zenker9647a332006-07-05 21:07:20 +000049
50#make sure build.pl is executable
51
52chmod +x "$SRC_ROOT/solenv/bin/build.pl"
Kurt Zenker1c5de272007-05-09 12:26:54 +000053chmod +x "$SRC_ROOT/solenv/bin/build_client.pl"
Kurt Zenker9647a332006-07-05 21:07:20 +000054chmod +x "$SRC_ROOT/solenv/bin/zipdep.pl"
55chmod +x "$SRC_ROOT/solenv/bin/gccinstlib.pl"
Hans-Joachim Lankenaua9669262010-01-15 14:55:12 +010056
57# fetch or update external tarballs
58if [ "$DO_FETCH_TARBALLS" = "yes" ]; then
Kay Schenka4c7ead2016-06-21 21:23:37 +000059# check perl include locations
60 "$PERL" -e 'print "\nInclude locations: @INC\n\n"';
Ariel Constenla-Haile4fddf872012-10-06 01:43:58 +000061 "$PERL" "$SOLARENV/bin/download_external_dependencies.pl" $SRC_ROOT/external_deps.lst
Damjan Jovanovic6dd7f9f2016-02-06 11:51:01 +000062 if [ "$?" != "0" ]; then
63 echo "*** Error downloading external dependencies, please fix the previous problems and try again ***"
64 exit 1
65 fi
Hans-Joachim Lankenaua9669262010-01-15 14:55:12 +010066fi
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +000067
68# ------------------------------------------------------------------------------
69# Build dmake
70
Ariel Constenla-Haile82079902012-06-10 19:59:43 +000071if test -n "$DMAKE_URL" -a ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +000072
Damjan Jovanovic90f47bb2016-07-27 22:52:02 +000073 # Assume that the dmake archive has been downloaded
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +000074 # Determine the name of the downloaded file.
75 dmake_package_name=`echo $DMAKE_URL | sed "s/^\(.*\/\)//"`
76
Ariel Constenla-Haile82079902012-06-10 19:59:43 +000077 tmp_build_dir="$SOLARENV/$INPATH/misc/build/"
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +000078 echo "making and entering $tmp_build_dir"
79 # Clean up any residues from a previous and unsuccessful build.
80 rm -rf "$tmp_build_dir"
81 mkdir -p "$tmp_build_dir"
82 cd "$tmp_build_dir" || exit
83
Andre Fischerc5d97002011-12-02 09:39:29 +000084 dmake_full_package_name=$(find $TARFILE_LOCATION -type f -name "*-$dmake_package_name")
85 if [ -z "$dmake_full_package_name" ]; then
86 echo "can not find the dmake package"
87 exit
88 fi
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +000089 if test "$GUI" = "WNT"; then
90 dmake_full_package_name=`cygpath -u "$dmake_full_package_name"`
91 fi
92 echo "unpacking $dmake_full_package_name"
93
94 # Unpack it.
95 case $dmake_package_name in
96 *.tar.gz)
97 tar -xzf "$dmake_full_package_name"
98 dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.gz\)//"`
99 ;;
100 *.tgz)
101 tar -xzf "$dmake_full_package_name"
102 dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tgz\)//"`
103 ;;
104 *.tar.bz2)
105 tar -xjf "$dmake_full_package_name"
106 dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.bz2\)//"`
107 ;;
108 *.zip)
109 unzip "$dmake_full_package_name"
110 dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.zip\)//"`
111 ;;
112 *)
113 echo "can not unpack the dmake source"
114 dmake_directory_name=
115 exit 1
Matthias Seidel3f05aa82018-03-27 20:24:08 +0000116 ;;
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000117 esac
118
119 echo "entering $dmake_directory_name"
120 cd "$dmake_directory_name" || exit
121
122 # Special case! The w32/tcsh build needs CC pointing to the MSVC++ compiler
123 # but we need a cygwin/gcc build dmake to understand the posix paths
124 if test "$GUI" = "WNT"; then
125 CC=""
126 CXX=""
127 export CC
128 export CXX
129 DMAKE_CONF="--enable-spawn"
130 else
131 DMAKE_CONF=""
132 fi
133
134 # For unixy systems
135 if test -f "Makefile" ; then
136 $GNUMAKE distclean || exit
137 fi
138
Matthias Seidel3f05aa82018-03-27 20:24:08 +0000139 # config.guess and config.sub for dmake are too old, overwrite with ours:
Damjan Jovanovic229b54c2018-03-04 06:52:50 +0000140 cp $SOLARSRC/config.guess .
Matthias Seidel3f05aa82018-03-27 20:24:08 +0000141 cp $SOLARSRC/config.sub .
Damjan Jovanovic229b54c2018-03-04 06:52:50 +0000142
143 # We also need to patch dmake for Win64
144 patch -p0 < $SOLARSRC/solenv/src/dmake-cygwin64.patch
145
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000146 ./configure $DMAKE_CONF || exit
Matthias Seidel3f05aa82018-03-27 20:24:08 +0000147
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000148 ## invoke the gnu make command set by configure.
149 $GNUMAKE || exit
150
151
152 # Deploy the dmake executable to solenv
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000153 cp -f "$tmp_build_dir/$dmake_directory_name/dmake$EXEEXT" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000154 echo ""
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000155 echo "dmake successfully built and copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000156 echo ""
157
Matthias Seidel3f05aa82018-03-27 20:24:08 +0000158 # Clean up. Note that this is skipped when one of the exits is executed above.
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000159 rm -rf "$tmp_build_dir"
160
Ariel Constenla-Haile70010c22011-11-23 18:41:20 +0000161elif test "$IS_SYSTEM_DMAKE" = "YES"; then
162
163 echo ""
164 echo "dmake is located in search path"
165 echo ""
166
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000167elif test -n "$DMAKE_PATH" -a -x "$DMAKE_PATH" -a ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
Ariel Constenla-Haile70010c22011-11-23 18:41:20 +0000168
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000169 cp -f "$DMAKE_PATH" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit
Ariel Constenla-Haile70010c22011-11-23 18:41:20 +0000170
171 echo ""
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000172 echo "dmake copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
Ariel Constenla-Haile70010c22011-11-23 18:41:20 +0000173 echo ""
174
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000175else
176
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000177 if test -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000178 echo ""
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000179 echo "dmake present in $SOLARENV/$INPATH/bin/dmake$EXEEXT"
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000180 fi
181
182fi
Andre Fischer78cf8d52012-03-16 11:58:50 +0000183
184# Download missing extensions.
Ariel Constenla-Haile4fddf872012-10-06 01:43:58 +0000185"$PERL" "$SOLARENV/bin/download_missing_extensions.pl"