Mercurial > gnulib
annotate build-aux/install-reloc @ 40200:19988ebda9fa
relocatable-prog: Improve verbose output.
* build-aux/install-reloc (func_verbose): Escape characters that would
be interpreted by the shell.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 24 Feb 2019 15:18:24 +0100 |
parents | 5fd32d128129 |
children | 9e8fb35d4032 |
rev | line source |
---|---|
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 #!/bin/sh |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
2 # install-reloc - install a program in a way that it will find its shared |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
3 # libraries even when relocated, |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
4 # - either including a relocating wrapper, |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
5 # - or using Mac OS X specific tools. |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
6 # Copyright (C) 2003-2019 Free Software Foundation, Inc. |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 # Written by Bruno Haible <bruno@clisp.org>, 2003. |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 # |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
9238
diff
changeset
|
9 # 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
|
10 # 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
|
11 # 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
|
12 # (at your option) any later version. |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 # |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 # 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
|
15 # 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
|
16 # 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
|
17 # GNU General Public License for more details. |
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 # You should have received a copy of the GNU General Public License |
19190 | 20 # along with this program. If not, see <https://www.gnu.org/licenses/>. |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
22 # Usage 1: |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
23 # install-reloc -- 'wrapper' \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
24 # library_path_var library_path_value prefix destdir \ |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
25 # compile_command srcdir builddir config_h_dir exeext \ |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
26 # strip_command \ |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
27 # install_command... destprog |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
28 # install-reloc -- 'macosx' \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
29 # prefix destdir \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
30 # strip_command \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
31 # install_command... destprog |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 # where |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 # - 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
|
34 # - 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
|
35 # 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
|
36 # - 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
|
37 # - 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
|
38 # 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
|
39 # and prefix |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 # - 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
|
41 # - 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
|
42 # - 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
|
43 # alloca.h and stdbool.h) |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 # - 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
|
45 # - 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
|
46 # - 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
|
47 # stripping is desired |
29b9820e29f2
Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents:
11027
diff
changeset
|
48 # - 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
|
49 # - destprog is the destination program name |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
50 # Usage 2: |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
51 # env RELOC_MODE='wrapper' \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
52 # RELOC_LIBRARY_PATH_VAR=library_path_var \ |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
53 # RELOC_LIBRARY_PATH_VALUE=library_path_value \ |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
54 # RELOC_PREFIX=prefix \ |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
55 # RELOC_DESTDIR=destdir \ |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
56 # RELOC_COMPILE_COMMAND=compile_command \ |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
57 # RELOC_SRCDIR=srcdir \ |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
58 # RELOC_BUILDDIR=builddir \ |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
59 # RELOC_CONFIG_H_DIR=config_h_dir \ |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
60 # RELOC_EXEEXT=exeext \ |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
61 # RELOC_STRIP_PROG=strip_command \ |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
62 # RELOC_INSTALL_PROG=install_command... \ |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
63 # install-reloc prog1 ... destprog |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
64 # env RELOC_MODE='macosx' \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
65 # RELOC_PREFIX=prefix \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
66 # RELOC_DESTDIR=destdir \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
67 # RELOC_STRIP_PROG=strip_command \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
68 # RELOC_INSTALL_PROG=install_command... \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
69 # install-reloc prog1 ... destprog |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
70 # where destprog is either the destination program name (when only one program |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
71 # is specified) or the destination directory for all programs. |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
72 # In the 'wrapper' mode, install-reloc renames destprog to destprog.bin and |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
73 # installs a relocating wrapper in the place of destprog. |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
74 |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
75 progname=$0 |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
76 |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
77 func_usage () |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
78 { |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
79 echo "Usage: $0 -- 'wrapper'" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
80 "library_path_var library_path_value prefix destdir" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
81 "compile_command srcdir builddir config_h_dir exeext" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
82 "strip_command" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
83 "install_command... destprog" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
84 echo "Usage: $0 -- 'macosx'" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
85 "prefix destdir" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
86 "strip_command" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
87 "install_command... destprog" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
88 } |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
89 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
90 if test "x$1" = "x--"; then |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
91 # Get fixed position arguments. |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
92 case "$2" in |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
93 wrapper) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
94 if test $# -ge 13; then |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
95 mode=$2 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
96 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
97 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
98 library_path_var=$1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
99 library_path_value=$2 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
100 prefix=$3 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
101 destdir=$4 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
102 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
103 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
104 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
105 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
106 compile_command=$1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
107 srcdir=$2 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
108 builddir=$3 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
109 config_h_dir=$4 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
110 exeext=$5 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
111 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
112 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
113 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
114 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
115 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
116 strip_prog=$1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
117 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
118 install_prog=$1 # maybe not including the "-c" option |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
119 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
120 else |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
121 func_usage 1>&2; exit 1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
122 fi |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
123 ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
124 macosx) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
125 if test $# -ge 6; then |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
126 mode=$2 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
127 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
128 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
129 prefix=$1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
130 destdir=$2 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
131 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
132 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
133 exeext= |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
134 strip_prog=$1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
135 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
136 install_prog=$1 # maybe not including the "-c" option |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
137 shift |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
138 else |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
139 func_usage 1>&2; exit 1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
140 fi |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
141 ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
142 *) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
143 func_usage 1>&2; exit 1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
144 ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
145 esac |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
146 else |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
147 if test $# -ge 2; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
148 # Get arguments from environment variables. |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
149 mode=$RELOC_MODE |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
150 case "$mode" in |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
151 wrapper) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
152 library_path_var=$RELOC_LIBRARY_PATH_VAR |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
153 library_path_value=$RELOC_LIBRARY_PATH_VALUE |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
154 prefix=$RELOC_PREFIX |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
155 destdir=$RELOC_DESTDIR |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
156 compile_command=$RELOC_COMPILE_COMMAND |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
157 srcdir=$RELOC_SRCDIR |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
158 builddir=$RELOC_BUILDDIR |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
159 config_h_dir=$RELOC_CONFIG_H_DIR |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
160 exeext=$RELOC_EXEEXT |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
161 strip_prog=$RELOC_STRIP_PROG |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
162 install_prog=$RELOC_INSTALL_PROG # including the "-c" option |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
163 ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
164 macosx) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
165 prefix=$RELOC_PREFIX |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
166 destdir=$RELOC_DESTDIR |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
167 exeext= |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
168 strip_prog=$RELOC_STRIP_PROG |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
169 install_prog=$RELOC_INSTALL_PROG # including the "-c" option |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
170 ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
171 *) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
172 func_usage 1>&2; exit 1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
173 ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
174 esac |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
175 else |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
176 func_usage 1>&2; exit 1 |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
177 fi |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
178 fi |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
179 |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
180 # Get destprog, last argument. |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
181 destprog= |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
182 for arg |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
183 do |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
184 destprog=$arg |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
185 done |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
186 # Determine whether destprog is a program name or a directory name. |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
187 if test -d "$destprog"; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
188 sed_remove_trailing_slashes='s|//*$||' |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
189 destprog_directory=`echo "$destprog" | sed -e "$sed_remove_trailing_slashes"` |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
190 if test -z "$destprog_directory"; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
191 destprog_directory='/' |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
192 fi |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
193 else |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
194 destprog_directory= |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
195 fi |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
196 # Prepare for remove trailing $exeext, if present. |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
197 if test -n "$exeext"; then |
9548
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
198 sed_quote='s,\.,\\.,g' |
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
199 sed_remove_exeext='s|'`echo "$exeext" | sed -e "$sed_quote"`'$||' |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
200 fi |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
201 if test -z "$destprog_directory"; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
202 # Remove trailing $exeext, if present. |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
203 if test -n "$exeext"; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
204 destprog=`echo "$destprog" | sed -e "$sed_remove_exeext"` |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
205 fi |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
206 fi |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
207 |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
208 # Outputs a command and runs it. |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
209 func_verbose () |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
210 { |
40200
19988ebda9fa
relocatable-prog: Improve verbose output.
Bruno Haible <bruno@clisp.org>
parents:
40193
diff
changeset
|
211 # Make it easy to copy&paste the printed command into a shell in most cases, |
19988ebda9fa
relocatable-prog: Improve verbose output.
Bruno Haible <bruno@clisp.org>
parents:
40193
diff
changeset
|
212 # by escaping '\\', '"', and '$'. This is not perfect, just good enough. |
19988ebda9fa
relocatable-prog: Improve verbose output.
Bruno Haible <bruno@clisp.org>
parents:
40193
diff
changeset
|
213 echo "$@" | sed -e 's/\([\\"$]\)/\\\1/g' |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
214 "$@" |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
215 } |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
216 |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
217 # Run install_command. |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
218 func_verbose $install_prog "$@" || exit $? |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
219 |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
220 # Iterate over all destination program names. |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
221 # func_iterate f |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
222 # applies f to each destination program names, after setting destprog. |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
223 sed_basename_of_file='s|^.*/||' |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
224 func_iterate () |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
225 { |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
226 if test -n "$destprog_directory"; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
227 prev_arg= |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
228 for arg |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
229 do |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
230 if test -n "prev_arg"; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
231 destprog="$destprog_directory"/`echo "$prev_arg" | sed -e "$sed_basename_of_file"` |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
232 $1 |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
233 fi |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
234 prev_arg="$arg" |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
235 done |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
236 else |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
237 $1 |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
238 fi |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
239 } |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
240 |
11028
29b9820e29f2
Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents:
11027
diff
changeset
|
241 # Run strip_command. |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
242 func_strip () |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
243 { |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
244 # Remove trailing $exeext, if present. |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
245 if test -n "$exeext"; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
246 destprog=`echo "$destprog" | sed -e "$sed_remove_exeext"` |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
247 fi |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
248 func_verbose "$strip_prog" "$destprog$exeext" || exit $? |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
249 } |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
250 if test "$strip_prog" != ':'; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
251 func_iterate func_strip |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
252 fi |
11028
29b9820e29f2
Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents:
11027
diff
changeset
|
253 |
9548
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
254 # Determine installdir from destprog, removing a leading destdir if present. |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
255 if test -n "$destprog_directory"; then |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
256 # There's possibly multiple programs to install, but all go into the same |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
257 # directory. |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
258 installdir="$destprog_directory" |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
259 else |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
260 # There's only one program to install. |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
261 installdir=`echo "$destprog" | sed -e 's,/[^/]*$,,'` |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
262 fi |
9548
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
263 if test -n "$destdir"; then |
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
264 sed_quote='s,\([|.\*^$[]\),\\\1,g' |
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
265 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
|
266 installdir=`echo "$installdir" | sed -e "$sed_remove_destdir"` |
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
267 fi |
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
268 |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
269 # func_relativize DIR1 DIR2 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
270 # computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
271 # Input: |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
272 # - DIR1 relative pathname, relative to the current directory |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
273 # - DIR2 relative pathname, relative to the current directory |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
274 # Output: |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
275 # - reldir relative pathname of DIR2, relative to DIR1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
276 func_relativize () |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
277 { |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
278 dir0=`pwd` |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
279 dir1="$1" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
280 dir2="$2" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
281 sed_first='s,^\([^/]*\)/.*$,\1,' |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
282 sed_rest='s,^[^/]*/*,,' |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
283 sed_last='s,^.*/\([^/]*\)$,\1,' |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
284 sed_butlast='s,/*[^/]*$,,' |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
285 while test -n "$dir1"; do |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
286 first=`echo "$dir1" | sed -e "$sed_first"` |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
287 if test "$first" != "."; then |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
288 if test "$first" = ".."; then |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
289 dir2=`echo "$dir0" | sed -e "$sed_last"`/"$dir2" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
290 dir0=`echo "$dir0" | sed -e "$sed_butlast"` |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
291 else |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
292 first2=`echo "$dir2" | sed -e "$sed_first"` |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
293 if test "$first2" = "$first"; then |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
294 dir2=`echo "$dir2" | sed -e "$sed_rest"` |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
295 else |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
296 dir2="../$dir2" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
297 fi |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
298 dir0="$dir0"/"$first" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
299 fi |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
300 fi |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
301 dir1=`echo "$dir1" | sed -e "$sed_rest"` |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
302 done |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
303 reldir="$dir2" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
304 } |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
305 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
306 case "$mode" in |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
307 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
308 wrapper) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
309 # If the platform doesn't support LD_LIBRARY_PATH or similar, we cannot |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
310 # build a wrapper. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
311 test -n "$library_path_var" || exit 0 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
312 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
313 libdirs= |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
314 save_IFS="$IFS"; IFS=":" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
315 for dir in $library_path_value; do |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
316 IFS="$save_IFS" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
317 if test -n "$dir"; then |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
318 case "$libdirs" in |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
319 *"\"$dir\""*) ;; # remove duplicate |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
320 *) libdirs="$libdirs\"$dir\"," ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
321 esac |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
322 fi |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
323 done |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
324 IFS="$save_IFS" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
325 # If there are no library directories to add at runtime, we don't need a |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
326 # wrapper. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
327 test -n "$libdirs" || exit 0 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
328 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
329 # Compile and install wrapper. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
330 func_create_wrapper () |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
331 { |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
332 # Remove trailing $exeext, if present. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
333 if test -n "$exeext"; then |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
334 destprog=`echo "$destprog" | sed -e "$sed_remove_exeext"` |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
335 fi |
11026
f7a9849b6394
Remove debugging information left over by C compiler on MacOS X.
Bruno Haible <bruno@clisp.org>
parents:
9548
diff
changeset
|
336 |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
337 # Compile wrapper. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
338 func_verbose $compile_command \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
339 -I"$builddir" -I"$srcdir" -I"$config_h_dir" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
340 -DHAVE_CONFIG_H -DIN_RELOCWRAPPER -DNO_XMALLOC \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
341 -D"INSTALLPREFIX=\"$prefix\"" -D"INSTALLDIR=\"$installdir\"" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
342 -D"LIBPATHVAR=\"$library_path_var\"" -D"LIBDIRS=$libdirs" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
343 -D"EXEEXT=\"$exeext\"" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
344 "$srcdir"/relocwrapper.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
345 "$srcdir"/progname.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
346 "$srcdir"/progreloc.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
347 "$srcdir"/areadlink.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
348 "$srcdir"/careadlinkat.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
349 "$srcdir"/allocator.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
350 "$srcdir"/readlink.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
351 "$srcdir"/stat.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
352 "$srcdir"/canonicalize-lgpl.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
353 "$srcdir"/malloca.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
354 "$srcdir"/lstat.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
355 "$srcdir"/relocatable.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
356 "$srcdir"/setenv.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
357 "$srcdir"/c-ctype.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
358 -o "$destprog.wrapper$exeext" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
359 rc=$? |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
360 # Clean up object files left over in the current directory by the native C |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
361 # compilers on Solaris, HP-UX, OSF/1, IRIX. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
362 rm -f relocwrapper.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
363 progname.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
364 progreloc.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
365 areadlink.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
366 careadlinkat.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
367 allocator.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
368 readlink.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
369 stat.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
370 canonicalize-lgpl.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
371 malloca.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
372 lstat.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
373 relocatable.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
374 setenv.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
375 c-ctype.o |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
376 test $rc = 0 || exit $? |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
377 # Clean up debugging information left over by the native C compiler on |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
378 # Mac OS X. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
379 rm -rf "$destprog.wrapper$exeext.dSYM" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
380 test $rc = 0 || exit $? |
11028
29b9820e29f2
Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents:
11027
diff
changeset
|
381 |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
382 # Strip wrapper. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
383 test "$strip_prog" = ':' || func_verbose "$strip_prog" "$destprog.wrapper$exeext" || exit $? |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
384 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
385 # Rename $destprog.wrapper -> $destprog -> $destprog.bin. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
386 ln -f "$destprog$exeext" "$destprog.bin$exeext" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
387 || { rm -f "$destprog.bin$exeext" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
388 && cp -p "$destprog$exeext" "$destprog.bin$exeext"; } \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
389 || exit 1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
390 mv "$destprog.wrapper$exeext" "$destprog$exeext" || exit 1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
391 } |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
392 func_iterate func_create_wrapper |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
393 ;; |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
394 |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
395 macosx) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
396 # Insert a reference to @loader_path in selected shared library references. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
397 # For executables, @executable_path is equivalent to @loader_path. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
398 func_reference_loader_path () |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
399 { |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
400 # For using 'install_name_tool -change ...' we need to know the precise |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
401 # library version of each reference. The linker command line does not give |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
402 # us the information; only 'otool' provides it. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
403 # Documentation: |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
404 # <https://www.manpagez.com/man/1/otool/> |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
405 # <https://www.unix.com/man-page/osx/1/otool/> |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
406 # The install_name_tool exists in versions without and with rpath support: |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
407 # <https://www.manpagez.com/man/1/install_name_tool/> |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
408 # <https://www.unix.com/man-page/osx/1/install_name_tool/> |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
409 otool -L "$destprog" | sed -e '/:$/d' -e 's/^[ ]*//' -e 's/ (.*$//' | \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
410 while read libfilename; do |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
411 case "$libfilename" in |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
412 "$prefix"/* ) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
413 func_relativize "$installdir" "$libfilename" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
414 new_libfilename="@loader_path/$reldir" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
415 func_verbose install_name_tool -change "$libfilename" "$new_libfilename" "$destprog" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
416 ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
417 esac |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
418 done |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
419 } |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
420 func_iterate func_reference_loader_path |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
421 ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
422 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
423 esac |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
424 |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
425 exit 0 |