#!/bin/bash set +e PACKAGES=""" https://downloads.haskell.org/~cabal/cabal-install-3.8.1.0/cabal-install-3.8.1.0-x86_64-windows.zip https://downloads.haskell.org/~ghc/9.2.5/ghc-9.2.5-x86_64-unknown-mingw32-integer-simple.tar.xz https://github.com/niXman/mingw-builds-binaries/releases/download/12.2.0-rt_v10-rev2/x86_64-12.2.0-release-win32-seh-msvcrt-rt_v10-rev2.7z https://github.com/libsdl-org/SDL/releases/download/release-2.26.3/SDL2-devel-2.26.3-mingw.tar.gz https://github.com/libsdl-org/SDL_image/releases/download/release-2.6.3/SDL2_image-devel-2.6.3-mingw.tar.gz https://downloads.sourceforge.net/project/pkgconfiglite/0.28-1/pkg-config-lite-0.28-1_bin-win32.zip """ mkdir -p packages cache workdir for p in $PACKAGES; do fname=`basename $p` if [ -f cache/$fname ]; then echo $fname already downloaded: OK else wget $p -O cache/$fname fi done if [ -d packages/cabal ]; then echo packages/cabal directory exists, skipping else echo Extracting Cabal unzip cache/cabal-install-3.8.1.0-x86_64-windows.zip -d packages/cabal fi if [ -d packages/ghc ]; then echo packages/ghc directory exists, skipping else echo Extracting GHC tar -C packages -xJf cache/ghc-9.2.5-x86_64-unknown-mingw32-integer-simple.tar.xz mv packages/ghc-9.2.5-x86_64-unknown-mingw32 packages/ghc fi if [ -f packages/cabal/pkg-config.exe ]; then echo packages/cabal/pkg-config.exe exists, skipping else echo Extracting pkg-config.exe unzip -j cache/pkg-config-lite-0.28-1_bin-win32.zip pkg-config-lite-0.28-1/bin/pkg-config.exe -d packages/cabal fi if [ -d packages/mingw64 ]; then echo packages/mingw84 directory exists, skipping else echo Extracting MingGW-W64 7z x -opackages cache/x86_64-12.2.0-release-win32-seh-msvcrt-rt_v10-rev2.7z fi if [ -d packages/sdl ]; then echo packages/sdl directory exists, skipping else echo Extractig SDL2 tar -C packages -xzf cache/SDL2-devel-2.26.3-mingw.tar.gz mv packages/SDL2-2.26.3 packages/sdl make CROSS_PATH=`realpath $PWD/packages/mingw64` -C packages/sdl cross fi if [ -d packages/sdl-image ]; then echo packages/sdl-image directory exists, skipping else echo Extracting SDL2_Image tar -C packages -xzf cache/SDL2_image-devel-2.6.3-mingw.tar.gz mv packages/SDL2_image-2.6.3 packages/sdl-image make CROSS_PATH=`realpath $PWD/packages/mingw64` -C packages/sdl-image cross fi echo "DONE!"