summaryrefslogtreecommitdiff
path: root/bootstrap.1
blob: 9e84c27b083686e104e4829f66c60b4f7312e7e6 (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

# 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/$OUTPATH/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
	$SRC_ROOT/fetch_tarballs.sh $SRC_ROOT/ooo.lst
fi

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

if test -n "$DMAKE_URL" -a  ! -x "$SOLARENV/$OUTPATH/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/$OUTPATH/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="$TARFILE_LOCATION/$dmake_package_name"
    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/$OUTPATH/bin/dmake$EXEEXT" || exit
    echo ""
    echo "dmake successfully built and copied to $SOLARENV/$OUTPATH/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/$OUTPATH/bin/dmake$EXEEXT"; then

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

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

else

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