tools-make/Documentation/README.MinGW

159 lines
5.3 KiB
Text
Raw Normal View History

Compiling GNUstep on MinGW
==========================
MinGW is a collection of header files and import libraries that allow
one to use GCC and produce native Windows32 programs that do not rely
on any 3rd-party DLLs. GNUstep has only partially been ported to MinGW
so expect some problems when trying to compile. Also, there are still
subtle problems with running GNU tools on Windows, so any problems you
may encounter may just as easly have to do with the compilation tools
you are using as with GNUstep.
The base library is not completely ported to run on MinGW yet.
In particular, anything using sockets, RunLoops and FileHandles will probably
not work.
Note for compiling with shared libraries (DLLs), it's a good idea to
remove the libobjc.a that comes with gcc (gcc -v for location) so that
it isn't accidentally found instead of the libobjc DLL that you will
compile below.
MinGW on Cygwin
---------------
This is the only configuration I've tested so far. This method uses
the Cygwin tools to help out with the configuration and compilation of
the libraries. It's always good to get the very latest version of
Cygwin and MinGW. These instructions were performed
with Cygwin DLL 1.3.2 and MingW gcc 2.95.3-5. If you have more
experience with MinGW than me, please help improve these instructions!
I assume you have installed Cygwin and MinGW, and dowloaded and
unpacked the GNUstep packages:
ffcall
gnustep-make
gnustep-objc
gnustep-base
See the GNUstep-HOWTO file for more information on where to get
various files.
1. First, start up a Cygwin BASH shell and make sure the MinGW tools
are in your path:
export PATH=//c/mingw/bin:$PATH
(Put in whatever path you have for the mingw tools). This is also a good
time to compile and install the ffcall package (Version 1.8b or above). It's
simply a C library so it requires no special tools other than the compiler.
For MinGW, configure the ffcall package like this:
./configure --host=i386-mingw32 --prefix=//c/mingw
(or set the prefix to some other location that is in the compiler search path).
Then
make
make install
NOTES: On some systems, configure has trouble when mingw's bin is in the
path (probably because of mingw's make).
2. The default location for GNUstep on Unix systems in /usr/GNUstep, but
there is no default for Windows machines, so you need to set that up
first with the GNUSTEP_SYSTEM_ROOT environment variable. To put it in
a similar location, you might try:
export GNUSTEP_SYSTEM_ROOT=//c/mingw/GNUstep/System
But you can put it anywhere you like (as long as you specify the full
path with the disk label so MinGW can find it). You can also specify this
with configure, using the --prefix=//c/mingw/GNUstep/System option.
3. You need to build and install each sub-package separately. So
first, go to the 'gnustep-make' package and configure:
cd gnustep-make
./configure --target=i386-mingw32
4. Now build the gnustep-make package. Occationally, the make that comes
with MinGW doesn't like the way GNUstep makefiles are setup (or perhaps
it's that MingW make doesn't work with bash), so you can try
using Cygwin's make instead:
/usr/bin/make target=i386-mingw32
/usr/bin/make target=i386-mingw32 install
5. Now source the GNUstep.sh file so the rest of the packages will
compile correctly:
. $GNUSTEP_SYSTEM_ROOT/Makefiles/GNUstep.sh
Also put this command in your shell startup script.
I also install a special script in the file ~/GNUstep/GNUstep.sh with the
lines:
if [ $GNUSTEP_HOST_OS = "mingw32" ]; then
GNUSTEP_SYSTEM_ROOT=`cygpath -w $GNUSTEP_SYSTEM_ROOT | tr '\\\' '/'`
fi
So both Cygwin's shell and MinGW tools can understand the GNUstep directories
(You can add similar lines for GNUSTEP_LOCAL_ROOT, GNUSTEP_USER_ROOT, etc.)
This automatically gets executed by the above command.
6. Now you can compile the Objective-C runtime DLL (unless you already
have one installed):
cd gnustep-objc
/usr/bin/make target=i386-mingw32 shared=yes
/usr/bin/make target=i386-mingw32 shared=yes install
Make sure to remove libobjc.a that comes with gcc, otherwise it will find that
one instead of the one we want.
7. Now we can configure and build the gnustep-base library.
cd gnustep-base
./configure --target=i386-mingw32
/usr/bin/make target=i386-mingw32 shared=yes
/usr/bin/make target=i386-mingw32 shared=yes install
If you get tired of typing "target=i386-mingw32" all the time, then before
you exec the GNUstep.sh script, just set the GNUSTEP_HOST:
export GNUSTEP_HOST=i586-pc-mingw32
. $GNUSTEP_SYSTEM_ROOT/Makefiles/GNUstep.sh
Native MinGW
------------
(Information provided by Craig Miskell)
So far, this configuration only works when compiling the Makefile package
(gnustep-make). It should, in the future work on the libraries. First, you
need to get a port of sh (probably zsh) for Windows
(ftp://ftp.blarg.net/users/amol/).
1. Make sure $HOST_CC or $CC is set to MinGW's gcc. The default seems to be
wrong.
2. Now configure. You may need to set the installation directory, because
the default installation dir is for Unix machines:
./configure --prefix=/usr/GNUstep/System
(Make sure the drive is specified correctly in the path).
3. Then make and install
make
make install
4. Now source the GNUstep.sh file so the rest of the packages will
compile correctly:
. $GNUSTEP_SYSTEM_ROOT/Makefiles/GNUstep.sh