From: Peter Rosin Date: Sun, 1 Aug 2010 06:38:05 +0000 (+0200) Subject: Add new auxiliary 'ar-lib' script, wrapping Microsoft lib. X-Git-Tag: v1.11.3~3^2~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9533d1f026a1ca8a3f77f64bc710f13cdaa1b410;p=platform%2Fupstream%2Fautomake.git Add new auxiliary 'ar-lib' script, wrapping Microsoft lib. * lib/ar-lib: New auxiliary script. * lib/Makefile.am: Add above. * tests/ar-lib.test: New test. * tests/Makefile.am: Add above. * automake.in (@common_files): Distribute the 'ar-lib' script. * doc/automake.texi (Auxiliary Programs): Mention the new 'ar-lib' script. (Optional): Mention 'ar-lib' in AC_CONFIG_AUX_DIR. * NEWS: Update. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index b280c89..8208906 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-08-06 Peter Rosin + + Add new auxiliary 'ar-lib' script, wrapping Microsoft lib. + * lib/ar-lib: New auxiliary script. + * lib/Makefile.am: Add above. + * tests/ar-lib.test: New test. + * tests/Makefile.am: Add above. + * automake.in (@common_files): Distribute the 'ar-lib' script. + * doc/automake.texi (Auxiliary Programs): Mention the new + 'ar-lib' script. + (Optional): Mention 'ar-lib' in AC_CONFIG_AUX_DIR. + * NEWS: Update. + 2010-08-07 Ralf Wildenhues Fix shell pattern negation in compile script. diff --git a/NEWS b/NEWS index 54fac91..6971bd7 100644 --- a/NEWS +++ b/NEWS @@ -6,7 +6,7 @@ New in 1.11.0a: is obsoleted by `xz' and `dist-xz' due to upstream changes. - The `compile' script now converts some options for MSVC for a better - user experience. + user experience. Similarly, the new `ar-lib' script wraps Microsoft lib. Bugs fixed in 1.11.0a: diff --git a/automake.in b/automake.in index 381202b..8fd6869 100755 --- a/automake.in +++ b/automake.in @@ -235,9 +235,9 @@ my @libtool_sometimes = qw(ltconfig ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh); my @common_files = (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO - ansi2knr.1 ansi2knr.c compile config.guess config.rpath config.sub - depcomp elisp-comp install-sh libversion.in mdate-sh missing - mkinstalldirs py-compile texinfo.tex ylwrap), + ansi2knr.1 ansi2knr.c ar-lib compile config.guess config.rpath + config.sub depcomp elisp-comp install-sh libversion.in mdate-sh + missing mkinstalldirs py-compile texinfo.tex ylwrap), @libtool_files, @libtool_sometimes); # Commonly used files we auto-include, but only sometimes. This list diff --git a/doc/automake.texi b/doc/automake.texi index 00e24eb..66c5a7e 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -2163,6 +2163,10 @@ copies are updated before each release, but we mention the original source in case you need more recent versions. @table @code +@item ar-lib +This is a wrapper primarily for the Microsoft lib archiver, to make +it more POSIX-like. + @item ansi2knr.c @itemx ansi2knr.1 These two files are used for de-ANSI-fication support (obsolete @@ -2840,12 +2844,12 @@ The Autoconf Manual}. Automake will look for various helper scripts, such as @file{install-sh}, in the directory named in this macro invocation. @c This list is accurate relative to version 1.8 -(The full list of scripts is: @file{config.guess}, @file{config.sub}, -@file{depcomp}, @file{elisp-comp}, @file{compile}, @file{install-sh}, -@file{ltmain.sh}, @file{mdate-sh}, @file{missing}, @file{mkinstalldirs}, -@file{py-compile}, @file{texinfo.tex}, and @file{ylwrap}.) Not all -scripts are always searched for; some scripts will only be sought if the -generated @file{Makefile.in} requires them. +(The full list of scripts is: @file{ar-lib}, @file{config.guess}, +@file{config.sub}, @file{depcomp}, @file{elisp-comp}, @file{compile}, +@file{install-sh}, @file{ltmain.sh}, @file{mdate-sh}, @file{missing}, +@file{mkinstalldirs}, @file{py-compile}, @file{texinfo.tex}, and +@file{ylwrap}.) Not all scripts are always searched for; some scripts +will only be sought if the generated @file{Makefile.in} requires them. If @code{AC_CONFIG_AUX_DIR} is not given, the scripts are looked for in their standard locations. For @file{mdate-sh}, diff --git a/lib/Makefile.am b/lib/Makefile.am index 627368d..5bdc02e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -2,7 +2,8 @@ ## Makefile for Automake lib. -# Copyright (C) 2001, 2003, 2004, 2009 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2004, 2009, 2010 Free Software Foundation, +# Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,7 +29,7 @@ dist_pkgvdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \ scriptdir = $(pkgvdatadir) dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \ mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile \ - symlink-tree + symlink-tree ar-lib EXTRA_DIST = gnupload diff --git a/lib/Makefile.in b/lib/Makefile.in index f90b085..9307cab 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -15,7 +15,8 @@ @SET_MAKE@ -# Copyright (C) 2001, 2003, 2004, 2009 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2004, 2009, 2010 Free Software Foundation, +# Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -51,8 +52,8 @@ build_triplet = @build@ subdir = lib DIST_COMMON = $(dist_pkgvdata_DATA) $(dist_script_DATA) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING INSTALL \ - ansi2knr.1 ansi2knr.c compile config.guess config.sub depcomp \ - elisp-comp install-sh mdate-sh missing mkinstalldirs \ + ansi2knr.1 ansi2knr.c ar-lib compile config.guess config.sub \ + depcomp elisp-comp install-sh mdate-sh missing mkinstalldirs \ py-compile texinfo.tex ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \ @@ -231,7 +232,7 @@ dist_pkgvdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \ scriptdir = $(pkgvdatadir) dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \ mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile \ - symlink-tree + symlink-tree ar-lib EXTRA_DIST = gnupload all: all-recursive diff --git a/lib/ar-lib b/lib/ar-lib new file mode 100755 index 0000000..aa4acbd --- /dev/null +++ b/lib/ar-lib @@ -0,0 +1,245 @@ +#! /bin/sh +# Wrapper for Microsoft lib.exe + +me=ar-lib +scriptversion=2010-08-08.07; # UTC + +# Copyright (C) 2010 Free Software +# Foundation, Inc. +# Written by Peter Rosin . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + + +# func_error message +func_error () +{ + echo "$me: $1" 1>&2 + exit 1 +} + +file_conv= + +# func_file_conv build_file +# Convert a $build file to $host form and store it in $file +# Currently only supports Win32 hosts. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv in + mingw) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_at_file at_file operation archive +# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE +# for each of them. +# When interpreting the content of the @FILE, do NOT use func_file_conv, +# since the user would need to supply preconverted file names to +# binutils ar, at least for MinGW. +func_at_file () +{ + operation=$2 + archive=$3 + at_file_contents=`cat "$1"` + eval set x "$at_file_contents" + shift + + for member + do + $AR -NOLOGO $operation:"$member" "$archive" || exit $? + done +} + +case $1 in + '') + func_error "no command. Try \`$0 --help' for more information." + ;; + -h | --h*) + cat <. + +# Make sure `ar-lib' wraps the Microsoft Library Manager (lib) correctly + +. ./defs || Exit 1 + +set -e + +cp "$testsrcdir/../lib/ar-lib" . +# Use a dummy lib, since lib isn't readily available on all systems +cat >lib <<'END' +#! /bin/sh +if test x"$2" = x-LIST -a $3 = fake.lib; then + echo fake.obj +else + echo "lib $@" +fi +END + +chmod +x ./lib + +# Check if ar-lib can create an archive with "cr" +opts=`./ar-lib ./lib cr foo.lib foo.obj` +test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.obj" + +# Check if ar-lib can update an existing archive with "r" +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 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" + +# Check if ar-lib can delete a member from an archive with "d" +opts=`./ar-lib ./lib d foo.lib foo.obj` +test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib" + +# Check if ar-lib can delete members in an @FILE +echo foo.obj > foolist +opts=`./ar-lib ./lib d foo.lib @foolist` +test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib" + +# Check if ar-lib can list archive members with "t" +opts=`./ar-lib ./lib t 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` +test x"$opts" = x"lib -NOLOGO -EXTRACT:fake.obj fake.lib" + +# Check if ar-lib can extract specified archive members with "x" +opts=`./ar-lib ./lib x foo.lib foo.obj` +test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib" + +# Check if ar-lib can extract members in an @FILE +opts=`./ar-lib ./lib x foo.lib @foolist` +test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib" + +: