195 Commits

Author SHA1 Message Date
Charlie Sharpsteen
275d22db9e ENV.rb: Set GCC-style CPU flags for GFortran
GFortran chokes when it is passed CPU flags specific to Clang. This change
ensures the environment variables `FCFLAGS` and `FFLAGS` contain the same CPU
flags that would be set for the GCC compiler.

Fixes Homebrew/homebrew#10424.
Fixes Homebrew/homebrew#10744.

Closes Homebrew/homebrew#10774.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2012-03-09 12:14:08 -08:00
Charlie Sharpsteen
55d4f48746 ENV.rb: Generalize method for setting CPU flags
All logic has been copied into a new method `set_cpu_flags` that accepts an
additional argument, `flags`, which contains a list of environment variables
for which the CPU flags are to be adjusted.

`set_cpu_cflags` now recalls `set_cpu_flags` and passes `cflags_flags` as the
first argument.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2012-03-09 12:14:05 -08:00
Charlie Sharpsteen
1805e87529 ENV.rb: Modifier methods accept lists of flags
`ENV` methods that modify environment variables, `prepend`, `append` and
`remove`, can now accept lists of flags as well as a single flag.

The list of flags affected by `append_to_cflags` and `remove_from_cflags` are
now definied in a shortcut method `cc_flag_vars`.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2012-03-09 12:14:04 -08:00
Max Howell
f3d177a99b Set ACLOCAL_PATH so that things work
This should mean all those formula that pass options to aclocal don't need to anymore, but I'm not risking changing them.
2012-02-27 04:06:39 +00:00
Jack Nagel
5d58792c5e Fix IO redirection in ENV.xcrun
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-26 15:01:01 -06:00
Charlie Sharpsteen
c0299ad19b ENV.rb: Set flags for Objective-C
We set defaults for C and C++, might as well do the same for Objective-C and
Objective-C++.

Closes Homebrew/homebrew#10354.
2012-02-21 21:34:48 -08:00
Max Howell
61a8bd9ca0 Don't hang if xcode-select -print-path is "/"
Introducing MacOS.xctools_fucked?.

Refs Homebrew/homebrew#10293.
2012-02-21 10:33:03 +00:00
Jack Nagel
a7ade739dc Remove -Qunused-arguments in ENV.enable_warnings
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-21 00:41:47 -06:00
Jack Nagel
f295661ca6 Remove unused :force switches
The :force behavior for ENV.gcc has been the default for some time, and
was used to force vanilla gcc in case the gcc symlink pointed at
llvm-gcc; for ENV.clang, this doesn't mattera as clang is just clang.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-21 00:22:27 -06:00
Jack Nagel
f8e3e806f9 Silence unused argument warnings from clang
The clang frontend ignores a number of options that are accepted by gcc
and llvm-gcc. However, it produces a warning for each unused argument at
each invocation, which can result in many lines of noise, e.g.

   clang: warning: argument unused during compilation: '-rdynamic'

Since these arguments do not affect compilation, let's just silence the
warnings by passing '-Qunused-arguments' to clang by default.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-21 00:22:17 -06:00
Jack Nagel
78d4fda6d6 ENV: clean up set_cpu_cflags a bit
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-21 00:20:29 -06:00
Camillo Lugaresi
5ef84730d0 add ENV.O1
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2012-02-19 11:45:15 -08:00
Adam Vandenberg
f2002c4558 This should be a regex 2012-02-17 19:43:44 -08:00
Max Howell
e1461b9d20 OTT handling for various Xcode-4.3/CLI-Tools edge cases
Also xcrun can only exist at /usr/bin/xcrun.

Most of these edges are non-buildable environments, but I didn't know that when writing it, so it may as well stay, since it still does make brew --env more correct.
2012-02-18 01:53:55 +00:00
Max Howell
607c13c32b Find xcrun if user doesn't ever install Xcode 4.3 helper tools 2012-02-17 13:34:06 +00:00
Max Howell
ba61d3013a Work with Xcode 4.3 if user didn't install helper tools
We ask Spotlight to find Xcode and use that path, neat right?
2012-02-17 13:08:55 +00:00
Max Howell
4504662033 Use xcrun; Ensure clang is the default compiler with Xcode 4.3
Using xcrun as a proxy to execute the compiler tools is per its design. This means you can't treat ENV['CC'] as a path anymore, but I think I found the cases this was being expected and corrected them. It was not proper anyway to assume the variable was a path, it can be anything. Like a proxy. Like xcrun.

