Commit | Line | Data |
a02608de |
1 | case $PERL_CONFIG_SH in |
85e6fe83 |
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 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. |
14ee6a0a |
24 | rm -f writemain |
85e6fe83 |
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!' |
a0d0e21e |
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 | # |
85e6fe83 |
36 | |
a0d0e21e |
37 | orig="$*" |
38 | args='' |
39 | : Remove any .a suffixes and any leading path components |
6062c587 |
40 | for file in $orig ; do |
41 | case "$file" in |
908fcb8b |
42 | *.a) file=`echo $file | sed 's/\.a//g'`;; |
43 | *.o) file=`echo $file | sed 's/\.o//g'`;; |
6062c587 |
44 | esac |
a0d0e21e |
45 | case "$file" in |
46 | ext/*) file=`echo $file | sed 's:ext/\(.*\)/[^/]*:\1:'` |
47 | ;; |
1aef975c |
48 | lib/auto/*) file=`echo $file | sed 's:lib/auto/\(.*\)/[^/]*:\1:'` |
49 | ;; |
a0d0e21e |
50 | */*) |
51 | file=`expr X$file : 'X.*/\(.*\)'` |
52 | ;; |
53 | esac |
54 | args="$args $file" |
55 | done |
56 | |
57 | |
3b5ca523 |
58 | sed '/Do not delete this line--writemain depends on it/q' miniperlmain.c |
4633a7c4 |
59 | |
60 | |
61 | if test X"$args" != "X" ; then |
62 | for ext in $args ; do |
63 | : $ext will either be 'Name' or 'Name1/Name2' etc |
64 | : convert ext into cname and mname |
65 | mname=`echo $ext | sed 's!/!::!g'` |
66 | cname=`echo $mname | sed 's!:!_!g'` |
67 | |
cea2e8a9 |
68 | echo "EXTERN_C void boot_${cname} (pTHX_ CV* cv);" |
4633a7c4 |
69 | done |
70 | fi |
71 | |
72 | cat << 'EOP' |
73 | |
74 | static void |
cea2e8a9 |
75 | xs_init(pTHX) |
4633a7c4 |
76 | { |
77 | EOP |
78 | |
a0d0e21e |
79 | if test X"$args" != "X" ; then |
a4c98449 |
80 | echo " static const char file[] = __FILE__;" |
a3c8358c |
81 | echo " dXSUB_SYS;" |
82 | |
a0d0e21e |
83 | ai='' |
84 | |
85 | for ext in $args ; do |
86 | |
87 | : $ext will either be 'Name' or 'Name1/Name2' etc |
88 | : convert ext into cname and mname |
89 | mname=`echo $ext | sed 's!/!::!g'` |
90 | cname=`echo $mname | sed 's!:!_!g'` |
91 | |
a0d0e21e |
92 | if test "$ext" = "DynaLoader"; then |
93 | : Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'! |
94 | : boot_DynaLoader is called directly in DynaLoader.pm |
95 | echo " newXS(\"${mname}::boot_${ext}\", boot_${cname}, file);" |
96 | else |
97 | echo " newXS(\"${mname}::bootstrap\", boot_${cname}, file);" |
98 | fi |
85e6fe83 |
99 | done |
85e6fe83 |
100 | fi |
101 | |
a0d0e21e |
102 | cat << 'EOP' |
103 | } |
104 | EOP |
105 | |
85e6fe83 |
106 | !NO!SUBS! |
107 | chmod 755 writemain |
108 | $eunicefix writemain |