sub ppm_module { chdir($targetmodule); # Step one - create the Framework directory my $autoroot = qq($targetmodule/blib/arch/auto/Wx); my $appcontents = qq($autoroot/wxPerl.app/Contents); my $frameworkdir = qq($appcontents/Frameworks); mkdir $frameworkdir; #step two - import the alien files from alien blib my $alien = 'Alien::wxWidgets'; $alien->require; $alien->load; my $alienprefix = $alien->prefix(); my @alienpaths = split(/[\\\/]/, $alienprefix); my $alienpackage = pop(@alienpaths); my $aliensource = qq($rootpath/modules/Alien-wxWidgets/blib/arch/Alien/wxWidgets/$alienpackage/lib); my $command = qq(cp -R $aliensource/* $frameworkdir); if(system($command)) { die 'Failed to copy alien libraries'; } # fixed install path for the current version of wxWidgets my $oldkey = '/Users/markdootson/build/wxlib/lib/Alien/wxWidgets/mac_2_8_10_uni/lib/BASELIBNAME-2.8.0.dylib'; my $newkey = '@executable_path/../Frameworks/BASELIBNAME-2.8.0.dylib'; my @submodules = qw( AUI Calendar DateTime DND DocView FS Grid Help Html MDI Media Perl Print RichText Socket STC XRC); my @libraries = $alien->shared_libraries; print qq(Alien Potential Library $_\n) for ( @libraries ); my @truealiens = (); for my $testlib( @libraries ) { my $realname = $testlib; $realname =~ s/dylib$/0\.dylib/; my $realfilename = qq($frameworkdir/$realname); push(@truealiens, $realname) if -f $realfilename; } print qq(Alien Actual Library $_\n) for ( @truealiens ); print qq(changing library paths in aliens\n); for my $alienlibrary ( @truealiens ) { my $baselibname = $alienlibrary; $baselibname =~ s/-2\.8\.0\.dylib$//; my $fromtext = $oldkey; $fromtext =~ s/BASELIBNAME/$baselibname/; my $totext = $newkey; $totext =~ s/BASELIBNAME/$baselibname/; for my $targetlibrary ( @truealiens ) { my $targetfile = qq($frameworkdir/$targetlibrary); if($alienlibrary eq $targetlibrary) { my $libcommand = qq(install_name_tool -id $totext $targetfile); print qq(running change command: $libcommand\n\n); system($libcommand); } else { my $libcommand = qq(install_name_tool -change $fromtext $totext $targetfile); print qq(running change command: $libcommand\n\n); system($libcommand); } } } print qq( changing library paths in bundles \n); for my $submodule ( 'Wx', @submodules ) { my $targetfile = ($submodule eq 'Wx') ? qq($autoroot/$submodule.bundle) : qq($autoroot/$submodule/$submodule.bundle); for my $alienlibrary ( @truealiens ) { my $baselibname = $alienlibrary; $baselibname =~ s/-2\.8\.0\.dylib$//; my $fromtext = $oldkey; $fromtext =~ s/BASELIBNAME/$baselibname/; my $totext = $newkey; $totext =~ s/BASELIBNAME/$baselibname/; my $libcommand = qq(install_name_tool -change $fromtext $totext $targetfile); print qq(running change command: $libcommand\n\n); system($libcommand); } } print qq( adding wxPerl \n); my $targetexec = qq(blib/bin/wxPerl); File::Copy::copy($wxexecutable, $targetexec); $command = 'chmod +x ' . $targetexec; if(system($command)) { die 'Failed to change permissions on exec file'; } print qq( removing system perl\n); my $installedwxperl = qq($appcontents/MacOS/wxPerl); unlink $installedwxperl; my $exmarker = qq($appcontents/MacOS/wxPerl); open my $exfh, '>', $exmarker; print $exfh ' '; close($exfh); $command = qq(tar cvzf $ppmfile blib); if(system($command)) { die 'Failed to create PPM'; } my $ppmtarget = qq($ppmdir/$ppmfile); my $ppmsource = qq($targetmodule/$ppmfile); File::Copy::copy($ppmsource, $ppmtarget); print qq($modulename PPM Copied to repository\n); { my $insttarget = qq($ppmdir/wxdarwininstall); my $instsource = qq(/Users/markdootson/build/scripts/wxdarwininstall); File::Copy::copy($instsource, $insttarget); print qq(install script copied to repository\n); } }