blob: 2b2ce734056723e0bb28d31fd104b90d876ac154 [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
Rüdiger Timm87840aa2003-12-01 16:38:25 +000022# executables are *.exe for WNT. This variable is necessary since Cygwin 1.5.x
Oliver Bolteafb4d612006-09-15 10:18:41 +000023# Use spawn instead of fork when building dmake on cygwin.
Kurt Zenker9647a332006-07-05 21:07:20 +000024if test "$GUI" = "WNT"; then
Vladimir Glazounovc64d4c52006-09-27 09:25:09 +000025 EXEEXT=".exe"
Rüdiger Timm87840aa2003-12-01 16:38:25 +000026else
Vladimir Glazounovc64d4c52006-09-27 09:25:09 +000027 EXEEXT=""
Kurt Zenker9647a332006-07-05 21:07:20 +000028fi
Kurt Zenkerb2ffa9c2006-07-19 08:36:10 +000029export EXEEXT
Jens-Heiner Rechtien11cb1ba2000-09-18 15:18:56 +000030
Ariel Constenla-Haile82079902012-06-10 19:59:43 +000031mkdir -p "$SOLARENV/$INPATH/bin"
Kurt Zenker9647a332006-07-05 21:07:20 +000032
33#make sure build.pl is executable
34
35chmod +x "$SRC_ROOT/solenv/bin/build.pl"
Kurt Zenker1c5de272007-05-09 12:26:54 +000036chmod +x "$SRC_ROOT/solenv/bin/build_client.pl"
Kurt Zenker9647a332006-07-05 21:07:20 +000037chmod +x "$SRC_ROOT/solenv/bin/zipdep.pl"
38chmod +x "$SRC_ROOT/solenv/bin/gccinstlib.pl"
Hans-Joachim Lankenaua9669262010-01-15 14:55:12 +010039
40# fetch or update external tarballs
41if [ "$DO_FETCH_TARBALLS" = "yes" ]; then
Ariel Constenla-Haile4fddf872012-10-06 01:43:58 +000042 "$PERL" "$SOLARENV/bin/download_external_dependencies.pl" $SRC_ROOT/external_deps.lst
Hans-Joachim Lankenaua9669262010-01-15 14:55:12 +010043fi
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +000044
45# ------------------------------------------------------------------------------
46# Build dmake
47
Ariel Constenla-Haile82079902012-06-10 19:59:43 +000048if test -n "$DMAKE_URL" -a ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +000049
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
Ariel Constenla-Haile82079902012-06-10 19:59:43 +000054 tmp_build_dir="$SOLARENV/$INPATH/misc/build/"
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +000055 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
Andre Fischerc5d97002011-12-02 09:39:29 +000061 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
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +000066 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
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000123 cp -f "$tmp_build_dir/$dmake_directory_name/dmake$EXEEXT" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000124 echo ""
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000125 echo "dmake successfully built and copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000126 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
Ariel Constenla-Haile70010c22011-11-23 18:41:20 +0000131elif test "$IS_SYSTEM_DMAKE" = "YES"; then
132
133 echo ""
134 echo "dmake is located in search path"
135 echo ""
136
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000137elif test -n "$DMAKE_PATH" -a -x "$DMAKE_PATH" -a ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
Ariel Constenla-Haile70010c22011-11-23 18:41:20 +0000138
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000139 cp -f "$DMAKE_PATH" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit
Ariel Constenla-Haile70010c22011-11-23 18:41:20 +0000140
141 echo ""
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000142 echo "dmake copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
Ariel Constenla-Haile70010c22011-11-23 18:41:20 +0000143 echo ""
144
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000145else
146
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000147 if test -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000148 echo ""
Ariel Constenla-Haile82079902012-06-10 19:59:43 +0000149 echo "dmake present in $SOLARENV/$INPATH/bin/dmake$EXEEXT"
Jürgen Schmidt5a16c1c2011-11-21 08:25:07 +0000150 fi
151
152fi
Andre Fischer78cf8d52012-03-16 11:58:50 +0000153
154# Download missing extensions.
Ariel Constenla-Haile4fddf872012-10-06 01:43:58 +0000155"$PERL" "$SOLARENV/bin/download_missing_extensions.pl"