151 Commits

Author SHA1 Message Date
Jack Nagel
9c8a73cf41 Allow requirements to specify env options 2012-12-26 14:37:03 -06:00
Adam Vandenberg
489ebd78d6 Teach Pathname how to scan for metafiles 2012-11-11 10:45:58 -08:00
Adam Vandenberg
4b72e44461 Use a class for FORMULA_META_FILES
* lets more text types get picked up
* better filter for `brew list`
2012-11-11 10:27:03 -08:00
Camillo Lugaresi
18dbe47f9f debrew: formula debugging for homebrew
A new feature for easing the pain of working with complex formulas, or
formulas for large packages. When running brew in debug mode (-d), if an
exception propagates outside the formula's install method, you now get a menu
which lets you return to the point where the exception was raised and perfom
several useful actions, such as:
- printing a backtrace
- entering IRB to examine the context and test ruby code
- entering the debugger (if ruby-debug is available)
- entering a shell
- ignoring the exception or proceeding with the raise as normal

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

* Fixed conflict in build.rb.
* Removed old debug handling in Formula.brew.

Closes Homebrew/homebrew#10435.
2012-10-28 11:39:02 -04:00
Adam Vandenberg
ec24f6528d Make --ignore-dependencies work again 2012-10-23 16:05:01 -07: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
1100818100 Fix fixopt and fixopt error handling
The Keg constructor was throwing because we were returning a relative path, and the error-handler was just returning a string rather than raising a string.

Worrying because a lot of opts have not been fixed and I thought this was essential for depending on keg-only formula nowadays.

Refs Homebrew/homebrew#15077.
2012-09-24 11:41:21 -04:00
Max Howell
bda8bb08e3 Attempt to fix opt-paths for all deps
Since we changed superenv to set a PATH without /usr/local, all deps need to have opt paths.

Fixes Homebrew/homebrew#15077.
2012-09-24 11:09:13 -04:00
Max Howell
bcf0d6f245 superenv: Remove HOMEBREW_PREFIX/bin from PATH
We add the bins from all deps instead. Rationale: formula find and use eg. GNU-coreutils versions of things and then break. Only allow formula to use tools that they depend on and expect.

I want to go further and only add include paths etc. for dependencies, I have done some work on this, but I fear it may be impossible. If an include path is eg. /usr/local/lib/foo/include, is it possible to know if this path is bad? Not always AFAICT.
2012-09-23 21:26:50 -04:00
Adam Vandenberg
88ad4c061d Support env :std, :userpaths
Closes Homebrew/homebrew#14654.
2012-09-14 09:14:48 -07:00
Max Howell
523f50862b Install plists in FormulaInstaller, not build.rb
Build rb should only build!
2012-09-13 17:00:02 -04:00
Max Howell
fe295faffe ghc requires std-env
Because it builds a tool (cabal) that uses the same env that built it to build stuff.
2012-09-13 16:49:53 -04:00
Max Howell
daf8caccd4 Auctex needs user path; Fixes Homebrew/homebrew#14699 2012-09-13 09:15:24 -04:00
Max Howell
d40bbe5af4 Apply userpaths after superenv-setup
Fixes Homebrew/homebrew#14701. Stupid mistake.
2012-09-13 09:06:37 -04:00
Adam Vandenberg
95b9083744 Fix code that chmods metafiles 2012-09-09 13:23:03 -07:00
Adam Vandenberg
22685cb89d Install plists by default 2012-09-09 13:02:48 -07:00
Max Howell
feb77b2085 Prevent possible bug in build's optlink 2012-09-03 15:12:29 -04:00
Jack Nagel
b97c0919f8 Process requirements before keg-only deps under stdenv
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-02 14:41:19 -05:00
Max Howell
fd0a5419a9 Blacklist graphviz: don't use superenv
Mysterious link errors due to two missing symbols are too mysterious for me. For now, blacklist.

Fixes Homebrew/homebrew#14566.
2012-09-01 00:27:52 -04:00
Max Howell
9b01e7cd28 Fixes Homebrew/homebrew#14594; superenv recursively finds X11 req 2012-08-31 13:29:46 -04:00
Max Howell
05c708b9fc Revert the user-PATH fix
User paths might have anything in them, anything can break builds.

Instead special case these two formula with the view to having an eventual DSL to allow injection of user paths into superenv. Certainly defaulting to off.
2012-08-31 10:22:10 -04:00
Max Howell
e1ff17ed75 Force Wine to use stdenv for now
Fixes Homebrew/homebrew#14535.
2012-08-29 19:49:10 -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
466a240bbe Fixes Homebrew/homebrew#14528; undefined vars.
Due to copy/pasta.
2012-08-29 14:54:07 -04:00
Max Howell
a360a41472 superenv only adds X11 paths if required
Since we are moving towards only depending on X11 for X-headers, superenv now doesn't automatically add X11 compilation. I was reluctant to do this, but it is the right thing to do now that X11 is not automatically installed by OS X or Xcode.

I didn't implement ENV.x11 because the order that the X headers are inserted is important. It must be done at initial setup to ensure that brewed versions of e.g. freetype and Cairo are used and not the ones installed by XQuartz.
2012-08-29 12:41:37 -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
0efd1b9efe Attempt to fix opt link if absent
This is mainly to prevent errors when users for the transitionary period where most installed kegs do not have an opt link.
2012-08-29 12:41:36 -04:00
Max Howell
20ce16a3ff Much better CTRL-C handling
Let's not show weird error messages when user interrupts during various stages of brew initialization.

Tested by doing `for x in $(brew search); do brew install $x; done` and pressing CTRL-C at random short intervals.
2012-08-29 12:41:35 -04:00
Max Howell
36de29f65e Force --env=std for stuff using scons, etc.
Python et al, require stdenv because otherwise pip, gem, etc. don't work. Can be fixed, just I'm not doing it now.

We want a DSL to do this but I couldn't be bothered to make that work etc. I want to commit. Apologies.
2012-08-29 12:41:34 -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
Max Howell
f02d81ecbf Create active symlinks for installed formula
Similar to the LinkedKegs record, we write a symlink for installed kegs to PREFIX/opt.

Unlike the linked-keg record, unlinking doesn't remove the link, only uninstalling, and keg-only formula have a record too.

The reason for this addition is so that formula that depend on keg-only formula can build against the opt directory and not the cellar keg. Thus surviving upgrades.

To enforce this fix_install_names and built were adapted to use the opt path.

Standard kegs also create an opt symlink so that caveats can now refer to the opt directory and thus provide steps that survive upgrades too.

Thus the choice of /opt. It is short, neat and the right choice: POSIX dictates that opt is for stand-alone prefixes of software.
2012-08-29 12:41:33 -04:00
Jack Nagel
53cf970312 build: expand requirements recursively when modifying ENV
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-14 22:35:28 -05:00
Max Howell
88e79a9098 Uninstall keg if error during build & tab creation
Previously if error occurred in code around the logic you'd get a keg that is installed without a tab, which breaks brew.
2012-08-13 10:14:59 -04:00
Adam Vandenberg
8c8701f268 Allow multiple unsatisfied fatal requirements
Closes Homebrew/homebrew#13335.
2012-08-07 10:49:45 -07:00
Jack Nagel
5a62582b39 Requirement: add modify_build_environment method
Rather than doing type introspection in build.rb, just define a method
to perform the necessary environment setup for Requirements.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-27 02:42:22 -05:00
Jeff Clites
c2f05cfb71 Prevent error pipe object from being finalized
When the first error pipe object is finalized, the underlying file
descriptor is closed, breaking the pipe between the build script and the
main Homebrew process. Keep a reference to this object so it isn't
closed.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-08 02:35:26 -05:00
Adam Vandenberg
ec39148c04 Remove brew install foo --help
This command was undocumented, only for autotools, and it is enough to do
`brew install foo -i` and then `./configure --help` in two steps.
2012-07-07 16:53:30 -07:00
Camillo Lugaresi
4416955495 ENV.x11 automatically if depends_on :x11 2012-07-01 12:19:01 -05:00
Jack Nagel
60b518278b Refactor PATH setup
- Make ORIGINAL_PATHS an array of Pathnames instead of strings
 - Append the dev tools path once in global.rb instead of build.rb

Closes Homebrew/homebrew#13075.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-06-29 00:55:01 -05:00
Jack Nagel
1b6f23c8a9 Add comment about error pipe (mis)behavior
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-06-15 14:48:29 -05:00
Adam Vandenberg
34e51fb16b Allow --get for non-interactive builds.
This is useful for doing a --debug build, as the git repo will pick up any
changes that have been made up to that point in the build process.

--git is still most useful in conjunction with --interactive, though.
2012-06-13 23:01:41 -07:00
Misty De Meo
7af4622b0f Replace /usr/bin/ruby with full Framework path
Rationale: some users insist on replacing the /usr/bin/ruby symlink
to point to another ruby on their system, which may break homebrew.
Use the full Framework path instead, which is less likely to be tampered with.

This also reorganizes the brew --config checks to reflect the different path.

Fixes Homebrew/homebrew#12009.

Closes Homebrew/homebrew#12333.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-06-01 09:24:25 -05:00
Jack Nagel
d9fe48cf54 Set close-on-exec on the error pipe
We use a pipe to marshal exceptions from the build script back to the
main Homebrew process; the associated file descriptor is stored in an
environment variable so that the script can figure out which descriptor
to use after being exec'd.

However, any child processes of the build script inherit this
descriptor (i.e. anything spawned via "system" by the formula during
installation). Normally this is not an issue, but if a formula executes
a long-running process such as a daemon, the main Homebrew process will
never see EOF on the error pipe because the daemon still has an open
descriptor.

We can fix this while preserving current behavior by setting the
close-on-exec flag on the build script's error pipe descriptor.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-05-23 17:43:14 -05:00
Max Howell
1a63e93875 sudo -k before calling build scripts
Potentially build scripts would call sudo, if so we don't want that to automatically succeed just because the time-period in which sudo works is still active after a previous incantation.

Closes Homebrew/homebrew#10629.

In fact I don't see how this can have been the problem, but if this isn't the problem then I don't see what else can be the problem.
2012-05-15 01:56:33 -04:00
Jack Nagel
de444ead0b New fails_with infrastructure
- Formulae can now declare failures on any compiler.
 - FailsWithLLVM and associated formula elements have been moved to
   compat.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-04-01 12:39:59 -05: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
4ee255134d Replace UI uses of 'folder' with 'directory'
There are still methods and variables with the word "folder" in the
name, but at least user-facing messages and warnings should use the
correct terminology.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-24 19:43:40 -06:00
Max Howell
a69ec7a22b Add dev_tools_path to PATH if not in PATH already
This prevents what are likely a whole slew of bugs.
2012-02-16 18:19:01 +00:00
Charlie Sharpsteen
94dba21f7d Centralize definition of rack in formula.rb
`rack` is a commonly used alias for `formula.prefix.parent`---so common that it
gets defined and used quite a bit. This patch makes `rack` an official method
of the `Formula` class.
2011-09-16 08:55:38 -07:00
Max Howell
b0c6970dec Recursively scan for keg-only deps before generating build ENV
Remove cairo dep from gtk formula as a consequence.
2011-08-24 22:30:44 +01:00