homebrew-core/Formula/nspr.rb
Jack Nagel 53473b6bf5 Clean up MacOS version method usage
The MacOS.version? family of methods (other than "leopard?") are poorly
defined and lead to confusing code. Replace them in formulae with more
explicit comparisons.

"MacOS.version" is a special version object that can be compared to
numerics, symbols, and strings using the standard Ruby comparison
methods.

The old methods were moved to compat when the version comparison code
was merged, and they must remain there "forever", but they should not be
used in new code.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-10 16:16:54 -05:00

42 lines
1.4 KiB
Ruby

require 'formula'
class Nspr < Formula
homepage 'http://www.mozilla.org/projects/nspr/'
url 'http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/v4.8.8/src/nspr-4.8.8.tar.gz'
sha256 '92f3f4ded2ee313e396c180d5445cc3c718ff347d86c06b7bf14a1b5e049d4c9'
def install
ENV.deparallelize
cd "mozilla/nsprpub" do
# Fixes a bug with linking against CoreFoundation, needed to work with SpiderMonkey
# See: http://openradar.appspot.com/7209349
target_frameworks = (Hardware.is_32_bit? or MacOS.version == :leopard) ? "-framework Carbon" : ""
inreplace "pr/src/Makefile.in", "-framework CoreServices -framework CoreFoundation", target_frameworks
args = ["--prefix=#{prefix}", "--disable-debug", "--enable-strip", "--enable-optimize"]
args << "--enable-64bit" if MacOS.prefer_64_bit?
system "./configure", *args
# Remove the broken (for anyone but Firefox) install_name
inreplace "config/autoconf.mk", "-install_name @executable_path/$@ ", "-install_name #{lib}/$@ "
system "make"
system "make install"
(lib+'pkgconfig/nspr.pc').write pkg_file
end
end
def pkg_file; <<-EOF
prefix=#{HOMEBREW_PREFIX}
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/nspr
Name: NSPR
Description: Netscape Portable Runtime
Version: 4.8.8
Libs: -L${libdir} -lplds4 -lplc4 -lnspr4
Cflags: -I${includedir}
EOF
end
end