adam@1760: #! /bin/sh adam@1760: # Wrapper for Microsoft lib.exe adam@1760: adam@1760: me=ar-lib adam@1760: scriptversion=2012-01-30.22; # UTC adam@1760: adam@1760: # Copyright (C) 2010, 2012 Free Software Foundation, Inc. adam@1760: # Written by Peter Rosin . adam@1760: # adam@1760: # This program is free software; you can redistribute it and/or modify adam@1760: # it under the terms of the GNU General Public License as published by adam@1760: # the Free Software Foundation; either version 2, or (at your option) adam@1760: # any later version. adam@1760: # adam@1760: # This program is distributed in the hope that it will be useful, adam@1760: # but WITHOUT ANY WARRANTY; without even the implied warranty of adam@1760: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the adam@1760: # GNU General Public License for more details. adam@1760: # adam@1760: # You should have received a copy of the GNU General Public License adam@1760: # along with this program. If not, see . adam@1760: adam@1760: # As a special exception to the GNU General Public License, if you adam@1760: # distribute this file as part of a program that contains a adam@1760: # configuration script generated by Autoconf, you may include it under adam@1760: # the same distribution terms that you use for the rest of that program. adam@1760: adam@1760: # This file is maintained in Automake, please report adam@1760: # bugs to or send patches to adam@1760: # . adam@1760: adam@1760: adam@1760: # func_error message adam@1760: func_error () adam@1760: { adam@1760: echo "$me: $1" 1>&2 adam@1760: exit 1 adam@1760: } adam@1760: adam@1760: file_conv= adam@1760: adam@1760: # func_file_conv build_file adam@1760: # Convert a $build file to $host form and store it in $file adam@1760: # Currently only supports Windows hosts. adam@1760: func_file_conv () adam@1760: { adam@1760: file=$1 adam@1760: case $file in adam@1760: / | /[!/]*) # absolute file, and not a UNC file adam@1760: if test -z "$file_conv"; then adam@1760: # lazily determine how to convert abs files adam@1760: case `uname -s` in adam@1760: MINGW*) adam@1760: file_conv=mingw adam@1760: ;; adam@1760: CYGWIN*) adam@1760: file_conv=cygwin adam@1760: ;; adam@1760: *) adam@1760: file_conv=wine adam@1760: ;; adam@1760: esac adam@1760: fi adam@1760: case $file_conv in adam@1760: mingw) adam@1760: file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` adam@1760: ;; adam@1760: cygwin) adam@1760: file=`cygpath -m "$file" || echo "$file"` adam@1760: ;; adam@1760: wine) adam@1760: file=`winepath -w "$file" || echo "$file"` adam@1760: ;; adam@1760: esac adam@1760: ;; adam@1760: esac adam@1760: } adam@1760: adam@1760: # func_at_file at_file operation archive adam@1760: # Iterate over all members in AT_FILE performing OPERATION on ARCHIVE adam@1760: # for each of them. adam@1760: # When interpreting the content of the @FILE, do NOT use func_file_conv, adam@1760: # since the user would need to supply preconverted file names to adam@1760: # binutils ar, at least for MinGW. adam@1760: func_at_file () adam@1760: { adam@1760: operation=$2 adam@1760: archive=$3 adam@1760: at_file_contents=`cat "$1"` adam@1760: eval set x "$at_file_contents" adam@1760: shift adam@1760: adam@1760: for member adam@1760: do adam@1760: $AR -NOLOGO $operation:"$member" "$archive" || exit $? adam@1760: done adam@1760: } adam@1760: adam@1760: case $1 in adam@1760: '') adam@1760: func_error "no command. Try '$0 --help' for more information." adam@1760: ;; adam@1760: -h | --h*) adam@1760: cat <