-
Notifications
You must be signed in to change notification settings - Fork 7
48 lines (39 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# typed: false
# frozen_string_literal: true
class MynewtNewtmgrAT12 < Formula
desc "Tool to manage devices running Mynewt OS via the Newtmgr Protocol"
homepage "https://mynewt.apache.org"
url "https://github.com/apache/mynewt-newtmgr/archive/mynewt_1_2_0_tag.tar.gz"
version "1.2.0"
sha256 "435c2e66a872bef7b13fbf3cc48add8aba7cb7482849eac234e1499b62c95e6d"
bottle do
root_url "https://github.com/JuulLabs-OSS/binary-releases/raw/master/mynewt-newt-tools_1.2.0"
sha256 cellar: :any_skip_relocation, sierra: "588884187b39ea39f7e1a900cc89e8f8a029bd20eb6712bc796ca0834145249a"
end
keg_only :versioned_formula
depends_on "go" => :build
depends_on arch: :x86_64
def install
contents = Dir["{*,.git,.gitignore}"]
gopath = buildpath/"gopath"
(gopath/"src/mynewt.apache.org/newtmgr").install contents
ENV["GOPATH"] = gopath
ENV.prepend_create_path "PATH", gopath/"bin"
# We are not able to vendor these packages due to a "go get" bug in
# vendoring packages with platform dependent code. So we have to get
# these packages for the buid.
cd gopath/"src" do
system "go", "get", "github.com/currantlabs/ble"
system "go", "get", "github.com/raff/goble"
system "go", "get", "github.com/mgutz/logxi/v1"
end
cd gopath/"src/mynewt.apache.org/newtmgr/newtmgr" do
system "go", "install"
bin.install gopath/"bin/newtmgr"
end
end
test do
# Check for Newtmgr in first word of output.
assert_match "Newtmgr", shell_output("#{bin}/newtmgr").split.first
end
end