This core links whole vendored trees for the sake of a few entry points.
libspectrum calls BZ2_bzBuffToBuffDecompress and BZ2_bzDecompress*, and
nothing else in bzip2: its compression half and the FILE* API are dead.
Of libretro-common only the VFS, path and string helpers are used;
filestream_vscanf, filestream_copy and
fill_pathname_abbreviated_or_relative are not. Without -ffunction-sections
the linker's unit is the whole object file, so one live symbol keeps every
dead one beside it.
Trimming those functions out of the vendored sources would work and is the
wrong fix. Divergence between this tree's deps/libretro-common and
upstream is exactly what broke the six build-static jobs three commits
ago, and hand-editing bzip2's internals to split decompress from compress
buys the same problem in a second dependency. Give the linker per-symbol
granularity and let it decide instead of the source.
Dropped from the shared build, verified with nm: BZ2_hbMakeCodeLengths,
mainSort, fallbackSort, bzopen_or_bzdopen, filestream_vscanf,
filestream_copy, fill_pathname_abbreviated_or_relative. The export set is
unchanged - the same 47 retro_* symbols before and after, diffed
symbol for symbol.
Static-linking platforms get the compile flags but not --gc-sections: they
produce an archive and it is the frontend's link that resolves it, so the
sections are there for RetroArch's linker to use. The findstring guard on
SHARED keeps the link flag off emscripten, which sets no SHARED, and
theos_ios, which links through its own rules.
c6b73c1 removed USE_WIDGET from src/config_fuse.h, but fuse/config.h -
the file the compiler actually reads - is a build-time copy of that
template made by a rule with no prerequisites, so it is created once
and never refreshed. Every tree that had built any earlier commit
still had the old copy defining USE_WIDGET, which sent ui/ui.h:295
into the deleted ui/widget/widget.h and broke the build. make clean
does not remove the generated config either, so a clean rebuild in an
existing checkout failed the same way; only a fresh clone - the one
path that got tested - worked.
Three fixes, each closing a different layer of the hole:
- ui/ui.h no longer references the deleted header under any
preprocessor condition: the USE_WIDGET block is gone, along with
the ui_widget_finish() macro and the ui_widget_init()/
ui_widget_end() declarations and stubs, none of which had any
remaining caller. Even a config that still defines USE_WIDGET now
builds. fuse/menu.h (which included the deleted scaler.h) and
fuse/menu_data.pl (which generated the deleted widget menu data)
were the only other survivors referencing deleted files, verified
by sweeping every include in every tracked source against the
full 277-file deletion list; both are gone.
- The config.h copy rules now list their templates as
prerequisites, so a template change propagates into existing
trees instead of applying only to fresh clones. Without this,
no edit to src/config_fuse.h or src/config_libspectrum.h has
ever reached an already-built checkout.
- $(OBJS) now depends on both generated configs. They were fellow
prerequisites of $(TARGET), which under -j lets objects compile
concurrently with - and therefore possibly before - the config
regeneration, racing stale against fresh. This also gives the
dependency-tracking-free build the right semantic that a config
change rebuilds every object.
Verified on the actual failure path and its neighbours: a tree built
at the border-modes commit then upgraded to master builds with make
alone and with make clean, a tree built before the __LIBRETRO__
removal upgrades the same way, a fresh clone builds, and forcing
-DUSE_WIDGET onto the compiler builds too since nothing consults the
symbol any more. The upgraded-tree binary is byte-identical to the
fresh-clone binary, and the full issue #176/#177 verification matrix
plus border modes, savestate round trip and machine boots produce
identical results to the pre-breakage build.
Every one of the 46 __LIBRETRO__ conditionals in the tree guarded a
choice between "the libretro build" and "a build that cannot exist":
this repository has no other frontend, no configure script, and no way
to compile without the define. Keep the libretro side of each one,
delete the other, and stop defining the symbol in Makefile.libretro,
the 22 build/Makefile.* platform files, etc/mkmake.lua and
build/jni/Android.mk.
Everything was stripped mechanically with unifdef -D__LIBRETRO__; the
only hand edits are in fuse/peripherals/joystick.c, where the comment
above the now-unconditional joy_kempston enable described the deleted
condition, and libspectrum/snap_accessors.txt, where the %ifdef around
the TurboSound fields is gone so accessor.pl regenerates exactly the
stripped snap_accessors.c (verified: the regenerated file is
byte-identical).
What falls out:
- machine.h/spectrum.h/periph.c/unittests.c: one
spectrum_unattached_port signature (taking the port, for floating
bus emulation) instead of two.
- ay.c/ay.h/machine.h/szx.c/snap_accessors.*/z80.c: the TurboSound
second AY and its AY2 snapshot chunk are simply part of the core.
- joystick.c/settings.c/widget.c: the libretro joystick-mapping
behaviour (frontend port wiring is authoritative, joy_kempston
always enabled on snapshot load, no joystick_N_output defaults) is
now the only behaviour, unconditionally.
- snapshot.c/snapshot.h: the peripheral-override hook from ad7e52f
is unconditional.
- szx.c: the fixed-size savestate padding (0xFF tail and fake
0xFFFFFFFF chunk) and AY2 chunk read/write are unconditional.
No functional change. The built core contains no __LIBRETRO__ string,
and the full verification matrix from issues #176 and #177 - Kempston
Mouse hotplug and Fuller joystick wiring with and without fastload,
option flips mid-autoload, all five border modes measured from the
framebuffer, machine boots, and a savestate round trip - produces
identical reset counts, port reads, framebuffer hashes and audio
sample counts to the build before this change.
The libnx platform block defines RARCH_INTERNAL for the whole build.
compat/strl.h reads that as "we are being compiled inside RetroArch's
source tree" and reacts by pulling in RetroArch's own config.h:
#if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H)
#include "../../../config.h"
#endif
That relative path only resolves in RetroArch's layout. Here
libretro-common is vendored under deps/, so it lands on deps/config.h and
the build stops:
./deps/libretro-common/include/compat/strl.h:39:10: fatal error:
../../../config.h: No such file or directory
make: *** [deps/libretro-common/vfs/vfs_implementation.o] Error 1
The condition needs both macros, which is why this only shows up on
libnx: every other platform sets HAVE_CONFIG_H but not RARCH_INTERNAL,
so the include is skipped and the same sources compile.
Compile the vendored objects with RARCH_INTERNAL undefined via their own
pattern rule, leaving the rest of the build untouched - the core's own
objects still see the platform's flags exactly as before. Verified by
compiling all twelve vendored sources with -DRARCH_INTERNAL
-DHAVE_CONFIG_H (the libnx combination) and by confirming the rule fires
only for deps/libretro-common. The unix build is unchanged, warning set
and oracles included.