140 Commits

Author SHA1 Message Date
Misty De Meo
55654933f5 superenv: fix cpp shim
This sets cpp to use the compiler as cpp, and works with scripts which
pass values to cpp on stdin as well as with file arguments.

Closes Homebrew/homebrew#22155.
2013-08-27 18:24:08 -07:00
Misty De Meo
f0bf64e1e9 superenv: support PPC bottles
Allows for building bottles on PPC both with and without Altivec.
This is currently not active but will be enabled once superenv is
stable on Leopard.
2013-08-25 14:51:48 -07:00
Jack Nagel
84369dd949 Always pass -headerpad_max_install_names to the linker
We use install_name_tool pretty liberally, so we need to take steps to
ensure libraries and executables are always linked with this flag.

Closes Homebrew/homebrew#20233.
Fixes Homebrew/homebrew#17984.
Fixes Homebrew/homebrew#22078.
2013-08-23 11:36:03 -05:00
Jack Nagel
1bcd428b8e Fix superenv arch flag handling
Fixes Homebrew/homebrew#21943.
2013-08-16 20:46:03 -05:00
Misty De Meo
1586a69879 superenv: use Hardware::CPU.universal_archs
This defines the new HOMEBREW_ARCHS environment variable, which is
currently only set during universal builds, so that the tool wrappers
no longer need to hardcode i386/x86_64.
2013-08-15 22:46:57 -07:00
Misty De Meo
0845341de3 cc: delegate cpp to the real tool, not compiler
Fixes Homebrew/homebrew#21527.
2013-07-30 18:41:27 -07:00
Misty De Meo
0430589fbc superenv cc: specify llvm-g++-4.2
We previously tried to call llvm-g++ under the name `g++`,
but this is now a link to clang on Xcode 5+.

Fixes Homebrew/homebrew#20691.
2013-06-27 14:56:47 -05:00
Misty De Meo
d212b360ec superenv: Improve compiler selection
This fixes superenv on Xcode 3.2.6, and also fixes C++ software with
gcc-4.2 on all Xcodes.
2013-05-27 12:56:25 -05:00
Mike McQuaid
ad5c1b81cd Fix --build-bottle CFLAGS.
The CFLAGS were previously not generic enough.

References Homebrew/homebrew#18944.
References Homebrew/homebrew#19179.
2013-05-11 12:18:25 +01:00
Samuel John
261ca7aa6a superenv: Filter out -isysroot
Closes Homebrew/homebrew#16576.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-03-29 11:10:18 -07:00
Jack Nagel
21b583ba46 -std, not --std 2013-03-07 22:42:42 -06:00
Jack Nagel
df1d27b037 superenv/cc: keep exec monkeypatch out of Object 2013-03-06 17:06:07 -06:00
Jack Nagel
4adf0b0f69 superenv/cc: make file loadable 2013-03-06 17:06:07 -06:00
Misty De Meo
2e23e9a22d superenv: --use-gcc should specify gcc-4.2
Since 'gcc' is a symlink to 'llvm-gcc' on Xcode 4.3+, --use-gcc and
--use-llvm were doing exactly the same thing. Combined with the
previous commit, this allows users with either a leftover
/usr/bin/gcc-4.2 or a homebrewed apple-gcc42 to build with gcc.

This doesn't however fix Xcode-only systems with apple-gcc42.

Fixes Homebrew/homebrew#17243.
2013-01-26 22:57:56 -06:00
Samuel John
293be41d5c superenv: Allow ENV.m32 (for 32bit builds)
Superenv normally filters out "-m32" flag, preventing 32bit builds.
Some software, however, still only work in 32bit mode.

If ENV.m32 is called, superenv does not filter out the "-m32" flag.
Also note, superenv, does not explicitly add the -m32 flag and
expects the build system of the software to know when and where to
provide this flag.

Closes Homebrew/homebrew#16350.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-01-24 19:21:57 -08:00
Jack Nagel
8135ed6528 superenv: allow -W[alp], style arguments to pass through
We already (correctly) allow -Wl, style linker arguments to pass
through; extend this to -Wp, (preprocessor) and -Wa, (assembler).

