SDL2 VICE Cross Compiling on Linux for Windows

From Jay's Cafe' Wiki

GARBAGE DOESN'T WORK - source documentation is more than 5 years old.

Setting up the Mingw32 environment

apt install gcc-mingw-w64-x86-64 build-essential vim-nox exuberant-ctags \
bash-completion g++-mingw-w64-x86-64 binutils-mingw-w64 mingw-w64 \
automake autoconf-archive gnu-standards libtool gettext -y

apt install autoconf build-essential byacc flex git subversion  \
  vim xa65 alien p7zip-full zip texinfo gawk* zip unzip mingw-w64 mingw-w64-tools \

mkdir rpm
cd rpm
vim files.txt
cat files.txt | while read f; do wget -r -l1 --no-parent --no-directories -A "${f}*.rpm" -R "*-static-*" -R "*-tools-*" https://download-ib01.fedoraproject.org/pub/fedora-secondary/releases/30/Everything/i386/os/Packages/m/; done;
ls
rm mingw64-atkmm-2.24.2-7.fc30.noarch.rpm mingw64-cairomm-1.12.0-7.fc30.noarch.rpm
mingw64-pangomm-2.40.1-6.fc30.noarch.rpm mingw64-pcre2-10.32-2.fc30.noarch.rpm
mkdir ~/deb
cd
for f in rpm/*.rpm; do alien --to-deb $f; done
mv *.deb deb/
cd deb
ls
for f in deb/*.deb; do dpkg -i $f; done
cd ..
for f in deb/*.deb; do dpkg -i $f; done
ls -l deb | wc -l
ls -l rpm | wc -l
ls -l deb
dir deb
dir rpm
cp -R /usr/x86_64-w64-mingw32/sys-root/mingw/* /usr/x86_64-w64-mingw32/
cd /usr/x86_64-w64-mingw32/lib/pkgconfig
for pc in *.pc; do     echo "$pc";     cp "$pc" "$pc.bak";     sed -i 's@/sys-root/mingw@@' "$pc";   done
ln -s /usr/lib/x86_64-linux-gnu/glib-2.0/glib-compile-resources     /usr/bin/glib-compile-resources
ln -s /usr/lib/x86_64-linux-gnu/glib-2.0/glib-compile-schemas     /usr/bin/glib-compile-schemas
ln -s /usr/x86_64-w64-mingw32/bin/glib-genmarshal     /usr/bin/glib-genmarshal

ln -s /usr/x86_64-w64-mingw32/bin/glib-mkenums     /usr/bin/glib-mkenums
cd /usr/x86_64-w64-mingw32/share/glib-2.0/schemas
glib-compile-schemas
cd
svn checkout https://svn.code.sf.net/p/vice-emu/code/trunk vice-trunk
cd ~/vice-trunk/vice
./autogen.sh
cd ..
mkdir gtk3-win64-build
cd gtk3-win64-build
../vice/configure --enable-native-gtk3ui --host=x86_64-w64-mingw32
../vice/configure --enable-native-gtk3ui --enable-x64 --host=x86_64-w64-mingw32
make -j 6 2>&1 | tee build.log
updatedb
locate glib-compile-resources
cd /usr/x86_64-w64-mingw32/share/glib-2.0/schemas
glib-compile-schemas .
cd
ln -s /usr/lib/x86_64-linux-gnu/glib-2.0/glib-compile-resources   \
  /usr/bin/glib-compile-resources
ls -lh /usr/bin/glib-compile-resources
ln -lh /usr/lib/glib-compile-schemas
ls -lh /usr/lib/glib-compile-schemas
ls -lh /usr/bin/glib-compile*
apt-cache search glib-compile-resources
apt install libglib2.0-bin
ls -lh /usr/bin/glib-compile*
updatedb
locate glib-compile-resources
glib-complie-resources
apt install libglib2.0-dev-bin
ls -lh /usr/bin/glib-compile*






apt install autoconf bash-completion build-essential byacc flex git subversion
    vim xa65 alien p7zip-full zip texinfo gawk* zip unzip mingw-w64 mingw-w64-tools

../vice/configure --enable-native-gtk3ui --enable-x64 --disable-arch\
 --host=x86_64-w64-mingw32 --disable-hwscale host_alias=x86_64-w64-mingw32 \
 --no-create --no-recursion

Setup the SDL 2.x Libraries

#!/usr/bin/env bash
#
# SDL Cross-Build Download Script v 1.0
# =====================================
# (c) 2006 Dana Olson <dolson@icculus.org>
# Updated 20080617 by Saul D.
# Updated 2020 by Jay C. Theriot to use SDL2 libraries
#
# SDL 1.2 - http://www.libsdl.org/download-1.2.php
# SDL_image - http://www.libsdl.org/projects/SDL_image/
# SDL_mixer - http://www.libsdl.org/projects/SDL_mixer/
# SDL_net - http://www.libsdl.org/projects/SDL_net/
# SDL_ttf - http://www.libsdl.org/projects/SDL_ttf/

# Path to install to. Default is /opt/SDL-2.0.12
INSTPATH=$1
if [ "$1" == "" ] ; then
	INSTPATH=/opt/SDL-2.0.12
        echo Install path not specified\; using default.
fi

# Check and warn if destination exists.
if [ -e "$INSTPATH" ] ; then
  echo WARNING!!! Install path already exists!
fi

# Allow user to confirm install.
echo SDL libraries will be installed to $INSTPATH.
echo Press Enter to continue, ^C to abort.
read junk

# Create the patch and subdirectory.
mkdir -p $INSTPATH/archives/

# Make sure the directory could be created.
if [ ! -e "$INSTPATH/archives" ] ; then
  echo Couldn\'t create install path. Aborting.
  exit 1
fi
echo Installing...

# Download the SDL archives. Add to this list if you want more libraries.
cd $INSTPATH/archives/
for i in \
https://www.libsdl.org/release/SDL2-devel-2.0.12-mingw.tar.gz \
https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.5-VC.zip \
https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.4-VC.zip \
https://www.libsdl.org/projects/SDL_net/release/SDL2_net-devel-2.0.1-VC.zip \
https://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-devel-2.0.11-VC.zip
  do wget -c $i
done
cd ..

# Extract the main SDL archive.
tar zxf archives/SDL2-devel-2.0.12-mingw.tar.gz

# Extract the addon archives.
for i in archives/*.zip
  do unzip $i
done

# Make a directory to hold the SDL runtime for Win32.
mkdir SDL-2.0.12/runtime/

# Move all the DLLs and README file into here.
mv */*/*.dll SDL-2.0.12/runtime/
mv SDL-1.2.13/README-SDL.txt SDL-1.2.13/runtime/

# Move all the addon libraries into the lib dir.
mv SDL_*/*/*.lib SDL-2.0.12/lib/

# Move all the addon headers into the include dir.
mv SDL_*/*/*.h SDL-2.0.12/include/

# Remove unneeded directories.
rm -rf SDL_*/

