<h2>Building vanillawish/undroidwish on Windows</h2>

By Stephan Effelsberg<br>

The crucial part in building undroidwish on Windows is the setup of the
environment. This set of instructions is the result from building
undroidwish on Windows 7 Pro 32 using MSys2.

<h3>Tool: MSys2</h3>

Install MSys2 from the <a or use
a package manager like <a
Once you have MSys2 you can install any necessary package via its package
manager pacman, e.g

<verbatim>
    pacman -S <name of package>
</verbatim>

Some tools like <b>CMake</b> are nice to have a system-wide install.
In this case just make sure that the tools are listed in the PATH.

<h3>Tool: MinGW</h3>
Install <a then copy some of the
binaries to give them their necessary names, see for example
<a instructions</a>
on the Enlightenment wiki. Unfortunately, the binaries of a Windows
installation of MinGW don't have the names of the cross compiler suite
of MinGW. Consult the build script that you're finally going to call to
learn about the names of the individual binaries. This is an excerpt
from build-undroidwish-win32.sh:

<verbatim>
# the toolchain
if test -d ; then
  # use -march=i386 -mtune=i386 for Win2000 and/or old CPUs w/o
  # SSE like VIA C3
  echo using toolchain from

  STRIP="x86_64-w64-mingw32-strip"
  OBJCOPY="x86_64-w64-mingw32-objcopy"
  AR="x86_64-w64-mingw32-ar"
  RANLIB="x86_64-w64-mingw32-ranlib"
  CC="x86_64-w64-mingw32-gcc -m32 -march=i386 -mtune=i386 -DTCL_UTF_MAX=3"
  CC_OLD="x86_64-w64-mingw32-gcc -m32 -march=i386 -mtune=i386 -D_WIN32_WINNT=0x0400 -DTCL_UTF_MAX=3"
  CXX="x86_64-w64-mingw32-g++ -m32 -march=i386 -mtune=i386 -fno-exceptions -DTCL_UTF_MAX=3"
  RC="x86_64-w64-mingw32-windres -F pe-i386"
  NM="x86_64-w64-mingw32-nm"
  export STRIP OBJCOPY AR RANLIB CC CC_OLD CXX RC NM
else
  # would like to use -march=i386 -mtune=i386, too, but then gcc-4.8
  # cannot link due to missing atomic support for this CPU, thus must
  # have Pentium at least
  echo using toolchain prefix i686-w64-mingw32
  STRIP="i686-w64-mingw32-strip"
  OBJCOPY="i686-w64-mingw32-objcopy"
  AR="i686-w64-mingw32-ar"
  RANLIB="i686-w64-mingw32-ranlib"
  CC="i686-w64-mingw32-gcc -m32 -march=i586 -mtune=generic -DTCL_UTF_MAX=3"
  CC_OLD="i686-w64-mingw32-gcc -m32 -march=i586 -mtune=generic -D_WIN32_WINNT=0x0400 -DTCL_UTF_MAX=3"
  CXX="i686-w64-mingw32-g++ -m32 -march=i586 -mtune=generic -fno-exceptions -DTCL_UTF_MAX=3"
  RC="i686-w64-mingw32-windres -F pe-i386"
  NM="i686-w64-mingw32-nm"

  export STRIP OBJCOPY AR RANLIB CC CC_OLD CXX RC NM TWAPI_LDFLAGS
fi
</verbatim>

<h4><i>
What if ... I instead rename the environment variables in the script
to reflect the names of the binaries?


When compiling libwebsockets, you may encounter a strange case of
<tt>CMAKE_AR-NOTFOUND</tt>. I don't know why <tt>ar</tt> is so special to CMake but
if you search for it you can find many surprised developers who stumbled upon it.

<h3>Tool: CMake</h3>

Get it from <a or a package manager.

<h3>Tool: rsync</h3>

For calling <tt>init</tt> of the build script.

<verbatim>
    pacman -S rsync
</verbatim>

<h3>Tool: make</h3>

<verbatim>
    pacman -S make
</verbatim>

<h3>Tool: nasm</h3>

<a or via package manager. Needed for jpeg-turbo.

<verbatim>
    pacman -S nasm
</verbatim>

<h3>Tool: Perl</h3>

<verbatim>
    pacman -S perl
</verbatim>

<h3>Tool: bc</h3>

<tt>curl</tt> calls <tt>curl-config</tt> and this script needs <tt>bc</tt> to calculate
the version number requirements.

<verbatim>
    pacman -S bc
</verbatim>

<h3>Tool: pkg-config</h3>
<verbatim>
    pacman -S pkg-config
</verbatim>

<h4><i>
What if ... I forget pgk-config?


You will not get error messages but some modules will silently be ignored,
e.g. the jsmpeg video driver. You will only learn about this when trying
to use an ignored module.

<h3>Tool: texinfo</h3>

<tt>ffidl</tt> may complain about a missing <tt>makeinfo</tt>.

<verbatim>
    pacman -S texinfo
</verbatim>

<h3>Starting the shell</h3>

There are some options to start the MSys shell (and you surely have already
started one in order to install the tools). Make sure that the shell is
being run as an MSys shell, not a MinGW shell, by checking <tt>uname</tt>.
The result should look like

<verbatim>
MSYS_NT_6.1-7601
</verbatim>

and not like

<verbatim>
MINGW_NT_6.1-7601
</verbatim>

Now follow the simple build instructions to get your wish.

<h4><i>
What if ... I run a shell in MinGW mode?


Some modules may give you error messages like
"Please use win32/Makefile.gcc instead." or "... is not a cygwin compiler."