Mercurial > hg > octave-kai > gnulib-hg
view build-aux/csharpcomp.sh.in @ 7302:8a1a9361108c
* _fpending.c: Include <config.h> unconditionally, since we no
longer worry about uses that don't define HAVE_CONFIG_H.
* acl.c, alloca.c, argmatch.c, atexit.c, backupfile.c:
* basename.c, c-stack.c, c-strtod.c, calloc.c, canon-host.c:
* canonicalize.c, chdir-long.c, chdir-safer.c, chown.c:
* cloexec.c, close-stream.c, closeout.c, creat-safer.c:
* cycle-check.c, diacrit.c, dirchownmod.c, dirfd.c, dirname.c:
* dup-safer.c, dup2.c, error.c, euidaccess.c, exclude.c:
* exitfail.c, fchmodat.c, fchown-stub.c, fd-safer.c:
* file-type.c, fileblocks.c, filemode.c, filenamecat.c:
* fnmatch.c, fopen-safer.c, fprintftime.c, free.c, fsusage.c:
* ftruncate.c, fts-cycle.c, fts.c, full-write.c, gai_strerror.c:
* getcwd.c, getdate.y, getdomainname.c, getgroups.c:
* gethostname.c, gethrxtime.c, getloadavg.c, getlogin_r.c:
* getndelim2.c, getnline.c, getopt.c, getopt1.c, getpass.c:
* gettime.c, gettimeofday.c, getugroups.c, getusershell.c:
* glob.c, group-member.c, hard-locale.c, hash-pjw.c, hash.c:
* human.c, idcache.c, inet_ntop.c, inet_pton.c, inttostr.c:
* isdir.c, lchown.c, linebuffer.c, long-options.c, lstat.c:
* malloc.c, md5.c, memcasecmp.c, memchr.c, memcmp.c, memcoll.c:
* memcpy.c, memmove.c, memrchr.c, mkancesdirs.c, mkdir-p.c:
* mkdir.c, mkdirat.c, mkstemp-safer.c, mkstemp.c, modechange.c:
* mountlist.c, nanosleep.c, obstack.c, open-safer.c:
* openat-die.c, openat.c, pagealign_alloc.c, physmem.c:
* pipe-safer.c, posixtm.c, posixver.c, putenv.c, quote.c:
* quotearg.c, raise.c, readtokens.c, readtokens0.c, readutmp.c:
* realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c, safe-read.c:
* same.c, save-cwd.c, savedir.c, setenv.c, settime.c, sha1.c:
* sig2str.c, snprintf.c, strdup.c, strerror.c, strftime.c:
* stripslash.c, strndup.c, strnlen.c, strpbrk.c, strtod.c:
* strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c:
* timegm.c, tmpfile-safer.c, unlinkdir.c, userspec.c, utime.c:
* utimecmp.c, utimens.c, version-etc-fsf.c, version-etc.c:
* xalloc-die.c, xgetcwd.c, xgethostname.c, xmalloc.c:
* xmemcoll.c, xnanosleep.c, xreadlink.c, xstrtod.c:
* xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c:
Likewise.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Wed, 13 Sep 2006 22:38:14 +0000 |
parents | c91111628d88 |
children | bbbbbf4cd1c5 |
line wrap: on
line source
#!/bin/sh # Compile a C# program. # Copyright (C) 2003-2006 Free Software Foundation, Inc. # Written by Bruno Haible <bruno@clisp.org>, 2003. # # This program 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. # # This program 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 more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # This uses the same choices as csharpcomp.c, but instead of relying on the # environment settings at run time, it uses the environment variables # present at configuration time. # # This is a separate shell script, because the various C# compilers have # different command line options. # # Usage: /bin/sh csharpcomp.sh [OPTION] SOURCE.cs ... RES.resource ... # Options: # -o PROGRAM.exe or -o LIBRARY.dll # set the output assembly name # -L DIRECTORY search for C# libraries also in DIRECTORY # -l LIBRARY reference the C# library LIBRARY.dll # -O optimize # -g generate debugging information # func_tmpdir # creates a temporary directory. # Sets variable # - tmp pathname of freshly created temporary directory func_tmpdir () { # Use the environment variable TMPDIR, falling back to /tmp. This allows # users to specify a different temporary directory, for example, if their # /tmp is filled up or too small. : ${TMPDIR=/tmp} { # Use the mktemp program if available. If not available, hide the error # message. tmp=`(umask 077 && mktemp -d -q "$TMPDIR/gtXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { # Use a simple mkdir command. It is guaranteed to fail if the directory # already exists. $RANDOM is bash specific and expands to empty in shells # other than bash, ksh and zsh. Its use does not increase security; # rather, it minimizes the probability of failure in a very cluttered /tmp # directory. tmp=$TMPDIR/gt$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$0: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } } sed_quote_subst='s/\([|&;<>()$`"'"'"'*?[#~=% \\]\)/\\\1/g' options_cscc= options_mcs= options_csc="-nologo" sources= while test $# != 0; do case "$1" in -o) case "$2" in *.dll) options_cscc="$options_cscc -shared" options_mcs="$options_mcs -target:library" options_csc="$options_csc -target:library" ;; *.exe) options_csc="$options_csc -target:exe" ;; esac options_cscc="$options_cscc -o "`echo "$2" | sed -e "$sed_quote_subst"` options_mcs="$options_mcs -out:"`echo "$2" | sed -e "$sed_quote_subst"` options_csc="$options_csc -out:"`echo "$2" | sed -e "$sed_quote_subst"` shift ;; -L) options_cscc="$options_cscc -L "`echo "$2" | sed -e "$sed_quote_subst"` options_mcs="$options_mcs -lib:"`echo "$2" | sed -e "$sed_quote_subst"` options_csc="$options_csc -lib:"`echo "$2" | sed -e "$sed_quote_subst"` shift ;; -l) options_cscc="$options_cscc -l "`echo "$2" | sed -e "$sed_quote_subst"` options_mcs="$options_mcs -reference:"`echo "$2" | sed -e "$sed_quote_subst"` options_csc="$options_csc -reference:"`echo "$2" | sed -e "$sed_quote_subst"`".dll" shift ;; -O) options_cscc="$options_cscc -O" options_csc="$options_csc -optimize+" ;; -g) options_cscc="$options_cscc -g" options_mcs="$options_mcs -debug" options_csc="$options_csc -debug+" ;; -*) echo "csharpcomp: unknown option '$1'" 1>&2 exit 1 ;; *.resources) options_cscc="$options_cscc -fresources="`echo "$1" | sed -e "$sed_quote_subst"` options_mcs="$options_mcs -resource:"`echo "$1" | sed -e "$sed_quote_subst"` options_csc="$options_csc -resource:"`echo "$1" | sed -e "$sed_quote_subst"` ;; *.cs) sources="$sources "`echo "$1" | sed -e "$sed_quote_subst"` ;; *) echo "csharpcomp: unknown type of argument '$1'" 1>&2 exit 1 ;; esac shift done if test -n "@HAVE_CSCC@"; then test -z "$CSHARP_VERBOSE" || echo cscc $options_cscc $sources exec cscc $options_cscc $sources else if test -n "@HAVE_MCS@"; then # mcs prints it errors and warnings to stdout, not stderr. Furthermore it # adds a useless line "Compilation succeeded..." at the end. Correct both. sed_drop_success_line='${ /^Compilation succeeded/d }' func_tmpdir trap 'rm -rf "$tmp"' 1 2 3 15 test -z "$CSHARP_VERBOSE" || echo mcs $options_mcs $sources mcs $options_mcs $sources > "$tmp"/mcs.err result=$? sed -e "$sed_drop_success_line" < "$tmp"/mcs.err >&2 rm -rf "$tmp" exit $result else if test -n "@HAVE_CSC@"; then test -z "$CSHARP_VERBOSE" || echo csc $options_csc $sources exec csc $options_csc $sources else echo 'C# compiler not found, try installing pnet, then reconfigure' 1>&2 exit 1 fi fi fi