diff --git a/man/.gitignore b/man/.gitignore new file mode 100644 index 0000000000000..aceb2df0637a9 --- /dev/null +++ b/man/.gitignore @@ -0,0 +1,2 @@ +rustc.1 +rustdoc.1 diff --git a/man/rustc.1 b/man/rustc.1.in similarity index 99% rename from man/rustc.1 rename to man/rustc.1.in index 0eaf89a560fb8..c536cd4a07d88 100644 --- a/man/rustc.1 +++ b/man/rustc.1.in @@ -1,4 +1,3 @@ -.TH RUSTC "1" "August 2016" "rustc 1.12.0" "User Commands" .SH NAME rustc \- The Rust compiler .SH SYNOPSIS diff --git a/man/rustdoc.1 b/man/rustdoc.1.in similarity index 98% rename from man/rustdoc.1 rename to man/rustdoc.1.in index 3fb5757f4ff24..55ff9331fd82b 100644 --- a/man/rustdoc.1 +++ b/man/rustdoc.1.in @@ -1,4 +1,3 @@ -.TH RUSTDOC "1" "August 2016" "rustdoc 1.12.0" "User Commands" .SH NAME rustdoc \- generate documentation from Rust source code .SH SYNOPSIS diff --git a/mk/clean.mk b/mk/clean.mk index ac34ac506bb17..9c79076ac9492 100644 --- a/mk/clean.mk +++ b/mk/clean.mk @@ -46,6 +46,7 @@ clean-misc: $(Q)rm -Rf rust-stage0-*.tar.bz2 $(PKG_NAME)-*.tar.gz $(PKG_NAME)-*.exe $(Q)rm -Rf dist/* $(Q)rm -Rf doc + $(Q)git clean -xdf man/ define CLEAN_GENERIC diff --git a/mk/docs.mk b/mk/docs.mk index f202c75360bf8..0aaf7a2e601f3 100644 --- a/mk/docs.mk +++ b/mk/docs.mk @@ -191,7 +191,7 @@ ifdef CFG_DISABLE_DOCS COMPILER_DOC_TARGETS := endif -docs: $(DOC_TARGETS) +docs: $(DOC_TARGETS) doc-man doc: docs compiler-docs: $(COMPILER_DOC_TARGETS) @@ -227,3 +227,11 @@ doc/error-index.html: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUIL doc/error-index.md: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/ $(Q)$(call E, error_index_generator: $@) $(Q)$(ERR_IDX_GEN_MD) + +doc-man: + cd man && \ + echo '.TH RUSTC "1" "$(shell LANG=C date "+%B %Y")" "rustc $(CFG_RELEASE_NUM)" "User Commands"' > rustc.1 && \ + cat rustc.1.in >> rustc.1 + cd man && \ + echo '.TH RUSTDOC "1" "$(shell LANG=C date "+%B %Y")" "rustdoc $(CFG_RELEASE_NUM)" "User Commands"' > rustdoc.1 && \ + cat rustdoc.1.in >> rustdoc.1 diff --git a/src/bootstrap/Cargo.lock b/src/bootstrap/Cargo.lock index d52577eb228e2..36b94e4ebea32 100644 --- a/src/bootstrap/Cargo.lock +++ b/src/bootstrap/Cargo.lock @@ -157,3 +157,24 @@ name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[metadata] +"checksum aho-corasick 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2b3fb52b09c1710b961acb35390d514be82e4ac96a9969a8e38565a29b878dc9" +"checksum cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "dfcf5bcece56ef953b8ea042509e9dcbdfe97820b7e20d86beb53df30ed94978" +"checksum filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5363ab8e4139b8568a6237db5248646e5a8a2f89bd5ccb02092182b11fd3e922" +"checksum gcc 0.3.31 (git+https://github.com/alexcrichton/gcc-rs)" = "" +"checksum gcc 0.3.31 (registry+https://github.com/rust-lang/crates.io-index)" = "cfe877476e53690ebb0ce7325d0bf43e198d9500291b54b3c65e518de5039b07" +"checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum libc 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "55f3730be7e803cf350d32061958171731c2395831fbd67a61083782808183e0" +"checksum md5 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a5539a8dee9b4ae308c9c406a379838b435a8f2c84cf9fedc6d5a576be9888db" +"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" +"checksum num_cpus 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "51fedae97a05f7353612fe017ab705a37e6db8f4d67c5c6fe739a9e70d6eed09" +"checksum regex 0.1.73 (registry+https://github.com/rust-lang/crates.io-index)" = "56b7ee9f764ecf412c6e2fff779bca4b22980517ae335a21aeaf4e32625a5df2" +"checksum regex-syntax 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "31040aad7470ad9d8c46302dcffba337bb4289ca5da2e3cd6e37b64109a85199" +"checksum rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6159e4e6e559c81bd706afe9c8fd68f547d3e851ce12e76b1de7914bab61691b" +"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" +"checksum thread_local 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "55dd963dbaeadc08aa7266bf7f91c3154a7805e32bb94b820b769d2ef3b4744d" +"checksum toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "fcd27a04ca509aff336ba5eb2abc58d456f52c4ff64d9724d88acb85ead560b6" +"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" +"checksum winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4dfaaa8fbdaa618fa6914b59b2769d690dd7521920a18d84b42d254678dd5fd4" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 9d18901eb0002..0a380a5fb657c 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -211,7 +211,28 @@ pub fn rustc(build: &Build, stage: u32, host: &str) { // Man pages t!(fs::create_dir_all(image.join("share/man/man1"))); - cp_r(&build.src.join("man"), &image.join("share/man/man1")); + //cp_r(&build.src.join("man"), &image.join("share/man/man1")); + let now_string = calc_now_string(); + println!("Searchable 98hnandsf9ifnesd"); + for man_page_source in t!(build.src.join("man").read_dir()).map(|e| t!(e)) { + let os_filename = man_page_source.file_name(); + + if let Some(filename) = os_filename.to_str() { + + // Match all source files + if filename.ends_with(".1.in") { + let header = + format!(r##".TH RUSTC "1" "{now_string}" "rustc 1.12.0" "User Commands""## + , now_string=now_string); + + println!("build: {:?}\nheader: {:?}", build.release, header); + } + // Match all generated files + if filename.ends_with(".1") { + // FIXME copy them + } + } + } // Debugger scripts debugger_scripts(build, &image, host); @@ -225,6 +246,52 @@ pub fn rustc(build: &Build, stage: u32, host: &str) { cp("LICENSE-MIT"); cp("README.md"); } + + fn calc_now_string() -> String { + use std::time::*; + + let now = SystemTime::now(); + let now = now.duration_since(UNIX_EPOCH).unwrap(); + let secs = now.as_secs(); + + let years = secs / (60 * 60 * 24 * 365); + + let year_secs = 60 * 60 * 24 * 365; // n seconds per year + let years_secs = years * year_secs; // seconds all past years used up + + let this_years_secs = secs - years_secs; + + let january : u64 = 60*60*24* 31; + let february : u64 = january + (60f64*60f64*24f64* 28.25) as u64; + let march : u64 = february + 60*60*24* 31; + let april : u64 = march + 60*60*24* 30; + let may : u64 = april + 60*60*24* 31; + let june : u64 = may + 60*60*24* 30; + let july : u64 = june + 60*60*24* 31; + let august : u64 = july + 60*60*24* 31; + let september : u64 = august + 60*60*24* 30; + let october : u64 = september + 60*60*24* 31; + let november : u64 = october + 60*60*24* 30; + + let month = + if this_years_secs < january { "January" } else + if this_years_secs < february { "February" } else + if this_years_secs < march { "March" } else + if this_years_secs < april { "April" } else + if this_years_secs < may { "May" } else + if this_years_secs < june { "June" } else + if this_years_secs < july { "July" } else + if this_years_secs < august { "August" } else + if this_years_secs < september { "September" } else + if this_years_secs < october { "October" } else + if this_years_secs < november { "November" } else + { "December" } + ; + + let year = years + 1970; + + format!("{} {}", month, year) + } } /// Copies debugger scripts for `host` into the `sysroot` specified.