Merge pull request #206108 from Homebrew/bump-lizard-analyzer-1.17.14
[homebrew-core.git] / Formula / d / ddd.rb
blob70dd056ea0e2b3ad19d316143ccedbd90520615b
1 class Ddd < Formula
2   desc "Graphical front-end for command-line debuggers"
3   homepage "https://www.gnu.org/software/ddd/"
4   url "https://ftp.gnu.org/gnu/ddd/ddd-3.4.1.tar.gz"
5   mirror "https://ftpmirror.gnu.org/ddd/ddd-3.4.1.tar.gz"
6   sha256 "b87517a6c3f9611566347e283a2cf931fa369919b553536a2235e63402f4ee89"
7   license all_of: [
8     "GPL-3.0-or-later",
9     "GFDL-1.1-no-invariants-or-later", # ddd/ddd-themes.info
10     "GFDL-1.3-no-invariants-or-later", # ddd/ddd.info
11     "HPND-sell-variant", # ddd/motif/LabelH.C
12     "MIT-open-group", # ddd/athena_ddd/PannerM.C
13   ]
15   bottle do
16     sha256 arm64_sequoia:  "3c31137211b8185a0b8e3ceffce6474c803cf8790348211ad0690162697a1613"
17     sha256 arm64_sonoma:   "73e84236c870313e5a43e936998545961609c5f43104e6b57cd693a03dc52a5d"
18     sha256 arm64_ventura:  "d287abe1d656058174b03b2e1215e7eee7d996fad1e041fd8d14e573b3e0716f"
19     sha256 arm64_monterey: "e2f58c650c498dd2ab90369baee0dad09b169e503e8616894f6814ba543310a8"
20     sha256 sonoma:         "19e15c98f1732a8c5032734ecdab5f4aec373ef3991bc65c7ce4e5f81b526861"
21     sha256 ventura:        "47ff49d7888461a987aee0ae62749dc96d6c44c6825f09a61d637f13cd736198"
22     sha256 monterey:       "33047c998d6856a9425df4fa92fd9f3fdfe7717921def4bb814ae82ceb928927"
23     sha256 x86_64_linux:   "52266be4e6e825db9c2941e2ab44002d1d3707b379e0339d3ddf12af18f81ad6"
24   end
26   depends_on "fontconfig"
27   depends_on "libx11"
28   depends_on "libxaw"
29   depends_on "libxft"
30   depends_on "libxmu"
31   depends_on "libxpm"
32   depends_on "libxt"
33   depends_on "openmotif"
35   uses_from_macos "ncurses"
37   on_macos do
38     depends_on "gnu-sed" => :build
39     depends_on "libice"
40     depends_on "libsm"
41     depends_on "libxext"
42     depends_on "libxp"
44     on_intel do
45       depends_on "gdb" => :test
46     end
47   end
49   on_linux do
50     depends_on "gdb" => :test
51   end
53   def install
54     # Use GNU sed due to ./unumlaut.sed: RE error: illegal byte sequence
55     ENV.prepend_path "PATH", Formula["gnu-sed"].libexec/"gnubin" if OS.mac?
57     # Help configure find freetype headers
58     ENV.append_to_cflags "-I#{Formula["freetype"].opt_include}/freetype2"
60     system "./configure", "--disable-silent-rules",
61                           "--enable-builtin-app-defaults",
62                           "--enable-builtin-manual",
63                           *std_configure_args
65     # From MacPorts: make will build the executable "ddd" and the X resource
66     # file "Ddd" in the same directory, as HFS+ is case-insensitive by default
67     # this will loosely FAIL
68     system "make", "EXEEXT=exe"
70     ENV.deparallelize
71     system "make", "install", "EXEEXT=exe"
72     mv bin/"dddexe", bin/"ddd"
73   end
75   test do
76     output = shell_output("#{bin}/ddd --version")
77     output.force_encoding("ASCII-8BIT") if output.respond_to?(:force_encoding)
78     assert_match version.to_s, output
80     if OS.mac? && Hardware::CPU.arm?
81       # gdb is not supported on macOS ARM. Other debuggers like --perl need window
82       # and using --nw causes them to just pass through to normal execution.
83       # Since it is tricky to test window/XQuartz on CI, just check no crash.
84       assert_equal "Test", shell_output("#{bin}/ddd --perl --nw -e \"print 'Test'\"")
85     else
86       assert_match testpath.to_s, pipe_output("#{bin}/ddd --gdb --nw true 2>&1", "pwd\nquit")
87     end
88   end
89 end