| 1 |
root |
1.1 |
case $PERL_CONFIG_SH in |
| 2 |
|
|
'') |
| 3 |
|
|
if test -f config.sh; then TOP=.; |
| 4 |
|
|
elif test -f ../config.sh; then TOP=..; |
| 5 |
|
|
elif test -f ../../config.sh; then TOP=../..; |
| 6 |
|
|
elif test -f ../../../config.sh; then TOP=../../..; |
| 7 |
|
|
elif test -f ../../../../config.sh; then TOP=../../../..; |
| 8 |
|
|
else |
| 9 |
|
|
echo "Can't find config.sh."; exit 1 |
| 10 |
|
|
fi |
| 11 |
|
|
. $TOP/config.sh |
| 12 |
|
|
;; |
| 13 |
|
|
esac |
| 14 |
|
|
: This forces SH files to create target in same directory as SH file. |
| 15 |
|
|
: This is so that make depend always knows where to find SH derivatives. |
| 16 |
|
|
case "$0" in |
| 17 |
|
|
*/*) cd `expr X$0 : 'X\(.*\)/'` ;; |
| 18 |
|
|
esac |
| 19 |
|
|
echo "Extracting makeaperl (with variable substitutions)" |
| 20 |
|
|
rm -f makeaperl |
| 21 |
|
|
$spitshell >makeaperl <<!GROK!THIS! |
| 22 |
|
|
$startperl |
| 23 |
|
|
eval 'exec $perlpath -S \$0 \${1+"\$@"}' |
| 24 |
|
|
if \$running_under_some_shell; |
| 25 |
|
|
!GROK!THIS! |
| 26 |
|
|
|
| 27 |
|
|
$spitshell >>makeaperl <<'!NO!SUBS!' |
| 28 |
|
|
|
| 29 |
|
|
=head1 NAME |
| 30 |
|
|
|
| 31 |
|
|
makeaperl - create a new perl binary from static extensions |
| 32 |
|
|
|
| 33 |
|
|
=head1 SYNOPSIS |
| 34 |
|
|
|
| 35 |
|
|
C<makeaperl -l library -m makefile -o target -t tempdir [object_files] [static_extensions] [search_directories]> |
| 36 |
|
|
|
| 37 |
|
|
=head1 DESCRIPTION |
| 38 |
|
|
|
| 39 |
|
|
This utility is designed to build new perl binaries from existing |
| 40 |
|
|
extensions on the fly. Called without any arguments it produces a new |
| 41 |
|
|
binary with the name C<perl> in the current directory. Intermediate |
| 42 |
|
|
files are produced in C</tmp>, if that is writeable, else in the |
| 43 |
|
|
current directory. The most important intermediate file is a Makefile, |
| 44 |
|
|
that is used internally to call C<make>. The new perl binary will consist |
| 45 |
|
|
|
| 46 |
|
|
The C<-l> switch lets you specify the name of a perl library to be |
| 47 |
|
|
linked into the new binary. If you do not specify a library, makeaperl |
| 48 |
|
|
writes targets for any C<libperl*.a> it finds in the search path. The |
| 49 |
|
|
topmost target will be the one related to C<libperl.a>. |
| 50 |
|
|
|
| 51 |
|
|
With the C<-m> switch you can provide a name for the Makefile that |
| 52 |
|
|
will be written (default C</tmp/Makefile.$$>). Likewise specifies the |
| 53 |
|
|
C<-o> switch a name for the perl binary (default C<perl>). The C<-t> |
| 54 |
|
|
switch lets you determine, in which directory the intermediate files |
| 55 |
|
|
should be stored. |
| 56 |
|
|
|
| 57 |
|
|
All object files and static extensions following on the command line |
| 58 |
|
|
will be linked into the target file. If there are any directories |
| 59 |
|
|
specified on the command line, these directories are searched for |
| 60 |
|
|
C<*.a> files, and all of the found ones will be linked in, too. If |
| 61 |
|
|
there is no directory named, then the contents of $INC[0] are |
| 62 |
|
|
searched. |
| 63 |
|
|
|
| 64 |
|
|
If the command fails, there is currently no other mechanism to adjust |
| 65 |
|
|
the behaviour of the program than to alter the generated Makefile and |
| 66 |
|
|
run C<make> by hand. |
| 67 |
|
|
|
| 68 |
|
|
=head1 AUTHORS |
| 69 |
|
|
Tim Bunce <Tim.Bunce@ig.co.uk>, Andreas Koenig |
| 70 |
|
|
<koenig@franz.ww.TU-Berlin.DE>; |
| 71 |
|
|
|
| 72 |
|
|
=head2 STATUS |
| 73 |
|
|
First version, written 5 Feb 1995, is considered alpha. |
| 74 |
|
|
|
| 75 |
|
|
=cut |
| 76 |
|
|
|
| 77 |
|
|
use ExtUtils::MakeMaker; |
| 78 |
|
|
use Getopt::Long; |
| 79 |
|
|
use strict qw(subs refs); |
| 80 |
|
|
|
| 81 |
|
|
$Version = 1.0; |
| 82 |
|
|
$Verbose = 0; |
| 83 |
|
|
|
| 84 |
|
|
sub usage{ |
| 85 |
|
|
warn <<END; |
| 86 |
|
|
$0 version $Version |
| 87 |
|
|
|
| 88 |
|
|
$0: [options] [object_files] [static_extensions ...] [directories to search through] |
| 89 |
|
|
-l perllibrary perl library to link from (the first libperl.a found) |
| 90 |
|
|
-m makefilename name of the makefile to be written (/tmp/Makefile.\$\$) |
| 91 |
|
|
-o name name for perl executable (perl) |
| 92 |
|
|
-t directory directory where intermediate files reside (/tmp) |
| 93 |
|
|
END |
| 94 |
|
|
exit 1; |
| 95 |
|
|
} |
| 96 |
|
|
|
| 97 |
|
|
if (-w "/tmp") { |
| 98 |
|
|
$opt_t = "/tmp"; |
| 99 |
|
|
} else { |
| 100 |
|
|
$opt_t = "."; |
| 101 |
|
|
} |
| 102 |
|
|
$opt_l = ''; |
| 103 |
|
|
$opt_m = "$opt_t/Makefile.$$"; |
| 104 |
|
|
$opt_o = 'perl'; |
| 105 |
|
|
|
| 106 |
|
|
$Getopt::Long::ignorecase=0; |
| 107 |
|
|
|
| 108 |
|
|
GetOptions('t=s', 'l=s', 'm=s', 'o=s') || die &usage; |
| 109 |
|
|
|
| 110 |
|
|
@dirs = grep -d $_, @ARGV; |
| 111 |
|
|
@fils = grep -f $_, @ARGV; |
| 112 |
|
|
|
| 113 |
|
|
@dirs = $INC[0] unless @dirs; |
| 114 |
|
|
|
| 115 |
|
|
open MAKE, ">$opt_m"; |
| 116 |
|
|
MM->init_main(); |
| 117 |
|
|
MM->init_others(); |
| 118 |
|
|
print MAKE MM->makeaperl('MAKE' => $opt_m, |
| 119 |
|
|
'TARGET' => $opt_o, |
| 120 |
|
|
'TMP' => $opt_t, |
| 121 |
|
|
'LIBPERL' => $opt_l, |
| 122 |
|
|
'DIRS' => [@dirs], |
| 123 |
|
|
'STAT' => [@fils], |
| 124 |
|
|
'INCL' => [@dirs] |
| 125 |
|
|
); |
| 126 |
|
|
close MAKE; |
| 127 |
|
|
(system "make -f $opt_m") == 0 or die "$0 failed: Please check file $opt_m and run make -f $opt_m\n"; |
| 128 |
|
|
!NO!SUBS! |
| 129 |
|
|
chmod 755 makeaperl |
| 130 |
|
|
$eunicefix makeaperl |