From 990eb37675b979f6d1bae46c1c8846755002b5e6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 7 Oct 2024 20:20:14 +0200 Subject: [PATCH] csharpcomp-script: Improve Cygwin support. * build-aux/csharpcomp.sh.in: Convert the file names passed to 'csc' to native Windows syntax. --- ChangeLog | 6 ++++++ build-aux/csharpcomp.sh.in | 44 +++++++++++++++++++++++++++++++++----- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e22466cb9c..47725d879d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-10-07 Bruno Haible + + csharpcomp-script: Improve Cygwin support. + * build-aux/csharpcomp.sh.in: Convert the file names passed to 'csc' to + native Windows syntax. + 2024-10-07 Bruno Haible csharpexec: Improve Cygwin support. diff --git a/build-aux/csharpcomp.sh.in b/build-aux/csharpcomp.sh.in index 0ffbb480a3..9febcddd72 100644 --- a/build-aux/csharpcomp.sh.in +++ b/build-aux/csharpcomp.sh.in @@ -68,6 +68,7 @@ sed_quote_subst='s/\([|&;<>()$`"'"'"'*?[#~=% \\]\)/\\\1/g' options_mcs= options_csc="-nologo" sources= +sources_csc= while test $# != 0; do case "$1" in -o) @@ -81,12 +82,28 @@ while test $# != 0; do ;; esac options_mcs="$options_mcs -out:"`echo "$2" | sed -e "$sed_quote_subst"` - options_csc="$options_csc -out:"`echo "$2" | sed -e "$sed_quote_subst"` + # On Windows, assume that 'csc' is a native Windows program, + # not a Cygwin program. + arg="$2" + case "@build_os@" in + cygwin*) + arg=`cygpath -w "$arg"` + ;; + esac + options_csc="$options_csc -out:"`echo "$arg" | sed -e "$sed_quote_subst"` shift ;; -L) options_mcs="$options_mcs -lib:"`echo "$2" | sed -e "$sed_quote_subst"` - options_csc="$options_csc -lib:"`echo "$2" | sed -e "$sed_quote_subst"` + # On Windows, assume that 'csc' is a native Windows program, + # not a Cygwin program. + arg="$2" + case "@build_os@" in + cygwin*) + arg=`cygpath -w "$arg"` + ;; + esac + options_csc="$options_csc -lib:"`echo "$arg" | sed -e "$sed_quote_subst"` shift ;; -l) @@ -107,10 +124,27 @@ while test $# != 0; do ;; *.resources) options_mcs="$options_mcs -resource:"`echo "$1" | sed -e "$sed_quote_subst"` - options_csc="$options_csc -resource:"`echo "$1" | sed -e "$sed_quote_subst"` + # On Windows, assume that 'csc' is a native Windows program, + # not a Cygwin program. + arg="$1" + case "@build_os@" in + cygwin*) + arg=`cygpath -w "$arg"` + ;; + esac + options_csc="$options_csc -resource:"`echo "$arg" | sed -e "$sed_quote_subst"` ;; *.cs) sources="$sources "`echo "$1" | sed -e "$sed_quote_subst"` + # On Windows, assume that 'csc' is a native Windows program, + # not a Cygwin program. + arg="$1" + case "@build_os@" in + cygwin*) + arg=`cygpath -w "$arg"` + ;; + esac + sources_csc="$sources_csc "`echo "$arg" | sed -e "$sed_quote_subst"` ;; *) echo "csharpcomp: unknown type of argument '$1'" 1>&2 @@ -136,8 +170,8 @@ if test -n "@HAVE_MCS@"; then exit $result else if test -n "@HAVE_CSC@"; then - test -z "$CSHARP_VERBOSE" || echo csc $options_csc $sources - exec csc $options_csc $sources + test -z "$CSHARP_VERBOSE" || echo csc $options_csc $sources_csc + exec csc $options_csc $sources_csc else echo 'C# compiler not found, try installing mono, then reconfigure' 1>&2 exit 1 -- 2.39.5