54 Commits

Author SHA1 Message Date
Jack Nagel
ce19fa2223 Unify install name parsing 2013-12-14 09:35:58 -06:00
Jack Nagel
de20814162 keg: use start_with? instead of regexp match 2013-12-14 09:35:58 -06:00
Jack Nagel
c6c7b9b165 Extract HOMEBREW_TEMP constant 2013-12-14 09:35:58 -06:00
Jack Nagel
f458fa9e9a keg: add debug output to install name machinery 2013-12-14 09:35:58 -06:00
Jack Nagel
c31512fe33 keg: the argument to find_dylib is already a Pathname 2013-12-14 09:35:58 -06:00
Jack Nagel
3662a2765d keg: combine loops in relocate_install_names 2013-12-14 09:35:58 -06:00
Jack Nagel
f6979cccb2 keg: eliminate reject_proc, make callers determine which names to fix 2013-12-14 09:35:58 -06:00
Jack Nagel
25632546a4 keg: yield install names successively instead of all at once
Every caller of install_names_for loops over the yielded array. Now that
we have separated the dylib id calculation and update, we can eliminate
the need for a separate loop and yield each install name individually.

Rename this method to "each_install_name_for" for clarity.
2013-12-14 09:35:57 -06:00
Jack Nagel
b86e98426e keg: decouple dylib id changes from install name changes
The dylib id calculation does not use any information gathered in
install_names_for, so we can pull the logic out completely and only
yield the install names.
2013-12-14 09:35:57 -06:00
Jack Nagel
f4618f0147 keg: factor out dylib id calculation 2013-12-14 09:35:57 -06:00
Jack Nagel
7a10493387 keg: try to avoid disk IO when possible
Calling Pathname#text_executable? reads in the first 1024 bytes of the
file, so try the basename check (which requires no filesystem access)
first.
2013-12-14 09:35:57 -06:00
Jack Nagel
24d8791dfb keg: use lib helper 2013-12-14 09:35:57 -06:00
Jack Nagel
935091cd8e Pathname#extname returns a string 2013-12-14 09:35:57 -06:00
Elliot Saba
3d76a2c8df Relocate libtool (.la) files as well as pkgconfig (.pc)
Ignore quotes, just do a global substitution on cellar and prefix.

Closes Homebrew/homebrew#24894.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-12-04 22:37:58 -06:00
Jack Nagel
2e89175eef relocate_install_names: only one substitution is needed 2013-12-04 22:37:58 -06:00
Jack Nagel
ca01b0ad97 relocate_install_names: use a single ensure_writable block 2013-12-04 22:37:57 -06:00
Jack Nagel
cf4e159d53 relocate_install_names: yielded names are already strings 2013-12-04 22:37:57 -06:00
Jack Nagel
e3bd9b2607 Let fix_install_names fix up placeholders too 2013-12-04 22:37:57 -06:00
Jack Nagel
f2aaa5f0ac Teach installer about prefix and cellar placeholders 2013-12-04 22:37:57 -06:00
Jack Nagel
2b5e57a4bd Remove special handling for relocatable pkgconfig files 2013-12-04 22:37:57 -06:00
Jack Nagel
76153e9780 Insert placeholders for prefix and cellar in relocatable bottles 2013-12-04 22:37:57 -06:00
Jack Nagel
94ebe8e747 relocate_install_names: rewrite cellar names before prefix names
The cellar may overlap with the prefix, so if we replace the prefix
first, we will end up with paths like "@@HOMEBREW_PREFIX@@/Cellar"
instead of "@@HOMEBREW_CELLAR@@", which will break on installations
where the cellar and prefix are disjoint.
2013-12-04 22:37:57 -06:00
Jack Nagel
98cc0b3022 fix_install_names: extract change_dylib_id 2013-12-04 22:37:57 -06:00
Jack Nagel
e7633d876e fix_install_names: extract change_install_name 2013-12-04 22:37:57 -06:00
Jack Nagel
4a972e5f41 Ensure cellar path is replace correctly for relocatable bottles 2013-12-01 17:05:02 -06:00
Jack Nagel
d6a94eb452 Skip path replacement when it would be a no-op 2013-12-01 17:05:02 -06:00
Jack Nagel
0224bce9f6 Extract repeated regexp to a method 2013-12-01 17:05:02 -06:00
Elliot Saba
0ece9135eb Add support for relocating pkgconfig files for bottles
* Finds pkg-config files such as "lib/pkgconfig/libfoo.pc" and "bin/libfoo-config"
 * Does inreplace on paths in such files to allow for better bottle relocation ability

