GBrowse

 view release on metacpan or  search on metacpan

contrib/install_macosx/scripts/build-libraries.pl  view on Meta::CPAN


# Generate the ReadMes and scripts for the package
print_readme();
#print_welcome();

#################################################################
##                       END MAIN
#################################################################


sub build_libraries {
  cpan_installs(\@EASY_INSTALLS,'basic');
  build_zlib();
  build_libjpeg();
  build_libpng();
  ###  build_freetype();  # unnecessary
  ###  build_libiconv();  # unnecessary
  build_readline();   # The AceDB package builds this as well - oh well...
  build_libgd();
  build_GD();
  build_expat();
  build_aceperl();
  cpan_installs(\@XML_MODULES,'basic');  # XML modules

  # XML dependencies satisfied, let's install SOAP::Lite
  # Also installs: MIME::Lite, Mime::Parser, MIME::Tools, Mail::Tools, etc
  cpan_installs([qw/SOAP::Lite/],'basic');
  build_DBD();
  build_bioperl();
}

# Try flushing the cahce
sub cpan_installs {
  my ($modules,$type) = @_;
  foreach my $module (@$modules) {
    my $module_obj = $cpan->module_tree()->{$module};
    
    # force install, because the package list might just say it is
    # already there...
    my $result  = $module_obj->install(force=>1);
    my $path    = $module_obj->pathname();
    my $version = $module_obj->version();
    
    # Flush the perl5lib cache to ensure that newly installed modules
    # become part of our @INC.
    $cpan->flush('lib');
    $config->stuff_results($module,$result,$version,$path);
  }
}

########
# zlib #
########
sub build_zlib {
  my $version = $config->version('zlib');
  my $url     = $config->url('zlib');
  my $file    = "zlib-$version.tar.gz";
  my $command=<<END;
  set -x
   cd $build
   setenv PERL5LILB $perllib; export PERL5LIB
   printenv
   if [ -e "$file" ]; then
    echo "$file already fetched"
  else
     curl -O $url/$file
  fi
  gnutar xzf $file
  pushd zlib-$version/
  ./configure --prefix=$local
  make
  make install
  ranlib $lib/libz.a
  popd
END
  
  my $result = system($command);
  $config->stuff_results('zlib',$result,$version,$local);
}


###########
# libjpeg #
###########
sub build_libjpeg {
  my $version = $config->version('libjpeg');
  my $url     = $config->url('libjpeg');
  my $file    = "jpegsrc.v$version.tar.gz";
  my $command=<<END;
  set -x
  cd $build
  if [ -e "$file" ]
   then
     echo "$file already downloaded"
  else
     curl -O $url/$file
  fi
  gnutar xzf $file
  pushd jpeg-$version/
  ./configure --prefix=$local --mandir=$man1
  make
  make install 
  make install-lib
  ranlib $lib/libjpeg.a
  popd
END

  my $result = system($command);
  $config->stuff_results('libjpeg',$result,$version,$local);
}


##########
# libpng #
##########
sub build_libpng {
  my $version = $config->version('libpng');
  my $url     = $config->url('libpng');
  my $file    = "libpng-$version.tar.gz";
  my $command=<<END;
  set -x



( run in 0.842 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )