Skip to content

feature/cross-compile #8

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

Draft
wants to merge 68 commits into
base: master
Choose a base branch
from

Conversation

andreabedini
Copy link
Member

Marked as draft to avoid merging.

andreabedini and others added 8 commits July 14, 2025 15:22
The treatment of --executable-static means we pass `-optl-static` to GHC, which
in turn just passes this to the linker. This flag can not work on macOS. Fully
static linking is impossible as libSystem must be linked dynamically.

Thus here we disable this flag for macOS.
Don't enable -threaded unconditionnally when building Setup.hs. We may only
have vanilla libraries (but maybe we don't have them either?)

Revert ae0e752
Run a program (named "preBuildHook") before doing a package build and
another program (named "postBuildHook") after the package is built.
The exit code from the pre-build hook is passed to the post-build
hook.

The commit includes documentation for the hooks and the security
safeguards implemented to avoid the running of malicious hook
files.

(cherry picked from commit 5f7b47f)
This has to be cleaned up but it does not make sense to pass the compiler.
@andreabedini andreabedini force-pushed the stable-haskell/feature/cross-compile branch from b9cbca4 to 985b8b7 Compare July 14, 2025 08:29
- Remove QualifiyOptions

Remove QualifyOptions by setting qoSetupIndependent to be always true (the
current default) and qoBaseShim false (this must have been just a hack of some
sort).
principalPP and setupPP seem to have gone unused since
8194fab
1. We want to let the user take control and we have no issue with GHC failing
later on.
2. These checks depend on the compiler which now can change within the build
graph. If they have to exist they will exist in a different way.
Another thing that cannot (shouldn't?) be compiler dependent.
remove independent goals
wip: try to keep compatibility with existing tooling


introduce Distribution.Client.Toolchain
andreabedini and others added 27 commits July 14, 2025 16:36
Merge fromSolverInstallPlan and fromSolverInstallPlanWithProgress.
available targets are only host
Isolate the common logic between building and only downloading
Determine packages to build in-place by their solver id, not their package id.
I am not sure about this commit. This works by package name and not by package id like hideInstalledPackagesSpecificBySourcePackageId.
refactor: simplify distBuildDirectory
When components were introduced, cabal had support for
build-type: Configure, which allows to run a `configure`
script prior to building the package.  Upon the introduction
of components, it became obvious that we can't just
configure each and every component, as this easily runs
into the situation where the `configure` script is run
potentially concurrently for all components.

However, build-type is a global option for cabal files, and
is usually used to produce a <pkg>.buildinfo file.  This file
is then used to augment the Main Library and Executables only.

This change now tracks whether or not we are building a
main library or executable component, and if we do, retains
only for these components the build-type: Configure from the
package description. For all other components, we will fall
back to the default build-type: Simple.  For end users who
want to depend on package configured values, they will need
to set their sub libraries, testsuites and benchmark
components to depend on the main library, and import any
configured values from there.

For lib:Cabal, which doesn't know about components
when configure is invoked, we will continue to execute
configure.  There is no impact on lib:Cabal in this change.
Cabal uses a peculiar c program to check if LD supports and should
use -x. To do this, it shells out to GHC to compiler the C file.
This however requires that GHC will not bail out, yet cabal does
not pass --package-db flags to this GHC invocation, and as such we
can run into situations where GHC bails out, especially during GHC
bootstrap phases where not all boot packages are available.

We however do not need GHC to compiler a c program, and can rely
on the C compiler.

Fundamentally cabal does not allow modelling program dependencies
in the program db, as such we must configure gcc first before using
it.

We make a small change to lib:Cabal (specifically the GHC module,
and it's Internal companion) to allow it to configure gcc first,
before trying to configure ld, and thus having gcc in scope while
configuring ld. This removes the need for the awkward ghc
invocation to compiler the test program.
@andreabedini andreabedini force-pushed the stable-haskell/feature/cross-compile branch from 985b8b7 to 9abf046 Compare July 14, 2025 09:23
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.

5 participants