File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,17 @@ fn main() {
7
7
// Re-export $TARGET during the build so that our executable tests know
8
8
// what environment variable CARGO_TARGET_@TARGET@_RUNNER to check when
9
9
// they want to spawn off executables.
10
-
11
10
let target = env:: var ( "TARGET" ) . unwrap ( ) ;
12
11
println ! ( "cargo:rustc-env=TARGET={target}" ) ;
12
+
13
+ // Set the default web bundle for tectonic to use.
14
+ // The `${web_bundle_prefix}` would lead to a url in the form of
15
+ // `${web_bundle_prefix}/default_bundle.tar`, while the "locked" url,
16
+ // if specified, can be used to pin the default bundle to a specific
17
+ // version. This would be useful for reproducible builds.
18
+ let web_bundle_prefix: String = env:: var ( "TECTONIC_WEB_BUNDLE_PREFIX" )
19
+ . unwrap_or ( "https://relay.fullyjustified.net" . to_owned ( ) ) ;
20
+ let web_bundle_locked: String = env:: var ( "TECTONIC_WEB_BUNDLE_LOCKED" ) . unwrap_or ( "" . to_owned ( ) ) ;
21
+ println ! ( "cargo:rustc-env=TECTONIC_WEB_BUNDLE_PREFIX={web_bundle_prefix}" ) ;
22
+ println ! ( "cargo:rustc-env=TECTONIC_WEB_BUNDLE_LOCKED={web_bundle_locked}" ) ;
13
23
}
Original file line number Diff line number Diff line change @@ -112,12 +112,22 @@ impl<B: Bundle + ?Sized> Bundle for Box<B> {
112
112
/// low-level reliability problems and was blocked in China. We now use a custom
113
113
/// webservice.
114
114
pub fn get_fallback_bundle_url ( format_version : u32 ) -> String {
115
+ // Build time environment variables declared in `build.rs`:
116
+ let web_bundle_locked = option_env ! ( "TECTONIC_WEB_BUNDLE_LOCKED" ) . unwrap_or ( "" ) ;
117
+ let web_bundle_prefix =
118
+ option_env ! ( "TECTONIC_WEB_BUNDLE_PREFIX" ) . unwrap_or ( "https://relay.fullyjustified.net" ) ;
119
+
120
+ // Simply return the locked url when it is specified:
121
+ if !web_bundle_locked. is_empty ( ) {
122
+ return web_bundle_locked. to_owned ( ) ;
123
+ }
124
+
115
125
// Format version 32 (TeXLive 2021) was when we introduced versioning to the
116
126
// URL.
117
127
if format_version < 32 {
118
- "https://relay.fullyjustified.net/ default_bundle.tar". to_owned ( )
128
+ format ! ( "{web_bundle_prefix}/ default_bundle.tar")
119
129
} else {
120
- format ! ( "https://relay.fullyjustified.net /default_bundle_v{format_version}.tar" )
130
+ format ! ( "{web_bundle_prefix} /default_bundle_v{format_version}.tar" )
121
131
}
122
132
}
123
133
You can’t perform that action at this time.
0 commit comments