-
Notifications
You must be signed in to change notification settings - Fork 7
58 lines (45 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
class MakeAT42 < Formula
desc "Utility for directing compilation"
homepage "https://www.gnu.org/software/make/"
url "https://ftp.gnu.org/gnu/make/make-4.2.1.tar.bz2"
mirror "https://ftpmirror.gnu.org/make/make-4.2.1.tar.bz2"
sha256 "d6e262bf3601b42d2b1e4ef8310029e1dcf20083c5446b4b7aa67081fdffc589"
revision 1
option "with-default-names", "Do not prepend 'g' to the binary"
def install
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
]
args << "--program-prefix=g" if build.without? "default-names"
system "./configure", *args
system "make", "install"
if build.without? "default-names"
(libexec/"gnubin").install_symlink bin/"gmake" =>"make"
(libexec/"gnuman/man1").install_symlink man1/"gmake.1" => "make.1"
end
end
def caveats
if build.without? "default-names"
<<~EOS
All commands have been installed with the prefix 'g'.
If you do not want the prefix, install using the "with-default-names" option.
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:
MANPATH="#{opt_libexec}/gnuman:$MANPATH"
EOS
end
end
test do
(testpath/"Makefile").write <<~EOS
default:
\t@echo Homebrew
EOS
cmd = build.with?("default-names") ? "make" : "gmake"
assert_equal "Homebrew\n",
shell_output("#{bin}/#{cmd}")
end
end