use sort "stable";
BEGIN { $ENV{LC_ALL} = "C"; }
-chdir "/pro/3gl/CPAN/perl";
-{ my @Cc = qw( Configure config_h.SH );
- system "chown merijn @Cc";
- chmod 0775, @Cc;
- #-d "merijn" or mkdir "merijn";
- #system "cp -f Configure config_h.SH Porting/Glossary Porting/config.sh merijn/";
- system "ls", "-l", @Cc;
- }
+
+use FindBin;
+use Getopt::Std;
+use Data::Dump qw(dd pp);
+
+$p5_metaconfig_base = "$FindBin::Bin/../";
+chdir "$p5_metaconfig_base/perl" or
+ die "perl/ directory missing in $p5_metaconfig_base\n";
+
+-w 'Configure' && -w 'config_h.SH' or
+ die "both Configure and config_h.SH must be writable\n";
+
+-l '.package' && -l 'U' or
+ die ".package and U should be symlinks as per README\n";
# $Id: mconfig.SH 22 2008-05-28 08:01:59Z rmanfredi $
#
# Perload ON
-$MC = '/pro/3gl/CPAN/lib/dist';
+$MC = "$p5_metaconfig_base/dist";
$version = '3.5';
$patchlevel = '0';
$grep = '/usr/bin/grep';
chop($date = `date`);
&profile; # Read ~/.dist_profile
-require 'getopts.pl';
-&usage unless &Getopts("dhkmoOstvwGMVL:");
+&usage unless getopts("dhkmoOstvwGMVL:");
$MC = $opt_L if $opt_L; # May override public library path
$MC = &tilda_expand($MC); # ~name expansion
} else {
`rm -rf .MT 2>&1`;
}
-system "/usr/bin/perl", "Porting/config_h.pl";
+system $^X, "Porting/config_h.pl";
print "Done.\n" unless $opt_s;
# General initializations
# Build the private makefile we use to compute the transitive closure of the
# previously determined dependencies.
sub build_makefile {
+ print "XXX0: entering \&build_makefile\n";
print "Computing optimal dependency graph...\n" unless $opt_s;
chdir('.MT') || die "Can't chdir to .MT\n";
local($wanted); # Wanted shell symbols
# Free memory by removing useless data structures
undef $dependencies;
undef $saved_dependencies;
+ print "XXX1: leaving \&build_makefile\n";
}
# First pass: build a private makefile from the extracted dependency, changing
}
print MAKEFILE $dependencies;
close MAKEFILE;
+ print "AAA: leaving \&build_private\n";
+ system(qq|cp -v 'Makefile' /tmp/first.Makefile|) and die "Unable to copy first Makefile: $!";
+ # Note: Everything appears okay up to this point on FreeBSD
}
# Ordering for symbols. Give higher priority to d_* ones and lower to i_* ones.
# have to load, filling in the %symwanted and %condwanted structures.
sub compute_loadable {
print " Determining loadable units...\n" unless $opt_s;
- open(MAKE, "make -n |") || die "Can't run make";
+ open(MAKE, "make -n |") || die "Can't run make";
+ #open(MAKE, "-|", "make -n") || die "Can't run make";
while (<MAKE>) {
s|^\s+||; # Some make print tabs before command
if (/^pick/) {
}
}
close MAKE;
+ print "BBB: leaving \&compute_loadable and dumping \%symwanted\n";
+ dd(\%symwanted);
+ # perllibs is not found in %symwanted on FreeBSD, though it is on Linux
}
# Now that we know all the desirable symbols, we have to rebuild
}
print MAKEFILE $saved_dependencies;
close MAKEFILE;
+ print "CCC: leaving \&update_makefile\n";
+ system(qq|cp -v 'Makefile' /tmp/second.Makefile|) and die "Unable to copy second Makefile: $!";
}
# Solve dependencies by saving the 'pick' command in @cmdwanted
local(%unitseen); # Record already picked units (avoid duplicates)
print "Determining the correct order for the units...\n" unless $opt_s;
chdir('.MT') || die "Can't chdir to .MT: $!.\n";
- open(MAKE, "make -n |") || die "Can't run make";
+ open(MAKE, "make -n |") || die "Can't run make";
+ #open(MAKE, "-|", "make -n") || die "Can't run make";
while (<MAKE>) {
s|^\s+||; # Some make print tabs before command
print "\t$_" if $opt_v;
+# On FreeBSD-10.3, we're failing to get these 2 lines:
+# pick add perllibs End
+# pick add End End
if (/^pick/) {
($pick,$cmd,$symbol,$unit) = split(' ');
push(@cmdwanted,"$cmd $symbol $unit")
}
chdir($WD) || die "Can't chdir to $WD: $!.\n";
close MAKE;
+# # Although second.Makefile looks okay, we're getting an error message:
+# `All' not remade because of errors.
+# Syntax error: EOF in backquote substitution
+# Syntax error: Error in command substitution
+ print "DDD: End of solve_dependencies and dumping \@cmdwanted\n";
+ dd(\@cmdwanted);
}
+
# Create the Configure script
sub create_configure {
print "Creating Configure...\n" unless $opt_s;