From 871e353fa851ef58e0918d93929b2ec7c9607470 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Thu, 6 Nov 2014 16:25:49 +0800 Subject: [PATCH 1/2] Homebrew: let Homebrew handle external resources download --- neovim.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/neovim.rb b/neovim.rb index 8a21baff59..876a69f952 100644 --- a/neovim.rb +++ b/neovim.rb @@ -9,9 +9,34 @@ class Neovim < Formula depends_on "automake" => :build depends_on "autoconf" => :build + resource "libuv" do + url "https://github.com/joyent/libuv/archive/v0.11.28.tar.gz" + sha1 "3b70b65467ee693228b8b8385665a52690d74092" + end + + resource "msgpack" do + url "https://github.com/msgpack/msgpack-c/archive/ecf4b09acd29746829b6a02939db91dfdec635b4.tar.gz" + sha1 "c160ff99f20d9d0a25bea0a57f4452f1c9bde370" + end + + resource "luajit" do + url "http://luajit.org/download/LuaJIT-2.0.3.tar.gz" + sha1 "2db39e7d1264918c2266b0436c313fbd12da4ceb" + end + + resource "luarocks" do + url "https://github.com/keplerproject/luarocks/archive/0587afbb5fe8ceb2f2eea16f486bd6183bf02f29.tar.gz" + sha1 "61a894fd5d61987bf7e7f9c3e0c5de16ba4b68c4" + end + def install ENV["GIT_DIR"] = cached_download/".git" if build.head? ENV.deparallelize + + resources.each do |r| + r.stage(target=buildpath/".deps/build/src/#{r.name}") + end + system "make", "CMAKE_BUILD_TYPE=RelWithDebInfo", "CMAKE_EXTRA_FLAGS=\"-DCMAKE_INSTALL_PREFIX:PATH=#{prefix}\"", "install" end end From 90658982644b76a9e8e4abfbcd16450df26b0a32 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Thu, 6 Nov 2014 17:56:52 +0800 Subject: [PATCH 2/2] build: don't download and extract tarball if source is already present When building under Homebrew, we want to let Homebrew manage downloading and extracting the tarballs. --- third-party/cmake/DownloadAndExtractFile.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/third-party/cmake/DownloadAndExtractFile.cmake b/third-party/cmake/DownloadAndExtractFile.cmake index e7a01b8a87..ec9c6db3b4 100644 --- a/third-party/cmake/DownloadAndExtractFile.cmake +++ b/third-party/cmake/DownloadAndExtractFile.cmake @@ -18,6 +18,15 @@ if(NOT DEFINED TARGET) message(FATAL_ERROR "TARGET must be defined.") endif() +set(SRC_DIR ${PREFIX}/src/${TARGET}) + +# Check whether the source has been downloaded. If true, skip it. +# Useful for external downloads like homebrew. +if(EXISTS "${SRC_DIR}" AND IS_DIRECTORY "${SRC_DIR}") + message(STATUS "${SRC_DIR} is found, skipping download and extraction. ") + return() +endif() + # Taken from ExternalProject_Add. Let's hope we can drop this one day when # ExternalProject_Add allows you to disable SHOW_PROGRESS on the file download. if(TIMEOUT) @@ -65,8 +74,6 @@ endif() message(STATUS "downloading... done") -set(SRC_DIR ${PREFIX}/src/${TARGET}) - # Slurped from a generated extract-TARGET.cmake file. message(STATUS "extracting... src='${file}'