5
# This script is called to do a set of text replacements for installing
6
# a Mafile.export.package file so that external clients can use it.
8
# Read in commandline arguments
10
my $exec_prefix = ""; # [required] Abs path to base installation directory (i.e. --prefix=??? option passed to configure)
11
my $my_export_makefile = ""; # [required] Name only of installed Makefile.export.package file
12
my $my_top_srcdir = ""; # [required] Abs path to this package's top source directory
13
my $my_incl_dirs = ""; # [required] Abs path to this package's include directories
14
my $my_lib_dirs = ""; # [optional] Abs path to this package's library directories (if any exist)
15
my $dep_package_builddirs = ""; # [optional] Abs paths to other directly dependent framework package build directories (if any exist)
17
"exec-prefix=s" => \$exec_prefix,
18
"my-export-makefile=s" => \$my_export_makefile,
19
"my-abs-top-srcdir=s" => \$my_top_srcdir,
20
"my-abs-incl-dirs=s" => \$my_incl_dirs,
21
"my-abs-lib-dirs=s" => \$my_lib_dirs,
22
"dep-package-abs-builddirs=s" => \$dep_package_builddirs
25
# Validate commandline arguments
27
scalar(@ARGV) == 0 || die;
28
$exec_prefix ne "" || die;
29
$my_export_makefile ne "" || die;
30
$my_top_srcdir ne "" || die;
31
$my_incl_dirs ne "" || die;
33
# Interpret commandline arguments
35
$exec_prefix = remove_rel_paths($exec_prefix);
36
my @my_incl_dirs = split(":",$my_incl_dirs);
37
my @my_lib_dirs = split(":",$my_lib_dirs);
38
my @dep_export_package_builddirs = split(":",$dep_package_builddirs);
42
my $my_abs_export_makefile = "${exec_prefix}/include/${my_export_makefile}";
44
my $cmnd_base = "${my_top_srcdir}/config/token-replace.pl ";
46
foreach(@dep_export_package_builddirs) {
48
run_cmnd($cmnd_base . "${_} ${exec_prefix}/include ${my_abs_export_makefile} ${my_abs_export_makefile}");
52
foreach(@my_incl_dirs) {
54
run_cmnd($cmnd_base . "-I${_} -I${exec_prefix}/include ${my_abs_export_makefile} ${my_abs_export_makefile}");
58
foreach(@my_lib_dirs) {
60
run_cmnd($cmnd_base . "-L${_} -L${exec_prefix}/lib ${my_abs_export_makefile} ${my_abs_export_makefile}");
64
run_cmnd($cmnd_base . "${my_top_srcdir}/config ${exec_prefix}/include ${my_abs_export_makefile} ${my_abs_export_makefile}");
68
sub remove_rel_paths {
70
if ($entry_in=~/-L\.\./) {
73
my @paths = split("/",$entry_in);
83
return join("/",@new_paths);
87
#print "\n", $cmnd, "\n";
88
system($cmnd)==0 || die;