]> ncurses.scripts.mit.edu Git - ncurses.git/blob - mk-dlls.sh
ncurses 5.7 - patch 20090718
[ncurses.git] / mk-dlls.sh
1 #!/bin/sh\r
2 # $Id: mk-dlls.sh,v 1.1 2008/11/18 08:50:04 juergen Exp $\r
3 ##############################################################################\r
4 # Copyright (c) 2008 Free Software Foundation, Inc.                          #\r
5 #                                                                            #\r
6 # Permission is hereby granted, free of charge, to any person obtaining a    #\r
7 # copy of this software and associated documentation files (the "Software"), #\r
8 # to deal in the Software without restriction, including without limitation  #\r
9 # the rights to use, copy, modify, merge, publish, distribute, distribute    #\r
10 # with modifications, sublicense, and/or sell copies of the Software, and to #\r
11 # permit persons to whom the Software is furnished to do so, subject to the  #\r
12 # following conditions:                                                      #\r
13 #                                                                            #\r
14 # The above copyright notice and this permission notice shall be included in #\r
15 # all copies or substantial portions of the Software.                        #\r
16 #                                                                            #\r
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #\r
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #\r
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #\r
20 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #\r
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #\r
22 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #\r
23 # DEALINGS IN THE SOFTWARE.                                                  #\r
24 #                                                                            #\r
25 # Except as contained in this notice, the name(s) of the above copyright     #\r
26 # holders shall not be used in advertising or otherwise to promote the sale, #\r
27 # use or other dealings in this Software without prior written               #\r
28 # authorization.                                                             #\r
29 ##############################################################################\r
30 #\r
31 # Author: Juergen Pfeifer\r
32 #\r
33 # Build DLLs on MinGW\r
34 #\r
35 gcc -v 2>&1 | grep specs | grep mingw\r
36 if [ $? -eq 1 ]; then\r
37   echo "$0 requires a mingw environment" >&2\r
38 else\r
39   if [ -d lib ]; then\r
40     cf="-shared"\r
41     lf="--enable-auto-import"\r
42     pushd lib 2>&1 >/dev/null\r
43       for t in "" "t"\r
44       do\r
45         for m in "" "_g"\r
46         do  \r
47           if [ -f libncurses${t}${m}.a ]; then\r
48             f=libncurses${t}${m}.a\r
49             g=`basename $f .a | cut -c 4-`\r
50             gi=libw${g}.a\r
51             td=tmp-${g}\r
52             rm -rf "${td}"\r
53             mkdir "${td}"\r
54             cd "${td}"\r
55               ar x ../${f} `ar t ../${f}`\r
56               gcc $cf -o w${g}.dll -Wl,--out-implib,${gi} -Wl,--output-def,w${g}.def -Wl,$lf `ar t ../$f`\r
57               lib //NOLOGO /MACHINE:i386 /DEF:w${g}.def\r
58               rm -f `ar t ../$f`\r
59               mv w${g}.dll ..\r
60               mv w${g}.lib ..\r
61               mv libw${g}.a ..\r
62             cd ..\r
63             rm -rf "${td}"\r
64 \r
65             for l in panel menu form\r
66             do\r
67               for f in lib${l}${t}${m}.a\r
68               do\r
69                 g=`basename $f .a | cut -c 4-`\r
70                 td=tmp-${g}\r
71                 rm -rf "${td}"\r
72                 mkdir "${td}"\r
73                 echo $g\r
74                 cd "${td}"\r
75                   ar x ../$f `ar t ../$f`\r
76                   gcc $cf -o w${g}.dll -Wl,--out-implib,libw${g}.a -Wl,--output-def,w${g}.def -Wl,$lf `ar t ../$f` ../${gi}\r
77                   lib //NOLOGO /MACHINE:i386 /DEF:w${g}.def\r
78                   rm -f `ar t ../$f`\r
79                   mv w${g}.dll ..\r
80                   mv w${g}.lib ..\r
81                   mv libw${g}.a ..\r
82                 cd ..  \r
83                 rm -rf "${td}"\r
84               done\r
85             done\r
86           fi\r
87         done\r
88       done\r
89     popd\r
90   else\r
91     echo lib has not been build >&2\r
92   fi\r
93 fi\r