71 Commits

Author SHA1 Message Date
Mike McQuaid
663f51b88e keg_relocate: don't assume .la files are in lib.
Sometimes they are in e.g. libexec but there's no real reason to assume
they are anywhere; we want to relocate them regardless.
2016-04-24 22:06:14 +01:00
William Woodruff
afe0fde49c os/mac: optionally use ruby_macho.
- and branch for dylib_id_and_dylibs
- add branches for dylib id changing and change_install_name
- rename MachO module to HomebrewMachO to prevent namespace clashes
  with MachO in ruby-macho. this will eventually be replaced entirely
  with direct calls to ruby-macho methods
- break ruby-macho implementation out into separate RubyMachO module,
  and include either RubyMachO or CctoolsMachO (the original
  implementation) based on the HOMEBREW_RUBY_MACHO env var
- move ArchitectureListExtension and RubyMachO into separate files
- create {ruby_,cctools_,,}relocate.rb for isolation of different
  methods of mach-o relocation (ruby-macho vs. cctools)
- fill in require_install_name_tool? for ruby_relocate.rb
- rename {ruby_,cctools_,,}relocate.rb to keg, isolate requires in
  os/mac

Closes Homebrew/homebrew#45001.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-03 21:25:40 +00:00
Syed Humza Shah
5e09a6a743 keg_relocate: replaced 'if' with guard clause
Closes Homebrew/homebrew#46211.
2015-11-24 10:48:28 +00:00
Martin Afanasjew
6f5307fbd9 keg_relocate: fix relocation of frameworks
When fixing references to regular dylibs, it is sufficient to search for
a file with the same base name, e.g., `libpoppler.56.dylib`. However, if
the broken reference is to a framework, we also have to take into
account preceding path components to find a suitable match. Framework
references (according to the `dyld` man page) come in two flavors:

- `XXX.framework/Versions/YYY/XXX` (with version)
- `XXX.framework/XXX` (without version)

The change here is to detect these patterns and to make sure that the
fixed library reference has the same suffix as the broken one.

Prior to this fix, a broken framework reference (if originating in a
sister framework) to `QtXml.framework/Versions/5/QtXml` would have been
rewritten to `<qt5-keg>/lib/QtXml.framework/QtXml`. In practice, this
mostly works, but is technically incorrect and thus creates problems
like in Homebrew/homebrew#42191. With this fix, the framework reference is correctly
rewritten to `<qt5-keg>/lib/QtXml.framework/Versions/5/QtXml`.

Closes Homebrew/homebrew#45494.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-11-19 08:54:58 +00:00
Martin Afanasjew
4d772042f7 keg_relocate: remove options from Keg#dylib_id_for
No longer used since commit 3b0cbe6a56d9133941482a9e2d033ad86cdb5e79.

Closes Homebrew/homebrew#45835.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-11-11 14:23:59 +08:00
Mike McQuaid
f59ad1c9e9 Revert "keg_relocate: fix relocation of frameworks"
This reverts commit 14ce4027ae5b8aa994f4bdf0b8160bbc4994948b.
2015-11-08 14:00:27 -08:00
Martin Afanasjew
06634edab7 keg_relocate: fix relocation of frameworks
When fixing references to regular dylibs, it is sufficient to search for
a file with the same base name, e.g., `libpoppler.56.dylib`. However, if
the broken reference is to a framework, we also have to take into
account preceding path components to find a suitable match. Framework
references (according to the `dyld` man page) come in two flavors:

- `XXX.framework/Versions/YYY/XXX` (with version)
- `XXX.framework/XXX` (without version)

The change here is to detect these patterns and to make sure that the
fixed library reference has the same suffix as the broken one.

Prior to this fix, a broken framework reference (if originating in a
sister framework) to `QtXml.framework/Versions/5/QtXml` would have been
rewritten to `<qt5-keg>/lib/QtXml.framework/QtXml`. In practice, this
mostly works, but is technically incorrect and thus creates problems
like in Homebrew/homebrew#42191. With this fix, the framework reference is correctly
rewritten to `<qt5-keg>/lib/QtXml.framework/Versions/5/QtXml`.

Closes Homebrew/homebrew#45494.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-11-08 13:27:03 -08:00
Tim D. Smith
f81d561b67 always use opt_prefix in install_name
dylib install_names are presently rewritten relative to HOMEBREW_PREFIX,
except for keg-only formulas, which are rewritten relative to
opt_prefix.

If we make a formula keg_only, all of its dependents need to be bumped,
since it will no longer exist in HOMEBREW_PREFIX and all of the links
will be written incorrectly.

If we always use opt_prefix, we avoid that dilemma, and make installed
packages more robust if a dependency is `brew unlink`ed.

Closes Homebrew/homebrew#43518.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2015-10-16 17:22:35 +01:00
Xu Cheng
e23cca8d84 bottle: auto detect any_skip_relocation 2015-09-12 01:39:00 +08:00
Xu Cheng
d911b5689a keg_relocate: split relocate_install_names and relocate_text_files
For bottle with `:any_skip_relocation`, relocating text files is
required.
2015-09-12 01:38:59 +08:00
Xu Cheng
5241932b45 keg_relocate: fix absolute symlink 2015-09-11 18:32:35 +08:00
Xu Cheng
a88c40b8c8 core file style update 2015-08-22 13:15:33 +08:00
William Woodruff
1face808f5 Add guards to calls that would trigger Xcode install requests
add guard in Formula#file_modified? to prevent git popup

add guard in Superenv.bin before calling MacOS::Xcode.version

add guard against missing Xcode/CLT in Xcode.uncached_version

return nil instread of 0 in uncached_version when Xcode/CLT are not present, to distinguish from linuxbrew behavior

checks against pour_bottle? and needs_relocation?, add guard around keg.relocate_install_names to check pour_bottle?/needs_relocation? as well

needs_relocation? becomes skip_relocation?, use cellar attr to indicate relocation instead of does_not_need_relocation

MacOS.can_build? becomes MacOS.has_apple_developer_tools?
2015-08-21 11:02:33 -07:00
William Woodruff
85187bf6d3 MacOS: update locate_cctool
This becomes MacOS.{install_name_tool,otool}, only do check_xcode if
xcode is installed, otherwise emit a warning
2015-08-21 10:58:13 -07:00
Mike McQuaid
ea5840ed61 keg_relocate: fix syntax error.
Closes Homebrew/homebrew#42408.
2015-08-03 14:25:38 +01:00
Xu Cheng
d62095710f More core files style updates 2015-08-03 20:38:20 +08:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Xu Cheng
de6a9ff055 keg_relocate: relocate libtool files 2015-07-23 16:29:37 +08:00
Mike McQuaid
70739e9f05 keg_relocate: also relocate executable text files.
There are times (e.g. `ocaml`) when the `text_executable?` test will
match even although `file` does not consider it a text file. Ensure
that it's relocated in this case correctly.

References Homebrew/homebrew#41663.
Closes Homebrew/homebrew#41926.
2015-07-20 12:06:13 +01:00
Mike McQuaid
5db82b46b1 keg_relocate: don't match "text" in filenames. 2015-07-20 08:34:03 +01:00
Mike McQuaid
b9cdfe21fc keg_relocate: relocate all text files.
Work out what's text and what's not using `file`. Also, rename
`keg_fix_install_names` to `keg_relocate` because that's a more
accurate description of what it does now.

Closes Homebrew/homebrew#41663.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-07-18 19:52:56 -07:00