Skip to content

Instantly share code, notes, and snippets.

@t-mat
Last active September 13, 2026 06:05
Show Gist options
  • Select an option

  • Save t-mat/3fede3be8c866458a577d4dcc670f3b1 to your computer and use it in GitHub Desktop.

Select an option

Save t-mat/3fede3be8c866458a577d4dcc670f3b1 to your computer and use it in GitHub Desktop.
bison.bat
@setlocal enabledelayedexpansion & echo off
set "BISON_VER=2.4.1"
set "BISON_BIN_URL=https://downloads.sourceforge.net/project/gnuwin32/bison/!BISON_VER!/bison-!BISON_VER!-bin.zip"
set "BISON_DEP_URL=https://downloads.sourceforge.net/project/gnuwin32/bison/!BISON_VER!/bison-!BISON_VER!-dep.zip"
set "BISON_DIR=%~dp0.bison"
set "BISON_BIN_ZIP_FILE=!BISON_DIR!\bison-bin.zip"
set "BISON_DEP_ZIP_FILE=!BISON_DIR!\bison-dep.zip"
set "BISON_EXE=!BISON_DIR!\bin\bison.exe"
set "BISON_DEP=!BISON_DIR!\bin\libiconv2.dll"
if not exist "!BISON_DIR!" ( mkdir "!BISON_DIR!" )
if not exist "!BISON_DIR!" ( echo FAIL : mkdir "!BISON_DIR!" & goto :ERROR )
if not exist "!BISON_BIN_ZIP_FILE!" ( echo Downloading !BISON_BIN_URL! & curl.exe -o "!BISON_BIN_ZIP_FILE!" -JLfSs !BISON_BIN_URL! )
if not exist "!BISON_BIN_ZIP_FILE!" ( echo FAIL : Download !BISON_BIN_URL! & goto : ERROR )
if not exist "!BISON_DEP_ZIP_FILE!" ( echo Downloading !BISON_DEP_URL! & curl.exe -o "!BISON_DEP_ZIP_FILE!" -JLfSs !BISON_DEP_URL! )
if not exist "!BISON_DEP_ZIP_FILE!" ( echo FAIL : Download !BISON_DEP_URL! & goto : ERROR )
if not exist "!BISON_DEP!" ( tar.exe -xf "!BISON_DEP_ZIP_FILE!" -C "!BISON_DIR!" )
if not exist "!BISON_DEP!" ( echo FAIL : tar.exe -xf "!BISON_DEP_ZIP_FILE!" -C "!BISON_DIR!" & goto :ERROR )
if not exist "!BISON_EXE!" ( tar.exe -xf "!BISON_BIN_ZIP_FILE!" -C "!BISON_DIR!" )
if not exist "!BISON_EXE!" ( echo FAIL : tar.exe -xf "!BISON_BIN_ZIP_FILE!" -C "!BISON_DIR!" & goto :ERROR )
"!BISON_EXE!" %* || goto :ERROR
exit /b 0
:ERROR
exit /b 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment