summaryrefslogtreecommitdiff
path: root/bootstrap.1
blob: 2b2ce734056723e0bb28d31fd104b90d876ac154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# *************************************************************
#  
#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you under the Apache License, Version 2.0 (the
#  "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#  
#    http://www.apache.org/licenses/LICENSE-2.0
#  
#  Unless required by applicable law or agreed to in writing,
#  software distributed under the License is distributed on an
#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#  KIND, either express or implied.  See the License for the
#  specific language governing permissions and limitations
#  under the License.
#  
# *************************************************************

# executables are *.exe for WNT. This variable is necessary since Cygwin 1.5.x
# Use spawn instead of fork when building dmake on cygwin. 
if test "$GUI" = "WNT"; then
    EXEEXT=".exe"
else
    EXEEXT=""
fi
export EXEEXT

mkdir -p "$SOLARENV/$INPATH/bin"

#make sure build.pl is executable 

chmod +x "$SRC_ROOT/solenv/bin/build.pl"
chmod +x "$SRC_ROOT/solenv/bin/build_client.pl"
chmod +x "$SRC_ROOT/solenv/bin/zipdep.pl"
chmod +x "$SRC_ROOT/solenv/bin/gccinstlib.pl"

# fetch or update external tarballs
if [ "$DO_FETCH_TARBALLS" = "yes" ]; then
    "$PERL" "$SOLARENV/bin/download_external_dependencies.pl" $SRC_ROOT/external_deps.lst
fi

# ------------------------------------------------------------------------------
# Build dmake

if test -n "$DMAKE_URL" -a  ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then

    # Assume that the dmake archive has been downloaded by fetch_tarballs.sh
    # Determine the name of the downloaded file.
    dmake_package_name=`echo $DMAKE_URL | sed "s/^\(.*\/\)//"`

    tmp_build_dir="$SOLARENV/$INPATH/misc/build/"
    echo "making and entering $tmp_build_dir"
    # Clean up any residues from a previous and unsuccessful build.
    rm -rf "$tmp_build_dir"
    mkdir -p "$tmp_build_dir"
    cd "$tmp_build_dir" || exit

    dmake_full_package_name=$(find $TARFILE_LOCATION -type f -name "*-$dmake_package_name")
    if [ -z "$dmake_full_package_name" ]; then
        echo "can not find the dmake package"
        exit
    fi
    if test "$GUI" = "WNT"; then
        dmake_full_package_name=`cygpath -u "$dmake_full_package_name"`
    fi
    echo "unpacking $dmake_full_package_name"

    # Unpack it.
    case $dmake_package_name in
        *.tar.gz)
            tar -xzf "$dmake_full_package_name"
            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.gz\)//"`
            ;;
        *.tgz)
            tar -xzf "$dmake_full_package_name"
            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tgz\)//"`
            ;;
        *.tar.bz2)
            tar -xjf "$dmake_full_package_name"
            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.bz2\)//"`
            ;;
        *.zip)
            unzip "$dmake_full_package_name"
            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.zip\)//"`
            ;;
        *)
            echo "can not unpack the dmake source"
            dmake_directory_name=
            exit 1
            ;;        
    esac

    echo "entering $dmake_directory_name"
    cd "$dmake_directory_name" || exit

    # Special case! The w32/tcsh build needs CC pointing to the MSVC++ compiler
    # but we need a cygwin/gcc build dmake to understand the posix paths
    if test "$GUI" = "WNT"; then
        CC=""
        CXX=""
        export CC
        export CXX
        DMAKE_CONF="--enable-spawn"
    else
        DMAKE_CONF=""
    fi

    # For unixy systems
    if test -f "Makefile" ; then
        $GNUMAKE distclean || exit
    fi

    ./configure $DMAKE_CONF || exit
        
    ## invoke the gnu make command set by configure.
    $GNUMAKE || exit


    # Deploy the dmake executable to solenv
    cp -f "$tmp_build_dir/$dmake_directory_name/dmake$EXEEXT" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit
    echo ""
    echo "dmake successfully built and copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
    echo ""

    # Clean up.  Note that this is skipped when one of the exits is executed above.
    rm -rf "$tmp_build_dir"

elif test "$IS_SYSTEM_DMAKE" = "YES"; then

    echo ""
    echo "dmake is located in search path"
    echo ""

elif test -n "$DMAKE_PATH" -a -x "$DMAKE_PATH" -a  ! -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then

    cp -f "$DMAKE_PATH" "$SOLARENV/$INPATH/bin/dmake$EXEEXT" || exit

    echo ""
    echo "dmake copied to $SOLARENV/$INPATH/bin/dmake$EXEEXT"
    echo ""

else

    if test -x "$SOLARENV/$INPATH/bin/dmake$EXEEXT"; then
        echo ""
        echo "dmake present in $SOLARENV/$INPATH/bin/dmake$EXEEXT"
    fi
    
fi

# Download missing extensions.
"$PERL" "$SOLARENV/bin/download_missing_extensions.pl"