homebrew-core/Formula/vcpkg.rb

51 lines
1.6 KiB
Ruby

class Vcpkg < Formula
desc "C++ Library Manager"
homepage "https://github.com/microsoft/vcpkg"
url "https://github.com/microsoft/vcpkg/archive/2020.07.tar.gz"
sha256 "11af5dc5ac7a01d98145e894f5962711b16b23cbcf6998bef9c77f00a565c9d1"
license "MIT"
head "https://github.com/microsoft/vcpkg.git"
bottle do
cellar :any
sha256 "35363b2d066c920dcde30159e28b580e346f33064accaa79f789759816eef61a" => :catalina
sha256 "055f677516a5474e4964f7bb5fdb6f05e91913b8aea32aba56918cb7d31fe34b" => :mojave
sha256 "b1cab740efdb40b575553ad9bd96cd457482e16d0246315b69a996f753b72a85" => :high_sierra
end
depends_on "cmake" => :build
depends_on "ninja" => :build
if MacOS.version <= :mojave
depends_on "gcc"
fails_with :clang do
cause "'file_status' is unavailable: introduced in macOS 10.15"
end
end
def install
# fix for conflicting declaration of 'char* ctermid(char*)' on Mojave
# https://github.com/microsoft/vcpkg/issues/9029
ENV.prepend "CXXFLAGS", "-D_CTERMID_H_" if MacOS.version == :mojave
args = %w[-useSystemBinaries -disableMetrics]
args << "-allowAppleClang" if MacOS.version > :mojave
system "./bootstrap-vcpkg.sh", *args
bin.install "vcpkg"
bin.env_script_all_files(libexec/"bin", VCPKG_ROOT: libexec)
libexec.install Dir["*.txt", ".vcpkg-root", "{ports,scripts,triplets}"]
end
def post_install
(var/"vcpkg/installed").mkpath
(var/"vcpkg/packages").mkpath
ln_s var/"vcpkg/installed", libexec/"installed"
ln_s var/"vcpkg/packages", libexec/"packages"
end
test do
assert_match "sqlite3", shell_output("#{bin}/vcpkg search sqlite")
end
end