nacl: build tweaks
Closes Homebrew/homebrew#50429. Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
This commit is contained in:
parent
03abde9abe
commit
e564ca847f
1 changed files with 14 additions and 5 deletions
|
@ -14,6 +14,16 @@ class Nacl < Formula
|
||||||
end
|
end
|
||||||
|
|
||||||
def install
|
def install
|
||||||
|
# Print the build to stdout rather than the default logfile.
|
||||||
|
# Logfile makes it hard to debug and spot hangs. Applied by Debian:
|
||||||
|
# https://sources.debian.net/src/nacl/20110221-4.1/debian/patches/output-while-building/
|
||||||
|
# Also, like Debian, inreplace the hostname because it isn't used outside
|
||||||
|
# build process and adds an unpredictable factor.
|
||||||
|
inreplace "do" do |s|
|
||||||
|
s.gsub! 'exec >"$top/log"', 'exec | tee "$top/log"'
|
||||||
|
s.gsub! /^shorthostname=`.*$/, "shorthostname=brew"
|
||||||
|
end
|
||||||
|
|
||||||
system "./do" # This takes a while since it builds *everything*
|
system "./do" # This takes a while since it builds *everything*
|
||||||
|
|
||||||
# NaCL has an odd compilation model (software by djb, who'da thunk it?)
|
# NaCL has an odd compilation model (software by djb, who'da thunk it?)
|
||||||
|
@ -26,17 +36,16 @@ class Nacl < Formula
|
||||||
# It also builds both x86 and x86_64 copies if your compiler can
|
# 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
|
# 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.
|
# 64bit system or not. A --universal could come later though I guess.
|
||||||
archstr = Hardware.is_64_bit? ? "amd64" : "x86"
|
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
|
# Don't include cpucycles.h
|
||||||
include.install Dir["build/#{hoststr}/include/#{archstr}/crypto_*.h"]
|
include.install Dir["build/brew/include/#{archstr}/crypto_*.h"]
|
||||||
include.install "build/#{hoststr}/include/#{archstr}/randombytes.h"
|
include.install "build/brew/include/#{archstr}/randombytes.h"
|
||||||
|
|
||||||
# Add randombytes.o to the libnacl.a archive - I have no idea why it's separated,
|
# 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
|
# but plenty of the key generation routines depend on it. Users shouldn't have to
|
||||||
# know this.
|
# know this.
|
||||||
nacl_libdir = "build/#{hoststr}/lib/#{archstr}"
|
nacl_libdir = "build/brew/lib/#{archstr}"
|
||||||
system "ar", "-r", "#{nacl_libdir}/libnacl.a", "#{nacl_libdir}/randombytes.o"
|
system "ar", "-r", "#{nacl_libdir}/libnacl.a", "#{nacl_libdir}/randombytes.o"
|
||||||
lib.install "#{nacl_libdir}/libnacl.a"
|
lib.install "#{nacl_libdir}/libnacl.a"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue