Skip to content

Update the docs for tests[n].package_contents.lib#2286

Open
multimeric wants to merge 1 commit intoprefix-dev:mainfrom
multimeric:test_lib_instructions
Open

Update the docs for tests[n].package_contents.lib#2286
multimeric wants to merge 1 commit intoprefix-dev:mainfrom
multimeric:test_lib_instructions

Conversation

@multimeric
Copy link

@multimeric multimeric commented Mar 9, 2026

The current instructions are slightly inaccurate. I've updated it based on reading this section:

Section::Lib => {
let raws = if exists {
self.lib.exists.include_globs()
} else {
self.lib.not_exists.include_globs()
};
if target_platform.is_windows() {
Self::match_files(raws, |raw| {
let mut res = Vec::new();
if raw.ends_with(".dll") {
res.push((
raw.to_string(),
GlobSet::builder()
.add(Glob::new(&format!("Library/bin/{raw}"))?)
.build()?,
));
} else if raw.ends_with(".lib") {
res.push((
raw.to_string(),
GlobSet::builder()
.add(Glob::new(&format!("Library/lib/{raw}"))?)
.build()?,
));
} else {
res.push((
raw.to_string(),
GlobSet::builder()
.add(Glob::new(&format!("Library/bin/{raw}.dll"))?)
.build()?,
));
res.push((
raw.to_string(),
GlobSet::builder()
.add(Glob::new(&format!("Library/lib/{raw}.lib"))?)
.build()?,
));
}
Ok(res)
})
} else {
Self::match_files(raws, |raw| {
let globset = if target_platform.is_osx() {
if raw.ends_with(".dylib") || raw.ends_with(".a") {
GlobSet::builder()
.add(Glob::new(&format!("lib/{raw}"))?)
.build()
} else {
GlobSet::builder()
.add(build_glob(format!("lib/{{,lib}}{raw}.dylib"))?)
.add(build_glob(format!("lib/{{,lib}}{raw}.*.dylib"))?)
.build()
}
} else {
if raw.ends_with(".so") || raw.contains(".so.") || raw.ends_with(".a") {
GlobSet::builder()
.add(Glob::new(&format!("lib/{raw}"))?)
.build()
} else {
GlobSet::builder()
.add(build_glob(format!("lib/{{,lib}}{raw}.so"))?)
.add(build_glob(format!("lib/{{,lib}}{raw}.so.*"))?)
.build()
}
}?;
Ok(vec![(raw.to_string(), globset)])
})
}
}

I think that further improvements might also be possible, but I didn't want to try anything further without discussion. Using comments in the example make it a bit hard to read as it doesn't wrap across lines. Also there is further subtlety which isn't captured in the examples, like the fact adding .dll to the end of the glob will turn off the automatic .lib glob etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant