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
+3 -3
View File
@@ -472,10 +472,10 @@ Cross-compiler pre-built binary downloads:
or pdcursesmod from: or pdcursesmod from:
https://github.com/Bill-Gray/PDCursesMod.git 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: 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 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 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 CROSS_TO_MSDOS=1
on your make command line. 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 cross-compile and package procedures require unzip and zip to be available
on your host build system. on your host build system.
+1 -1
View File
@@ -225,7 +225,7 @@ steps:
sh setup.sh hints/linux.370 sh setup.sh hints/linux.370
cd ../.. cd ../..
make fetch-lua make fetch-lua
sh sys/msdos/fetch-cross-compiler.sh sys/msdos/fetch-cross-compiler.sh
retVal=$? retVal=$?
if [ $retVal -eq 0 ]; then if [ $retVal -eq 0 ]; then
make LUA_VERSION=5.4.6 WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_MSDOS=1 package make LUA_VERSION=5.4.6 WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_MSDOS=1 package
+5 -5
View File
@@ -56,9 +56,9 @@ II. There once was a time when people built NetHack right on their DOS machine.
pdcurses from: pdcurses from:
https://github.com/wmcbrine/PDCurses.git 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: 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 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 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 CROSS_TO_MSDOS=1
on your make command line. 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 cross-compile and package procedures require unzip and zip to be available
on your host build system. on your host build system.
@@ -136,8 +136,8 @@ Appendix B - Common Difficulties Encountered
make: *** [Makefile:1531: nethack] Error 2 make: *** [Makefile:1531: nethack] Error 2
That result usually indicates that you haven't successfully run That result usually indicates that you haven't successfully run
the script to fetch the cross-compiler. Try again: the bash script to fetch the cross-compiler. Try again:
sh sys/msdos/fetch-cross-compiler.sh sys/msdos/fetch-cross-compiler.sh
ii) The cross-compile stops with an error "libfl.so.2: cannot open ii) The cross-compile stops with an error "libfl.so.2: cannot open
shared object file: No such file or directory. shared object file: No such file or directory.
+64 -51
View File
@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
if [ ! -z "${TF_BUILD}" ]; then if [ ! -z "${TF_BUILD}" ]; then
set -x set -x
@@ -60,6 +60,7 @@ fi
cd lib cd lib
if [ ! -f "$DJGPP_FILE" ]; then if [ ! -f "$DJGPP_FILE" ]; then
echo "fetching djgpp cross-compiler int lib/djgpp"
if [ "$(uname)" = "Darwin" ]; then if [ "$(uname)" = "Darwin" ]; then
#Mac #Mac
curl -L $DJGPP_URL -o $DJGPP_FILE curl -L $DJGPP_URL -o $DJGPP_FILE
@@ -69,12 +70,14 @@ if [ ! -f "$DJGPP_FILE" ]; then
fi fi
if [ ! -d djgpp/i586-pc-msdosdjgpp ]; then if [ ! -d djgpp/i586-pc-msdosdjgpp ]; then
echo "extracting djgpp from $DJGPP_FILE"
tar xjf "$DJGPP_FILE" tar xjf "$DJGPP_FILE"
#rm -f $DJGPP_FILE #rm -f $DJGPP_FILE
fi fi
# DOS-extender for use with djgpp # DOS-extender for use with djgpp
if [ ! -d djgpp/cwsdpmi ]; then if [ ! -d djgpp/cwsdpmi ]; then
echo "fetching DOS extender for use with djgpp"
if [ "$(uname)" = "Darwin" ]; then if [ "$(uname)" = "Darwin" ]; then
#Mac #Mac
curl http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip -o csdpmi7b.zip curl http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip -o csdpmi7b.zip
@@ -94,18 +97,18 @@ fi
# PDCurses (non-Unicode build uses this) # PDCurses (non-Unicode build uses this)
if [ ! -d "pdcurses" ]; then 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 git clone --depth 1 https://github.com/wmcbrine/PDCurses.git pdcurses
fi fi
# PDCursesMod (Unicode build uses this) # PDCursesMod (Unicode build uses this)
if [ ! -d "pdcursesmod" ]; then 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 git clone --depth 1 https://github.com/Bill-Gray/PDCursesMod.git pdcursesmod
fi fi
if [ ! -d djgpp/djgpp-patch ]; then if [ ! -d djgpp/djgpp-patch ]; then
echo "Getting djlsr205.zip" ; echo "fetching djlsr205.zip" ;
cd djgpp cd djgpp
mkdir -p djgpp-patch mkdir -p djgpp-patch
cd djgpp-patch cd djgpp-patch
@@ -132,62 +135,70 @@ if [ ! -d djgpp/djgpp-patch ]; then
mkdir -p src/libc/go32 mkdir -p src/libc/go32
unzip -p djlsr205.zip src/libc/go32/exceptn.S >src/libc/go32/exceptn.S unzip -p djlsr205.zip src/libc/go32/exceptn.S >src/libc/go32/exceptn.S
patch -p0 -l -i ../../../sys/msdos/exceptn.S.patch patch -p0 -l -i ../../../sys/msdos/exceptn.S.patch
echo "djgpp patch applied"
cd ../../ cd ../../
fi 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 if [ ! -d djgpp/target ]; then
cd djgpp cd djgpp
mkdir -p target mkdir -p target
cd ../ cd ../
fi 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 if [ -d djgpp/target ]; then
cd djgpp/target cd djgpp/target
# symify to make bug reports more useful count=0
if [ ! -f symify.exe ]; then while [ "x${zipurl[count]}" != "x" ]
if [ ! -f djdev205.zip ]; then do
echo "Getting djdev205.zip" ; if [ ! -f ${exesought[count]} ]; then
if [ "$(uname)" = "Darwin" ]; then if [ ! -f ${ziplocal[count]} ]; then
#Mac echo "Getting ${ziplocal[count]}" ;
curl --output djdev205.zip http://www.mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2/djdev205.zip if [ "$(uname)" = "Darwin" ]; then
export cmdstatus=$? #Mac
else curl --output ${ziplocal[count]} ${zipurl[count]}
wget --quiet --no-hsts http://www.mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2/djdev205.zip export cmdstatus=$?
export cmdstatus=$? else
fi wget --quiet --no-hsts ${zipurl[count]}
if [ $cmdstatus -eq 0 ]; then export cmdstatus=$?
echo "fetch of djdev205.zip was successful" fi
fi if [ $cmdstatus -eq 0 ]; then
fi echo "fetch of ${ziplocal[count]} was successful"
if [ -f djdev205.zip ]; then fi
echo "unzipping djdev205.zip" fi
unzip -p djdev205.zip bin/symify.exe >./symify.exe if [ -f ${ziplocal[count]} ]; then
fi echo "unzipping ${ziplocal[count]}"
fi unzip -p ${ziplocal[count]} ${exepathinzip[count]} >./${exesought[count]}
# gdb fi
if [ ! -f gdb.exe ]; then fi
if [ ! -f gdb801b.zip ]; then count=$(( $count + 1 ))
echo "getting gdb801b.zip" ; done
if [ "$(uname)" = "Darwin" ]; then echo "Native DOS executables in lib/djgpp/target:"
#Mac ls -l *.exe
curl --output gdb801b.zip http://www.mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2gnu/gdb801b.zip cd ../../
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 ../../
fi fi
FONT_VERSION="4.49" FONT_VERSION="4.49"
@@ -207,6 +218,8 @@ if [ ! -d "$FONT_LFILE" ]; then
fi fi
tar -xvf $FONT_RFILE tar -xvf $FONT_RFILE
rm $FONT_RFILE rm $FONT_RFILE
else
echo "terminus fonts are already available in lib/$FONT_LFILE"
fi fi
cd ../ cd ../