App-Bootstrap-Perl

 view release on metacpan or  search on metacpan

bin/bootstrap-perl  view on Meta::CPAN

}

chdir "$build_path_perl"; # important, I don't remember for what below
print_and_system "cd $build_path_perl && rm -f $build_path_perl/.git/index.lock";
print_and_system "cd $build_path_perl && git reset --hard";
print_and_system "cd $build_path_perl && git clean -dxf";
print_and_system "cd $build_path_perl && git checkout blead";
print_and_system "cd $build_path_perl && git stash";
print_and_system "cd $build_path_perl && git pull";
print_and_system "cd $build_path_perl && git stash";
print_and_system "cd $build_path_perl && git checkout $version";
print_and_system "cd $build_path_perl && git pull";

# ========= version =========

my $gitdescribe;
$gitdescribe = print_and_qx_chomp qq!cd $build_path_perl && git describe --all!;
$gitdescribe = print_and_qx_chomp qq!cd $build_path_perl && git describe! if ($gitdescribe =~ m,/, && $gitdescribe !~ m,tags/,);
$gitdescribe =~ s|^tags/||g;
my $gitchangeset = print_and_qx_chomp qq!cd $build_path_perl && git rev-parse HEAD!;
my ($perl_revision, $perl_version, $perl_subversion) = $gitdescribe =~ m/^\D*(\d+)[._](\d+)(?:[._](\d+))?.*$/g;
$perl_version    = sprintf("%02d", $perl_version);
$perl_subversion ||= 0;
$VERSION = eval("v$perl_revision.$perl_version.$perl_subversion");

# ========= cherry-picks  =========

# cherry pick several bugfixes in 5.8/5.9 that break building
if (v5.8.0 le $VERSION && $VERSION le v5.9.4) {
        print $LOGFILE "*** cherry-pick building fixes for older perl versions\n";
        # FIX: <command-line>
        print_and_system qq!cd $build_path_perl && git cherry-pick -n cf14425e2bd169ce935f76d359f3253b51e441a0!;
        # FIX: rebuild / gcc -g
        print_and_system qq!cd $build_path_perl && git cherry-pick -n a3d1be69db4c082c1b9cef14f51a6e7fe4a9dac9!;
        # FIX: makedepend.SH
        print_and_system qq!cd $build_path_perl && git cherry-pick -n 96a8704c85b1e14bb3d63195b0b720f2fd5b8182!;
        # FIX: create missing link (5.8.8)
        print_and_system q'sudo ln -sf `find  /usr/src -name page.h | grep arch/x86/include/asm/page.h | tail -1` /usr/include/asm/'  if ! -e "/usr/include/asm/page.h";
}

if ($VERSION lt v5.12.4) {
        print $LOGFILE "*** cherry-pick: fix search libs in configure\n";
        print_and_system qq!cd $build_path_perl && git cherry-pick -n 40f026236b9959b7ad3260fedc6c66cd30bb7abc!;
        print_and_system qq!cd $build_path_perl && git cherry-pick -n bcab1245a0693be445ce018352f6fbe4abc26e88!;
}

# ========== prepare paths ==========

unless (defined $perl_revision && defined $perl_version)
{
        no warnings 'uninitialized';
        print $USER "# Bummer! Unrecognized version schema ($gitdescribe).\n";
        print $USER "# ($perl_revision, $perl_version, $perl_subversion)\n";
        exit 1;
}

my $codespeed_executable =            _perl_exe_name  ($perl_revision, $perl_version, $perl_subversion, $usethreads, $bit64, $taintsupport, $silentnotaint, $gitdescribe, $gitchangeset, \@EXESUFFIXES, $blead);
my $PREFIX               = $prefix || _perl_pathprefix($perl_revision, $perl_version, $perl_subversion, $usethreads, $bit64, $taintsupport, $silentnotaint, $gitdescribe, $gitchangeset, \@EXESUFFIXES, $blead);
my $USETHREADS           = $usethreads ? "-Dusethreads"  : "";
my $BIT64                = $bit64      ? "-Duse64bitall" : "";
my $TAINTSUPPORT         = $taintsupport ? "" : ($silentnotaint ? "-Accflags=-DSILENT_NO_TAINT_SUPPORT" : "-Accflags=-DNO_TAINT_SUPPORT");

print $USER "\n";
print $USER "============================================================\n\n";
print $USER "  Bootstrap Perl\n";
print $USER "  --------------\n\n";
print $USER "  version:        $version\n\n";
print $USER "  git-describe:   $gitdescribe\n\n";
print $USER "  git-changeset:  $gitchangeset\n\n";
print $USER "  codespeed name: $codespeed_executable\n\n";
print $USER "  PREFIX:         $PREFIX\n\n";
print $USER "  configureargs:  ".join("\n                  ", @confargs)."\n\n";
print $USER "  CPAN mirrors:   ".join("\n                  ", @CPANMIRRORS)."\n\n";
print $USER "  modules:        ".join("\n                  ", @MODULES)."\n\n";
print $USER "  scripts:        ".join("\n                  ", map { $_ ." ".join(" ", @RUNARGS) } @RUNSCRIPTS)."\n\n";
print $USER "============================================================\n\n";

