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

Download this file

100 lines (81 with data), 3.2 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, 2010, 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"

for argv in ${DEFAULT_OPTIONS} ${XMINGW32_BUILD} "$@"
  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}
	case --${opt} in ${arg}*) match=${match}--${opt} ;; esac
      for opt in ${TOGGLES}
	case --no-${opt} in ${arg}*) match=${match}--no-${opt} ;; esac

      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=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'" ;;

eval set x $new_argv; shift

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

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

Sign up for the SourceForge newsletter:

No, thanks