Fixes Homebrew/homebrew#17252.
2013-01-23 00:18:01 -06:00
Max Howell
2446e5ee8a dels -> dups typo
/cc @samueljohn
2012-11-13 11:18:19 -05:00
Xiyue Deng
6762780f3e Whitelist Homebrew's own prefix in superenv.
This allows Homebrew to be installed into /opt or /sw.

Closes Homebrew/homebrew#15780.

Signed-off-by: Max Howell <mxcl@me.com>

Cleaned up the patch a little. Still ugly though, but logic is unusual so that's just how it is.
2012-11-01 09:51:41 -04:00
Adam Vandenberg
e502728641 Superenv: be more specific about -O flags
Closes Homebrew/homebrew#15775.
2012-10-31 06:50:50 -07:00
Max Howell
a967f5c82a Use cc -E, not cpp -E. Fixes Homebrew/homebrew#15402. 2012-10-28 10:52:06 -04:00
Max Howell
64927a45ef Restore HOMEBREW_LOG functionality 2012-09-29 09:57:37 -04:00
Max Howell
a217b03952 Clean up and improve build-error output and logs
All logs are now stored from each command executed in Formula.install.

Error output is truncated to five lines in an attempt to not overwhelm the user and to encourage users to read the error output and report the bug properly. Maybe we can get that figure up from 70% to 90%.
2012-09-25 11:31:56 -04:00
Max Howell
4bf72a3e62 Puts build-tool args first
build-tool provided args must be considered first by cc, etc. Generally this already occurred for -I flags, because most of our -I flags were -isystem. However it didn't occur for keg-only flags and -L paths.

This was an error.

I amended the refurbishment code to ensure any paths we want to control the order of are thoroughly scrubbed out of the build-tool provided args. This ensures reliability for our builds.

However this path-scrubbing should always occur, even during configure (I am fairly sure of this). So more work is required.

Fixes Homebrew/homebrew#14781.
2012-09-14 11:55:59 -04:00
Max Howell
514b1b54cd Support c99/c89 compiles properly
We can't really execute c89/99 explicitly as these POSIX compliant tools support very few args. Best to execute clang or gcc with the --std=cx9 argument appended.

Fixes Homebrew/homebrew#14724.
2012-09-13 11:30:11 -04:00
Max Howell
ef8a720caa Fixes universal builds; Fixes Homebrew/homebrew#14845 2012-09-13 08:53:35 -04:00
Max Howell
10aab9a672 superenv: More thorough scrubbing of -I & -L args
It's important that -I is scrubbed thoroughly as we add most of our important paths with -isystem and -I is handled *first*.

NOTE this indicates we should probably have used -I rather than -isystem, but too late to test all that now.

Also scrub -L for bad-paths thoroughly (evaluate realpath).
2012-09-03 15:12:32 -04:00
Max Howell
fdadd7e9dd Fix linking against X11 cairo in preference to ours
Amateur mistake where I forgot that the system library path is read AFTER the -L library path, so /usr/local/lib was after /opt/X11/lib and the wrong cairo was used.

This only affects CLT /usr/local installs with XQuartz installed.

Fixes Homebrew/homebrew#14639.
2012-09-03 15:12:31 -04:00
Max Howell
c35f6cb9d5 Set CC and CXX with superenv (again)
It was dumb to have make call different compilers to configure depending on the `servile?` flag. This is not a route to reliability.

Instead now we set CC (formula that break if CC is set like Jack be damned, their build-systems are just plain broken and should not be supported). When cc is called we examine HOMEBREW_CC, otherwise we instantiate the tool that was called, just like the formula's build-system will expect.

Fixes Homebrew/homebrew#14659 (though the build fails later for me, with the same error for stdenv and superenv).
2012-09-03 15:12:31 -04:00
Max Howell
88b1da7405 Remove -fopenmp *and* -lgomp
Apparently LLVM can use these, so only remove if clang.

Refs Homebrew/homebrew#14569.
2012-09-02 23:10:06 -04:00
Max Howell
30b53cf92a Cram GL headers and includes into superenv
Fixes Homebrew/homebrew#14554.

