From 9b83acbefd575fa0bb7b30cf43fa0962bead8a37 Mon Sep 17 00:00:00 2001 From: sezero Date: Fri, 3 Aug 2018 19:43:02 +0300 Subject: [PATCH] linux build fixes --- glide3x/cvg/glide3/src/makefile.linux | 4 +-- glide3x/h3/glide3/src/makefile.linux | 8 +++--- glide3x/h3/minihwc/lin_mode.c | 22 --------------- glide3x/h3/minihwc/linhwc.c | 28 +------------------ glide3x/h5/glide3/src/makefile.linux | 8 +++--- glide3x/h5/glide3/tests/sbench.c | 2 ++ glide3x/h5/glide3/tests/tlib.c | 7 +++-- glide3x/h5/minihwc/lin_mode.c | 22 --------------- glide3x/h5/minihwc/linhwc.c | 28 +++---------------- glide3x/sst1/glide3/src/makefile.linux | 5 ++-- glide3x/sst1/init/makefile.linux | 2 +- glide3x/sst1/init/makefile.unix | 2 +- swlibs/fxmisc/fxos.c | 38 ++++++++++++++------------ 13 files changed, 45 insertions(+), 131 deletions(-) diff --git a/glide3x/cvg/glide3/src/makefile.linux b/glide3x/cvg/glide3/src/makefile.linux index 1b3fcd4..e0a1b02 100644 --- a/glide3x/cvg/glide3/src/makefile.linux +++ b/glide3x/cvg/glide3/src/makefile.linux @@ -117,7 +117,7 @@ ASFLAGS = -O6 -felf -D__linux__ ASFLAGS += $(CDEFS) # compiler -CFLAGS = -Wall -W +CFLAGS = -Wall CFLAGS += -I. -I../../incsrc -I../../init CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib @@ -268,7 +268,7 @@ $(GLIDE_LIBDIR)/$(GLIDE_SO): $(GLIDE_LIBDIR)/$(GLIDE_SHARED) ln -fs $(GLIDE_SHARED) $(GLIDE_LIBDIR)/$(GLIDE_SO) $(GLIDE_LIBDIR)/$(GLIDE_SHARED): $(GLIDE_OBJECTS:.o=.lo) - $(CC) -o $@ -shared -Wl,-soname,$(GLIDE_SONAME) $^ $(LDFLAGS) $(LDLIBS) + $(CC) -o $@ -shared -Wl,--no-undefined -Wl,-soname,$(GLIDE_SONAME) $^ $(LDFLAGS) $(LDLIBS) $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB) ifeq ($(TEXUS2),1) diff --git a/glide3x/h3/glide3/src/makefile.linux b/glide3x/h3/glide3/src/makefile.linux index df9f698..877ca0b 100644 --- a/glide3x/h3/glide3/src/makefile.linux +++ b/glide3x/h3/glide3/src/makefile.linux @@ -109,8 +109,8 @@ ifdef DEBUG CDEFS += -DGDBG_INFO_ON -DGLIDE_DEBUG -DGLIDE_SANITY_ASSERT -DGLIDE_SANITY_SIZE endif -# other -CDEFS += -DGLIDE_PLUG -DGLIDE_SPLASH +# shameless plug and splash screen - not for linux DRI builds +#CDEFS += -DGLIDE_PLUG -DGLIDE_SPLASH ifeq ($(TEXUS2),1) CDEFS += -DHAVE_TEXUS2 @@ -128,7 +128,7 @@ ASFLAGS = -O6 -felf -D__linux__ ASFLAGS += $(CDEFS) # compiler -CFLAGS = -Wall -W +CFLAGS = -Wall CFLAGS += -I. -I../../incsrc -I../../minihwc -I../../cinit CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib @@ -274,7 +274,7 @@ $(GLIDE_LIBDIR)/$(GLIDE_SO): $(GLIDE_LIBDIR)/$(GLIDE_SHARED) ln -fs $(GLIDE_SHARED) $(GLIDE_LIBDIR)/$(GLIDE_SO) $(GLIDE_LIBDIR)/$(GLIDE_SHARED): $(GLIDE_OBJECTS:.o=.lo) - $(CC) -o $@ -shared -Wl,-soname,$(GLIDE_SONAME) $^ $(LDFLAGS) $(LDLIBS) + $(CC) -o $@ -shared -Wl,--no-undefined -Wl,-soname,$(GLIDE_SONAME) $^ $(LDFLAGS) $(LDLIBS) $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB) ifeq ($(TEXUS2),1) diff --git a/glide3x/h3/minihwc/lin_mode.c b/glide3x/h3/minihwc/lin_mode.c index b196b07..1176851 100644 --- a/glide3x/h3/minihwc/lin_mode.c +++ b/glide3x/h3/minihwc/lin_mode.c @@ -227,25 +227,3 @@ char *file_getenv (const char *a) return NULL; } - -#include - -/*------------------------------------------------------------------- - Function: tlKbHit - Date: 2/28 - Implementor(s): jdt - Library: test library - Description: - Returns true if there are pending characters in the input queue - Arguments: - none - Return: - nonzero if keys in queue - -------------------------------------------------------------------*/ -int hwcKbHit( void ) { - return lin_kbhit(); -} - -char hwcGetCH( void ) { - return lin_getch(); -} diff --git a/glide3x/h3/minihwc/linhwc.c b/glide3x/h3/minihwc/linhwc.c index b548dad..8bdca36 100644 --- a/glide3x/h3/minihwc/linhwc.c +++ b/glide3x/h3/minihwc/linhwc.c @@ -62,7 +62,7 @@ hwcCheckMemSize(hwcBoardInfo *bInfo, FxU32 xres, FxU32 yres, FxU32 nColBuffers, #include #include #include -#include +/*#include */ #include #include "lindri.h" @@ -154,16 +154,6 @@ void grDRIPosition(int x, int y, int w, int h, driInfo.pClip=pClip; } -#if 0 /* unused */ -static FxU32 -pow2Round(FxU32 val, FxU32 pow2Const) -{ - const FxU32 pow2Mask = (pow2Const - 1UL); - - return ((val + pow2Mask) & ~pow2Mask); -} -#endif - static void loadEnvFile() { FILE *file; char data[128]; @@ -607,22 +597,6 @@ hwcCheckMemSize(hwcBoardInfo *bInfo, FxU32 xres, FxU32 yres, FxU32 nColBuffers, #undef FN_NAME } /* hwcCheckMemSize */ -#if 0 /* unused */ -static FxU32 -calculateLfbStride(FxU32 screenWidth) -{ -#if 1 - unsigned int TileAperturePitch; - for (TileAperturePitch = 1024; - (TileAperturePitch < (16u << 10)) && (TileAperturePitch < screenWidth); - TileAperturePitch <<= 1); - return(TileAperturePitch); -#else - return(0x1000); -#endif -} -#endif - /* How the hw treats lfb accesses are dependent on the 'type' of * memory (tiled/linear) that the color/aux buffers are in. We * pre-compute the actual lfb address here while we know about the diff --git a/glide3x/h5/glide3/src/makefile.linux b/glide3x/h5/glide3/src/makefile.linux index 79c0d2b..9e978c1 100644 --- a/glide3x/h5/glide3/src/makefile.linux +++ b/glide3x/h5/glide3/src/makefile.linux @@ -115,8 +115,8 @@ ifdef DEBUG CDEFS += -DGDBG_INFO_ON -DGLIDE_DEBUG -DGLIDE_SANITY_ASSERT -DGLIDE_SANITY_SIZE endif -# other -CDEFS += -DGLIDE_PLUG -DGLIDE_SPLASH +# shameless plug and splash screen - not for linux DRI builds +#CDEFS += -DGLIDE_PLUG -DGLIDE_SPLASH ifeq ($(TEXUS2),1) CDEFS += -DHAVE_TEXUS2 @@ -134,7 +134,7 @@ ASFLAGS = -O6 -felf -D__linux__ ASFLAGS += $(CDEFS) # compiler -CFLAGS = -Wall -W +CFLAGS = -Wall CFLAGS += -I. -I../../incsrc -I../../minihwc -I../../cinit CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib @@ -302,7 +302,7 @@ $(GLIDE_LIBDIR)/$(GLIDE_SO): $(GLIDE_LIBDIR)/$(GLIDE_SHARED) ln -fs $(GLIDE_SHARED) $(GLIDE_LIBDIR)/$(GLIDE_SO) $(GLIDE_LIBDIR)/$(GLIDE_SHARED): $(GLIDE_OBJECTS:.o=.lo) - $(CC) -o $@ -shared -Wl,-soname,$(GLIDE_SONAME) $^ $(LDFLAGS) $(LDLIBS) + $(CC) -o $@ -shared -Wl,--no-undefined -Wl,-soname,$(GLIDE_SONAME) $^ $(LDFLAGS) $(LDLIBS) $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB) ifeq ($(TEXUS2),1) diff --git a/glide3x/h5/glide3/tests/sbench.c b/glide3x/h5/glide3/tests/sbench.c index 0c0b95b..0959d01 100644 --- a/glide3x/h5/glide3/tests/sbench.c +++ b/glide3x/h5/glide3/tests/sbench.c @@ -21,7 +21,9 @@ #include #include +#ifndef __linux__ #include +#endif #include #include #include diff --git a/glide3x/h5/glide3/tests/tlib.c b/glide3x/h5/glide3/tests/tlib.c index cd66f1a..083149f 100644 --- a/glide3x/h5/glide3/tests/tlib.c +++ b/glide3x/h5/glide3/tests/tlib.c @@ -2179,7 +2179,8 @@ tlScreenDump return FXTRUE; } -#if defined(__unix__) && !defined(__DJGPP__) +#ifdef __linux__ +#include /*------------------------------------------------------------------- Function: tlKbHit @@ -2194,7 +2195,7 @@ tlScreenDump nonzero if keys in queue -------------------------------------------------------------------*/ int tlKbHit( void ) { - return hwcKbHit(); + return lin_kbhit(); } FxBool tlErrorMessage( char *err) { @@ -2215,7 +2216,7 @@ tlErrorMessage( char *err) { character -------------------------------------------------------------------*/ char tlGetCH( void ) { - return hwcGetCH(); + return lin_getch(); } FxU32 diff --git a/glide3x/h5/minihwc/lin_mode.c b/glide3x/h5/minihwc/lin_mode.c index b129e23..be61879 100644 --- a/glide3x/h5/minihwc/lin_mode.c +++ b/glide3x/h5/minihwc/lin_mode.c @@ -1541,25 +1541,3 @@ void hwcSetSLIAAMode(hwcBoardInfo *bInfo, } } - -#include - -/*------------------------------------------------------------------- - Function: tlKbHit - Date: 2/28 - Implementor(s): jdt - Library: test library - Description: - Returns true if there are pending characters in the input queue - Arguments: - none - Return: - nonzero if keys in queue - -------------------------------------------------------------------*/ -int hwcKbHit( void ) { - return lin_kbhit(); -} - -char hwcGetCH( void ) { - return lin_getch(); -} diff --git a/glide3x/h5/minihwc/linhwc.c b/glide3x/h5/minihwc/linhwc.c index bf742a7..40a0f53 100644 --- a/glide3x/h5/minihwc/linhwc.c +++ b/glide3x/h5/minihwc/linhwc.c @@ -62,7 +62,7 @@ hwcCheckMemSize(hwcBoardInfo *bInfo, FxU32 xres, FxU32 yres, FxU32 nColBuffers, #include #include #include -#include +/*#include */ #include #include "lindri.h" @@ -79,8 +79,10 @@ static FxU32 __attribute_used fenceVar; # define P6FENCE asm volatile("mf.a" ::: "memory"); #elif defined (__alpha__) # define P6FENCE asm volatile("mb" ::: "memory"); -#else +#elif (defined(__i386__) || defined(__x86_64__)) # define P6FENCE asm("xchg %%eax, %0" : : "m" (fenceVar) : "eax"); +#else +# error "No P6FENCE asm for this architecture" #endif #define MAXFIFOSIZE 0x40000 @@ -972,28 +974,6 @@ void hwcSLIReadDisable(hwcBoardInfo *bInfo) #endif } -#include - -/*------------------------------------------------------------------- - Function: tlKbHit - Date: 2/28 - Implementor(s): jdt - Library: test library - Description: - Returns true if there are pending characters in the input queue - Arguments: - none - Return: - nonzero if keys in queue - -------------------------------------------------------------------*/ -int hwcKbHit( void ) { - return lin_kbhit(); -} - -char hwcGetCH( void ) { - return lin_getch(); -} - void grDRIImportFifo(int fifoPtr, int fifoRead) { _grImportFifo(fifoPtr, fifoRead); diff --git a/glide3x/sst1/glide3/src/makefile.linux b/glide3x/sst1/glide3/src/makefile.linux index 0956571..e11a381 100644 --- a/glide3x/sst1/glide3/src/makefile.linux +++ b/glide3x/sst1/glide3/src/makefile.linux @@ -121,7 +121,7 @@ ASFLAGS = -O6 -felf -D__linux__ ASFLAGS += $(CDEFS) # compiler -CFLAGS = -Wall -W +CFLAGS = -Wall CFLAGS += -I. -I../../incsrc -I../../init -I../../init/initvg -I../../init/init96 CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib @@ -190,7 +190,6 @@ GLIDE_OBJECTS += \ ../../init/init.o \ ../../init/vgdrvr.o \ ../../init/vg96drvr.o \ - ../../init/h3drvr.o \ ../../init/initvg/gamma.o \ ../../init/initvg/dac.o \ ../../init/initvg/video.o \ @@ -264,7 +263,7 @@ $(GLIDE_LIBDIR)/$(GLIDE_SO): $(GLIDE_LIBDIR)/$(GLIDE_SHARED) ln -fs $(GLIDE_SHARED) $(GLIDE_LIBDIR)/$(GLIDE_SO) $(GLIDE_LIBDIR)/$(GLIDE_SHARED): $(GLIDE_OBJECTS:.o=.lo) - $(CC) -o $@ -shared -Wl,-soname,$(GLIDE_SONAME) $^ $(LDFLAGS) $(LDLIBS) + $(CC) -o $@ -shared -Wl,--no-undefined -Wl,-soname,$(GLIDE_SONAME) $^ $(LDFLAGS) $(LDLIBS) $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB) ifeq ($(TEXUS2),1) diff --git a/glide3x/sst1/init/makefile.linux b/glide3x/sst1/init/makefile.linux index 2060972..f9c44ee 100644 --- a/glide3x/sst1/init/makefile.linux +++ b/glide3x/sst1/init/makefile.linux @@ -44,7 +44,7 @@ LCDEFS += -D$(INITHW) HEADERS = init.h sst1vid.h PRIVATE_HEADERS = fxinit.h INSTALL_DESTINATION = $(BUILD_ROOT_HW) -CFILES = init.c vgdrvr.c vg96drvr.c h3drvr.c +CFILES = init.c vgdrvr.c vg96drvr.c LIBRARIES = libinit.a diff --git a/glide3x/sst1/init/makefile.unix b/glide3x/sst1/init/makefile.unix index 7c12e8d..b8e3c6e 100644 --- a/glide3x/sst1/init/makefile.unix +++ b/glide3x/sst1/init/makefile.unix @@ -44,7 +44,7 @@ LCDEFS += -D$(INITHW) HEADERS = init.h sst1vid.h PRIVATE_HEADERS = fxinit.h INSTALL_DESTINATION = $(BUILD_ROOT_SST1) -CFILES = init.c vgdrvr.c vg96drvr.c h3drvr.c +CFILES = init.c vgdrvr.c vg96drvr.c LIBRARIES = libinit.a diff --git a/swlibs/fxmisc/fxos.c b/swlibs/fxmisc/fxos.c index f9cd663..08272d2 100644 --- a/swlibs/fxmisc/fxos.c +++ b/swlibs/fxmisc/fxos.c @@ -42,12 +42,12 @@ int fxGethostname(char *name, int n) #if !macintosh && !defined(__FreeBSD__) /* return current time in seconds (floating point) */ -float fxTime(void) -{ #if defined ( __sparc__ ) || defined ( __DJGPP__ ) /* times returns 0 in BSD Unix, so we use ftime instead */ -# include -# include +#include +#include +float fxTime(void) +{ struct timeb tb; static time_t once; // saves first time value @@ -55,21 +55,23 @@ float fxTime(void) if (once == 0) // stash away first call once = tb.time; // as float is not big enough return (tb.time - once) + tb.millitm * .001; - -#else -#if defined ( WIN32 ) || ( __DOS__ ) -# include -# define times(a) clock() -# define HZ CLOCKS_PER_SEC -#else -# include -# include -# include - struct tms foo; -#endif - return times(&foo)/(float)HZ; -#endif } +#elif defined ( WIN32 ) || ( __DOS__ ) +#include +float fxTime(void) +{ + return clock()/(float)CLOCKS_PER_SEC; +} +#else +#include +#include +#include +float fxTime(void) +{ + struct tms foo; + return times(&foo)/(float)HZ; +} +#endif /* returns elapsed time in seconds */ float timer(int flag)