[Bps-public-commit] r15395 - in Shipwright/trunk: . share/bin

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Aug 22 20:28:18 EDT 2008


Author: sunnavy
Date: Fri Aug 22 20:28:18 2008
New Revision: 15395

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Build.pm
   Shipwright/trunk/share/bin/shipwright-builder

Log:
 r15998 at sunnavys-mb:  sunnavy | 2008-08-23 08:26:58 +0800
 added CFLAGS and LDFLAGS for build


Modified: Shipwright/trunk/lib/Shipwright/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Build.pm	Fri Aug 22 20:28:18 2008
@@ -43,22 +43,18 @@
 
     unless ( $self->install_base ) {
 
-        my $dir =
-          tempdir( 'vessel_' . $self->name . '-XXXXXX', TMPDIR => 1 );
+        my $dir = tempdir( 'vessel_' . $self->name . '-XXXXXX', TMPDIR => 1 );
         $self->install_base( catfile( $dir, $self->name ) );
     }
 
     no warnings 'uninitialized';
 
     $ENV{DYLD_LIBRARY_PATH} =
-      catfile( $self->install_base, 'lib' ) . ':'
-      . $ENV{DYLD_LIBRARY_PATH};
+      catfile( $self->install_base, 'lib' ) . ':' . $ENV{DYLD_LIBRARY_PATH};
     $ENV{LD_LIBRARY_PATH} =
-      catfile( $self->install_base, 'lib' ) . ':'
-      . $ENV{LD_LIBRARY_PATH};
+      catfile( $self->install_base, 'lib' ) . ':' . $ENV{LD_LIBRARY_PATH};
     $ENV{PERL5LIB} =
-        catfile( $self->install_base, 'lib', 'perl5', 'site_perl' )
-      . ':'
+        catfile( $self->install_base, 'lib', 'perl5', 'site_perl' ) . ':'
       . catfile( $self->install_base, 'lib', 'perl5' ) . ':'
       . $ENV{PERL5LIB};
     $ENV{PATH} =
@@ -66,10 +62,13 @@
       . catfile( $self->install_base, 'sbin' ) . ':'
       . $ENV{PATH};
     $ENV{PERL_MM_USE_DEFAULT} = 1;
+    $ENV{LDFLAGS} .= ' -L' . catfile( $args{'install-base'}, 'lib' );
+    $ENV{CFLAGS}  .= ' -I' . catfile( $args{'install-base'}, 'include' );
 
     require CPAN;
     require Module::Info;
     if ( Module::Info->new_from_module('CPAN::Config') ) {
+
         # keep original CPAN::Config info
         require CPAN::Config;
     }
@@ -108,8 +107,7 @@
         dircopy( 'etc', catfile( $self->install_base, 'etc' ) );
 
         my $installed_hash = {};
-        $installed_file =
-          catfile( $self->install_base, 'installed.yml' );
+        $installed_file = catfile( $self->install_base, 'installed.yml' );
         if ( -e $installed_file ) {
             $installed = Shipwright::Util::LoadFile($installed_file);
             $installed_hash = { map { $_ => 1 } @$installed };
@@ -119,14 +117,14 @@
         }
 
         my $order =
