This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] option to prefer HTTP for downloads


Hi,

when trying to build a toolchain with crosstool-ng, the process
got stuck in the download of the kernel headers from the kernel.org
FTP server. i tried the same from another box in another network
without problems. i suppose that the firewall of the corporate network
is restricting the access to the FTP server.

here is a small patch that adds the option to download the tarballs
preferably from HTTP servers.

regards

-- 
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

                If you don't know where you are going,
               you will probably end up somewhere else
                         (Laurence J. Peter)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
diff -urN crosstool-ng-1.0.0.org/config/global.in crosstool-ng-1.0.0/config/global.in
--- crosstool-ng-1.0.0.org/config/global.in	2007-09-14 23:30:22.000000000 +0200
+++ crosstool-ng-1.0.0/config/global.in	2008-04-11 15:45:28.000000000 +0200
@@ -246,6 +246,15 @@
       
       Usefull to pre-retrieve the tarballs before going off-line.
 
+config PREFER_HTTP_DOWNLOAD
+    bool
+    prompt "Prefer HTTP servers"
+    default n
+    help
+      Tarballs are downloaded from HTTP servers if possible.
+      
+      Usefull if FTP access is restricted by a firewall.
+
 config FOOBAR
 
 if ! ONLY_DOWNLOAD
diff -urN crosstool-ng-1.0.0.org/scripts/build/binutils.sh crosstool-ng-1.0.0/scripts/build/binutils.sh
--- crosstool-ng-1.0.0.org/scripts/build/binutils.sh	2007-08-15 12:14:43.000000000 +0200
+++ crosstool-ng-1.0.0/scripts/build/binutils.sh	2008-04-11 15:45:39.000000000 +0200
@@ -8,9 +8,15 @@
 
 # Download binutils
 do_binutils_get() {
-    CT_GetFile "${CT_BINUTILS_FILE}"                            \
-               ftp://ftp.gnu.org/gnu/binutils                   \
-               ftp://ftp.kernel.org/pub/linux/devel/binutils
+		if [ "${CT_PREFER_HTTP_DOWNLOAD}" != "y" ]; then
+				CT_GetFile "${CT_BINUTILS_FILE}"                            \
+                   ftp://ftp.gnu.org/gnu/binutils                   \
+                   ftp://ftp.kernel.org/pub/linux/devel/binutils
+		else
+				CT_GetFile "${CT_BINUTILS_FILE}"                            \
+                   http://ftp.gnu.org/gnu/binutils                  \
+                   http://kernel.org/pub/linux/devel/binutils
+		fi
 }
 
 # Extract binutils
diff -urN crosstool-ng-1.0.0.org/scripts/build/cc_gcc.sh crosstool-ng-1.0.0/scripts/build/cc_gcc.sh
--- crosstool-ng-1.0.0.org/scripts/build/cc_gcc.sh	2008-01-16 23:15:16.000000000 +0100
+++ crosstool-ng-1.0.0/scripts/build/cc_gcc.sh	2008-04-11 15:46:06.000000000 +0200
@@ -15,10 +15,18 @@
     # Arrgghh! Some of those versions does not follow this convention:
     # gcc-3.3.3 lives in releases/gcc-3.3.3, while gcc-2.95.* isn't in a
     # subdirectory! You bastard!
-    CT_GetFile "${CT_CC_FILE}"                                  \
-               ftp://ftp.gnu.org/gnu/gcc/${CT_CC_FILE}          \
-               ftp://ftp.gnu.org/gnu/gcc/releases/${CT_CC_FILE} \
-               ftp://ftp.gnu.org/gnu/gcc
+
+		if [ "${CT_PREFER_HTTP_DOWNLOAD}" != "y" ]; then
+				CT_GetFile "${CT_CC_FILE}"                                  \
+                   ftp://ftp.gnu.org/gnu/gcc/${CT_CC_FILE}          \
+                   ftp://ftp.gnu.org/gnu/gcc/releases/${CT_CC_FILE} \
+                   ftp://ftp.gnu.org/gnu/gcc
+		else
+				CT_GetFile "${CT_CC_FILE}"                                       \
+                   http://ftp.gnu.org/gnu/gcc/gcc/${CT_CC_FILE}          \
+                   http://ftp.gnu.org/gnu/gcc/gcc/releases/${CT_CC_FILE} \
+                   http://ftp.gnu.org/gnu/gcc/gcc
+		fi
 }
 
 # Extract final gcc
