2015-11-17 20:49:10 +08:00
|
|
|
require "dependency_collector"
|
|
|
|
|
|
|
|
class DependencyCollector
|
2018-01-18 20:54:21 +00:00
|
|
|
module Compat
|
|
|
|
# Define the languages that we can handle as external dependencies.
|
|
|
|
LANGUAGE_MODULES = Set[
|
|
|
|
:lua, :lua51, :perl, :python, :python3, :ruby
|
|
|
|
].freeze
|
2017-12-23 16:38:06 +00:00
|
|
|
|
2018-01-18 20:54:21 +00:00
|
|
|
def parse_string_spec(spec, tags)
|
|
|
|
if (tag = tags.first) && LANGUAGE_MODULES.include?(tag)
|
2018-01-18 21:10:43 +00:00
|
|
|
odeprecated "'depends_on ... => #{tag.inspect}'"
|
2018-01-18 20:54:21 +00:00
|
|
|
LanguageModuleRequirement.new(tag, spec, tags[1])
|
|
|
|
else
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
2017-12-23 16:38:06 +00:00
|
|
|
|
2018-01-18 20:54:21 +00:00
|
|
|
def parse_symbol_spec(spec, tags)
|
|
|
|
case spec
|
|
|
|
when :clt
|
|
|
|
odeprecated "'depends_on :clt'"
|
|
|
|
when :tex
|
|
|
|
odeprecated "'depends_on :tex'"
|
|
|
|
TeXRequirement.new(tags)
|
|
|
|
when :autoconf, :automake, :bsdmake, :libtool
|
|
|
|
output_deprecation(spec)
|
|
|
|
autotools_dep(spec, tags)
|
|
|
|
when :cairo, :fontconfig, :freetype, :libpng, :pixman
|
|
|
|
output_deprecation(spec)
|
|
|
|
Dependency.new(spec.to_s, tags)
|
|
|
|
when :ant, :expat
|
|
|
|
output_deprecation(spec)
|
|
|
|
Dependency.new(spec.to_s, tags)
|
|
|
|
when :libltdl
|
|
|
|
tags << :run
|
|
|
|
output_deprecation("libtool")
|
|
|
|
Dependency.new("libtool", tags)
|
|
|
|
when :apr
|
|
|
|
output_deprecation(spec, "apr-util")
|
|
|
|
Dependency.new("apr-util", tags)
|
|
|
|
when :fortran
|
|
|
|
output_deprecation(spec, "gcc")
|
|
|
|
Dependency.new("gcc", tags)
|
|
|
|
when :gpg
|
|
|
|
output_deprecation(spec, "gnupg")
|
|
|
|
Dependency.new("gnupg", tags)
|
|
|
|
when :hg
|
|
|
|
output_deprecation(spec, "mercurial")
|
|
|
|
Dependency.new("mercurial", tags)
|
|
|
|
when :mpi
|
|
|
|
output_deprecation(spec, "open-mpi")
|
|
|
|
Dependency.new("open-mpi", tags)
|
|
|
|
when :python, :python2
|
|
|
|
output_deprecation(spec, "python")
|
|
|
|
Dependency.new("python", tags)
|
|
|
|
when :python3
|
|
|
|
output_deprecation(spec, "python3")
|
|
|
|
Dependency.new("python3", tags)
|
|
|
|
when :emacs, :mysql, :perl, :postgresql, :rbenv, :ruby
|
|
|
|
output_deprecation(spec)
|
2018-02-21 08:49:13 +00:00
|
|
|
Dependency.new(spec.to_s, tags)
|
2018-01-18 20:54:21 +00:00
|
|
|
else
|
|
|
|
super
|
|
|
|
end
|
2017-12-23 16:38:06 +00:00
|
|
|
end
|
|
|
|
|
2018-01-18 20:54:21 +00:00
|
|
|
private
|
2015-11-17 20:49:10 +08:00
|
|
|
|
2018-01-18 20:54:21 +00:00
|
|
|
def autotools_dep(spec, tags)
|
|
|
|
tags << :build unless tags.include? :run
|
2017-12-30 18:58:30 +00:00
|
|
|
Dependency.new(spec.to_s, tags)
|
2015-11-16 23:18:31 +08:00
|
|
|
end
|
|
|
|
|
2018-01-18 20:54:21 +00:00
|
|
|
def output_deprecation(dependency, new_dependency = dependency)
|
|
|
|
odeprecated "'depends_on :#{dependency}'",
|
|
|
|
"'depends_on \"#{new_dependency}\"'"
|
|
|
|
end
|
2015-11-16 23:18:31 +08:00
|
|
|
end
|
2016-07-16 22:14:55 +01:00
|
|
|
|
2018-01-18 20:54:21 +00:00
|
|
|
prepend Compat
|
2015-11-16 23:18:31 +08:00
|
|
|
end
|