@@ -35,6 +35,13 @@ need_ok() {
35
35
fi
36
36
}
37
37
38
+ need_cmd () {
39
+ if command -v $1 > /dev/null 2>&1
40
+ then msg " found $1 "
41
+ else err " need $1 "
42
+ fi
43
+ }
44
+
38
45
putvar () {
39
46
local T
40
47
eval T=\$ $1
@@ -198,6 +205,15 @@ absolutify() {
198
205
ABSOLUTIFIED=" ${FILE_PATH} "
199
206
}
200
207
208
+ msg " looking for install programs"
209
+ need_cmd mkdir
210
+ need_cmd printf
211
+ need_cmd cut
212
+ need_cmd grep
213
+ need_cmd uname
214
+ need_cmd tr
215
+ need_cmd sed
216
+
201
217
CFG_SRC_DIR=" $( cd $( dirname $0 ) && pwd) /"
202
218
CFG_SELF=" $0 "
203
219
CFG_ARGS=" $@ "
@@ -216,16 +232,65 @@ else
216
232
step_msg " processing $CFG_SELF args"
217
233
fi
218
234
235
+ # Check for mingw or cygwin in order to special case $CFG_LIBDIR_RELATIVE.
236
+ # This logic is duplicated from configure in order to get the correct libdir
237
+ # for Windows installs.
238
+ CFG_OSTYPE=$( uname -s)
239
+
240
+ case $CFG_OSTYPE in
241
+
242
+ MINGW32* )
243
+ CFG_OSTYPE=pc-mingw32
244
+ ;;
245
+
246
+ MINGW64* )
247
+ # msys2, MSYSTEM=MINGW64
248
+ CFG_OSTYPE=w64-mingw32
249
+ ;;
250
+
251
+ # Thad's Cygwin identifers below
252
+
253
+ # Vista 32 bit
254
+ CYGWIN_NT-6.0)
255
+ CFG_OSTYPE=pc-mingw32
256
+ ;;
257
+
258
+ # Vista 64 bit
259
+ CYGWIN_NT-6.0-WOW64)
260
+ CFG_OSTYPE=w64-mingw32
261
+ ;;
262
+
263
+ # Win 7 32 bit
264
+ CYGWIN_NT-6.1)
265
+ CFG_OSTYPE=pc-mingw32
266
+ ;;
267
+
268
+ # Win 7 64 bit
269
+ CYGWIN_NT-6.1-WOW64)
270
+ CFG_OSTYPE=w64-mingw32
271
+ ;;
272
+ esac
273
+
219
274
OPTIONS=" "
220
275
BOOL_OPTIONS=" "
221
276
VAL_OPTIONS=" "
222
277
278
+ # On windows we just store the libraries in the bin directory because
279
+ # there's no rpath. This is where the build system itself puts libraries;
280
+ # --libdir is used to configure the installation directory.
281
+ # FIXME: Thise needs to parameterized over target triples. Do it in platform.mk
282
+ CFG_LIBDIR_RELATIVE=lib
283
+ if [ " $CFG_OSTYPE " = " pc-mingw32" ] || [ " $CFG_OSTYPE " = " w64-mingw32" ]
284
+ then
285
+ CFG_LIBDIR_RELATIVE=bin
286
+ fi
287
+
223
288
flag uninstall " only uninstall from the installation prefix"
224
289
opt verify 1 " verify that the installed binaries run correctly"
225
290
valopt prefix " /usr/local" " set installation prefix"
226
291
# NB This isn't quite the same definition as in `configure`.
227
292
# just using 'lib' instead of CFG_LIBDIR_RELATIVE
228
- valopt libdir " ${CFG_PREFIX} /lib " " install libraries"
293
+ valopt libdir " ${CFG_PREFIX} /${CFG_LIBDIR_RELATIVE} " " install libraries"
229
294
valopt mandir " ${CFG_PREFIX} /share/man" " install man pages in PATH"
230
295
231
296
if [ $HELP -eq 1 ]
@@ -384,7 +449,7 @@ while read p; do
384
449
need_ok " failed to update manifest"
385
450
386
451
# The manifest lists all files to install
387
- done < " ${CFG_SRC_DIR} /lib /rustlib/manifest.in"
452
+ done < " ${CFG_SRC_DIR} /${CFG_LIBDIR_RELATIVE} /rustlib/manifest.in"
388
453
389
454
# Sanity check: can we run the installed binaries?
390
455
if [ -z " ${CFG_DISABLE_VERIFY} " ]
0 commit comments