summaryrefslogtreecommitdiff
path: root/bootstrap
blob: 6a2d69149a6453525b12c31d643b06dcb7d36e4b (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
#!/bin/sh

if test -z "${SRC_ROOT}"; then
    if test -f ./config_build.mk ; then
        sed -e 's/^\s*\(export [A-Z0-9_]*=\)\(.*\)$/\1"\2"/' <config_build.mk >config_build.mk.sh
        . ./config_build.mk.sh
        rm config_build.mk.sh
    else
        if test -f ./config_host.mk ; then
            sed -e 's/^\s*\(export [A-Z0-9_]*=\)\(.*\)$/\1"\2"/' <config_host.mk >config_host.mk.sh
            . ./config_host.mk.sh
            rm config_host.mk.sh
        fi
    fi
fi
if test -z "${SOLARENV}"; then
    echo "bootstrap: No environment set!"
    exit 1
fi

# 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 "$OS_FOR_BUILD" = "WNT"; then
    EXEEXT=".exe"
    DMAKE_CONF="--enable-spawn"
else
    EXEEXT=""
    DMAKE_CONF=""
fi
export EXEEXT

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

if test "$BUILD_DMAKE" != "NO"; then
    if test ! -x "$SRC_ROOT/dmake/dmake$EXEEXT"; then
        cd "$SRC_ROOT/dmake" || exit

        # If cross-compiling then don't use the cross compilers to build dmake.
        if test "$OS_FOR_BUILD" = "WNT"; then
            # Let the Cygwin gcc be found
            unset CC CXX AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
        elif test "$CROSS_COMPILING" = "YES"; then
            export CC="$CC_FOR_BUILD"
            export CXX="$CXX_FOR_BUILD"
            unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
        fi

        # For normal 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

        echo ""
        echo "dmake has been successfully built"

        cd ..
    else
        echo "dmake/dmake already built"
    fi
fi

mkdir -p "$SOLARENV/$OUTPATH_FOR_BUILD/bin"
if test "$BUILD_DMAKE" != "NO"; then
    cp -f "$SRC_ROOT/dmake/dmake$EXEEXT" "$SOLARENV/$OUTPATH_FOR_BUILD/bin" || exit
    echo ""
    echo "dmake copied to $SOLARENV/$OUTPATH_FOR_BUILD/bin/dmake$EXEEXT"
fi

#make sure build.pl is executable

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

# Local Variables:
# mode: shell-script
# tab-width: 4
# indent-tabs-mode: nil
# End:

# vim:set shiftwidth=4 softtabstop=4 expandtab: