From 10db179b61f038a9b7c4fcdfae77699c6c75fcc2 Mon Sep 17 00:00:00 2001 From: eschnett Date: Fri, 10 Aug 2012 22:04:02 +0000 Subject: Take REQUIRES and OPTIONAL into account when determining library link order git-svn-id: http://svn.cactuscode.org/flesh/trunk@4860 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/sbin/CST | 18 ++++++++++++++++-- lib/sbin/CreateConfigurationBindings.pl | 10 +++++----- 2 files changed, 21 insertions(+), 7 deletions(-) (limited to 'lib/sbin') diff --git a/lib/sbin/CST b/lib/sbin/CST index 6dea94ca..8108da7c 100644 --- a/lib/sbin/CST +++ b/lib/sbin/CST @@ -591,12 +591,26 @@ sub TopoSort { $thorn_ancestor{"\U$thorn\E"} .= $interface->{"IMPLEMENTATION \U$ancestor_imp\E THORNS"}. ' '; } + $thorn_requires{"\U$thorn\E"} = ''; + foreach $capability (split(' ', $cfg->{"\U$thorn REQUIRES\E"})) + { + foreach $thorn2 (sort keys %thorns) + { + foreach $capability2 (split(' ', $cfg->{"\U$thorn2 PROVIDES\E"})) + { + if ("\U$capability\E" eq "\U$capability2\E") + { + $thorn_requires{"\U$thorn\E"} .= " $thorn2"; + } + } + } + } - my @uses_thorns = split (' ', $cfg->{"\U$thorn\E USES THORNS"} . ' ' . $thorn_ancestor{"\U$thorn\E"}); + my @uses_thorns = split (' ', $cfg->{"\U$thorn\E USES THORNS"} . ' ' . $cfg->{"\U$thorn\E REQUIRES THORNS"} . ' ' . $thorn_requires{"\U$thorn\E"} . ' ' . $thorn_ancestor{"\U$thorn\E"}); my $uses_thorns = ''; foreach (@uses_thorns) { - # ignore if a thorn wants to use only itself + # ignore if a thorn wants to use itself # otherwise we'll get a cyclic list later in the topological sort $uses_thorns .= "$thorn $_\n" if ($thorn ne $_); } diff --git a/lib/sbin/CreateConfigurationBindings.pl b/lib/sbin/CreateConfigurationBindings.pl index 82466336..0abd5f16 100644 --- a/lib/sbin/CreateConfigurationBindings.pl +++ b/lib/sbin/CreateConfigurationBindings.pl @@ -134,18 +134,18 @@ sub CreateConfigurationBindings &WriteFile("Capabilities/cctki_\U$providedcap\E.h",\$incs); &WriteFile("Capabilities/make.\U$providedcap\E.deps",\$deps); - # ES 2011-11-25: I don't understand these lines, so I'm - # leaving them alone + # Create a list of thorns that provide a capability with + # a library (or library search paths) if ($cfg->{"\U$thorn $providedcap\E LIBRARY"}) { $linker_thorns{"$thorn"} = $thorn; - $linker_cfg{"\U$thorn\E USES"} = $cfg->{"\U$thorn\E USES THORNS"}; + #$linker_cfg{"\U$thorn\E USES"} = $cfg->{"\U$thorn\E USES THORNS"}; } if ($cfg->{"\U$thorn $providedcap\E LIBRARY_DIRECTORY"}) { $linker_thorns{"$thorn"} = $thorn; - $linker_cfg{"\U$thorn\E USES"} = $cfg->{"\U$thorn\E USES THORNS"}; + #$linker_cfg{"\U$thorn\E USES"} = $cfg->{"\U$thorn\E USES THORNS"}; } } } @@ -197,7 +197,7 @@ sub CreateConfigurationBindings $linkerdirs = 'LIBDIRS +='; $linkerlibs = 'LIBS +='; - $linker_list = &TopoSort(\%linker_thorns, \%linker_cfg); + $linker_list = &TopoSort(\%linker_thorns, \%linker_cfg, $cfg); foreach $thorn (split (' ', $linker_list)) { foreach $providedcap (split (' ', $cfg->{"\U$thorn\E PROVIDES"})) -- cgit v1.2.3