use bash for sys/msdos/fetch-cross-compiler.sh

bash allows arrays thus preventing duplication during fetching
This commit is contained in:
nhmall
2024-12-16 13:35:05 -05:00
parent 0a5948fffc
commit 5a3795184f
4 changed files with 73 additions and 60 deletions

View File

@@ -472,10 +472,10 @@ Cross-compiler pre-built binary downloads:
or pdcursesmod from:
https://github.com/Bill-Gray/PDCursesMod.git
- A shell script to download that djgpp cross-compiler and associated
- A bash script to download that djgpp cross-compiler and associated
pieces for either linux or macOS is available:
sh sys/msdos/fetch-cross-compiler.sh
bash sys/msdos/fetch-cross-compiler.sh
That script won't install anything, it just does file fetches and stores
them in subfolders of lib. The linux.370 and macOS.370 hints files are
@@ -483,7 +483,7 @@ Cross-compiler pre-built binary downloads:
CROSS_TO_MSDOS=1
on your make command line.
Note: Both the fetch-cross-compiler.sh script and the msdos
Note: Both the fetch-cross-compiler.sh bash script and the msdos
cross-compile and package procedures require unzip and zip to be available
on your host build system.

View File

@@ -225,7 +225,7 @@ steps:
sh setup.sh hints/linux.370
cd ../..
make fetch-lua
sh sys/msdos/fetch-cross-compiler.sh
sys/msdos/fetch-cross-compiler.sh
retVal=$?
if [ $retVal -eq 0 ]; then
make LUA_VERSION=5.4.6 WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_MSDOS=1 package

View File

