'''vice-3.6.1/doc/building/Windows-MinGW-GTK3-Howto.txt'''

From Jay's Cafe' Wiki
Revision as of 03:50, 25 December 2022 by Jayctheriot (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
VICE on Windows - The Next G(TK)eneration
=========================================

These are some instructions about getting VICE with the GTK3 GUI
compiled on Windows under MinGW.


NOTE: Although msys2 can build both 32-bit and 64-bit Windows binaries, a
      64-bit Windows (7 or later) host is required.


1. Get MSYS2 (includes mingw):
 http://www.msys2.org/
Install as per that webpage.


1.1. Update the distribution:

$ pacman -Syu

This will usually update only a few packages (the package manager itself and
some related packages), and then require you to exit the shell by clicking 'x'.
You can then start the shell again and run the same command again to update the
rest of the packages.



2. Check your MSYS2 username for spaces, for example:

$ whoami
David Hogan

If your Windows username has spaces like mine (David Hogan), then your
home dir will also have spaces in it, which causes problems with our
bindist build script later. To fix this, you'll need to change your MSYS2
home dir to something without spaces in it.

$ /usr/bin/mkpasswd > /etc/passwd

Use your favourite editor to change your home dir entry in /etc/passwd:

$ # pacman -S vim
$ # vim /etc/passwd

For example, change "/home/David Hogan" to "/home/dqh". You also can change
the username at the start of the entry if you like.

Finally, rename your existing homedir folder and exit and relaunch the
MSYS2 shell:

$ cd /home
$ # mv 'David Hogan' dqh
$ exit

<relaunch MSYS2 MinGW>

$ pwd
/home/dqh

$ whoami
dqh


3. Install the stuff that you need to build VICE:
Launch either the MSYS2 MinGW 64-bit shell or the MSYS2 MinGW 32-bit shell
(use the one that matches the version of MSYS2 that you installed).

DON'T USE THE NON-MINGW ONE, STUFF WON'T WORK.


Run the following command lines to install the prerequisites:

$ pacman -S --noconfirm --needed base-devel pactoys
$ pacboy sync autotools pkg-config gcc ntldd zip: p7zip: subversion: gtk3 glew giflib icoutils ffmpeg flac mpg123

(Note: type the colons that you see in the second command; they are important.
 Hit enter for the default on all the prompts, then wait for a lot of stuff
 to download and install.)


4. Then you need the xa 6502 cross-assembler, which is used to assemble the
"driver" program for vsid (the SID player that comes with VICE). It can be found
here: http://www.floodgap.com/retrotech/xa/

Don't log out of the shell.  After you download xa, go back to the shell.

Alternatively, use wget (in the shell) to download it:

$ cd /c/Users/<login-name>/Downloads/
$ wget https://www.floodgap.com/retrotech/xa/dists/xa-2.3.11.tar.gz

Make the directory "/usr/local/src/".
Use tar to unpack xa (use the MSYS2 path to where you downloaded it):

$ cd /usr/local
$ mkdir -p src
$ cd src
$ tar -xzf /c/Users/<login-name>/Downloads/xa-2.3.11.tar.gz

NOTE: if fetching the above mentioned tarball fails, then probably XA was
      updated, have a look at https://www.floodgap.com/retrotech/xa/dists/ and
      change the name of the tarball accordingly.

      A mirror of the xa source packages is available via Github:
      https://github.com/fachat/xa65/archive/refs/tags/xa-2.3.11.tar.gz

Then build and install it:

$ cd xa-2.3.11
$ make mingw install
$ mv ../../bin/xa.exe ../../bin/xa65.exe


5. Get MiKTeX, in order to build the PDF documentation (optional).
NOTE: if you skip this step, you will need to ./configure with --disable-pdf-docs

Download and install it, see: https://miktex.org/howto/install-miktex

Set $PATH so configure will find the required binaries:

(My MiKTeX path is C:\miktex, I'll use that as the example -- assumes 64-bit
 Windows.)
$ export PATH="$PATH:/c/miktex/miktex/bin/x64"

Remember either to do that last step every time you open the msys64 terminal,
or edit your "~/.bash_profile".

Also, add this line to your "~/.bash_profile" file:

export OSTYPE="MSYS"

(It works around a current bug that makes it impossible to build the PDF
document without that line.)

If you change your ".bash_profile" exit from the shell and relaunch that
shell (it will use your updated profile).


6. Get VICE's source code.
To check out the source with Subversion (into "~/vice-trunk/", for example),
you could type:

$ cd ~
$ svn checkout http://svn.code.sf.net/p/vice-emu/code/trunk vice-trunk


7. Now, you can try to build VICE:

$ cd ~/vice-trunk/vice
$ ./autogen.sh
$ ./configure -C --enable-native-gtk3ui
$ make -s --no-print-dir
$ make -s --no-print-dir bindist

NOTE: if you want to help us out with bug reports, please instead configure
with:

$ ./configure -C --enable-native-gtk3ui --enable-debug-gtk3ui --enable-debug


8. If it got through all those steps, you should have some executables to play
with in "GTK3VICE-3.?-win??-*/" (the "win??" part of that name tells you which
type [32-bit or 64-bit] you built).


9. You can build the 32-bit version of VICE and/or the 64-bit version.  You
make the choice by choosing to run a particular one of the MSYS2 MinGW shells
(its environment variables control VICE's configuration).

make the choice by choosing to run a particular one of the MSYS2 MinGW shells
(its environment variables control VICE's configuration).

If you build one version, then want to build the other version, you must clean
away the object files first.  Then, you must configure VICE again.

$ make clean
$ rm config.cache
$ ./configure -C --enable-native-gtk3ui
$ make -s --no-print-dir
$ make -s --no-print-dir bindist


10. If you want the distribution in a ZIP or a 7z archive instead of a
subdirectory then use one of these commands (instead of "make -s --no-print-dir bindist").
Use this for a ZIP-format bindist:

$ make -s --no-print-dir bindistzip

or this for a 7z bindist:

$ make -s --no-print-dir bindist7zip


Note:  You can install other packages if you want to add features to VICE.
(If you install any of these packages after you have built VICE, rerun
the last four commands in step 9.  That will make VICE use the
newly-installed libraries.)


11. Optional features

11.1. This will let VICE use PortAudio:

$ pacboy sync portaudio