151 Commits

Author SHA1 Message Date
Jack Nagel
8ca8ec3993 Fix up dep directories before activating ENV extensions 2014-07-28 23:20:23 -05:00
Jack Nagel
8a971f7268 Move the fixopt method into the Build class 2014-07-28 21:25:49 -05:00
Jack Nagel
001b2ee471 Reuse existing keg object 2014-06-26 17:21:10 -05:00
Jack Nagel
10fda9e9b9 Decouple spec selection from ARGV 2014-06-20 21:32:36 -05:00
Jack Nagel
f0e13ee97b Use multiple argument form of system 2014-06-20 18:37:24 -05:00
Jack Nagel
e3f082c294 Stop joining symbols to pathnames
Ruby 2.2's native Pathname#/ accepts only string-like objects.
2014-06-09 14:57:21 -05:00
Jack Nagel
974b7e71ef Use opt shortcut methods 2014-06-09 14:57:21 -05:00
Jack Nagel
59515ea126 Remove executable bit from build.rb
- the executed script is the formula file, build.rb is a library
 - ruby is invoked directly, so it wouldn't need to be executable anyway
2014-05-03 10:01:30 -05:00
Jack Nagel
ce1f598e98 Avoid realpath where it is not necessary
Symlinks in opt and LinkedKegs point directly at a keg in the cellar, so
only resolving one symlink should suffice, and make it clear what path
we are actually interested in.
2014-04-05 12:17:19 -05:00
Jack Nagel
c7a54f8da1 Use ARGV.env 2014-03-13 16:37:11 -05:00
Jack Nagel
d965bbba47 Allow the debugger to work from inside staged resources
References Homebrew/homebrew#23263.
Closes Homebrew/homebrew#27445.
2014-03-13 10:05:57 -05:00
Jack Nagel
9a83f63c21 Prefer Formula#name method over Formula#to_s 2014-03-03 23:51:30 -06:00
Jack Nagel
caa12678d8 Skip dependency expansion completely when ignore_deps? is true 2014-03-03 23:48:25 -06:00
Misty De Meo
d885d98164 C++ stdlibs: issue warning, don't fail the build 2014-02-02 11:04:30 -08:00
Misty De Meo
edf474cb63 C++ stdlib check: don't check executables for deps
This avoids some possible false positives, as happens with, e.g., qt4.
2014-02-02 11:04:30 -08:00
Jack Nagel
08055e1776 Ensure option names are consistent for default formula requirements 2013-12-09 14:36:10 -06:00
Jack Nagel
69dcc2592c Don't mutate deps collection when expanding requirements
Fixes Homebrew/homebrew-science#213.
2013-12-02 12:47:50 -06:00
Jack Nagel
ae1d00e31f Revert "FormulaInstaller: flush before closing writes."
This reverts commit 5ce8f7a3a494e1d8e812369301fd4c4a05a7d9b7.
2013-11-29 21:05:27 -06:00
Mike McQuaid
3c3bd76528 FormulaInstaller: flush before closing writes.
This seems to help the problem with `brew install -v` sometimes truncating output.

Closes Homebrew/homebrew#24666.
2013-11-26 16:28:27 +00:00
Jack Nagel
2fb5ead38a Prevent deps of build-time deps from leaking into the build environment
When decided what dependencies should be part of the build environment
(and have appropriate entries added to variables like PKG_CONFIG_PATH),
we select the entire dependency tree except for

 (1) inactive optional and recommended deps (2) indirect build-time deps
 (i.e., build-time deps of other deps)

There is a third category that sould be excluded: dependencies of direct
build-time deps. These are irrelevant to the build, and including them
can cause unexpected linkages.
2013-11-13 10:38:14 -06:00
Misty De Meo
3657393017 Move stdlib tracking postinstall
This moves stdlib tracking after the install completes, which allows
the tracking to have access to the actual stdlib in use.

This unfortunately means that builds can error out *after* a build,
resulting in wasted time; however, it reduces false positives, and the
overall user experience is still likely to be better this way.
2013-10-26 21:54:29 -07:00
Misty De Meo
80c77e6113 build: fix typo 2013-10-06 19:34:39 -07:00
Misty De Meo
8427e71368 Track the OS's default C++ stdlib 2013-10-06 19:26:06 -07:00
Misty De Meo
74ab023422 Only track C++ stdlibs for C++ code
After a formula is built, scan all mach-o files for dynamic links
to see if any of them point to a C++ stdlib (libc++ or libstdc++).
If one of them is linked, record that information in the formula's tab.

This replaces the old behaviour where all files were assumed to be C++
code, and stdlibs were always tracked regardless of whether they were
actually linked against.

This also modifies the way that tabs are written - now tabs are written
with the stdlib field null, and values are only written if an stdlib
is detected.
2013-10-06 19:26:06 -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
Misty De Meo
7c3d6ea81c Check dependencies for a compatible C++ stdlib
There are now a few possible C++ standard libraries a given build could
be using, with subtle incompatibilities and possibility of breakage
when mixed. This makes sure that the dependency chain was compiled in
a compatible manner.

Fortunately all of the Apple compilers use the same libstdc++, and we
don't yet support building with libc++, so this will primarily only
nag users trying to use GNU gcc who already have software installed
with Apple compilers.

