Files
nethack/outdated/include/amiconf.h
nhmall cb223271cb add cross-compile recipe for amiga
Disclaimer: This is a minimal recipe, just to get someone else
started if they have a desire to get a full cross-compile of
NetHack-3.7 going for the Amiga. Some NetHack code bitrot was
corrected, and it does seem able to compile the game itself
to a point. See caveats below.

- If you want to obtain the cross-compiler and tools/libs for Amiga
         https://github.com/bebbo/amiga-gcc

  To our knowledge, a pre-built copy isn't available, so you have to
  obtain the source via git and build it on your system.

  The build prerequisite packages for Ubuntu are easily obtained:

    sudo apt install make wget git gcc g++ lhasa libgmp-dev \
        libmpfr-dev libmpc-dev flex bison gettext texinfo ncurses-dev \
        autoconf rsync

  The build prerequisite packages for macOS are apparently easily
  obtained via homebrew, but that was not tested:

    brew install bash wget make lhasa gmp mpfr libmpc flex gettext \
    texinfo gcc make autoconf

  After installing the prerequite packages and the cross-compiler
  it was a straightforward build:

        git clone https://github.com/bebbo/amiga-gcc.git
        cd amiga-gcc
        make update
    [Note that you may have to take ownership of the files in the
     bebbo repo via chown before succesfully carrying out the next
     steps]
        make clean
        make clean-prefix
        date; make all -j3 >&b.log; date
  The compiler pieces are installed in /opt/amiga by default which
  was satisfactory for our initial attempt, but if you want you can
  alter the prefix before you build if you want. That is all
  spelled out on the page at: https://github.com/bebbo/amiga-gcc

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

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

You can explicitly include tty and curses support if desired, otherwise
you'll end up with a tty-only cross-compile build. The SDL1 pdcurses
support has not been tested.

       make WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_AMIGA=1 all

Also note that building the amiga targets using the make command
above, does not preclude you from building local linux or macOS
targets as well. Just drop the CROSS_TO_AMIGA=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.

CAVEATS: The original NetHack Amiga build steps included the source for
some utilities that were built and executed on the amiga: txt2iff and
xpm2iff as part of the NetHack build procedure on amiga. Those did not
compile out-of-the-box on the linux host. They will either have to be:
    - ported to build and run on the linux or macOS cross-compile host

   or

    - their functionality will have to be rolled into amiga NetHack
      itself and executed on the target Amiga the first time the game
      is run, perhaps.

Good luck amiga aficionados, perhaps you'll be able to take this
initial effort forward and get NetHack-3.7 available on the amiga or
amiga-emulator. Let us know if you do, and we can roll changes in
if you provide them.
2020-09-28 17:30:22 -04:00

223 lines
5.5 KiB
C

