2011-09-16 22:00:43 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Nss < Formula
|
2014-03-21 02:06:51 +00:00
|
|
|
homepage "https://developer.mozilla.org/docs/NSS"
|
|
|
|
url "https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_16_RTM/src/nss-3.16-with-nspr-4.10.4.tar.gz"
|
|
|
|
sha1 "8ae6ddec43556b4deb949dc889123ff1d09ab737"
|
|
|
|
version "3.16"
|
2011-09-16 22:00:43 +00:00
|
|
|
|
2014-03-21 16:45:01 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
|
|
|
sha1 "08ea6d10ebe317330129e03c184a0aaa59b300b0" => :mavericks
|
|
|
|
sha1 "3fd67a639a8fcdb253f8fe982a5ecf6f1ea25c6b" => :mountain_lion
|
|
|
|
sha1 "a4153f7a673f3f4703a9e4142958039e7b24bc51" => :lion
|
|
|
|
end
|
|
|
|
|
2014-03-21 02:06:51 +00:00
|
|
|
depends_on "nspr"
|
2011-09-16 22:00:43 +00:00
|
|
|
|
2014-03-21 02:06:51 +00:00
|
|
|
keg_only "NSS installs a libssl which conflicts with OpenSSL."
|
2013-01-10 17:07:47 +00:00
|
|
|
|
2011-09-16 22:00:43 +00:00
|
|
|
def install
|
|
|
|
ENV.deparallelize
|
2014-03-21 02:06:51 +00:00
|
|
|
cd "nss"
|
2011-09-16 22:00:43 +00:00
|
|
|
|
|
|
|
args = [
|
2014-03-21 02:06:51 +00:00
|
|
|
"BUILD_OPT=1",
|
|
|
|
"NSS_USE_SYSTEM_SQLITE=1",
|
2012-06-10 15:08:17 +00:00
|
|
|
"NSPR_INCLUDE_DIR=#{HOMEBREW_PREFIX}/include/nspr",
|
|
|
|
"NSPR_LIB_DIR=#{HOMEBREW_PREFIX}/lib"
|
2011-09-16 22:00:43 +00:00
|
|
|
]
|
2014-03-21 02:06:51 +00:00
|
|
|
args << "USE_64=1" if MacOS.prefer_64_bit?
|
2011-09-16 22:00:43 +00:00
|
|
|
|
2012-06-10 15:30:01 +00:00
|
|
|
# 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
|
2012-06-10 15:30:01 +00:00
|
|
|
|
2014-03-21 02:06:51 +00:00
|
|
|
system "make", "nss_build_all", *args
|
2011-09-16 22:00:43 +00:00
|
|
|
|
|
|
|
# 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"
|
2011-09-16 22:00:43 +00:00
|
|
|
bin.mkdir
|
2014-03-21 02:06:51 +00:00
|
|
|
Dir["Darwin*/bin/*"].each do |file|
|
|
|
|
cp file, bin unless file.include? ".dylib"
|
2011-09-16 22:00:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
include.mkdir
|
|
|
|
include_target = include + "nss"
|
|
|
|
include_target.mkdir
|
2014-03-21 02:06:51 +00:00
|
|
|
["dbm", "nss"].each do |dir|
|
|
|
|
Dir["public/#{dir}/*"].each do |file|
|
2011-09-16 22:00:43 +00:00
|
|
|
cp file, include_target
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
lib.mkdir
|
2014-03-21 02:06:51 +00:00
|
|
|
libexec.mkdir
|
|
|
|
Dir["Darwin*/lib/*"].each do |file|
|
|
|
|
cp file, lib unless file.include? ".chk"
|
|
|
|
cp file, libexec if file.include? ".chk"
|
2011-09-16 22:00:43 +00:00
|
|
|
end
|
2012-01-21 14:29:19 +00:00
|
|
|
|
2014-03-21 02:06:51 +00:00
|
|
|
(lib+"pkgconfig/nss.pc").write pc_file
|
2011-09-16 22:00:43 +00:00
|
|
|
end
|
|
|
|
|
2013-02-02 05:12:47 +00:00
|
|
|
test do
|
2011-09-22 15:25:52 +00:00
|
|
|
# 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
|
2011-09-16 22:00:43 +00:00
|
|
|
end
|
2012-01-21 14:29:19 +00:00
|
|
|
|
2013-03-25 02:09:38 +00:00
|
|
|
def pc_file; <<-EOS.undent
|
|
|
|
prefix=#{opt_prefix}
|
|
|
|
exec_prefix=${prefix}
|
|
|
|
libdir=${exec_prefix}/lib
|
|
|
|
includedir=${prefix}/include/nss
|
2012-01-21 14:29:19 +00:00
|
|
|
|
2013-03-25 02:09:38 +00:00
|
|
|
Name: NSS
|
|
|
|
Description: Mozilla Network Security Services
|
|
|
|
Version: #{version}
|
|
|
|
Requires: nspr
|
|
|
|
Libs: -L${libdir} -lnss3 -lnssutil3 -lsmime3 -lssl3
|
|
|
|
Cflags: -I${includedir}
|
|
|
|
EOS
|
2012-01-21 14:29:19 +00:00
|
|
|
end
|
2011-09-16 22:00:43 +00:00
|
|
|
end
|