mingw.tcl 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #
  2. # Run this Tcl script to generate the crosscompile.html file.
  3. #
  4. set rcsid {$Id: mingw.tcl,v 1.3 2001/11/24 13:23:05 drh Exp $}
  5. puts {<html>
  6. <head>
  7. <title>Notes On How To Build MinGW As A Cross-Compiler</title>
  8. </head>
  9. <body bgcolor=white>
  10. <h1 align=center>
  11. Notes On How To Build MinGW As A Cross-Compiler
  12. </h1>}
  13. puts "<p align=center>
  14. (This page was last modified on [lrange $rcsid 3 4] UTC)
  15. </p>"
  16. puts {
  17. <p><a href="http://www.mingw.org/">MinGW</a> or
  18. <a href="http://www.mingw.org/">Minimalist GNU For Windows</a>
  19. is a version of the popular GCC compiler that builds Win95/Win98/WinNT
  20. binaries. See the website for details.</p>
  21. <p>This page describes how you can build MinGW
  22. from sources as a cross-compiler
  23. running under Linux. Doing so will allow you to construct
  24. WinNT binaries from the comfort and convenience of your
  25. Unix desktop.</p>
  26. }
  27. proc Link {path {file {}}} {
  28. if {$file!=""} {
  29. set path $path/$file
  30. } else {
  31. set file $path
  32. }
  33. puts "<a href=\"$path\">$file</a>"
  34. }
  35. puts {
  36. <p>Here are the steps:</p>
  37. <ol>
  38. <li>
  39. <p>Get a copy of source code. You will need the binutils, the
  40. compiler, and the MinGW runtime. Each are available separately.
  41. As of this writing, Mumit Khan has collected everything you need
  42. together in one FTP site:
  43. }
  44. set ftpsite \
  45. ftp://ftp.nanotech.wisc.edu/pub/khan/gnu-win32/mingw32/snapshots/gcc-2.95.2-1
  46. Link $ftpsite
  47. puts {
  48. The three files you will need are:</p>
  49. <ul>
  50. <li>}
  51. Link $ftpsite binutils-19990818-1-src.tar.gz
  52. puts </li><li>
  53. Link $ftpsite gcc-2.95.2-1-src.tar.gz
  54. puts </li><li>
  55. Link $ftpsite mingw-20000203.zip
  56. puts {</li>
  57. </ul>
  58. <p>Put all the downloads in a directory out of the way. The sequel
  59. will assume all downloads are in a directory named
  60. <b>~/mingw/download</b>.</p>
  61. </li>
  62. <li>
  63. <p>
  64. Create a directory in which to install the new compiler suite and make
  65. the new directory writable.
  66. Depending on what directory you choose, you might need to become
  67. root. The example shell commands that follow
  68. will assume the installation directory is
  69. <b>/opt/mingw</b> and that your user ID is <b>drh</b>.</p>
  70. <blockquote><pre>
  71. su
  72. mkdir /opt/mingw
  73. chown drh /opt/mingw
  74. exit
  75. </pre></blockquote>
  76. </li>
  77. <li>
  78. <p>Unpack the source tarballs into a separate directory.</p>
  79. <blockquote><pre>
  80. mkdir ~/mingw/src
  81. cd ~/mingw/src
  82. tar xzf ../download/binutils-*.tar.gz
  83. tar xzf ../download/gcc-*.tar.gz
  84. unzip ../download/mingw-*.zip
  85. </pre></blockquote>
  86. </li>
  87. <li>
  88. <p>Create a directory in which to put all the build products.</p>
  89. <blockquote><pre>
  90. mkdir ~/mingw/bld
  91. </pre></blockquote>
  92. </li>
  93. <li>
  94. <p>Configure and build binutils and add the results to your PATH.</p>
  95. <blockquote><pre>
  96. mkdir ~/mingw/bld/binutils
  97. cd ~/mingw/bld/binutils
  98. ../../src/binutils/configure --prefix=/opt/mingw --target=i386-mingw32 -v
  99. make 2&gt;&amp;1 | tee make.out
  100. make install 2&gt;&amp;1 | tee make-install.out
  101. export PATH=$PATH:/opt/mingw/bin
  102. </pre></blockquote>
  103. </li>
  104. <li>
  105. <p>Manually copy the runtime include files into the installation directory
  106. before trying to build the compiler.</p>
  107. <blockquote><pre>
  108. mkdir /opt/mingw/i386-mingw32/include
  109. cd ~/mingw/src/mingw-runtime*/mingw/include
  110. cp -r * /opt/mingw/i386-mingw32/include
  111. </pre></blockquote>
  112. </li>
  113. <li>
  114. <p>Configure and build the compiler</p>
  115. <blockquote><pre>
  116. mkdir ~/mingw/bld/gcc
  117. cd ~/mingw/bld/gcc
  118. ../../src/gcc-*/configure --prefix=/opt/mingw --target=i386-mingw32 -v
  119. cd gcc
  120. make installdirs
  121. cd ..
  122. make 2&gt;&amp;1 | tee make.out
  123. make install
  124. </pre></blockquote>
  125. </li>
  126. <li>
  127. <p>Configure and build the MinGW runtime</p>
  128. <blockquote><pre>
  129. mkdir ~/mingw/bld/runtime
  130. cd ~/mingw/bld/runtime
  131. ../../src/mingw-runtime*/configure --prefix=/opt/mingw --target=i386-mingw32 -v
  132. make install-target-w32api
  133. make install
  134. </pre></blockquote>
  135. </li>
  136. </ol>
  137. <p>And you are done...</p>
  138. }
  139. puts {
  140. <p><hr /></p>
  141. <p><a href="index.html"><img src="/goback.jpg" border=0 />
  142. Back to the SQLite Home Page</a>
  143. </p>
  144. </body></html>}