Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL #5

Closed
MBeijer opened this issue Feb 8, 2018 · 29 comments
Closed

SDL #5

MBeijer opened this issue Feb 8, 2018 · 29 comments
Assignees
Labels
close pending waiting for feedback to close this issue reminder not a real issue

Comments

@MBeijer
Copy link
Contributor

MBeijer commented Feb 8, 2018

I noticed that you finally added the SDK SDL. I'm curious of how the SDK install works.

The repository https://github.com/AmigaPorts/libSDL12 has SDL 1.2.15, reworked for AmigaOS3.x with a bunch of bug-fixes over 1.2.6, like fullscreen finally works. As well as AMMX extras working for Vampire cards to get some extra speed with the blitter.

The functioning makefile in this repository is Makefile.bax. The prefix is wrong but the rest should be correct.

The Vampire specific functions are defined in an vasm assembler file, that is compiled with VASM and then included in the gcc linker.

The Apollo/Vampire specifics seem to be in here: https://github.com/AmigaPorts/libSDL12/tree/master/video/apollo

The Apollo/Vampire specifics are designed to only be used if the Apollo based CPU is identified. So it will work on 020, 030, 040 and 060 just as well!

I think Makefile.bax is pretty self explanatory! =)

I need to know how I could implement this in the SDK install process, so we can leave the bug-ridden SDL 1.2.6 from Aminet behind, once and for all!

@bebbo
Copy link
Owner

bebbo commented Feb 8, 2018

You have to make a decision:
a) provide a sdk file
use this to install precompile binaries
b) provide a Makefile snippet
this gets added to the Makefile itself. Maybe we find a comfortable way to provide separate Makefiles for such a purpose.

A simple starting point is the integration of libdebug:

# =================================================
# libdebug
# =================================================
CONFIG_LIBDEBUG = --prefix=$(PREFIX) --target=m68k-amigaos --host=m68k-amigaos 

libdebug: build/libdebug/_done

build/libdebug/_done: build/libdebug/Makefile
	cd build/libdebug && $(MAKE)
	cp build/libdebug/libdebug.a $(PREFIX)/m68k-amigaos/lib/
	echo "done" >build/libdebug/_done

build/libdebug/Makefile: build/libnix/Makefile projects/libdebug/configure $(shell find 2>/dev/null projects/libdebug -not \( -path projects/libdebug/.git -prune \) -type f)
	mkdir -p build/libdebug
	cd build/libdebug && $(A) $(PWD)/projects/libdebug/configure $(CONFIG_LIBDEBUG)

projects/libdebug/configure:
	@mkdir -p projects
	cd projects &&	git clone -b master --depth 4 https://github.com/bebbo/libdebug

projects/libdebug/configure is a file which always exists after cloning.

Here is a configure command invoked to create the Makefile in the build folder.
Otherwise I use rsync to copy all files.

Then I invoke the makefile and install the files.

@bebbo
Copy link
Owner

bebbo commented Feb 8, 2018

first try:

CONFIG_LIBSDL12 = PREFX=$(PREFIX) PREF=$(PREFIX)  

libSDL12: build/libSDL12/_done

build/libSDL12/_done: build/libSDL12/Makefile.bax
	cd build/libSDL12 && $(MAKE) -f Makefile.bax $(CONFIG_LIBSDL12)
	cp build/libSDL12/libsdl.a $(PREFIX)/m68k-amigaos/lib/
	echo "done" >build/libsdl/_done

build/libSDL12/Makefile.bax: build/libnix/Makefile projects/libSDL12/Makefile.bax $(shell find 2>/dev/null projects/libSDL12 -not \( -path projects/libSDL12/.git -prune \) -type f)
	mkdir -p build/libSDL12
	rsync -a projects/libSDL12/* build/libSDL12 

projects/libSDL12/Makefile.bax:
	@mkdir -p projects
	cd projects &&	git clone -b master --depth 4  https://github.com/AmigaPorts/libSDL12

@bebbo
Copy link
Owner

bebbo commented Feb 8, 2018

./include/SDL_stdinc.h:66:23: fatal error: inttypes.h: No such file or directory
 # include <inttypes.h>

@MBeijer
Copy link
Contributor Author

MBeijer commented Feb 8, 2018

I have asked Henryk Richter (author of the libSDL12 repo) to join us in this issue with his input. So please leave this open. :)

@MBeijer
Copy link
Contributor Author

MBeijer commented Feb 8, 2018

inttypes.h is always an issue for me with your toolchain, which is why I have added my own inttypes.h file in /opt/m68k-amigaos/include:

/*
 * Copyright (c) 2004, 2005 by
 * Ralf Corsepius, Ulm/Germany. All rights reserved.
 *
 * Permission to use, copy, modify, and distribute this software
 * is freely granted, provided that this notice is preserved.
 */

/**
 *  @file  inttypes.h
 */

#ifndef _INTTYPES_H
#define _INTTYPES_H

#include <stdint.h>
#define __need_wchar_t
#include <stdlib.h>

#define __STRINGIFY(a) #a

/* 8-bit types */
#define __PRI8(x) __STRINGIFY(x)
#define __SCN8(x) __STRINGIFY(hh##x)


#define PRId8           __PRI8(d)
#define PRIi8           __PRI8(i)
#define PRIo8           __PRI8(o)
#define PRIu8           __PRI8(u)
#define PRIx8           __PRI8(x)
#define PRIX8           __PRI8(X)

#define SCNd8           __SCN8(d)
#define SCNi8           __SCN8(i)
#define SCNo8           __SCN8(o)
#define SCNu8           __SCN8(u)
#define SCNx8           __SCN8(x)


#define PRIdLEAST8      __PRI8(d)
#define PRIiLEAST8      __PRI8(i)
#define PRIoLEAST8      __PRI8(o)
#define PRIuLEAST8      __PRI8(u)
#define PRIxLEAST8      __PRI8(x)
#define PRIXLEAST8      __PRI8(X)

#define SCNdLEAST8      __SCN8(d)
#define SCNiLEAST8      __SCN8(i)
#define SCNoLEAST8      __SCN8(o)
#define SCNuLEAST8      __SCN8(u)
#define SCNxLEAST8      __SCN8(x)


#define PRIdFAST8       __PRI8(d)
#define PRIiFAST8       __PRI8(i)
#define PRIoFAST8       __PRI8(o)
#define PRIuFAST8       __PRI8(u)
#define PRIxFAST8       __PRI8(x)
#define PRIXFAST8       __PRI8(X)

#define SCNdFAST8       __SCN8(d)
#define SCNiFAST8       __SCN8(i)
#define SCNoFAST8       __SCN8(o)
#define SCNuFAST8       __SCN8(u)
#define SCNxFAST8       __SCN8(x)

/* 16-bit types */
#define __PRI16(x) __STRINGIFY(x)
#define __SCN16(x) __STRINGIFY(h##x)


#define PRId16          __PRI16(d)
#define PRIi16          __PRI16(i)
#define PRIo16          __PRI16(o)
#define PRIu16          __PRI16(u)
#define PRIx16          __PRI16(x)
#define PRIX16          __PRI16(X)

#define SCNd16          __SCN16(d)
#define SCNi16          __SCN16(i)
#define SCNo16          __SCN16(o)
#define SCNu16          __SCN16(u)
#define SCNx16          __SCN16(x)


#define PRIdLEAST16     __PRI16(d)
#define PRIiLEAST16     __PRI16(i)
#define PRIoLEAST16     __PRI16(o)
#define PRIuLEAST16     __PRI16(u)
#define PRIxLEAST16     __PRI16(x)
#define PRIXLEAST16     __PRI16(X)

#define SCNdLEAST16     __SCN16(d)
#define SCNiLEAST16     __SCN16(i)
#define SCNoLEAST16     __SCN16(o)
#define SCNuLEAST16     __SCN16(u)
#define SCNxLEAST16     __SCN16(x)


#define PRIdFAST16      __PRI16(d)
#define PRIiFAST16      __PRI16(i)
#define PRIoFAST16      __PRI16(o)
#define PRIuFAST16      __PRI16(u)
#define PRIxFAST16      __PRI16(x)
#define PRIXFAST16      __PRI16(X)

#define SCNdFAST16      __SCN16(d)
#define SCNiFAST16      __SCN16(i)
#define SCNoFAST16      __SCN16(o)
#define SCNuFAST16      __SCN16(u)
#define SCNxFAST16      __SCN16(x)

/* 32-bit types */
#if __have_long32
#define __PRI32(x) __STRINGIFY(l##x)
#define __SCN32(x) __STRINGIFY(l##x)
#else
#define __PRI32(x) __STRINGIFY(x)
#define __SCN32(x) __STRINGIFY(x)
#endif

#define PRId32          __PRI32(d)
#define PRIi32          __PRI32(i)
#define PRIo32          __PRI32(o)
#define PRIu32          __PRI32(u)
#define PRIx32          __PRI32(x)
#define PRIX32          __PRI32(X)

#define SCNd32          __SCN32(d)
#define SCNi32          __SCN32(i)
#define SCNo32          __SCN32(o)
#define SCNu32          __SCN32(u)
#define SCNx32          __SCN32(x)


#define PRIdLEAST32     __PRI32(d)
#define PRIiLEAST32     __PRI32(i)
#define PRIoLEAST32     __PRI32(o)
#define PRIuLEAST32     __PRI32(u)
#define PRIxLEAST32     __PRI32(x)
#define PRIXLEAST32     __PRI32(X)

#define SCNdLEAST32     __SCN32(d)
#define SCNiLEAST32     __SCN32(i)
#define SCNoLEAST32     __SCN32(o)
#define SCNuLEAST32     __SCN32(u)
#define SCNxLEAST32     __SCN32(x)


#define PRIdFAST32      __PRI32(d)
#define PRIiFAST32      __PRI32(i)
#define PRIoFAST32      __PRI32(o)
#define PRIuFAST32      __PRI32(u)
#define PRIxFAST32      __PRI32(x)
#define PRIXFAST32      __PRI32(X)

#define SCNdFAST32      __SCN32(d)
#define SCNiFAST32      __SCN32(i)
#define SCNoFAST32      __SCN32(o)
#define SCNuFAST32      __SCN32(u)
#define SCNxFAST32      __SCN32(x)


/* 64-bit types */
#if __have_longlong64
#define __PRI64(x) __STRINGIFY(ll##x)
#define __SCN64(x) __STRINGIFY(ll##x)
#elif __have_long64
#define __PRI64(x) __STRINGIFY(l##x)
#define __SCN64(x) __STRINGIFY(l##x)
#else
#define __PRI64(x) __STRINGIFY(x)
#define __SCN64(x) __STRINGIFY(x)
#endif

#define PRId64          __PRI64(d)
#define PRIi64          __PRI64(i)
#define PRIo64          __PRI64(o)
#define PRIu64          __PRI64(u)
#define PRIx64          __PRI64(x)
#define PRIX64          __PRI64(X)

#define SCNd64          __SCN64(d)
#define SCNi64          __SCN64(i)
#define SCNo64          __SCN64(o)
#define SCNu64          __SCN64(u)
#define SCNx64          __SCN64(x)

#if __int64_t_defined
#define PRIdLEAST64     __PRI64(d)
#define PRIiLEAST64     __PRI64(i)
#define PRIoLEAST64     __PRI64(o)
#define PRIuLEAST64     __PRI64(u)
#define PRIxLEAST64     __PRI64(x)
#define PRIXLEAST64     __PRI64(X)

#define SCNdLEAST64     __SCN64(d)
#define SCNiLEAST64     __SCN64(i)
#define SCNoLEAST64     __SCN64(o)
#define SCNuLEAST64     __SCN64(u)
#define SCNxLEAST64     __SCN64(x)


#define PRIdFAST64      __PRI64(d)
#define PRIiFAST64      __PRI64(i)
#define PRIoFAST64      __PRI64(o)
#define PRIuFAST64      __PRI64(u)
#define PRIxFAST64      __PRI64(x)
#define PRIXFAST64      __PRI64(X)

#define SCNdFAST64      __SCN64(d)
#define SCNiFAST64      __SCN64(i)
#define SCNoFAST64      __SCN64(o)
#define SCNuFAST64      __SCN64(u)
#define SCNxFAST64      __SCN64(x)
#endif

/* max-bit types */
#if __have_longlong64
#define __PRIMAX(x) __STRINGIFY(ll##x)
#define __SCNMAX(x) __STRINGIFY(ll##x)
#elif __have_long64
#define __PRIMAX(x) __STRINGIFY(l##x)
#define __SCNMAX(x) __STRINGIFY(l##x)
#else
#define __PRIMAX(x) __STRINGIFY(x)
#define __SCNMAX(x) __STRINGIFY(x)
#endif

#define PRIdMAX         __PRIMAX(d)
#define PRIiMAX         __PRIMAX(i)
#define PRIoMAX         __PRIMAX(o)
#define PRIuMAX         __PRIMAX(u)
#define PRIxMAX         __PRIMAX(x)
#define PRIXMAX         __PRIMAX(X)

#define SCNdMAX         __SCNMAX(d)
#define SCNiMAX         __SCNMAX(i)
#define SCNoMAX         __SCNMAX(o)
#define SCNuMAX         __SCNMAX(u)
#define SCNxMAX         __SCNMAX(x)

/* ptr types */
#if __have_longlong64
#define __PRIPTR(x) __STRINGIFY(ll##x)
#define __SCNPTR(x) __STRINGIFY(ll##x)
#elif __have_long64
#define __PRIPTR(x) __STRINGIFY(l##x)
#define __SCNPTR(x) __STRINGIFY(l##x)
#else
#define __PRIPTR(x) __STRINGIFY(x)
#define __SCNPTR(x) __STRINGIFY(x)
#endif

#define PRIdPTR         __PRIPTR(d)
#define PRIiPTR         __PRIPTR(i)
#define PRIoPTR         __PRIPTR(o)
#define PRIuPTR         __PRIPTR(u)
#define PRIxPTR         __PRIPTR(x)
#define PRIXPTR         __PRIPTR(X)

#define SCNdPTR         __SCNPTR(d)
#define SCNiPTR         __SCNPTR(i)
#define SCNoPTR         __SCNPTR(o)
#define SCNuPTR         __SCNPTR(u)
#define SCNxPTR         __SCNPTR(x)


typedef struct {
  intmax_t      quot;
  intmax_t      rem;
} imaxdiv_t;

#ifdef __cplusplus
extern "C" {
#endif

extern intmax_t  imaxabs(intmax_t j);
extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denomer);
extern intmax_t  strtoimax(const char *__restrict, char **__restrict, int);
extern uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
extern intmax_t  wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
extern uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);

#ifdef __cplusplus
}
#endif

#endif

@MBeijer
Copy link
Contributor Author

MBeijer commented Feb 8, 2018

I believe I've mentioned this before, but been told I've done something wrong. Eventually I just added the file myself.

It's required for me to compile MilkyTracker as well.

@MBeijer
Copy link
Contributor Author

MBeijer commented Feb 8, 2018

I don't know how much of this file is actually needed.

@bebbo
Copy link
Owner

bebbo commented Feb 8, 2018

I'll add it to ixemul --> ends up in sys-includes

next:

ideo/amigaos/SDL_cgxvideo.c:40:41: fatal error: cybergraphics/cybergraphics.h: No such file or directory
 #include <cybergraphics/cybergraphics.h>

it depends on the cgx.sdk

@bebbo
Copy link
Owner

bebbo commented Feb 8, 2018

but there it is CGraphX/C/Include/cybergraphx/cybergraphics.h

@MBeijer
Copy link
Contributor Author

MBeijer commented Feb 8, 2018

Yeah, for some reason the include path for cybergraphics has changed between cybergraphx and cybergraphics between generations. While one is still used in MorphOS, another is used in your toolchain. And depending on source I've been working with it's been switched around. Pretty stupid.
How does the toolchain handle symlinks?

@bebbo
Copy link
Owner

bebbo commented Feb 8, 2018

if symlinks exists, they are used :-)
I could add symlink creation to sdk install

@bebbo
Copy link
Owner

bebbo commented Feb 8, 2018

next one:

-I/opt/amiga/os-include

should be
/$(PREFX)/m68k-amigaos/sys-include

no?

@MBeijer
Copy link
Contributor Author

MBeijer commented Feb 8, 2018

yup, it differs on older GCC toolchains, especially if you use the old gg toolchain in Workbench

@MBeijer
Copy link
Contributor Author

MBeijer commented Feb 8, 2018

I added you to the SDL team on AmigaPorts. Feel free to make changes to the libSDL12 repo.

@bebbo
Copy link
Owner

bebbo commented Feb 8, 2018

I will look tomorrow - I pushed what I already did.

@bebbo
Copy link
Owner

bebbo commented Feb 11, 2018

make libSDL12 is built now.

But the headers are currently not installed, because I don't like the fact that all headers are duplicated.
I'd prefer having the SDL headers in the SDL folder.

@MBeijer
Copy link
Contributor Author

MBeijer commented Feb 11, 2018 via email

@HenrykRichter
Copy link

I knew that this thing would be going to haunt me. Yes, you both are absolutely right. There are redundant files in this particular Amiga SDL port. I didn't find time and motivation to clean the source up, as of yet.

FWIW, I've deleted the superfluous includes and kept only the SDL subdirectory. The lib builds just as fine. As Bebbo pointed out, inttypes.h is not really necessary to build SDL itself. Hence, it is disabled now in SDL_config_amigaos.h.

Hope it helps along a little.

@MBeijer
Copy link
Contributor Author

MBeijer commented Feb 12, 2018

Thanks for that! :)

Bebbo:
One request I have is that I'd like it if the SDL includes ends up in /opt/m68k-amigaos/include/ SDL/ rather than /opt/m68k-amigaos/m68k-amigaos/include/ so system specific includes doesn't get mixed in with ported libs and such.

@bebbo
Copy link
Owner

bebbo commented Feb 12, 2018

now the SDL and GL folders are copied.

@MBeijer
Copy link
Contributor Author

MBeijer commented Feb 13, 2018

As a side-note, I intend to apply the fixes from the libSDL12 repo to the AmigaPorts/SDL repo. When it's time to switch I'll let you know. Until then libSDL12 serves its purpose.

bebbo added a commit that referenced this issue Feb 13, 2018
@MBeijer
Copy link
Contributor Author

MBeijer commented Feb 14, 2018

Awesome, thank you! :) 👍

@MBeijer
Copy link
Contributor Author

MBeijer commented Mar 5, 2018

Make-script fails at libSDL12:

make[2]: Leaving directory '/home/marlon/tmp/Programming/Amiga/Tools/amiga-gcc'
make[1]: Leaving directory '/home/marlon/tmp/Programming/Amiga/Tools/amiga-gcc'
cd build/libSDL12 && "CFLAGS=-Os -g -fomit-frame-pointer" make -f Makefile.bax PREFX=/opt/m68k-amigaos PREF=/opt/m68k-amigaos
/bin/bash: CFLAGS=-Os -g -fomit-frame-pointer: command not found
make: *** [Makefile:623: build/libSDL12/_done] Error 127

@MBeijer
Copy link
Contributor Author

MBeijer commented Mar 5, 2018

Simply moving the first " from "CFLAGS= to CFLAGS=" fixes this.

bebbo added a commit that referenced this issue Mar 5, 2018
@bebbo
Copy link
Owner

bebbo commented Mar 5, 2018

... happens :-)

@bebbo
Copy link
Owner

bebbo commented Apr 1, 2018

what's left to do here?

@MBeijer
Copy link
Contributor Author

MBeijer commented Apr 3, 2018

Nothing until we're/I'm done merging the libSDL12 repo into the AmigaPorts/SDL/SDL-1.2 branch, which is a lot of manual work!

@bebbo bebbo added reminder not a real issue close pending waiting for feedback to close this issue labels Jun 3, 2018
@bebbo
Copy link
Owner

bebbo commented Jun 14, 2018

reopened if necessary

@bebbo bebbo closed this as completed Jun 14, 2018
@arczi84
Copy link

arczi84 commented Jan 27, 2019

"Fire-0.3" demo from https://su2.info/demos/
displays only half of particles on the screen.
Tried various -O flags with same result.
Works on older gcc's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
close pending waiting for feedback to close this issue reminder not a real issue
Projects
None yet
Development

No branches or pull requests

4 participants