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

Metadata for Tup build systems #16

Merged
merged 3 commits into from
Mar 3, 2019
Merged

Metadata for Tup build systems #16

merged 3 commits into from
Mar 3, 2019

Conversation

ehmry
Copy link
Contributor

@ehmry ehmry commented Mar 3, 2019

This pull request is for adding some minimal metadata for Tup build systems. Each core gets a Tupfile that loads rules from a parent directory above this repository.

I am moving the Libretro build system for the Genode platform from Make to a Tup super-repo using Git submodules. By adding this metadata "upstream" I only build these cores if the core submodule is checked out. I build all the cores at once so that I can tweak things like the linker and see the effects on every core. As an example my build rules that sit above this submodule are here: https://github.com/ehmry/genode-emery/blob/tup/libretro/cores/samples/Tuprules.tup.

If this is okay, I will start adding tupfiles to the other core repositories as I port them to Genode. To keep this nice and tidy I don't want to duplicate any information with the makefiles other than TARGET_NAME and CORE_DIR, my intention is to move messy platform rules out of the core repositories.

ehmry added 3 commits March 3, 2019 11:51
The MIDI test is not silent, but does not use sampled audio.
Return false from retro_load_game if
RETRO_ENVIRONMENT_GET_MIDI_INTERFACE is unavailable.
Add minimal metadata for a Tup build system. Tup will discover any file
named "Tupfile" in a the sub-directories where it is run. In this case a
tupfile defines the core name and invokes the "include_rules" directive,
which will include the Tup rules defined in parent directories. This
allows a parent repository with platform-specific build rules to host
this repository as a submodule. The sample cores may thus be ported to
new platforms without polluting the local makefiles. Naturally the
external build rules must be synchronized with the source code herein,
the tupfiles here only define TARGET_NAME so that they will never
contradict information contained in the makefiles.

A sample Tuprules.tup for a super-repository:

ifeq ($(TARGET_NAME),advanced_tests)
	CFLAGS += -I../../libretro-common/include
	SOURCES_C += libretro-test.c
endif
CFLAGS += -O3 -Wall -pedantic -std=gnu99
: foreach $(SOURCES_C) |> !libretro_cc |> {objs}
: {objs} |> !libretro_ld |> $(TARGET_NAME)_libretro.so
@ehmry
Copy link
Contributor Author

ehmry commented Mar 3, 2019

Also, some minor patches to make testing cores easier for me.

@inactive123 inactive123 merged commit 10b07cf into libretro:master Mar 3, 2019
@RobLoach
Copy link
Member

RobLoach commented Mar 10, 2019

Why Tup? Looks the same as a Makefile...

Some questions...

  • Are we duplicating effort?
  • Can you install make on Genode?
  • What rules out other widely adopted build systems like CMake?

@@ -190,7 +190,7 @@ void retro_get_system_av_info(struct retro_system_av_info *info)
info->geometry.max_height = HEIGHT;
info->geometry.max_width = WIDHT;
info->timing.fps = FPS;
info->timing.sample_rate = 48000.0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the midi test may need a sample rate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MIDI test discards the sampled audio callbacks from the frontend, so I assumed there would be no need for a sample rate.

@ehmry
Copy link
Contributor Author

ehmry commented Mar 12, 2019

@RobLoach Tup is different from Make and CMake in that the build metadata is at the bottom of the tree rather than the top, so the build system gets rooted somewhere and searches its subdirectories for Tupfiles, and builds its recipes from the sum of these. This allows it to build a bunch of smaller git repositories as one big job, which is useful to me because I'm building the Genode frontend, all the ported cores, and the packaging metadata at once.

Some of the cores are already ported to Genode and have Make rules, but as I see it this is mostly duplicated effort because I have to commit the Genode build rules in each core repository, and I'm not confident that I wouldn't want to changes these rules in the future. This also encourages a clean separation of generic and platfrom build info between Makefile.libretro and Makefile.common because Tup can parse parse simple Makefile.common files.

Also, this saves me and maybe others from having to integrate our exotic platforms into libretro-super.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants