Make the build scripts tool-independent

This commit is contained in:
RichardG867
2021-08-15 00:31:31 -03:00
parent 04903bc721
commit 7649efa6e4
8 changed files with 195 additions and 215 deletions

View File

@@ -1,46 +1,2 @@
@echo off
::
:: 86Box A hypervisor and IBM PC system emulator that specializes in
:: running old operating systems and software designed for IBM
:: PC systems and compatibles from 1981 through fairly recent
:: system designs based on the PCI bus.
::
:: This file is part of the 86Box Probing Tools distribution.
::
:: Universal Windows build script for Watcom C-based host tools.
::
::
::
:: Authors: RichardG, <richardg867@gmail.com>
::
:: Copyright 2021 RichardG.
::
:: Check for Watcom environment.
if "x%WATCOM%" == "x" (
echo *** WATCOM environment variable not set. Make sure you're on an OpenWatcom
echo "Build Environment" command prompt.
exit /b 1
)
:: Find source file.
for %%i in (*.c) do set srcfile=%%i
if "x%srcfile%" == "x" (
echo *** Source file not found.
exit /b 2
)
:: Generate output file name.
set destfile=%srcfile:~0,-2%.exe
:: Call compiler.
echo *** Building...
wcl386 -bcl=nt -fo="%destfile%" "%srcfile%"
:: Check for success.
if errorlevel 1 (
echo *** Build failed.
exit /b 4
) else (
echo *** Build successful.
)
..\lib\build_watcom_host.bat cp437.c

View File

@@ -1,44 +1,2 @@
#!/bin/sh
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box Probing Tools distribution.
#
# Universal *nix build script for Watcom C-based host tools.
#
#
#
# Authors: RichardG, <richardg867@gmail.com>
#
# Copyright 2021 RichardG.
#
if ! wcl386 -v >/dev/null 2>&1
then
echo '***' Watcom compiler not found. Make sure OpenWatcom is installed and in \$PATH.
exit 1
fi
# Find source file.
srcfile="$(ls *.c 2>/dev/null | head -1)"
if [ "x$srcfile" == "x" ]
then
echo '***' Source file not found.
exit 2
fi
# Generate output file name.
destfile=$(basename "$srcfile" .c)
# Call compiler and check for success.
if wcl386 -bcl=linux -fo="$destfile" "$srcfile"
then
echo '***' Build successful.
chmod +x "$destfile"
else
echo '***' Build failed.
exit 4
fi
exec ../lib/build_watcom_host.sh cp437.c

59
lib/build_watcom_dos.bat Normal file
View File

@@ -0,0 +1,59 @@
@echo off
::
:: 86Box A hypervisor and IBM PC system emulator that specializes in
:: running old operating systems and software designed for IBM
:: PC systems and compatibles from 1981 through fairly recent
:: system designs based on the PCI bus.
::
:: This file is part of the 86Box Probing Tools distribution.
::
:: Universal Windows build script for Watcom C-based DOS tools.
::
::
::
:: Authors: RichardG, <richardg867@gmail.com>
::
:: Copyright 2021 RichardG.
::
:: Check for Watcom environment.
if "x%WATCOM%" == "x" (
echo *** WATCOM environment variable not set. Make sure you're on an OpenWatcom
echo "Build Environment" command prompt.
exit /b 1
)
:: Check for cp437 tool and build it if necessary.
if not exist ..\cp437\cp437.exe (
echo *** Building cp437 conversion tool for your host system...
pushd ..\cp437
call build.bat
popd
if errorlevel 1 exit /b %errorlevel%
)
:: Convert source file to CP437.
echo *** Converting %1 to CP437...
..\cp437\cp437.exe %1
if errorlevel 1 (
echo *** Conversion failed.
exit /b 2
)
:: Generate output file name.
set srcfile=%1
set destfile=%srcfile:~0,-2%.exe
setlocal enabledelayedexpansion
for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do set "destfile=!destfile:%%i=%%i!"
:: Call compiler.
echo *** Building...
wcl -bcl=dos -fo="!destfile!" "%1.cp437"
:: Check for success.
if errorlevel 1 (
echo *** Build failed.
exit /b 3
) else (
echo *** Build successful.
)

56
lib/build_watcom_dos.sh Normal file
View File

@@ -0,0 +1,56 @@
#!/bin/sh
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box Probing Tools distribution.
#
# Universal *nix build script for Watcom C-based DOS tools.
#
#
#
# Authors: RichardG, <richardg867@gmail.com>
#
# Copyright 2021 RichardG.
#
# Check for Watcom environment.
if ! wcl -v >/dev/null 2>&1
then
echo '***' Watcom compiler not found. Make sure OpenWatcom is installed and in \$PATH.
exit 1
fi
# Check for cp437 tool and build it if necessary.
if [ ! -x ../cp437/cp437 ]
then
echo '***' Building cp437 conversion tool for your host system...
pushd ../cp437
if ! ./build.sh
then
exit $?
fi
popd
fi
# Convert source file to CP437.
echo '***' Converting $1 to CP437...
if ! ../cp437/cp437 "$1"
then
echo '***' Conversion failed.
exit 2
fi
# Generate output file name.
destfile=$(basename "$1" .c | tr [:lower:] [:upper:]).EXE
# Call compiler and check for success.
if wcl -bcl=dos -fo="$destfile" "$1".cp437
then
echo '***' Build successful.
else
echo '***' Build failed.
exit 3
fi

