Commit | Line | Data |
2000072c |
1 | case $CONFIGDOTSH 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 |
b233458b |
27 | src=$src |
85e6fe83 |
28 | !GROK!THIS! |
29 | |
30 | : In the following dollars and backticks do not need the extra backslash. |
31 | $spitshell >>writemain <<'!NO!SUBS!' |
a0d0e21e |
32 | # This script takes the plain miniperlmain.c and writes out perlmain.c |
33 | # which includes all the extensions. |
34 | # The command line arguments name extensions to be used. |
35 | # E.g.: sh writemain SDBM_File POSIX > perlmain.c |
36 | # |
85e6fe83 |
37 | |
a0d0e21e |
38 | orig="$*" |
39 | args='' |
40 | : Remove any .a suffixes and any leading path components |
6062c587 |
41 | for file in $orig ; do |
42 | case "$file" in |
43 | *.a) file=`echo $file | sed 's/\.a//g'` |
44 | ;; |
45 | esac |
a0d0e21e |
46 | case "$file" in |
47 | ext/*) file=`echo $file | sed 's:ext/\(.*\)/[^/]*:\1:'` |
48 | ;; |
1aef975c |
49 | lib/auto/*) file=`echo $file | sed 's:lib/auto/\(.*\)/[^/]*:\1:'` |
50 | ;; |
a0d0e21e |
51 | */*) |
52 | file=`expr X$file : 'X.*/\(.*\)'` |
53 | ;; |
54 | esac |
55 | args="$args $file" |
56 | done |
57 | |
58 | |
b233458b |
59 | sed '/Do not delete this line--writemain depends on it/q' $src/miniperlmain.c |
4633a7c4 |
60 | |
61 | |
62 | if test X"$args" != "X" ; then |
63 | for ext in $args ; do |
64 | : $ext will either be 'Name' or 'Name1/Name2' etc |
65 | : convert ext into cname and mname |
66 | mname=`echo $ext | sed 's!/!::!g'` |
67 | cname=`echo $mname | sed 's!:!_!g'` |
68 | |
cea2e8a9 |
69 | echo "EXTERN_C void boot_${cname} (pTHX_ CV* cv);" |
4633a7c4 |
70 | done |
71 | fi |
72 | |
73 | cat << 'EOP' |
74 | |
75 | static void |
cea2e8a9 |
76 | xs_init(pTHX) |
4633a7c4 |
77 | { |
78 | EOP |
79 | |
a0d0e21e |
80 | if test X"$args" != "X" ; then |
81 | echo " char *file = __FILE__;" |
a3c8358c |
82 | echo " dXSUB_SYS;" |
83 | |
a0d0e21e |
84 | ai='' |
85 | |
86 | for ext in $args ; do |
87 | |
88 | : $ext will either be 'Name' or 'Name1/Name2' etc |
89 | : convert ext into cname and mname |
90 | mname=`echo $ext | sed 's!/!::!g'` |
91 | cname=`echo $mname | sed 's!:!_!g'` |
92 | |
a0d0e21e |
93 | if test "$ext" = "DynaLoader"; then |
94 | : Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'! |
95 | : boot_DynaLoader is called directly in DynaLoader.pm |
96 | echo " newXS(\"${mname}::boot_${ext}\", boot_${cname}, file);" |
97 | else |
98 | echo " newXS(\"${mname}::bootstrap\", boot_${cname}, file);" |
99 | fi |
85e6fe83 |
100 | done |
85e6fe83 |
101 | fi |
102 | |
a0d0e21e |
103 | cat << 'EOP' |
104 | } |
105 | EOP |
106 | |
85e6fe83 |
107 | !NO!SUBS! |
108 | chmod 755 writemain |
109 | $eunicefix writemain |