[Libreoffice-commits] .: configure.in download.in
Christian Lohmaier
cloph at kemper.freedesktop.org
Fri Oct 8 20:44:07 PDT 2010
configure.in | 19 ++++--------
download.in | 87 ++++++++++++++++++++++++++++++++++++-----------------------
2 files changed, 61 insertions(+), 45 deletions(-)
New commits:
commit b1b47a6e122ea0d4045ecf8222593754db8ecbbb
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date: Sat Oct 9 05:42:40 2010 +0200
add support for downloading with curl
diff --git a/configure.in b/configure.in
index 42e70af..317423e 100644
--- a/configure.in
+++ b/configure.in
@@ -1115,7 +1115,7 @@ if test "z$with_gnu_tar" != "z"; then
if test -f $with_gnu_tar ; then
GNUTAR=$with_gnu_tar
else
- AC_MSG_ERROR([The file \"$with_gnu_tar\" does not exist.])
+ AC_MSG_ERROR([The file "$with_gnu_tar" does not exist.])
fi
else
AC_MSG_ERROR([--with-gnu-tar requires an absolute path])
@@ -1126,17 +1126,10 @@ fi
AC_MSG_RESULT([$GNUTAR])
AC_SUBST(GNUTAR)
-AC_PATH_PROG(WGET, wget)
-if test -z "$WGET"; then
- if test -f /usr/sfw/bin/wget; then
- WGET="/usr/sfw/bin/wget"
- fi
-fi
-if test -z "$WGET"; then
- AC_MSG_WARN([*** Configure could not reliably find wget on your system ! ***])
- AC_MSG_WARN([*** Downloading of source packages might fail ! ***])
+AC_PATH_PROGS(GET_CMD, [wget curl])
+if test -z "$GET_CMD" ; then
+ AC_MSG_ERROR([Neither "wget" nor "curl" found, but needed for download])
fi
-AC_SUBST(WGET)
AC_MSG_CHECKING([for favourite drink])
DRINK=tea
@@ -1808,7 +1801,7 @@ Building openoffice
widget sets: ${widget_sets:-disabled}
gcc to use: $gcc_to_use
openclipart: ${OPENCLIPART_VER:-${OPENCLIPART_DIR:-no}}
- mono bindings: $mono_enabled
+ mono bindings: $mono_enabled
mdbtools/access: $access_enabled
java: ${with_java:-yes}
ooo-install-dir: $OOOINSTALLDIRNAME
@@ -1819,6 +1812,7 @@ Building openoffice
cairo: $cairo_enabled
build type: $build_product build
ooo sources: $upstream_sources
+ get externals with: $GET_CMD
To build run:
$warn_use_download make
@@ -1862,3 +1856,4 @@ if test "$OOO_GIT" = "" ; then
Consider configuring via --with-git
"
fi
+# vim: set ts=4 sw=4 expandtab :
diff --git a/download.in b/download.in
index 1694389..ed63c30 100755
--- a/download.in
+++ b/download.in
@@ -2,16 +2,46 @@
use Switch;
use File::Temp qw/ tempfile tempdir /;
+sub download($$$$) {
+ my ($remote, $destdir, $targetfile, $extract) = @_;
+
+ my $GET_CMD='@GET_CMD@';
+ # option to specify output-filename (or to use remote name)
+ my $set_output = "";
+ if ($targetfile) {
+ if ($GET_CMD =~ /curl$/) {
+ $set_output = "-o \"$targetfile\"";
+ } else {
+ $set_output = "-O \"$targetfile\"";
+ }
+ } elsif ($GET_CMD =~ /curl$/) {
+ $set_output = "-O";
+ }
+
+ die "Target directory does not exist!" unless ( -d $destdir );
+ my $result = system( "cd \"$destdir\" ; $GET_CMD \"$remote\" $set_output" );
+
+ return $result if ( $extract == 0 );
+
+ # extraction was requested
+ die "requested to untar nothing!" unless ($targetfile);
+ if ( $result != 0 ) {
+ unlink("$destdir/$targetfile");
+ return $result;
+ }
+ my $tarswitch = "j";
+ $tarswitch = "z" if ($targetfile =~ /gz$/ );
+ $result = system( "cd \"$destdir\" ; tar -x".$tarswitch."f \"$targetfile\" > /dev/null 2>&1");
+ unlink($destdir."/".$targetfile);
+
+ return $result;
+}
+
sub webget($$$$)
{
my ($src, $dest, $name, $is_cgit) = @_;
my $result;
- $save_as = '';
- if ( $name ne '' ) {
- $save_as = "-O \"$name\"";
- }
-
if ( $is_cgit && $name ne '' ) {
# it must be piece source and must be repacked
my $ooo_sourceversion = '@OOO_SOURCEVERSION@';
@@ -21,14 +51,10 @@ sub webget($$$$)
print "Get $src -> $dest/libreoffice-$name-${ooo_sourceversion}.tar.bz2\n";
# first try to get the tarball into a temporary directory
- my $tempdir = tempdir( '/tmp/libreoffice-download-XXXXXX' );
+ my $tempdir = tempdir( 'libreoffice-download-XXXXXX', TMPDIR => 1, CLEANUP =>1 );
- $result = system( "cd $tempdir ; $WGET \"$src\" -O temp.tar.bz2" );
-
- if ( $result == 0 ) {
- # try to unpack the tarball in the temp dir
- $result = system( "cd $tempdir ; tar -xjf temp.tar.bz2 > /dev/null 2>&1" );
- }
+ # try to download and extract
+ $result = download($src, $tempdir, "temp.tar.bz2", 1);
# cgit is known to be broken, try plan B (download gzip variant) if bzip2 download failed
if ( $result != 0 ) {
@@ -37,29 +63,20 @@ sub webget($$$$)
if ( $gzip_src ne $src ) {
print "Bad archive, go for plan B: get $gzip_src and repack\n";
- $result = system( "cd $tempdir ; $WGET \"$gzip_src\" -O temp.tar.gz" );
- if ( $result == 0 ) {
- # try to unpack the tarball in the temp dir
- $result = system( "cd $tempdir ; tar -xzf temp.tar.gz > /dev/null 2>&1" );
- }
- }
+ $result = download($gzip_src, $tempdir, "temp.tar.gz", 1);
}
+ }
# pack the files to the final archive, use the ooo-pack-source helper tool
if ( $result == 0 ) {
- # first, remove temp tarballs
- unlink "$tempdir/temp.tar.bz2", "$tempdir/temp.tar.gz";
# pack the files
# FIXME: it would be more safe to use $temp_dir/$git_tag instead of $tempdir/*
$result = system( "cd $dest; $ooo_pack_sources --set-version=$ooo_sourceversion --piece=$name $tempdir/*" );
- }
-
- # remove temp files
- system( "rm -rf $tempdir" );
+ }
} else {
# normal file, easy go
print "Get $src -> $dest/$name\n";
- $result = system( "cd $dest ; $WGET \"$src\" $save_as" );
+ $result = download($src, $dest, $name, 0);
}
return ( $result == 0 );
@@ -218,7 +235,6 @@ if ( '@UPSTREAM_NAME@' ne '' ) {
$SRC_URLS{'@UPSTREAM_NAME at .*'} = '@MIRROR@/upstream-copy';
}
-$WGET='@WGET@';
if ('@SPLIT@' eq '') {
$SPLIT = 0;
} else {
@@ -388,8 +404,6 @@ while ($arg = shift @ARGV) {
# Defaults
print "Downloading files for @OOO_SOURCEDIRNAME@\n";
--x $WGET || die "Can't find wget - install it and try again\n";
-
if ('@SYSTEM_GCC@' eq '') {
source_file( 'gcc-4.2.3.tar.bz2' );
source_file( 'binutils-2.18.tar.bz2' );
@@ -405,9 +419,13 @@ if ($download_all && '@BUILD_WIN32@' eq '')
source_file( '@BUILD_MOZILLA_SOURCE@' );
}
-if ('@BUILD_WIN32@' ne '' || '@DISTRO@' eq 'LibreOfficeLinux'
- || '@DISTRO@' eq 'LibreOfficeLinuxDevel'
- || '@DISTRO@' eq 'LibreOfficeWin32' || '@DISTRO@' eq 'LibreOfficeMacOSX')
+my %requires_ant = (
+ LibreOfficeLinux => 1,
+ LibreOfficeLinuxDevel => 1,
+ LibreOfficeWin32 => 1,
+ LibreOfficeMacOSX => 1,
+);
+if ('@BUILD_WIN32@' || $requires_ant{@DISTRO@})
{
source_file( '@APACHE_ANT_TARBALL@' );
}
@@ -629,7 +647,10 @@ download_files (\@files, \%SRC_URLS, '@SRCDIR@');
download_external_sources();
open (FILELIST, ">download.list");
-print FILELIST join ("\n", @files);
-print FILELIST "\n";
+foreach $entry (@files) {
+ print FILELIST $entry->{file}."\n" if ( $entry->{file} );
+}
+close FILELIST;
print "Done\n";
+# vim: set ts=4 sw=4 expandtab :
More information about the Libreoffice-commits
mailing list