Future TODOs:

* Add general support for building with libc++ (compatibility checking
  already handled here)
* Possibly track formulae which actually build C++ bindings, so that
  users aren't bothered by spurious nagging re: interpreted languages,
  pure-C software, etc.
2013-09-01 13:19:13 -07:00
Misty De Meo
b71682bdc7 Tab: track C++ stdlib in use
There are subtle incompatibilities between Apple's libstdc++ and the
libstdc++ used by the various GNU GCC formulae. In addition, we'll
likely also be supporting libc++ in the future, and that's also
incompatible with the other stdlibs.

Tracking it in the tab lets us make sure that dependencies are all
built against the same stdlib to avoid subtle breakage.
2013-09-01 13:19:13 -07:00
Misty De Meo
3ac74331a8 Move Tab creation into build process
The parent process doesn't have access to the selected compiler, which
will be important in the next commit.

Fortunately the child process already has a filtered and massaged
ARGV, so it has enough information to build the tab itself.
2013-09-01 13:19:13 -07:00
Jack Nagel
eebc04ec9b Move common stuff to extend/ENV.rb 2013-08-19 12:32:57 -05:00
Jack Nagel
bf0e329010 Make Superenv activation explicit 2013-08-19 12:32:56 -05:00
Jack Nagel
93af660c7f Handle optional build-time deps correctly 2013-07-22 21:36:11 -05:00
Jack Nagel
0f314f9808 Remove unused variable 2013-06-12 17:25:29 -05:00
Jack Nagel
580eea89be Cast deps to formula before passing them to superenv
Dependency names retain the "tap prefix", e.g. the "homebrew/dupes"
part of "homebrew/dupes/zlib". However formula objects do not, and this
is desired because we do not record the tap name as part of the
installation prefix.

So we need to ensure the correct dep names are passed to superenv,
otherwise it will not add the correct directories to various environment
variables.
2013-06-10 17:38:52 -05:00
Jack Nagel
873d9766ae Allow explicit conversion of requirements to deps
Fixes Homebrew/homebrew#19857.
2013-06-03 16:52:00 -05:00
Jack Nagel
05f92b5c98 build: expand dependencies only once
Closes Homebrew/homebrew#20081.
2013-05-25 15:27:10 -05:00
Jack Nagel
12158b201d build: expand requirements only once 2013-05-25 15:26:55 -05:00
Jack Nagel
f264d5a93c build: make deps an attribute of Build 2013-05-25 15:26:55 -05:00
Jack Nagel
67694b8c60 build: move build methods into a class 2013-05-25 15:26:55 -05:00
Misty De Meo
4fdbb2d685 CompilerSelector: raise when no compatible compiler
This replaces the old behaviour of falling back to the original
compiler with no messaging.

Fixes Homebrew/homebrew#19170.
Fixes mistydemeo/tigerbrew#45.
2013-05-20 23:25:15 -05:00
Jack Nagel
007d174f43 build: use ARGV.interactive? instead of .flag? 2013-05-20 22:34:53 -05:00
Jack Nagel
2f49fd07b1 Isolate compiler selector tests 2013-04-02 13:19:04 -05:00
Jack Nagel
a55fa2c359 Decouple CompilerSelector from ENV 2013-03-16 13:05:02 -05:00
Jack Nagel
cc08d08d74 Switch compilers when no build is specified
Given the current state of OS X compilers, the original fails_with
behavior is becoming less useful, mostly resulting in build failures
each time the compiler is updated. So make the following changes:

When a build is specified, we retain the old behavior: switch compilers
if the available compiler is <= the build, don't switch if it is > the
build.

When no build is specified, unconditionally switch compilers, and don't
output the advice message. This allows us to mark formulae as
perpetually failing, avoiding the need to update formulae each time a
new compiler build is made available.

As a bonus, this makes the logic much easier to reason about.

Closes Homebrew/homebrew#18175.
2013-03-12 13:55:15 -05:00
Jack Nagel
a21be66fc8 Rename these collections for clarity 2013-03-09 17:13:34 -06:00
Jack Nagel
c75a7decb7 Save a subshell here 2013-03-02 23:28:27 -06:00
Jack Nagel
97f9f93f25 build: ignore non-explicit build-time dependencies
Given the following dependency tree:

  foo
    bar (bottled)
      baz (build-time only)

We skip installing baz because it is a build-time dependency of
something that is bottled. However, during the build of foo, this filter
is not applied because the dependent-dep relationship is not considered
at this stage. If baz wasn't installed prior to this build, fixopt(baz)
will fail.

Further, build-time deps are tightly coupled to the formula they are
specified by, and we shouldn't rely on them coming from dependencies
several levels down.

Fixes Homebrew/homebrew#17697.
2013-02-09 14:37:36 -06:00
Jack Nagel
fba1d2129b build: accept X11 proxies as X11 deps 2013-01-31 19:46:18 -06:00
Jack Nagel
109145bf21 Replace usages of recursive_deps with recursive_dependencies 2013-01-26 12:14:49 -06:00
Jack Nagel
3d92f1c683 build: reorganize #install for readability 2013-01-21 17:14:16 -06:00
Jack Nagel
4dffd3beb9 Set userpaths before processing requirement ENV modifications 2013-01-09 11:46:51 -06:00