mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-09 16:37:36 +00:00
rust / build: Remove the rust
tool
Sadly, there's a lack of resources for maintaining the `rust` tool, and we decided in the 2013-10-08 Rust team meeting that it's better to remove it altogether than to leave it in a broken state. This deletion is without prejudice. If a person or people appear who would like to maintain the tool, we will probably be happy to resurrect it! Closes #9775
This commit is contained in:
parent
62812f1e38
commit
a9dddbacde
@ -222,7 +222,6 @@ CFG_LIBSYNTAX_$(1) :=$(call CFG_LIB_NAME_$(1),syntax)
|
||||
CFG_LIBRUSTPKG_$(1) :=$(call CFG_LIB_NAME_$(1),rustpkg)
|
||||
CFG_LIBRUSTDOC_$(1) :=$(call CFG_LIB_NAME_$(1),rustdoc)
|
||||
CFG_LIBRUSTI_$(1) :=$(call CFG_LIB_NAME_$(1),rusti)
|
||||
CFG_LIBRUST_$(1) :=$(call CFG_LIB_NAME_$(1),rust)
|
||||
|
||||
EXTRALIB_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),extra)
|
||||
STDLIB_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),std)
|
||||
@ -231,7 +230,6 @@ LIBSYNTAX_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),syntax)
|
||||
LIBRUSTPKG_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustpkg)
|
||||
LIBRUSTDOC_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustdoc)
|
||||
LIBRUSTI_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rusti)
|
||||
LIBRUST_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rust)
|
||||
EXTRALIB_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),extra)
|
||||
STDLIB_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),std)
|
||||
LIBRUSTC_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustc)
|
||||
@ -239,7 +237,6 @@ LIBSYNTAX_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),syntax)
|
||||
LIBRUSTPKG_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustpkg)
|
||||
LIBRUSTDOC_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustdoc)
|
||||
LIBRUSTI_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rusti)
|
||||
LIBRUST_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rust)
|
||||
|
||||
endef
|
||||
|
||||
@ -447,11 +444,9 @@ CSREQ$(1)_T_$(2)_H_$(3) = \
|
||||
$$(HBIN$(1)_H_$(3))/rustpkg$$(X_$(3)) \
|
||||
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
|
||||
$$(HBIN$(1)_H_$(3))/rusti$$(X_$(3)) \
|
||||
$$(HBIN$(1)_H_$(3))/rust$$(X_$(3)) \
|
||||
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTPKG_$(3)) \
|
||||
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTDOC_$(3)) \
|
||||
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTI_$(3)) \
|
||||
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUST_$(3)) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(2)) \
|
||||
@ -459,7 +454,6 @@ CSREQ$(1)_T_$(2)_H_$(3) = \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTPKG_$(2)) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTDOC_$(2)) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTI_$(2)) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUST_$(2))
|
||||
|
||||
ifeq ($(1),0)
|
||||
# Don't run the the stage0 compiler under valgrind - that ship has sailed
|
||||
|
111
man/rust.1
111
man/rust.1
@ -1,111 +0,0 @@
|
||||
.TH RUST "1" "July 2013" "rust 0.7" "User Commands"
|
||||
.SH NAME
|
||||
rust \- a front-end to the Rust toolchain
|
||||
.SH SYNOPSIS
|
||||
.B rust
|
||||
[\fICOMMAND\fR] [\fIOPTIONS\fR] \fIINPUT\fR
|
||||
|
||||
.SH DESCRIPTION
|
||||
This tool is a front-end for the Rust language, available at
|
||||
<\fBhttps://www.rust-lang.org\fR>. It provides commands to
|
||||
run, test and package Rust programs.
|
||||
|
||||
.SH COMMANDS
|
||||
|
||||
.TP
|
||||
\fBbuild\fR
|
||||
compile rust source files
|
||||
.TP
|
||||
\fBrun\fR
|
||||
build an executable, and run it
|
||||
.TP
|
||||
\fBtest\fR
|
||||
build a test executable, and run it
|
||||
.TP
|
||||
\fBdoc\fR
|
||||
generate documentation from doc comments
|
||||
.TP
|
||||
\fBpkg\fR
|
||||
download, build, install rust packages
|
||||
.TP
|
||||
\fBsketch\fR
|
||||
run a rust interpreter
|
||||
.TP
|
||||
\fBhelp\fR
|
||||
show detailed usage of a command
|
||||
|
||||
The build, run and test commands take the same parameters
|
||||
as the rustc command.
|
||||
|
||||
.SS "BUILD COMMAND"
|
||||
|
||||
The \fBbuild\fR command is a shortcut for the \fBrustc\fR command line.
|
||||
All options will be passed to the compiler verbatim. For example, to build
|
||||
an optimised version:
|
||||
|
||||
$ rust build -O <filename>
|
||||
|
||||
.SS "RUN COMMAND"
|
||||
|
||||
The \fBrun\fR command is a shortcut for the \fBrustc\fR command line.
|
||||
All options will be passed to the compiler verbatim, and if the compilation
|
||||
is successful, the resultant executable will be invoked. For example, to
|
||||
build and run an optimised version:
|
||||
|
||||
$ rust run -O <filename>
|
||||
|
||||
.SS "TEST COMMAND"
|
||||
|
||||
The \fBtest\fR command is a shortcut for the command line:
|
||||
|
||||
$ rustc --test <filename> -o <filestem>test~ && ./<filestem>test~
|
||||
|
||||
.SS "DOC COMMAND"
|
||||
|
||||
The \fBdoc\fR command is an alias for the rustdoc program. It is equivalent to:
|
||||
|
||||
$ rustdoc [options] <cratefile>
|
||||
|
||||
.SS "PKG COMMAND"
|
||||
|
||||
The \fBpkg\fR command is an alias for the rustpkg program. It is equivalent to:
|
||||
|
||||
$ rustpkg [options] <cratefile>
|
||||
|
||||
.SS "SKETCH COMMAND"
|
||||
|
||||
The \fBsketch\fR command launches the \fBrusti\fR interactive shell.
|
||||
|
||||
.SS "HELP COMMAND"
|
||||
|
||||
The \fBhelp\fR command displays a summary of available commands (ie. this text).
|
||||
|
||||
.SH "EXAMPLES"
|
||||
|
||||
To build an executable (with a main function):
|
||||
$ rust build hello.rs
|
||||
|
||||
To build a library from a source file:
|
||||
$ rust build --lib hello-lib.rs
|
||||
|
||||
To build and run an executable:
|
||||
$ rust run hello.rs
|
||||
|
||||
To build an executable with unit tests and execute the tests:
|
||||
$ rust test hello.rs
|
||||
|
||||
To create a package
|
||||
|
||||
.SH "SEE ALSO"
|
||||
rustc, rustdoc, rustpkg, rusti
|
||||
|
||||
.SH "BUGS"
|
||||
See <\fBhttps://github.com/mozilla/rust/issues\fR> for issues.
|
||||
|
||||
.SH "AUTHOR"
|
||||
See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare
|
||||
<\fIgraydon@mozilla.com\fR> is the project leader.
|
||||
|
||||
.SH "COPYRIGHT"
|
||||
This work is dual-licensed under Apache 2.0 and MIT terms. See \fBCOPYRIGHT\fR
|
||||
file in the rust source distribution.
|
@ -77,7 +77,6 @@ clean$(1)_H_$(2):
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTC_$(2))
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBSYNTAX_$(2))
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTI_$(2))
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUST_$(2))
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(STDLIB_GLOB_$(2))
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(EXTRALIB_GLOB_$(2))
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTC_GLOB_$(2))
|
||||
@ -85,7 +84,6 @@ clean$(1)_H_$(2):
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTPKG_GLOB_$(2))
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTDOC_GLOB_$(2))
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTI_GLOB_$(2))
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUST_GLOB_$(2))
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUSTLLVM_$(2))
|
||||
$(Q)rm -f $$(HLIB$(1)_H_$(2))/libstd.rlib
|
||||
|
||||
@ -112,7 +110,6 @@ clean$(1)_T_$(2)_H_$(3):
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(2))
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(2))
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTI_$(2))
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUST_$(2))
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(STDLIB_GLOB_$(2))
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(EXTRALIB_GLOB_$(2))
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTC_GLOB_$(2))
|
||||
@ -120,7 +117,6 @@ clean$(1)_T_$(2)_H_$(3):
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTPKG_GLOB_$(2))
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTDOC_GLOB_$(2))
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTI_GLOB_$(2))
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUST_GLOB_$(2))
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(2))
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libstd.rlib
|
||||
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
|
||||
|
@ -30,7 +30,6 @@ PKG_FILES := \
|
||||
driver \
|
||||
librustpkg \
|
||||
librusti \
|
||||
librust \
|
||||
librustc \
|
||||
compiletest \
|
||||
etc \
|
||||
|
@ -105,7 +105,6 @@ install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
|
||||
$$(Q)$$(call INSTALL_LIB,$$(LIBRUSTPKG_GLOB_$(1)))
|
||||
$$(Q)$$(call INSTALL_LIB,$$(LIBRUSTDOC_GLOB_$(1)))
|
||||
$$(Q)$$(call INSTALL_LIB,$$(LIBRUSTI_GLOB_$(1)))
|
||||
$$(Q)$$(call INSTALL_LIB,$$(LIBRUST_GLOB_$(1)))
|
||||
$$(Q)$$(call INSTALL_LIB,libmorestack.a)
|
||||
|
||||
endef
|
||||
@ -140,18 +139,15 @@ install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_TRIPLE)_H_$(CFG_BUILD_TRIPLE))
|
||||
$(Q)$(call INSTALL,$(HB2),$(PHB),rustpkg$(X_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL,$(HB2),$(PHB),rustdoc$(X_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL,$(HB2),$(PHB),rusti$(X_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL,$(HB2),$(PHB),rust$(X_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL_LIB,$(STDLIB_GLOB_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL_LIB,$(EXTRALIB_GLOB_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL_LIB,$(LIBRUSTC_GLOB_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL_LIB,$(LIBSYNTAX_GLOB_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL_LIB,$(LIBRUSTI_GLOB_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL_LIB,$(LIBRUST_GLOB_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL_LIB,$(LIBRUSTPKG_GLOB_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL_LIB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUNTIME_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM_$(CFG_BUILD_TRIPLE)))
|
||||
$(Q)$(call INSTALL,$(S)/man, $(PREFIX_ROOT)/share/man/man1,rust.1)
|
||||
$(Q)$(call INSTALL,$(S)/man, $(PREFIX_ROOT)/share/man/man1,rustc.1)
|
||||
$(Q)$(call INSTALL,$(S)/man, $(PREFIX_ROOT)/share/man/man1,rustdoc.1)
|
||||
$(Q)$(call INSTALL,$(S)/man, $(PREFIX_ROOT)/share/man/man1,rusti.1)
|
||||
@ -167,7 +163,6 @@ uninstall:
|
||||
$(Q)rm -f $(PHB)/rustc$(X_$(CFG_BUILD_TRIPLE))
|
||||
$(Q)rm -f $(PHB)/rustpkg$(X_$(CFG_BUILD_TRIPLE))
|
||||
$(Q)rm -f $(PHB)/rusti$(X_$(CFG_BUILD_TRIPLE))
|
||||
$(Q)rm -f $(PHB)/rust$(X_$(CFG_BUILD_TRIPLE))
|
||||
$(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD_TRIPLE))
|
||||
$(Q)rm -f $(PHL)/$(CFG_RUSTLLVM_$(CFG_BUILD_TRIPLE))
|
||||
$(Q)rm -f $(PHL)/$(CFG_RUNTIME_$(CFG_BUILD_TRIPLE))
|
||||
@ -179,12 +174,10 @@ uninstall:
|
||||
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTPKG_GLOB_$(CFG_BUILD_TRIPLE))) \
|
||||
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD_TRIPLE))) \
|
||||
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTI_GLOB_$(CFG_BUILD_TRIPLE))) \
|
||||
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUST_GLOB_$(CFG_BUILD_TRIPLE))) \
|
||||
; \
|
||||
do rm -f $$i ; \
|
||||
done
|
||||
$(Q)rm -Rf $(PHL)/rustc
|
||||
$(Q)rm -f $(PREFIX_ROOT)/share/man/man1/rust.1
|
||||
$(Q)rm -f $(PREFIX_ROOT)/share/man/man1/rustc.1
|
||||
$(Q)rm -f $(PREFIX_ROOT)/share/man/man1/rustdoc.1
|
||||
$(Q)rm -f $(PREFIX_ROOT)/share/man/man1/rusti.1
|
||||
|
12
mk/tests.mk
12
mk/tests.mk
@ -15,7 +15,7 @@
|
||||
|
||||
# The names of crates that must be tested
|
||||
TEST_TARGET_CRATES = std extra
|
||||
TEST_HOST_CRATES = rust rusti rustpkg rustc rustdoc syntax
|
||||
TEST_HOST_CRATES = rusti rustpkg rustc rustdoc syntax
|
||||
TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
|
||||
|
||||
# Markdown files under doc/ that should have their code extracted and run
|
||||
@ -387,16 +387,6 @@ $(3)/stage$(1)/test/rustitest-$(2)$$(X_$(2)): \
|
||||
@$$(call E, compile_and_link: $$@)
|
||||
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
|
||||
|
||||
$(3)/stage$(1)/test/rusttest-$(2)$$(X_$(2)): \
|
||||
$$(RUST_LIB) $$(RUST_INPUTS) \
|
||||
$$(SREQ$(1)_T_$(2)_H_$(3)) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTPKG_$(2)) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTDOC_$(2)) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTI_$(2)) \
|
||||
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
|
||||
@$$(call E, compile_and_link: $$@)
|
||||
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
|
||||
|
||||
$(3)/stage$(1)/test/rustdoctest-$(2)$$(X_$(2)): \
|
||||
$$(RUSTDOC_LIB) $$(RUSTDOC_INPUTS) \
|
||||
$$(SREQ$(1)_T_$(2)_H_$(3)) \
|
||||
|
46
mk/tools.mk
46
mk/tools.mk
@ -28,10 +28,6 @@ RUSTDOC_INPUTS := $(wildcard $(addprefix $(S)src/librustdoc/, \
|
||||
RUSTI_LIB := $(S)src/librusti/rusti.rs
|
||||
RUSTI_INPUTS := $(wildcard $(S)src/librusti/*.rs)
|
||||
|
||||
# Rust, the convenience tool
|
||||
RUST_LIB := $(S)src/librust/rust.rs
|
||||
RUST_INPUTS := $(wildcard $(S)src/librust/*.rs)
|
||||
|
||||
# FIXME: These are only built for the host arch. Eventually we'll
|
||||
# have tools that need to built for other targets.
|
||||
define TOOLS_STAGE_N_TARGET
|
||||
@ -97,27 +93,6 @@ $$(TBIN$(1)_T_$(4)_H_$(3))/rusti$$(X_$(4)): \
|
||||
@$$(call E, compile_and_link: $$@)
|
||||
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg rusti -o $$@ $$<
|
||||
|
||||
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4)): \
|
||||
$$(RUST_LIB) $$(RUST_INPUTS) \
|
||||
$$(SREQ$(1)_T_$(4)_H_$(3)) \
|
||||
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)) \
|
||||
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTI_$(4)) \
|
||||
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4)) \
|
||||
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4)) \
|
||||
| $$(TLIB$(1)_T_$(4)_H_$(3))/
|
||||
@$$(call E, compile_and_link: $$@)
|
||||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@))
|
||||
$$(STAGE$(1)_T_$(4)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
|
||||
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@))
|
||||
|
||||
$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X_$(4)): \
|
||||
$$(DRIVER_CRATE) \
|
||||
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
|
||||
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4)) \
|
||||
| $$(TBIN$(1)_T_$(4)_H_$(3))/
|
||||
@$$(call E, compile_and_link: $$@)
|
||||
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg rust -o $$@ $$<
|
||||
|
||||
endef
|
||||
|
||||
define TOOLS_STAGE_N_HOST
|
||||
@ -193,27 +168,6 @@ $$(HBIN$(2)_H_$(4))/rusti$$(X_$(4)): \
|
||||
@$$(call E, cp: $$@)
|
||||
$$(Q)cp $$< $$@
|
||||
|
||||
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUST_$(4)): \
|
||||
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4)) \
|
||||
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)) \
|
||||
$$(HSREQ$(2)_H_$(4)) \
|
||||
| $$(HLIB$(2)_H_$(4))/
|
||||
@$$(call E, cp: $$@)
|
||||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@))
|
||||
$$(Q)cp $$< $$@
|
||||
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUST_GLOB_$(4)),$$(notdir $$@))
|
||||
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUST_GLOB_$(4)) \
|
||||
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUST_DSYM_GLOB)_$(4)) \
|
||||
$$(HLIB$(2)_H_$(4))
|
||||
|
||||
$$(HBIN$(2)_H_$(4))/rust$$(X_$(4)): \
|
||||
$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X_$(4)) \
|
||||
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUST_$(4)) \
|
||||
$$(HSREQ$(2)_H_$(4)) \
|
||||
| $$(HBIN$(2)_H_$(4))/
|
||||
@$$(call E, cp: $$@)
|
||||
$$(Q)cp $$< $$@
|
||||
|
||||
endef
|
||||
|
||||
$(foreach host,$(CFG_HOST_TRIPLES), \
|
||||
|
@ -1,256 +0,0 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// rust - central access to other rust tools
|
||||
// FIXME #2238 Make commands run and test emit proper file endings on windows
|
||||
// FIXME #2238 Make run only accept source that emits an executable
|
||||
|
||||
#[link(name = "rust",
|
||||
vers = "0.9-pre",
|
||||
uuid = "4a24da33-5cc8-4037-9352-2cbe9bd9d27c",
|
||||
url = "https://github.com/mozilla/rust/tree/master/src/rust")];
|
||||
|
||||
#[license = "MIT/ASL2"];
|
||||
#[crate_type = "lib"];
|
||||
|
||||
extern mod rustpkg;
|
||||
extern mod rustdoc;
|
||||
extern mod rusti;
|
||||
extern mod rustc;
|
||||
|
||||
use std::io;
|
||||
use std::os;
|
||||
use std::run;
|
||||
|
||||
enum ValidUsage {
|
||||
Valid(int), Invalid
|
||||
}
|
||||
|
||||
impl ValidUsage {
|
||||
fn is_valid(&self) -> bool {
|
||||
match *self {
|
||||
Valid(_) => true,
|
||||
Invalid => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum Action {
|
||||
Call(extern "Rust" fn(args: &[~str]) -> ValidUsage),
|
||||
CallMain(&'static str, extern "Rust" fn(&[~str]) -> int),
|
||||
}
|
||||
|
||||
enum UsageSource<'self> {
|
||||
UsgStr(&'self str),
|
||||
UsgCall(extern "Rust" fn()),
|
||||
}
|
||||
|
||||
struct Command<'self> {
|
||||
cmd: &'self str,
|
||||
action: Action,
|
||||
usage_line: &'self str,
|
||||
usage_full: UsageSource<'self>,
|
||||
}
|
||||
|
||||
static COMMANDS: &'static [Command<'static>] = &'static [
|
||||
Command {
|
||||
cmd: "build",
|
||||
action: CallMain("rustc", rustc::main_args),
|
||||
usage_line: "compile rust source files",
|
||||
usage_full: UsgCall(rustc_help),
|
||||
},
|
||||
Command {
|
||||
cmd: "run",
|
||||
action: Call(cmd_run),
|
||||
usage_line: "build an executable, and run it",
|
||||
usage_full: UsgStr(
|
||||
"The run command is an shortcut for the command line \n\
|
||||
\"rustc <filename> -o <filestem>~ && ./<filestem>~ [<arguments>...]\".\
|
||||
\n\nUsage:\trust run <filename> [<arguments>...]"
|
||||
)
|
||||
},
|
||||
Command {
|
||||
cmd: "test",
|
||||
action: Call(cmd_test),
|
||||
usage_line: "build a test executable, and run it",
|
||||
usage_full: UsgStr(
|
||||
"The test command is an shortcut for the command line \n\
|
||||
\"rustc --test <filename> -o <filestem>test~ && \
|
||||
./<filestem>test~ [<arguments>...]\"\
|
||||
\n\nUsage:\trust test <filename> [<arguments>...]"
|
||||
)
|
||||
},
|
||||
Command {
|
||||
cmd: "doc",
|
||||
action: CallMain("rustdoc", rustdoc::main_args),
|
||||
usage_line: "generate documentation from doc comments",
|
||||
usage_full: UsgCall(rustdoc_help),
|
||||
},
|
||||
Command {
|
||||
cmd: "pkg",
|
||||
action: CallMain("rustpkg", rustpkg::main_args),
|
||||
usage_line: "download, build, install rust packages",
|
||||
usage_full: UsgCall(rustpkg::usage::general),
|
||||
},
|
||||
Command {
|
||||
cmd: "sketch",
|
||||
action: CallMain("rusti", rusti::main_args),
|
||||
usage_line: "run a rust interpreter",
|
||||
usage_full: UsgStr("\nUsage:\trusti"),
|
||||
},
|
||||
Command {
|
||||
cmd: "help",
|
||||
action: Call(cmd_help),
|
||||
usage_line: "show detailed usage of a command",
|
||||
usage_full: UsgStr(
|
||||
"The help command displays the usage text of another command.\n\
|
||||
The text is either build in, or provided by the corresponding \
|
||||
program.\n\nUsage:\trust help <command>"
|
||||
)
|
||||
}
|
||||
];
|
||||
|
||||
fn rustc_help() {
|
||||
rustc::usage(os::args()[0].clone())
|
||||
}
|
||||
|
||||
fn rustdoc_help() {
|
||||
rustdoc::usage(os::args()[0].clone())
|
||||
}
|
||||
|
||||
fn find_cmd(command_string: &str) -> Option<Command> {
|
||||
do COMMANDS.iter().find |command| {
|
||||
command.cmd == command_string
|
||||
}.map(|x| *x)
|
||||
}
|
||||
|
||||
fn cmd_help(args: &[~str]) -> ValidUsage {
|
||||
fn print_usage(command_string: ~str) -> ValidUsage {
|
||||
match find_cmd(command_string) {
|
||||
Some(command) => {
|
||||
match command.action {
|
||||
CallMain(prog, _) => println!(
|
||||
"The {} command is an alias for the {} program.",
|
||||
command.cmd, prog),
|
||||
_ => ()
|
||||
}
|
||||
match command.usage_full {
|
||||
UsgStr(msg) => println!("{}\n", msg),
|
||||
UsgCall(f) => f(),
|
||||
}
|
||||
Valid(0)
|
||||
},
|
||||
None => Invalid
|
||||
}
|
||||
}
|
||||
|
||||
match args {
|
||||
[ref command_string] => print_usage((*command_string).clone()),
|
||||
_ => Invalid
|
||||
}
|
||||
}
|
||||
|
||||
fn cmd_test(args: &[~str]) -> ValidUsage {
|
||||
match args {
|
||||
[ref filename, ..prog_args] => {
|
||||
let p = Path(*filename);
|
||||
let test_exec = p.filestem().unwrap() + "test~";
|
||||
invoke("rustc", &[~"--test", filename.to_owned(),
|
||||
~"-o", test_exec.to_owned()], rustc::main_args);
|
||||
let exit_code = run::process_status(~"./" + test_exec, prog_args);
|
||||
Valid(exit_code)
|
||||
}
|
||||
_ => Invalid
|
||||
}
|
||||
}
|
||||
|
||||
fn cmd_run(args: &[~str]) -> ValidUsage {
|
||||
match args {
|
||||
[ref filename, ..prog_args] => {
|
||||
let p = Path(*filename);
|
||||
let exec = p.filestem().unwrap() + "~";
|
||||
invoke("rustc", &[filename.to_owned(), ~"-o", exec.to_owned()],
|
||||
rustc::main_args);
|
||||
let exit_code = run::process_status(~"./"+exec, prog_args);
|
||||
Valid(exit_code)
|
||||
}
|
||||
_ => Invalid
|
||||
}
|
||||
}
|
||||
|
||||
fn invoke(prog: &str, args: &[~str], f: &fn(&[~str]) -> int) -> int {
|
||||
let mut osargs = ~[prog.to_owned()];
|
||||
osargs.push_all_move(args.to_owned());
|
||||
f(osargs)
|
||||
}
|
||||
|
||||
fn do_command(command: &Command, args: &[~str]) -> ValidUsage {
|
||||
match command.action {
|
||||
Call(f) => f(args),
|
||||
CallMain(prog, f) => {
|
||||
Valid(invoke(prog, args, f))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn usage() {
|
||||
static INDENT: uint = 8;
|
||||
|
||||
io::print(
|
||||
"The rust tool is a convenience for managing rust source code.\n\
|
||||
It acts as a shortcut for programs of the rust tool chain.\n\
|
||||
\n\
|
||||
Usage:\trust <command> [arguments]\n\
|
||||
\n\
|
||||
The commands are:\n\
|
||||
\n"
|
||||
);
|
||||
|
||||
for command in COMMANDS.iter() {
|
||||
let padding = " ".repeat(INDENT - command.cmd.len());
|
||||
println!(" {}{}{}", command.cmd, padding, command.usage_line);
|
||||
}
|
||||
|
||||
io::print(
|
||||
"\n\
|
||||
Use \"rust help <command>\" for more information about a command.\n\
|
||||
\n"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
#[fixed_stack_segment]; #[inline(never)];
|
||||
|
||||
let os_args = os::args();
|
||||
|
||||
if (os_args.len() > 1 && (os_args[1] == ~"-v" || os_args[1] == ~"--version")) {
|
||||
rustc::version(os_args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
let args = os_args.tail();
|
||||
|
||||
if !args.is_empty() {
|
||||
let r = find_cmd(*args.head());
|
||||
for command in r.iter() {
|
||||
let result = do_command(command, args.tail());
|
||||
match result {
|
||||
Valid(exit_code) => {
|
||||
os::set_exit_status(exit_code);
|
||||
return;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
usage();
|
||||
}
|
Loading…
Reference in New Issue
Block a user