/* NetHack 3.6 amiconf.h $NHDT-Date: 1432512775 2015/05/25 00:12:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */
/* Copyright (c) Kenneth Lorber, Bethesda, Maryland, 1990, 1991, 1992, 1993.
*/
/* NetHack may be freely redistributed. See license for details. */
#ifndef AMICONF_H
#define AMICONF_H
#undef abs /* avoid using macro form of abs */
#ifndef __SASC_60
#undef min /* this gets redefined */
#undef max /* this gets redefined */
#endif
#include <time.h> /* get time_t defined before use! */
#ifdef AMIGA_CROSS
#include <stdlib.h>
#include <string.h>
#endif
#ifdef __SASC_60 /* since SAS can prevent re-inclusion */
#include <stdlib.h> /* general things, including builtins */
#include <string.h>
#endif
#ifdef AZTEC_50
#include <stdlib.h>
#define AZTEC_C_WORKAROUND /* Bug which turns up in sounds.c. Bummer... */
#define NO_SIGNAL /* 5.0 signal handling doesn't like SIGINT... */
#endif
#ifdef _DCC
#include <stdlib.h>
#define _SIZE_T
#endif
#ifndef __GNUC__
typedef long off_t;
#endif
#define MICRO /* must be defined to allow some inclusions */
#define NOCWD_ASSUMPTIONS /* Allow paths to be specified for HACKDIR, \
LEVELDIR, SAVEDIR, BONESDIR, DATADIR, \
SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */
#define PATHLEN 130
/* data librarian defs */
#ifndef NOCWD_ASSUMPTIONS
#define DLBFILE "NetHack:nhdat" /* main library */
#define DLBFILE2 "NetHack:nhsdat" /* sound library */
#else
#define DLBFILE "nhdat" /* main library */
#define DLBFILE2 "nhsdat" /* sound library */
#endif
#ifndef AMIGA_CROSS
#define FILENAME_CMP stricmp /* case insensitive */
#else
#define FILENAME_CMP strcmpi /* case insensitive */
#endif
#ifndef __SASC_60
#define O_BINARY 0
#endif
/* Compile in New Intuition look for 2.0 */
#ifdef IDCMP_CLOSEWINDOW
#ifndef INTUI_NEW_LOOK
#define INTUI_NEW_LOOK 1
#endif
#endif
#define MFLOPPY /* You'll probably want this; provides assistance \
* for typical personal computer configurations \
*/
#ifndef AMIGA_CROSS
#define RANDOM
#endif
/* ### amidos.c ### */
extern void FDECL(nethack_exit, (int));
/* ### amiwbench.c ### */
extern void NDECL(ami_wbench_init);
extern void NDECL(ami_wbench_args);
extern int FDECL(ami_wbench_getsave, (int));
extern void FDECL(ami_wbench_unlink, (char *));
extern int FDECL(ami_wbench_iconsize, (char *));
extern void FDECL(ami_wbench_iconwrite, (char *));
extern int FDECL(ami_wbench_badopt, (const char *));
extern void NDECL(ami_wbench_cleanup);
extern void FDECL(getlind, (const char *, char *, const char *));
/* ### winreq.c ### */
extern void amii_setpens(int);
extern void FDECL(exit, (int));
extern void NDECL(CleanUp);
extern void FDECL(Abort, (long));
extern int NDECL(getpid);
extern char *FDECL(CopyFile, (const char *, const char *));
extern int NDECL(kbhit);
extern int NDECL(WindowGetchar);
extern void FDECL(ami_argset, (int *, char *[]));
extern void FDECL(ami_mkargline, (int *, char **[]));
extern void FDECL(ami_wininit_data, (int));
#define FromWBench 0 /* A hint for compiler ... */
/* extern boolean FromWBench; /* how were we run? */
extern int ami_argc;
extern char **ami_argv;
#ifndef MICRO_H
#include "micro.h"
#endif
#ifndef PCCONF_H
#include "pcconf.h" /* remainder of stuff is almost same as the PC */
#endif
#define remove(x) unlink(x)
/* DICE wants rewind() to return void. We want it to return int. */
#if defined(_DCC) || defined(__GNUC__)
#define rewind(f) fseek(f, 0, 0)
#endif
#ifdef AZTEC_C
extern FILE *FDECL(freopen, (const char *, const char *, FILE *));
extern char *FDECL(gets, (char *));
#endif
/*
* If AZTEC_C we can't use the long cpath in vision.c....
*/
#ifdef AZTEC_C
#undef MACRO_CPATH
#endif
/*
* (Possibly) configurable Amiga options:
*/
#define TEXTCOLOR /* Use colored monsters and objects */
#define HACKFONT /* Use special hack.font */
#ifndef AMIGA_CROSS /* issues with prototype and spawnl */
#define SHELL /* Have a shell escape command (!) */
#endif
#define MAIL /* Get mail at unexpected occasions */
#define DEFAULT_ICON "NetHack:default.icon" /* private icon */
#define AMIFLUSH /* toss typeahead (select flush in .cnf) */
/* #define OPT_DISPMAP /* enable fast_map option */
/* new window system options */
/* WRONG - AMIGA_INTUITION should go away */
#ifdef AMII_GRAPHICS
#define AMIGA_INTUITION /* high power graphics interface (amii) */
#endif
#define CHANGE_COLOR 1
#ifdef TEXTCOLOR
#define DEPTH 6 /* Maximum depth of the screen allowed */
#else
#define DEPTH 2 /* Four colors...sigh... */
#endif
#define AMII_MAXCOLORS (1L << DEPTH)
typedef unsigned short AMII_COLOR_TYPE;
#define PORT_HELP "nethack:amii.hlp"
#undef TERMLIB
#define AMII_MUFFLED_VOLUME 40
#define AMII_SOFT_VOLUME 50
#define AMII_OKAY_VOLUME 60
#define AMII_LOUDER_VOLUME 80
#ifdef TTY_GRAPHICS
#define ANSI_DEFAULT
#endif
extern int amibbs; /* BBS mode? */
#ifdef AMII_GRAPHICS
extern int amii_numcolors;
void FDECL(amii_setpens, (int));
#endif
/* for cmd.c: override version in micro.h */
#ifdef __SASC_60
#undef M
#define M(c) ((c) -128)
#endif
struct ami_sysflags {
char sysflagsid[10];
#ifdef AMIFLUSH
boolean altmeta; /* use ALT keys as META */
boolean amiflush; /* kill typeahead */
#endif
#ifdef AMII_GRAPHICS
int numcols;
unsigned short amii_dripens[20]; /* DrawInfo Pens currently there are 13 in v39 */
AMII_COLOR_TYPE amii_curmap[AMII_MAXCOLORS]; /* colormap */
#endif
#ifdef OPT_DISPMAP
boolean fast_map; /* use optimized, less flexible map display */
#endif
#ifdef MFLOPPY
boolean asksavedisk;
#endif
};
extern struct ami_sysflags sysflags;
#endif /* AMICONF_H */