6a0ba09f19
As reported on list, may fail with weird wget config files... Change-Id: I258809c3488181dcc7584f5349930287dfacb7b8
315 lines
10 KiB
Bash
Executable file
315 lines
10 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#*************************************************************************
|
|
#
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
#
|
|
# Copyright 2000, 2010 Oracle and/or its affiliates.
|
|
#
|
|
# OpenOffice.org - a multi-platform office productivity suite
|
|
#
|
|
# This file is part of OpenOffice.org.
|
|
#
|
|
# OpenOffice.org is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Lesser General Public License version 3
|
|
# only, as published by the Free Software Foundation.
|
|
#
|
|
# OpenOffice.org is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Lesser General Public License version 3 for more details
|
|
# (a copy is included in the LICENSE file that accompanied this code).
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public License
|
|
# version 3 along with OpenOffice.org. If not, see
|
|
# <http://www.openoffice.org/license.html>
|
|
# for a copy of the LGPLv3 License.
|
|
#
|
|
#*************************************************************************
|
|
|
|
set -o pipefail
|
|
|
|
# environment setup yet?
|
|
if [ -z "$TARFILE_LOCATION" ]; then
|
|
. ./config_host.mk.source
|
|
fi
|
|
|
|
# we want to clone if we are in the bootstrap git repo and clone does not exist yet
|
|
# we need to test for a .git in order not to clone after rsync if we are called in
|
|
# the inner autogen of the buid-repo based build
|
|
|
|
check_file()
|
|
{
|
|
echo "Looking for $1 ..."
|
|
if test -f $1; then
|
|
echo "ok"
|
|
else
|
|
echo "missing required archive; run './download' again";
|
|
exit 1;
|
|
fi
|
|
}
|
|
|
|
if [ -d .git ] ; then
|
|
if [ -z "$GIT_LINK_SRC" ]; then
|
|
./g -f clone
|
|
else
|
|
echo "FIXME: GIT_LINK_SRC method is not yet implemented with submodules" 1>&2
|
|
# space-saving clone from another local workdir
|
|
for i in $GIT_NEEDED_SUBMODULES ; do
|
|
rm -r $i
|
|
cp -R $GIT_LINK_SRC/$i $i
|
|
# bin/git-new-workdir $GIT_LINK_SRC/$i $i
|
|
done
|
|
git submodule update $GIT_NEEDED_SUBMODULES
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d "$TARFILE_LOCATION" ]; then
|
|
mkdir $TARFILE_LOCATION
|
|
fi
|
|
if [ ! -d "$TARFILE_LOCATION" ]; then
|
|
echo "Error: Cannot create $TARFILE_LOCATION."
|
|
exit 1
|
|
fi
|
|
|
|
FILELIST="$1"
|
|
if [ -z "$FILELIST" ]; then
|
|
echo "No filelist provided, using the default ooo.lst."
|
|
FILELIST="ooo.lst"
|
|
fi
|
|
|
|
# check for wget and md5sum
|
|
wget=
|
|
md5sum=
|
|
curl=`which curl 2>/dev/null`
|
|
|
|
for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
|
|
eval "$i --version" > /dev/null 2>&1
|
|
ret=$?
|
|
if [ $ret -eq 0 ]; then
|
|
wget=$i
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [ -z "$wget" -a -z "$curl" ]; then
|
|
echo "ERROR: neither wget nor curl found!"
|
|
exit 1
|
|
fi
|
|
|
|
for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
|
|
if [ "$i" = "md5" ]; then
|
|
eval "$i -x" > /dev/null 2>&1
|
|
else
|
|
eval "$i --version" > /dev/null 2>&1
|
|
fi
|
|
ret=$?
|
|
if [ $ret -eq 0 ]; then
|
|
md5sum=$i
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [ "$md5sum" = "md5" ]; then
|
|
if md5 -r < /dev/null > /dev/null 2>/dev/null; then
|
|
md5special=-r
|
|
elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
|
|
md5special=-n
|
|
fi
|
|
fi
|
|
|
|
if [ -z "$md5sum" ]; then
|
|
echo "Warning: no md5sum: found!"
|
|
fi
|
|
|
|
start_dir=`pwd`
|
|
logfile=$TARFILE_LOCATION/fetch.log
|
|
date >> $logfile
|
|
|
|
downloaditem()
|
|
{
|
|
if [ "$1" != "" ]; then
|
|
if [ ! -f "../$2" ]; then
|
|
echo $2
|
|
if [ ! -z "$wget" ]; then
|
|
$wget --progress=dot:mega -N $1/$2 2>&1 | tee -a $logfile
|
|
else
|
|
echo fetching $2
|
|
$curl $file_date_check -O $1/$2 2>&1 | tee -a $logfile
|
|
fi
|
|
wret=$?
|
|
if [ $wret -ne 0 ]; then
|
|
mv $2 ${i}_broken
|
|
failed="$failed $2"
|
|
wret=0
|
|
fi
|
|
if [ -f $2 -a -n "$3" -a -n "$md5sum" ]; then
|
|
sum=`$md5sum $md5special $2 | sed "s/ .*//"`
|
|
if [ "$sum" != "$3" ]; then
|
|
echo checksum failure for $2 2>&1 | tee -a $logfile
|
|
failed="$failed $2"
|
|
mv $2 ${i}_broken
|
|
else
|
|
mv $2 ..
|
|
if [ $? -ne 0 ]; then
|
|
echo cannot mv $2 to destination 2>&1 | tee -a $logfile
|
|
failed="$failed $2"
|
|
fi
|
|
fi
|
|
else
|
|
mv $2 ..
|
|
if [ $? -ne 0 ]; then
|
|
echo cannot mv $2 to destination 2>&1 | tee -a $logfile
|
|
failed="$failed $2"
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
}
|
|
|
|
filelist=`cat $FILELIST`
|
|
mkdir -p $TARFILE_LOCATION/tmp
|
|
cd $TARFILE_LOCATION/tmp
|
|
echo $$ > fetch-running
|
|
for i in $filelist ; do
|
|
# echo $i
|
|
if [ "$i" != `echo $i | sed "s/^http:\///"` ]; then
|
|
tarurl=$i
|
|
# TODO: check for comment
|
|
else
|
|
if [ "$tarurl" != "" ]; then
|
|
sum=`echo $i | sed "s/-.*//"`
|
|
downloaditem $tarurl $i $sum
|
|
fi
|
|
fi
|
|
done
|
|
|
|
if [ "$COM" = "MSC" ]; then
|
|
downloaditem "http://download.microsoft.com/download/E/9/F/E9FCA9E9-9908-4D8F-B491-8E8A4C294C01/" "WindowsXP-KB958911-x86-ENU.exe" "ff084c5815b0672d54628158b820f5b1"
|
|
fi
|
|
|
|
if [ -f $start_dir/sources.ver -a ! -d $start_dir/.git ] ; then
|
|
# these sources are from a tarball, so get the other source tarballs
|
|
. $start_dir/sources.ver
|
|
# sources are put into "major.minor.micro" version directory on the dowload site, e.g. "3.5.2"
|
|
lo_bugfix_release_sources_ver=`echo $lo_sources_ver | sed -e "s/\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/"`
|
|
lo_src_dir="$start_dir/src"
|
|
mkdir -p "$lo_src_dir"
|
|
for piece in $GIT_NEEDED_SUBMODULES ; do
|
|
if [ "helpcontent2" = "$piece" ] ; then piece="help"; fi
|
|
tarname="libreoffice-$piece-$lo_sources_ver"
|
|
if [ ! -f "$TARFILE_LOCATION/$tarname.tar.xz" ] ; then
|
|
downloaditem "http://download.documentfoundation.org/libreoffice/src/$lo_bugfix_release_sources_ver" "$tarname.tar.xz" ""
|
|
fi
|
|
$start_dir/bin/unpack-sources $start_dir $TARFILE_LOCATION/$tarname.tar.xz
|
|
done
|
|
fi
|
|
|
|
rm $TARFILE_LOCATION/tmp/*-*
|
|
cd $start_dir
|
|
|
|
if [ ! -z "$failed" ]; then
|
|
echo
|
|
echo ERROR: failed on:
|
|
for i in $failed ; do
|
|
echo $i
|
|
done
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$COM" = "MSC" -a "$CPUNAME" = "INTEL" ]; then
|
|
|
|
# Windows builds need dbghelp.dll in external/dbghelp/
|
|
if [ ! -f ./external/dbghelp/dbghelp.dll -a -f $TARFILE_LOCATION/$DBGHELP_DLL ]; then
|
|
cp $TARFILE_LOCATION/$DBGHELP_DLL ./external/dbghelp/dbghelp.dll
|
|
fi
|
|
if [ ! -f ./external/dbghelp/dbghelp.dll ]; then
|
|
echo "dbghelp.dll is missing in external/dbghelp/."
|
|
echo "Get it from the Microsoft site and put it there."
|
|
echo "(Note: Microsoft seems to enjoy changing the exact location of this file."
|
|
echo "You may have to search Microsoft's website.) Last time it was seen at:"
|
|
echo "<http://www.microsoft.com/downloads/release.asp?releaseid=30682>."
|
|
exit 1
|
|
fi
|
|
|
|
# Windows builds need gdiplus.dll in external/gdiplus/
|
|
if [ ! -f ./external/gdiplus/gdiplus.dll -a -f $TARFILE_LOCATION/WindowsXP-KB958911-x86-ENU.exe -a -n "$md5sum" ]; then
|
|
# This can be run only on Windows itself (Cygwin)
|
|
TMPUNPACK=`cygpath -d $TARFILE_LOCATION/tmp`
|
|
chmod a+w $TARFILE_LOCATION/tmp
|
|
gdiplus_dll_path=SP3QFE/asms/10/msft/windows/gdiplus/gdiplus.dll
|
|
chmod +x $TARFILE_LOCATION/WindowsXP-KB958911-x86-ENU.exe
|
|
|
|
# Run it through cmd so that the UAC prompt is displayed
|
|
echo
|
|
echo "NOTE: We are running the Microsoft KB958911 security fix installer"
|
|
echo "to get gdiplus.dll. You will most probably get a UAC prompt now."
|
|
echo "If you trust us, just enter your administrator password."
|
|
echo "The security fix is run with the /extract switch to just unpack"
|
|
echo "its files."
|
|
echo "If you don't trust us, just get gdiplus.dll yourself and put it"
|
|
echo "in external/gdiplus/gdiplus.dll."
|
|
echo "gdiplus.dll is included in the LibreOffice installer for the benefit of"
|
|
echo "Windows 2000 users."
|
|
# A few empty lines so that the above is visible even if the taskbar's auto-hide is turned on,
|
|
# and the UAC prompt caused it to taise (with a blinking icon for the UAC prompt)
|
|
echo
|
|
echo
|
|
echo
|
|
cmd /c "`cygpath -w $TARFILE_LOCATION/WindowsXP-KB958911-x86-ENU.exe` /extract:$TMPUNPACK /q"
|
|
if [ -f $TARFILE_LOCATION/tmp/$gdiplus_dll_path ]; then
|
|
echo "Extraction succeeded"
|
|
sum=`$md5sum $md5special $TARFILE_LOCATION/tmp/$gdiplus_dll_path | sed "s/ .*//"`
|
|
if [ "$sum" = "3a95b4d80a3586ab1e2f0c608608ebac" ]; then
|
|
cp $TARFILE_LOCATION/tmp/$gdiplus_dll_path ./external/gdiplus/gdiplus.dll
|
|
else
|
|
echo "But unexpected checksum of $gdiplus_dll_path"
|
|
fi
|
|
else
|
|
echo "WindowsXP-KB958911-x86-ENU.exe did not unpack the expected $gdiplus_dll_path"
|
|
fi
|
|
fi
|
|
if [ ! -f ./external/gdiplus/gdiplus.dll ]; then
|
|
echo "gdiplus.dll is missing in external/gdiplus/."
|
|
echo "Get it from the Microsoft site and put it there."
|
|
echo "You may have to search Microsoft's website. Last time it was seen at:"
|
|
echo "<http://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if [ "$COM" = "MSC" ]; then
|
|
if [ "$CPUNAME" = "INTEL" ]; then
|
|
ver=""
|
|
else
|
|
ver="-64"
|
|
fi
|
|
# use oowintool to copy CRT dlls and manifest
|
|
if ! ./oowintool --msvc-copy-dlls"$ver" ./external/msvcp ; then
|
|
echo "oowintool failed to copy CRT"
|
|
exit 1
|
|
fi
|
|
|
|
# use oowintool to copy VC redist merge modules
|
|
if ! ./oowintool --msvc-copy-msms"$ver" ./external/msm"$VCVER" ; then
|
|
echo "oowintool failed to copy merge modules"
|
|
exit 1
|
|
fi
|
|
if [ "$CPUNAME" = "INTEL" ]; then
|
|
if ! ./oowintool --msvc-copy-msms-64 ./external/msm"$VCVER" ; then
|
|
echo "WARNING: oowintool failed to copy x64 merge modules, installation will lack the 64-bit Explorer extension"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if [ -n "$OXYGENOFFICE_PACK" ] ; then
|
|
check_file $TARFILE_LOCATION/$OXYGENOFFICE_PACK
|
|
echo "Unpacking OxygenOffice '$OXYGENOFFICE_PACK' ..."
|
|
unzip -o -q $TARFILE_LOCATION/$OXYGENOFFICE_PACK -d $SRC_ROOT/src
|
|
fi
|
|
|
|
# Local Variables:
|
|
# tab-width: 4
|
|
# indent-tabs-mode: nil
|
|
# End:
|
|
|
|
# vim:set shiftwidth=4 softtabstop=4 expandtab:
|