source: trunk/third/perl/makeaperl.SH @ 14545

Revision 14545, 3.8 KB checked in by ghudson, 25 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r14544, which included commits to RCS files with non-trunk default branches.
  • Property svn:executable set to *
Line 
1case $CONFIGDOTSH 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        ;;
13esac
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.
16case "$0" in
17*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
18esac
19echo "Extracting makeaperl (with variable substitutions)"
20rm -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
31makeaperl - create a new perl binary from static extensions
32
33=head1 SYNOPSIS
34
35C<makeaperl -l library -m makefile -o target -t tempdir [object_files] [static_extensions] [search_directories]>
36
37=head1 DESCRIPTION
38
39This utility is designed to build new perl binaries from existing
40extensions on the fly. Called without any arguments it produces a new
41binary with the name C<perl> in the current directory. Intermediate
42files are produced in C</tmp>, if that is writeable, else in the
43current directory. The most important intermediate file is a Makefile,
44that is used internally to call C<make>. The new perl binary will consist
45
46The C<-l> switch lets you specify the name of a perl library to be
47linked into the new binary. If you do not specify a library, makeaperl
48writes targets for any C<libperl*.a> it finds in the search path. The
49topmost target will be the one related to C<libperl.a>.
50
51With the C<-m> switch you can provide a name for the Makefile that
52will be written (default C</tmp/Makefile.$$>). Likewise specifies the
53C<-o> switch a name for the perl binary (default C<perl>). The C<-t>
54switch lets you determine, in which directory the intermediate files
55should be stored.
56
57All object files and static extensions following on the command line
58will be linked into the target file. If there are any directories
59specified on the command line, these directories are searched for
60C<*.a> files, and all of the found ones will be linked in, too. If
61there is no directory named, then the contents of $INC[0] are
62searched.
63
64If the command fails, there is currently no other mechanism to adjust
65the behaviour of the program than to alter the generated Makefile and
66run C<make> by hand.
67
68=head1 AUTHORS
69Tim Bunce <Tim.Bunce@ig.co.uk>, Andreas Koenig
70<koenig@franz.ww.TU-Berlin.DE>;
71
72=head2 STATUS
73First version, written 5 Feb 1995, is considered alpha.
74
75=cut
76
77use ExtUtils::MakeMaker;
78use Getopt::Long;
79use strict qw(subs refs);
80
81$Version = 1.0;
82$Verbose = 0;
83
84sub 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)
93END
94    exit 1;
95}
96
97if (-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
108GetOptions('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
115open MAKE, ">$opt_m";
116MM->init_main();
117MM->init_others();
118print 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);
126close 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!
129chmod 755 makeaperl
130$eunicefix makeaperl
Note: See TracBrowser for help on using the repository browser.