Add a convenience script for stripping DLLs
[mingw-xscripts.git] / mingw-environment.sh
blob6add6954d960bf7d3d7a0f9836b12c841b3b8b1e
1 # This file is in the public domain for what it's worth.
2 # Written by Jānis Rūcis <parasti@gmail.com>
3 # Last updated in September, 2008.
5 # README:
7 # * If the date above seems too far back in the past, the stuff
8 # below is likely horribly outdated and only of historic relevance.
9 # Don't use it.
11 # * Some of the variables below will have to be modified for the
12 # script to be useful on your system. These include MINGW_PREFIX,
13 # BUILD and TARGET.
15 # * The script is deliberately minimalistic. Its primary purpose is
16 # to provide a proper cross-compilation environment for Neverball
17 # and its dependencies, so you will probably need to add more
18 # variables to get your own software to compile.
20 # * This script is designed to be as transparent as possible, so
21 # that no changes are necessary to a build system. However, due to
22 # there being no way to inform GCC of a non-standard library path
23 # when cross-compiling, a build system still has support the LDFLAGS
24 # environment variable.
26 MINGW_PREFIX=~/dev/mingw
27 export MINGW_PREFIX
29 # This isn't plain 'wine' because in Debian the Wine in PATH is
30 # actually the Winelauncher script, which is a bit too slow and too
31 # helpful for our tastes.
33 # Useful for builds that use their own functionality half-way through.
34 WINE=/usr/lib/wine/wine.bin
35 export WINE
37 # Some rationale for why some of the variables below have to be
38 # specified: it appears that configure scripts use different methods
39 # to determine whether cross-compilation is in effect. Some rely on
40 # the specified compiler, some require that --host be specified, some
41 # only work properly when both --build and --host are provided (which
42 # is strange considering that most of them are able to detect the
43 # build system automatically).
45 # config.guess is available in the autotools-dev package on Debian and
46 # in most autotools-based packages. You can probably use the script
47 # if you need some flexibility.
49 #BUILD=$(sh /usr/share/misc/config.guess)
50 BUILD=i686-linux-gnu
51 # TARGET is the exact prefix of the cross binaries sans hyphen.
52 TARGET=i586-mingw32msvc
53 HOST=$TARGET
55 # The variables above do not need to be exported.
56 # No exports here, move along!
58 CC=$TARGET-gcc
59 export CC
61 CXX=$TARGET-g++
62 export CXX
64 # Appears to be used by libtool, although I haven't (yet) run into any
65 # trouble without it.
67 CC_FOR_BUILD=cc
68 export CC_FOR_BUILD
70 # When a project that uses libtool does not inform libtool that it has
71 # been ported to build native Windows DLLs (by using the
72 # AC_LIBTOOL_WIN32_DLL macro in configure.in or, since this macro has
73 # been deprecated recently, some other equivalent way), dynamic
74 # libraries fail to build. Although libtool documentation does
75 # mention this requirement, libtool itself does not seem to handle
76 # this cleanly and fails in obscure ways. Explicitly setting OBJDUMP
77 # is (sometimes) a sufficient work-around. (Note that this might have
78 # been fixed to some extent in recent libtool versions.)
80 # This is an incomplete list of binary utilies. Expand as needed.
82 OBJDUMP=$TARGET-objdump
83 export OBJDUMP
85 RANLIB=$TARGET-ranlib
86 export RANLIB
88 NM=$TARGET-nm
89 export NM
91 # CFLAGS and CPPFLAGS aren't always the best place for setting these.
92 # Instead, we inform GCC directly.
94 CPATH="$MINGW_PREFIX/include:$CPATH"
95 export CPATH
97 # The LIBRARY_PATH environment variable would be the perfect way of
98 # letting GCC know in which directories to look for libraries, but
99 # unfortunately it is not used when cross compiling. The reason for
100 # this remains a mystery.
102 LDFLAGS="-L$MINGW_PREFIX/lib $LDFLAGS"
103 export LDFLAGS
105 # This particular PATH setting is seen often in cross compilation
106 # scripts, but I have only experienced problems with it and haven't
107 # yet come across a setup where it's actually necessary.
109 #PATH="$MINGW_PREFIX/bin:/usr/$TARGET/bin:$PATH" # Bad idea.
110 PATH="$MINGW_PREFIX/bin:$PATH" # Good idea.
111 export PATH
113 # If configure picks up build system's pkg-config, we politely ask it
114 # to look in all the right places. Might not work with an old
115 # pkg-config.
117 PKG_CONFIG_LIBDIR="$MINGW_PREFIX/lib/pkgconfig"
118 export PKG_CONFIG_LIBDIR