blob: e4de3c16cbf843f6e9c86e847edb604567689e2c (
plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
def x11_installed?
MacOS::X11.installed?
end
def snow_leopard_64?
MacOS.prefer_64_bit?
end
class Formula
# in compatability because the naming is somewhat confusing
def self.resolve_alias name
opoo 'Formula.resolve_alias is deprecated and will eventually be removed'
opoo 'Use Formula.canonical_name instead.'
# Don't resolve paths or URLs
return name if name.include?("/")
aka = HOMEBREW_REPOSITORY+"Library/Aliases"+name
if aka.file?
aka.realpath.basename('.rb').to_s
else
name
end
end
# This used to be called in "def install", but should now be used
# up in the DSL section.
def fails_with_llvm msg=nil, data=nil
opoo "Calling fails_with_llvm in the install method is deprecated"
puts "Use the fails_with DSL instead"
end
def fails_with_llvm?
fails_with? :llvm
end
def self.fails_with_llvm msg=nil, data={}
case msg when Hash then data = msg end
failure = CompilerFailure.new(:llvm) { build(data.delete(:build).to_i) }
@cc_failures ||= Set.new
@cc_failures << failure
end
def std_cmake_parameters
"-DCMAKE_INSTALL_PREFIX='#{prefix}' -DCMAKE_BUILD_TYPE=None -DCMAKE_FIND_FRAMEWORK=LAST -Wno-dev"
end
class << self
def bottle_sha1 val=nil
val.nil? ? @bottle_sha1 : @bottle_sha1 = val
end
end
def self.all
opoo "Formula.all is deprecated, use Formula.map instead"
map
end
end
class UnidentifiedFormula < Formula
end
module HomebrewEnvExtension extend self
def use_clang?
compiler == :clang
end
def use_gcc?
compiler == :gcc
end
def use_llvm?
compiler == :llvm
end
end
# TODO eventually some of these should print deprecation warnings
module MacOS extend self
def xcode_folder
Xcode.folder
end
def xcode_prefix
Xcode.prefix
end
def xcode_installed?
Xcode.installed?
end
def xcode_version
Xcode.version
end
def clt_installed?
CLT.installed?
end
def clt_version?
CLT.version
end
def x11_installed?
X11.installed?
end
def x11_prefix
X11.prefix
end
def leopard?
10.5 == MACOS_VERSION
end
def snow_leopard?
10.6 <= MACOS_VERSION # Actually Snow Leopard or newer
end
alias_method :snow_leopard_or_newer?, :snow_leopard?
def lion?
10.7 <= MACOS_VERSION # Actually Lion or newer
end
alias_method :lion_or_newer?, :lion?
def mountain_lion?
10.8 <= MACOS_VERSION # Actually Mountain Lion or newer
end
alias_method :mountain_lion_or_newer?, :mountain_lion?
def macports_or_fink_installed?
not MacOS.macports_or_fink.empty?
end
end
class Version
def slice *args
opoo "Calling slice on versions is deprecated, use: to_s.slice"
to_s.slice(*args)
end
end
# MD5 support
class Formula
def self.md5(val)
@stable ||= SoftwareSpec.new
@stable.md5(val)
end
end
class SoftwareSpec
def md5(val)
@checksum = Checksum.new(:md5, val)
end
end
class Pathname
def md5
require 'digest/md5'
opoo <<-EOS.undent
MD5 support is deprecated and will be removed in a future version.
Please switch this formula to #{Checksum::TYPES.map { |t| t.to_s.upcase } * ' or '}.
EOS
incremental_hash(Digest::MD5)
end
end
|