Also more thoroughly clear ENV.
2012-02-16 23:43:43 +00:00
Jack Nagel
59bd97bb89 Unset CLICOLOR_FORCE in the build environment
If we're going to unset GREP_OPTIONS we may as well unset this one too,
as it causes similar issues. Recent autoconf unset both of these.

Fixes Homebrew/homebrew#8165.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-16 16:55:28 -06:00
Max Howell
66f942aa66 Find the dev tools, even with Xcode 4.3
Fixes Homebrew/homebrew#9179.
2012-02-16 18:19:01 +00:00
Max Howell
82ed6aceb8 Pre-refactor Tidy 2012-02-16 18:19:01 +00:00
Max Howell
be953bbb85 Use -Os rather than -O3
This was probably a stupid decision in the first place. Who wants lengthy compile times for debatable gain? Apple use Os in all Xcode projects, so I'm guessing its the best choice.

Also I have long suspected the Image Magick performance issues Homebrew is supposedly susceptible to were because of O3.
2012-02-16 18:19:00 +00:00
Max Howell
ec66d1f956 Delete ENV[GREP_OPTIONS] and the related doctor check
Can break CMAKE builds.
2012-02-16 18:19:00 +00:00
Jack Nagel
150cf9b88c ENV: fix typo 2012-02-12 22:52:12 -06:00
Jack Nagel
10ddeaef8b Add ENV.cxxflags
Useful when CXXFLAGS has diverged fom CFLAGS, e.g. via ENV.append, and
also it is nice for CXX to have symmetry with CC.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-12 17:29:02 -06:00
Jack Nagel
709674cb95 Move old ENV.use_foo? compiler methods to compat
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-03 23:01:28 -06:00
Jack Nagel
0f499ac7be Don't append an empty value to CFLAGS
Appending an empty string results in an extraneous space character.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-01-19 22:54:28 -06:00
Mike McQuaid
c71f883fa8 Use more generic cflags when building bottles.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-01-16 21:05:00 +00:00
Mike McQuaid
555e7ff893 Don't try and use GCC on Xcode 4.2: it's gone Jim.
Closes Homebrew/homebrew#9622.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-01-16 21:00:24 +00:00
Misty De Meo
1ed22ff1c3 ENV.gcc: search HOMEBREW_PREFIX/bin for gcc-4.2
Allow the use of a Homebrewed gcc-4.2 in order to support homebrew-alt's
apple-gcc42 formula.

This also removes the :force filtering for the gcc-4.2 check error.

Closes Homebrew/homebrew#9384.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-01-11 21:16:13 -06:00
Jack Nagel
f437c9040b Resolve multi-level gcc symlinks
In later XCodes, gcc is a symlink to gcc-4.2 which is itself a symlink
to llvm-gcc, so it is necessary to resolve multiple symlinks.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2011-12-26 12:03:55 -06:00
Oleg Oshmyan
f05e267c3f Remove Clang-specific cflags when switching compilers
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2011-12-14 20:12:07 -08:00
Oleg Oshmyan
d2492073b2 ENV: update and clean up optimization flags
- Fix ENV.libxml2 to update CPPFLAGS rather than CFLAGS
 - Methods ENV.{gcc*,llvm,clang} now reset CPU-specific optimization
   flags on every call.

Closes Homebrew/homebrew#8105.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2011-12-13 20:38:45 -06:00
Misty De Meo
6c86d358a3 ENV: fix llvm-gcc regexp
Fixes: Homebrew/homebrew#8890.
Closes Homebrew/homebrew#8893.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2011-12-01 13:16:00 -08:00
Charlie Sharpsteen
399d73e100 ENV.rb: Fix typo in Fortran environment variables
`FFFLAGS` should be `FFLAGS`.
2011-11-23 09:25:22 -08:00
Max Howell
bf3433bde7 With xcodebuild don't set CC, CXX, etc.
The compiler setting in the xcodeproj is overridden by the CC setting in the environment. This is a bit insane IMO since the xcodeproj itself has detailed decisions about what tools to use.

