I have Windows OS (Operating System) and I am trying to install libpostal library https://github.com/openvenues/libpostal
I want to take care of everything (installations) using a .bat script and then try to run an example.
Here is a .bat script I found that tests if installation is already done else continues until finished (I think I might already have some of these parts done before):
@echo off
:: Check if MSYS2 and MinGW are installed
where msys2 2>nul >nul
if %errorlevel% equ 0 (
echo MSYS2 is already installed. Use --force to reinstall.
) else (
:: Install MSYS2 and MinGW
choco install msys2
refreshenv
)
:: Check if MSYS2 packages are updated
pacman -Qu 2>nul >nul
if %errorlevel% equ 0 (
echo MSYS2 packages are already updated. Use --force to reinstall.
) else (
:: Update MSYS2 packages
pacman -Syu
)
:: Check if build dependencies are installed
pacman -Q autoconf automake curl git make libtool gcc mingw-w64-x86_64-gcc 2>nul >nul
if %errorlevel% equ 0 (
echo Build dependencies are already installed. Use --force to reinstall.
) else (
:: Install build dependencies
pacman -S autoconf automake curl git make libtool gcc mingw-w64-x86_64-gcc
)
:: Check if libpostal is cloned
if exist libpostal (
echo libpostal repository is already cloned. Use --force to reinstall.
) else (
:: Clone libpostal repository
git clone https://github.com/openvenues/libpostal
)
cd libpostal
:: Check if libpostal is built and installed
if exist C:/Program Files/libpostal/bin/libpostal.dll (
echo libpostal is already built and installed. Use --force to reinstall.
) else (
:: Build and install libpostal
cp -rf windows/* ./
./bootstrap.sh
./configure --datadir=C:/libpostal
make -j4
make install
)
:: Check if libpostal is added to PATH environment variable
setx /m PATH "%PATH%;C:\Program Files\libpostal\bin" 2>nul >nul
if %errorlevel% equ 0 (
echo libpostal is already added to PATH environment variable. Use --force to reinstall.
) else (
:: Add libpostal to PATH environment variable
setx PATH "%PATH%;C:\Program Files\libpostal\bin"
)
:: Test libpostal installation
libpostal "100 S Broad St, Philadelphia, PA"
pause
I save this code in a notepad file as bat_script.bat
, then I left-click on .bat icon, run as administrator and get the following screenshot before the command prompt closes:
Can someone please help?