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