diff options
| author | Austin Seipp | 2011-10-01 20:22:42 -0500 |
|---|---|---|
| committer | Jack Nagel | 2012-02-02 20:29:55 -0600 |
| commit | 68bacb17b958f399ce865923ee2c4cc95b5d6c76 (patch) | |
| tree | d744031eb1ee66c923d8d3fdbb11a41a7d2506dc /Library | |
| parent | f7525704a563f013a75391958fb35844d5255cef (diff) | |
| download | homebrew-68bacb17b958f399ce865923ee2c4cc95b5d6c76.tar.bz2 | |
New formula: NaCl 20110221
Closes #7934.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/nacl.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Library/Formula/nacl.rb b/Library/Formula/nacl.rb new file mode 100644 index 000000000..6f18ce193 --- /dev/null +++ b/Library/Formula/nacl.rb @@ -0,0 +1,35 @@ +require 'formula' + +class Nacl < Formula + url 'http://hyperelliptic.org/nacl/nacl-20110221.tar.bz2' + homepage 'http://nacl.cace-project.eu' + md5 '7efb5715561c3d10dafd3fa97b4f2d20' + + def install + system "./do" # This takes a while since it builds *everything* + + # NaCL has an odd compilation model (software by djb, who'da thunk it?) + # and installs the resulting binaries in a directory like: + # <nacl source>/build/<hostname>/lib/<arch>/libnacl.a + # <nacl source>/build/<hostname>/include/<arch>/crypto_box.h + # etc. Each of these is optimized for the specific hardware it's + # compiled on. + # + # It also builds both x86 and x86_64 copies if your compiler can + # handle it. Here we only install one copy, based on if you're a + # 64bit system or not. A --universal could come later though I guess. + archstr = Hardware.is_64_bit? ? "amd64" : "x86" + hoststr = `hostname | sed 's/\\..*//' | tr -cd '[a-z][A-Z][0-9]'`.strip + + # Don't include cpucycles.h + include.install Dir["build/#{hoststr}/include/#{archstr}/crypto_*.h"] + include.install "build/#{hoststr}/include/#{archstr}/randombytes.h" + + # Add randombytes.o to the libnacl.a archive - I have no idea why it's separated, + # but plenty of the key generation routines depend on it. Users shouldn't have to + # know this. + nacl_libdir = "build/#{hoststr}/lib/#{archstr}" + system "ar -r #{nacl_libdir}/libnacl.a #{nacl_libdir}/randombytes.o" + lib.install "#{nacl_libdir}/libnacl.a" + end +end |