Closes Homebrew/homebrew#23825.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-11-13 18:49:16 -06:00
Misty De Meo
0e6df1c3bf detect_cxx_stdlibs: use mach_o_files 2013-10-26 21:54:30 -07:00
Jack Nagel
c511d7d2f4 Add OS.mac? and OS.linux? 2013-10-18 12:56:51 -05:00
Misty De Meo
a5f68bb874 detect_cxx_stdlibs: Only detect for dylibs
Fixes Homebrew/homebrew#23115.
2013-10-08 09:04:21 -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
Alex Malinovich
fb929f429f Fix typo in Keg#fixed_name invocation
Closes Homebrew/homebrew#23079.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-10-06 14:20:06 -05:00
Xiyue Deng
592b5d91a0 Fix install_name_tool path for keg_only formulae
* When a versioned keg_only formula installs the same set of executables
  or libraries as a unversioned formula that links to $HOMEBREW_PREFIX,
  install_name_tool will prefer to use the linked paths for files in
  keg_only formula.  This breaks software that should link to the
  keg_only formula but links to the unversioned one instead.
* Add an additional "options" parameter with keg_only field to specify
  the correct install path for keg_only formulae.
2013-10-04 02:03:03 -07:00
Jack Nagel
0bf35a05a9 Favor equality check over nil check 2013-05-22 19:42:43 -05:00
Jack Nagel
da2b5cf5ab Extract name repair logic from fix_install_names 2013-05-22 11:40:57 -05:00
Jack Nagel
2488cfa55a Factor out MacOS.locate("install_name_tool") calls 2013-05-22 11:11:32 -05:00
Mike McQuaid
0f9910d352 Relocate bottles using install_name_tool.
This has two parts:

1. Bottles are temporarily relocated on bottling and tested if that is
sufficient for them to contain no longer reference the prefix or
cellar. If so, they are marked as relocatable.
2. On installation if bottles are marked as relocatable they will be
relocated using install_name_tool to the current prefix and cellar.

Closes Homebrew/homebrew#18374.
2013-03-11 18:58:37 +00:00
Mike McQuaid
98352b3b41 Don't run certain functions on non-MACOS. 2013-03-11 18:26:25 +00:00
Jack Nagel
21098905ab Fix framework install names 2012-11-06 13:04:40 -06:00
Jack Nagel
bd4f69a718 Don't try to fix @rpath install names
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-18 13:07:00 -05:00
Jack Nagel
186a76c741 Fix bad install names in executables
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-04 13:02:43 -05: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
98b6f24510 keg_fix_install_names doesn't need Find
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-21 14:23:25 -05:00
samueljohn
725feb3db1 Core change: XCode only install, with CLT or both
Allow XCode without the Command Line Tools to
work with homebrew, so it's not necessary
to register an Apple Dev ID and/or go to the
XCode prefs and download the CLT. Yay!

Further, this commit allows to use the CLT
solely (without the need for XCode).
Saves quite some megs.
(Some furmulae require xcodebuild)

Of course XCode together with the CLT is still
fine and has been tested on 10.7 and 10.6
with Xcode 4 and Xcode 3.

Only on Lion or above, tell the user about the options,
which are
- Xcode without CLT
- CLT without Xcode
- both (ok, it's not directly stated, but implicit)
So if no Xcode is found and we are on Lion or above,
we don't fail but check for the CLTs now.
For older Macs, the old message that Xcode is needed
and the installer should be run is still displayed.
If the CLT are not found but Xcode is, then we
print out about the experimental status of this setup.

Closes Homebrew/homebrew#10510.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2012-06-24 19:11:06 -07:00
Jack Nagel
58d4a95ea7 fix_install_names: try harder to find referenced dylibs
Keg#fix_install_names punts if bad install names reference dylibs that
aren't "nearby". Enable this machinery to fix more complex directory
hierarchies by searching everything under 'lib' for the bad name's
basename.

Additionally, teach it to correctly handle Mach-O bundle files.

Fixes Homebrew/homebrew#12810.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-06-17 16:22:08 -05:00
Jack Nagel
1a47306467 fix_install_names: make failures verbose in debug mode
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-05-30 22:32:49 -05:00
Jack Nagel
7bb1894df5 fix_install_names: use Mach-O methods to find dylibs
Some libraries do not have the .dylib extension (e.g. Qt framework
libs), but need to have their install names rewritten to prevent other
packages from breaking due to upgrades. Use the new Pathname#dylib?
instead.
2012-05-30 22:32:48 -05:00
Jack Nagel
b6e0dfed23 Recurse into subdirectories when fixing install names 2012-05-30 22:32:48 -05:00
Camillo Lugaresi
e32e2475bb Make fix_install_names more robust
fixes a problem with the opencv formula

Closes Homebrew/homebrew#10291.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-21 19:39:37 -06:00