diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 3a395660700439b77b733574dffe39eae066f2de..1dd6da4b3572854c7e23328344b8eb776e968b9d 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -64,7 +64,7 @@ module Homebrew def fetch_bottle?(f) return true if ARGV.force_bottle? && f.bottle return false unless f.bottle && f.pour_bottle? - return false if ARGV.build_from_source? || ARGV.build_bottle? + return false if ARGV.build_formula_from_source?(f) return false unless f.bottle.compatible_cellar? true end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 22be53ad0112387010e528d1773168a2b1fff0d7..d41ef66d4599c21c02a4809a3792b88217284c3f 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -24,8 +24,13 @@ #: `gcc-4.2` for Apple's GCC 4.2, or `gcc-4.9` for a Homebrew-provided GCC #: 4.9. #: -#: If `--build-from-source` is passed, compile from source even if a bottle -#: is provided for <formula>. +#: If `--build-from-source` or `-s` is passed, compile the specified <formula> from +#: source even if a bottle is provided. Dependencies will still be installed +#: from bottles if they are available. +#: +#: If `HOMEBREW_BUILD_FROM_SOURCE` is set, regardless of whether `--build-from-source` was +#: passed, then both <formula> and the dependencies installed as part of this process +#: are built from source even if bottles are available. #: #: If `--force-bottle` is passed, install from a bottle if it exists #: for the current version of OS X, even if custom options are given. @@ -259,7 +264,7 @@ module Homebrew fi.ignore_deps = ARGV.ignore_deps? fi.only_deps = ARGV.only_deps? fi.build_bottle = ARGV.build_bottle? - fi.build_from_source = ARGV.build_from_source? + fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source? fi.force_bottle = ARGV.force_bottle? fi.interactive = ARGV.interactive? fi.git = ARGV.git? diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 8cf81fb619173badc29e6177c95b8aae6ada5dbb..4a23c00ec6202f7788ae11d2d160a16311c5bd97 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -26,7 +26,7 @@ module Homebrew fi = FormulaInstaller.new(f) fi.options = options fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && tab.build_bottle?) - fi.build_from_source = ARGV.build_from_source? + fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source? fi.force_bottle = ARGV.force_bottle? fi.interactive = ARGV.interactive? fi.git = ARGV.git? diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 2f8407feb2bc86d5250860dabeeaa9dad5cb94ed..c296e77577a110428edf5c82b671383b355bb6e2 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -71,7 +71,7 @@ module Homebrew fi = FormulaInstaller.new(f) fi.options = tab.used_options fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && tab.build_bottle?) - fi.build_from_source = ARGV.build_from_source? + fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source? fi.verbose = ARGV.verbose? fi.quieter = ARGV.quieter? fi.debug = ARGV.debug? diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index eec2172a2bf557b753faf222243cbedaede58382..bb26d453fbce6c796127a6905e8f70a55c0e0dac 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -185,7 +185,19 @@ module HomebrewArgvExtension end def build_from_source? - switch?("s") || include?("--build-from-source") || !!ENV["HOMEBREW_BUILD_FROM_SOURCE"] + switch?("s") || include?("--build-from-source") + end + + def build_all_from_source? + !!ENV["HOMEBREW_BUILD_FROM_SOURCE"] + end + + # Whether a given formula should be built from source during the current + # installation run. + def build_formula_from_source?(f) + return true if build_all_from_source? + return false unless (build_from_source? || build_bottle?) + formulae.any? { |argv_f| argv_f.full_name == f.full_name } end def flag?(flag) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index afeb3ec27a4e6f71f1b094e171d3c2cfab77b12a..a25a78f4440124db5cbc0823ad0d6a90c84a874c 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -794,6 +794,8 @@ class Formula opt_prefix+"Frameworks" end + # Indicates that this formula supports bottles. (Not necessarily that one + # should be used in the current installation run.) # Can be overridden to selectively disable bottles from formulae. # Defaults to true so overridden version does not have to check if bottles # are supported. diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 4de4a79dc750264db3f398d05a88908aaf50c5c9..4b8dcf202e51e9417f0d8378735445abaafa5d8c 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -428,7 +428,7 @@ class FormulaInstaller fi.options |= tab.used_options fi.options |= Tab.remap_deprecated_options(df.deprecated_options, dep.options) fi.options |= inherited_options - fi.build_from_source = build_from_source? + fi.build_from_source = ARGV.build_formula_from_source?(df) fi.verbose = verbose? && !quieter? fi.debug = debug? fi.prelude diff --git a/share/doc/homebrew/brew.1.html b/share/doc/homebrew/brew.1.html index daf613eb3d9f399127c58fe7af31e3613874acba..ca2230308bc68e2727e2adcb527a204abb643828 100644 --- a/share/doc/homebrew/brew.1.html +++ b/share/doc/homebrew/brew.1.html @@ -145,7 +145,7 @@ For tarballs, also print SHA-256 checksums.</p> <p>If <code>--HEAD</code> or <code>--devel</code> is passed, fetch that version instead of the stable version.</p> -<p>If <code>-v</code> is passed, do a verbose VCS checkout, if the URL represents a CVS. +<p>If <code>-v</code> is passed, do a verbose VCS checkout, if the URL represents a VCS. This is useful for seeing if an existing VCS cache has been updated.</p> <p>If <code>--force</code> is passed, remove a previously cached version and re-fetch.</p> @@ -196,8 +196,13 @@ options but do not install the specified formula.</p> <code>gcc-4.2</code> for Apple's GCC 4.2, or <code>gcc-4.9</code> for a Homebrew-provided GCC 4.9.</p> -<p>If <code>--build-from-source</code> is passed, compile from source even if a bottle -is provided for <var>formula</var>.</p> +<p>If <code>--build-from-source</code> or <code>-s</code> is passed, compile the specified <var>formula</var> from +source even if a bottle is provided. Dependencies will still be installed +from bottles if they are available.</p> + +<p>If HOMEBREW_BUILD_FROM_SOURCE is set, regardless of whether <code>--build-from-source</code> was +passed, then both <var>formula</var> and the dependencies installed as part of this process +are built from source even if bottles are available.</p> <p>If <code>--force-bottle</code> is passed, install from a bottle if it exists for the current version of OS X, even if custom options are given.</p> diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1 index acadd5de28f51b2b4d385cdd9e05921d4921f1e7..201e45a7de325de7c01ea3b240cb6c5ea9499628 100644 --- a/share/man/man1/brew.1 +++ b/share/man/man1/brew.1 @@ -196,7 +196,7 @@ Download the source packages for the given \fIformulae\fR\. For tarballs, also p If \fB\-\-HEAD\fR or \fB\-\-devel\fR is passed, fetch that version instead of the stable version\. . .IP -If \fB\-v\fR is passed, do a verbose VCS checkout, if the URL represents a CVS\. This is useful for seeing if an existing VCS cache has been updated\. +If \fB\-v\fR is passed, do a verbose VCS checkout, if the URL represents a VCS\. This is useful for seeing if an existing VCS cache has been updated\. . .IP If \fB\-\-force\fR is passed, remove a previously cached version and re\-fetch\. @@ -265,7 +265,10 @@ If \fB\-\-only\-dependencies\fR is passed, install the dependencies with specifi If \fB\-\-cc=\fR\fIcompiler\fR is passed, attempt to compile using \fIcompiler\fR\. \fIcompiler\fR should be the name of the compiler\'s executable, for instance \fBgcc\-4\.2\fR for Apple\'s GCC 4\.2, or \fBgcc\-4\.9\fR for a Homebrew\-provided GCC 4\.9\. . .IP -If \fB\-\-build\-from\-source\fR is passed, compile from source even if a bottle is provided for \fIformula\fR\. +If \fB\-\-build\-from\-source\fR or \fB\-s\fR is passed, compile the specified \fIformula\fR from source even if a bottle is provided\. Dependencies will still be installed from bottles if they are available\. +. +.IP +If HOMEBREW_BUILD_FROM_SOURCE is set, regardless of whether \fB\-\-build\-from\-source\fR was passed, then both \fIformula\fR and the dependencies installed as part of this process are built from source even if bottles are available\. . .IP If \fB\-\-force\-bottle\fR is passed, install from a bottle if it exists for the current version of OS X, even if custom options are given\.