Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cons: Use xml2-config to set up external dependency #404

Merged
merged 3 commits into from
Oct 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 34 additions & 42 deletions mgr/ConsDefs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1049,53 +1049,45 @@
"LIBDIR = $LoggerLIBDIR \tLoggerINCDIR = $LoggerINCDIR \tLoggerLIBS = $LoggerLIBS\n"
if $LoggerLIBDIR && ! $param::quiet;
}

# xml2
my ($XMLINCDIR,$XMLLIBDIR,$XMLLIBS) = ("","","");
my ($xml) = script::find_lib($MYSTAR . "/bin /usr/bin " . $LIBXML2_DIR . "/bin " . dirname(`which xml2-config`),
"xml2-config");
if ($xml) {
$xml .= "/xml2-config";
$XMLINCDIR = `$xml --cflags`;
chomp($XMLINCDIR);
$XMLINCDIR =~ s/-I//;
my $XML = `$xml --libs`; # die "$XML\n";
my(@libs)= split(" ", $XML);

$XMLLIBDIR = shift(@libs);
if ($XMLLIBDIR =~ /-L/){
$XMLLIBDIR =~ s/-L//;
$XMLLIBS = join(" ",@libs);
} else {
# no -L, assume all were LIBS
$XMLLIBS = $XMLLIBDIR ." ".join(" ",@libs);
# and fix -L / should work for both 32 and 64
$XMLLIBDIR = "/usr/$LLIB";
}
chomp(my $xml = `which xml2-config`);

if ($?) {
die "No xml2-config found\n";
}

# ($XMLLIBDIR,$XMLLIBS) = split(' ', $XML);
# if ($XMLLIBDIR =~ /-L/){
# $XMLLIBDIR =~ s/-L//;
# } else {
# # may not have any -L
# if ($XMLLIBS
# }
my ($XMLINCDIR,$XMLLIBDIR,$XMLLIBS) = ("","","");

my $XMLVersion = `$xml --version`; # print "XMLVersion = $XMLVersion\n";
my ($major,$minor) = split '\.', $XMLVersion; # print "major = $major,minor = $minor\n";
$XMLCPPFlag = "";#-DXmlTreeReader";
if ($major < 2 or $major == 2 and $minor < 5) {
$XMLCPPFlag = "-DNoXmlTreeReader";
}
if ( ! $param::quiet ){
if ( $XMLLIBDIR ){
print "Use xml $xml XMLLIBDIR = $XMLLIBDIR \tXMLINCDIR = $XMLINCDIR \tXMLLIBS = $XMLLIBS XMLCPPFlag =$XMLCPPFlag\n";
} else {
print "Use xml -> WARNING ** Could not define XMLLIBDIR, XMLINCDIR, XMLLIBS\n";
}
}
$XMLINCDIR = `$xml --cflags`;
chomp($XMLINCDIR);
$XMLINCDIR =~ s/-I//;
my $XML = `$xml --libs`; # die "$XML\n";
my(@libs)= split(" ", $XML);

$XMLLIBDIR = shift(@libs);
if ($XMLLIBDIR =~ /-L/){
$XMLLIBDIR =~ s/-L//;
$XMLLIBS = join(" ",@libs);
} else {
print "Could not find xml libs\n" if (! $param::quiet);
# no -L, assume all were LIBS
$XMLLIBS = $XMLLIBDIR ." ".join(" ",@libs);
# and fix -L / should work for both 32 and 64
$XMLLIBDIR = "/usr/$LLIB";
}

my $XMLVersion = `$xml --version`; # print "XMLVersion = $XMLVersion\n";
my ($major,$minor) = split '\.', $XMLVersion; # print "major = $major,minor = $minor\n";
$XMLCPPFlag = "";#-DXmlTreeReader";
if ($major < 2 or $major == 2 and $minor < 5) {
$XMLCPPFlag = "-DNoXmlTreeReader";
}
if ( ! $param::quiet ){
if ( $XMLLIBDIR ){
print "Using $xml\n\tXMLLIBDIR = $XMLLIBDIR\n\tXMLINCDIR = $XMLINCDIR\n\tXMLLIBS = $XMLLIBS\n\tXMLCPPFlag = $XMLCPPFlag\n" if !$param::quiet;
} else {
print "Use xml -> WARNING ** Could not define XMLLIBDIR, XMLINCDIR, XMLLIBS\n";
}
}

chomp($FASTJET_PREFIX = `fastjet-config --prefix`);
Expand Down