Adding a variant to an existing homebrew formula? -
i'd modify dtc formula build specialized version of dtc used beaglebone black (and other device-tree arm boards). problem multi-fold. dtc formula provides bottled versions, , installed 1.4.0. want install version comes newer sources, not absolute latest, , applies patch available elsewhere. can build manually on os x, don't know best way make available in homebrew.
i'd make variant. either entirely separate formula, or within current formula can selected command-line parameter. i'm not well-versed enough in brew know how best this.
i tried creating new formula called "dtc-dyn" doesn't dashes in name.
i'd make bottle, others' convenience, seems more complicated.
i tried modifying current dtc , removing bottle stuff, modifying url, version, , adding system steps. of operations fail (that seem work when run original build script):
def install git_sha = "f6dbc6ca9618391e4f30c415a0a09b7af35f7647" system "git checkout master -f" system "git pull" system "git checkout #{git_sha} -b #{git_sha}-build" system "git pull --no-edit https://github.com/pantoniou/dtc dt-overlays5" system "make clean" system "make all" end
sadly, doesn't work:
$ brew install dtc ==> cloning git://git.kernel.org/pub/scm/utils/dtc/dtc.git updating /library/caches/homebrew/dtc--git ==> checking out branch master ==> git checkout master -f ==> git pull ==> git checkout f6dbc6ca9618391e4f30c415a0a09b7af35f7647 -b f6dbc6ca9618391e4f30c415a0a09b7af35f7647-build 2015-09-21 00:22:37 -0700 git checkout f6dbc6ca9618391e4f30c415a0a09b7af35f7647 -b f6dbc6ca9618391e4f30c415a0a09b7af35f7647-build fatal: reference not tree: f6dbc6ca9618391e4f30c415a0a09b7af35f7647 read this: https://git.io/brew-troubleshooting
the original script can found here.
anyway, what's best way approach this? think kind of with-option, based on of example scripts, i'm not sure how avoid bottle business. thanks!
second approach
okay, after more doc reading , experimenting, i'm trying this:
class dtc < formula desc "device tree compiler" homepage "http://www.devicetree.org/" url "https://mirrors.kernel.org/debian/pool/main/d/device-tree-compiler/device-tree-compiler_1.4.0+dfsg.orig.tar.gz" mirror "https://mirrors.ocf.berkeley.edu/debian/pool/main/d/device-tree-compiler/device-tree-compiler_1.4.0+dfsg.orig.tar.gz" sha256 "f5f9a1aea478ee6dbcece8907fd4551058fe72fc2c2a7be972e3d0b7eec4fa43" version "1.4.0" option "with-symbols", "add symbols/fixup support (-@ option)." bottle… if build.with? "symbols" url "http://git.kernel.org/pub/scm/utils/dtc/dtc.git", :revision => "f6dbc6ca9618391e4f30c415a0a09b7af35f7647" system "git", "pull", "--no-edit", "https://github.com/pantoniou/dtc", "dt-overlays5" end def install system "make" system "make", "destdir=#{prefix}", "prefix=", "install" mv lib/"libfdt.dylib.1", lib/"libfdt.1.dylib" end end
unfortunately, git pull fails because before cloning git repo, , it's not in right directory. first considered patch do…, wasn't clear how apply patch via git pull. tried this:
if build.with? "symbols" url "http://git.kernel.org/pub/scm/utils/dtc/dtc.git", :revision => "f6dbc6ca9618391e4f30c415a0a09b7af35f7647" patch system "git", "pull", "--no-edit", "https://github.com/pantoniou/dtc", "dt-overlays5" end end
but still tries git pull before cloning repo , cding it.
Comments
Post a Comment