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

stdenv/generic/setup.sh: extract Make logic #298838

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from

Conversation

ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented Mar 25, 2024

Description of changes

Extract Make-based build process into separated Bash functions to make them reusable by packages, making them reusable by packages using a language- or framework-specific build helpers that rewrite the phases.

Proposed Bash functions containing the make-related logic:

  • makeBuild
  • makeCheck
  • makeInstall
  • makeInstallCheck

Name each Make-based phases make*Phase and specify *Phase=make*Phase by default. This makes it align with build process based on other build tools such as CMake. Withhold due to the scale of fixes regarding the wide-spread "phases are Bash function" assumption. See #299045.

Use apptainer as an example how packages using buildGoModule could benefit from the Make-based build commands provided by stdenv.mkDerivation.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Mar 25, 2024
@ShamrockLee ShamrockLee changed the base branch from master to staging March 25, 2024 04:37
@ShamrockLee ShamrockLee changed the title Stdenv make logic stdenv/generic/setup.sh: extract Make logic Mar 25, 2024
@ofborg ofborg bot added 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild 10.rebuild-linux-stdenv This PR causes stdenv to rebuild labels Mar 25, 2024
@ofborg ofborg bot requested a review from jbedo March 25, 2024 06:37
@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Mar 26, 2024

It is a known issue that singularity currently fails to create images on aarch64-linux, and couldn't run images on all platforms (#295809).

@ofborg build singularity apptainer apptainer.tests

@ShamrockLee ShamrockLee force-pushed the stdenv-make-logic branch 2 times, most recently from 4b3e961 to a3194f2 Compare March 26, 2024 17:09
@ShamrockLee
Copy link
Contributor Author

@ofborg build apptainer singularity

@ShamrockLee
Copy link
Contributor Author

Test cases produced with testers.runNixOSTest is complaining TimeoutError. Is it normal on a world rebuild?

@ofborg build tests.testers.runNixOSTest-example

@ShamrockLee ShamrockLee marked this pull request as ready for review March 26, 2024 22:42
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label May 3, 2024
@ShamrockLee
Copy link
Contributor Author

Rebased it and resolved the merge conflict.

@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 30, 2024
Extract Make-related logics into separate functions.
- Bash functions to call configure-script-related logics
    - scriptConfigure
- Bash functions to call the make-related logics
    - makeBuild
    - makeCheck
    - makeInstall
    - makeInstallCheck
    - makeDist
- Benefits:
    - Increase reusability. If applied, developers can call them from
      their pre* or post* phases when using language- or
      framework-specific build helpers that overwrites those Make-based
      phases.
@ShamrockLee
Copy link
Contributor Author

Renamed makeConfigure to scriptConfigure.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/mix-workflows-by-extracting-build-commands-from-each-stages/48376/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: stdenv Standard environment 10.rebuild-darwin: 501+ 10.rebuild-darwin: 5001+ 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild 10.rebuild-linux: 501+ 10.rebuild-linux: 5001+ 10.rebuild-linux-stdenv This PR causes stdenv to rebuild 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants