Skip to content

Commit 13a6255

Browse files
authored
Merge pull request #252 from sourceryinstitute/fix-trunk-install
Fixes #234
2 parents 09d6e09 + 078df72 commit 13a6255

File tree

3 files changed

+71
-37
lines changed

3 files changed

+71
-37
lines changed

prerequisites/build-functions/build_and_install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ build_and_install()
1717
if [[ "${package_to_build}" == "gcc" ]]; then
1818
info "pushd ${download_path}/${package_source_directory} "
1919
pushd "${download_path}/${package_source_directory}"
20-
arg_string="${args[@]:-}"
20+
arg_string="${gcc_prereqs_fetch_args[@]:-}"
2121
if [[ "$(uname)" == "Linux" ]]; then
22-
sed -i'' "s/wget/${fetch} ${arg_string}/g" "${PWD}/contrib/download_prerequisites"
22+
sed -i'' s/"wget --no-verbose -O \"\${directory}\/\${ar}\""/"${gcc_prereqs_fetch} ${arg_string}"/ "${PWD}/contrib/download_prerequisites"
2323
else
2424
# This works on OS X and other POSIX-compliant operating systems:
25-
sed -i '' "s/wget/${fetch} ${arg_string}/g" "${PWD}/contrib/download_prerequisites"
25+
sed -i '' s/"wget --no-verbose -O \"\${directory}\/\${ar}\""/"${gcc_prereqs_fetch} ${arg_string}"/ "${PWD}/contrib/download_prerequisites"
2626
fi
2727
"${PWD}"/contrib/download_prerequisites
2828
info "popd"

prerequisites/build-functions/download_if_necessary.sh

Lines changed: 54 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,61 @@ download_if_necessary()
1313

1414
# We set args regardless of whether this function performs a download because
1515
# GCC builds will need this to modify GCC's contrib/download_prerequisites script
16-
if [[ "${fetch}" == "svn" ]]; then
17-
if [[ "${arg_B:-}" == "gcc" ]]; then
18-
args=("ls")
19-
else
20-
args=("checkout")
21-
fi
22-
elif [[ "${fetch}" == "wget" ]]; then
23-
args=("--no-check-certificate")
24-
elif [[ "${fetch}" == "ftp-url" ]]; then
25-
args=("-n")
26-
elif [[ "${fetch}" == "git" ]]; then
27-
args=("clone")
28-
elif [[ "${fetch}" == "curl" ]]; then
29-
first_three_characters=$(echo "${package_url}" | cut -c1-3)
30-
if [[ "${first_three_characters}" == "ftp" ]]; then
31-
args=("-LO" "-u" "anonymous:")
32-
elif [[ "${first_three_characters}" == "htt" ]]; then
33-
args=("-LO")
34-
else
35-
emergency "download_if_necessary.sh: Unrecognized URL."
36-
fi
37-
fi
3816

17+
case "${fetch}" in
18+
"wget" )
19+
args=("--no-check-certificate")
20+
;;
21+
"ftp-url" )
22+
args=("-n")
23+
;;
24+
"git" )
25+
args=("clone")
26+
;;
27+
"svn" )
28+
case "${arg_B:-}" in
29+
"gcc")
30+
args=("ls")
31+
;;
32+
*)
33+
args=("checkout")
34+
;;
35+
esac
36+
;;
37+
"curl" )
38+
first_three_characters=$(echo "${package_url}" | cut -c1-3)
39+
case "${first_three_characters}" in
40+
"ftp" )
41+
args=("-LO" "-u" "anonymous:")
42+
;;
43+
"htt" )
44+
args=("-LO")
45+
;;
46+
*)
47+
emergency "download_if_necessary.sh: Unrecognized URL."
48+
;;
49+
esac
50+
;;
51+
*)
52+
emergency "download_if_necessary.sh: Unrecognized \${fetch}=${fetch}."
53+
;;
54+
esac
55+
56+
case "${gcc_prereqs_fetch}" in
57+
"wget" )
58+
gcc_prereqs_fetch_args=("--no-check-certificate")
59+
;;
60+
"ftp-url" )
61+
gcc_prereqs_fetch_args=("-n")
62+
;;
63+
"curl" )
64+
gcc_prereqs_fetch_args=("-LO" "-u" "anonymous:")
65+
;;
66+
*)
67+
emergency "download_if_necessary.sh: Unrecognized \${gcc_prereqs_fetch_args}=${gcc_prereqs_fetch_args}."
68+
;;
69+
esac
70+
3971
if [[ -f "${download_path}/${url_tail}" || -d "${download_path}/${url_tail}" ]] ; then
4072
info "Found '${url_tail}' in ${download_path}."
4173
info "If it resulted from an incomplete download, building ${package_name} could fail."

prerequisites/build-functions/set_or_print_downloader.sh

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,29 @@ set_or_print_downloader()
2121
info "Checking available download mechanisms: ftp, wget, and curl."
2222
info "\${package_name}=${package_name} \${arg_b:-\${arg_B:-}}=${arg_b:-${arg_B:-}}"
2323

24-
if [[ "${package_name}" == "gcc" && ! -z "${arg_b:-${arg_B:-}}" ]]; then
25-
26-
if type svn &> /dev/null; then
27-
fetch=svn
28-
else
29-
tried="svn"
30-
fi
31-
32-
elif type curl &> /dev/null; then
33-
fetch=curl
24+
if type curl &> /dev/null; then
25+
gcc_prereqs_fetch=curl
3426
elif type wget &> /dev/null; then
35-
fetch=wget
27+
gcc_prereqs_fetch=wget
3628
elif type ftp &> /dev/null; then
3729
if [[ "${package_name}" == "gcc" || "${package_name}" == "wget" || "${package_name}" == "make" ||
3830
"${package_name}" == "bison" || "${package_name}" == "m4" ]]; then
39-
fetch=ftp-url
31+
gcc_prereqs_fetch=wget
4032
fi
4133
else
4234
tried="curl, wget, and ftp"
4335
fi
4436

37+
if [[ "${package_name}" == "gcc" && ! -z "${arg_b:-${arg_B:-}}" ]]; then
38+
if type svn &> /dev/null; then
39+
fetch=svn
40+
else
41+
tried="svn"
42+
fi
43+
else
44+
fetch=${gcc_prereqs_fetch}
45+
fi
46+
4547
if [[ -z "${fetch:-}" ]]; then
4648
if [[ -z "${arg_B:-}" ]]; then
4749
warning "No available download mechanism. Options tried: ${tried}"

0 commit comments

Comments
 (0)