Skip to content

build: make --without-{python,perl,r} actually disable the language#12

Open
quinnjr wants to merge 1 commit into
FIUBioRG:masterfrom
quinnjr:bugfix/sconstruct-java-python-detection
Open

build: make --without-{python,perl,r} actually disable the language#12
quinnjr wants to merge 1 commit into
FIUBioRG:masterfrom
quinnjr:bugfix/sconstruct-java-python-detection

Conversation

@quinnjr

@quinnjr quinnjr commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

After PR #7 (SConstruct cleanup), the per-language --without-* flags only gated the SWIG wrapper invocation. The rest of the build was still unconditional, so e.g. --without-r would still:

  • Compile src/languages/R.cxx into pluma (the *.cxx glob in build_language_objects was unfiltered)
  • Link pluma against -lR -lRInside (hard-coded in program_libs)
  • Require PluginManager.h to include languages/R.h and push a MiAMi::R instance into supportedLanguages

This PR finishes the gating so --without-{python,perl,r} actually produces a binary that does not require the corresponding runtime at link or load time.

Changes

  • SConstruct:
    • `build_language_objects` filters the `src/languages/*.cxx` glob by a small `option → filename` map, so adding new gated languages is a one-liner.
    • `build_main_executable` composes `program_libs` conditionally based on which `--without-*` flags are set, instead of always emitting the full list.
  • PluginManager.h: wraps the language `#include` and `supported.push_back` calls in `#ifdef HAVE_PYTHON / HAVE_R / HAVE_PERL`, matching the existing `HAVE_JAVA` / `HAVE_RUST` pattern. `configure_python / configure_perl / configure_r` already set these defines only when the language is enabled, so no further SConstruct change is needed.

Scope notes

Test plan

  • `scons --without-r` produces a `pluma` binary that doesn't require libR/libRInside at link time
  • `scons --without-python` produces a binary that doesn't require libpython
  • `scons --without-perl` produces a binary that doesn't require libperl
  • `scons` (default, all enabled) still produces the same binary as before

@quinnjr quinnjr force-pushed the bugfix/sconstruct-java-python-detection branch from ada55e6 to ed68933 Compare May 14, 2026 15:54
The SCons cleanup that landed in PR FIUBioRG#7 made the swig wrapper command
itself conditional on each per-language option, but the rest of the
build was still unconditional. With --without-r the build still:

  - Compiled src/languages/R.cxx into pluma (build_language_objects
    globs *.cxx unfiltered)
  - Linked pluma against -lR -lRInside (program_libs hard-coded)
  - Required PluginManager.h to #include "languages/R.h" and push a
    MiAMi::R instance into supportedLanguages (also unconditional)

So the option appeared to do something during configure but the link
would still fail on hosts without R, defeating the point.

Gate the remainder:

  - build_language_objects filters the *.cxx glob by the disabled
    options. Driven by a small map of option name to filename so adding
    a new gated language is a one-line change.
  - build_main_executable composes program_libs based on which options
    are off, instead of dumping the full list.
  - PluginManager.h wraps the language #includes and the matching
    supported.push_back calls in #ifdef HAVE_PYTHON / HAVE_R / HAVE_PERL,
    matching the existing HAVE_JAVA / HAVE_RUST pattern. configure_python
    / configure_perl / configure_r already set those defines only when
    the language is enabled, so the guards work without any further
    SConstruct change.

Java is not gated here because --without-java is not declared in OPTIONS
yet (separate concern, handled in FIUBioRG#13); the existing HAVE_JAVA guard in
PluginManager.h remains.
@quinnjr quinnjr force-pushed the bugfix/sconstruct-java-python-detection branch from 76224fa to 8c941b8 Compare May 15, 2026 00:09
@quinnjr quinnjr changed the title fix(sconstruct): correct Java libjvm discovery and Python linking build: make --without-{python,perl,r} actually disable the language May 15, 2026
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.

1 participant