Mercurial > mxe-octave
comparison src/build-msvctools/ar-msvc @ 3061:f8299bb6c872
Initial support for native MSVC compilation.
* add MSVC support files: compiler wrappers and support libraries
* adapt libiconv to work with MSVC
* adapt gettext to work with MSVC
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Mon, 17 Jun 2013 22:43:11 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3060:cbdf4575016d | 3061:f8299bb6c872 |
---|---|
1 #!/bin/sh | |
2 | |
3 # ar-msvc | |
4 # Wrapper around MS's lib.exe to make it act more like Unix ar. This | |
5 # software is largely inspired by cccl (http://cccl.sourceforge.net). | |
6 # | |
7 # Copyright (C) 2006 Michael Goffioul | |
8 # | |
9 # This program is free software; you can redistribute it and/or modify | |
10 # it under the terms of the GNU General Public License as published by | |
11 # the Free Software Foundation; either version 2 of the License, or | |
12 # (at your option) any later version. | |
13 # | |
14 # This program is distributed in the hope that it will be useful, but | |
15 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 # General Public License for more details. | |
18 # | |
19 # You should have received a copy of the GNU General Public License | |
20 # along with this program; if not, see <http://www.gnu.org/licenses/>. | |
21 # | |
22 | |
23 usage() | |
24 { | |
25 cat <<EOF | |
26 Usage: ar-msvc [OPTIONS] | |
27 | |
28 ar-msvc is a wrapper around Microsoft's lib.exe. It translates parameters | |
29 that Unix ar's understand to parameters that lib undertsand. | |
30 EOF | |
31 exit $1 | |
32 } | |
33 | |
34 cmd= | |
35 cmdopts= | |
36 archive_file= | |
37 files= | |
38 convert= | |
39 | |
40 case $1 in | |
41 --cygwin) | |
42 convert=cygwin | |
43 shift | |
44 ;; | |
45 esac | |
46 | |
47 cmd="$1" | |
48 shift | |
49 | |
50 cmd=`echo "$cmd" | sed 's/-\?-\?\(.*\)/\1/g'` | |
51 | |
52 case $cmd in | |
53 version) | |
54 cat <<EOF | |
55 ar-msvc 0.1 | |
56 | |
57 Copyright 2006 Michael Goffioul | |
58 This is free software; see the source for copying conditions. There is NO | |
59 waranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
60 EOF | |
61 exit 0 | |
62 ;; | |
63 help | h) | |
64 usage 0 | |
65 ;; | |
66 r* | cr*) | |
67 cmd=replace | |
68 ;; | |
69 t*) | |
70 cmd=list | |
71 ;; | |
72 x*) | |
73 cmd=extract | |
74 ;; | |
75 *) | |
76 echo "Unsupported command flag: $cmd" | |
77 exit 1 | |
78 ;; | |
79 esac | |
80 | |
81 while test $# -gt 0; do | |
82 if test "x$archive_file" == "x"; then | |
83 archive_file="$1" | |
84 # converts libxxx.a to xxx.lib | |
85 archive_file=`echo $archive_file | sed 's/\(.*\)lib\([^\.\/]*\)\.a/\1\2.lib/'` | |
86 else | |
87 files="$files $1" | |
88 fi | |
89 shift | |
90 done | |
91 | |
92 if test "x$convert" != "x"; then | |
93 case $convert in | |
94 cygwin) | |
95 archive_file=`cygpath -m $archive_file` | |
96 ;; | |
97 esac | |
98 fi | |
99 | |
100 if test "x$cmd" == "x"; then | |
101 usage 1 | |
102 fi | |
103 | |
104 case $cmd in | |
105 extract) | |
106 if test -z "$files"; then | |
107 files=`lib -nologo -list $archive_file` | |
108 fi | |
109 for f in $files; do | |
110 of=`echo $f | sed -e 's,.*[\\/],,'` | |
111 lib -nologo -extract:$f -out:$of $archive_file | |
112 done | |
113 ;; | |
114 list) | |
115 lib -list $archive_file | |
116 ;; | |
117 replace) | |
118 if test -f "$archive_file"; then | |
119 lib $archive_file $files | |
120 else | |
121 lib -out:$archive_file $files | |
122 fi | |
123 ;; | |
124 esac |