summaryrefslogtreecommitdiff
path: root/core/src/xmake/binutils/extractlib.c
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-11 23:24:49 +0800
committerruki <[email protected]>2025-12-12 09:00:44 +0800
commit2821dc7bf3ccee9b725697836ac97b4036e6eb24 (patch)
tree17700668a597d29aaa4af6bf9141d5f593401d33 /core/src/xmake/binutils/extractlib.c
parentcec022212a4f04973d98534cb7c56767d2c656c5 (diff)
add mslib extract support
Diffstat (limited to 'core/src/xmake/binutils/extractlib.c')
-rw-r--r--core/src/xmake/binutils/extractlib.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/src/xmake/binutils/extractlib.c b/core/src/xmake/binutils/extractlib.c
index e1d76c28e..d5e8b3759 100644
--- a/core/src/xmake/binutils/extractlib.c
+++ b/core/src/xmake/binutils/extractlib.c
@@ -85,9 +85,18 @@ tb_int_t xm_binutils_extractlib(lua_State *lua) {
// extract based on format
if (format == XM_BINUTILS_FORMAT_AR) {
// AR archive format (.a or .lib in AR format)
- if (!xm_binutils_ar_extract(istream, outputdir)) {
- error_msg = "extract AR archive failed";
- break;
+ // if the file extension is .lib, we use the msvc lib extractor to support long paths and subdirectories
+ tb_size_t n = tb_strlen(libraryfile);
+ if (n > 4 && !tb_strnicmp(libraryfile + n - 4, ".lib", 4)) {
+ if (!xm_binutils_mslib_extract(istream, outputdir)) {
+ error_msg = "extract MSVC lib failed";
+ break;
+ }
+ } else {
+ if (!xm_binutils_ar_extract(istream, outputdir)) {
+ error_msg = "extract AR archive failed";
+ break;
+ }
}
ok = tb_true;
} else if (format == XM_BINUTILS_FORMAT_COFF) {