40
lib/build_watcom_host.bat Normal file
View File

@@ -0,0 +1,40 @@
@echo off
::
:: 86Box A hypervisor and IBM PC system emulator that specializes in
:: running old operating systems and software designed for IBM
:: PC systems and compatibles from 1981 through fairly recent
:: system designs based on the PCI bus.
::
:: This file is part of the 86Box Probing Tools distribution.
::
:: Universal Windows build script for Watcom C-based host tools.
::
::
::
:: Authors: RichardG, <richardg867@gmail.com>
::
:: Copyright 2021 RichardG.
::
:: Check for Watcom environment.
if "x%WATCOM%" == "x" (
echo *** WATCOM environment variable not set. Make sure you're on an OpenWatcom
echo "Build Environment" command prompt.
exit /b 1
)
:: Generate output file name.
set srcfile=%1
set destfile=%srcfile:~0,-2%.exe
:: Call compiler.
echo *** Building...
wcl386 -bcl=nt -fo="%destfile%" "%1"
:: Check for success.
if errorlevel 1 (
echo *** Build failed.
exit /b 4
) else (
echo *** Build successful.
)

36
lib/build_watcom_host.sh Normal file
View File

@@ -0,0 +1,36 @@
#!/bin/sh
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box Probing Tools distribution.
#
# Universal *nix build script for Watcom C-based host tools.
#
#
#
# Authors: RichardG, <richardg867@gmail.com>
#
# Copyright 2021 RichardG.
#
if ! wcl386 -v >/dev/null 2>&1
then
echo '***' Watcom compiler not found. Make sure OpenWatcom is installed and in \$PATH.
exit 1
fi
# Generate output file name.
destfile=$(basename "$1" .c)
# Call compiler and check for success.
if wcl386 -bcl=linux -fo="$destfile" "$1"
then
echo '***' Build successful.
chmod +x "$destfile"
else
echo '***' Build failed.
exit 4
fi

View File

@@ -1,65 +1,2 @@
@echo off
::
:: 86Box A hypervisor and IBM PC system emulator that specializes in
:: running old operating systems and software designed for IBM
:: PC systems and compatibles from 1981 through fairly recent
:: system designs based on the PCI bus.
::
:: This file is part of the 86Box Probing Tools distribution.
::
:: Universal Windows build script for Watcom C-based DOS tools.
::
::
::
:: Authors: RichardG, <richardg867@gmail.com>
::
:: Copyright 2021 RichardG.
::
:: Check for Watcom environment.
if "x%WATCOM%" == "x" (
echo *** WATCOM environment variable not set. Make sure you're on an OpenWatcom
echo "Build Environment" command prompt.
exit /b 1
)
:: Check for cp437 tool and build it if necessary.
if not exist ..\cp437\cp437.exe (
echo *** Building cp437 conversion tool for your host system...
pushd ..\cp437
call build.bat
popd
if errorlevel 1 exit /b %errorlevel%
)
:: Find source file.
for %%i in (*.c) do set srcfile=%%i
if "x%srcfile%" == "x" (
echo *** Source file not found.
exit /b 2
)
:: Convert source file to CP437.
echo *** Converting %srcfile% to CP437...
..\cp437\cp437.exe %srcfile%
if errorlevel 1 (
echo *** Conversion failed.
exit /b 3
)
:: Generate output file name.
set destfile=%srcfile:~0,-2%.exe
setlocal enabledelayedexpansion
for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do set "destfile=!destfile:%%i=%%i!"
:: Call compiler.
echo *** Building...
wcl -bcl=dos -fo="!destfile!" "%srcfile%.cp437"
:: Check for success.
if errorlevel 1 (
echo *** Build failed.
exit /b 4
) else (
echo *** Build successful.
)
..\lib\build_watcom_dos.bat pcireg.c

View File

@@ -1,64 +1,2 @@
#!/bin/sh
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box Probing Tools distribution.
#
# Universal *nix build script for Watcom C-based DOS tools.
#
#
#
# Authors: RichardG, <richardg867@gmail.com>
#
# Copyright 2021 RichardG.
#
# Check for Watcom environment.
if ! wcl -v >/dev/null 2>&1
then
echo '***' Watcom compiler not found. Make sure OpenWatcom is installed and in \$PATH.
exit 1
fi
# Check for cp437 tool and build it if necessary.
if [ ! -x ../cp437/cp437 ]
then
echo '***' Building cp437 conversion tool for your host system...
pushd ../cp437
if ! ./build.sh
then
exit $?
fi
popd
fi
# Find source file.
srcfile="$(ls *.c 2>/dev/null | head -1)"
if [ "x$srcfile" == "x" ]
then
echo '***' Source file not found.
exit 2
fi
# Convert source file to CP437.
echo '***' Converting $srcfile to CP437...
if ! ../cp437/cp437 "$srcfile"
then
echo '***' Conversion failed.
exit 3
fi
# Generate output file name.
destfile=$(basename "$srcfile" .c | tr [:lower:] [:upper:]).EXE
# Call compiler and check for success.
if wcl -bcl=dos -fo="$destfile" "$srcfile".cp437
then
echo '***' Build successful.
else
echo '***' Build failed.
exit 4
fi
exec ../lib/build_watcom_dos.sh pcireg.c