aboutsummaryrefslogtreecommitdiff
path: root/build-homebrew-formula.py
diff options
context:
space:
mode:
Diffstat (limited to 'build-homebrew-formula.py')
-rwxr-xr-xbuild-homebrew-formula.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/build-homebrew-formula.py b/build-homebrew-formula.py
index 26a587c..e82c1a5 100755
--- a/build-homebrew-formula.py
+++ b/build-homebrew-formula.py
@@ -40,22 +40,34 @@ class CryptechAlpha < Formula
end
def install
- # Homebrew voodoo for installing Python dependencies without depending on pip.
- # In theory, this handles any number of (Python) resource specifications.
+ # Installation is a bit complex due to the way Homebrew handles
+ # Python library dependencies and due to our stuff being a mix of
+ # Python and C.
+
+ # Set PYTHONPATH to point to our private library location.
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
+
+ # Add all resources (and assume they are all Python, be careful...).
resources.each do |r|
r.stage do
system "python", *Language::Python.setup_install_args(libexec/"vendor")
end
end
+ # Build everything.
ohai "Building PKCS #11 code (including crypto and bignum libraries) from source, this is slow, sorry..."
ENV.deparallelize
system "make", "-C", "sw/pkcs11"
+
+ # Install the Python script(s) then replace them with stubs which
+ # set PYTHONPATH before calling the real script(s).
+ sbin.install "sw/stm32/projects/hsm/cryptech_upload"
+ sbin.env_script_all_files(libexec/"sbin", :PYTHONPATH => ENV["PYTHONPATH"])
+
+ # Install other (non-Python) stuff, then we are done.
share.install "cryptech-alpha-firmware.tar.gz"
lib.install "sw/pkcs11/libpkcs11.dylib"
sbin.install "sw/pkcs11/p11util"
- sbin.install "sw/stm32/projects/hsm/cryptech_upload"
end
end