Strawberry Perl Home

Building your own "strawberry-like"
perl distribution (via MSM merge module)

What do I need?

Start with an installation of any version of Strawberry Perl 5.12.x (or higher). BEWARE:You'll need to install Strawberry Perl to a directory OTHER THAN C:\strawberry.

Install WiX-3.0 installer from http://wix.sourceforge.net/downloadv3.html

Install 4 modules, in this order:

What do I do after everything's installed?

There are two more things to do:

  • Create a script - let's call it build_perl.pl - like this:
  • package CustomPerlBuild;
    
    use strict;
    use warnings;
    use File::Temp;
    use File::Spec::Functions  qw( catdir catfile );
    use File::Slurp            qw( write_file );
    use parent 'Perl::Dist::Strawberry';
    
    sub new {
      my ($class, $workdir) = @_;  
      die "FATAL: workdir name must be defined and can't contain spaces" if !$workdir || $workdir =~ / /;
      my %args = (
        # Set this to 2 for now. You can set it to 1 later.
        trace                => 2,
        temp_dir             => $workdir,
        image_dir            => catdir($workdir, 'strawberry'),
        perl_version         => '5142',
        # Change these as appropriate for what you want to call your distribution.
        app_publisher_url    => 'http://publisher.website.invalid/',
        app_id               => 'customperl',
        app_name             => 'Custom Perl',
        app_publisher        => 'Publisher Name',
        build_number         => 11, #the 4th digit in version 5.14.2.
        # These are the locations to pull down the msm. 
        bits                 => 32, #32|64 - should correspond to chosen MSM
        msm_to_use           => 'http://strawberryperl.com/package/kmx/p5.14.2.1-RC/strawberry-perl-5.14.2.1-32bit.msm',
        msm_zip              => 'http://strawberryperl.com/package/kmx/p5.14.2.1-RC/strawberry-perl-5.14.2.1-32bit.zip',
        msm_code             => '72014D7D-5EC7-3665-9F97-959C988CA754',
        fileid_perl          => 'F_exe_MzA1Mjk2NjIyOQ',
        fileid_relocation_pl => 'F_tab_Mzg0NDgwNzYyMQ',
        # Tasklist
        tasklist => [
          'final_initialization',
          'initialize_using_msm',
          'install_extra_modules',
          'install_win32_extras',
          'install_strawberry_extras',
          'install_relocation_information',
          'remove_waste',
          'install_readme',
          'regenerate_fragments',
          'write',
        ],
      );
      return $class->SUPER::new( \%args );
    }
    
    sub install_readme {  # README.txt is mandatory, must be included into Win32Extras fragment
      my $self = shift;
      write_file( $self->file('README.txt'), <add_to_fragment('Win32Extras', [$self->file('README.txt')]);
    }
    
    sub install_extra_modules {
      my $self = shift;
      #$self->install_module( name=>'YAML::XS' );        
      $self->install_module( name=>'Spreadsheet::ParseExcel', follow_deps=>1, force=>1 );
    }
    
    sub _build_output_base_filename { # the output filename for ZIP/MSI e.g. 'customperl-5.14.2.11-20111124-32bit'
      my $self = shift;
      my $string = $self->app_id . '-'
                 . $self->perl_version_human . '.'
                 . $self->build_number . '-'
                 . $self->output_date_string . '-'
                 . $self->bits . 'bit';
      return $string;
    }
    	  
    package main;
    
    my $dist = CustomPerlBuild->new( 'c:\buildtmp' );
    $dist->run();
    	  
  • Run build_perl.pl + wait a few minutes, and you're done.

If you want to do more complicated things than just add additional modules, read the Perl::Dist::WiX documentation, and then e-mail us and we'll do our best to help you out.