@@ -531,189 +531,3 @@ impl Step for TestHelpers {
531531 . compile ( "rust_test_helpers" ) ;
532532 }
533533}
534-
535- const OPENSSL_VERS : & ' static str = "1.0.2n" ;
536- const OPENSSL_SHA256 : & ' static str =
537- "370babb75f278c39e0c50e8c4e7493bc0f18db6867478341a832a982fd15a8fe" ;
538-
539- #[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
540- pub struct Openssl {
541- pub target : Interned < String > ,
542- }
543-
544- impl Step for Openssl {
545- type Output = ( ) ;
546-
547- fn should_run ( run : ShouldRun ) -> ShouldRun {
548- run. never ( )
549- }
550-
551- fn run ( self , builder : & Builder ) {
552- if builder. config . dry_run {
553- return ;
554- }
555- let target = self . target ;
556- let out = match builder. openssl_dir ( target) {
557- Some ( dir) => dir,
558- None => return ,
559- } ;
560-
561- let stamp = out. join ( ".stamp" ) ;
562- let mut contents = String :: new ( ) ;
563- drop ( File :: open ( & stamp) . and_then ( |mut f| f. read_to_string ( & mut contents) ) ) ;
564- if contents == OPENSSL_VERS {
565- return
566- }
567- t ! ( fs:: create_dir_all( & out) ) ;
568-
569- let name = format ! ( "openssl-{}.tar.gz" , OPENSSL_VERS ) ;
570- let tarball = out. join ( & name) ;
571- if !tarball. exists ( ) {
572- let tmp = tarball. with_extension ( "tmp" ) ;
573- // originally from https://www.openssl.org/source/...
574- let url = format ! ( "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/{}" ,
575- name) ;
576- let mut last_error = None ;
577- for _ in 0 ..3 {
578- let status = Command :: new ( "curl" )
579- . arg ( "-o" ) . arg ( & tmp)
580- . arg ( "-f" ) // make curl fail if the URL does not return HTTP 200
581- . arg ( & url)
582- . status ( )
583- . expect ( "failed to spawn curl" ) ;
584-
585- // Retry if download failed.
586- if !status. success ( ) {
587- last_error = Some ( status. to_string ( ) ) ;
588- continue ;
589- }
590-
591- // Ensure the hash is correct.
592- let mut shasum = if target. contains ( "apple" ) ||
593- builder. config . build . contains ( "netbsd" ) {
594- let mut cmd = Command :: new ( "shasum" ) ;
595- cmd. arg ( "-a" ) . arg ( "256" ) ;
596- cmd
597- } else {
598- Command :: new ( "sha256sum" )
599- } ;
600- let output = output ( & mut shasum. arg ( & tmp) ) ;
601- let found = output. split_whitespace ( ) . next ( ) . unwrap ( ) ;
602-
603- // If the hash is wrong, probably the download is incomplete or S3 served an error
604- // page. In any case, retry.
605- if found != OPENSSL_SHA256 {
606- last_error = Some ( format ! (
607- "downloaded openssl sha256 different\n \
608- expected: {}\n \
609- found: {}\n ",
610- OPENSSL_SHA256 ,
611- found
612- ) ) ;
613- continue ;
614- }
615-
616- // Everything is fine, so exit the retry loop.
617- last_error = None ;
618- break ;
619- }
620- if let Some ( error) = last_error {
621- panic ! ( "failed to download openssl source: {}" , error) ;
622- }
623- t ! ( fs:: rename( & tmp, & tarball) ) ;
624- }
625- let obj = out. join ( format ! ( "openssl-{}" , OPENSSL_VERS ) ) ;
626- let dst = builder. openssl_install_dir ( target) . unwrap ( ) ;
627- drop ( fs:: remove_dir_all ( & obj) ) ;
628- drop ( fs:: remove_dir_all ( & dst) ) ;
629- builder. run ( Command :: new ( "tar" ) . arg ( "zxf" ) . arg ( & tarball) . current_dir ( & out) ) ;
630-
631- let mut configure = Command :: new ( "perl" ) ;
632- configure. arg ( obj. join ( "Configure" ) ) ;
633- configure. arg ( format ! ( "--prefix={}" , dst. display( ) ) ) ;
634- configure. arg ( "no-dso" ) ;
635- configure. arg ( "no-ssl2" ) ;
636- configure. arg ( "no-ssl3" ) ;
637-
638- let os = match & * target {
639- "aarch64-linux-android" => "linux-aarch64" ,
640- "aarch64-unknown-linux-gnu" => "linux-aarch64" ,
641- "aarch64-unknown-linux-musl" => "linux-aarch64" ,
642- "aarch64-unknown-netbsd" => "BSD-generic64" ,
643- "arm-linux-androideabi" => "android" ,
644- "arm-unknown-linux-gnueabi" => "linux-armv4" ,
645- "arm-unknown-linux-gnueabihf" => "linux-armv4" ,
646- "armv6-unknown-netbsd-eabihf" => "BSD-generic32" ,
647- "armv7-linux-androideabi" => "android-armv7" ,
648- "armv7-unknown-linux-gnueabihf" => "linux-armv4" ,
649- "armv7-unknown-netbsd-eabihf" => "BSD-generic32" ,
650- "i586-unknown-linux-gnu" => "linux-elf" ,
651- "i586-unknown-linux-musl" => "linux-elf" ,
652- "i686-apple-darwin" => "darwin-i386-cc" ,
653- "i686-linux-android" => "android-x86" ,
654- "i686-unknown-freebsd" => "BSD-x86-elf" ,
655- "i686-unknown-linux-gnu" => "linux-elf" ,
656- "i686-unknown-linux-musl" => "linux-elf" ,
657- "i686-unknown-netbsd" => "BSD-x86-elf" ,
658- "mips-unknown-linux-gnu" => "linux-mips32" ,
659- "mips64-unknown-linux-gnuabi64" => "linux64-mips64" ,
660- "mips64el-unknown-linux-gnuabi64" => "linux64-mips64" ,
661- "mipsel-unknown-linux-gnu" => "linux-mips32" ,
662- "powerpc-unknown-linux-gnu" => "linux-ppc" ,
663- "powerpc-unknown-linux-gnuspe" => "linux-ppc" ,
664- "powerpc-unknown-netbsd" => "BSD-generic32" ,
665- "powerpc64-unknown-linux-gnu" => "linux-ppc64" ,
666- "powerpc64le-unknown-linux-gnu" => "linux-ppc64le" ,
667- "powerpc64le-unknown-linux-musl" => "linux-ppc64le" ,
668- "s390x-unknown-linux-gnu" => "linux64-s390x" ,
669- "sparc-unknown-linux-gnu" => "linux-sparcv9" ,
670- "sparc64-unknown-linux-gnu" => "linux64-sparcv9" ,
671- "sparc64-unknown-netbsd" => "BSD-sparc64" ,
672- "x86_64-apple-darwin" => "darwin64-x86_64-cc" ,
673- "x86_64-linux-android" => "linux-x86_64" ,
674- "x86_64-unknown-freebsd" => "BSD-x86_64" ,
675- "x86_64-unknown-dragonfly" => "BSD-x86_64" ,
676- "x86_64-unknown-linux-gnu" => "linux-x86_64" ,
677- "x86_64-unknown-linux-gnux32" => "linux-x32" ,
678- "x86_64-unknown-linux-musl" => "linux-x86_64" ,
679- "x86_64-unknown-netbsd" => "BSD-x86_64" ,
680- _ => panic ! ( "don't know how to configure OpenSSL for {}" , target) ,
681- } ;
682- configure. arg ( os) ;
683- configure. env ( "CC" , builder. cc ( target) ) ;
684- for flag in builder. cflags ( target, GitRepo :: Rustc ) {
685- configure. arg ( flag) ;
686- }
687- // There is no specific os target for android aarch64 or x86_64,
688- // so we need to pass some extra cflags
689- if target == "aarch64-linux-android" || target == "x86_64-linux-android" {
690- configure. arg ( "-mandroid" ) ;
691- configure. arg ( "-fomit-frame-pointer" ) ;
692- }
693- if target == "sparc64-unknown-netbsd" {
694- // Need -m64 to get assembly generated correctly for sparc64.
695- configure. arg ( "-m64" ) ;
696- if builder. config . build . contains ( "netbsd" ) {
697- // Disable sparc64 asm on NetBSD builders, it uses
698- // m4(1)'s -B flag, which NetBSD m4 does not support.
699- configure. arg ( "no-asm" ) ;
700- }
701- }
702- // Make PIE binaries
703- // Non-PIE linker support was removed in Lollipop
704- // https://source.android.com/security/enhancements/enhancements50
705- if target == "i686-linux-android" {
706- configure. arg ( "no-asm" ) ;
707- }
708- configure. current_dir ( & obj) ;
709- builder. info ( & format ! ( "Configuring openssl for {}" , target) ) ;
710- builder. run_quiet ( & mut configure) ;
711- builder. info ( & format ! ( "Building openssl for {}" , target) ) ;
712- builder. run_quiet ( Command :: new ( "make" ) . arg ( "-j1" ) . current_dir ( & obj) ) ;
713- builder. info ( & format ! ( "Installing openssl for {}" , target) ) ;
714- builder. run_quiet ( Command :: new ( "make" ) . arg ( "install" ) . arg ( "-j1" ) . current_dir ( & obj) ) ;
715-
716- let mut f = t ! ( File :: create( & stamp) ) ;
717- t ! ( f. write_all( OPENSSL_VERS . as_bytes( ) ) ) ;
718- }
719- }
0 commit comments