[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFD] Preliminary patches for Mono/.NET support
From: |
Raja R Harinath |
Subject: |
[RFD] Preliminary patches for Mono/.NET support |
Date: |
Thu, 28 Jun 2007 12:59:14 +0530 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/21.3 (gnu/linux) |
Hi,
I'm attaching a series of preliminary patches that add basic support for
compiling CLI (Mono/.NET/ECMA 335) assemblies. I'm only missing the
corresponding autoconf macros.
- Hari
>From e688d8c80d3b8262b815646e474ec729d340af1e Mon Sep 17 00:00:00 2001
In-Reply-To: <address@hidden>
References: <address@hidden>
From: Raja R Harinath <address@hidden>
Date: Wed, 27 Jun 2007 14:21:25 +0530
Subject: [PATCH 1/3] Add basic support for Mono/.NET
* automake.in (register_language): Add 'cli'.
(handle_cli, handle_cli_assembly, lang_cli_rewrite): New.
(generate_makefile): Call 'handle_cli'.
* lib/am/Makefile.am (dist_am_DATA): Update.
* lib/am/cli.am, lib/am/cli-assembly.am: New.
* tests/cli1.test: Simple test for Mono/.NET support.
* tests/Makefile.am (TESTS): Update.
---
ChangeLog | 11 ++++
automake.in | 127 ++++++++++++++++++++++++++++++++++++++++++++++++
lib/am/Makefile.am | 2 +
lib/am/cli-assembly.am | 22 ++++++++
lib/am/cli.am | 25 +++++++++
tests/Makefile.am | 1 +
tests/cli1.test | 40 +++++++++++++++
7 files changed, 228 insertions(+), 0 deletions(-)
create mode 100644 lib/am/cli-assembly.am
create mode 100644 lib/am/cli.am
create mode 100755 tests/cli1.test
diff --git a/ChangeLog b/ChangeLog
index 0730b31..b246d80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-06-27 Raja R Harinath <address@hidden>
+
+ Add basic support for Mono/.NET
+ * automake.in (register_language): Add 'cli'.
+ (handle_cli, handle_cli_assembly, lang_cli_rewrite): New.
+ (generate_makefile): Call 'handle_cli'.
+ * lib/am/Makefile.am (dist_am_DATA): Update.
+ * lib/am/cli.am, lib/am/cli-assembly.am: New.
+ * tests/cli1.test: Simple test for Mono/.NET support.
+ * tests/Makefile.am (TESTS): Update.
+
2007-06-23 Paul Eggert <address@hidden>
Ralf Wildenhues <address@hidden>
diff --git a/automake.in b/automake.in
index 083b6fa..de33217 100755
--- a/automake.in
+++ b/automake.in
@@ -983,6 +983,16 @@ register_language ('name' => 'java',
'pure' => 1,
'extensions' => ['.java', '.class', '.zip', '.jar']);
+# CLI - C#, VB
+register_language ('name' => 'cli',
+ 'Name' => 'Common Language Infrastructure (C# or VB)',
+ 'extensions' => ['.cs', '.vb'],
+ # No output.
+ 'output_extensions' => sub { return () },
+ # Nothing to do.
+ '_finish' => sub { });
+
+
################################################################
# Error reporting functions.
@@ -4673,6 +4683,114 @@ sub handle_java
push (@all, 'class' . $dir . '.stamp');
}
+sub handle_cli_assembly ($$$%)
+{
+ my ($one_file, $unxformed, $where, %transform) = @_;
+ my $compiler = '';
+ my @cmdsrcs = ();
+ my $seen_extn = 0;
+
+ foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
+ 'dist_EXTRA_', 'nodist_EXTRA_')
+ {
+ my $varname = $prefix . $one_file . "_SOURCES";
+ my $var = var $varname;
+ next unless $var;
+ my $xpfx = ($prefix eq '') ? 'am_' : $prefix;
+ my $outvarname = $xpfx . $one_file . "_CMDSRCS";
+ my $nodist = ($prefix =~ /^nodist_/);
+ my $nodefine = ($prefix =~ /EXTRA_/);
+
+ push @cmdsrcs, "\$($outvarname)";
+
+ push @sources, "\$($varname)";
+ push @dist_sources, shadow_unconditionally ($varname, $where)
+ unless (option ('no-dist') || $nodist);
+
+ $output_rules .= "$unxformed: \$($varname)\n";
+
+ $var->transform_variable_recursively
+ ($outvarname, 'am__cli', $nodefine, $where,
+ sub {
+ my ($subvar, $val, $cond, $full_cond) = @_;
+ return ()
+ unless $val =~ /($KNOWN_EXTENSIONS_PATTERN)$/;
+ my $extn = $1;
+
+ if ($seen_extn)
+ {
+ msg_var 'error', $varname, "multi-language assemblies not
supported: $seen_extn $extn"
+ unless $extn eq $seen_extn;
+ }
+ else
+ {
+ $seen_extn = $extn;
+ }
+
+ if (rule $val)
+ {
+ return $val if $nodist;
+ msg_var 'error', $subvar, "`$val' has a rule to build it, but is
also distributed";
+ }
+ return '$(srcdir)/' . $val;
+ });
+ }
+
+ msg 'error', $where, "`$unxformed' doesn't have any source defined"
+ unless scalar @cmdsrcs;
+
+ define_pretty_variable ($one_file . '_CMDSRCS', TRUE, $where, sort @cmdsrcs);
+
+ my $lang = uc substr $seen_extn, 1;
+ my $dirstamp = require_build_directory_maybe ($unxformed);
+ my $progflags = "${one_file}_${lang}FLAGS";
+
+ require_variables ($unxformed, "Seen CLI source file with extension
$seen_extn", TRUE, $lang . 'C');
+ define_variable ($progflags, "\$(AM_${lang}FLAGS)", INTERNAL)
+ unless var $progflags;
+
+ $output_rules .=
+ file_contents ('cli-assembly', $where,
+ %transform,
+ ASSEMBLY => $unxformed,
+ XASSEMBLY => $one_file,
+ LANG => $lang,
+ DIRSTAMP => $dirstamp);
+}
+
+# Handle Mono/.NET
+sub handle_cli
+{
+ my %targets = ( EXE => 'exe', WINEXE => 'winexe', DLL => 'library', MODULE
=> 'module' );
+ my %outextns = ( EXE => '.exe', WINEXE => '.exe', DLL => '.dll', MODULE =>
'.netmodule' );
+ foreach my $target (keys %targets)
+ {
+ my @assemblies = &am_install_var ('cli', 'CLI' . $target . 'S',
+ 'noinst', 'check', 'lib' #, 'gac'
+ );
+
+ next unless @assemblies;
+
+ define_variable ('INSTALL_CLI' . $target,
+ ($target =~ /EXE$/) ? '$(INSTALL_SCRIPT)' :
'$(INSTALL_DATA)',
+ INTERNAL);
+
+ foreach my $pair (@assemblies)
+ {
+ my ($where, $one_file) = @$pair;
+
+ msg_am 'syntax', "CLI $target doesn't have $outextns{$target}
extension"
+ unless $one_file =~ /$outextns{$target}$/;
+
+ my $xname = &check_canonical_spelling ($one_file, '_SOURCES',
'_RESOURCES', '_REFERENCES');
+ $where->push_context ("while processing CLI assembly '$one_file'");
+ $where->set (INTERNAL->get);
+
+ &handle_cli_assembly ($xname, $one_file, $where, TARGET =>
$targets{$target});
+ }
+ }
+}
+
# Handle some of the minor options.
sub handle_minor_options
@@ -5407,6 +5525,13 @@ sub lang_java_rewrite
return LANG_SUBDIR;
}
+# Rewrite a single CLI source file.
+sub lang_cli_rewrite
+{
+ # CLI files are ignored for rewrites.
+ return LANG_IGNORE;
+}
+
# The lang_X_finish functions are called after all source file
# processing is done. Each should handle defining rules for the
# language, etc. A finish function is only called if a source file of
@@ -7490,6 +7615,8 @@ sub generate_makefile ($$)
handle_languages;
handle_libtool;
+ handle_cli;
+
# Variables used by distdir.am and tags.am.
define_pretty_variable ('SOURCES', TRUE, INTERNAL, @sources);
if (! option 'no-dist')
diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am
index 52afd40..cd7ce1c 100644
--- a/lib/am/Makefile.am
+++ b/lib/am/Makefile.am
@@ -27,6 +27,8 @@ ansi2knr.am \
check.am \
clean-hdr.am \
clean.am \
+cli-assembly.am \
+cli.am \
compile.am \
configure.am \
data.am \
diff --git a/lib/am/cli-assembly.am b/lib/am/cli-assembly.am
new file mode 100644
index 0000000..f85710c
--- /dev/null
+++ b/lib/am/cli-assembly.am
@@ -0,0 +1,22 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright (C) 2007
+## Free Software Foundation, Inc.
+
+## 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.
+%ASSEMBLY%: $(%XASSEMBLY%_DEPENDENCIES) %DIRSTAMP%
+ @rm -f %ASSEMBLY%
+ $(%LANG%C) $(%XASSEMBLY%_%LANG%FLAGS) $(%LANG%FLAGS) -out:$@
-target:%TARGET% \
+ $(%XASSEMBLY%_CMDSRCS) $(%XASSEMBLY%_CMDRSRCS)
$(%XASSEMBLY%_REFERENCES)
diff --git a/lib/am/cli.am b/lib/am/cli.am
new file mode 100644
index 0000000..8ddbc4f
--- /dev/null
+++ b/lib/am/cli.am
@@ -0,0 +1,25 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright (C) 1994, 1995, 1996, 1998, 1999, 2001, 2003, 2004, 2006
+## Free Software Foundation, Inc.
+
+## 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.
+
+include data.am
+
+.PHONY clean-am: clean-%DIR%%PRIMARY%
+clean-%DIR%%PRIMARY%:
+ -list='$(%DIR%_%PRIMARY%)'; for p in $$list; do \
+ rm -f $$p $$p.mdb $$p.pdb; done
diff --git a/tests/Makefile.am b/tests/Makefile.am
index df6ff87..f5af67f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -91,6 +91,7 @@ check7.test \
checkall.test \
clean.test \
clean2.test \
+cli1.test \
colneq.test \
colneq2.test \
colon.test \
diff --git a/tests/cli1.test b/tests/cli1.test
new file mode 100755
index 0000000..29314eb
--- /dev/null
+++ b/tests/cli1.test
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test that basic CLI functionality works.
+
+. ./defs || exit 1
+
+set -e
+
+cat >Makefile.am <<END
+CSC = mcs
+VBC = vbnc
+noinst_CLIEXES = foo.exe bar/foo.exe
+noinst_CLIDLLS = foo.dll
+foo_exe_SOURCES = a.cs baz/b.cs quux/c.cs
+foo_exe_CSFLAGS = -debug+
+bar_foo_exe_SOURCES = baz/b.cs
+foo_dll_SOURCES = b.vb
+foo_dll_VBFLAGS = -debug+
+END
+
+$ACLOCAL
+$AUTOMAKE
--
1.5.2.1.174.gcd03
>From c47e2c0ab8b46469d159b1493fd669e4e869707d Mon Sep 17 00:00:00 2001
In-Reply-To: <address@hidden>
References: <address@hidden>
From: Raja R Harinath <address@hidden>
Date: Wed, 27 Jun 2007 14:26:15 +0530
Subject: [PATCH 2/3] Compute dependencies from assembly references
* automake.in (handle_cli_assembly): Return true on success.
(handle_cli_assembly_references): New.
(handle_cli): Call it.
* tests/cli2.test: Add test for dependency calculation.
* tests/Makefile.am (TESTS): Update.
---
ChangeLog | 7 +++++
automake.in | 65 +++++++++++++++++++++++++++++++++++++++++++++++++---
tests/Makefile.am | 1 +
tests/cli2.test | 41 +++++++++++++++++++++++++++++++++
4 files changed, 110 insertions(+), 4 deletions(-)
create mode 100755 tests/cli2.test
diff --git a/ChangeLog b/ChangeLog
index b246d80..ec49428 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2007-06-27 Raja R Harinath <address@hidden>
+ Compute dependencies from assembly references
+ * automake.in (handle_cli_assembly): Return true on success.
+ (handle_cli_assembly_references): New.
+ (handle_cli): Call it.
+ * tests/cli2.test: Add test for dependency calculation.
+ * tests/Makefile.am (TESTS): Update.
+
Add basic support for Mono/.NET
* automake.in (register_language): Add 'cli'.
(handle_cli, handle_cli_assembly, lang_cli_rewrite): New.
diff --git a/automake.in b/automake.in
index de33217..9bf8b43 100755
--- a/automake.in
+++ b/automake.in
@@ -4686,7 +4686,6 @@ sub handle_java
sub handle_cli_assembly ($$$%)
{
my ($one_file, $unxformed, $where, %transform) = @_;
- my $compiler = '';
my @cmdsrcs = ();
my $seen_extn = 0;
@@ -4736,8 +4735,11 @@ sub handle_cli_assembly ($$$%)
});
}
- msg 'error', $where, "`$unxformed' doesn't have any source defined"
- unless scalar @cmdsrcs;
+ if (scalar @cmdsrcs == 0)
+ {
+ msg 'error', $where, "`$unxformed' doesn't have any source defined";
+ return 0;
+ }
define_pretty_variable ($one_file . '_CMDSRCS', TRUE, $where, sort @cmdsrcs);
@@ -4756,6 +4758,53 @@ sub handle_cli_assembly ($$$%)
XASSEMBLY => $one_file,
LANG => $lang,
DIRSTAMP => $dirstamp);
+
+ return 1;
+}
+
+sub handle_cli_assembly_references(\%)
+{
+ my ($known_assemblies) = @_;
+ my ($unxformed, $where);
+ while (($unxformed, $where) = each %$known_assemblies)
+ {
+ my $one_file = &canonicalize ($unxformed);
+ my $var = var $one_file . '_REFERENCES';
+
+ next unless $var;
+
+ $var->transform_variable_recursively
+ ($one_file . '_DEPENDENCIES', 'am__DEPENDENCIES', 0, INTERNAL,
+ sub {
+ my ($subvar, $val, $cond, $full_cond) = @_;
+ if ($val =~ /^-r(eference)?:(.*\.dll)$/)
+ {
+ $val = $2;
+ }
+ elsif ($val =~ /^-addmodule:(.*\.netmodule)$/)
+ {
+ $val = $1;
+ }
+ else
+ {
+ return ();
+ }
+
+ # if it's a bare file name, only add it as a dependency if we know
we're building it.
+ # So -r:System.Web.dll won't create a dependency on System.Web.dll.
+ if ($val eq basename $val)
+ {
+ return $val
+ if exists $known_assemblies->{$val};
+ }
+ else
+ {
+ return $val
+ unless File::Spec->file_name_is_absolute ($val);
+ }
+ return ();
+ });
+ }
}
# Handle Mono/.NET
@@ -4763,6 +4812,9 @@ sub handle_cli
{
my %targets = ( EXE => 'exe', WINEXE => 'winexe', DLL => 'library', MODULE
=> 'module' );
my %outextns = ( EXE => '.exe', WINEXE => '.exe', DLL => '.dll', MODULE =>
'.netmodule' );
+
+ my %known_assemblies = ();
+
foreach my $target (keys %targets)
{
my @assemblies = &am_install_var ('cli', 'CLI' . $target . 'S',
@@ -4786,9 +4838,14 @@ sub handle_cli
$where->push_context ("while processing CLI assembly '$one_file'");
$where->set (INTERNAL->get);
- &handle_cli_assembly ($xname, $one_file, $where, TARGET =>
$targets{$target});
+ if (&handle_cli_assembly ($xname, $one_file, $where, TARGET =>
$targets{$target}))
+ {
+ $known_assemblies{$one_file} = $where;
+ }
}
}
+
+ handle_cli_assembly_references %known_assemblies;
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f5af67f..8708b10 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -92,6 +92,7 @@ checkall.test \
clean.test \
clean2.test \
cli1.test \
+cli2.test \
colneq.test \
colneq2.test \
colon.test \
diff --git a/tests/cli2.test b/tests/cli2.test
new file mode 100755
index 0000000..5d8ecb6
--- /dev/null
+++ b/tests/cli2.test
@@ -0,0 +1,41 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test that basic CLI functionality works.
+
+. ./defs || exit 1
+
+set -e
+
+cat >Makefile.am <<END
+CSC = mcs
+VBC = vbnc
+noinst_CLIEXES = foo.exe
+noinst_CLIDLLS = foo.dll
+foo_exe_SOURCES = a.cs
+foo_dll_SOURCES = b.cs
+foo_exe_REFERENCES = -r:foo.dll -r:System.Web.dll
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+grep 'foo_exe_DEPENDENCIES =.*System.Web.dll' Makefile.in && exit 1
+grep 'foo_exe_DEPENDENCIES =.*foo.dll' Makefile.in
--
1.5.2.1.174.gcd03
>From 2a982c2bd8f1dd990ee4dc3dcfbe307082cd3c43 Mon Sep 17 00:00:00 2001
In-Reply-To: <address@hidden>
References: <address@hidden>
From: Raja R Harinath <address@hidden>
Date: Wed, 27 Jun 2007 17:47:16 +0530
Subject: [PATCH 3/3] Add support for resources
* automake.in (handle_cli_assembly_sources): Rename from handle_cli_assembly.
(handle_cli_assembly_resources): New. Add support for handling resources.
(handle_cli_assembly): Call both the previous methods.
(cli_need_resgen): New.
(handle_cli): Use it to emit RESGEN suffix rules, if necessary.
* lib/am/cli.am (clean-%DIR%%PRIMARY%): Remove *.resources.
* tests/cli3.test: New.
* tests/Makefile.am (TESTS): Update.
---
ChangeLog | 12 ++++++
automake.in | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++-
lib/am/cli.am | 1 +
tests/Makefile.am | 1 +
tests/cli3.test | 46 +++++++++++++++++++++++++
5 files changed, 155 insertions(+), 2 deletions(-)
create mode 100755 tests/cli3.test
diff --git a/ChangeLog b/ChangeLog
index ec49428..2e75139 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2007-06-27 Raja R Harinath <address@hidden>
+ Add support for resources
+ * automake.in (handle_cli_assembly_sources): Rename from
+ handle_cli_assembly.
+ (handle_cli_assembly_resources): New. Add support for handling
+ resources.
+ (handle_cli_assembly): Call both the previous methods.
+ (cli_need_resgen): New.
+ (handle_cli): Use it to emit RESGEN suffix rules, if necessary.
+ * lib/am/cli.am (clean-%DIR%%PRIMARY%): Remove *.resources.
+ * tests/cli3.test: New.
+ * tests/Makefile.am (TESTS): Update.
+
Compute dependencies from assembly references
* automake.in (handle_cli_assembly): Return true on success.
(handle_cli_assembly_references): New.
diff --git a/automake.in b/automake.in
index 9bf8b43..c2ab593 100755
--- a/automake.in
+++ b/automake.in
@@ -4683,7 +4683,7 @@ sub handle_java
push (@all, 'class' . $dir . '.stamp');
}
-sub handle_cli_assembly ($$$%)
+sub handle_cli_assembly_sources ($$$%)
{
my ($one_file, $unxformed, $where, %transform) = @_;
my @cmdsrcs = ();
@@ -4700,7 +4700,8 @@ sub handle_cli_assembly ($$$%)
my $nodist = ($prefix =~ /^nodist_/);
my $nodefine = ($prefix =~ /EXTRA_/);
- push @cmdsrcs, "\$($outvarname)";
+ push @cmdsrcs, "\$($outvarname)"
+ unless $nodefine;
push @sources, "\$($varname)";
push @dist_sources, shadow_unconditionally ($varname, $where)
@@ -4762,6 +4763,78 @@ sub handle_cli_assembly ($$$%)
return 1;
}
+my $cli_need_resgen;
+
+sub handle_cli_assembly_resources ($$$%)
+{
+ my ($one_file, $unxformed, $where, %transform) = @_;
+ my @cmdrsrcs = ();
+
+ foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
+ 'dist_EXTRA_', 'nodist_EXTRA_')
+ {
+ my $varname = $prefix . $one_file . "_RESOURCES";
+ my $var = var $varname;
+ next unless $var;
+ my $xpfx = ($prefix eq '') ? 'am_' : $prefix;
+ my $cmdrsrc = $xpfx . $one_file . "_CMDRSRCS";
+ my $deprsrc = $xpfx . $one_file . "_DEPRSRCS";
+ my $nodist = ($prefix =~ /^nodist_/);
+ my $nodefine = ($prefix =~ /EXTRA_/);
+
+ my @distrsrcs = uniq sort map { s/^(.*),([^,]*)$/$1/; $_ }
$var->value_as_list_recursive;
+ &push_dist_common (@distrsrcs)
+ unless (option ('no-dist') || $nodist);
+
+ $var->transform_variable_recursively
+ ($deprsrc, 'am__cli', $nodefine, $where,
+ sub {
+ my ($subvar, $val, $cond, $full_cond) = @_;
+ $val =~ s/^(.*),([^,]*)$/$1/;
+ $val =~ s/\.(resx|txt|po)$/.resources/;
+ return $val;
+ });
+
+ $output_rules .= "$unxformed: \$($deprsrc)\n"
+ unless $nodefine;
+
+ push @cmdrsrcs, "\$($cmdrsrc)";
+
+ $var->transform_variable_recursively
+ ($cmdrsrc, 'am__cli', $nodefine, $where,
+ sub {
+ my ($subvar, $val, $cond, $full_cond) = @_;
+ my $rsrc_name = ();
+ my $nosrcdir = $nodist;
+ if ($val =~ /^(.*),([^,]*)$/)
+ {
+ $val = $1;
+ $rsrc_name = $2;
+ }
+ if ($val =~ /\.(resx|txt|po)$/)
+ {
+ $val =~ s/\.(resx|txt|po)$/.resources/;
+ $nosrcdir = 1;
+ $cli_need_resgen = $where;
+ }
+ my $retval = "-resource:";
+ $retval .= '$(srcdir)/'
+ unless $nosrcdir;
+ $retval .= $val;
+ $retval .= ",$rsrc_name"
+ if $rsrc_name;
+ return $retval;
+ });
+ }
+
+ return 1
+ if scalar @cmdrsrcs == 0;
+
+ define_pretty_variable ($one_file . '_CMDRSRCS', TRUE, $where, sort
@cmdrsrcs);
+
+ return 1;
+}
+
sub handle_cli_assembly_references(\%)
{
my ($known_assemblies) = @_;
@@ -4807,6 +4880,14 @@ sub handle_cli_assembly_references(\%)
}
}
+sub handle_cli_assembly ($$$%)
+{
+ my ($one_file, $unxformed, $where, %transform) = @_;
+ my $sources_ok = handle_cli_assembly_sources $one_file, $unxformed, $where,
%transform;
+ my $resources_ok = handle_cli_assembly_resources $one_file, $unxformed,
$where, %transform;
+ return $sources_ok && $resources_ok;
+}
+
# Handle Mono/.NET
sub handle_cli
{
@@ -4815,6 +4896,8 @@ sub handle_cli
my %known_assemblies = ();
+ $cli_need_resgen = ();
+
foreach my $target (keys %targets)
{
my @assemblies = &am_install_var ('cli', 'CLI' . $target . 'S',
@@ -4845,6 +4928,16 @@ sub handle_cli
}
}
+ if ($cli_need_resgen)
+ {
+ define_variable ('RESGEN', 'resgen', INTERNAL);
+ for my $ext ('.resx','.txt','.po')
+ {
+ register_suffix_rule (INTERNAL, $ext, '.resources');
+ $output_rules .= "$ext.resources:\n\t\$(RESGEN) \$< address@hidden";
+ }
+ }
+
handle_cli_assembly_references %known_assemblies;
}
diff --git a/lib/am/cli.am b/lib/am/cli.am
index 8ddbc4f..d3064b2 100644
--- a/lib/am/cli.am
+++ b/lib/am/cli.am
@@ -23,3 +23,4 @@ include data.am
clean-%DIR%%PRIMARY%:
-list='$(%DIR%_%PRIMARY%)'; for p in $$list; do \
rm -f $$p $$p.mdb $$p.pdb; done
+ -rm -f *.resources
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8708b10..e725d87 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -93,6 +93,7 @@ clean.test \
clean2.test \
cli1.test \
cli2.test \
+cli3.test \
colneq.test \
colneq2.test \
colon.test \
diff --git a/tests/cli3.test b/tests/cli3.test
new file mode 100755
index 0000000..7f5ab4c
--- /dev/null
+++ b/tests/cli3.test
@@ -0,0 +1,46 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Test that basic CLI functionality works.
+
+. ./defs || exit 1
+
+set -e
+
+cat >Makefile.am <<END
+CSC = mcs
+VBC = vbnc
+noinst_CLIEXES = foo1.exe foo2.exe foo3.exe
+foo1_exe_SOURCES = a.cs
+foo2_exe_SOURCES = a.cs
+foo3_exe_SOURCES = a.cs
+foo1_exe_RESOURCES = b.txt,Some.other.name
+foo2_exe_RESOURCES = c.resx
+foo3_exe_RESOURCES = d.ico
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+grep '^am_foo1_exe_CMDRSRCS =.*b.txt' Makefile.in && exit 1
+grep '^am_foo1_exe_CMDRSRCS =.*-resource:b.resources' Makefile.in
+grep '^am_foo2_exe_CMDRSRCS =.*c.resx' Makefile.in && exit 1
+grep '^am_foo2_exe_CMDRSRCS =.*-resource:c.resources' Makefile.in
+grep '^am_foo3_exe_CMDRSRCS =.*-resource:[^ ]*d.ico' Makefile.in
--
1.5.2.1.174.gcd03
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [RFD] Preliminary patches for Mono/.NET support,
Raja R Harinath <=