Skip to content

Conversation

@Hapsa21
Copy link
Contributor

@Hapsa21 Hapsa21 commented Nov 14, 2025

This PR updates the src/bin/sage script to correctly handle the sage -b and sage-br flags for modern Meson-based builds.

The build_sage() function is modified to:

  1. Detect pure Meson builds: It now checks for the existence of build/build.ninja and other standard Meson build directories.
  2. Run ninja: If a Meson build is found, it correctly runs ninja -C build to build the project.
  3. Maintain compatibility: If no pure Meson build is found, it falls back to the existing ( cd "$SAGE_ROOT" && make sagelib-no-deps ) command. This ensures it still works for the current hybrid (make+meson) build system and older make-only builds.

Additionally, the sage -br flag is now marked as deprecated. It will print a warning message to stderr explaining that in an editable install, just running ./sage is a replacement. It still performs the build and runs Sage as it did before.

Fixes #41161.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

None.

@dimpase
Copy link
Member

dimpase commented Nov 15, 2025

Why would one need to detect the presence of meson files? They are where they should be, it's totally not needed.

Copy link
Member

@dimpase dimpase left a comment

Choose a reason for hiding this comment

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

and there is no need to invoke meson to mimic what sage -b used to do.
Just invoke ninja

@dimpase
Copy link
Member

dimpase commented Nov 15, 2025

we definitely don't care for old make-only compatibility

@dimpase
Copy link
Member

dimpase commented Nov 15, 2025

Instead of invoking the full meson build if no ninja files are found, just error out with the message to run make or meson instead.

Old habits die hard, we really don't want to encourage people running full builds using obscure non-standard options.

This PR should also modify docs accordingly.

Copy link
Member

@dimpase dimpase left a comment

Choose a reason for hiding this comment

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

If it's possible to detect that this is a non-editable install, error out with an appropriate message.

@Hapsa21
Copy link
Contributor Author

Hapsa21 commented Nov 15, 2025

@dimpase

build_sage() now checks for build/build.ninja and errors out if it's not there

I also updated the docs in startup.rst to match the new logic (If there are any other docs files that need changes then let me know).

this is what you had in mind right?

@Hapsa21 Hapsa21 requested a review from dimpase November 16, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix sage -b and sage -br

2 participants