* lib/ar-lib: Implement the "q" (quick) action as a synonym for "r" (replace). Ignore "s" (symbol index) and "S" (no symbol index) when used as modifiers and "s" when used as a command, there is simply no way for Microsoft lib to not update the symbol table index in the archive. * tests/ar-lib.test: Check the added behavior. Also add checks for the recently added "u" (update) and "v" (verbose) modifiers. --- lib/ar-lib | 11 ++++++++--- tests/ar-lib.test | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-)
Hi! I tried building GNU MP with AR="/path/to/ar-lib lib" and found that ar-lib needed a few more bits. Ok for the msvc branch (and merges to master and branch-1.11)? Cheers, Peter diff --git a/lib/ar-lib b/lib/ar-lib index c698ac5..4fddb70 100755 --- a/lib/ar-lib +++ b/lib/ar-lib @@ -153,7 +153,9 @@ action=${action#-} delete= extract= list= +quick= replace= +index= create= while test -n "$action" @@ -162,7 +164,10 @@ do d*) delete=yes ;; x*) extract=yes ;; t*) list=yes ;; + q*) quick=yes ;; r*) replace=yes ;; + s*) index=yes ;; + S*) ;; # the index is always updated implicitly c*) create=yes ;; u*) ;; # TODO: don't ignore the update modifier v*) ;; # TODO: don't ignore the verbose modifier @@ -173,8 +178,8 @@ do action=${action#?} done -case $delete$extract$list$replace in - yes) +case $delete$extract$list$quick$replace,$index in + yes,* | ,yes) ;; yesyes*) func_error "more than one action specified" @@ -225,7 +230,7 @@ elif test -n "$extract"; then done fi -elif test -n "$replace"; then +elif test -n "$quick$replace"; then if test ! -f "$orig_archive"; then if test -z "$create"; then echo "$me: creating $orig_archive" diff --git a/tests/ar-lib.test b/tests/ar-lib.test index 0350645..1ddec64 100755 --- a/tests/ar-lib.test +++ b/tests/ar-lib.test @@ -45,6 +45,23 @@ touch foo.lib opts=`./ar-lib ./lib r foo.lib foo.obj` test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" +# Check if ar-lib can update an existing archive with "q". +opts=`./ar-lib ./lib q foo.lib foo.obj` +test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" + +# Check if ar-lib accepts "u" as a modifier. +# NOTE: "u" should have an effect, but currently doesn't. +opts=`./ar-lib ./lib ru foo.lib foo.obj` +test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" + +# Check if ar-lib accepts "s" as a modifier. +opts=`./ar-lib ./lib rs foo.lib foo.obj` +test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" + +# Check if ar-lib accepts "S" as a modifier. +opts=`./ar-lib ./lib rS foo.lib foo.obj` +test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" + # Check if ar-lib passes on @FILE with "r" opts=`./ar-lib ./lib r foo.lib @list` test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib @list" @@ -62,6 +79,11 @@ test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib" opts=`./ar-lib ./lib t foo.lib` test x"$opts" = x"lib -NOLOGO -LIST foo.lib" +# Check if ar-lib accepts "v" as a modifier. +# NOTE: "v" should have an effect, but currently doesn't. +opts=`./ar-lib ./lib tv foo.lib` +test x"$opts" = x"lib -NOLOGO -LIST foo.lib" + # Check if ar-lib can extract archive members with "x". touch fake.lib opts=`./ar-lib ./lib x fake.lib` @@ -84,4 +106,8 @@ touch fake2.lib opts=`./ar-lib ./lib x fake2.lib` test x"$opts" = x"lib -NOLOGO -EXTRACT:dir\\fake2.obj fake2.lib" +# Check if ar-lib accepts "s" as an action. +opts=`./ar-lib ./lib s foo.lib` +test x"$opts" = x + : -- 1.7.9