feat: cc builder #22

Open
vlinkz wants to merge 1 commit from vlinkz/labs:vlinkz/ccbuilder into main
Owner

Basic gcc builder. Not yet fully featured, but enough to start.
Picked out of #21, example usage: 3e80b2e12e/tidepool/src/packages/core/hello/versions/2.12.nix.

Basic gcc builder. Not yet fully featured, but enough to start. Picked out of https://git.auxolotl.org/auxolotl/labs/pulls/21, example usage: https://git.auxolotl.org/auxolotl/labs/src/commit/3e80b2e12ee8f7f8cb3802ef394b0c2e615393bd/tidepool/src/packages/core/hello/versions/2.12.nix.
vlinkz added 1 commit 2025-09-20 04:15:48 +00:00
vlinkz force-pushed vlinkz/ccbuilder from 974dbc4b85 to 139750a59e 2025-09-20 04:39:51 +00:00 Compare
vlinkz force-pushed vlinkz/ccbuilder from 139750a59e to dc8f97c133 2025-09-20 04:41:54 +00:00 Compare
RossSmyth reviewed 2025-10-02 19:28:11 +00:00
@ -0,0 +85,4 @@
configureFlags = builtins.concatStringsSep " " (
lib.lists.when (settings.configure.prefix) [ "--prefix=$out" ]
++
lib.lists.when (settings.configure.platforms && package.platform.build != package.platform.host)
Contributor

Is there a reason why this shouldn't just be passed by default?

Is there a reason why this shouldn't just be passed by default?
First-time contributor

I think it's useful to disable these args if the configure script is cmake instead, which does not support this form of arguments. But I'm not sure whether this specific builder would be the preferred way of working with CMake.

I think it's useful to disable these args if the configure script is `cmake` instead, which does not support this form of arguments. But I'm not sure whether this specific builder would be the preferred way of working with CMake.
Contributor

These flags definitely should not be passed to CMake, should have its own attribute because the way it handles things are very different with types and such.

These flags definitely should not be passed to CMake, should have its own attribute because the way it handles things are very different with types and such.
Author
Owner

I was thinking we make seperate capabilities for cmake, meson, autotools, etc. Thoughts?

I was thinking we make seperate capabilities for cmake, meson, autotools, etc. Thoughts?
@ -0,0 +93,4 @@
++
lib.lists.when (settings.configure.platforms && package.platform.host != package.platform.target)
[
"--target=${(lib.systems.withBuildInfo package.platform.target).triple}"
Contributor

Same with this.

Same with this.
@ -0,0 +95,4 @@
[
"--target=${(lib.systems.withBuildInfo package.platform.target).triple}"
]
++ settings.configure.flags
Contributor

There are some other flags to be pass if it is an autotools-compatible configure script. Should we assume that? Examples:

  1. --disable-static (and ----enable-static for a static platform)
  2. --disable-dependency-tracking
  3. For GCC will need to handle --prefix
There are some other flags to be pass if it is an autotools-compatible configure script. Should we assume that? Examples: 1. `--disable-static` (and `----enable-static` for a static platform) 2. --disable-dependency-tracking 3. For GCC will need to handle `--prefix`
Member

Not sure if I ever ran this through hydra before (it claims not), but it's now failing: https://hydra.aux-cache.dev/jobset/aux-prs/labs-pr22#tabs-errors

I think it probably just needs a rebase? I can't remember exactly what we've changed since this PR was last edited.

Not sure if I ever ran this through hydra before (it claims not), but it's now failing: https://hydra.aux-cache.dev/jobset/aux-prs/labs-pr22#tabs-errors I think it probably just needs a rebase? I can't remember exactly what we've changed since this PR was last edited.
Contributor

@srd424 wrote in #22 (comment):

I think it probably just needs a rebase? I can't remember exactly what we've changed since this PR was last edited.

The relevant change is the removal of target, I think.

Patch to remove `target`
diff --git a/tidepool/src/builders/foundation/cc.nix b/tidepool/src/builders/foundation/cc.nix
index 2829c187ad..42e9d50cb1 100644
--- a/tidepool/src/builders/foundation/cc.nix
+++ b/tidepool/src/builders/foundation/cc.nix
@@ -40,34 +40,22 @@
             settings = package.builder.settings;
 
             deps = lib.attrs.mergeRecursive {
-              build = {
-                build =
-                  lib.packages.dependencies.build package.platform.build package.platform.build package.platform.build
-                    {
-                      diffutils = packages.foundation.diffutils.latest;
-                      findutils = packages.foundation.findutils.latest;
-                      gawk = packages.foundation.gawk.latest;
-                      gnugrep = packages.foundation.gnugrep.latest;
-                      gnumake = packages.foundation.gnumake.latest;
-                      gnupatch = packages.foundation.gnupatch.latest;
-                      gnused = packages.foundation.gnused.latest;
-                      gnutar = packages.foundation.gnutar.latest;
-                      gzip = packages.foundation.gzip.latest;
-                      xz = packages.foundation.xz.latest;
-                    };
-                host =
-                  lib.packages.dependencies.build package.platform.build package.platform.build package.platform.host
-                    {
-                      binutils = packages.foundation.binutils.latest;
-                      gcc = packages.foundation.gcc.latest;
-                    };
+              build = lib.packages.dependencies.build package.platform.build package.platform.build {
+                binutils = packages.foundation.binutils.latest;
+                diffutils = packages.foundation.diffutils.latest;
+                findutils = packages.foundation.findutils.latest;
+                gawk = packages.foundation.gawk.latest;
+                gcc = packages.foundation.gcc.latest.target.${package.platform.host};
+                gnugrep = packages.foundation.gnugrep.latest;
+                gnumake = packages.foundation.gnumake.latest;
+                gnupatch = packages.foundation.gnupatch.latest;
+                gnused = packages.foundation.gnused.latest;
+                gnutar = packages.foundation.gnutar.latest;
+                gzip = packages.foundation.gzip.latest;
+                xz = packages.foundation.xz.latest;
               };
-              host = {
-                host =
-                  lib.packages.dependencies.build package.platform.build package.platform.host package.platform.host
-                    {
-                      glibc = packages.foundation.glibc.latest;
-                    };
+              host = lib.packages.dependencies.build package.platform.build package.platform.host {
+                glibc = packages.foundation.glibc.latest;
               };
             } package.deps;
 
@@ -90,11 +78,6 @@
                           "--build=${(lib.systems.withBuildInfo package.platform.build).triple}"
                           "--host=${(lib.systems.withBuildInfo package.platform.host).triple}"
                         ]
-                    ++
-                      lib.lists.when (settings.configure.platforms && package.platform.host != package.platform.target)
-                        [
-                          "--target=${(lib.systems.withBuildInfo package.platform.target).triple}"
-                        ]
                     ++ settings.configure.flags
                   );
                 in
@srd424 wrote in https://git.auxolotl.org/auxolotl/labs/pulls/22#issuecomment-1554: > I think it probably just needs a rebase? I can't remember exactly what we've changed since this PR was last edited. The relevant change is the removal of `target`, I think. <details> <summary>Patch to remove `target`</summary> ```diff diff --git a/tidepool/src/builders/foundation/cc.nix b/tidepool/src/builders/foundation/cc.nix index 2829c187ad..42e9d50cb1 100644 --- a/tidepool/src/builders/foundation/cc.nix +++ b/tidepool/src/builders/foundation/cc.nix @@ -40,34 +40,22 @@ settings = package.builder.settings; deps = lib.attrs.mergeRecursive { - build = { - build = - lib.packages.dependencies.build package.platform.build package.platform.build package.platform.build - { - diffutils = packages.foundation.diffutils.latest; - findutils = packages.foundation.findutils.latest; - gawk = packages.foundation.gawk.latest; - gnugrep = packages.foundation.gnugrep.latest; - gnumake = packages.foundation.gnumake.latest; - gnupatch = packages.foundation.gnupatch.latest; - gnused = packages.foundation.gnused.latest; - gnutar = packages.foundation.gnutar.latest; - gzip = packages.foundation.gzip.latest; - xz = packages.foundation.xz.latest; - }; - host = - lib.packages.dependencies.build package.platform.build package.platform.build package.platform.host - { - binutils = packages.foundation.binutils.latest; - gcc = packages.foundation.gcc.latest; - }; + build = lib.packages.dependencies.build package.platform.build package.platform.build { + binutils = packages.foundation.binutils.latest; + diffutils = packages.foundation.diffutils.latest; + findutils = packages.foundation.findutils.latest; + gawk = packages.foundation.gawk.latest; + gcc = packages.foundation.gcc.latest.target.${package.platform.host}; + gnugrep = packages.foundation.gnugrep.latest; + gnumake = packages.foundation.gnumake.latest; + gnupatch = packages.foundation.gnupatch.latest; + gnused = packages.foundation.gnused.latest; + gnutar = packages.foundation.gnutar.latest; + gzip = packages.foundation.gzip.latest; + xz = packages.foundation.xz.latest; }; - host = { - host = - lib.packages.dependencies.build package.platform.build package.platform.host package.platform.host - { - glibc = packages.foundation.glibc.latest; - }; + host = lib.packages.dependencies.build package.platform.build package.platform.host { + glibc = packages.foundation.glibc.latest; }; } package.deps; @@ -90,11 +78,6 @@ "--build=${(lib.systems.withBuildInfo package.platform.build).triple}" "--host=${(lib.systems.withBuildInfo package.platform.host).triple}" ] - ++ - lib.lists.when (settings.configure.platforms && package.platform.host != package.platform.target) - [ - "--target=${(lib.systems.withBuildInfo package.platform.target).triple}" - ] ++ settings.configure.flags ); in ``` </details>
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u vlinkz/ccbuilder:vlinkz-vlinkz/ccbuilder
git checkout vlinkz-vlinkz/ccbuilder

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout main
git merge --no-ff vlinkz-vlinkz/ccbuilder
git checkout vlinkz-vlinkz/ccbuilder
git rebase main
git checkout main
git merge --ff-only vlinkz-vlinkz/ccbuilder
git checkout vlinkz-vlinkz/ccbuilder
git rebase main
git checkout main
git merge --no-ff vlinkz-vlinkz/ccbuilder
git checkout main
git merge --squash vlinkz-vlinkz/ccbuilder
git checkout main
git merge --ff-only vlinkz-vlinkz/ccbuilder
git checkout main
git merge vlinkz-vlinkz/ccbuilder
git push origin main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: auxolotl/labs#22
No description provided.