Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
Standardize 32 bit build switch
Browse files Browse the repository at this point in the history
  • Loading branch information
adamv committed Jan 2, 2012
1 parent 0401df3 commit 4fb1699
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Library/Formula/gmp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Gmp < Formula

def options
[
["--32-bit", "Force 32-bit."],
["--32-bit", "Build 32-bit only."],
["--skip-check", "Do not run 'make check' to verify libraries."]
]
end
Expand All @@ -32,7 +32,7 @@ def install

# Build 32-bit where appropriate, and help configure find 64-bit CPUs
# see: http://gmplib.org/macos.html
if MacOS.prefer_64_bit? and not ARGV.include? "--32-bit"
if MacOS.prefer_64_bit? and not ARGV.build_32_bit?
ENV.m64
args << "--build=x86_64-apple-darwin"
else
Expand Down
4 changes: 2 additions & 2 deletions Library/Formula/mpfr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Mpfr < Formula
depends_on 'gmp'

def options
[["--32-bit", "Force 32-bit."]]
[["--32-bit", "Build 32-bit only."]]
end

def patches
Expand All @@ -20,7 +20,7 @@ def install

# Build 32-bit where appropriate, and help configure find 64-bit CPUs
# Note: This logic should match what the GMP formula does.
if MacOS.prefer_64_bit? and not ARGV.include? "--32-bit"
if MacOS.prefer_64_bit? and not ARGV.build_32_bit?
ENV.m64
args << "--build=x86_64-apple-darwin"
else
Expand Down
4 changes: 2 additions & 2 deletions Library/Formula/opencv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ def patches
end

def options
[['--build32', 'Force a 32-bit build.']]
[["--32-bit", "Build 32-bit only."]]
end

def install
args = std_cmake_parameters.split
args << "-DOPENCV_EXTRA_C_FLAGS='-arch i386 -m32'" if ARGV.include? '--build32'
args << "-DOPENCV_EXTRA_C_FLAGS='-arch i386 -m32'" if ARGV.build_32_bit?

# The CMake `FindPythonLibs` Module is dumber than a bag of hammers when
# more than one python installation is available---for example, it clings
Expand Down
6 changes: 2 additions & 4 deletions Library/Formula/p7zip.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
require 'formula'

def build_32bit?; ARGV.include? '--32-bit' or Hardware.is_32_bit?; end

class P7zip < Formula
url 'http://downloads.sourceforge.net/project/p7zip/p7zip/9.20.1/p7zip_9.20.1_src_all.tar.bz2'
homepage 'http://p7zip.sourceforge.net/'
md5 'bd6caaea567dc0d995c990c5cc883c89'

def options
[["--32-bit", "Force 32-bit."]]
[["--32-bit", "Build 32-bit only."]]
end

def install
if build_32bit?
if Hardware.is_32_bit? or ARGV.build_32_bit?
mv 'makefile.macosx_32bits', 'makefile.machine'
else
mv 'makefile.macosx_64bits', 'makefile.machine'
Expand Down
4 changes: 2 additions & 2 deletions Library/Formula/sbcl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def options
["--without-threads", "Build SBCL without support for native threads"],
["--with-ldb", "Include low-level debugger in the build"],
["--with-internal-xref", "Include XREF information for SBCL internals (increases core size by 5-6MB)"],
["--32bit", "Override arch detection and compile for 32-bits."]
["--32-bit", "Build 32-bit only."]
]
end

Expand Down Expand Up @@ -69,7 +69,7 @@ def install

Dir.chdir(build_directory)

if ARGV.include? "--32bit"
if ARGV.build_32_bit?
system "SBCL_ARCH=x86 ./make.sh --prefix='#{prefix}' --xc-host='#{xc_cmdline}'"
else
system "./make.sh --prefix='#{prefix}' --xc-host='#{xc_cmdline}'"
Expand Down
7 changes: 7 additions & 0 deletions Library/Homebrew/extend/ARGV.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ def build_universal?
include? '--universal'
end

# Request a 32-bit only build.
# This is needed for some use-cases though we prefer to build Universal
# when a 32-bit version is needed.
def build_32_bit?
include? '--32-bit'
end

def build_from_source?
return true if flag? '--build-from-source' or ENV['HOMEBREW_BUILD_FROM_SOURCE'] \
or not MacOS.lion? or HOMEBREW_PREFIX.to_s != '/usr/local'
Expand Down

0 comments on commit 4fb1699

Please sign in to comment.