Skip to content

Commit b5a8618

Browse files
committed
1 parent 963eb19 commit b5a8618

4 files changed

+347
-37
lines changed

recipe/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export PKG_CONFIG_ALLOW_CROSS=1
77
# https://github.com/rust-lang/cargo/issues/10583#issuecomment-1129997984
88
export CARGO_NET_GIT_FETCH_WITH_CLI=true
99

10-
if [ $(uname) = Darwin ] ; then
11-
export CXXFLAGS="-arch $OSX_ARCH -stdlib=libc++ -std=c++11"
10+
if [ $(uname) = Darwin ]; then
11+
export CXXFLAGS="-arch $OSX_ARCH -stdlib=libc++ -std=c++17"
1212
export RUSTFLAGS="-C link-args=-Wl,-rpath,$PREFIX/lib"
1313

1414
if [[ "${CONDA_BUILD_CROSS_COMPILATION}" != "1" ]]; then

recipe/meta.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ source:
1313
url: https://crates.io/api/v1/crates/{{ name }}/{{ version }}/download
1414
sha256: {{ sha256 }}
1515
patches:
16+
- pr-1202-fix-use-cxx-17.patch
1617
- winzip.patch # [win]
17-
- time-0.3.37-type-annotations.patch
1818

1919
build:
2020
number: 1
@@ -32,6 +32,7 @@ requirements:
3232
- harfbuzz # [build_platform != target_platform]
3333

3434
host:
35+
- expat # [not osx]
3536
- fontconfig # [not osx]
3637
- freetype
3738
- glib # development files needed by harfbuzz

recipe/pr-1202-fix-use-cxx-17.patch

+343
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,343 @@
1+
diff --git a/Cargo.lock b/Cargo.lock
2+
index db797783..490846c4 100644
3+
--- a/Cargo.lock
4+
+++ b/Cargo.lock
5+
@@ -2359,6 +2359,7 @@ dependencies = [
6+
"tectonic_xetex_layout",
7+
"tempfile",
8+
"termcolor",
9+
+ "time",
10+
"tokio",
11+
"toml",
12+
"url",
13+
@@ -2682,9 +2683,9 @@ dependencies = [
14+
15+
[[package]]
16+
name = "time"
17+
-version = "0.3.34"
18+
+version = "0.3.36"
19+
source = "registry+https://github.com/rust-lang/crates.io-index"
20+
-checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
21+
+checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
22+
dependencies = [
23+
"deranged",
24+
"itoa",
25+
@@ -2705,9 +2706,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
26+
27+
[[package]]
28+
name = "time-macros"
29+
-version = "0.2.17"
30+
+version = "0.2.18"
31+
source = "registry+https://github.com/rust-lang/crates.io-index"
32+
-checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
33+
+checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
34+
dependencies = [
35+
"num-conv",
36+
"time-core",
37+
diff --git a/Cargo.toml b/Cargo.toml
38+
index 2bfb0c11..8f136eb7 100644
39+
--- a/Cargo.toml
40+
+++ b/Cargo.toml
41+
@@ -27,6 +27,9 @@ license = "MIT"
42+
edition = "2018"
43+
exclude = ["/dist/", "/reference_sources/"]
44+
45+
+[lints.rust]
46+
+unexpected_cfgs = { level = "warn", check-cfg = ['cfg(backtrace)'] }
47+
+
48+
[badges]
49+
travis-ci = { repository = "tectonic-typesetting/tectonic" }
50+
codecov = { repository = "tectonic-typesetting/tectonic", service = "github" }
51+
@@ -75,19 +78,19 @@ quick-xml = "^0.28"
52+
serde = { version = "^1.0", features = ["derive"], optional = true }
53+
sha2 = "^0.10"
54+
structopt = "0.3"
55+
-tectonic_bridge_core = { path = "crates/bridge_core", version =">=0.4.0,<1"}
56+
-tectonic_bundles = { path = "crates/bundles", version =">=0.3.0,<1", default-features = false }
57+
-tectonic_docmodel = { path = "crates/docmodel", version =">=0.2.0,<1", optional = true }
58+
-tectonic_engine_bibtex = { path = "crates/engine_bibtex", version =">=0.1.0,<1"}
59+
-tectonic_engine_spx2html = { path = "crates/engine_spx2html", version =">=0.3.0,<1"}
60+
-tectonic_engine_xdvipdfmx = { path = "crates/engine_xdvipdfmx", version =">=0.3.0,<1"}
61+
-tectonic_engine_xetex = { path = "crates/engine_xetex", version =">=0.4.0,<1"}
62+
-tectonic_errors = { path = "crates/errors", version =">=0.1.0,<1"}
63+
-tectonic_geturl = { path = "crates/geturl", version =">=0.3.0,<1", default-features = false }
64+
-tectonic_io_base = { path = "crates/io_base", version =">=0.3.0,<1"}
65+
-tectonic_status_base = { path = "crates/status_base", version =">=0.1.0,<1"}
66+
-tectonic_xdv = { path = "crates/xdv", version =">=0.1.9,<1"}
67+
-tectonic_xetex_layout = { path = "crates/xetex_layout", version =">=0.1.0,<1"}
68+
+tectonic_bridge_core = { path = "crates/bridge_core", version = ">=0.4.0,<1" }
69+
+tectonic_bundles = { path = "crates/bundles", version = ">=0.3.0,<1", default-features = false }
70+
+tectonic_docmodel = { path = "crates/docmodel", version = ">=0.2.0,<1", optional = true }
71+
+tectonic_engine_bibtex = { path = "crates/engine_bibtex", version = ">=0.1.0,<1" }
72+
+tectonic_engine_spx2html = { path = "crates/engine_spx2html", version = ">=0.3.0,<1" }
73+
+tectonic_engine_xdvipdfmx = { path = "crates/engine_xdvipdfmx", version = ">=0.3.0,<1" }
74+
+tectonic_engine_xetex = { path = "crates/engine_xetex", version = ">=0.4.0,<1" }
75+
+tectonic_errors = { path = "crates/errors", version = ">=0.1.0,<1" }
76+
+tectonic_geturl = { path = "crates/geturl", version = ">=0.3.0,<1", default-features = false }
77+
+tectonic_io_base = { path = "crates/io_base", version = ">=0.3.0,<1" }
78+
+tectonic_status_base = { path = "crates/status_base", version = ">=0.1.0,<1" }
79+
+tectonic_xdv = { path = "crates/xdv", version = ">=0.1.9,<1" }
80+
+tectonic_xetex_layout = { path = "crates/xetex_layout", version = ">=0.1.0,<1" }
81+
tempfile = "^3.1"
82+
termcolor = "^1.1"
83+
tokio = "^1.0"
84+
@@ -97,6 +100,7 @@ watchexec = "^2.3.0"
85+
watchexec-filterer-globset = "1.2"
86+
watchexec-signals = "1.0"
87+
zip = { version = "^0.6", default-features = false, features = ["deflate"] }
88+
+time = "0.3.36"
89+
90+
[features]
91+
default = ["geturl-reqwest", "serialization"]
92+
diff --git a/crates/bundles/src/cache.rs b/crates/bundles/src/cache.rs
93+
index 0c481b0d..4b363d84 100644
94+
--- a/crates/bundles/src/cache.rs
95+
+++ b/crates/bundles/src/cache.rs
96+
@@ -460,7 +460,7 @@ impl<CB: CacheBackend> CachingBundle<CB> {
97+
// If a filename contains newline characters, it will mess up our
98+
// line-based manifest format. Be paranoid and refuse to record such
99+
// filenames.
100+
- if !name.contains(|c| c == '\n' || c == '\r') {
101+
+ if !name.contains(['\n', '\r']) {
102+
writeln!(man, "{name} {length} {digest_text}")?;
103+
}
104+
105+
@@ -515,9 +515,7 @@ impl<CB: CacheBackend> CachingBundle<CB> {
106+
// giving incorrect results if we pulled files out of the cache
107+
// before this invocation. Rewrite the digest file so that next time
108+
// we'll start afresh, then bail.
109+
- file_create_write(&self.digest_path, |f| {
110+
- writeln!(f, "{}", pull_data.digest.to_string())
111+
- })?;
112+
+ file_create_write(&self.digest_path, |f| writeln!(f, "{}", pull_data.digest))?;
113+
bail!("backend digest changed; rerun tectonic to use updated information");
114+
}
115+
116+
diff --git a/crates/docmodel/src/document.rs b/crates/docmodel/src/document.rs
117+
index b91b95a1..16dc4038 100644
118+
--- a/crates/docmodel/src/document.rs
119+
+++ b/crates/docmodel/src/document.rs
120+
@@ -270,7 +270,7 @@ impl Document {
121+
tried_src_path = true;
122+
123+
if let Some(s) = t.to_str() {
124+
- name = s.to_owned();
125+
+ s.clone_into(&mut name);
126+
}
127+
}
128+
129+
@@ -280,7 +280,7 @@ impl Document {
130+
131+
if let Some(Component::Normal(t)) = full_path.components().next_back() {
132+
if let Some(s) = t.to_str() {
133+
- name = s.to_owned();
134+
+ s.clone_into(&mut name);
135+
}
136+
}
137+
}
138+
diff --git a/crates/engine_spx2html/src/assets.rs b/crates/engine_spx2html/src/assets.rs
139+
index edd08ed6..21f73a74 100644
140+
--- a/crates/engine_spx2html/src/assets.rs
141+
+++ b/crates/engine_spx2html/src/assets.rs
142+
@@ -179,7 +179,7 @@ pub(crate) fn create_output_path(
143+
144+
for piece in dest_path.split('/') {
145+
if let Some(out_path) = out_path.as_mut() {
146+
- match std::fs::create_dir(&out_path) {
147+
+ match std::fs::create_dir(out_path.as_path()) {
148+
Ok(_) => {}
149+
Err(e) if e.kind() == std::io::ErrorKind::AlreadyExists => {}
150+
Err(e) => {
151+
diff --git a/crates/engine_spx2html/src/fontfile.rs b/crates/engine_spx2html/src/fontfile.rs
152+
index 8455f06b..65289b10 100644
153+
--- a/crates/engine_spx2html/src/fontfile.rs
154+
+++ b/crates/engine_spx2html/src/fontfile.rs
155+
@@ -426,9 +426,10 @@ impl FontFileData {
156+
157+
if let Some(out_path) = out_path.as_mut() {
158+
out_path.push(rel_path);
159+
+ let display_path = out_path.clone();
160+
atry!(
161+
- std::fs::write(&out_path, &self.buffer);
162+
- ["cannot write output file `{}`", out_path.display()]
163+
+ std::fs::write(out_path, &self.buffer);
164+
+ ["cannot write output file `{}`", display_path.display()]
165+
);
166+
}
167+
168+
@@ -490,9 +491,10 @@ impl FontFileData {
169+
170+
out_path.pop();
171+
out_path.push(&varname);
172+
+ let display_path = out_path.clone();
173+
atry!(
174+
- std::fs::write(&out_path, &buffer);
175+
- ["cannot write output file `{}`", out_path.display()]
176+
+ std::fs::write(out_path, &buffer);
177+
+ ["cannot write output file `{}`", display_path.display()]
178+
);
179+
}
180+
181+
diff --git a/crates/engine_spx2html/src/fonts.rs b/crates/engine_spx2html/src/fonts.rs
182+
index a826700b..e57c383c 100644
183+
--- a/crates/engine_spx2html/src/fonts.rs
184+
+++ b/crates/engine_spx2html/src/fonts.rs
185+
@@ -197,13 +197,13 @@ impl FontEnsemble {
186+
// Update the info records for the relevant fonts to capture the
187+
// established relationship.
188+
189+
- self.font_files[regular].family_name = name.clone();
190+
+ self.font_files[regular].family_name.clone_from(&name);
191+
self.font_files[regular].family_relation = FamilyRelativeFontId::Regular;
192+
- self.font_files[bold].family_name = name.clone();
193+
+ self.font_files[bold].family_name.clone_from(&name);
194+
self.font_files[bold].family_relation = FamilyRelativeFontId::Bold;
195+
- self.font_files[italic].family_name = name.clone();
196+
+ self.font_files[italic].family_name.clone_from(&name);
197+
self.font_files[italic].family_relation = FamilyRelativeFontId::Italic;
198+
- self.font_files[bold_italic].family_name = name.clone();
199+
+ self.font_files[bold_italic].family_name.clone_from(&name);
200+
self.font_files[bold_italic].family_relation = FamilyRelativeFontId::BoldItalic;
201+
202+
self.font_families.insert(
203+
diff --git a/crates/engine_spx2html/src/initialization.rs b/crates/engine_spx2html/src/initialization.rs
204+
index 1ec38ce3..f56508ff 100644
205+
--- a/crates/engine_spx2html/src/initialization.rs
206+
+++ b/crates/engine_spx2html/src/initialization.rs
207+
@@ -167,12 +167,12 @@ impl InitializationState {
208+
}
209+
210+
fn handle_set_template(&mut self, texpath: &str, _common: &mut Common) -> Result<()> {
211+
- self.next_template_path = texpath.to_owned();
212+
+ texpath.clone_into(&mut self.next_template_path);
213+
Ok(())
214+
}
215+
216+
fn handle_set_output_path(&mut self, texpath: &str, _common: &mut Common) -> Result<()> {
217+
- self.next_output_path = texpath.to_owned();
218+
+ texpath.clone_into(&mut self.next_output_path);
219+
Ok(())
220+
}
221+
222+
diff --git a/crates/engine_xetex/build.rs b/crates/engine_xetex/build.rs
223+
index 992b3511..a34282b4 100644
224+
--- a/crates/engine_xetex/build.rs
225+
+++ b/crates/engine_xetex/build.rs
226+
@@ -25,6 +25,7 @@ fn main() {
227+
let profile_target_requires_frame_pointer: bool =
228+
target_cfg!(not(all(target_os = "linux", target_arch = "x86_64")));
229+
230+
+ #[allow(unexpected_cfgs)]
231+
const PROFILE_BUILD_ENABLED: bool = cfg!(feature = "profile");
232+
233+
let profile_config = |cfg: &mut cc::Build| {
234+
diff --git a/crates/io_base/src/digest.rs b/crates/io_base/src/digest.rs
235+
index c0928dca..77672a6f 100644
236+
--- a/crates/io_base/src/digest.rs
237+
+++ b/crates/io_base/src/digest.rs
238+
@@ -4,7 +4,7 @@
239+
//! Helpers to tidy up the computation of digests in various places.
240+
241+
use std::{
242+
- fs,
243+
+ fmt, fs,
244+
path::{Path, PathBuf},
245+
str::FromStr,
246+
string::ToString,
247+
@@ -104,9 +104,9 @@ impl DigestData {
248+
}
249+
}
250+
251+
-impl ToString for DigestData {
252+
- fn to_string(&self) -> String {
253+
- bytes_to_hex(&self.0)
254+
+impl fmt::Display for DigestData {
255+
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
256+
+ write!(f, "{}", bytes_to_hex(&self.0))
257+
}
258+
}
259+
260+
diff --git a/crates/xdv/src/lib.rs b/crates/xdv/src/lib.rs
261+
index 4acfb526..1c0f2882 100644
262+
--- a/crates/xdv/src/lib.rs
263+
+++ b/crates/xdv/src/lib.rs
264+
@@ -1229,7 +1229,7 @@ impl<'a, T: XdvEvents> Cursor<'a, T> {
265+
return Err(InternalError::NeedMoreData);
266+
}
267+
268+
- let rv = unsafe { mem::transmute(self.buf[0]) };
269+
+ let rv = unsafe { mem::transmute::<u8, i8>(self.buf[0]) };
270+
self.buf = &self.buf[1..];
271+
self.offset += 1;
272+
Ok(rv)
273+
diff --git a/crates/xetex_layout/build.rs b/crates/xetex_layout/build.rs
274+
index bdd0d03f..558fd29e 100644
275+
--- a/crates/xetex_layout/build.rs
276+
+++ b/crates/xetex_layout/build.rs
277+
@@ -86,7 +86,7 @@ fn main() {
278+
let mut cppcfg = cc::Build::new();
279+
280+
let cppflags = [
281+
- "-std=c++14",
282+
+ "-std=c++17",
283+
"-Wall",
284+
"-Wdate-time",
285+
"-Wendif-labels",
286+
diff --git a/src/driver.rs b/src/driver.rs
287+
index 504acd28..b9041c16 100644
288+
--- a/src/driver.rs
289+
+++ b/src/driver.rs
290+
@@ -1132,7 +1132,7 @@ impl ProcessingSessionBuilder {
291+
}
292+
};
293+
294+
- filesystem_root = parent.clone();
295+
+ filesystem_root.clone_from(&parent);
296+
let pio: Box<dyn IoProvider> = Box::new(FilesystemPrimaryInputIo::new(&p));
297+
(pio, Some(p), parent)
298+
}
299+
diff --git a/src/io/format_cache.rs b/src/io/format_cache.rs
300+
index dbb4e182..2b02fe1f 100644
301+
--- a/src/io/format_cache.rs
302+
+++ b/src/io/format_cache.rs
303+
@@ -55,7 +55,7 @@ impl FormatCache {
304+
let mut p = self.formats_base.clone();
305+
p.push(format!(
306+
"{}-{}-{}.fmt",
307+
- self.bundle_digest.to_string(),
308+
+ self.bundle_digest,
309+
stem,
310+
crate::FORMAT_SERIAL
311+
));
312+
diff --git a/tests/formats.rs b/tests/formats.rs
313+
index 75682ccb..d55d1793 100644
314+
--- a/tests/formats.rs
315+
+++ b/tests/formats.rs
316+
@@ -177,12 +177,8 @@ fn test_format_generation(texname: &str, fmtname: &str, sha256: &str) {
317+
let observed = info.write_digest.unwrap();
318+
319+
if observed != want_digest {
320+
- println!(
321+
- "expected {} to have SHA256 = {}",
322+
- fmtname,
323+
- want_digest.to_string()
324+
- );
325+
- println!("instead, got {}", observed.to_string());
326+
+ println!("expected {} to have SHA256 = {}", fmtname, want_digest);
327+
+ println!("instead, got {}", observed);
328+
panic!();
329+
}
330+
}
331+
diff --git a/tests/util/mod.rs b/tests/util/mod.rs
332+
index 711a27e0..eb64bfd0 100644
333+
--- a/tests/util/mod.rs
334+
+++ b/tests/util/mod.rs
335+
@@ -169,7 +169,7 @@ impl<'a> ExpectedFile<'a> {
336+
pbase.set_extension(extension);
337+
let name = pbase.file_name().unwrap().to_str().unwrap().to_owned();
338+
339+
- let mut dec = GzDecoder::new(File::open(&pbase).unwrap());
340+
+ let mut dec = GzDecoder::new(File::open(pbase.as_path()).unwrap());
341+
let mut contents = Vec::new();
342+
dec.read_to_end(&mut contents).unwrap();
343+

0 commit comments

Comments
 (0)