source: trunk/third/perl/writemain.SH @ 10724

Revision 10724, 2.7 KB checked in by ghudson, 27 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r10723, which included commits to RCS files with non-trunk default branches.
  • Property svn:executable set to *
Line 
1case $CONFIG 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 writemain (with variable substitutions)"
20: This section of the file will have variable substitutions done on it.
21: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
22: Protect any dollar signs and backticks that you do not want interpreted
23: by putting a backslash in front.  You may delete these comments.
24rm -f writemain
25$spitshell >writemain <<!GROK!THIS!
26$startsh
27!GROK!THIS!
28
29: In the following dollars and backticks do not need the extra backslash.
30$spitshell >>writemain <<'!NO!SUBS!'
31# This script takes the plain miniperlmain.c and writes out perlmain.c
32# which includes all the extensions.
33# The command line arguments name extensions to be used.
34#  E.g.:  sh writemain SDBM_File POSIX > perlmain.c
35#
36
37orig="$*"
38args=''
39: Remove any .a suffixes and any leading path components
40for file in `echo $orig | sed 's/\.a//g'` ; do
41        case "$file" in
42        ext/*)  file=`echo $file | sed 's:ext/\(.*\)/[^/]*:\1:'`
43                ;;
44        lib/auto/*)     file=`echo $file | sed 's:lib/auto/\(.*\)/[^/]*:\1:'`
45                ;;
46        */*)
47                file=`expr X$file : 'X.*/\(.*\)'`
48                ;;
49        esac
50        args="$args $file"
51done
52
53
54sed '/Do not delete this line--writemain depends on it/q' miniperlmain.c
55
56
57if test X"$args" != "X" ; then
58    for ext in $args ; do
59: $ext will either be 'Name' or 'Name1/Name2' etc
60: convert ext into cname and mname
61mname=`echo $ext   | sed 's!/!::!g'`
62cname=`echo $mname | sed 's!:!_!g'`
63
64echo "EXTERN_C void boot_${cname} _((CV* cv));"
65    done
66fi
67
68cat << 'EOP'
69
70static void
71xs_init()
72{
73EOP
74
75if test X"$args" != "X" ; then
76    echo "    char *file = __FILE__;"
77    echo "    dXSUB_SYS;"
78
79    ai=''
80
81    for ext in $args ; do
82
83        : $ext will either be 'Name' or 'Name1/Name2' etc
84        : convert ext into cname and mname
85        mname=`echo $ext   | sed 's!/!::!g'`
86        cname=`echo $mname | sed 's!:!_!g'`
87
88        if test "$ext" = "DynaLoader"; then
89            : Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'!
90            : boot_DynaLoader is called directly in DynaLoader.pm
91            echo "        newXS(\"${mname}::boot_${ext}\", boot_${cname}, file);"
92        else
93            echo "        newXS(\"${mname}::bootstrap\", boot_${cname}, file);"
94        fi
95    done
96fi
97
98cat << 'EOP'
99}
100EOP
101
102!NO!SUBS!
103chmod 755 writemain
104$eunicefix writemain
Note: See TracBrowser for help on using the repository browser.