@@ -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+
3845putvar () {
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+
201217CFG_SRC_DIR=" $( cd $( dirname $0 ) && pwd) /"
202218CFG_SELF=" $0 "
203219CFG_ARGS=" $@ "
@@ -216,16 +232,65 @@ else
216232 step_msg " processing $CFG_SELF args"
217233fi
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+
219274OPTIONS=" "
220275BOOL_OPTIONS=" "
221276VAL_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+
223288flag uninstall " only uninstall from the installation prefix"
224289opt verify 1 " verify that the installed binaries run correctly"
225290valopt 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"
229294valopt mandir " ${CFG_PREFIX} /share/man" " install man pages in PATH"
230295
231296if [ $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?
390455if [ -z " ${CFG_DISABLE_VERIFY} " ]
0 commit comments