We justify doing this because pre 10.8 X11 came with GL for all Homebrew-capable systems and as such is a default that we'd prefer not to have to address.
2012-08-31 14:12:28 -04:00
Max Howell
139fcf189c Always make fuss
It's only visible if you specify -v or builds fail, so let's help people to diagnose superenv issues.
2012-08-31 13:29:46 -04:00
Max Howell
282313c68f Remove -fopenmp, fix pixman
Possibly this is not wise, but with -fopenmp -lgomp is automatically added by the toolchain, and I didn't have -lgomp.

Ideally we'd detect when this will work and then leave it in there.

/cc @sharpie @mikemcquaid @jacknagel
2012-08-31 13:29:46 -04:00
Max Howell
b024554872 Remove plain "-O" 2012-08-31 10:22:11 -04:00
Max Howell
00df962b6f Consider superenv “servile” during configure
superenv defaults to servile mode. In servile mode:

* If 'gcc' is called, then 'gcc' is run (we ignore HOMEBREW_CC)
* CFLAGS (optimizations) are not applied
* ARGV is not mangled (TODO though we should apply fixes)
* -I and -L environment is still forcibly inserted.

This fixes, eg. jack which was still broken with stdenv. Jack was broken because we set CC in stdenv, and Jack has a stupid build-system. Unsetting CC allowed Jack to find and use the gcc tool it so demanded, but (previously) we would then substitute clang under its nose. The configure still failed. In servile mode (llvm-)gcc is used and Jack compiles.

In normal circumstances clang would then be inserted again during the make phase. But Jack uses the niche-wag build tool that we don't support for setting the O HOMEBREW_CCCFG flag that disables servile mode.
2012-08-31 10:22:10 -04:00
Max Howell
d4503b1202 Fixes Homebrew/homebrew#14542; ocaml superenv issues
This patch removes most of the settings for CC, CXX etc. because we are trying to be minimal. Then we force the compiler to Homebrew's choice underneath in superenv. We however leave LD because we prefer that build-systems use the c-compiler for linking, it generally works better (copiously tested), however when the build-system explicitly calls ld, we respect that. This gets around the ocaml bug in question, since somehow clang was crashing during link, but the ld tool itself (which is kind of clang, kind of llvm-gcc) is okay with this.

Also moved the setting of O (so that cc-args are refurbished) into a make wrapper. Not sure if this matter much, but seems more consistent.
2012-08-30 20:02:29 -04:00
Max Howell
8f299d9779 Work for users who delete /usr/bin/ruby
Some people do insane things and are then surprised things break.

Fixes Homebrew/homebrew#14546.
2012-08-30 09:55:33 -04:00
Max Howell
1a9c2917a4 Some flags must be specified -Wl,foo
Finishes fixing qrupdate. And maybe others.
2012-08-29 22:43:52 -04:00
Max Howell
a7946e0088 Warn about removed warnings less shockingly
The problem here now is though that the warnings only appear when compiling verbosely. But they should thus be visible if the build fails. Or if people are hunting for problems.
2012-08-29 15:19:42 -04:00
Max Howell
7d8954d74c Warn user if they set CFLAGS, etc. with superenv
Since we remove some CFLAGS under their noses, this would otherwise be quite confusing.

Notably, this will now trigger in numerous formula. Sucks.
2012-08-29 12:41:37 -04:00
Max Howell
65d195dcaa superenv: build-environments that just work
1. A minimal build environment, we don't set CFLAGS, CPPFLAGS, LDFLAGS, etc. the rationale being, the less that is set, the less variables we are introducing that can break builds.
2. A set of scripts that replace cc, ld, etc. and inject the -I, -L, etc. flags we need into the args passed to the build-tools.

Because we now have complete control over compiler instantiations we do a variety of clean-up tasks, like removing bad flags, enforcing universal builds and ensuring makefiles don't try to change the order of library and include paths from ones that work to ones that don't.

The previous ENV-system is still available when --env=std is specified.

superenv applies to Xcode >= 4.3 only currently.
2012-08-29 12:41:34 -04:00