From f36f4c9ddb9777f3286773742377010f168f017e Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 24 Apr 2010 21:38:39 +0000 Subject: [PATCH] Some fixes to make the amiga build work better. I finally installed gcc on my amiga, so there is a hope of getting a working build. Everything compiles but fails when linking, because I've not figured out how to install SDL. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1464 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/Makefile | 44 ++++++-------------------------------------- src/buttons.c | 27 +++++++++++++++------------ src/filesel.c | 20 +++++++++++--------- src/init.c | 10 ++++++---- src/io.c | 4 ++++ src/main.c | 9 ++++++++- src/realpath.c | 2 +- 7 files changed, 51 insertions(+), 65 deletions(-) diff --git a/src/Makefile b/src/Makefile index 71a7e08e..b1f1a81e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -59,19 +59,20 @@ else #For all other platforms, we can rely on uname PLATFORM = $(shell uname) - #AmigaOS4 specific + #AmigaOS (3 or 4) specific ifeq ($(PLATFORM),AmigaOS) # 1 DELCOMMAND = rm -rf MKDIR = mkdir -p RMDIR = rmdir CP = cp BIN = ../bin/grafx2 - COPT = -Wall -c -gstabs -mcrt=newlib `sdl-config --cflags` -I/SDK/Local/common/include/SDL -D__USE_INLINE__ $(TTFCOPT) + COPT = -Wall -c -gstabs `sdl-config --cflags` $(TTFCOPT) LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) -lft2 CC = gcc OBJDIR = ../obj/amiga ZIP = lha ZIPOPT = a + NOTTF = 1 else ifeq ($(PLATFORM),Darwin) # 2 @@ -129,21 +130,6 @@ else ZIPOPT = a PLATFORMFILES = ../misc/grafx2.info - else - ifeq ($(PLATFORM),AMIGA) # 5 - # AmigaOS 3.x specific (building with gcc) - DELCOMMAND = rm -rf - MKDIR = mkdir -p - RMDIR = rmdir - CP = cp - BIN = ../bin/grafx2 - COPT = -Wall -gstabs -c `sdl-config --cflags` $(TTFCOPT) - LOPT = -lSDL_image `sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT) -lfreetype - CC = gcc - OBJDIR = ../obj/amiga - ZIP = lha - ZIPOPT = a - else ifeq ($(PLATFORM),BeOS) # 6 #BeOS specific @@ -201,24 +187,6 @@ else OBJDIR = ../obj/unix X11LOPT = -lX11 CC = gcc - - else - ifeq ($(findstring Kickstart,$(shell version)),Kickstart) # 9 - # Classic amiga without gcc. Use vbcc. - PLATFORM = amiga-vbcc - DELCOMMAND = delete - MKDIR = makedir - RMDIR= delete - CP = copy - BIN = ../bin/grafx2 - COPT = -c99 -Ivbcc:PosixLib/include -D__amigaos__ $(TTFCOPT) - CC = vc - OBJDIR = ../obj/amiga-vbcc - ZIP = lha - ZIPOPT = a - - NOTTF = 1 - else # Finally, the default rules that work fine for most unix/gcc systems, linux and freebsd are tested. @@ -280,8 +248,6 @@ else endif endif endif - endif - endif endif ### BUILD SETTINGS are set according to vars set in the platform selection, the "overridable defaults", and environment variables set before launching make @@ -335,7 +301,9 @@ OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o SKIN_FILES = ../share/grafx2/skins/skin_classic.png ../share/grafx2/skins/skin_modern.png ../share/grafx2/skins/skin_DPaint.png ../share/grafx2/skins/font_Classic.png ../share/grafx2/skins/font_Fun.png ../share/grafx2/skins/font_Fairlight.png ../share/grafx2/skins/font_Melon.png ../share/grafx2/skins/font_DPaint.png ../share/grafx2/skins/skin_scenish.png ../share/grafx2/skins/font_Seen.png -SCRIPT_FILES = ../share/grafx2/scripts/bru_db_Amigaball.lua ../share/grafx2/scripts/bru_db_ColorSphere.lua ../share/grafx2/scripts/bru_db_FindAA.lua ../share/grafx2/scripts/bru_db_Fisheye.lua ../share/grafx2/scripts/bru_db_GrayscaleAvg.lua ../share/grafx2/scripts/bru_db_GrayscaleDesat.lua ../share/grafx2/scripts/bru_db_Halfsmooth.lua ../share/grafx2/scripts/bru_db_Mandelbrot.lua ../share/grafx2/scripts/bru_db_Waves.lua ../share/grafx2/scripts/pal_db_Desaturate.lua ../share/grafx2/scripts/pal_db_ExpandColors.lua ../share/grafx2/scripts/pal_db_FillColorCube.lua ../share/grafx2/scripts/pal_db_InvertedRGB.lua ../share/grafx2/scripts/pal_db_Set3bit.lua ../share/grafx2/scripts/pal_db_Set6bit.lua ../share/grafx2/scripts/pal_db_SetC64Palette.lua ../share/grafx2/scripts/pal_db_ShiftHue.lua ../share/grafx2/scripts/pic_db_Pic2isometric.lua ../share/grafx2/scripts/pic_db_Rainbow-Dark2Bright.lua ../share/grafx2/scripts/pic_db_SierpinskyCarpet.lua ../share/grafx2/scripts/pic_db_SierpinskyTriangle.lua ../share/grafx2/scripts/pic_ni_Colorspace12bit.lua ../share/grafx2/scripts/pic_ni_Colorspace15bit.lua ../share/grafx2/scripts/pic_ni_Colorspace18bit.lua ../share/grafx2/scripts/pic_ni_GlassGridFilter.lua ../share/grafx2/scripts/pic_ni_Grid8.lua ../share/grafx2/scripts/pic_ni_Grid8red.lua ../share/grafx2/scripts/pic_ni_GridIso.lua ../share/grafx2/scripts/pic_ni_PaletteX1.lua ../share/grafx2/scripts/pic_ni_PaletteX8.lua ../share/grafx2/scripts/scn_db_RemapImage2RGB.lua ../share/grafx2/scripts/scn_db_RemapImage2RGB_ed.lua ../share/grafx2/scripts/scn_db_RemapImageTo3bitPal.lua +SCRIPT_FILES1 = ../share/grafx2/scripts/bru_db_Amigaball.lua ../share/grafx2/scripts/bru_db_ColorSphere.lua ../share/grafx2/scripts/bru_db_FindAA.lua ../share/grafx2/scripts/bru_db_Fisheye.lua ../share/grafx2/scripts/bru_db_GrayscaleAvg.lua ../share/grafx2/scripts/bru_db_GrayscaleDesat.lua ../share/grafx2/scripts/bru_db_Halfsmooth.lua ../share/grafx2/scripts/bru_db_Mandelbrot.lua ../share/grafx2/scripts/bru_db_Waves.lua ../share/grafx2/scripts/pal_db_Desaturate.lua ../share/grafx2/scripts/pal_db_ExpandColors.lua ../share/grafx2/scripts/pal_db_FillColorCube.lua ../share/grafx2/scripts/pal_db_InvertedRGB.lua ../share/grafx2/scripts/pal_db_Set3bit.lua ../share/grafx2/scripts/pal_db_Set6bit.lua ../share/grafx2/scripts/pal_db_SetC64Palette.lua ../share/grafx2/scripts/pal_db_ShiftHue.lua ../share/grafx2/scripts/pic_db_Pic2isometric.lua ../share/grafx2/scripts/pic_db_Rainbow-Dark2Bright.lua ../share/grafx2/scripts/pic_db_SierpinskyCarpet.lua +SCRIPT_FILES2 = ../share/grafx2/scripts/pic_db_SierpinskyTriangle.lua ../share/grafx2/scripts/pic_ni_Colorspace12bit.lua ../share/grafx2/scripts/pic_ni_Colorspace15bit.lua ../share/grafx2/scripts/pic_ni_Colorspace18bit.lua ../share/grafx2/scripts/pic_ni_GlassGridFilter.lua ../share/grafx2/scripts/pic_ni_Grid8.lua ../share/grafx2/scripts/pic_ni_Grid8red.lua ../share/grafx2/scripts/pic_ni_GridIso.lua ../share/grafx2/scripts/pic_ni_PaletteX1.lua ../share/grafx2/scripts/pic_ni_PaletteX8.lua ../share/grafx2/scripts/scn_db_RemapImage2RGB.lua ../share/grafx2/scripts/scn_db_RemapImage2RGB_ed.lua ../share/grafx2/scripts/scn_db_RemapImageTo3bitPal.lua +SCRIPT_FILES1= SCRIPT_FILES1 SCRIPT_FILES2 ifeq ($(PLATFORM),Darwin) all : $(MACAPPEXE) diff --git a/src/buttons.c b/src/buttons.c index 02b5c470..7aec5f11 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -19,6 +19,21 @@ You should have received a copy of the GNU General Public License along with Grafx2; if not, see */ + +#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) + #include + #include + #include + #define isHidden(x) (0) +#elif defined(__WIN32__) + #include + #include + #define isHidden(x) (GetFileAttributesA((x)->d_name)&FILE_ATTRIBUTE_HIDDEN) +#else + #include + #define isHidden(x) ((x)->d_name[0]=='.') +#endif + #define _XOPEN_SOURCE 500 #include @@ -62,18 +77,6 @@ #define __attribute__(x) #endif -#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) - #include - #include - #define isHidden(x) (0) -#elif defined(__WIN32__) - #include - #include - #define isHidden(x) (GetFileAttributesA((x)->d_name)&FILE_ATTRIBUTE_HIDDEN) -#else - #include - #define isHidden(x) ((x)->d_name[0]=='.') -#endif extern char Program_version[]; // generated in pversion.c diff --git a/src/filesel.c b/src/filesel.c index fd8406ec..738bd94c 100644 --- a/src/filesel.c +++ b/src/filesel.c @@ -21,18 +21,10 @@ You should have received a copy of the GNU General Public License along with Grafx2; if not, see */ -#include -#include -#include -#include -#include -#include -#include -#include -#include #if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) #include + #include #include #define isHidden(x) (0) #elif defined(__WIN32__) @@ -44,6 +36,16 @@ #define isHidden(x) ((x)->d_name[0]=='.') #endif +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "const.h" #include "struct.h" #include "global.h" diff --git a/src/init.c b/src/init.c index 36f104bf..cfb3abc1 100644 --- a/src/init.c +++ b/src/init.c @@ -29,6 +29,12 @@ #if defined(__WIN32__) || defined(__linux__) #define GRAFX2_CATCHES_SIGNALS #endif + +#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) + #include + #include +#endif + #include //#include #include @@ -44,10 +50,6 @@ #if defined(__WIN32__) #include // GetLogicalDrives(), GetDriveType(), DRIVE_* #endif -#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__) - #include - #include -#endif #ifdef GRAFX2_CATCHES_SIGNALS #include #endif diff --git a/src/io.c b/src/io.c index cbc8d897..4707ed3c 100644 --- a/src/io.c +++ b/src/io.c @@ -299,6 +299,9 @@ int Lock_file_handle = -1; byte Create_lock_file(const char *file_directory) { + #ifdef __amigaos__ + #warning "Missing code for your platform, please check and correct!" + #else char lock_filename[MAX_PATH_CHARACTERS]; strcpy(lock_filename,file_directory); @@ -333,6 +336,7 @@ byte Create_lock_file(const char *file_directory) return -1; } #endif + #endif // __amigaos__ return 0; } diff --git a/src/main.c b/src/main.c index 999b24fb..80455c49 100644 --- a/src/main.c +++ b/src/main.c @@ -23,15 +23,22 @@ */ #define GLOBAL_VARIABLES +// time.h defines timeval which conflicts with the one in amiga SDK +#ifdef __amigaos__ + #include +#else + #include +#endif + #include #include #include #include -#include #include #include #include + // There is no WM on the GP2X... #ifndef __GP2X__ #include diff --git a/src/realpath.c b/src/realpath.c index 30a4af9c..34668c08 100644 --- a/src/realpath.c +++ b/src/realpath.c @@ -17,7 +17,7 @@ // the path. So this implementation is limited, it's really better to // use realpath() if your platform has it. - #if defined(__GP2X__) + #if defined(__GP2X__) || defined(__amigaos__) // This is a random default value ... #define PATH_MAX 32768 #endif