[9b4c5d]: x86-mingw32-build.sh.getopts  Maximize  Restore  History

Download this file

100 lines (81 with data), 3.1 kB

# x86-mingw32-build.sh.getopts -*- sh -*- vim: filetype=sh
# $Id$
#
# Interpret command line arguments given to the x86-mingw32-build script.
#
# Copyright (C) 2006, 2009, MinGW Project
# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
#
# This file is a component of the x86-mingw32-build script; it is not
# intended for stand alone use.
# 
# x86-mingw32-build is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
# 
# x86-mingw32-build is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for further details.
# 
# You should have received a copy of the GNU General Public License along
# with x86-mingw32-build; see the file COPYING.  If not, write to the Free
# Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301,
# USA.

OPTIONS="help info version batch dry-run unattended use-latest-versions"
TOGGLES="pre-clean post-clean download"

DEFAULT_OPTIONS="--download --pre-clean --post-clean"

new_argv=""
for argv in ${DEFAULT_OPTIONS} ${XMINGW32_BUILD} "$@"
do
  case ${argv} in

    # Option arguments...
    #
    -*)
      # Attempt to identify a match to a defined option name,
      # treating all as GNU style long form options, and allowing
      # for abbreviations, but rejecting ambiguities.
      #
      arg=${argv} match=""
      case ${arg} in --*) ;; -*) arg=-${arg} ;; esac
      for opt in ${OPTIONS} ${TOGGLES}
      do
	case --${opt} in ${arg}*) match=${match}--${opt} ;; esac
      done
      for opt in ${TOGGLES}
      do
	case --no-${opt} in ${arg}*) match=${match}--no-${opt} ;; esac
      done

      case ${match} in

	--help | --info | --version)
                          . ${script}.help ;;

        --batch | --unattended)
                          BUILD_METHOD=batch ;;

        --dry-run)        RUN=echo BUILD_PLATFORM='`../config.guess`' ;;

        --download)       ALLOW_DOWNLOADS=YES ;;
        --no-download)    ALLOW_DOWNLOADS=NO ;;

	--pre-clean)      CLEAN_SLATE_AT_START='rm -rf "$WORKING_DIR"' ;;
	--no-pre-clean)   CLEAN_SLATE_AT_START='' ;;

	--post-clean)     CLEAN_SLATE_ON_EXIT='rm -rf "$WORKING_DIR"' ;;
	--no-post-clean)  CLEAN_SLATE_ON_EXIT='' ;;

        --use-latest-versions)
                          USE_LATEST_VERSIONS=YES ;;

	--*) die 2 "$script: option '$argv' is ambiguous; specify more chars" ;;
	*)   die 2 "$script: unknown option '$argv'" ;;

      esac ;;

    # Assignment arguments...
    #
    *=*)
      # Simply add these to the environment,
      # to be passed to the build process.
      #
      export `IFS==; set x $argv; echo $2`
      eval `IFS==; set x $argv; echo $2`='`echo $argv | sed s"?^[^=]=??"`' ;;

    # Anything else is simply left in the residual argument vector...
    #
    *) new_argv="$new_argv '$argv'" ;;

  esac
done
eval set x $new_argv; shift

# $RCSfile$Revision: 1.3 $: end of file

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks