Skip to content

Commit 3ba4cec

Browse files
committed
Bump ar_archive_writer to a recent release
This commit updates the ar_archive_writer dependency to not use an old version but instead the recent 0.5.x release.
1 parent bc775cf commit 3ba4cec

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

psm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ readme = "README.mkd"
1414
[dependencies]
1515

1616
[build-dependencies]
17-
ar_archive_writer = "0.2.0"
17+
ar_archive_writer = "0.5.0"
1818
cc = "1.2.33"

psm/build.rs

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ fn find_assembly(
2424
Some(("src/arch/x86_64_windows_gnu.s", false))
2525
}
2626
}
27-
("x86_64", _, "cygwin", _) => {
28-
Some(("src/arch/x86_64_windows_gnu.s", false))
29-
}
27+
("x86_64", _, "cygwin", _) => Some(("src/arch/x86_64_windows_gnu.s", false)),
3028
("arm", _, "windows", "msvc") => Some(("src/arch/arm_armasm.asm", false)),
3129
("arm64ec", _, "windows", "msvc") => Some(("src/arch/arm64ec_armasm.asm", false)),
3230
("aarch64", _, "windows", _) => {
@@ -111,10 +109,12 @@ fn main() {
111109
// directly to `ar` to assemble an archive. Otherwise we're actually
112110
// compiling the source assembly file.
113111
if asm.ends_with(".o") {
114-
use ar_archive_writer::{write_archive_to_stream, NewArchiveMember, ArchiveKind};
115-
use std::fs::{read, metadata};
116-
use std::path::PathBuf;
112+
use ar_archive_writer::{
113+
write_archive_to_stream, ArchiveKind, NewArchiveMember, ObjectReader,
114+
};
115+
use std::fs::{metadata, read};
117116
use std::io::Cursor;
117+
use std::path::PathBuf;
118118

119119
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR environment variable not set");
120120
let output_path = PathBuf::from(&out_dir).join("libpsm_s.a");
@@ -123,15 +123,21 @@ fn main() {
123123
let file_metadata = metadata(asm).expect("Failed to read file metadata");
124124

125125
// Extract file metadata
126-
let mtime = file_metadata.modified().ok()
126+
let mtime = file_metadata
127+
.modified()
128+
.ok()
127129
.and_then(|time| time.duration_since(std::time::UNIX_EPOCH).ok())
128130
.map(|duration| duration.as_secs())
129131
.unwrap_or(0);
130132

131133
#[cfg(unix)]
132134
let (uid, gid, perms) = {
133135
use std::os::unix::fs::MetadataExt;
134-
(file_metadata.uid(), file_metadata.gid(), file_metadata.mode())
136+
(
137+
file_metadata.uid(),
138+
file_metadata.gid(),
139+
file_metadata.mode(),
140+
)
135141
};
136142

137143
#[cfg(not(unix))]
@@ -140,7 +146,18 @@ fn main() {
140146
let filename = asm.rsplit('/').next().unwrap_or(asm);
141147
let member = NewArchiveMember {
142148
buf: Box::new(object_data),
143-
get_symbols: |_data: &[u8], _callback: &mut dyn FnMut(&[u8]) -> Result<(), std::io::Error>| Ok(true),
149+
object_reader:
150+
&ObjectReader {
151+
get_symbols: |_data: &[u8],
152+
_callback: &mut dyn FnMut(
153+
&[u8],
154+
)
155+
-> Result<(), std::io::Error>| Ok(true),
156+
get_xcoff_member_alignment: |_data| 0,
157+
is_64_bit_object_file: |_data| false,
158+
is_any_arm64_coff: |_data| false,
159+
is_ec_object_file: |_data| false,
160+
},
144161
member_name: filename.to_string(),
145162
mtime,
146163
uid,
@@ -157,15 +174,17 @@ fn main() {
157174
// it falls through to Gnu https://llvm.org/doxygen/Object_2Archive_8cpp_source.html
158175
ArchiveKind::Gnu,
159176
false,
160-
).expect("Failed to write archive");
177+
None,
178+
)
179+
.expect("Failed to write archive");
161180

162-
std::fs::write(&output_path, output_bytes.into_inner()).expect("Failed to write archive file");
181+
std::fs::write(&output_path, output_bytes.into_inner())
182+
.expect("Failed to write archive file");
163183

164184
println!("cargo:rustc-link-search=native={}", out_dir);
165185
println!("cargo:rustc-link-lib=static=psm_s");
166186
} else {
167187
cfg.file(asm);
168188
cfg.compile("libpsm_s.a");
169189
}
170-
171-
}
190+
}

0 commit comments

Comments
 (0)