5534
|
1 #! /bin/sh -e |
|
2 |
|
3 # Create additional links to .oct files that define more than one |
|
4 # function. |
|
5 |
|
6 # If the first arg is --print, only print the links we need to make. |
|
7 |
|
8 # The first non-option arg is taken as the directory where the .oct |
|
9 # files are installed. The remaining arguments should be the list of |
|
10 # .df files corresponding to the source files that were used to |
|
11 # create the .oct files. |
|
12 |
|
13 SED=${SED:-'sed'} |
|
14 |
|
15 if [ $1 = "--prefix" ]; then |
|
16 shift |
|
17 prefix="$1" |
|
18 shift |
|
19 fi |
|
20 |
|
21 for f in "$@"; do |
|
22 if [ -f $f ]; then |
|
23 |
|
24 ## Compute and print the autoloads. |
|
25 |
|
26 base=`basename $f | $SED 's/\.df$//'` |
|
27 fcns=`grep '^ *XDEFUN_DLD_INTERNAL' $f |\ |
|
28 $SED -e 's/XDEFUN_DLD_INTERNAL *( *//' -e 's/ *,.*$//' |\ |
|
29 sort -u` |
|
30 if [ -n "$fcns" ]; then |
|
31 for n in $fcns; do |
|
32 if [ "$n" = "$base" ]; then |
|
33 true |
|
34 else |
|
35 if [ -n "$prefix" ]; then |
|
36 echo "autoload (\"$n\", \"$prefix/$base.oct\");" |
|
37 else |
|
38 echo "autoload (\"$n\", \"$base.oct\");" |
|
39 fi |
|
40 fi |
|
41 done |
|
42 fi |
|
43 |
|
44 ## Process PKG_ADD directives after autoloads so that all |
|
45 ## necessary functions can be found before they are used. |
|
46 |
|
47 $SED -n -e 's,^//* *PKG_ADD: *,,p' \ |
|
48 -e 's,^/\* *PKG_ADD: *\(.*\) *\*/ *$,\1,p' $f |
|
49 |
|
50 fi |
|
51 done |
|
52 |
|
53 exit $? |