Skip to content

Commit e6c54a1

Browse files
committedJul 3, 2014
auto merge of #15087 : iliekturtles/rust/13810-make-install-mingw32, r=brson
Short-term fix per @brson's comment: #13810 (comment). Tested on Win7 x64 and Linux. One possible issue is that `install.sh` doesn't have a `need_cmd` definition like `configure` does. Should this be ported over as well? Platform-detection code from `configure` copied over to `install.sh` in order to special case the lib dir being `bin` on Windows instead of `lib`. Short-term fix for #13810.
2 parents 67776ba + ccd7aaf commit e6c54a1

File tree

1 file changed

+67
-2
lines changed

1 file changed

+67
-2
lines changed
 

‎src/etc/install.sh

+67-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ need_ok() {
3535
fi
3636
}
3737

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+
3845
putvar() {
3946
local T
4047
eval T=\$$1
@@ -198,6 +205,15 @@ absolutify() {
198205
ABSOLUTIFIED="${FILE_PATH}"
199206
}
200207

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+
201217
CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
202218
CFG_SELF="$0"
203219
CFG_ARGS="$@"
@@ -216,16 +232,65 @@ else
216232
step_msg "processing $CFG_SELF args"
217233
fi
218234

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+
219274
OPTIONS=""
220275
BOOL_OPTIONS=""
221276
VAL_OPTIONS=""
222277

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+
223288
flag uninstall "only uninstall from the installation prefix"
224289
opt verify 1 "verify that the installed binaries run correctly"
225290
valopt prefix "/usr/local" "set installation prefix"
226291
# NB This isn't quite the same definition as in `configure`.
227292
# 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"
229294
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
230295

231296
if [ $HELP -eq 1 ]
@@ -384,7 +449,7 @@ while read p; do
384449
need_ok "failed to update manifest"
385450

386451
# 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"
388453

389454
# Sanity check: can we run the installed binaries?
390455
if [ -z "${CFG_DISABLE_VERIFY}" ]

0 commit comments

Comments
 (0)
Please sign in to comment.