#!/bin/bash

#This script is intended to help with building for windows systems. Everyting was
#snatched from https://martinber.github.io/gtk-rs.github.io/docs-src/tutorial/cross.
#Before executing, you need to install some libraries.
#Arch linux: yay -S mingw-w64-gtk4
#Other distros: Feeling pity for u :)
#Useful: https://web.archive.org/web/20180719181100/http://win32builder.gnome.org/

if [[ $1 == "" ]]; then
	echo "[WARNING] PKG_CONFIG_PATH as a first argument was not defined. Using default value '/usr/i686-w64-mingw32/lib/pkgconfig'"
	export PKG_CONFIG_PATH=/usr/i686-w64-mingw32/lib/pkgconfig
else
	echo "[INFO] Setting PKG_CONFIG_PATH to '$1'"
	export PKG_CONFIG_PATH=$1
fi
export PKG_CONFIG_ALLOW_CROSS=1
cargo build --target=x86_64-pc-windows-gnu --release
