Dump unnecessary patch hunk
[LibreOffice.git] / download
blob33e515120e7e172804767397899d1fcdac592842
1 #!/bin/sh
2 #*************************************************************************
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 #
6 # Copyright 2000, 2010 Oracle and/or its affiliates.
8 # OpenOffice.org - a multi-platform office productivity suite
10 # This file is part of OpenOffice.org.
12 # OpenOffice.org is free software: you can redistribute it and/or modify
13 # it under the terms of the GNU Lesser General Public License version 3
14 # only, as published by the Free Software Foundation.
16 # OpenOffice.org is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU Lesser General Public License version 3 for more details
20 # (a copy is included in the LICENSE file that accompanied this code).
22 # You should have received a copy of the GNU Lesser General Public License
23 # version 3 along with OpenOffice.org. If not, see
24 # <http://www.openoffice.org/license.html>
25 # for a copy of the LGPLv3 License.
27 #*************************************************************************
29 # environment setup yet?
30 if [ -z "$TARFILE_LOCATION" ]; then
31 . ./Env.Host.sh
34 # we want to clone if we are in the bootstrap git repo and clone does not exist yet
35 # we need to test for a .git in order not to clone after rsync if we are called in
36 # the inner autogen of the buid-repo based build
38 check_file()
40 echo "Looking for $1 ..."
41 if test -f $1; then
42 echo "ok"
43 else
44 echo "missing required archive; run './download' again";
45 exit 1;
49 if [ -d .git ] ; then
50 if [ -z "$GIT_LINK_SRC" ]; then
51 ./g -f clone
52 else
53 # space-saving clone from another local workdir
54 mkdir clone
55 for i in $GIT_REPO_NAMES ; do
56 bin/git-new-workdir $GIT_LINK_SRC/$i clone/$i
57 for i in clone/$i/* ; do
58 ln -sfn $i $(basename $i)
59 done
60 done
64 if [ ! -d "$TARFILE_LOCATION" ]; then
65 mkdir $TARFILE_LOCATION
67 if [ ! -d "$TARFILE_LOCATION" ]; then
68 echo "Error: Cannot create $TARFILE_LOCATION."
69 exit 1
72 FILELIST="$1"
73 if [ -z "$FILELIST" ]; then
74 echo "No filelist provided, using the default ooo.lst."
75 FILELIST="ooo.lst"
78 # check for wget and md5sum
79 wget=
80 md5sum=
81 curl=`which curl 2>/dev/null`
83 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
84 eval "$i --version" > /dev/null 2>&1
85 ret=$?
86 if [ $ret -eq 0 ]; then
87 wget=$i
88 break
90 done
92 if [ -z "$wget" -a -z "$curl" ]; then
93 echo "ERROR: neither wget nor curl found!"
94 exit 1
97 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
98 if [ "$i" = "md5" ]; then
99 eval "$i -x" > /dev/null 2>&1
100 else
101 eval "$i --version" > /dev/null 2>&1
103 ret=$?
104 if [ $ret -eq 0 ]; then
105 md5sum=$i
106 break
108 done
110 if [ "$md5sum" = "md5" ]; then
111 if md5 -r < /dev/null > /dev/null 2>/dev/null; then
112 md5special=-r
113 elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
114 md5special=-n
118 if [ -z "$md5sum" ]; then
119 echo "Warning: no md5sum: found!"
122 start_dir=`pwd`
123 logfile=$TARFILE_LOCATION/fetch.log
124 date >> $logfile
126 downloaditem()
128 if [ "$1" != "" ]; then
129 if [ ! -f "../$2" ]; then
130 echo $2
131 if [ ! -z "$wget" ]; then
132 $wget --progress=dot:mega -N $1/$2 2>&1 | tee -a $logfile
133 else
134 echo fetching $2
135 $curl $file_date_check -O $1/$2 2>&1 | tee -a $logfile
137 wret=$?
138 if [ $wret -ne 0 ]; then
139 mv $2 ${i}_broken
140 failed="$failed $2"
141 wret=0
143 if [ -f $2 -a -n "$3" -a -n "$md5sum" ]; then
144 sum=`$md5sum $md5special $2 | sed "s/ .*//"`
145 if [ "$sum" != "$3" ]; then
146 echo checksum failure for $2 2>&1 | tee -a $logfile
147 failed="$failed $2"
148 mv $2 ${i}_broken
149 else
150 mv $2 ..
152 else
153 mv $2 ..
159 filelist=`cat $FILELIST`
160 mkdir -p $TARFILE_LOCATION/tmp
161 cd $TARFILE_LOCATION/tmp
162 echo $$ > fetch-running
163 for i in $filelist ; do
164 # echo $i
165 if [ "$i" != `echo $i | sed "s/^http:\///"` ]; then
166 tarurl=$i
167 # TODO: check for comment
168 else
169 if [ "$tarurl" != "" ]; then
170 sum=`echo $i | sed "s/-.*//"`
171 downloaditem $tarurl $i $sum
174 done
176 if [ "$COM" = "MSC" ]; then
177 downloaditem "http://download.microsoft.com/download/platformsdk/Redist/5.0.2195.1/W9XNT4/EN-US/" "dbghinst.EXE" "096f1d53d9ba09cde27d6f7c2ea6cc47"
178 downloaditem "http://download.microsoft.com/download/a/b/c/abc45517-97a0-4cee-a362-1957be2f24e1/" "WindowsXP-KB975337-x86-ENU.exe" "946d00d87e4094f3a6e425e2d538eadd"
180 msvcver=`$SRC_ROOT/oowintool --msvc-ver`
181 case "$msvcver" in
182 9.0)
183 downloaditem "http://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/" "vcredist_x86.exe" "35da2bf2befd998980a495b6f4f55e60"
184 downloaditem "http://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/" "vcredist_x64.exe" "e2ada570911edaaae7d1b3c979345fce"
188 esac
192 if [ -f $start_dir/bootstrap.ver -a ! -d $start_dir/.git ] ; then
193 # bootstrap is from sources, so get the other source tarballs
194 . $start_dir/bootstrap.ver
195 lo_src_dir="$start_dir/src"
196 mkdir -p "$lo_src_dir"
197 for piece in `cat $start_dir/bin/repo-list` ; do
198 tarname="libreoffice-$piece-$lo_bootstrap_ver"
199 if [ ! -f "$TARFILE_LOCATION/$tarname.tar.bz2" ] ; then
200 downloaditem "http://download.documentfoundation.org/libreoffice/src/" "$tarname.tar.bz2" ""
202 $start_dir/bin/unpack-sources $start_dir $TARFILE_LOCATION/$tarname.tar.bz2
203 done
206 rm $TARFILE_LOCATION/tmp/*-*
207 cd $start_dir
209 if [ ! -z "$failed" ]; then
210 echo
211 echo ERROR: failed on:
212 for i in $failed ; do
213 echo $i
214 done
215 exit 1
218 if [ "$COM" = "MSC" -a -n "$md5sum" ]; then
219 # This can be run only on Windows itself (Cygwin)
220 TMPUNPACK=`cygpath -d $TARFILE_LOCATION/tmp`
221 chmod a+w $TARFILE_LOCATION/tmp
222 if [ ! -f ./external/dbghelp/dbghelp.dll -a -f $TARFILE_LOCATION/dbghinst.EXE ]; then
223 if [ ! -x $TARFILE_LOCATION/dbghinst.EXE ]; then
224 chmod +x $TARFILE_LOCATION/dbghinst.EXE
226 $TARFILE_LOCATION/dbghinst.EXE /T:$TMPUNPACK /C
227 sum=`$md5sum $md5special $TARFILE_LOCATION/tmp/dbghelp.exe | sed "s/ .*//"`
228 if [ "$sum" = "cd3086a91e37965dd761ef5fd5df5b15" ]; then
229 unzip -LL -j -o -d ./external/dbghelp $TARFILE_LOCATION/tmp/dbghelp.exe
232 if [ ! -f ./external/gdiplus/gdiplus.dll -a -f $TARFILE_LOCATION/WindowsXP-KB975337-x86-ENU.exe ]; then
233 gdiplus_dll_path=asms/10/msft/windows/gdiplus/gdiplus.dll
235 # Run it through cmd so that the UAC prompt is displayed
236 echo
237 echo "NOTE: We are running the Microsoft KB975337 security fix installer"
238 echo "to get gdiplus.dll. You will most probably get a UAC prompt now."
239 echo "If you trust us, just enter your administrator password."
240 echo "The security fix is run with the /extract switch to just unpack"
241 echo "its files."
242 echo "If you don't trust us, just get gdiplus.dll yourself and put it"
243 echo "in external/gdiplus/gdiplus.dll."
244 echo "gdiplus.dll is included in the LibreOffice installer for the benefit of"
245 echo "Windows 2000 users."
246 # A few empty lines so that the above is visible even if the taskbar's auto-hide is turned on,
247 # and the UAC prompt caused it to taise (with a blinking icon for the UAC prompt)
248 echo
249 echo
250 echo
251 cmd /c "`cygpath -d $TARFILE_LOCATION/WindowsXP-KB975337-x86-ENU.exe` /extract:$TMPUNPACK /q"
252 if [ -f $TARFILE_LOCATION/tmp/$gdiplus_dll_path ]; then
253 echo "Extraction succeeded"
254 sum=`$md5sum $md5special $TARFILE_LOCATION/tmp/$gdiplus_dll_path | sed "s/ .*//"`
255 if [ "$sum" = "4721ab485e0c29cd1617a5f296b9cc47" ]; then
256 cp $TARFILE_LOCATION/tmp/$gdiplus_dll_path ./external/gdiplus/gdiplus.dll
257 else
258 echo "But unexpected checksum of $gdiplus_dll_path"
260 else
261 echo "WindowsXP-KB975337-x86-ENU.exe did not unpack the expected $gdiplus_dll_path"
264 if [ ! -f ./external/vcredist/vcredist_x86.exe -a -f $TARFILE_LOCATION/vcredist_x86.exe ]; then
265 cp $TARFILE_LOCATION/vcredist_x86.exe ./external/vcredist/vcredist_x86.exe
267 if [ ! -f ./external/vcredist/vcredist_x64.exe -a -f $TARFILE_LOCATION/vcredist_x64.exe ]; then
268 cp $TARFILE_LOCATION/vcredist_x64.exe ./external/vcredist/vcredist_x64.exe
272 # OxygenOffice extras
273 for pack in $OOOP_FONTS_PACK $OOOP_GALLERY_PACK $OOOP_SAMPLES_PACK $OOOP_TEMPLATES_PACK ; do
274 check_file $TARFILE_LOCATION/$pack
275 echo "Unpacking OxygenOffice extra '$pack' ..."
276 unzip -o -q $TARFILE_LOCATION/$pack -d $SRC_ROOT/extras/source
277 done
279 # Extensions copy
280 for pack in $BARCODE_EXTENSION_PACK $DIAGRAM_EXTENSION_PACK $VALIDATOR_EXTENSION_PACK $WATCH_WINDOW_EXTENSION_PACK $NUMBERTEXT_EXTENSION_PACK $HUNART_EXTENSION_PACK $TYPO_EXTENSION_PACK $GOOGLE_DOCS_EXTENSION_PACK $OOOBLOGGER_EXTENSION_PACK $LIGHTPROOF_HU_PACK $LIGHTPROOF_RU_PACK $LIGHTPROOF_EN_US_PACK $SUNTEMPLATES_DE_PACK $SUNTEMPLATES_EN_US_PACK $SUNTEMPLATES_ES_PACK $SUNTEMPLATES_FR_PACK $SUNTEMPLATES_HU_PACK $SUNTEMPLATES_IT_PACK; do
281 check_file $TARFILE_LOCATION/$pack
282 packfilename=`echo "$pack" | cut -f 2- -s -d - | cut -f 1 -d _`
283 echo "Copy extension: '$pack' as '$packfilename.oxt' ..."
284 mkdir -p $SRC_ROOT/extras/source/extensions/ || exit 1
285 cp $TARFILE_LOCATION/$pack $SRC_ROOT/extras/source/extensions/$packfilename.oxt || exit 1
286 done
288 [ -x "post_download" ] || { echo "'post_download' script not found, run ./autogen.sh." ; exit 1 ; }
290 # Save the config.log from the main configure script
291 # and restore it after running post_download.
292 mv config.log config.log.save
294 ./post_download --build=$BUILD_PLATFORM --host=$HOST_PLATFORM
295 post_download_status=$?
297 test -f config.log && mv config.log post_download.log
298 mv config.log.save config.log
300 exit $post_download_status
302 # Local Variables:
303 # tab-width: 4
304 # indent-tabs-mode: nil
305 # End:
307 # vim:set shiftwidth=4 softtabstop=4 expandtab: