SGDK icon indicating copy to clipboard operation
SGDK copied to clipboard

Separate the library and the toolchain

Open LukeUsher opened this issue 6 years ago • 6 comments

In order to allow easier updates when using an alternative toolchain, for example, using Linux with the gendev script, I think it would be much more convenient if the SGDK libraries could be in their own repository, separate from the precompiled toolchain binaries. This way it would be possible to integrate SGDK as a sub-module in another repository and keep it synced with upstream.

The current behavior of including windows binaries is nice for Windows users, and could be preserved by providing an SGDK-windows repository that brings in the parent SGDK repository as a submodule, alongside the precompiled tools

LukeUsher avatar Jan 02 '18 13:01 LukeUsher

As a user of gendev, I very much agree with this.

On 3 January 2018 at 00:28, Luke Usher [email protected] wrote:

In order to allow easier updates when using an alternative toolchain, for example, using Linux with the gendev script, I think it would be much more convenient if the SGDK libraries could be in their own repository, separate from the precompiled toolchain binaries. This way it would be possible to integrate SGDK as a sub-module in another repository and keep it synced with upstream.

The current behavior of including windows binaries is nice for Windows users, and could be preserved by providing an SGDK-windows repository that brings in the parent SGDK repository as a submodule, alongside the precompiled tools

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Stephane-D/SGDK/issues/105, or mute the thread https://github.com/notifications/unsubscribe-auth/ATjMoAe--2b-18GngkeMAEaAD46xCf5Wks5tGi8MgaJpZM4RQnCa .

minerscale avatar Jan 02 '18 23:01 minerscale

Also a Gendev user here and I think this would be a good idea too.

Sentient68k avatar Dec 25 '18 04:12 Sentient68k

I agree. Even when using Windows, sometimes you might not want to use the compiler included in SGDK (I use other with newlib support).

doragasu avatar Apr 19 '20 19:04 doragasu

I am willing to work in this direction and submit pull-requests, but I do not know if @Stephane-D would be interested in merging these kind of changes. Any words about it?

doragasu avatar Dec 19 '21 17:12 doragasu

I am developing on ubuntu (22.10) and use the default m68k compiler/toolchain from the ubuntu repository (currently version 11.3.0): sudo apt install gcc-m68k-linux-gnu g++-m68k-linux-gnu

For the build I installed the package of gendev bundling SGDK and another (9.3.0 = in my opinion outdated) m68k toolchain (omitting in favor of ubuntu one).

The SGDK provided Makefile for building roms just needs to be changed for the toolchain part:

BIN := /usr/bin/m68k-linux-gnu-

CC := $(BIN)gcc
CPP := $(BIN)g++
LD := $(BIN)ld
NM := $(BIN)nm
OBJCPY := $(BIN)objcopy

Compiling c and c++ code into a rom worked flawlessly until now. Roms start and run.

So the parts really required from SGDK are:

  • sega.s
  • rom_head.c (as a template)
  • md.ld
  • libgcc.a (optional! can be replaced by ubuntu one: /usr/lib/gcc-cross/m68k-linux-gnu/11/libgcc.a)
  • libmd.a (optional? currently required to build sega.s)

jagiella avatar Jun 22 '22 09:06 jagiella

@jagiella latest SGDK does already allow toolchain separation with the common.mk file used to define the compiler path. It should almost work out of the box for you, except maybe the missing g++ binding (it can be added eventually even if SGDK is 100% C for now)

Stephane-D avatar Jun 22 '22 10:06 Stephane-D