1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Avoid duplicate code in script

Change-Id: Ia40f8fd676a7e2c302f06efa4ccf9fb77dc6dfc9
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/39421
Tested-by: Hudson CI
Reviewed-by: Simon Marchi <simon.marchi@polymtl.ca>
This commit is contained in:
Marc Khouzam 2015-01-12 15:27:33 -05:00
parent 971176c83f
commit 7bbaa4d7b3

View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# * Copyright (c) 2014 Ericsson and others. # * Copyright (c) 2015 Ericsson and others.
# * All rights reserved. This program and the accompanying materials # * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0 # * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at # * which accompanies this distribution, and is available at
@ -20,7 +20,7 @@ base_dir="${default_base_dir}"
default_jlevel="4" default_jlevel="4"
jlevel="${default_jlevel}" jlevel="${default_jlevel}"
# Default versions (for when "all" is used) # Supported versions
default_versions="6.6 6.7.1 6.8 7.0.1 7.1 7.2 7.3.1 7.4.1 7.5.1 7.6.2 7.7.1 7.8.1" default_versions="6.6 6.7.1 6.8 7.0.1 7.1 7.2 7.3.1 7.4.1 7.5.1 7.6.2 7.7.1 7.8.1"
# Is set to "echo" if we are doing a dry-run. # Is set to "echo" if we are doing a dry-run.
@ -66,8 +66,11 @@ function echo_header() {
# #
# $1: version number # $1: version number
function check_supported() { function check_supported() {
local supported_pattern="@(${default_versions// /|})"
shopt -s extglob
case "$version" in case "$version" in
"6.6"|"6.7.1"|"6.8"|"7.0.1"|"7.1"|"7.2"|"7.3.1"|"7.4.1"|"7.5.1"|"7.6.2"|"7.7.1"|"7.8.1") ${supported_pattern})
# Supported, do nothing. # Supported, do nothing.
;; ;;
*) *)
@ -168,12 +171,8 @@ function configure_gdb() {
# Let the user specify some CFLAGS # Let the user specify some CFLAGS
cflags="${cflags} ${CFLAGS}" cflags="${cflags} ${CFLAGS}"
# The ${dryrun} trick doesn't work here, because of the env var. # Need to use eval to allow the ${dryrun} trick to work with the env var command at the start.
if [ -z "${dryrun}" ]; then eval ${dryrun} 'CFLAGS="${cflags}" ./configure --prefix="${install_dir}/gdb-${version}"'
CFLAGS="${cflags}" ./configure --prefix="${install_dir}/gdb-${version}"
else
${dryrun} CFLAGS="\"${cflags}\"" ./configure --prefix="${install_dir}/gdb-${version}"
fi
${dryrun} popd ${dryrun} popd
} }