@@ -28,7 +28,7 @@ use build_helper::output;
2828
2929use { Build , Compiler , Mode } ;
3030use channel;
31- use util:: { cp_r, libdir, is_dylib, cp_filtered, copy} ;
31+ use util:: { cp_r, libdir, is_dylib, cp_filtered, copy, replace_in_file } ;
3232use builder:: { Builder , RunConfig , ShouldRun , Step } ;
3333use compile;
3434use tool:: { self , Tool } ;
@@ -434,7 +434,22 @@ impl Step for Rustc {
434434
435435 // Man pages
436436 t ! ( fs:: create_dir_all( image. join( "share/man/man1" ) ) ) ;
437- cp_r ( & build. src . join ( "src/doc/man" ) , & image. join ( "share/man/man1" ) ) ;
437+ let man_src = build. src . join ( "src/doc/man" ) ;
438+ let man_dst = image. join ( "share/man/man1" ) ;
439+ let date_output = output ( Command :: new ( "date" ) . arg ( "+%B %Y" ) ) ;
440+ let month_year = date_output. trim ( ) ;
441+ // don't use our `bootstrap::util::{copy, cp_r}`, because those try
442+ // to hardlink, and we don't want to edit the source templates
443+ for entry_result in t ! ( fs:: read_dir( man_src) ) {
444+ let file_entry = t ! ( entry_result) ;
445+ let page_src = file_entry. path ( ) ;
446+ let page_dst = man_dst. join ( file_entry. file_name ( ) ) ;
447+ t ! ( fs:: copy( & page_src, & page_dst) ) ;
448+ // template in month/year and version number
449+ replace_in_file ( & page_dst,
450+ & [ ( "<INSERT DATE HERE>" , month_year) ,
451+ ( "<INSERT VERSION HERE>" , channel:: CFG_RELEASE_NUM ) ] ) ;
452+ }
438453
439454 // Debugger scripts
440455 builder. ensure ( DebuggerScripts {
0 commit comments