Hi! lib.exe is simply a wrapper around "link.exe -lib", this patch allows the latter form to also be wrapped by ar-lib.
While at it, the patch also allows some other options through to the wrapped archiver. I have quoted some of the output from "lib -?" below for your convenience (remember that '-' can be used instead of '/' as option specifier and that '/' isn't really supported when using ar-lib since it makes the option look like an absolute file name). Cheers, Peter $ lib -? Microsoft (R) Library Manager Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved. usage: LIB [options] [files] options: *snip* /LTCG /MACHINE:{ARM|EBC|IA64|MIPS|MIPS16|MIPSFPU|MIPSFPU16| SH4|THUMB|X64|X86} *snip* /SUBSYSTEM:{BOOT_APPLICATION|CONSOLE|EFI_APPLICATION| EFI_BOOT_SERVICE_DRIVER|EFI_ROM|EFI_RUNTIME_DRIVER| NATIVE|POSIX|WINDOWS|WINDOWSCE}[,#[.##]] /VERBOSE /WX[:NO]
>From 6545b496ad0868e9d7ffde4372e3b36049ceaf3c Mon Sep 17 00:00:00 2001 From: Peter Rosin <p...@lysator.liu.se> Date: Thu, 12 Aug 2010 16:24:11 +0200 Subject: [PATCH] Enable the use of "link -lib" as the wrapped archiver. * lib/ar-lib: Enable the use of "link -lib" as the wrapped archiver, as well as allowing some other options to be passed through to the wrapped archiver. * tests/ar-lib.test: Test the above. Signed-off-by: Peter Rosin <p...@lysator.liu.se> --- ChangeLog | 8 ++++++++ lib/ar-lib | 24 ++++++++++++++++++++++-- tests/ar-lib.test | 4 ++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8208906..2a1c514 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-08-12 Peter Rosin <p...@lysator.liu.se> + + Enable the use of "link -lib" as the wrapped archiver. + * lib/ar-lib: Enable the use of "link -lib" as the wrapped + archiver, as well as allowing some other options to be passed + through to the wrapped archiver. + * tests/ar-lib.test: Test the above. + 2010-08-06 Peter Rosin <p...@lysator.liu.se> Add new auxiliary 'ar-lib' script, wrapping Microsoft lib. diff --git a/lib/ar-lib b/lib/ar-lib index aa4acbd..7c472e7 100755 --- a/lib/ar-lib +++ b/lib/ar-lib @@ -121,8 +121,28 @@ fi AR=$1 shift -action=$1 -shift +while : +do + if test $# -lt 2; then + func_error "you must specify a program, an action and an archive" + fi + case $1 in + -lib | -LIB \ + | -ltcg | -LTCG \ + | -machine* | -MACHINE* \ + | -subsystem* | -SUBSYSTEM* \ + | -verbose | -VERBOSE \ + | -wx* | -WX* ) + AR="$AR $1" + shift + ;; + *) + action=$1 + shift + break + ;; + esac +done orig_archive=$1 shift func_file_conv "$orig_archive" diff --git a/tests/ar-lib.test b/tests/ar-lib.test index 85f8242..d418c21 100755 --- a/tests/ar-lib.test +++ b/tests/ar-lib.test @@ -72,4 +72,8 @@ test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib" opts=`./ar-lib ./lib x foo.lib @foolist` test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib" +# Check if ar-lib passes -lib and -LTCG through to the wrappee +opts=`./ar-lib ./lib -lib -LTCG x foo.lib foo.obj` +test x"$opts" = x"lib -lib -LTCG -NOLOGO -EXTRACT:foo.obj foo.lib" + : -- 1.6.4.2