diff options
author | eschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2012-05-02 23:54:25 +0000 |
---|---|---|
committer | eschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2012-05-02 23:54:25 +0000 |
commit | 026a19d48f2024e7f81515925e0aedc1cd60a400 (patch) | |
tree | 4abc3bbceee1f2fac07cd454c3bec0ad2ffd76da /lib | |
parent | 694da8ef6fb4646a52d0272aaacc8df5474680ae (diff) |
Handle requirements recursively
If A requires B, and B requires C, then A also requires C. This is
necessary e.g. for include directories: If A includes a file from B,
which in turn includes a file from C, then C's include directory must
be in the search path of A.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4811 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sbin/CreateConfigurationBindings.pl | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/lib/sbin/CreateConfigurationBindings.pl b/lib/sbin/CreateConfigurationBindings.pl index e0d36ede..7eceb6ed 100644 --- a/lib/sbin/CreateConfigurationBindings.pl +++ b/lib/sbin/CreateConfigurationBindings.pl @@ -21,7 +21,7 @@ require "$sbin_dir/CSTUtils.pl"; sub CreateConfigurationBindings { my($bindings_dir, $cfg, $thorns)=@_; - my($field, $providedcap, $providedcaplist, $thorn, $temp,$defs,$incs,$deps,$linkerflagdirs,$linkerflaglibs); + my($field, $providedcap, $thorn, $temp,$defs,$incs,$deps,$linkerflagdirs,$linkerflaglibs); my(%linker_thorns, %linker_cfg, $linker_list, $linkerdirs, $linkerlibs); if(! $build_dir) @@ -59,12 +59,38 @@ sub CreateConfigurationBindings mkdir('Thorns', 0755) || die "Unable to create Thorns directory"; } + # Turn optional capabilities into required capabilities, if the + # capability is provided. This way we don't have to treat required + # and optional requirements differently. + my %providedcaps; + foreach my $thorn (sort keys %thorns) + { + if ($cfg->{"\U$thorn\E PROVIDES"}) + { + foreach my $providedcap (split (' ', $cfg->{"\U$thorn\E PROVIDES"})) + { + $providedcaps{$providedcap} = 1; + } + } + } + foreach my $thorn (sort keys %thorns) + { + if ($cfg->{"\U$thorn\E OPTIONAL"}) + { + foreach my $optionalcap (split (' ', $cfg->{"\U$thorn\E OPTIONAL"})) + { + if ($providedcaps{$optionalcap}) + { + $cfg->{"\U$thorn\E REQUIRES"} .= "$optionalcap "; + } + } + } + } # These strings go directly into the Cactus executable my $linkerflagdirs = ''; my $linkerflaglibs = ''; - my $providedcaplist = ''; # Put all the provided capabilities where they belong foreach my $thorn (sort keys %thorns) { @@ -75,11 +101,19 @@ sub CreateConfigurationBindings foreach my $providedcap (split (' ', $cfg->{"\U$thorn\E PROVIDES"})) { die if $providedcap !~ m{^[A-Za-z0-9_.]+$}; - $providedcaplist .= "$providedcap "; my $defs = ''; my $incs = ''; my $deps = ''; + + # Add requirements recursively + foreach my $requiredcap (split (' ', $cfg->{"\U$thorn\E REQUIRES"})) + { + next if $requiredcap eq $providedcap; + $defs .= "include $bindings_dir/Configuration/Capabilities/make.\U$requiredcap\E.defn\n"; + $incs .= "#include \"cctki_\U$requiredcap\E.h\"\n"; + $deps .= "include $bindings_dir/Configuration/Capabilities/make.\U$requiredcap\E.deps\n"; + } # Put include_dirs and make.definition in one file: # make.capability.defn @@ -145,22 +179,6 @@ sub CreateConfigurationBindings } } - # turn optional capabilities into required capabilities, if the - # capability is provided - foreach $thorn (sort keys %thorns) - { - if ($cfg->{"\U$thorn\E OPTIONAL"}) - { - foreach $cap (split (' ', $cfg->{"\U$thorn\E OPTIONAL"})) - { - if ($providedcaplist =~ m/\b$cap\b/i) - { - $cfg->{"\U$thorn\E REQUIRES"} .= "$cap "; - } - } - } - } - # here we add the files to the thorns that require capabilities foreach $thorn (sort keys %thorns) { |