Files
nethack/sys/msdos/fetch-cross-compiler.sh
nhmall 14b532bf10 add cross-compile recipe for msdos
- If you want to obtain the djgpp cross-compiler and tools/libs for MSDOS,
which is available for linux and macOS, you can use the following script
to obtain it:

       sh sys/msdos/fetch-cross-compiler.sh

That script won't install anything, it is just file fetches. It will
store the cross-compiler in subfolders of lib and the hints files are
configured to find it appropriately there.

Note: Both the fetch and the msdos cross-compile package target require
unzip and zip to be available on your host build system.

Cross-compiler bits:
       https://github.com/andrewwutw/build-djgpp
   and the pre-built binary for your platform from:
       https://github.com/andrewwutw/build-djgpp/releases/download/v3.0/
   and a DOS-extender (for including in msdos packaging) from
       http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip
   and pdcurses from:
       https://github.com/wmcbrine/PDCurses.git

The MSDOS cross-compile can then be carried out by specifying
CROSS_TO_MSDOS=1 on the make command line.

For example:
       make CROSS_TO_MSDOS=1 all
       make CROSS_TO_MSDOS=1 package

You can explicitly include tty and curses support if desired, otherwise
you'll end up with a tty-only cross-compile build:
       make WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_MSDOS=1 all

Also note that building the msdos targets using the make command
above, does not preclude you from building local linux or macOS
targets as well. Just drop the CROSS_TO_MSDOS=1 from the make
command line.

The cross-compiler hints additions are enclosed inside ifdef sections
and won't interfere with the non-cross-compile build in that case.
2020-09-28 16:28:15 -04:00

98 lines
2.1 KiB
Bash

#!/bin/sh
#set -x
if [ -z "$TRAVIS_BUILD_DIR" ]; then
export DJGPP_TOP=$(pwd)/lib/djgpp
else
export DJGPP_TOP="$TRAVIS_BUILD_DIR/lib/djgpp"
fi
if [ -z "$GCCVER" ]; then
export GCCVER=gcc1010
fi
if [ -z "$LUA_VERSION" ]; then
export LUA_VERSION=5.4.0
fi
if [ ! -d "$(pwd)/lib" ]; then
echo "Set up for Unix build and 'make fetch-lua' first."
exit 1
fi
#DJGPP_URL="https://github.com/andrewwutw/build-djgpp/releases/download/v2.9/"
DJGPP_URL="https://github.com/andrewwutw/build-djgpp/releases/download/v3.0/"
if [ "$(uname)" = "Darwin" ]; then
#Mac
DJGPP_FILE="djgpp-osx-$GCCVER.tar.bz2"
if [ -z "HINTS" ]; then
export HINTS=macOS.2020
fi
elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then
#Linux
DJGPP_FILE="djgpp-linux64-$GCCVER.tar.bz2"
if [ -z "$HINTS" ]; then
export HINTS=linux.2020
fi
elif [ "$(expr substr $(uname -s) 1 10)" = "MINGW32_NT" ]; then
#mingw
DJGPP_FILE="djgpp-mingw-$GCCVER-standalone.zip"
else
echo "No DJGPP release for you, sorry."
exit 1
fi
DJGPP_URL="$DJGPP_URL$DJGPP_FILE"
# export
if [ ! -d lib ]; then
mkdir -p lib
fi
cd lib
if [ ! -f "$DJGPP_FILE" ]; then
if [ "$(uname)" = "Darwin" ]; then
#Mac
curl -L $DJGPP_URL -o $DJGPP_FILE
else
wget --no-hsts "$DJGPP_URL"
fi
fi
if [ ! -d djgpp/i586-pc-msdosdjgpp ]; then
tar xjf "$DJGPP_FILE"
rm -f $DJGPP_FILE
fi
# DOS-extender for use with djgpp
if [ ! -d djgpp/cwsdpmi ]; then
if [ "$(uname)" = "Darwin" ]; then
#Mac
curl http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip -o csdpmi7b.zip
else
wget --no-hsts http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip
fi
cd djgpp
mkdir -p cwsdpmi
cd cwsdpmi
unzip ../../csdpmi7b.zip
cd ../../
rm csdpmi7b.zip
fi
# PDCurses
if [ ! -d "pdcurses" ]; then
echo "Getting ../pdcurses from https://github.com/wmcbrine/PDCurses.git" ; \
git clone --depth 1 https://github.com/wmcbrine/PDCurses.git pdcurses
fi
cd ../
# Don't fail the build if lua fetch failed because we cannot do anything about it
# but don't bother proceeding forward either
if [ ! -d "lib/lua-$LUA_VERSION/src" ]; then
exit 0
fi