Mercurial > gnulib
annotate build-aux/install-reloc @ 40193:5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Reported by Paul Smith <psmith@gnu.org>.
* build-aux/install-reloc: Accept a 'mode' argument as first argument.
(func_relativize): New function, from gnulib-tool.
Handle mode 'macosx' through invocations of 'otool' and
'install_name_tool'.
* m4/relocatable.m4 (gl_RELOCATABLE_BODY): Determine use_macos_tools.
If use_macos_tools is true, set INSTALL_PROGRAM_ENV to an
'install-reloc' invocation with mode 'macosx'.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 23 Feb 2019 22:42:54 +0100 |
parents | b06060465f09 |
children | 19988ebda9fa |
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 { |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
211 echo "$@" |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
212 "$@" |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
213 } |
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 # Run install_command. |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
216 func_verbose $install_prog "$@" || exit $? |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
217 |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
218 # Iterate over all destination program names. |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
219 # func_iterate f |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
220 # 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
|
221 sed_basename_of_file='s|^.*/||' |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
222 func_iterate () |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
223 { |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
224 if test -n "$destprog_directory"; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
225 prev_arg= |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
226 for arg |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
227 do |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
228 if test -n "prev_arg"; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
229 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
|
230 $1 |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
231 fi |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
232 prev_arg="$arg" |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
233 done |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
234 else |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
235 $1 |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
236 fi |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
237 } |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
238 |
11028
29b9820e29f2
Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents:
11027
diff
changeset
|
239 # Run strip_command. |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
240 func_strip () |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
241 { |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
242 # Remove trailing $exeext, if present. |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
243 if test -n "$exeext"; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
244 destprog=`echo "$destprog" | sed -e "$sed_remove_exeext"` |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
245 fi |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
246 func_verbose "$strip_prog" "$destprog$exeext" || exit $? |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
247 } |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
248 if test "$strip_prog" != ':'; then |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
249 func_iterate func_strip |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
250 fi |
11028
29b9820e29f2
Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents:
11027
diff
changeset
|
251 |
9548
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
252 # 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
|
253 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
|
254 # 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
|
255 # directory. |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
256 installdir="$destprog_directory" |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
257 else |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
258 # There's only one program to install. |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
259 installdir=`echo "$destprog" | sed -e 's,/[^/]*$,,'` |
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
260 fi |
9548
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
261 if test -n "$destdir"; then |
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
262 sed_quote='s,\([|.\*^$[]\),\\\1,g' |
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
263 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
|
264 installdir=`echo "$installdir" | sed -e "$sed_remove_destdir"` |
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
265 fi |
827a525c7057
Make --enable-relocatable work with DESTDIR.
Bruno Haible <bruno@clisp.org>
parents:
9547
diff
changeset
|
266 |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
267 # 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
|
268 # 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
|
269 # Input: |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
270 # - 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
|
271 # - 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
|
272 # Output: |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
273 # - 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
|
274 func_relativize () |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
275 { |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
276 dir0=`pwd` |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
277 dir1="$1" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
278 dir2="$2" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
279 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
|
280 sed_rest='s,^[^/]*/*,,' |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
281 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
|
282 sed_butlast='s,/*[^/]*$,,' |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
283 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
|
284 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
|
285 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
|
286 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
|
287 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
|
288 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
|
289 else |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
290 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
|
291 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
|
292 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
|
293 else |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
294 dir2="../$dir2" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
295 fi |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
296 dir0="$dir0"/"$first" |
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 fi |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
299 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
|
300 done |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
301 reldir="$dir2" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
302 } |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
303 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
304 case "$mode" in |
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 wrapper) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
307 # 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
|
308 # build a wrapper. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
309 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
|
310 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
311 libdirs= |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
312 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
|
313 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
|
314 IFS="$save_IFS" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
315 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
|
316 case "$libdirs" in |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
317 *"\"$dir\""*) ;; # remove duplicate |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
318 *) libdirs="$libdirs\"$dir\"," ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
319 esac |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
320 fi |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
321 done |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
322 IFS="$save_IFS" |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
323 # 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
|
324 # wrapper. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
325 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
|
326 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
327 # 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
|
328 func_create_wrapper () |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
329 { |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
330 # 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
|
331 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
|
332 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
|
333 fi |
11026
f7a9849b6394
Remove debugging information left over by C compiler on MacOS X.
Bruno Haible <bruno@clisp.org>
parents:
9548
diff
changeset
|
334 |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
335 # Compile wrapper. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
336 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
|
337 -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
|
338 -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
|
339 -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
|
340 -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
|
341 -D"EXEEXT=\"$exeext\"" \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
342 "$srcdir"/relocwrapper.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
343 "$srcdir"/progname.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
344 "$srcdir"/progreloc.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
345 "$srcdir"/areadlink.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
346 "$srcdir"/careadlinkat.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
347 "$srcdir"/allocator.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
348 "$srcdir"/readlink.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
349 "$srcdir"/stat.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
350 "$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
|
351 "$srcdir"/malloca.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
352 "$srcdir"/lstat.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
353 "$srcdir"/relocatable.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
354 "$srcdir"/setenv.c \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
355 "$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
|
356 -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
|
357 rc=$? |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
358 # 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
|
359 # 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
|
360 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
|
361 progname.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
362 progreloc.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
363 areadlink.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
364 careadlinkat.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
365 allocator.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
366 readlink.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
367 stat.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
368 canonicalize-lgpl.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
369 malloca.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
370 lstat.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
371 relocatable.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
372 setenv.o \ |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
373 c-ctype.o |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
374 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
|
375 # 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
|
376 # Mac OS X. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
377 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
|
378 test $rc = 0 || exit $? |
11028
29b9820e29f2
Support for stripping executables in --enable-relocatable.
Bruno Haible <bruno@clisp.org>
parents:
11027
diff
changeset
|
379 |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
380 # Strip wrapper. |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
381 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
|
382 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
383 # 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
|
384 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
|
385 || { 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
|
386 && 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
|
387 || exit 1 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
388 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
|
389 } |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
390 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
|
391 ;; |
17525
ea01543bbca7
install-reloc: Support multi-binary installation.
Bruno Haible <bruno@clisp.org>
parents:
17249
diff
changeset
|
392 |
40193
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
393 macosx) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
394 # 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
|
395 # 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
|
396 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
|
397 { |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
398 # 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
|
399 # 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
|
400 # 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
|
401 # Documentation: |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
402 # <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
|
403 # <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
|
404 # 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
|
405 # <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
|
406 # <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
|
407 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
|
408 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
|
409 case "$libfilename" in |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
410 "$prefix"/* ) |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
411 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
|
412 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
|
413 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
|
414 ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
415 esac |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
416 done |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
417 } |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
418 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
|
419 ;; |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
420 |
5fd32d128129
relocatable-prog: Use wrapper-free installation also on Mac OS X.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
421 esac |
8265
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
422 |
20006894dae4
Infrastructure for relocatable installation, from GNU gettext.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
423 exit 0 |