Bump for 3.6-28
[LibreOffice.git] / download
blob99139ef94cc770478acb509ce67561c46101e31a
1 #!/usr/bin/env bash
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 set -o pipefail
31 # environment setup yet?
32 if [ -z "$TARFILE_LOCATION" ]; then
33 . ./config_host.mk
36 # we want to clone if we are in the bootstrap git repo and clone does not exist yet
37 # we need to test for a .git in order not to clone after rsync if we are called in
38 # the inner autogen of the buid-repo based build
40 check_file()
42 echo "Looking for $1 ..."
43 if test -f $1; then
44 echo "ok"
45 else
46 echo "missing required archive; run './download' again";
47 exit 1;
51 if [ -d .git ] ; then
52 if [ -z "$GIT_LINK_SRC" ]; then
53 ./g -f clone
54 else
55 # space-saving clone from another local workdir
56 mkdir clone
57 branch=$(git symbolic-ref HEAD | cut -d"/" -f 3)
58 for i in $GIT_REPO_NAMES ; do
59 bin/git-new-workdir $GIT_LINK_SRC/$i clone/$i $branch
60 for d in clone/$i/* ; do
61 if [ "${d}" != "clone/$i/git-hooks" ]; then
62 ln -sfn ${d} $(basename ${d})
64 done
65 done
69 if [ ! -d "$TARFILE_LOCATION" ]; then
70 mkdir $TARFILE_LOCATION
72 if [ ! -d "$TARFILE_LOCATION" ]; then
73 echo "Error: Cannot create $TARFILE_LOCATION."
74 exit 1
77 FILELIST="$1"
78 if [ -z "$FILELIST" ]; then
79 echo "No filelist provided, using the default ooo.lst."
80 FILELIST="ooo.lst"
83 # check for wget and md5sum
84 wget=
85 md5sum=
86 curl=`which curl 2>/dev/null`
88 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
89 eval "$i --version" > /dev/null 2>&1
90 ret=$?
91 if [ $ret -eq 0 ]; then
92 wget=$i
93 break
95 done
97 if [ -z "$wget" -a -z "$curl" ]; then
98 echo "ERROR: neither wget nor curl found!"
99 exit 1
102 for i in md5 md5sum /usr/local/bin/md5sum gmd5sum /usr/sfw/bin/md5sum /opt/sfw/bin/gmd5sum /opt/local/bin/md5sum; do
103 if [ "$i" = "md5" ]; then
104 eval "$i -x" > /dev/null 2>&1
105 else
106 eval "$i --version" > /dev/null 2>&1
108 ret=$?
109 if [ $ret -eq 0 ]; then
110 md5sum=$i
111 break
113 done
115 if [ "$md5sum" = "md5" ]; then
116 if md5 -r < /dev/null > /dev/null 2>/dev/null; then
117 md5special=-r
118 elif md5 -n < /dev/null > /dev/null 2>/dev/null; then
119 md5special=-n
123 if [ -z "$md5sum" ]; then
124 echo "Warning: no md5sum: found!"
127 start_dir=`pwd`
128 logfile=$TARFILE_LOCATION/fetch.log
129 date >> $logfile
131 downloaditem()
133 if [ "$1" != "" ]; then
134 if [ ! -f "../$2" ]; then
135 echo $2
136 if [ ! -z "$wget" ]; then
137 $wget --progress=dot:mega -N $1/$2 2>&1 | tee -a $logfile
138 else
139 echo fetching $2
140 $curl $file_date_check -O $1/$2 2>&1 | tee -a $logfile
142 wret=$?
143 if [ $wret -ne 0 ]; then
144 mv $2 ${i}_broken
145 failed="$failed $2"
146 wret=0
148 if [ -f $2 -a -n "$3" -a -n "$md5sum" ]; then
149 sum=`$md5sum $md5special $2 | sed "s/ .*//"`
150 if [ "$sum" != "$3" ]; then
151 echo checksum failure for $2 2>&1 | tee -a $logfile
152 failed="$failed $2"
153 mv $2 ${i}_broken
154 else
155 mv $2 ..
157 else
158 mv $2 ..
164 filelist=`cat $FILELIST`
165 mkdir -p $TARFILE_LOCATION/tmp
166 cd $TARFILE_LOCATION/tmp
167 echo $$ > fetch-running
168 for i in $filelist ; do
169 # echo $i
170 if [ "$i" != `echo $i | sed "s/^http:\///"` ]; then
171 tarurl=$i
172 # TODO: check for comment
173 else
174 if [ "$tarurl" != "" ]; then
175 sum=`echo $i | sed "s/-.*//"`
176 downloaditem $tarurl $i $sum
179 done
181 if [ "$COM" = "MSC" ]; then
182 downloaditem "http://download.microsoft.com/download/platformsdk/Redist/5.0.2195.1/W9XNT4/EN-US/" "dbghinst.EXE" "096f1d53d9ba09cde27d6f7c2ea6cc47"
183 downloaditem "http://download.microsoft.com/download/a/b/c/abc45517-97a0-4cee-a362-1957be2f24e1/" "WindowsXP-KB975337-x86-ENU.exe" "946d00d87e4094f3a6e425e2d538eadd"
186 if [ -f $start_dir/sources.ver -a ! -d $start_dir/.git ] ; then
187 # these sources are from a tarball, so get the other source tarballs
188 . $start_dir/sources.ver
189 # sources are put into "major.minor.micro" version directory on the dowload site, e.g. "3.5.2"
190 lo_bugfix_release_sources_ver=`echo $lo_sources_ver | sed -e "s/\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/"`
191 lo_src_dir="$start_dir/src"
192 mkdir -p "$lo_src_dir"
193 for piece in `cat $start_dir/bin/repo-list` ; do
194 tarname="libreoffice-$piece-$lo_sources_ver"
195 if [ ! -f "$TARFILE_LOCATION/$tarname.tar.xz" ] ; then
196 downloaditem "http://download.documentfoundation.org/libreoffice/src/$lo_bugfix_release_sources_ver" "$tarname.tar.xz" ""
198 $start_dir/bin/unpack-sources $start_dir $TARFILE_LOCATION/$tarname.tar.xz
199 done
202 rm $TARFILE_LOCATION/tmp/*-*
203 cd $start_dir
205 if [ ! -z "$failed" ]; then
206 echo
207 echo ERROR: failed on:
208 for i in $failed ; do
209 echo $i
210 done
211 exit 1
214 if [ "$COM" = "MSC" -a -n "$md5sum" ]; then
215 # This can be run only on Windows itself (Cygwin)
216 TMPUNPACK=`cygpath -d $TARFILE_LOCATION/tmp`
217 chmod a+w $TARFILE_LOCATION/tmp
218 if [ ! -f ./external/dbghelp/dbghelp.dll -a -f $TARFILE_LOCATION/dbghinst.EXE ]; then
219 if [ ! -x `cygpath $TARFILE_LOCATION`/dbghinst.EXE ]; then
220 chmod +x `cygpath $TARFILE_LOCATION`/dbghinst.EXE
222 $TARFILE_LOCATION/dbghinst.EXE /T:$TMPUNPACK /C
223 sum=`$md5sum $md5special $TARFILE_LOCATION/tmp/dbghelp.exe | sed "s/ .*//"`
224 if [ "$sum" = "cd3086a91e37965dd761ef5fd5df5b15" ]; then
225 unzip -LL -j -o -d ./external/dbghelp $TARFILE_LOCATION/tmp/dbghelp.exe
228 if [ ! -f ./external/gdiplus/gdiplus.dll -a -f $TARFILE_LOCATION/WindowsXP-KB975337-x86-ENU.exe ]; then
229 gdiplus_dll_path=asms/10/msft/windows/gdiplus/gdiplus.dll
230 chmod +x `cygpath $TARFILE_LOCATION`/WindowsXP-KB975337-x86-ENU.exe
232 # Run it through cmd so that the UAC prompt is displayed
233 echo
234 echo "NOTE: We are running the Microsoft KB975337 security fix installer"
235 echo "to get gdiplus.dll. You will most probably get a UAC prompt now."
236 echo "If you trust us, just enter your administrator password."
237 echo "The security fix is run with the /extract switch to just unpack"
238 echo "its files."
239 echo "If you don't trust us, just get gdiplus.dll yourself and put it"
240 echo "in external/gdiplus/gdiplus.dll."
241 echo "gdiplus.dll is included in the LibreOffice installer for the benefit of"
242 echo "Windows 2000 users."
243 # A few empty lines so that the above is visible even if the taskbar's auto-hide is turned on,
244 # and the UAC prompt caused it to taise (with a blinking icon for the UAC prompt)
245 echo
246 echo
247 echo
248 cmd /c "`cygpath -d $TARFILE_LOCATION/WindowsXP-KB975337-x86-ENU.exe` /extract:$TMPUNPACK /q"
249 if [ -f $TARFILE_LOCATION/tmp/$gdiplus_dll_path ]; then
250 echo "Extraction succeeded"
251 sum=`$md5sum $md5special $TARFILE_LOCATION/tmp/$gdiplus_dll_path | sed "s/ .*//"`
252 if [ "$sum" = "4721ab485e0c29cd1617a5f296b9cc47" ]; then
253 cp $TARFILE_LOCATION/tmp/$gdiplus_dll_path ./external/gdiplus/gdiplus.dll
254 else
255 echo "But unexpected checksum of $gdiplus_dll_path"
257 else
258 echo "WindowsXP-KB975337-x86-ENU.exe did not unpack the expected $gdiplus_dll_path"
263 # OxygenOffice extras
264 for pack in $OOOP_FONTS_PACK $OOOP_GALLERY_PACK $OOOP_SAMPLES_PACK $OOOP_TEMPLATES_PACK ; do
265 check_file $TARFILE_LOCATION/$pack
266 echo "Unpacking OxygenOffice extra '$pack' ..."
267 unzip -o -q $TARFILE_LOCATION/$pack -d $SRC_ROOT/extras/source
268 done
270 if [ "$OXYGENOFFICE_PACK" = "YES" ] ; then
271 check_file $TARFILE_LOCATION/$OXYGENOFFICE_PACK
272 echo "Unpacking OxygenOffice '$OXYGENOFFICE_PACK' ..."
273 unzip -o -q $TARFILE_LOCATION/$OXYGENOFFICE_PACK -d $SRC_ROOT/src
276 # Extensions copy
277 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 $SUNTEMPLATES_DE_PACK $SUNTEMPLATES_EN_US_PACK $SUNTEMPLATES_ES_PACK $SUNTEMPLATES_FR_PACK $SUNTEMPLATES_HU_PACK $SUNTEMPLATES_IT_PACK; do
278 check_file $TARFILE_LOCATION/$pack
279 packfilename=`echo "$pack" | cut -f 2- -s -d - | cut -f 1 -d _`
280 echo "Copy extension: '$pack' as '$packfilename.oxt' ..."
281 mkdir -p $SRC_ROOT/extras/source/extensions/ || exit 1
282 cp $TARFILE_LOCATION/$pack $SRC_ROOT/extras/source/extensions/$packfilename.oxt || exit 1
283 done
285 [ -x "post_download" ] || { echo "'post_download' script not found, run ./autogen.sh." ; exit 1 ; }
287 # Save the config.log from the main configure script
288 # and restore it after running post_download.
289 mv config.log config.log.save
291 ./post_download --build=$BUILD_PLATFORM --host=$HOST_PLATFORM
292 post_download_status=$?
294 test -f config.log && mv config.log post_download.log
295 mv config.log.save config.log
297 exit $post_download_status
299 # Local Variables:
300 # tab-width: 4
301 # indent-tabs-mode: nil
302 # End:
304 # vim:set shiftwidth=4 softtabstop=4 expandtab: