homebrew-core/Formula/imake.rb
2019-04-19 08:25:34 +02:00

57 lines
2.1 KiB
Ruby

class Imake < Formula
desc "Build automation system written for X11"
homepage "https://xorg.freedesktop.org"
url "https://xorg.freedesktop.org/releases/individual/util/imake-1.0.8.tar.bz2"
sha256 "b8d2e416b3f29cd6482bcffaaf19286d32917a164d07102a0e531ccd41a2a702"
bottle do
sha256 "7b88b762f87532242c2e45ea2818eaf1e73528f8c45710bba22697d53e102034" => :mojave
sha256 "005f26740da80aafab194f81a41699aae4f79eb9a0881e4a75984d64832f8299" => :high_sierra
sha256 "f95dbaaf6211d6b1384e7b1b2fde0ed73c7d9c4bddd3af9982a3092f190273e8" => :sierra
end
depends_on "pkg-config" => :build
depends_on "gcc"
depends_on :x11
resource "xorg-cf-files" do
url "https://xorg.freedesktop.org/releases/individual/util/xorg-cf-files-1.0.6.tar.bz2"
sha256 "4dcf5a9dbe3c6ecb9d2dd05e629b3d373eae9ba12d13942df87107fdc1b3934d"
end
patch :p0 do
url "https://raw.githubusercontent.com/Homebrew/patches/a0bb3a4/imake/patch-imakemdep.h.diff"
sha256 "1f7a24f625d2611c31540d4304a45f228767becafa37af01e1695d74e612459e"
end
def install
ENV.deparallelize
# imake runtime is broken when used with clang's cpp
cpp_program = Formula["gcc"].opt_bin/"cpp-#{Formula["gcc"].version_suffix}"
inreplace "imakemdep.h", /::CPPCMD::/, cpp_program
inreplace "imake.man", /__cpp__/, cpp_program
# also use gcc's cpp during buildtime to pass ./configure checks
ENV["RAWCPP"] = cpp_program
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
system "make", "install"
resource("xorg-cf-files").stage do
# Fix for different X11 locations.
inreplace "X11.rules", "define TopXInclude /**/",
"define TopXInclude -I#{MacOS::X11.include}"
system "./configure", "--with-config-dir=#{lib}/X11/config",
"--prefix=#{HOMEBREW_PREFIX}"
system "make", "install"
end
end
test do
# Use pipe_output because the return code is unimportant here.
output = pipe_output("#{bin}/imake -v -s/dev/null -f/dev/null -T/dev/null 2>&1")
gcc_major_ver = Formula["gcc"].version_suffix
assert_match "#{Formula["gcc"].opt_bin}/cpp-#{gcc_major_ver}", output
end
end