homebrew-core/Formula/nss.rb

88 lines
2.5 KiB
Ruby
Raw Normal View History

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"
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"
2014-03-21 02:06:51 +00:00
keg_only "NSS installs a libssl which conflicts with OpenSSL."
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
2014-03-21 02:06:51 +00:00
system "make", "nss_build_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"
bin.mkdir
2014-03-21 02:06:51 +00:00
Dir["Darwin*/bin/*"].each do |file|
cp file, bin unless file.include? ".dylib"
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|
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"
end
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