-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.make
333 lines (297 loc) · 10 KB
/
install.make
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
##
# Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
#
# @APPLE_LICENSE_HEADER_START@
#
# The contents of this file constitute Original Code as defined in and
# are subject to the Apple Public Source License Version 1.1 (the
# "License"). You may not use this file except in compliance with the
# License. Please obtain a copy of the License at
# http://www.apple.com/publicsource and read it before using this file.
#
# This Original Code and all software distributed under the License are
# distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
# License for the specific language governing rights and limitations
# under the License.
#
# @APPLE_LICENSE_HEADER_END@
##
#
# install.make
#
# Rules for installing the product in its final destination. Installation
# takes place in three stages. The first stage is to install the
# products from the current project. The next stage is to recursively perform
# post-install processing on every subproject. Finally, the destination is
# chowned and chrooted.
#
# PUBLIC TARGETS
# install: installs the product and any public or private header
# files into their final destination.
#
# IMPORTED VARIABLES
# PRODUCTS: products to install. All of these products will be placed in
# the directory $(DSTROOT)$(INSTALLDIR)
# INSTALL_AS_USER: owner of the intalled products (default root)
# INSTALL_AS_GROUP: group of the installed products (default wheel)
# INSTALL_PERMISSIONS: permissions of the installed product (default o+rX)
# BEFORE_INSTALL: targets to build before installing the product
# AFTER_INSTALL: targets to build after installing the product
# BEFORE_POSTINSTALL: targets to build before postinstalling every subproject
# AFTER_POSTINSTALL: targts to build after postinstalling every subproject
# INSTALLDIR: final destination for installed products
#
.PHONY: install install-products install-hook
.PHONY: postinstall recursive-postinstall local-postinstall
#
# Variable definitions
#
ifneq "YES" "$(BUILD_OFILES_LIST_ONLY)"
ACTUAL_INSTALL = install-products install-projtype-specific-products
ACTUAL_POSTINSTALL = strip-binaries install-headers
else
ACTUAL_INSTALL =
ACTUAL_POSTINSTALL = install-headers
endif
ifeq "$(OS)" "MACOS"
STRIPFLAGS = -S
endif
ifeq "$(OS)" "NEXTSTEP"
STRIPFLAGS = -S
endif
#
# RDW 04/15/1999 -- Changed the strip flag used on Solaris
# and HP-UX during install.
#
ifeq "$(PLATFORM_TYPE)" "PDO_UNIX"
STRIPFLAGS = -x
endif
ALL_STRIPFLAGS = $(STRIPFLAGS) $(PROJTYPE_STRIPFLAGS) $(OTHER_STRIPFLAGS)
INSTALLED_PRODUCTS = $(addprefix $(DSTROOT)$(INSTALLDIR)/, $(notdir $(PRODUCTS)))
ifeq "YES" "$(JAVA_USED)"
INSTALLED_JAVA_PRODUCT = $(JAVA_DSTROOT)$(JAVA_INSTALL_DIR)/$(JAVA_PRODUCT)
INSTALLED_JAVA_PRODUCT_CLIENT = $(JAVA_DSTROOT_CLIENT)$(JAVA_INSTALL_DIR_CLIENT)/$(JAVA_PRODUCT_CLIENT)
endif
ifeq "" "$(INSTALL_AS_USER)"
INSTALL_AS_USER = root
endif
ifeq "" "$(INSTALL_AS_GROUP)"
ifeq "MACOS" "$(OS)"
INSTALL_AS_GROUP = wheel
else
ifeq "NEXTSTEP" "$(OS)"
INSTALL_AS_GROUP = wheel
else
INSTALL_AS_GROUP = bin
endif
endif
endif
ifeq "" "$(INSTALL_PERMISSIONS)"
INSTALL_PERMISSIONS = o+rX
endif
#
# First we do local installation, then we recursively do postinstallation
#
ifneq "YES" "$(SUPPRESS_BUILD)"
ifeq ($(OS)-$(REINSTALLING)-$(STRIP_ON_INSTALL), WINDOWS--YES)
install: all
$(MAKE) reinstall-stripped REINSTALLING=YES
else
install: local-install postinstall finish-install
endif
postinstall: local-postinstall recursive-postinstall
recursive-postinstall: local-postinstall
recursive-postinstall: $(RECURSABLE_DIRS:%=postinstall@%)
ifndef RECURSING
postinstall local-postinstall recursive-postinstall: local-install
$(RECURSABLE_DIRS:%=postinstall@%): local-install
endif
endif
#
# Local installation
#
local-install: announce-install validate-install $(BEFORE_INSTALL) $(ACTUAL_INSTALL)
$(ACTUAL_INSTALL): announce-install validate-install $(BEFORE_INSTALL)
$(BEFORE_INSTALL): announce-install validate-install
local-postinstall: announce-postinstall $(BEFORE_POSTINSTALL) $(ACTUAL_POSTINSTALL) $(AFTER_POSTINSTALL)
$(AFTER_POSTINSTALL): announce-postinstall $(BEFORE_POSTINSTALL) $(ACTUAL_POSTINSTALL)
$(ACTUAL_POSTINSTALL): announce-postinstall $(BEFORE_POSTINSTALL)
$(BEFORE_POSTINSTALL): announce-postinstall
#
# before we do anything we announce our intentions
#
announce-install:
$(SILENT) $(ECHO) Installing product...
announce-postinstall:
ifndef RECURSING
$(SILENT) $(ECHO) Performing post-installation processing...
else
$(SILENT) $(ECHO) $(RECURSIVE_ELLIPSIS)in $(NAME)
endif
#
# We must ensure that we know where to put things
#
validate-install:
ifneq "YES" "$(BUILD_OFILES_LIST_ONLY)"
ifeq "" "$(INSTALLDIR)"
$(SILENT) $(ECHO) install.make: error: INSTALLDIR variable not defined
$(SILENT) exit 1
endif
ifeq "WINDOWS" "$(OS)"
ifneq "1" "$(words $(subst :, ,$(INSTALLDIR)))"
ifneq "" "$(DSTROOT)"
$(SILENT) $(ECHO) install.make: error: DSTROOT specified and INSTALLDIR defines a drive letter
$(SILENT) exit 1
endif
endif
endif
endif
#
# Actual installation is a matter of copying the product
# to the destination area
#
ifneq "" "$(INSTALLED_PRODUCTS)"
install-products: $(DSTROOT)$(INSTALLDIR)
-$(CHMOD) -R +w $(INSTALLED_PRODUCTS)
$(RM) -rf $(INSTALLED_PRODUCTS)
($(CD) $(PRODUCT_DIR) && $(TAR) cf - $(notdir $(PRODUCTS))) | ($(CD) $(DSTROOT)$(INSTALLDIR) && $(TAR) xf -)
else
install-products:
endif
install-projtype-specific-products:
#
# after installing we must strip the binaries
#
ifneq "$(STRIPPED_PRODUCTS)" ""
ifdef STRIP
strip-binaries:
ifneq "$(STRIP_ON_INSTALL)" "NO"
-$(STRIP) $(ALL_STRIPFLAGS) $(subst $(PRODUCT_DIR),$(DSTROOT)$(INSTALLDIR),$(STRIPPED_PRODUCTS))
ifneq "$(STRIPPED_PROFILED_PRODUCTS)" ""
-$(SILENT) if [ -f $(subst $(PRODUCT_DIR),$(DSTROOT)$(INSTALLDIR),$(STRIPPED_PROFILED_PRODUCTS)) ] ; then \
cmd="$(STRIP) $(ALL_STRIPFLAGS) $(subst $(PRODUCT_DIR),$(DSTROOT)$(INSTALLDIR),$(STRIPPED_PROFILED_PRODUCTS))" ; \
$(ECHO) $$cmd ; eval $$cmd ; \
fi
endif
endif
endif
endif
#
# To ensure that header files are correct, use the rules
# from installhdrs.make
#
install-headers: local-installhdrs
#
# then we finish installing and chmod/chown things
#
finish-install: change-permissions $(AFTER_INSTALL) change-java-permissions convert-bundle
$(AFTER_INSTALL): change-permissions
ifneq "" "$(INSTALLED_PRODUCTS)"
change-permissions:
ifdef CHMOD
-$(CHMOD) -R ugo-w $(INSTALLED_PRODUCTS)
-$(CHMOD) -R $(INSTALL_PERMISSIONS) $(INSTALLED_PRODUCTS)
endif
ifdef CHGRP
-$(CHGRP) -R $(INSTALL_AS_GROUP) $(INSTALLED_PRODUCTS)
endif
ifdef CHOWN
-$(CHOWN) -R $(INSTALL_AS_USER) $(INSTALLED_PRODUCTS)
endif
else
change-permissions:
endif
change-java-permissions: change-java-perms change-java-perms-client
ifneq "" "$(INSTALLED_JAVA_PRODUCT)"
ifdef JAVA_DSTROOT
change-java-perms:
ifdef CHMOD
-$(SILENT) if [ ! -z "$(JAVA_INSTALL_DIR)" -a -d "$(JAVA_DSTROOT)$(JAVA_INSTALL_DIR)" ]; then \
$(ECHO) $(CHMOD) -R ugo-w $(INSTALLED_JAVA_PRODUCT); \
$(CHMOD) -R ugo-w $(INSTALLED_JAVA_PRODUCT); \
$(ECHO) $(CHMOD) -R $(INSTALL_PERMISSIONS) $(INSTALLED_JAVA_PRODUCT); \
$(CHMOD) -R $(INSTALL_PERMISSIONS) $(INSTALLED_JAVA_PRODUCT); \
fi
endif
ifdef CHGRP
-$(SILENT) if [ ! -z "$(JAVA_INSTALL_DIR)" -a -d "$(JAVA_DSTROOT)$(JAVA_INSTALL_DIR)" ]; then \
$(ECHO) $(CHGRP) -R $(INSTALL_AS_GROUP) $(INSTALLED_JAVA_PRODUCT); \
$(CHGRP) -R $(INSTALL_AS_GROUP) $(INSTALLED_JAVA_PRODUCT); \
fi
endif
ifdef CHOWN
-$(SILENT) if [ ! -z "$(JAVA_INSTALL_DIR)" -a -d "$(JAVA_DSTROOT)$(JAVA_INSTALL_DIR)" ]; then \
$(ECHO) $(CHOWN) -R $(INSTALL_AS_USER) $(INSTALLED_JAVA_PRODUCT); \
$(CHOWN) -R $(INSTALL_AS_USER) $(INSTALLED_JAVA_PRODUCT); \
fi
endif
else
change-java-perms:
endif
else
change-java-perms:
endif
ifneq "" "$(INSTALLED_JAVA_PRODUCT_CLIENT)"
ifdef JAVA_DSTROOT_CLIENT
change-java-perms-client:
ifdef CHMOD
-$(SILENT) if [ ! -z "$(JAVA_INSTALL_DIR_CLIENT)" -a -d "$(JAVA_DSTROOT_CLIENT)$(JAVA_INSTALL_DIR_CLIENT)" ]; then \
$(ECHO) $(CHMOD) -R ugo-w $(INSTALLED_JAVA_PRODUCT_CLIENT); \
$(CHMOD) -R ugo-w $(INSTALLED_JAVA_PRODUCT_CLIENT); \
$(ECHO) $(CHMOD) -R $(INSTALL_PERMISSIONS) $(INSTALLED_JAVA_PRODUCT_CLIENT); \
$(CHMOD) -R $(INSTALL_PERMISSIONS) $(INSTALLED_JAVA_PRODUCT_CLIENT); \
fi
endif
ifdef CHGRP
-$(SILENT) if [ ! -z "$(JAVA_INSTALL_DIR_CLIENT)" -a -d "$(JAVA_DSTROOT_CLIENT)$(JAVA_INSTALL_DIR_CLIENT)" ]; then \
$(ECHO) $(CHGRP) -R $(INSTALL_AS_GROUP) $(INSTALLED_JAVA_PRODUCT_CLIENT); \
$(CHGRP) -R $(INSTALL_AS_GROUP) $(INSTALLED_JAVA_PRODUCT_CLIENT); \
fi
endif
ifdef CHOWN
-$(SILENT) if [ ! -z "$(JAVA_INSTALL_DIR_CLIENT)" -a -d "$(JAVA_DSTROOT_CLIENT)$(JAVA_INSTALL_DIR_CLIENT)" ]; then \
$(ECHO) $(CHOWN) -R $(INSTALL_AS_USER) $(INSTALLED_JAVA_PRODUCT_CLIENT); \
$(CHOWN) -R $(INSTALL_AS_USER) $(INSTALLED_JAVA_PRODUCT_CLIENT); \
fi
endif
else
change-java-perms-client:
endif
else
change-java-perms-client:
endif
#
# Support for converting "bundles" (.app, .palette, .framework,
# and .bundle directory wrappers) from the old OpenStep/Yellow/Cocoa-MacOSXServer structure
# to the new structure for MacOS X
#
# BUNDLE_STYLE controls on a per-project basis if the project wants to use
# the new structure.
# PROJTYPE_CONVERT_BUNDLE is set by the various project type specific makefiles if the
# project type wants to use the new structure. It should be only set if the OS is MACOSX
ifeq "YES" "$(CONVERT_BUNDLE_BACKDOOR)"
PROJTYPE_CONVERT_BUNDLE = YES
endif
# NOTE!!! The convertBundle utility has been removed, for SnowLeopard (Mac OS X 10.6).
# These build rules are only still here to "fail loudly" in case anything is still using this support.
ifeq "YES" "$(PROJTYPE_CONVERT_BUNDLE)"
ifeq "MACOSX" "$(BUNDLE_STYLE)"
convert-bundle:
$(MAKEFILEDIR)/convertBundle $(INSTALLED_PRODUCTS)
else
convert-bundle:
endif
else
convert-bundle:
endif
#
# rule for creating directories
#
$(DSTROOT)$(INSTALLDIR):
$(SILENT) $(MKDIRS) $@
ifeq "$(OS)" "WINDOWS"
include $(MAKEFILEDIR)/reinstall.make
endif