/usr/sbin/gpt-to-pkgconfig is in grid-packaging-tools 3.6.7-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | #! /usr/bin/perl
# This script parses a source package gpt metadata file ($ARGV[0]) and
# generates a pkg-config file containing equivalent metadata with package names
# modified so that _ becomes -. The resulting pkg-config file is written
# to pkg_data_src.pc.in in the directory where $ARGV[0] was located. This
# must be run through an autoconf substitution (or equivalent) to resolve
# paths to $prefix, $exec_prefix, $libdir, $includedir, and $flavorincludedir
#
# This script ignores version aging and assumes that any version >= than the
# version named in the metadata is compatible.
#
# This script is based on one by Mattias Ellert, but rewritten to use
# XML::Parser for compatibility with certain linux distributions without
# requiring perl modules that are in their package sets
use XML::Parser;
my $parser = new XML::Parser(Style => 'Objects', Pkg => 'GPT');
my $doc = $parser->parsefile($ARGV[0]);
my $gptmeta = $doc->[0];
my $gptname = $gptmeta->{Name};
my $gptagingver = (grep { ($_->isa('GPT::Aging_Version')) } @{$gptmeta->{Kids}})[0];
my $gptmajorver = $gptagingver->{Major};
my $gptminorver = $gptagingver->{Minor};
my $description_element = (grep
{ ($_->isa('GPT::Description')) }
@{$gptmeta->{Kids}})[0];
my $description = $description_element->{Kids}->[0]->{Text};
my %deps;
my $srcpkg = (grep
{ ($_->isa('GPT::src_pkg')) }
@{$gptmeta->{Kids}})[0];
my $sourcedeps_element = (grep
{ ($_->isa('GPT::Source_Dependencies')) }
@{$srcpkg->{Kids}});
for my $bindep (grep
{ ($_->isa('GPT::Source_Dependencies')) }
@{$srcpkg->{Kids}})
{
my $type = $bindep->{Type};
next unless $type eq 'compile';
for my $dep (grep { $_->isa('GPT::Dependency') } @{$bindep->{Kids}})
{
my $depname = $dep->{Name};
$depname =~ tr/_/-/;
my $depversion = (grep {$_->isa('GPT::Version')} @{$dep->{Kids}})[0];
my $depverelement = (grep {$_->isa('GPT::Simple_Version')}
@{$depversion->{Kids}})[0];
my $depver = $depverelement->{Major};
$deps{$depname} = $depver;
}
}
my $buildenv = (grep {$_->isa('GPT::Build_Environment')} @{$srcpkg->{Kids}})[0];
my $cflagselem = (grep { $_->isa('GPT::cflags') } @{$buildenv->{Kids}})[0];
my $cflags = $cflagselem->{Kids}->[0]->{Text};
my $extincelem = (grep { $_->isa('GPT::external_includes') } @{$buildenv->{Kids}})[0];
my $extinc = $extincelem->{Kids}->[0]->{Text};
my $pkglibselem = (grep { $_->isa('GPT::pkg_libs') } @{$buildenv->{Kids}})[0];
my $pkglibs = $pkglibselem->{Kids}->[0]->{Text};
my $extlibselem = (grep { $_->isa('GPT::external_libs') } @{$buildenv->{Kids}})[0];
my $extlibs = $extlibselem->{Kids}->[0]->{Text};
my $name = $gptname;
$name =~ tr/_/-/;
$description =~ s!^\s+|\s+$!!g;
$description =~ s!\s+! !g;
my $version = "$gptmajorver.$gptminorver";
my $libs = "-L\${libdir} $pkglibs";
$libs =~ s!^\s+|\s+$!!g;
$libs =~ s!\s+! !g;
$extlibs =~ s!^\s+|\s+$!!g;
$extlibs =~ s!\s+! !g;
$cflags = "$cflags -I\${includedir} -I\${flavorincludedir} $extinc";
$cflags =~ s!^\s+|\s+$!!g;
$cflags =~ s!\s+! !g;
my $outfile = $ARGV[0];
if ($outfile =~ m|/|)
{
$outfile =~ s|/[^/]*$|/pkg_data_src.pc.in|;
}
else
{
$outfile = 'pkg_data_src.pc.in';
}
# Add fake dependency for other things that were detected in autoconf using
# pkg-config autoconf macros
$deps{'@GPT_PKGCONFIG_DEPENDENCIES@'} = 0;
local(*OUTFILE);
open(OUTFILE, ">$outfile");
print OUTFILE "prefix=\@prefix\@\n";
print OUTFILE "exec_prefix=\@exec_prefix\@\n";
print OUTFILE "libdir=\@libdir\@\n";
print OUTFILE "includedir=\@includedir\@\n";
print OUTFILE "GLOBUS_FLAVOR_NAME=\@GLOBUS_FLAVOR_NAME\@\n";
print OUTFILE "flavorincludedir=\@flavorincludedir\@\n";
print OUTFILE "\n";
print OUTFILE "Name: $name\n";
print OUTFILE "Description: Globus Toolkit - $description\n";
print OUTFILE "Version: $version\n";
print OUTFILE "Requires.private:";
while (($key, $value) = each(%deps)) {
print OUTFILE ($value > 0 ? " $key >= $value" : " $key");
}
print OUTFILE "\n";
print OUTFILE "Libs: $libs\n";
print OUTFILE "Libs.private: $extlibs\n";
print OUTFILE "Cflags: $cflags\n";
|