131 Commits

Author SHA1 Message Date
Misty De Meo
bdd2e71b3a stdenv: set correct compiler symbol for gcc 4.0 2014-01-03 19:13:35 -08:00
Misty De Meo
97bb9c5b73 stdenv: fix self.cc check
Since ENV.cc/cxx are accessors to ENV, any values being passed through
are coerced into strings, which means that a nil `ENV.cc` is actually
an empty string - which isn't considered to be false in Ruby.

Fixes mistydemeo/tigerbrew#161.
Fixes mistydemeo/tigerbrew#135.
2014-01-03 17:59:00 -08:00
Jack Nagel
14b19ba3c4 Adjust optimization flags if the CPU does not support SSE4
Tentatively fixes Homebrew/homebrew#21778, Homebrew/homebrew#24363.
2013-11-27 17:25:27 -06:00
Jack Nagel
e0d2492247 Move optimization flag selection out of cc wrapper
The mapping of architectures to optimization flags is now retrieved from
Hardware::CPU and the selected flags are passed as an environmen
variable, rather than duplicated in the cc wrapper and re-calculated on
every invocation of the compiler.

Closes Homebrew/homebrew#24540.
2013-11-20 13:19:06 -06:00
Jack Nagel
c7b7fdf0ca Simplify ENV.0x methods in stdenv 2013-11-12 13:53:29 -06:00
Jack Nagel
0b793e321e Add ENV.O0 to stdenv 2013-11-12 13:53:29 -06:00
Xiyue Deng
6fc6dd791b stdenv: drop space between "-isystem" and path.
* This is consistent with superenv.
2013-11-02 01:47:35 -07:00
Xiyue Deng
ea2dd613a4 Make stdenv handling less intrusive.
* Don't encode "-Qunused-arguments", as this is only supported in Clang
  and will break building when C/C++ compiler is switched during the
  process, e.g. building gcc. The warning is harmless without
  "-Werror".
2013-10-27 06:30:48 -07:00
Xiyue Deng
15e5fe4384 Clang standard library selection.
* Add new ENV function for selecting stdlib for Clang.
  - The selection is no-op for non-system-clang compilers.
  - Both superenv and stdenv are handled.
* Add new HOMEBREW_CCCFG flag and ccwrapper handling.
2013-10-26 22:17:04 -07:00
Xiyue Deng
f2132c47bd C++11 support.
* Add options and ENV method to specify building in C++11 mode.
  - Set C++ compiler flags to enable C++11 mode.
  - To add options to support C++11 mode, a formula can now use

      option :cxx11

    to provide "--c++11" option, and detect and enable C++11 support in
    install method using

      ENV.cxx11 if build.cxx11?

Closes Homebrew/homebrew#22453.
2013-10-26 22:17:04 -07:00
Jack Nagel
805472946b Rename MacOS to OS::Mac 2013-10-18 12:56:51 -05:00
Jack Nagel
c511d7d2f4 Add OS.mac? and OS.linux? 2013-10-18 12:56:51 -05:00
Jack Nagel
2bbe2dba16 ENV.x11: only use SDK when CLT is missing and X11 is from Apple 2013-10-04 21:06:18 -05:00
Jack Nagel
b2bb0e22f4 ENV.x11: always add include/freetype2 to CPPFLAGS 2013-10-04 21:06:18 -05:00
Misty De Meo
48dde74503 Move ld64 into SharedEnvExtension
Superenv is being tested on Xcode 3.1.4, so this needs to be supported
in both ENVs, not just stdenv.
2013-09-28 17:22:27 -07:00
Misty De Meo
1ae81f0bf7 Move CompilerSelector logic into build env setup
This moves the CompilerSelector fails_with logic into the build
environment setup, making the compiler selection available before
performing actions that depends on knowing what the compiler is, e.g.
setting up PATH.

ENV.setup_build_environment now optionally takes a Formula argument
to provide the information necessary to do the fails_with, and the new
ENV.validate_cc! extracts the fails_with logic from Build.install.
2013-09-17 12:43:38 -07:00
Jack Nagel
ce48366ab1 ENV: use cc accessor 2013-09-03 10:06:55 -05:00
Misty De Meo
ef1d9c0cd0 Implement fails_with for non-Apple compilers
This adds support for non-Apple GCC compilers in the fails_with code.
A fails_with block for a non-Apple compiler looks like:

fails_with :gcc => '4.8.1' do
  cause 'Foo'
end

Non-Apple compilers don't have build numbers, so compiler failures are
based on version strings instead.

Internally non-Apple compilers can be distinguished because they are
passed around as strings instead of symbols.

In addition, this alters the priority list for compilers, with the
following changes:

* Apple GCC 4.2 and LLVM-GCC swap positions, with GCC now taking
  priority. (Maybe LLVM-GCC should just go away.)
* Non-Apple GCC compilers are ranked below GCC 4.2 but above LLVM-GCC
  and Apple GCC 4.0.
2013-09-01 13:19:13 -07:00
Misty De Meo
11f8b2f49c Experimental support for non-Apple GCCs 2013-09-01 13:19:12 -07:00
Jack Nagel
2cb8c443e4 ENV: use cflags setter 2013-08-30 18:42:12 -05:00
Jack Nagel
cc37943267 ENV: use cc accessor 2013-08-30 18:42:12 -05:00
Jack Nagel
aa79e21ba4 ENV: add cc and cxx setters 2013-08-30 18:42:12 -05:00
Misty De Meo
7e1af4b7d5 Unify compiler selection logic
This unifies the logic for selecting a compiler between superenv and
stdenv. A variation of superenv's `determine_cc`, which now returns a
symbol, has been moved into the shared ENV extension. Stdenv uses the
result of this directly (as it's always used symbols), while superenv
translates that back into a compiler string.

This also has the effect of disabling HOMEBREW_USE_(gcc|llvm|clang) in
stdenv, which have already been marked as deprecated for some time, and
enables the HOMEBREW_CC= environment variable syntax from superenv in
stdenv.
2013-08-30 07:52:13 -07:00
Misty De Meo
221bb2419f Add --cc= syntax for selecting compilers 2013-08-30 07:52:12 -07:00
Misty De Meo
c58d707158 Allow building bottles with custom architectures
This allows overriding the "oldest CPU" behaviour - for instance, to
build Intel bottles for a newer CPU than Core 2, to build a PPC bottle
with or without Altivec on the same computer, etc.
2013-08-28 20:21:06 -07:00
Jack Nagel
77056dc5cd Simplify condition 2013-08-26 22:11:29 -05: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
ea8f51256b Use ENV.append_path 2013-08-19 17:21:13 -05:00
Amos Wenger
52ace99f14 Use File::PATH_SEPARATOR globally instead of ':'
On Unix, the path separator is ':', whereas on Windows,
it is ';'. This is the first of a series of patch to bring
macbrew's and winbrew's codebases closer together.

The main places the magic constant ':' was being used were:
  - the $PATH environment variable
  - CMAKE-related environment variables
  - pkg-config related environment variables

Closes Homebrew/homebrew#21921.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-08-19 13:35:44 -05:00
Jack Nagel
cec8d74239 Remove ENV.expand_xcrun
This method is currently unused and after inspecting the git history, it
appears it may never have been used at all.
2013-08-19 12:34:14 -05:00
Jack Nagel
dd9c269c69 Rename HomebrewEnvExtension to Stdenv 2013-08-19 12:32:59 -05:00