Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Handling non-standard universal builds under superenv #17352

Closed
wants to merge 2 commits into from
Closed

Handling non-standard universal builds under superenv #17352

wants to merge 2 commits into from

Conversation

jacknagel
Copy link
Contributor

For the purposes of this discussion, the "standard" universal build is the current behavior of ENV.universal_binary: passing -arch i386 -arch x86_64 to the compiler and linker.

Currently this works under both superenv and stdenv, but superenv doesn't handle things that diverge from this convention, e.g. mysql:

args << "-DCMAKE_OSX_ARCHITECTURES='i386;x86_64'" if build.universal?

this formula does not call ENV.universal_binary, so any arch flags that the build system passes to the compiler will be filtered out. The procedure for handling this has thus far been to punt and add env :std if build.universal? to the formula.

So we need to to add a switch to superenv that doesn't explicitly add universal arch flags, but doesn't filter them out, either.

One possibility would be to keep a struct representing the universal "mode" (e.g. allow_universal_flags or add_universal_flags) on the formula's BuildEnvironment object, and pass it into superenv during universal builds.

@jacknagel
Copy link
Contributor Author

The other thing that needs to be addressed is how this should be specified in the formula DSL.

We need a way to differentiate between things where ENV.universal_binary should be called and where it should not.

@MylesBorins
Copy link
Contributor

This bug is currently effecting the universal build of llvm... should we add env :std if build.universal? to the current formula?

@jacknagel
Copy link
Contributor Author

Yeah.

@MikeMcQuaid
Copy link
Member

In the CMake/MySQL case you could just do ENV.universal_binary and pass the CMake flag too.

@GuillaumeDIDIER
Copy link
Contributor

I agree with the solution that ENV.universal_binary should simply instructs superenv to keep both -arch flags
Just keeping a list of the architecture somewhere to deduce these.
Perhaps this should be a different flag, but implied by universal binary.
I'm no ruby expert but as you said in the discussion #21534 I will try to make a pull request.

@GuillaumeDIDIER
Copy link
Contributor

Here's a first piece of work (#21664).

@jacknagel
Copy link
Contributor Author

I need to get this sorted so that we can build openssl universal. wip:

https://github.com/jacknagel/homebrew/compare/u

@jacknagel
Copy link
Contributor Author

@Homebrew/owners - anyone want to bikeshed the name ENV.preserve_arch_flags? Open to suggestions.

@adamv
Copy link
Contributor

adamv commented May 11, 2014

Seems OK; does the K represent anything?

@jacknagel
Copy link
Contributor Author

No, just picked it at random.

@jacknagel jacknagel closed this in 83ceef1 May 14, 2014
@jacknagel jacknagel deleted the u branch May 14, 2014 05:03
gadomski pushed a commit to gadomski/homebrew that referenced this pull request May 14, 2014
@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants