annotate build-aux/install-reloc @ 12559:c2cbabec01dd

update nearly all FSF copyright year lists to include 2010 Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
author Jim Meyering <meyering@redhat.com>
date Fri, 01 Jan 2010 10:31:12 +0100
parents 29b9820e29f2
children 97fc9a21a8fb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 #!/bin/sh
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 # install-reloc - install a program including a relocating wrapper
12559
c2cbabec01dd update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents: 11028
diff changeset
3 # Copyright (C) 2003, 2005-2007, 2009-2010 Free Software Foundation, Inc.
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 # Written by Bruno Haible <bruno@clisp.org>, 2003.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 #
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9238
diff changeset
6 # This program is free software: you can redistribute it and/or modify
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 # it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9238
diff changeset
8 # the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9238
diff changeset
9 # (at your option) any later version.
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 #
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 # This program is distributed in the hope that it will be useful,
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 # GNU General Public License for more details.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 #
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 # You should have received a copy of the GNU General Public License
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 9238
diff changeset
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 # Usage:
9548
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
20 # install-reloc library_path_var library_path_value prefix destdir \
11028
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
21 # compile_command srcdir builddir config_h_dir exeext \
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
22 # strip_command \
8279
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
23 # install_command... destprog
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 # where
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 # - library_path_var is the platform dependent runtime library path variable
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 # - library_path_value is a colon separated list of directories that contain
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 # the libraries at installation time (use this instead of -rpath)
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 # - prefix is the base directory at installation time
9548
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
29 # - destdir is a string that is prepended to all file names at installation
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
30 # time; it is already prepended to destprog but not to library_path_value
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
31 # and prefix
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 # - compile_command is a C compiler compilation and linking command
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 # - srcdir is the directory where to find relocwrapper.c and its dependencies
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 # - builddir is the directory where to find built dependencies (namely,
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 # alloca.h and stdbool.h)
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 # - config_h_dir is the directory where to find config.h
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 # - exeext is platform dependent suffix of executables
11028
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
38 # - strip_command is the command for stripping executables, or : if no
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
39 # stripping is desired
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
40 # - install_command is the install command line, excluding the final destprog
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 # - destprog is the destination program name
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 # install-reloc renames destprog to destprog.bin and installs a relocating
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 # wrapper in the place of destprog.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 progname=$0
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 if test $# -eq 2; then
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 # Get arguments from environment variables.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 library_path_var=$RELOC_LIBRARY_PATH_VAR
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 library_path_value=$RELOC_LIBRARY_PATH_VALUE
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 prefix=$RELOC_PREFIX
9548
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
52 destdir=$RELOC_DESTDIR
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 compile_command=$RELOC_COMPILE_COMMAND
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 srcdir=$RELOC_SRCDIR
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 builddir=$RELOC_BUILDDIR
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 config_h_dir=$RELOC_CONFIG_H_DIR
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 exeext=$RELOC_EXEEXT
11028
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
58 strip_prog=$RELOC_STRIP_PROG
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 install_prog=$RELOC_INSTALL_PROG # including the "-c" option
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 else
11028
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
61 if test $# -ge 11; then
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 # Get fixed position arguments.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 library_path_var=$1
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 library_path_value=$2
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 prefix=$3
9548
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
66 destdir=$4
11028
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
67 shift
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
68 shift
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
69 shift
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
70 shift
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
71 compile_command=$1
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
72 srcdir=$2
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
73 builddir=$3
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
74 config_h_dir=$4
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
75 exeext=$5
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 shift
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 shift
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 shift
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 shift
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 shift
11028
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
81 strip_prog=$1
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
82 shift
9548
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
83 install_prog=$1 # maybe not including the "-c" option
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
84 shift
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 else
9548
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
86 echo "Usage: $0 library_path_var library_path_value prefix destdir" \
8279
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
87 "compile_command srcdir builddir config_h_dir exeext" \
11028
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
88 "strip_command" \
8279
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
89 "install_command... destprog" 1>&2
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 exit 1
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 fi
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 fi
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 # Get destprog, last argument.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 destprog=
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
96 for arg
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
97 do
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
98 destprog=$arg
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
99 done
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
100 # Remove trailing $exeext, if present.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
101 if test -n "$exeext"; then
9548
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
102 sed_quote='s,\.,\\.,g'
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
103 sed_remove_exeext='s|'`echo "$exeext" | sed -e "$sed_quote"`'$||'
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
104 destprog=`echo "$destprog" | sed -e "$sed_remove_exeext"`
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
105 fi
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
106
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107 # Outputs a command and runs it.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
108 func_verbose ()
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
109 {
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
110 echo "$@"
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
111 "$@"
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
112 }
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
113
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 # Run install_command.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
115 func_verbose $install_prog "$@" || exit $?
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
116
11028
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
117 # Run strip_command.
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
118 test "$strip_prog" = ':' || func_verbose "$strip_prog" "$destprog$exeext" || exit $?
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
119
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
120 # If the platform doesn't support LD_LIBRARY_PATH or similar, we cannot build
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
121 # a wrapper.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
122 test -n "$library_path_var" || exit 0
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
123
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
124 libdirs=
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
125 save_IFS="$IFS"; IFS=":"
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 for dir in $library_path_value; do
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
127 IFS="$save_IFS"
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
128 if test -n "$dir"; then
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
129 case "$libdirs" in
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
130 *"\"$dir\""*) ;; # remove duplicate
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
131 *) libdirs="$libdirs\"$dir\"," ;;
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
132 esac
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 fi
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 done
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135 IFS="$save_IFS"
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 # If there are no library directories to add at runtime, we don't need a
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137 # wrapper.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
138 test -n "$libdirs" || exit 0
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
139
9548
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
140 # Determine installdir from destprog, removing a leading destdir if present.
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
141 installdir=`echo "$destprog" | sed -e 's,/[^/]*$,,'`
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
142 if test -n "$destdir"; then
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
143 sed_quote='s,\([|.\*^$[]\),\\\1,g'
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
144 sed_remove_destdir='s|^'`echo "$destdir" | sed -e "$sed_quote"`'||'
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
145 installdir=`echo "$installdir" | sed -e "$sed_remove_destdir"`
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
146 fi
827a525c7057 Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents: 9547
diff changeset
147
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148 # Compile wrapper.
8279
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
149 func_verbose $compile_command \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
150 -I"$builddir" -I"$srcdir" -I"$config_h_dir" \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
151 -DHAVE_CONFIG_H -DIN_RELOCWRAPPER -DNO_XMALLOC \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
152 -D"INSTALLPREFIX=\"$prefix\"" -D"INSTALLDIR=\"$installdir\"" \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
153 -D"LIBPATHVAR=\"$library_path_var\"" -D"LIBDIRS=$libdirs" \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
154 -D"EXEEXT=\"$exeext\"" \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
155 "$srcdir"/relocwrapper.c \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
156 "$srcdir"/progname.c \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
157 "$srcdir"/progreloc.c \
9238
6d715fbc981c Change xreadlink module to use areadlink.
Bruno Haible <bruno@clisp.org>
parents: 8950
diff changeset
158 "$srcdir"/areadlink.c \
8279
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
159 "$srcdir"/readlink.c \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
160 "$srcdir"/canonicalize-lgpl.c \
8950
53b90318e324 Update after allocsa -> malloca renaming.
Bruno Haible <bruno@clisp.org>
parents: 8280
diff changeset
161 "$srcdir"/malloca.c \
8279
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
162 "$srcdir"/relocatable.c \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
163 "$srcdir"/setenv.c \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
164 "$srcdir"/strerror.c \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
165 "$srcdir"/c-ctype.c \
8280
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
166 -o "$destprog.wrapper$exeext"
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
167 rc=$?
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
168 # Clean up object files left over in the current directory by the native C
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
169 # compilers on Solaris, HP-UX, OSF/1, IRIX.
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
170 rm -f relocwrapper.o \
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
171 progname.o \
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
172 progreloc.o \
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
173 xreadlink.o \
9238
6d715fbc981c Change xreadlink module to use areadlink.
Bruno Haible <bruno@clisp.org>
parents: 8950
diff changeset
174 areadlink.o \
8280
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
175 canonicalize-lgpl.o \
8950
53b90318e324 Update after allocsa -> malloca renaming.
Bruno Haible <bruno@clisp.org>
parents: 8280
diff changeset
176 malloca.o \
8280
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
177 relocatable.o \
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
178 setenv.o \
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
179 strerror.o \
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
180 c-ctype.o
cf9fed416d8c Avoid leaving object files around.
Bruno Haible <bruno@clisp.org>
parents: 8279
diff changeset
181 test $rc = 0 || exit $?
11026
f7a9849b6394 Remove debugging information left over by C compiler on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 9548
diff changeset
182 # Clean up debugging information left over by the native C compiler on MacOS X.
f7a9849b6394 Remove debugging information left over by C compiler on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 9548
diff changeset
183 rm -rf "$destprog.wrapper$exeext.dSYM"
f7a9849b6394 Remove debugging information left over by C compiler on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 9548
diff changeset
184 test $rc = 0 || exit $?
f7a9849b6394 Remove debugging information left over by C compiler on MacOS X.
Bruno Haible <bruno@clisp.org>
parents: 9548
diff changeset
185
11028
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
186 # Strip wrapper.
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
187 test "$strip_prog" = ':' || func_verbose "$strip_prog" "$destprog.wrapper$exeext" || exit $?
29b9820e29f2 Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents: 11027
diff changeset
188
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
189 # Rename $destprog.wrapper -> $destprog -> $destprog.bin.
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
190 ln -f "$destprog$exeext" "$destprog.bin$exeext" \
8279
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
191 || { rm -f "$destprog.bin$exeext" \
ca03b672badc Break long lines.
Bruno Haible <bruno@clisp.org>
parents: 8272
diff changeset
192 && cp -p "$destprog$exeext" "$destprog.bin$exeext"; } \
8265
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
193 || exit 1
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
194 mv "$destprog.wrapper$exeext" "$destprog$exeext" || exit 1
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
195
20006894dae4 Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
196 exit 0