xref: /aoo42x/main/bootstrap.1 (revision a6ff3988)
1
2# executables are *.exe for WNT. This variable is necessary since Cygwin 1.5.x
3# Use spawn instead of fork when building dmake on cygwin.
4if test "$GUI" = "WNT"; then
5    EXEEXT=".exe"
6else
7    EXEEXT=""
8fi
9export EXEEXT
10
11mkdir -p "$SOLARENV/$OUTPATH/bin"
12
13#make sure build.pl is executable
14
15chmod +x "$SRC_ROOT/solenv/bin/build.pl"
16chmod +x "$SRC_ROOT/solenv/bin/build_client.pl"
17chmod +x "$SRC_ROOT/solenv/bin/zipdep.pl"
18chmod +x "$SRC_ROOT/solenv/bin/gccinstlib.pl"
19
20# fetch or update external tarballs
21if [ "$DO_FETCH_TARBALLS" = "yes" ]; then
22	$SRC_ROOT/fetch_tarballs.sh $SRC_ROOT/ooo.lst
23fi
24
25# ------------------------------------------------------------------------------
26# Build dmake
27
28if test -n "$DMAKE_URL" -a  ! -x "$SOLARENV/$OUTPATH/bin/dmake$EXEEXT"; then
29
30    # Assume that the dmake archive has been downloaded by fetch_tarballs.sh
31    # Determine the name of the downloaded file.
32    dmake_package_name=`echo $DMAKE_URL | sed "s/^\(.*\/\)//"`
33
34    tmp_build_dir="$SOLARENV/$OUTPATH/misc/build/"
35    echo "making and entering $tmp_build_dir"
36    # Clean up any residues from a previous and unsuccessful build.
37    rm -rf "$tmp_build_dir"
38    mkdir -p "$tmp_build_dir"
39    cd "$tmp_build_dir" || exit
40
41    dmake_full_package_name=$(find $TARFILE_LOCATION -type f -name "*-$dmake_package_name")
42    if [ -z "$dmake_full_package_name" ]; then
43        echo "can not find the dmake package"
44        exit
45    fi
46    if test "$GUI" = "WNT"; then
47        dmake_full_package_name=`cygpath -u "$dmake_full_package_name"`
48    fi
49    echo "unpacking $dmake_full_package_name"
50
51    # Unpack it.
52    case $dmake_package_name in
53        *.tar.gz)
54            tar -xzf "$dmake_full_package_name"
55            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.gz\)//"`
56            ;;
57        *.tgz)
58            tar -xzf "$dmake_full_package_name"
59            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tgz\)//"`
60            ;;
61        *.tar.bz2)
62            tar -xjf "$dmake_full_package_name"
63            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.tar.bz2\)//"`
64            ;;
65        *.zip)
66            unzip "$dmake_full_package_name"
67            dmake_directory_name=`echo $dmake_package_name | sed "s/\(\.zip\)//"`
68            ;;
69        *)
70            echo "can not unpack the dmake source"
71            dmake_directory_name=
72            exit 1
73            ;;
74    esac
75
76    echo "entering $dmake_directory_name"
77    cd "$dmake_directory_name" || exit
78
79    # Special case! The w32/tcsh build needs CC pointing to the MSVC++ compiler
80    # but we need a cygwin/gcc build dmake to understand the posix paths
81    if test "$GUI" = "WNT"; then
82        CC=""
83        CXX=""
84        export CC
85        export CXX
86        DMAKE_CONF="--enable-spawn"
87    else
88        DMAKE_CONF=""
89    fi
90
91    # For unixy systems
92    if test -f "Makefile" ; then
93        $GNUMAKE distclean || exit
94    fi
95
96    ./configure $DMAKE_CONF || exit
97
98    ## invoke the gnu make command set by configure.
99    $GNUMAKE || exit
100
101
102    # Deploy the dmake executable to solenv
103    cp -f "$tmp_build_dir/$dmake_directory_name/dmake$EXEEXT" "$SOLARENV/$OUTPATH/bin/dmake$EXEEXT" || exit
104    echo ""
105    echo "dmake successfully built and copied to $SOLARENV/$OUTPATH/bin/dmake$EXEEXT"
106    echo ""
107
108    # Clean up.  Note that this is skipped when one of the exits is executed above.
109    rm -rf "$tmp_build_dir"
110
111elif test "$IS_SYSTEM_DMAKE" = "YES"; then
112
113    echo ""
114    echo "dmake is located in search path"
115    echo ""
116
117elif test -n "$DMAKE_PATH" -a -x "$DMAKE_PATH" -a  ! -x "$SOLARENV/$OUTPATH/bin/dmake$EXEEXT"; then
118
119    cp -f "$DMAKE_PATH" "$SOLARENV/$OUTPATH/bin/dmake$EXEEXT" || exit
120
121    echo ""
122    echo "dmake copied to $SOLARENV/$OUTPATH/bin/dmake$EXEEXT"
123    echo ""
124
125else
126
127    if test -x "$SOLARENV/$OUTPATH/bin/dmake$EXEEXT"; then
128        echo ""
129        echo "dmake present in $SOLARENV/$OUTPATH/bin/dmake$EXEEXT"
130    fi
131
132fi
133