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.16.0.tar.xz" sha256 "6a33dc555cc9ba8b10caf7695878ef134eeb36d0af366041f639b1da9b6ed220" license "MIT" livecheck do url :stable regex(/href=.*?fontconfig[._-]v?(\d+\.\d+\.(?:\d|[0-8]\d+))\.t/i) end head do url "https://gitlab.freedesktop.org/fontconfig/fontconfig.git" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "gettext" => :build depends_on "libtool" => :build end depends_on "pkgconf" => :build depends_on "freetype" uses_from_macos "gperf" => :build uses_from_macos "python" => :build, since: :catalina uses_from_macos "bzip2" uses_from_macos "expat" on_linux do depends_on "gettext" => :build depends_on "json-c" => :build depends_on "util-linux" end def install font_dirs = %w[ /System/Library/Fonts /Library/Fonts ~/Library/Fonts ] if OS.mac? && MacOS.version >= :sierra font_dirs << Dir["/System/Library/Assets{,V2}/com_apple_MobileAsset_Font*"].max end system "autoreconf", "--force", "--install", "--verbose" if build.head? ENV["UUID_CFLAGS"] = "-I#{Formula["util-linux"].include}" if OS.linux? system "./configure", "--disable-silent-rules", "--disable-docs", "--enable-static", "--with-add-fonts=#{font_dirs.join(",")}", "--localstatedir=#{var}", "--sysconfdir=#{etc}", *std_configure_args 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