diff -urN crosstool-ng-1.0.0.org/scripts/build/debug/gdb.sh crosstool-ng-1.0.0/scripts/build/debug/gdb.sh
--- crosstool-ng-1.0.0.org/scripts/build/debug/gdb.sh	2007-07-12 15:22:26.000000000 +0200
+++ crosstool-ng-1.0.0/scripts/build/debug/gdb.sh	2008-04-11 15:45:53.000000000 +0200
@@ -15,11 +15,19 @@
 }
 
 do_debug_gdb_get() {
-    CT_GetFile "gdb`do_debug_gdb_suffix`"                           \
-               ftp://ftp.gnu.org/pub/gnu/gdb                        \
-               ftp://sources.redhat.com/pub/gdb/releases            \
-               ftp://sources.redhat.com/pub/gdb/old-releases        \
-               ftp://sources.redhat.com/pub/gdb/snapshots/current 
+		if [ "${CT_PREFER_HTTP_DOWNLOAD}" != "y" ]; then
+				CT_GetFile "gdb`do_debug_gdb_suffix`"                           \
+                   ftp://ftp.gnu.org/pub/gnu/gdb                        \
+                   ftp://sources.redhat.com/pub/gdb/releases            \
+                   ftp://sources.redhat.com/pub/gdb/old-releases        \
+                   ftp://sources.redhat.com/pub/gdb/snapshots/current 
+	  else
+				CT_GetFile "gdb`do_debug_gdb_suffix`"                                         \
+                   http://ftp.gnu.org/gnu/gdb                                         \
+                   http://sources-redhat.oc1.mirrors.redwire.net/gdb/releases         \
+                   http://sources-redhat.oc1.mirrors.redwire.net/gdb/old-releases     \
+                   http://sources-redhat.oc1.mirrors.redwire.net/gdb/snapshots/current 
+    fi
 }
 
 do_debug_gdb_extract() {
diff -urN crosstool-ng-1.0.0.org/scripts/build/debug/ltrace.sh crosstool-ng-1.0.0/scripts/build/debug/ltrace.sh
--- crosstool-ng-1.0.0.org/scripts/build/debug/ltrace.sh	2007-07-13 14:22:34.000000000 +0200
+++ crosstool-ng-1.0.0/scripts/build/debug/ltrace.sh	2008-04-11 15:45:45.000000000 +0200
@@ -8,7 +8,12 @@
 }
 
 do_debug_ltrace_get() {
-    CT_GetFile "ltrace_${CT_LTRACE_VERSION}.orig" ftp://ftp.de.debian.org/debian/pool/main/l/ltrace/
+		if [ "${CT_PREFER_HTTP_DOWNLOAD}" != "y" ]; then
+				CT_GetFile "ltrace_${CT_LTRACE_VERSION}.orig" ftp://ftp.de.debian.org/debian/pool/main/l/ltrace/
+		else
+				CT_GetFile "ltrace_${CT_LTRACE_VERSION}.orig" http://ftp.de.debian.org/debian/pool/main/l/ltrace/
+		fi
+
     # Create a link so that the following steps are easier to do:
     cd "${CT_TARBALLS_DIR}"
     ltrace_ext=`CT_GetFileExtension "ltrace_${CT_LTRACE_VERSION}.orig"`
diff -urN crosstool-ng-1.0.0.org/scripts/build/kernel_linux-libc-headers.sh crosstool-ng-1.0.0/scripts/build/kernel_linux-libc-headers.sh
--- crosstool-ng-1.0.0.org/scripts/build/kernel_linux-libc-headers.sh	2007-07-04 00:16:42.000000000 +0200
+++ crosstool-ng-1.0.0/scripts/build/kernel_linux-libc-headers.sh	2008-04-11 15:46:00.000000000 +0200
@@ -13,12 +13,21 @@
 # Download the kernel
 do_kernel_get() {
     if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" != "y" ]; then
-        CT_GetFile "${CT_KERNEL_FILE}"                                  \
-                   ftp://ftp.kernel.org/pub/linux/kernel/v2.6           \
-                   ftp://ftp.kernel.org/pub/linux/kernel/v2.4           \
-                   ftp://ftp.kernel.org/pub/linux/kernel/v2.2           \
-                   ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing   \
-                   http://ep09.pld-linux.org/~mmazur/linux-libc-headers
+				if [ "${CT_PREFER_HTTP_DOWNLOAD}" != "y" ]; then
+						CT_GetFile "${CT_KERNEL_FILE}"                                  \
+								       ftp://ftp.kernel.org/pub/linux/kernel/v2.6           \
+                       ftp://ftp.kernel.org/pub/linux/kernel/v2.4           \
+                       ftp://ftp.kernel.org/pub/linux/kernel/v2.2           \
+                       ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing   \
+                       http://ep09.pld-linux.org/~mmazur/linux-libc-headers
+				else
+						CT_GetFile "${CT_KERNEL_FILE}"                                  \
+				               http://kernel.org/pub/linux/kernel/v2.6              \
+                       http://kernel.org/pub/linux/kernel/v2.4              \
+                       http://kernel.org/pub/linux/kernel/v2.2              \
+                       http://kernel.org/linux/kernel/v2.6/testing          \
+                       http://ep09.pld-linux.org/~mmazur/linux-libc-headers				
+				fi
     fi
     return 0
 }
diff -urN crosstool-ng-1.0.0.org/scripts/build/kernel_linux.sh crosstool-ng-1.0.0/scripts/build/kernel_linux.sh
--- crosstool-ng-1.0.0.org/scripts/build/kernel_linux.sh	2007-07-04 00:16:42.000000000 +0200
+++ crosstool-ng-1.0.0/scripts/build/kernel_linux.sh	2008-04-11 15:46:00.000000000 +0200
@@ -13,12 +13,21 @@
 # Download the kernel
 do_kernel_get() {
     if [ "${CT_KERNEL_LINUX_HEADERS_USE_CUSTOM_DIR}" != "y" ]; then
-        CT_GetFile "${CT_KERNEL_FILE}"                                  \
-                   ftp://ftp.kernel.org/pub/linux/kernel/v2.6           \
-                   ftp://ftp.kernel.org/pub/linux/kernel/v2.4           \
-                   ftp://ftp.kernel.org/pub/linux/kernel/v2.2           \
-                   ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing   \
-                   http://ep09.pld-linux.org/~mmazur/linux-libc-headers
+				if [ "${CT_PREFER_HTTP_DOWNLOAD}" != "y" ]; then
+						CT_GetFile "${CT_KERNEL_FILE}"                                  \
+								       ftp://ftp.kernel.org/pub/linux/kernel/v2.6           \
+                       ftp://ftp.kernel.org/pub/linux/kernel/v2.4           \
+                       ftp://ftp.kernel.org/pub/linux/kernel/v2.2           \
+                       ftp://ftp.kernel.org/pub/linux/kernel/v2.6/testing   \
+                       http://ep09.pld-linux.org/~mmazur/linux-libc-headers
+				else
+						CT_GetFile "${CT_KERNEL_FILE}"                                  \
+				               http://kernel.org/pub/linux/kernel/v2.6              \
+                       http://kernel.org/pub/linux/kernel/v2.4              \
+                       http://kernel.org/pub/linux/kernel/v2.2              \
+                       http://kernel.org/linux/kernel/v2.6/testing          \
+                       http://ep09.pld-linux.org/~mmazur/linux-libc-headers				
+				fi
     fi
     return 0
 }
diff -urN crosstool-ng-1.0.0.org/scripts/build/libc_glibc.sh crosstool-ng-1.0.0/scripts/build/libc_glibc.sh
--- crosstool-ng-1.0.0.org/scripts/build/libc_glibc.sh	2007-11-02 19:55:55.000000000 +0100
+++ crosstool-ng-1.0.0/scripts/build/libc_glibc.sh	2008-04-11 15:46:12.000000000 +0200
@@ -17,7 +17,12 @@
     # Ah! Not all GNU folks seem stupid. All glibc releases are in the same
     # directory. Good. Alas, there is no snapshot there. I'll deal with them
     # later on... :-/
-    CT_GetFile "${CT_LIBC_FILE}" ftp://ftp.gnu.org/gnu/glibc
+
+		if [ "${CT_PREFER_HTTP_DOWNLOAD}" != "y" ]; then
+				CT_GetFile "${CT_LIBC_FILE}" ftp://ftp.gnu.org/gnu/glibc
+		else
+				CT_GetFile "${CT_LIBC_FILE}" http://ftp.gnu.org/gnu/glibc
+		fi
 
     # C library addons
     for addon in `do_libc_add_ons_list " "`; do

--
For unsubscribe information see http://sourceware.org/lists.html#faq

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]