@@ -17,7 +17,7 @@ use std::collections::{HashMap, HashSet};
17
17
use std:: env;
18
18
use std:: fs:: File ;
19
19
use std:: io:: prelude:: * ;
20
- use std:: path:: PathBuf ;
20
+ use std:: path:: { Path , PathBuf } ;
21
21
use std:: process;
22
22
use std:: cmp;
23
23
@@ -126,7 +126,6 @@ pub struct Config {
126
126
pub docdir : Option < PathBuf > ,
127
127
pub bindir : Option < PathBuf > ,
128
128
pub libdir : Option < PathBuf > ,
129
- pub libdir_relative : Option < PathBuf > ,
130
129
pub mandir : Option < PathBuf > ,
131
130
pub codegen_tests : bool ,
132
131
pub nodejs : Option < PathBuf > ,
@@ -418,22 +417,6 @@ impl Config {
418
417
config. mandir = install. mandir . clone ( ) . map ( PathBuf :: from) ;
419
418
}
420
419
421
- // Try to infer `libdir_relative` from `libdir`.
422
- if let Some ( ref libdir) = config. libdir {
423
- let mut libdir = libdir. as_path ( ) ;
424
- if !libdir. is_relative ( ) {
425
- // Try to make it relative to the prefix.
426
- if let Some ( ref prefix) = config. prefix {
427
- if let Ok ( suffix) = libdir. strip_prefix ( prefix) {
428
- libdir = suffix;
429
- }
430
- }
431
- }
432
- if libdir. is_relative ( ) {
433
- config. libdir_relative = Some ( libdir. to_path_buf ( ) ) ;
434
- }
435
- }
436
-
437
420
// Store off these values as options because if they're not provided
438
421
// we'll infer default values for them later
439
422
let mut thinlto = None ;
@@ -581,6 +564,17 @@ impl Config {
581
564
config
582
565
}
583
566
567
+ /// Try to find the relative path of `libdir`.
568
+ pub fn libdir_relative ( & self ) -> Option < & Path > {
569
+ let libdir = self . libdir . as_ref ( ) ?;
570
+ if libdir. is_relative ( ) {
571
+ Some ( libdir)
572
+ } else {
573
+ // Try to make it relative to the prefix.
574
+ libdir. strip_prefix ( self . prefix . as_ref ( ) ?) . ok ( )
575
+ }
576
+ }
577
+
584
578
pub fn verbose ( & self ) -> bool {
585
579
self . verbose > 0
586
580
}
0 commit comments