homebrew-core/Formula/nss.rb

85 lines
2.4 KiB
Ruby
Raw Normal View History

2014-05-31 15:19:34 +00:00
require "formula"
class Nss < Formula
2014-03-21 02:06:51 +00:00
homepage "https://developer.mozilla.org/docs/NSS"
2014-06-30 18:39:39 +00:00
url "https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_16_2_RTM/src/nss-3.16.2.tar.gz"
sha1 "c4e7f007723cfafcf7fe743000e3960cc5086642"
2014-03-21 16:45:01 +00:00
bottle do
cellar :any
sha1 "614b281c05b0544ebf2485f2fdf25497136c6535" => :mavericks
sha1 "e3db185142fff3fd11432d3542d59b722d02d06e" => :mountain_lion
sha1 "65416dfa06130a4834c7a83e41dfb11a672c88e5" => :lion
2014-03-21 16:45:01 +00:00
end
2014-03-21 02:06:51 +00:00
depends_on "nspr"
def install
ENV.deparallelize
2014-03-21 02:06:51 +00:00
cd "nss"
args = [
2014-03-21 02:06:51 +00:00
"BUILD_OPT=1",
"NSS_USE_SYSTEM_SQLITE=1",
"NSPR_INCLUDE_DIR=#{HOMEBREW_PREFIX}/include/nspr",
"NSPR_LIB_DIR=#{HOMEBREW_PREFIX}/lib"
]
2014-03-21 02:06:51 +00:00
args << "USE_64=1" if MacOS.prefer_64_bit?
# Remove the broken (for anyone but Firefox) install_name
2014-03-21 02:06:51 +00:00
inreplace "coreconf/Darwin.mk", "-install_name @executable_path", "-install_name #{lib}"
inreplace "lib/freebl/config.mk", "@executable_path", lib
system "make", "all", *args
# We need to use cp here because all files get cross-linked into the dist
# hierarchy, and Homebrew's Pathname.install moves the symlink into the keg
# rather than copying the referenced file.
2014-03-21 02:06:51 +00:00
cd "../dist"
2014-05-31 15:19:34 +00:00
bin.mkpath
Dir.glob("Darwin*/bin/*") do |file|
2014-03-21 02:06:51 +00:00
cp file, bin unless file.include? ".dylib"
end
include_target = include + "nss"
2014-05-31 15:19:34 +00:00
include_target.mkpath
Dir.glob("public/{dbm,nss}/*") { |file| cp file, include_target }
2014-05-31 15:19:34 +00:00
lib.mkpath
libexec.mkpath
Dir.glob("Darwin*/lib/*") do |file|
2014-05-31 15:24:53 +00:00
if file.include? ".chk"
cp file, libexec
else
cp file, lib
end
end
# resolves conflict with openssl, see #28258
rm lib/"libssl.a"
2014-03-21 02:06:51 +00:00
(lib+"pkgconfig/nss.pc").write pc_file
end
2013-02-02 05:12:47 +00:00
test do
# See: http://www.mozilla.org/projects/security/pki/nss/tools/certutil.html
2014-03-21 02:06:51 +00:00
(testpath/"passwd").write("It's a secret to everyone.")
2013-02-02 05:12:47 +00:00
system "#{bin}/certutil", "-N", "-d", pwd, "-f", "passwd"
system "#{bin}/certutil", "-L", "-d", pwd
end
def pc_file; <<-EOS.undent
prefix=#{opt_prefix}
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/nss
Name: NSS
Description: Mozilla Network Security Services
Version: #{version}
Requires: nspr
Libs: -L${libdir} -lnss3 -lnssutil3 -lsmime3 -lssl3
Cflags: -I${includedir}
EOS
end
end