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.
This commit is contained in:
nhmall
2020-09-28 16:28:15 -04:00
parent b9b4755fe3
commit 14b532bf10
3 changed files with 223 additions and 0 deletions

View File

@@ -3,6 +3,52 @@
#
# Cross-compiling -POST section
ifdef CROSS_TO_MSDOS
#
$(TARGETDIR)/msdos.o : ../sys/msdos/msdos.c $(HACK_H)
$(TARGETDIR)/pckeys.o : ../sys/msdos/pckeys.c $(HACK_H)
$(TARGETDIR)/pctiles.o : ../sys/msdos/pctiles.c ../sys/msdos/portio.h $(HACK_H)
$(TARGETDIR)/video.o : ../sys/msdos/video.c ../sys/msdos/portio.h $(HACK_H)
$(TARGETDIR)/vidtxt.o : ../sys/msdos/vidtxt.c ../sys/msdos/portio.h \
../win/share/tile.h ../include/tileset.h $(HACK_H)
$(TARGETDIR)/vidvga.o : ../sys/msdos/vidvga.c ../sys/msdos/portio.h \
../win/share/tile.h ../include/tileset.h $(HACK_H)
$(TARGETDIR)/vidvesa.o : ../sys/msdos/vidvesa.c ../sys/msdos/portio.h \
../win/share/tile.h ../include/tileset.h $(HACK_H)
$(TARGETDIR)/vidstub.o : ../sys/msdos/vidvesa.c ../sys/msdos/portio.h \
$(HACK_H)
$(TARGETDIR)/tile.o : tile.c
#
#.PHONY: dospkg
dospkg: $(GAMEBIN) $(TARGETDIR)/recover.exe ../dat/nhtiles.bmp
$(TARGET_STUBEDIT) $(GAMEBIN) minstack=2048K
mkdir -p $(TARGETDIR)/pkg
cp $(GAMEBIN) $(TARGETDIR)/pkg/NETHACK.EXE
cp ../dat/nhdat $(TARGETDIR)/pkg/NHDAT
cp ../dat/license $(TARGETDIR)/pkg/LICENSE
cp ../dat/nhtiles.bmp $(TARGETDIR)/pkg/NHTILES.BMP
cp ../dat/symbols $(TARGETDIR)/pkg/SYMBOLS
cp ../sys/share/NetHack.cnf $(TARGETDIR)/pkg/NETHACK.CNF
cp ../sys/msdos/sysconf $(TARGETDIR)/pkg/SYSCONF
cp ../doc/nethack.txt $(TARGETDIR)/pkg/NETHACK.TXT
cp ../lib/djgpp/cwsdpmi/bin/CWSDPMI.EXE $(TARGETDIR)/pkg/CWSDPMI.EXE
-touch $(TARGETDIR)/pkg/RECORD
zip -9 $(TARGETDIR)/NH370DOS.ZIP $(TARGETDIR)/pkg/*
@echo msdos package zip file $(TARGETDIR)/NH370DOS.ZIP
endif # CROSS_TO_MSDOS
#
# shared file dependencies
#
$(TARGETDIR)/pcmain.o : ../sys/share/pcmain.c $(HACK_H)
$(TARGETDIR)/pcsys.o : ../sys/share/pcsys.c $(HACK_H)
$(TARGETDIR)/pctty.o : ../sys/share/pctty.c $(HACK_H)
$(TARGETDIR)/pcunix.o : ../sys/share/pcunix.c $(HACK_H)
$(TARGETDIR)/tileset.o : ../win/share/tileset.c
$(TARGETDIR)/bmptiles.o : ../win/share/bmptiles.c
$(TARGETDIR)/giftiles.o : ../win/share/giftiles.c
$(TARGETDIR)/recover.exe : $(TARGETDIR)/recover.o
#
# Lua lib
$(LUACROSSLIB): $(LUALIBOBJS)