Skip to content

Commit

Permalink
docker-machine-driver-xhyve: fix libev issue
Browse files Browse the repository at this point in the history
Close #6678
  • Loading branch information
zchee committed Nov 18, 2016
1 parent f771359 commit ebd0469
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions Formula/docker-machine-driver-xhyve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ class DockerMachineDriverXhyve < Formula
depends_on "docker-machine" => :recommended
if build.with? "qcow2"
depends_on "opam"
depends_on "libev"
depends_on "libev" => :build
end

# Allow specifying version and libev location.
patch :DATA

def install
(buildpath/"gopath/src/github.com/zchee/docker-machine-driver-xhyve").install Dir["{*,.git,.gitignore,.gitmodules}"]

Expand All @@ -38,8 +41,12 @@ def install

if build.with? "qcow2"
build_tags << " qcow2"
ENV["LIBEV_FILE"] = "#{Formula["libev"].lib}/libev.a"

system "opam", "init", "--no-setup"
opam_dir = "#{buildpath}/.brew_home/.opam"

# To imitate 'eval `opam init`'
ENV["CAML_LD_LIBRARY_PATH"] = "#{opam_dir}/system/lib/stublibs:/usr/local/lib/ocaml/stublibs"
ENV["OPAMUTF8MSGS"] = "1"
ENV["PERL5LIB"] = "#{opam_dir}/system/lib/perl5"
Expand All @@ -48,11 +55,11 @@ def install
system "opam", "install", "-y", "uri", "qcow-format", "conf-libev"
end

go_ldflags = "-w -s -X 'github.com/zchee/docker-machine-driver-xhyve/xhyve.GitCommit=Homebrew#{git_hash}'"
go_ldflags = "-w -s -X=github.com/zchee/docker-machine-driver-xhyve/xhyve.GitCommit=Homebrew-#{git_hash}"
ENV["GO_LDFLAGS"] = go_ldflags
ENV["GO_BUILD_TAGS"] = build_tags
system "make", "lib9p"
system "make", "build"
system "make", "build", "V=1"
bin.install "bin/docker-machine-driver-xhyve"
end
end
Expand All @@ -70,3 +77,29 @@ def caveats; <<-EOS.undent
shell_output("#{Formula["docker-machine"].bin}/docker-machine create --driver xhyve -h")
end
end

__END__
diff --git a/Makefile b/Makefile
index d6448d0..8c26cf7 100644
--- a/Makefile
+++ b/Makefile
@@ -78,7 +78,7 @@ CGO_CFLAGS :=
CGO_LDFLAGS :=

# Parse git current branch commit-hash
-GO_LDFLAGS += -X `go list ./xhyve`.GitCommit=`git rev-parse --short HEAD 2>/dev/null`
+GO_LDFLAGS ?= -X `go list ./xhyve`.GitCommit=`git rev-parse --short HEAD 2>/dev/null`


# Set debug gcflag, or optimize ldflags
@@ -126,8 +126,8 @@ endif
# Use mirage-block for pwritev|preadv
HAVE_OCAML_QCOW := $(shell if ocamlfind query qcow uri >/dev/null 2>/dev/null ; then echo YES ; else echo NO; fi)
ifeq ($(HAVE_OCAML_QCOW),YES)
-LIBEV_FILE=/usr/local/lib/libev.a
-LIBEV=$(shell if test -e $(LIBEV_FILE) ; then echo $(LIBEV_FILE) ; fi )
+LIBEV_FILE ?= /usr/local/lib/libev.a
+LIBEV = $(shell if test -e $(LIBEV_FILE) ; then echo $(LIBEV_FILE) ; fi )
OCAML_WHERE := $(shell ocamlc -where)
OCAML_LDLIBS := -L $(OCAML_WHERE) \
$(shell ocamlfind query cstruct)/cstruct.a \

0 comments on commit ebd0469

Please sign in to comment.