-          Shipwright::Util::LoadFile(
-            catfile( 'shipwright', 'order.yml' ) )
+          Shipwright::Util::LoadFile( catfile( 'shipwright', 'order.yml' ) )
           || [];
 
         my ( $flags, $ktf, $branches );
         if ( -e catfile( 'shipwright', 'flags.yml' ) ) {
 
-            $flags = Shipwright::Util::LoadFile(
+            $flags =
+              Shipwright::Util::LoadFile(
                 catfile( 'shipwright', 'flags.yml' ) );
 
             # fill not specified but mandatory flags
@@ -144,7 +142,8 @@
 
         if ( -e catfile( 'shipwright', 'known_test_failures.yml' ) ) {
 
-            $ktf = Shipwright::Util::LoadFile(
+            $ktf =
+              Shipwright::Util::LoadFile(
                 catfile( 'shipwright', 'known_test_failures.yml' ) );
         }
         else {
@@ -153,7 +152,8 @@
 
         if ( -e catfile( 'shipwright', 'branches.yml' ) ) {
 
-            $branches = Shipwright::Util::LoadFile(
+            $branches =
+              Shipwright::Util::LoadFile(
                 catfile( 'shipwright', 'branches.yml' ) );
         }
 
@@ -177,8 +177,7 @@
         @$order = grep { !$installed_hash->{$_} } @$order;
 
         unless ( $self->perl && -e $self->perl ) {
-            my $perl =
-              catfile( $self->install_base, 'bin', 'perl' );
+            my $perl = catfile( $self->install_base, 'bin', 'perl' );
 
             # -e $perl makes sense when we install on to another vessel
             if ( ( grep { /^perl/ } @{$order} ) || -e $perl ) {
@@ -208,21 +207,17 @@
 # install one dist, the install methods are in scripts/distname/build
 
 sub _install {
-    my $self = shift;
-    my $dir  = shift;
-    my $ktf  = shift;
+    my $self     = shift;
+    my $dir      = shift;
+    my $ktf      = shift;
     my $branches = shift;
 
-    if ( $branches ) {
-            system(
-                "cp -r "
-                  . catdir( 'sources', $dir, split /\//,
-                    $branches->{$dir}[0] )
-                  . ' '
-                  . catdir( 'dists', $dir )
-              )
-              && die
-              "cp sources/$dir/$branches->{$dir}[0] to dists/$dir failed";
+    if ($branches) {
+        system( "cp -r "
+              . catdir( 'sources', $dir, split /\//, $branches->{$dir}[0] )
+              . ' '
+              . catdir( 'dists', $dir ) )
+          && die "cp sources/$dir/$branches->{$dir}[0] to dists/$dir failed";
     }
 
     chdir catfile( 'dists', $dir );
@@ -244,8 +239,7 @@
     }
     else {
 
-        my @cmds = read_file(
-            catfile( '..', '..', 'scripts', $dir, 'build' ) );
+        my @cmds = read_file( catfile( '..', '..', 'scripts', $dir, 'build' ) );
         chomp @cmds;
         @cmds = map { $self->_substitute($_) } @cmds;
 
@@ -313,18 +307,12 @@
         mkdir catfile( $self->install_base,       "$dir-wrapped" )
           unless -d catfile( $self->install_base, "$dir-wrapped" );
 
-        if (
-            -e catfile( $self->install_base, "$dir-wrapped", $file )
-          )
-        {
-            $self->log->warn(
-                'found old '
-                  . catfile( $self->install_base, "$dir-wrapped",
-                    $file )
-                  . ', deleting' . "\n"
-            );
-            unlink catfile( $self->install_base, "$dir-wrapped",
-                $file );
+        if ( -e catfile( $self->install_base, "$dir-wrapped", $file ) ) {
+            $self->log->warn( 'found old '
+                  . catfile( $self->install_base, "$dir-wrapped", $file )
+                  . ', deleting'
+                  . "\n" );
+            unlink catfile( $self->install_base, "$dir-wrapped", $file );
         }
 
         my $type;
@@ -347,33 +335,28 @@
             }
         }
 
-        move(
-            $file => catfile( $self->install_base, "$dir-wrapped" )
-        ) or die $!;
+        move( $file => catfile( $self->install_base, "$dir-wrapped" ) )
+          or die $!;
 
     # if we have this $type(e.g. perl) installed and have that specific wrapper,
     # then link to it, else link to the normal one
         if (   $type
             && -e catfile( '..', 'bin', $type )
-            && -e catfile( '..', 'etc', "shipwright-$type-wrapper" )
-          )
+            && -e catfile( '..', 'etc', "shipwright-$type-wrapper" ) )
         {
-            symlink catfile( '..', 'etc',
-                "shipwright-$type-wrapper" ) => $file
+            symlink catfile( '..', 'etc', "shipwright-$type-wrapper" ) => $file
               or die $!;
         }
         else {
 
-            symlink catfile( '..', 'etc',
-                'shipwright-script-wrapper' ) => $file
+            symlink catfile( '..', 'etc', 'shipwright-script-wrapper' ) => $file
               or die $!;
         }
     };
 
     my @dirs =
       grep { -d $_ }
-      map { catfile( $self->install_base, $_ ) }
-      qw/bin sbin/;
+      map { catfile( $self->install_base, $_ ) } qw/bin sbin/;
     find( $sub, @dirs ) if @dirs;
 }
 

Modified: Shipwright/trunk/share/bin/shipwright-builder
==============================================================================
--- Shipwright/trunk/share/bin/shipwright-builder	(original)
+++ Shipwright/trunk/share/bin/shipwright-builder	Fri Aug 22 20:28:18 2008
@@ -107,20 +107,17 @@
 }
 
 unless ( $args{'install-base'} ) {
-    my $dir =
-      tempdir( 'vessel_' . $args{name} . '-XXXXXX', TMPDIR => 1 );
+    my $dir = tempdir( 'vessel_' . $args{name} . '-XXXXXX', TMPDIR => 1 );
     $args{'install-base'} = catfile( $dir, $args{name} );
     print "no default install-base, will set it to $args{'install-base'}\n";
 }
 
 my $installed;
 my $installed_hash = {};
-my $installed_file =
-  catfile( $args{'install-base'}, 'installed.yml' );
+my $installed_file = catfile( $args{'install-base'}, 'installed.yml' );
 if ( -e $installed_file ) {
     $installed =
-      YAML::Tiny->read(
-        catfile( $args{'install-base'}, 'installed.yml' ) );
+      YAML::Tiny->read( catfile( $args{'install-base'}, 'installed.yml' ) );
     $installed_hash = { map { $_ => 1 } @{ $installed->[0] } };
 }
 else {
@@ -130,37 +127,29 @@
 $args{'install-base'} = abs_path( $args{'install-base'} );
 
 # YAML::Tiny objects are array based.
-my $order =
-  ( YAML::Tiny->read( catfile( 'shipwright', 'order.yml' ) ) )->[0];
+my $order = ( YAML::Tiny->read( catfile( 'shipwright', 'order.yml' ) ) )->[0];
 
 my ( $flags, $ktf, $branches );
 
 if ( -e catfile( 'shipwright', 'flags.yml' ) ) {
-    $flags =
-      ( YAML::Tiny->read( catfile( 'shipwright', 'flags.yml' ) ) )
-      ->[0];
+    $flags = ( YAML::Tiny->read( catfile( 'shipwright', 'flags.yml' ) ) )->[0];
 }
 else {
     $flags = {};
 }
 
 if ( -e catfile( 'shipwright', 'known_test_failures.yml' ) ) {
-    $ktf = (
-        YAML::Tiny->read(
-            catfile( 'shipwright', 'known_test_failures.yml' )
-        )
-    )->[0];
+    $ktf =
+      ( YAML::Tiny->read( catfile( 'shipwright', 'known_test_failures.yml' ) ) )
+      ->[0];
 }
 else {
     $ktf = {};
 }
 
 if ( -e catfile( 'shipwright', 'branches.yml' ) ) {
-    $branches = (
-        YAML::Tiny->read(
-            catfile( 'shipwright', 'branches.yml' )
-        )
-    )->[0];
+    $branches =
+      ( YAML::Tiny->read( catfile( 'shipwright', 'branches.yml' ) ) )->[0];
 }
 
 # fill not specified but mandatory flags
@@ -270,12 +259,9 @@
           catfile( $args{'install-base'}, 'lib' ) . ':'
           . $ENV{DYLD_LIBRARY_PATH};
         $ENV{LD_LIBRARY_PATH} =
-          catfile( $args{'install-base'}, 'lib' ) . ':'
-          . $ENV{LD_LIBRARY_PATH};
+          catfile( $args{'install-base'}, 'lib' ) . ':' . $ENV{LD_LIBRARY_PATH};
         $ENV{PERL5LIB} =
-          catfile( $args{'install-base'}, 'lib', 'perl5',
-            'site_perl' )
-          . ':'
+            catfile( $args{'install-base'}, 'lib', 'perl5', 'site_perl' ) . ':'
           . catfile( $args{'install-base'}, 'lib', 'perl5' ) . ':'
           . $ENV{PERL5LIB};
         $ENV{PATH} =
@@ -283,6 +269,8 @@
           . catfile( $args{'install-base'}, 'sbin' ) . ':'
           . $ENV{PATH};
         $ENV{PERL_MM_USE_DEFAULT} = 1;
+        $ENV{LDFLAGS} .= ' -L' . catfile( $args{'install-base'}, 'lib' );
+        $ENV{CFLAGS}  .= ' -I' . catfile( $args{'install-base'}, 'include' );
     }
 
     mkpath $args{'install-base'} unless -e $args{'install-base'};
@@ -305,8 +293,7 @@
     }
 
     chmod oct 755,
-      catfile( $args{'install-base'}, 'tools',
-        'shipwright-utility' );
+      catfile( $args{'install-base'}, 'tools', 'shipwright-utility' );
 
     mkdir 'dists' unless -e 'dists';
     for my $dist (@$order) {
@@ -331,13 +318,10 @@
     }
     else {
         if ($branches) {
-            system(
-                "cp -r "
-                  . catdir( 'sources', $dir, split /\//,
-                    $branches->{$dir}[0] )
+            system( "cp -r "
+                  . catdir( 'sources', $dir, split /\//, $branches->{$dir}[0] )
                   . ' '
-                  . catdir( 'dists', $dir )
-              )
+                  . catdir( 'dists', $dir ) )
               && die
               "cp sources/$dir/$branches->{$dir}[0] to dists/$dir failed";
         }
@@ -368,8 +352,7 @@
         }
     }
     else {
-        my $cmds =
-          cmds( catfile( '..', '..', 'scripts', $dir, 'build' ) );
+        my $cmds = cmds( catfile( '..', '..', 'scripts', $dir, 'build' ) );
 
         for (@$cmds) {
             my ( $type, $cmd ) = @$_;
@@ -425,20 +408,14 @@
         }
 
         my $dir = ( splitdir($File::Find::dir) )[-1];
-        mkdir catfile( $args{'install-base'}, "$dir-wrapped" )
-          unless -d catfile( $args{'install-base'},
-            "$dir-wrapped" );
-
-        if (
-            -e catfile( $args{'install-base'}, "$dir-wrapped",
-                $file ) )
-        {
+        mkdir catfile( $args{'install-base'},       "$dir-wrapped" )
+          unless -d catfile( $args{'install-base'}, "$dir-wrapped" );
+
+        if ( -e catfile( $args{'install-base'}, "$dir-wrapped", $file ) ) {
             print $log 'found old '
-              . catfile( $args{'install-base'}, "$dir-wrapped",
-                $file )
+              . catfile( $args{'install-base'}, "$dir-wrapped", $file )
               . ', deleting' . "\n";
-            unlink catfile( $args{'install-base'}, "$dir-wrapped",
-                $file );
+            unlink catfile( $args{'install-base'}, "$dir-wrapped", $file );
         }
 
         my $type;
@@ -456,25 +433,21 @@
             }
         }
 
-        move( $file =>
-              catfile( $args{'install-base'}, "$dir-wrapped" ) )
+        move( $file => catfile( $args{'install-base'}, "$dir-wrapped" ) )
           or die $!;
 
     # if we have this $type(e.g. perl) installed and have that specific wrapper,
     # then link to it, else link to the normal one
         if (   $type
             && -e catfile( '..', 'bin', $type )
-            && -e catfile( '..', 'etc', "shipwright-$type-wrapper" )
-          )
+            && -e catfile( '..', 'etc', "shipwright-$type-wrapper" ) )
         {
-            symlink catfile( '..', 'etc',
-                "shipwright-$type-wrapper" ) => $file
+            symlink catfile( '..', 'etc', "shipwright-$type-wrapper" ) => $file
               or die $!;
         }
         else {
 
-            symlink catfile( '..', 'etc',
-                'shipwright-script-wrapper' ) => $file
+            symlink catfile( '..', 'etc', 'shipwright-script-wrapper' ) => $file
               or die $!;
         }
         chmod oct 755, $file;
@@ -482,8 +455,7 @@
 
     my @dirs =
       grep { -d $_ }
-      map { catfile( $args{'install-base'}, $_ ) }
-      qw/bin sbin/;
+      map { catfile( $args{'install-base'}, $_ ) } qw/bin sbin/;
     find( $sub, @dirs ) if @dirs;
 
 }
@@ -575,8 +547,7 @@
           '--clean';
     }
     else {
-        my $cmds =
-          cmds( catfile( '..', '..', 'scripts', $dir, 'build' ) );
+        my $cmds = cmds( catfile( '..', '..', 'scripts', $dir, 'build' ) );
 
         for (@$cmds) {
             my ( $type, $c ) = @$_;



More information about the Bps-public-commit mailing list