@@ -56,9 +56,9 @@ II. There once was a time when people built NetHack right on their DOS machine.
pdcurses from:
https://github.com/wmcbrine/PDCurses.git
- A shell script to download the above-mentioned djgpp cross-compiler and
- A bash script to download the above-mentioned djgpp cross-compiler and
associated support pieces for either linux or macOS is available:
sh sys/msdos/fetch-cross-compiler.sh
sys/msdos/fetch-cross-compiler.sh
That script won't install anything, it just does file fetches and stores
them in subfolders of lib. The linux.370 and macOS.370 hints files are
@@ -66,7 +66,7 @@ II. There once was a time when people built NetHack right on their DOS machine.
CROSS_TO_MSDOS=1
on your make command line.
Note: Both the fetch-cross-compiler.sh script and the msdos
Note: Both the fetch-cross-compiler.sh bash script and the msdos
cross-compile and package procedures require unzip and zip to be available
on your host build system.
@@ -136,8 +136,8 @@ Appendix B - Common Difficulties Encountered
make: *** [Makefile:1531: nethack] Error 2
That result usually indicates that you haven't successfully run
the script to fetch the cross-compiler. Try again:
sh sys/msdos/fetch-cross-compiler.sh
the bash script to fetch the cross-compiler. Try again:
sys/msdos/fetch-cross-compiler.sh
ii) The cross-compile stops with an error "libfl.so.2: cannot open
shared object file: No such file or directory.

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
if [ ! -z "${TF_BUILD}" ]; then
set -x
@@ -60,6 +60,7 @@ fi
cd lib
if [ ! -f "$DJGPP_FILE" ]; then
echo "fetching djgpp cross-compiler int lib/djgpp"
if [ "$(uname)" = "Darwin" ]; then
#Mac
curl -L $DJGPP_URL -o $DJGPP_FILE
@@ -69,12 +70,14 @@ if [ ! -f "$DJGPP_FILE" ]; then
fi
if [ ! -d djgpp/i586-pc-msdosdjgpp ]; then
echo "extracting djgpp from $DJGPP_FILE"
tar xjf "$DJGPP_FILE"
#rm -f $DJGPP_FILE
fi
# DOS-extender for use with djgpp
if [ ! -d djgpp/cwsdpmi ]; then
echo "fetching DOS extender for use with djgpp"
if [ "$(uname)" = "Darwin" ]; then
#Mac
curl http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip -o csdpmi7b.zip
@@ -94,18 +97,18 @@ fi
# PDCurses (non-Unicode build uses this)
if [ ! -d "pdcurses" ]; then
echo "Getting ../pdcurses from https://github.com/wmcbrine/PDCurses.git" ; \
echo "fetching ../pdcurses from https://github.com/wmcbrine/PDCurses.git" ; \
git clone --depth 1 https://github.com/wmcbrine/PDCurses.git pdcurses
fi
# PDCursesMod (Unicode build uses this)
if [ ! -d "pdcursesmod" ]; then
echo "Getting ../pdcursesmod from https://github.com/Bill-Gray/PDCursesMod.git" ; \
echo "fetching ../pdcursesmod from https://github.com/Bill-Gray/PDCursesMod.git" ; \
git clone --depth 1 https://github.com/Bill-Gray/PDCursesMod.git pdcursesmod
fi
if [ ! -d djgpp/djgpp-patch ]; then
echo "Getting djlsr205.zip" ;
echo "fetching djlsr205.zip" ;
cd djgpp
mkdir -p djgpp-patch
cd djgpp-patch
@@ -132,62 +135,70 @@ if [ ! -d djgpp/djgpp-patch ]; then
mkdir -p src/libc/go32
unzip -p djlsr205.zip src/libc/go32/exceptn.S >src/libc/go32/exceptn.S
patch -p0 -l -i ../../../sys/msdos/exceptn.S.patch
echo "djgpp patch applied"
cd ../../
fi
# create a directory hold native DOS executables that might get deployed
# create a directory to hold some native DOS executables that might get deployed
if [ ! -d djgpp/target ]; then
cd djgpp
mkdir -p target
cd ../
fi
# These 4 arrays must have their elements kept in synch.
#
# full URL for the remote zip file to fetch
zipurl=(
"http://www.mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2/djdev205.zip"
"http://www.mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2gnu/gdb801b.zip"
)
# name of zip file upon landing here
ziplocal=(
"djdev205.zip"
"gdb801b.zip"
)
# name of file after extraction from zip file
exesought=(
"symify.exe"
"gdb.exe"
)
# stored full path inside zip file
exepathinzip=(
"bin/symify.exe"
"bin/gdb.exe"
)
if [ -d djgpp/target ]; then
cd djgpp/target
# symify to make bug reports more useful
if [ ! -f symify.exe ]; then
if [ ! -f djdev205.zip ]; then
echo "Getting djdev205.zip" ;
if [ "$(uname)" = "Darwin" ]; then
#Mac
curl --output djdev205.zip http://www.mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2/djdev205.zip
export cmdstatus=$?
else
wget --quiet --no-hsts http://www.mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2/djdev205.zip
export cmdstatus=$?
fi
if [ $cmdstatus -eq 0 ]; then
echo "fetch of djdev205.zip was successful"
fi
fi
if [ -f djdev205.zip ]; then
echo "unzipping djdev205.zip"
unzip -p djdev205.zip bin/symify.exe >./symify.exe
fi
fi
# gdb
if [ ! -f gdb.exe ]; then
if [ ! -f gdb801b.zip ]; then
echo "getting gdb801b.zip" ;
if [ "$(uname)" = "Darwin" ]; then
#Mac
curl --output gdb801b.zip http://www.mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2gnu/gdb801b.zip
export cmdstatus=$?
else
wget --quiet --no-hsts http://www.mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2gnu/gdb801b.zip
export cmdstatus=$?
fi
if [ $cmdstatus -eq 0 ]; then
echo "fetch of gdb801b.zip was successful"
fi
fi
if [ -f gdb801b.zip ]; then
echo "unzipping gdb801b.zip"
unzip -p gdb801b.zip bin/gdb.exe >./gdb.exe
fi
fi
echo "Native DOS executables:"
ls -l *.exe
cd ../../
cd djgpp/target
count=0
while [ "x${zipurl[count]}" != "x" ]
do
if [ ! -f ${exesought[count]} ]; then
if [ ! -f ${ziplocal[count]} ]; then
echo "Getting ${ziplocal[count]}" ;
if [ "$(uname)" = "Darwin" ]; then
#Mac
curl --output ${ziplocal[count]} ${zipurl[count]}
export cmdstatus=$?
else
wget --quiet --no-hsts ${zipurl[count]}
export cmdstatus=$?
fi
if [ $cmdstatus -eq 0 ]; then
echo "fetch of ${ziplocal[count]} was successful"
fi
fi
if [ -f ${ziplocal[count]} ]; then
echo "unzipping ${ziplocal[count]}"
unzip -p ${ziplocal[count]} ${exepathinzip[count]} >./${exesought[count]}
fi
fi
count=$(( $count + 1 ))
done
echo "Native DOS executables in lib/djgpp/target:"
ls -l *.exe
cd ../../
fi
FONT_VERSION="4.49"
@@ -207,6 +218,8 @@ if [ ! -d "$FONT_LFILE" ]; then
fi
tar -xvf $FONT_RFILE
rm $FONT_RFILE
else
echo "terminus fonts are already available in lib/$FONT_LFILE"
fi
cd ../