Shipwright

 view release on metacpan or  search on metacpan

share/bin/shipwright-builder  view on Meta::CPAN


        # we don't want any prereqs any more!
        no warnings 'once';
        $CPAN::Config->{prerequisites_policy} = 'ignore';
    };

# this dirty hack means that ExtUtils::AutoInstall won't try to recurse and run cpan
    $ENV{'PERL5_CPANPLUS_IS_RUNNING'} = 1;
    $ENV{'AUTOMATED_TESTING'}         = 1;    # Term::ReadLine::Perl and others
                                              # use this to not prompt
    $ENV{PERL_MM_USE_DEFAULT}         = 1;
    $ENV{PERL_MM_OPT}                 = '';
    $ENV{MODULEBUILDRC}               = '';

    mkdir 'dists' unless -e 'dists';

    unless ( $args{perl} && -e $args{perl} ) {
        my $perl = catfile( $args{'install-base'}, 'bin', 'perl' );
        $args{perl} = -e $perl ? $perl : $^X;
    }

    $args{perl} = $bin_quote . $args{perl} . $bin_quote
      if $args{perl} =~ /\s/
          && $args{perl} !~ /^$bin_quote/;

    if ( $args{'no-install-base'} ) {
        for my $dist (@$order) {
            _install( $dist, $log );
            if ( $dist =~ /^perl/ ) {
                my $perl = catfile( $args{'install-base'}, 'bin', 'perl' );
                $args{perl} = -e $perl ? $perl : $^X;
            }

            chdir $build_base;
        }
        print "install finished\n";
    }
    else {
        open my $fh, '>', '__install_base'
          or confess "can't write to __install_base: $!";
        print $fh $args{'install-base'};
        close $fh;

        {

            no warnings 'uninitialized';
            $ENV{DYLD_LIBRARY_PATH} =
              catdir( $args{'install-base'}, 'lib' ) . ':'
              . $ENV{DYLD_LIBRARY_PATH};
            $ENV{LD_LIBRARY_PATH} =
              catdir( $args{'install-base'}, 'lib' ) . ':'
              . $ENV{LD_LIBRARY_PATH};
            _set_perl5lib();

            $ENV{PATH} =
                catdir( $args{'install-base'}, 'sbin' ) . ':'
              . catdir( $args{'install-base'}, 'bin' ) . ':'
              . catdir( $args{'install-base'}, 'usr', 'sbin' ) . ':'
              . catdir( $args{'install-base'}, 'usr', 'bin' ) . ':'
              . $ENV{PATH};
            $ENV{LDFLAGS} .= ' -L' . catdir( $args{'install-base'}, 'lib' );
            $ENV{CFLAGS}  .= ' -I' . catdir( $args{'install-base'}, 'include' );
        }

        mkpath $args{'install-base'} unless -e $args{'install-base'};

        mkdir catdir( $args{'install-base'}, 'etc' )
          unless -e catdir( $args{'install-base'}, 'etc' );
        mkdir catdir( $args{'install-base'}, 'tools' )
          unless -e catdir( $args{'install-base'}, 'tools' );

        for ( 'shipwright-script-wrapper', 'shipwright-perl-wrapper' ) {
            rcopy( catfile( 'etc', $_ ),
                catfile( $args{'install-base'}, 'etc', $_ ) );
        }

        for ( 'shipwright-utility', 'shipwright-source-bash',
            'shipwright-source-tcsh' )
        {
            rcopy( catfile( 'etc', $_ ),
                catfile( $args{'install-base'}, 'tools', $_ ) );
        }

        chmod oct 755,
          catfile( $args{'install-base'}, 'tools', 'shipwright-utility' );

        # remove lib it's symbolic link
        for my $r ('lib') {
            my $dir = catdir( $args{'install-base'}, $r );
            unlink $dir if -l $dir;
        }

        # remove (usr/)?s?bin if it's an install from start
        unless ( keys %$installed_hash ) {
            for my $r (
                'bin', 'sbin',
                catdir( 'usr', 'bin' ),
                catdir( 'usr', 'sbin' ),
              )
            {
                my $dir = catdir( $args{'install-base'}, $r );
                next unless -e $dir;
                rmtree($dir);
            }
        }

        for my $dist (@$order) {
            _install( $dist, $log );
            _record( $dist, $log );
            if ( $dist =~ /^perl/ ) {
                my $perl = catfile( $args{'install-base'}, 'bin', 'perl' );
                $args{perl} = -e $perl ? $perl : $^X;
                _set_perl5lib();
            }
            chdir $build_base;
        }

        mkdir catdir( $args{'install-base'}, 'bin' )
          unless -e catdir( $args{'install-base'}, 'bin' );

        # in case wrappers are overwritten by accident



( run in 1.576 second using v1.01-cache-2.11-cpan-5735350b133 )