3
# script to extract and create aliases from source files
5
# $Id: install-aliases,v 1.7 2000/12/06 22:17:42 jsh Exp $
10
# copy a .la file, editing the `dlname=' line to the new stem
12
la_src="$1"; la_dest="$2"; shift 2
14
old_stem=`echo "$la_src" | sed -e 's|^.*/\([^/]*\)\.[^/]*$|\1|'`
15
new_stem=`echo "$la_dest" | sed -e 's|^.*/\([^/]*\)\.[^/]*$|\1|'`
17
sed -e '/^dlname=/ s/'"${old_stem}"'/'"${new_stem}"'/' \
18
< "$la_src" > "$la_dest"
21
# return the outermost directory of the filename
25
echo "$1" | sed -e 's|^\([^/]*\)/.*$|\1|'
33
# return the filename without its outermost directory
35
echo "$1" | sed -e 's|^[^/]*/\(.*\)$|\1|'
38
# strip common leading directories from $2
39
strip_common_prefix () {
40
str1="$1"; str2="$2"; shift 2
41
pfx=`prefix "$str1"`; str1=`postfix "$str1"`
42
while [ x"$pfx" != x ]; do
45
str2=`postfix "$str2"`
51
pfx=`prefix "$str1"`; str1=`postfix "$str1"`
56
# turns `FOO/BAR/BAZ' into `FOO/BAR/libBAZ'
58
echo "$1" | sed -e 's|\([^/]*\)$|lib\1|'
62
destroot="$1"; src="$2"; dest="$3"; shift 3
64
for g in `echo "${destroot}/${src}.*"`; do
66
suf=`echo "$g" | sed -e 's|^'"${destroot}/${src}"'\(.*\)$|\1|'`
67
if [ $verbose = yes ]; then
68
echo "${src}${suf} -> ${dest}${suf}"
70
if [ $dry_run = no ]; then
71
rm -f "${destroot}/${dest}${suf}"
74
copy_la_file "${destroot}/${src}${suf}" \
75
"${destroot}/${dest}${suf}"
78
# make sure links are relative to their own directory
79
local_src=`strip_common_prefix "$dest" "$src"`
80
ln -s "${local_src}${suf}" "${destroot}/${dest}${suf}"
91
src=`echo "$f" | sed -e 's/^\(.*\)#\(.*\)$/\1/'`
92
dest=`echo "$f" | sed -e 's/^\(.*\)#\(.*\)$/\2/'`
93
dosome "$destroot" "$src" "$dest"
95
# libtool sometimes needs to prefix module libraries with a `lib'
96
# prefix; this will try to pick up such libraries
97
dosome "$destroot" `lib_prefixed "$src"` `lib_prefixed "$dest"`
101
while [ x"$1" != x ]; do
104
files=`find "$2" -name '*.jl' -print`
105
aliases=`grep '(define-structure-alias' $files |
106
sed -e 's/^.*(define-structure-alias \([^ ]*\) \([^ ]*\)).*$/\2#\1/' |
113
files=`find "$2" -name '*.c' -print`
114
aliases=`grep '::alias:' $files |
115
sed -e 's/^.*::alias:\([^ ]*\) \(.*\)::.*$/\2#\1/' |
121
-v) verbose=yes; shift ;;
122
-n) dry_run=yes; verbose=yes; shift ;;
125
echo "usage [-v] [-n] [-l LISP-SRC-DIR LISP-INST-DIR] [-c C-SRC-DIR LA-INST-DIR]"