class Fontconfig < Formula desc "XML-based font configuration API for X Windows" homepage "https://wiki.freedesktop.org/www/Software/fontconfig/" url "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.12.6.tar.bz2" sha256 "cf0c30807d08f6a28ab46c61b8dbd55c97d2f292cf88f3a07d3384687f31f017" # The bottle tooling is too lenient and thinks fontconfig # is relocatable, but it has hardcoded paths in the executables. bottle do sha256 "8c9ff65654be03a4003d0e0d9e27fa1f03641aceadebd0f2a1b2f66cc1c2b54a" => :high_sierra sha256 "cfa65615f05fe6e0547be2738bed94d21f05491df2edf1e246da8a3669225e4d" => :sierra sha256 "664c8faf84a8bd6e80ebd8ca175c8e0a4cb6087f867e208cea4d9f8cda643134" => :el_capitan end pour_bottle? do reason "The bottle needs to be installed into /usr/local." # c.f. the identical hack in lua # https://github.com/Homebrew/homebrew/issues/47173 satisfy { HOMEBREW_PREFIX.to_s == "/usr/local" } end head do url "https://anongit.freedesktop.org/git/fontconfig", :using => :git depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end depends_on "pkg-config" => :build depends_on "freetype" def install font_dirs = %w[ /System/Library/Fonts /Library/Fonts ~/Library/Fonts ] if MacOS.version == :sierra font_dirs << "/System/Library/Assets/com_apple_MobileAsset_Font3" elsif MacOS.version == :high_sierra font_dirs << "/System/Library/Assets/com_apple_MobileAsset_Font4" end system "autoreconf", "-iv" if build.head? system "./configure", "--disable-dependency-tracking", "--disable-silent-rules", "--enable-static", "--with-add-fonts=#{font_dirs.join(",")}", "--prefix=#{prefix}", "--localstatedir=#{var}", "--sysconfdir=#{etc}" system "make", "install", "RUN_FC_CACHE_TEST=false" end def post_install ohai "Regenerating font cache, this may take a while" system "#{bin}/fc-cache", "-frv" end test do system "#{bin}/fc-list" end end