dist-install-dir-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
dist-install-dir-$(1): PREPARE_CLEAN=true
dist-install-dir-$(1): prepare-base-dir-$(1)
+# Write the install manifest, making sure the manifest contains itself
+ $$(Q)touch $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest-$(1).in
$$(Q)(cd $$(PREPARE_DEST_DIR)/ && find -type f | sed 's/^\.\///') \
- > tmp/manifest-$(1) # NB Use a tmp file so `find` doesn't *find the manifest*
- $$(Q)cp tmp/manifest-$(1) $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest
+ > $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest-$(1).in
+# Add remaining non-installed files
$$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)
$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR)
$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR)
install: dist-install-dir-$(CFG_BUILD)
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(CFG_PREFIX)" --libdir="$(CFG_LIBDIR)" --mandir="$(CFG_MANDIR)"
+# Remove tmp files while we can because they may have been created under sudo
+ $(Q)rm -R tmp/dist/$(PKG_NAME)-$(CFG_BUILD/
uninstall: dist-install-dir-$(CFG_BUILD)
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(CFG_PREFIX)" --libdir="$(CFG_LIBDIR)" --mandir="$(CFG_MANDIR)"
# Sanity check: can we can write to the destination?
umask 022 && mkdir -p "${CFG_LIBDIR}"
-need_ok "directory creation failed"
+need_ok "can't write to destination. consider `sudo`."
touch "${CFG_LIBDIR}/rust-install-probe" 2> /dev/null
if [ $? -ne 0 ]
then
- err "can't write to destination. try again with 'sudo'."
+ err "can't write to destination. consider `sudo`."
fi
rm "${CFG_LIBDIR}/rust-install-probe"
need_ok "failed to remove install probe"
+# The file name of the manifest we're going to create during install
INSTALLED_MANIFEST="${CFG_LIBDIR}/rustlib/manifest"
# First, uninstall from the installation prefix.
warn "failed to remove rustlib"
fi
else
+ # There's no manifest. If we were asked to uninstall, then that's a problem.
if [ -n "${CFG_UNINSTALL}" ]
then
err "unable to find installation manifest at ${CFG_LIBDIR}/rustlib"
FILE_INSTALL_PATH="${CFG_MANDIR}/$pp"
fi
- # Make sure ther's a directory for it
+ # Make sure there's a directory for it
umask 022 && mkdir -p "$(dirname ${FILE_INSTALL_PATH})"
need_ok "directory creation failed"
need_ok "failed to update manifest"
# The manifest lists all files to install
-done < "${CFG_SRC_DIR}/lib/rustlib/manifest"
+done < "${CFG_SRC_DIR}/lib/rustlib/manifest.in"
echo
echo " Rust is ready to roll."