From 2d4f18558898417ee03e0b702aa9de758166f427 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 3 Jul 2016 17:35:24 -0400 Subject: Add dependencies for sqlite3 and pyserial to Homebrew formula. --- build-homebrew-formula.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/build-homebrew-formula.py b/build-homebrew-formula.py index 8f29720..26a587c 100755 --- a/build-homebrew-formula.py +++ b/build-homebrew-formula.py @@ -26,17 +26,30 @@ class CryptechAlpha < Formula url "{url}" sha256 "{sha256}" - # Eventually we'll want resource clauses here to pull in stuff we - # need from pypi, see brew doc for that, but skip it initially. + # See https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md#specifying-other-formulae-as-dependencies + # for details on handling dependencies on other homebrew packages (eg, sqlite3). - # We should also specify a dependency on sqlite3, and perhaps other - # packages. Skip that for now too. + # See https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Python-for-Formula-Authors.md + # for details on handling dependencies on Python libraries (eg, pyserial). - # If we get really ambitous, it would be nice to have "bottled" - # (precompiled binary) versions, but that requires either a build - # farm or some kind of cross-compilation. + depends_on "sqlite3" + + resource "pyserial" do + url "https://pypi.python.org/packages/3c/d8/a9fa247ca60b02b3bebbd61766b4f321393b57b13c53b18f6f62cf172c08/pyserial-3.1.1.tar.gz" + sha256 "d657051249ce3cbd0446bcfb2be07a435e1029da4d63f53ed9b4cdde7373364c" + end def install + # Homebrew voodoo for installing Python dependencies without depending on pip. + # In theory, this handles any number of (Python) resource specifications. + ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages" + resources.each do |r| + r.stage do + system "python", *Language::Python.setup_install_args(libexec/"vendor") + end + end + + ohai "Building PKCS #11 code (including crypto and bignum libraries) from source, this is slow, sorry..." ENV.deparallelize system "make", "-C", "sw/pkcs11" share.install "cryptech-alpha-firmware.tar.gz" -- cgit v1.2.3