my @in_blead = grep { / blead$/ }
               map  { chomp ; $_ }
               print_and_qx qq!git branch --contains $gitchangeset!;
if ($blead && !@in_blead) {
        print $USER "# Bummer!\n";
        print $USER "#   Use '--blead' only with commits in blead branch.\n";
        exit 1;
}
$ENV{PERL_AUTOINSTALL} = "--defaultdeps";
$ENV{TEST_JOBS}        = $threadcount;
$ENV{TWMC_TEST_PORT}   = "9876";

my $perl_exe = "$PREFIX/bin/perl";

my $THREADS = $jobs ? "-j $jobs" : "-j $threadcount";
my $DRY = $dry ? "-n" : "";

# ========== build ==========

if ($forcebuildperl or ! -x $perl_exe )
{
        print $USER "*** BUILD perl\n";

        # ========== metainfo in Perl Config ==========

        # This (mis-)uses a built-in mechanism in Configure.
        #
        # Ultimately we want to inject meta information so it appears
        # later in Perl's %Config.
        #
        # Instead of dumping metadata directly into "config.arch" it
        # generates script code in there that in turn appends variable
        # assignments to "UU/config.sh" which in turn pretend to
        # later Configure steps that there would be configuration data
        # of an earlier session which it then merges into %Config.
        #
        # It should work for any ancient or future Perl 5 version.
        # Credits to Tux for help sorting this out.

        my $config_arch;
        print $LOGFILE "*** CONFIGURE meta information for Perl's \%Config via config.arch\n";
        open ($config_arch, ">>", "$build_path_perl/config.arch") and do {
                print $config_arch qq!\
cat >> UU/config.sh <<EOUUCONFIG

bin/bootstrap-perl  view on Meta::CPAN


Run the perl test suite:

  $ bootstrap-perl --test
  $ bootstrap-perl -t

Default is B<not> to run the tests.

=head3 (re-)build Perl

You can specify whether you want to compile perl even when an
executable C<perl> already exists:

  $ bootstrap-perl --forcebuildperl
  $ bootstrap-perl --noforcebuildperl

Default is B<off>.

=head3 bootstrap CPAN

You can specify whether to bootstrap a full CPAN environment with
distroprefs and dependencies:

  $ bootstrap-perl --cpan
  $ bootstrap-perl --nocpan

Default is B<on>.

=head3 (re-)configure CPAN

You can specify whether to (re-)write a CPAN config
(C<CPAN/Config.pm>, C<CPAN/MyConfig.pm>) even when it already exists:

  $ bootstrap-perl --forcecpancfg
  $ bootstrap-perl --noforcecpancfg

Default is B<on>.

=head3 use threads

Build a threaded Perl (C<-Dusethreads>):

  $ bootstrap-perl --usethreads

which is already the default. To build non-threaded Perl use:

  $ bootstrap-perl --nousethreads

=head3 use 64bit

Build a 64bit enabled Perl (C<-Duse64bitall>):

  $ bootstrap-perl --use64bit

which is already the default. To build Perl without 64bit use:

  $ bootstrap-perl --nouse64bit

=head3 taint support

Perl can be built without taint support (C<-DNO_TAINT_SUPPORT>, C<-DSILENT_NO_TAINT_SUPPORT>).

To build a Perl with taint support:

  $ bootstrap-perl --taintsupport

which is already the default.

To build Perl without taint support use:

  $ bootstrap-perl --notaintsupport

To make the notaintsupport silent, combine it with --silentnotaint:

  $ bootstrap-perl --notaintsupport --silentnotaint

(sic, both are needed).

=head3 version numbers vs. blead

By default the Perl version number is derived from git-describe and
kept for later reference (e.g., for codespeed exe name). However, if you
specify

  $ bootstrap-perl --blead

then the version used in paths or codespeed executables is using
"blead" in order to generate a make it belong to to a common
development line besides the yearly segmented graphs.

It is only possible to use C<--blead> with development versions in
order to create consistent results from only the blead branch.

Note that C<--blead> does not set a version but only modifies the
formats of path prefix and how the version is reported to
Perl::Formance; it is B<not> the same as C<--version blead>.

=head3 configure CPAN and modules

Configure CPAN to use these mirrors:

  $ bootstrap-perl --mirror file:///home/ss5/MINICPAN/
  $ bootstrap-perl -m file:///home/ss5/MINICPAN/ -m ftp://ftp.rub.de/pub/CPAN/
  $ bootstrap-perl -m file:///home/ss5/MINICPAN/,ftp://ftp.rub.de/pub/CPAN/

(Option can be repeated and allow comma separated lists.)

Install these modules from CPAN:

  $ bootstrap-perl --module YAML::Syck
  $ bootstrap-perl --module YAML::Syck --forcemoduleinstall
  $ bootstrap-perl -M YAML::Syck -M Digest::SHA1 -M IO::Tty -M LWP
  $ bootstrap-perl -M YAML::Syck,Digest::SHA1 -M IO::Tty,LWP

(Option can be repeated and allow comma separated lists.)

=head3 run scripts

Run these scripts relative to built <PREFIX>/bin/:

  $ bootstrap-perl --run tapper-testsuite-benchmark-perlformance



( run in 2.351 seconds using v1.01-cache-2.11-cpan-4e7a2411597 )