Fixes Homebrew/homebrew#6406.
2011-09-10 11:30:00 +01:00
Max Howell
0a0187feed Tune optimisations for sandybridge 2011-09-09 09:26:59 +01:00
Max Howell
06795b8953 Allow :force for ENV.gcc
This is used with fails_with_llvm so that if GCC cannot be found (and we suspect this is the case with Xcode 4.2) the build will fail.

Quite possibly it should be the default.
2011-09-06 11:22:22 +01:00
Max Howell
65d4b2378a Remember compiler setting when it is changed via eg. ENV.gcc
Thus it will be correct after the setting is changed.
2011-09-06 11:22:22 +01:00
Max Howell
a0763dfc2c Remove Xcode dependence from ENV.rb
Fixes Homebrew/homebrew#7329.
Fixes Homebrew/homebrew#7269.
Fixes Homebrew/homebrew#7236.

Also quite a lot of tidy. This should all work fine.

I think we only started referring into xcode_prefix because LLVM used to not
be linked into /usr/bin. But for sure this is no longer true. If someone out
there doesn't link cc etc. into /usr/bin then I guess we can revise this patch
but it's not something we officially supported before, it was just an
accident.

I added a test step in the init code so that a working compiler will always be
selected. This is mainly a fallback for old Xcodes. Though a comment in
another area of the code suggested Xcode 3 on 10.5 doesn't have LLVM so…
2011-09-02 12:12:20 +01:00
Max Howell
d5e3c40ca1 Actually obey --use-gcc flag
Schoolboy error.
2011-09-01 14:17:29 +01:00
Max Howell
a32e738f7c Default to LLVM for Xcodes that default to LLVM 2011-08-31 17:36:41 +01:00
Eugene Ray
b6fa7ebcca Fix Xcode 4.2 cc compiles
It seems like latest build of Xcode 4.2 doesn't create "-4.2" links in /usr/bin. Because of this recipes fail with "configure: error: C compiler cannot create executables" error.

Closes Homebrew/homebrew#7254.
Closes Homebrew/homebrew#7276.

Signed-off-by: Max Howell <max@methylblue.com>

Amended to work as intended, since /usr/bin/cc is actually since Xcode 4.

Amended commit message. First line must be less than 72 characters! :P
2011-08-31 11:16:56 +01:00
Max Howell
0822907d6d Some more sanity with ENV.compiler
Deprecated use_clang? etc. since the logic was such that multiple states could be set, when in reality only one compiler can be set.

Changed fails_with_llvm handling so if HOMEBREW_USE_LLVM is set then it tries to build even if the formula has fails_with_llvm set. Rationale: mostly they will no longer fail and we need to catch these cases.
2011-08-26 14:21:37 +01:00
Max Howell
c659829f29 Add ENV.clang; Fixes Homebrew/homebrew#6580
Also tidied it up a little, reducing duplication as per original patch.
2011-08-26 13:53:36 +01:00
Max Howell
ac60ff2b14 -march=native doesn't work at all. Gee.
Fixes Homebrew/homebrew#7185.
2011-08-25 00:36:37 +01:00
Chip Turner
3299ffe590 add arrandale to list of core2 CPUs 2011-08-25 00:36:37 +01:00
Jack Nagel
d5f7594748 ENV: allow a user-configurable number of make jobs
Let an environment variable, HOMEBREW_MAKE_JOBS, override the default
'-j<cores>' make flag.

Now we can more easily debug formula that normally build in parallel, or
(potentially) speed up lengthy builds.
2011-08-24 17:14:23 -05:00
Max Howell
b025fb1397 Use -march=native when we don't otherwise know
I believe this works nowadays. When I created Homebrew originally, it did nothing. Hence all the other logic.
2011-08-24 22:30:44 +01:00
Max Howell
3a0cf31ed0 Tidy ENV.rb 2011-08-24 22:30:43 +01:00
CharlieRoot
c76ae1a94f Fix Xcode 4 compiler paths for --use-gcc
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2011-08-04 10:07:08 -07:00