# Make a symlink, so that the sdl-config can be found.
cd SDL-2.0.12/bin/
ln -s sdl-config i586-mingw32msvc-sdl-config

# Patch the sdl-config script to point to install path.
echo "--- i586-mingw32msvc-sdl-config" > sdlcfgfix.patch
echo "+++ i586-mingw32msvc-sdl-config.fix" >> sdlcfgfix.patch
echo "@@ -1,6 +1,6 @@" >> sdlcfgfix.patch
echo " #!/bin/sh" >> sdlcfgfix.patch
echo " " >> sdlcfgfix.patch
echo "-prefix=/Users/hercules/tmp/SDL-1.2.13" >> sdlcfgfix.patch
echo "+prefix=$INSTPATH" >> sdlcfgfix.patch
echo " exec_prefix=\${prefix}" >> sdlcfgfix.patch
echo " exec_prefix_set=no" >> sdlcfgfix.patch
echo " " >> sdlcfgfix.patch
patch < sdlcfgfix.patch
mv sdlcfgfix.patch ../../archives/

# Set proper permissions on some files.
cd ../../
chmod -x SDL-1.2.13/lib/* SDL-1.2.13/runtime/*

# Move everything into install dir.
mv SDL-1.2.13/ tempsdlinstalldir129
mv tempsdlinstalldir129/* ./
rm -r tempsdlinstalldir129/

# Done!
echo
echo Everything is done! SDL was installed in $INSTPATH.
echo This line should work to cross-compile:
echo PATH=$INSTPATH/bin:\$PATH ./configure --target=i586-mingw32msvc --host=i586-mingw32msvc --build=i586-linux
echo
exit 0