mk-dlls.sh.in 4.4 KB

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