Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
diana:windows:building:environment [2009-11-25 14:34:02] dages OBE |
diana:windows:building:environment [2022-05-31 09:29:31] (current) |
Assuming Windows XP 32. We will use MinGW to build the libraries and application and MSYS as a working environment. | Assuming Windows XP 32. We will use MinGW to build the libraries and application and MSYS as a working environment. |
| |
The distinction between MinGW and MSYS is very important: MinGW is a set of compilers and libraries you use to build Windows applications, while MSYS is a GNU environment similar to (and, in fact, based on) Cygwin. You can //not// use MSYS libraries in your Windows application. | The distinction between MinGW and MSYS is very important: MinGW is a set of compilers and libraries you use to build Windows applications, while MSYS is an emulated GNU environment similar to (and, in fact, based on) Cygwin. You can //not// use MSYS libraries in your Windows application. This means that you will sometimes have two copies of a particular library: an MSYS version used by MSYS tools, and a native version built with MinGW and used by MinGW tools and / or your application. |
| |
| ===== Directories ===== |
| |
| We will install MinGW into ''C:\MinGW'' and MSYS into ''C:\MSYS''. |
| |
| MSYS maps Unix-like paths to Windows paths: ''/'' translates to ''C:\MSYS'' and ''/mingw'' translates to ''C:\MinGW''. In addition, all Windows drives will show up as ''/x'', where ''x'' corresponds to the drive letter, so ''/c/windows'' translates to ''C:\windows'', etc. |
| |
| We will install our libraries and applications into ''C:\met.no''. You should start by creating that directory and the required subdirectories: |
| |
| C:\> mkdir met.no |
| C:\> mkdir met.no\bin |
| C:\> mkdir met.no\include |
| C:\> mkdir met.no\lib |
| C:\> mkdir met.no\share |
| C:\> mkdir met.no\copyright |
| |
===== Subversion ===== | ===== Subversion ===== |
| |
At this point, you may want to download bsdtar from http://sourceforge.net/projects/mingw/files/MinGW%20Utilities/basic%20bsdtar/bsdtar-2.7.900a_r1628-20091110/ and install ''bsdtar.exe'' as ''/mingw/bin/tar''. It supports a wider range of archive formats and compression algorithms than GNU tar, and automatically detects which one to use. | At this point, you may want to download bsdtar from http://sourceforge.net/projects/mingw/files/MinGW%20Utilities/basic%20bsdtar/bsdtar-2.7.900a_r1628-20091110/ and install ''bsdtar.exe'' as ''/mingw/bin/tar''. It supports a wider range of archive formats and compression algorithms than GNU tar, and automatically detects which one to use. |
| |
| You may want to install InfoZip's ''zip'' utility as well, since ''bsdtar'' can //extract// zip files but not //create// them: download the source code from http://sourceforge.net/projects/infozip/files/, extract it, and run the following commands in the source directory: |
| |
| $ make -f win32/makefile.gcc |
| $ cp zip.exe /mingw/bin |
| |
===== MSYS ===== | ===== MSYS ===== |
GNU Fortran (GCC) 3.4.5 (mingw-vista special r3) | GNU Fortran (GCC) 3.4.5 (mingw-vista special r3) |
Copyright (C) 2004 Free Software Foundation, Inc. | Copyright (C) 2004 Free Software Foundation, Inc. |
| |
GNU Fortran comes with NO WARRANTY, to the extent permitted by law. | GNU Fortran comes with NO WARRANTY, to the extent permitted by law. |
You may redistribute copies of GNU Fortran | You may redistribute copies of GNU Fortran |
$ cat >hello.f | $ cat >hello.f |
PROGRAM HELLOW | PROGRAM HELLOW |
WRITE(UNIT=*, FMT=*) 'Hello World' | WRITE(UNIT=*, FMT=*) 'Hello, Fortran world!' |
END | END |
^D | ^D |
Hello, Fortran world! | Hello, Fortran world! |
| |
===== Perl ===== | ===== lex & yacc ===== |
| |
The GNU Autotools, which we will install next, require Perl. Download and install the MSYS version of Perl from http://sourceforge.net/projects/mingw/files/MSYS%20perl/. You will also need libcrypt from http://sourceforge.net/projects/mingw/files/MSYS%20crypt/. | Or rather, in our brave GNU world, flex and bison. There is a problem here: you can't use the MSYS versions, because they're not just build tools—bison includes a runtime library (''liby''). Hence we need native versions of both tools. We can get those from [[http://sourceforge.net/projects/gnuwin32|GnuWin32]]. |
| |
===== pkg-config ===== | |
| |
There are no MinGW or MSYS binaries for pkg-config, and building it from source is non-trivial due to a circular dependency on glib (you need pkg-config to build glib). However, the Gnome project distribute Windows binaries of both glib and pkg-config, which you can download from http://www.gtk.org/download-windows.html. They come in zip files, so you can just double-click them in Windows Explorer and copy the contents to your MinGW root (''C:\MinGW''). | |
| |
===== lex & yacc ===== | |
| |
Or rather, in our brave GNU world, flex (http://downloads.sourceforge.net/project/mingw/MSYS%20flex/flex-2.5.35-1/flex-2.5.35-1-msys-1.0.11-bin.tar.lzma) and bison (http://downloads.sourceforge.net/project/mingw/MSYS%20bison/bison-2.4.1-1/bison-2.4.1-1-msys-1.0.11-bin.tar.lzma). In addition, flex requires the GNU regex library (http://downloads.sourceforge.net/project/mingw/MSYS%20regex/regex-1.20090805-1/libregex-1.20090805-1-msys-1.0.11-dll-1.tar.lzma). Download and install as usual. | Download the following files from http://sourceforge.net/projects/gnuwin32/files/: |
| |
===== Boost jam ===== | * the ''bin'', ''lib'' and ''dep'' zipfiles for the latest bison release (the ''dep'' zipfile contains a few libraries that bison needs, so you won't have to install them separately) |
| * the ''bin'' and ''lib'' zipfiles for the latest flex release |
| |
This utility is used to [[boost|compile the Boost libraries]]. We're going to build it from source, so this is our baptism of MinGW fire... | For some unfathomable reason, both the flex and bison ''lib'' zipfiles contain incorrect copies of ''<unistd.h>''. Either make a backup copy of ''/MinGW/include/unistd.h'' before you unpack them, or tell ''unzip'' (or ''bsdtar'') not to overwrite existing files: |
| |
Get the source tarball from http://downloads.sourceforge.net/project/boost/boost-jam/3.1.17/boost-jam-3.1.17.tgz; once you have it, it's a simple matter of running the build script (which will automatically detect MinGW) and installing the resulting executable: | $ tar -kxf bison-2.4.1-lib.zip -C /MinGW |
| |
$ tar zxf boost-jam-3.1.17.tgz | This will install a shell script called ''/MinGW/bin/yacc'' which incorrectly redirects to ''c:/progra~1/bison/bin/bison''. Edit it so the entire script looks like this: |
$ cd boost-jam-3.1.17 | |
$ sh ./build.sh | |
$ mkdir -p /usr/local/bin | |
$ cp bin.ntx86/bjam.exe /usr/local/bin | |
$ which bjam | |
/usr/local/bin/bjam.exe | |
$ bjam -v | |
Boost.Jam Version 3.1.17. OS=NT. | |
Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc. | |
Copyright 2001 David Turner. | |
Copyright 2001-2004 David Abrahams. | |
Copyright 2002-2008 Rene Rivera. | |
Copyright 2003-2008 Vladimir Prus. | |
| |
It's alive! | #! /bin/sh |
| exec /mingw/bin/bison -y "$@" |
| |
===== WiX ===== | ===== WiX ===== |