xezat 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xezat/command/bump/cygport_dep.rb +3 -1
  3. data/lib/xezat/command/bump/runtime_package.rb +18 -1
  4. data/lib/xezat/command/bump/src_uri.rb +2 -2
  5. data/lib/xezat/command/generate.rb +9 -0
  6. data/lib/xezat/command/init.rb +1 -1
  7. data/lib/xezat/command/validate/config.rb +48 -15
  8. data/lib/xezat/command/validate/license.rb +3 -0
  9. data/lib/xezat/command/validate.rb +18 -11
  10. data/lib/xezat/detector/asciidoc.rb +1 -1
  11. data/lib/xezat/detector/autoconf-archive.rb +27 -0
  12. data/lib/xezat/detector/autoconf.rb +1 -1
  13. data/lib/xezat/detector/automake.rb +2 -15
  14. data/lib/xezat/detector/boost.m4.rb +1 -1
  15. data/lib/xezat/detector/cmake.rb +1 -1
  16. data/lib/xezat/detector/docbook2X.rb +20 -0
  17. data/lib/xezat/detector/font-util.rb +20 -0
  18. data/lib/xezat/detector/gengetopt.rb +1 -1
  19. data/lib/xezat/detector/gettext-devel.rb +18 -0
  20. data/lib/xezat/detector/gnulib.rb +1 -1
  21. data/lib/xezat/detector/gobject-introspection.rb +1 -1
  22. data/lib/xezat/detector/halibut.rb +1 -1
  23. data/lib/xezat/detector/libQt5Core-devel.rb +1 -1
  24. data/lib/xezat/detector/libtool.rb +1 -1
  25. data/lib/xezat/detector/make.rb +1 -1
  26. data/lib/xezat/detector/meson.rb +1 -1
  27. data/lib/xezat/detector/nasm.rb +1 -1
  28. data/lib/xezat/detector/ninja.rb +1 -1
  29. data/lib/xezat/detector/python27.rb +1 -1
  30. data/lib/xezat/detector/python36.rb +1 -1
  31. data/lib/xezat/detector/python37.rb +1 -1
  32. data/lib/xezat/detector/python38.rb +1 -1
  33. data/lib/xezat/detector/python39-docutils.rb +2 -2
  34. data/lib/xezat/detector/python39.rb +1 -1
  35. data/lib/xezat/detector/roundup.rb +1 -1
  36. data/lib/xezat/detector/waf.rb +1 -1
  37. data/lib/xezat/detector/xorg-util-macros.rb +20 -0
  38. data/lib/xezat/detectors.rb +1 -1
  39. data/lib/xezat/generator/cmake.rb +44 -0
  40. data/lib/xezat/generator/pkgconfig.rb +5 -7
  41. data/lib/xezat/generator.rb +6 -0
  42. data/lib/xezat/main.rb +1 -0
  43. data/lib/xezat/variables.rb +16 -4
  44. data/lib/xezat/version.rb +1 -1
  45. data/lib/xezat.rb +10 -1
  46. data/share/xezat/autoconf-archive.yml +583 -0
  47. data/share/xezat/template/cmake/cmake.erb +22 -0
  48. data/share/xezat/var2yaml.sh +1 -0
  49. data/xezat.gemspec +33 -13
  50. metadata +47 -38
  51. data/.fasterer.yml +0 -6
  52. data/.github/workflows/ruby.yml +0 -45
  53. data/.gitignore +0 -11
  54. data/.gitmodules +0 -3
  55. data/.rspec +0 -2
  56. data/.rubocop.yml +0 -36
  57. data/.ruby-version +0 -1
  58. data/Gemfile +0 -8
  59. data/Rakefile +0 -8
  60. data/bin/console +0 -15
  61. data/bin/setup +0 -8
  62. /data/share/xezat/template/{Makefile.am → pkgconfig/Makefile.am} +0 -0
  63. /data/share/xezat/template/{cmake.erb → pkgconfig/cmake.erb} +0 -0
  64. /data/share/xezat/template/{pkgconfig.erb → pkgconfig/pkgconfig.erb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44f20fb8c8d53290ca2aa712f0305df3a64fa92b5fd495e74d9c251cea4bd38c
4
- data.tar.gz: 43aa81a90789ba5ab3d9c64b7b8aa4b93bf04d96cde0c51ceba7a35238623771
3
+ metadata.gz: 19e1eef962e59cf81c84a69ea321838d0b0542952073b429cb0f9af0d8cd7dd3
4
+ data.tar.gz: 88a9a875473d8e11ab01651393740b06af772b9c1f7ce18e9e3fc74909971b1b
5
5
  SHA512:
6
- metadata.gz: fde0d1e68848308d416fe1e06749bfcaec89a558a40454fc8924a0038103ddbbc07db8900894d48b825a21633e112c83ce72899e40133b8766f082749a3a2f12
7
- data.tar.gz: 0cbca3957598e70390bdb6c87bddfe94585d5d1afe85b97057158b23dae17a2ab1555c7b63410595417cf996382124e42907dd42f1aa1e43831710f26295184d
6
+ metadata.gz: cf83fa1fbc96dfd22a07d64c974fc3d279cd00a3021315d18948011d44354624d8e426c88bdd654bd63c27a63b01ece6f47a842ed9cba54fb77cf50fa1d754d2
7
+ data.tar.gz: b4132baf3892fccce8e9b19f6701751878be50a74e08551cc601c921a1ccfe25f3b29f7730d160a7cda93c51306a95ba47e4234ce99a84754b40b4849a50f5e6
@@ -14,8 +14,10 @@ module Xezat
14
14
  additional_path = candidate_files.map do |file|
15
15
  File.dirname(file)
16
16
  end.sort.uniq.join(':')
17
+ Xezat.logger.debug(" Additional PATH = #{additional_path.gsub(Regexp.new(variables[:D]), '')}")
17
18
  command = ['bash', File.expand_path(File.join(DATA_DIR, 'cygport_dep.sh')), cygport]
18
- result, error, status = Open3.capture3({ 'PATH' => "#{ENV.fetch('PATH')}:#{additional_path}" }, command.join(' '))
19
+ result, error, status = Open3.capture3({ 'PATH' => "#{additional_path}:#{ENV.fetch('PATH')}" }, command.join(' '))
20
+ Xezat.logger.warn(" Stderr = #{error}") unless error.empty?
19
21
  raise CygportProcessError, error unless status.success?
20
22
 
21
23
  result
@@ -13,12 +13,29 @@ module Xezat
13
13
  runtime_packages = result.gsub(/^.*\*\*\*.*$/, '').split($INPUT_RECORD_SEPARATOR).map(&:lstrip)
14
14
  build_requires = variables[:BUILD_REQUIRES].nil? ? [] : variables[:BUILD_REQUIRES].split.map(&:to_sym)
15
15
  runtime_packages.delete(pkgs[:'libssl-devel']) if build_requires.include?(:'libssl1.0-devel')
16
- runtime_packages.map! { |pkg| pkg == 'python3' ? pkgs[:python39] : pkg }
16
+ runtime_packages.map! do |pkg|
17
+ resolve_pseudo(pkg, pkgs)
18
+ end
17
19
  variables[:REQUIRES]&.split&.each do |req|
18
20
  runtime_packages << pkgs[req.to_sym]
19
21
  end
20
22
  runtime_packages.sort.uniq
21
23
  end
24
+
25
+ private
26
+
27
+ def resolve_pseudo(pkg, pkgs)
28
+ case pkg
29
+ when 'python3'
30
+ pkgs[:python39]
31
+ when 'perl5_036'
32
+ pkgs[:perl_base]
33
+ when 'ruby_32'
34
+ pkgs[:ruby]
35
+ else
36
+ pkg
37
+ end
38
+ end
22
39
  end
23
40
  end
24
41
  end
@@ -9,9 +9,9 @@ module Xezat
9
9
  def get_src_uri(variables, cygclasses = CygclassManager.new)
10
10
  Xezat.logger.debug(' Collect SRC_URI')
11
11
  cygclasses.vcs.each do |vcs|
12
- next unless variables.key?("_#{vcs}_CYGCLASS_".intern)
12
+ next unless variables.key?(:"_#{vcs}_CYGCLASS_")
13
13
 
14
- src_uri_key = "#{vcs.to_s.upcase}_URI".intern
14
+ src_uri_key = :"#{vcs.to_s.upcase}_URI"
15
15
  return variables[src_uri_key].split if variables.key?(src_uri_key)
16
16
  end
17
17
  variables[:SRC_URI].split
@@ -13,6 +13,15 @@ module Xezat
13
13
  require 'xezat/generator/pkgconfig'
14
14
  Generator::Pkgconfig.new(options, cygport).generate
15
15
  end
16
+
17
+ desc 'cmake cygport', 'Generate CMakeLists.txt'
18
+ option :overwrite, type: :boolean, aliases: '-o', desc: 'overwrite CMakeLists.txt'
19
+ option :srcdir, type: :string, aliases: '-s', desc: 'relative path to CMakeLists.txt'
20
+
21
+ def cmake(cygport)
22
+ require 'xezat/generator/cmake'
23
+ Generator::CMake.new(options, cygport).generate
24
+ end
16
25
  end
17
26
  end
18
27
  end
@@ -65,7 +65,7 @@ module Xezat
65
65
  vcs_class = cygclass
66
66
  end
67
67
  vcs_prefix = vcs_class.to_s.upcase if vcs_class
68
- vcs_uri = "#{vcs_prefix}_URI".intern
68
+ vcs_uri = :"#{vcs_prefix}_URI"
69
69
  {
70
70
  :HOMEPAGE => original_template_variables[:HOMEPAGE],
71
71
  vcs_uri => original_template_variables[vcs_uri]
@@ -7,24 +7,18 @@ module Xezat
7
7
  module Command
8
8
  class Validate
9
9
  def validate_config(variables, gcc_version)
10
- configs = Dir.glob(File.join(variables[:D], '/usr/bin/*-config'))
11
- configs.each do |config|
12
- basename = File.basename(config)
13
- Xezat.logger.debug(" #{basename} found")
10
+ Dir.glob(File.join(variables[:D], '/usr/bin/*-config')).each do |config|
11
+ Xezat.logger.debug(" #{File.basename(config)} found")
14
12
 
15
- result, _, status = Open3.capture3("#{config} --cflags")
16
- if status.success?
17
- Xezat.logger.debug(" cflags = #{result.strip}")
18
- else
19
- Xezat.logger.warn(' cflags not supported')
13
+ begin
14
+ executable?(config)
15
+ rescue StandardError
16
+ next
20
17
  end
21
18
 
22
- result, _, status = Open3.capture3("#{config} --cxxflags")
23
- if status.success?
24
- Xezat.logger.debug(" cxxflags = #{result.strip}")
25
- else
26
- Xezat.logger.warn(' cxxflags not supported')
27
- end
19
+ validate_modversion(config, variables)
20
+ validate_cflags(config)
21
+ validate_cxxflags(config)
28
22
 
29
23
  result, _, status = Open3.capture3("#{config} --libs")
30
24
  if status.success?
@@ -35,6 +29,45 @@ module Xezat
35
29
  end
36
30
  end
37
31
  end
32
+
33
+ private
34
+
35
+ def executable?(config)
36
+ Open3.capture3(config.to_s)
37
+ rescue StandardError => e
38
+ Xezat.logger.warn(" #{config} not executable: #{e}")
39
+ raise e
40
+ end
41
+
42
+ def validate_modversion(config, variables)
43
+ result, _, status = Open3.capture3("#{config} --version")
44
+ if status.success?
45
+ modversion = result.strip
46
+ Xezat.logger.debug(" modversion = #{modversion}")
47
+ pv = variables[:PV][0].gsub(/\+.+$/, '')
48
+ Xezat.logger.error(" modversion differs from $PN = #{pv}") unless modversion == pv
49
+ else
50
+ Xezat.logger.warn(' modversion not supported')
51
+ end
52
+ end
53
+
54
+ def validate_cflags(config)
55
+ result, _, status = Open3.capture3("#{config} --cflags")
56
+ if status.success?
57
+ Xezat.logger.debug(" cflags = #{result.strip}")
58
+ else
59
+ Xezat.logger.warn(' cflags not supported')
60
+ end
61
+ end
62
+
63
+ def validate_cxxflags(config)
64
+ result, _, status = Open3.capture3("#{config} --cxxflags")
65
+ if status.success?
66
+ Xezat.logger.debug(" cxxflags = #{result.strip}")
67
+ else
68
+ Xezat.logger.warn(' cxxflags not supported')
69
+ end
70
+ end
38
71
  end
39
72
  end
40
73
  end
@@ -19,6 +19,9 @@ module Xezat
19
19
  license_uri = vars[:LICENSE_URI]
20
20
  if license_uri.nil? || license_uri.empty?
21
21
  Xezat.logger.warn(' LICENSE_URI is not defined')
22
+ elsif license_uri.start_with?('https://', 'http://')
23
+ Xezat.logger.debug(" LICENSE_URI = #{license_uri}")
24
+ livecheck(license_uri)
22
25
  elsif File.exist?(File.join(vars[:S], license_uri))
23
26
  Xezat.logger.debug(" LICENSE_URI = #{license_uri}")
24
27
  else
@@ -63,17 +63,8 @@ module Xezat
63
63
  end
64
64
 
65
65
  def validate_homepage(homepage)
66
- response = Net::HTTP.get_response(URI.parse(homepage))
67
- code = response.code
68
- if code == '200'
69
- Xezat.logger.debug(" code = #{code}")
70
- else
71
- Xezat.logger.error(" code = #{code}")
72
- end
73
- rescue OpenSSL::SSL::SSLError => e
74
- raise e unless @options[:ignore]
75
-
76
- Xezat.logger.warn(' Ignore SSLError')
66
+ Xezat.logger.debug(" HOMEPAGE = #{homepage}")
67
+ livecheck(homepage)
77
68
  end
78
69
 
79
70
  def validate_build_requires(build_requires, pkgs)
@@ -113,6 +104,22 @@ module Xezat
113
104
  end
114
105
  end
115
106
  end
107
+
108
+ private
109
+
110
+ def livecheck(url)
111
+ response = Net::HTTP.get_response(URI.parse(url))
112
+ code = response.code
113
+ if code == '200'
114
+ Xezat.logger.debug(" code = #{code}")
115
+ else
116
+ Xezat.logger.error(" code = #{code}")
117
+ end
118
+ rescue OpenSSL::SSL::SSLError => e
119
+ raise e unless @options[:ignore]
120
+
121
+ Xezat.logger.warn(' Ignore SSLError')
122
+ end
116
123
  end
117
124
  end
118
125
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Asciidoc
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
11
 
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xezat
4
+ module Detector
5
+ class AutoconfArchive
6
+ def detect?(variables)
7
+ return false unless variables.keys.index do |key|
8
+ %i[_cmake_CYGCLASS_ _meson_CYGCLASS_ _ninja_CYGCLASS_].include?(key)
9
+ end.nil?
10
+
11
+ autoconf_archive_file = File.expand_path(File.join(DATA_DIR, 'autoconf-archive.yml'))
12
+ autoconf_archive_macros = YAML.safe_load(File.open(autoconf_archive_file), symbolize_names: true, permitted_classes: [Symbol])
13
+
14
+ Find.find(variables[:S]) do |file|
15
+ next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
16
+
17
+ autoconf_archive_macros.each do |macro|
18
+ File.foreach(file) do |line|
19
+ return true if line.scrub.strip.start_with?(macro)
20
+ end
21
+ end
22
+ end
23
+ false
24
+ end
25
+ end
26
+ end
27
+ end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Autoconf
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return false unless variables.keys.index do |key|
10
10
  %i[_cmake_CYGCLASS_ _meson_CYGCLASS_ _ninja_CYGCLASS_].include?(key)
11
11
  end.nil?
@@ -5,28 +5,15 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Automake
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return false unless variables.keys.index do |key|
10
10
  %i[_cmake_CYGCLASS_ _meson_CYGCLASS_ _ninja_CYGCLASS_].include?(key)
11
11
  end.nil?
12
12
 
13
- cygautoreconf = false
14
- File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
15
- if line.index('cygautoreconf')
16
- cygautoreconf = true
17
- return true
18
- end
19
- end
20
-
21
- unless cygautoreconf
22
- File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
23
- return false if line.index('src_compile')
24
- end
25
- end
26
-
27
13
  Find.find(variables[:S]) do |file|
28
14
  return true if file.end_with?('.am')
29
15
  end
16
+
30
17
  false
31
18
  end
32
19
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class BoostM4
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
11
 
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Cmake
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  variables.key?(:_cmake_CYGCLASS_)
10
10
  end
11
11
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'find'
4
+
5
+ module Xezat
6
+ module Detector
7
+ class Docbook2x
8
+ def detect?(variables)
9
+ Find.find(variables[:S]) do |file|
10
+ next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
+
12
+ File.foreach(file) do |line|
13
+ return true if line.include?('docbook2x-man')
14
+ end
15
+ end
16
+ false
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'find'
4
+
5
+ module Xezat
6
+ module Detector
7
+ class FontUtil
8
+ def detect?(variables)
9
+ Find.find(variables[:S]) do |file|
10
+ next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
+
12
+ File.foreach(file) do |line|
13
+ return true if line.start_with?('XORG_FONT_MACROS_VERSION')
14
+ end
15
+ end
16
+ false
17
+ end
18
+ end
19
+ end
20
+ end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Gengetopt
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  return true if file.end_with?('.ggo', '.ggo.in')
11
11
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xezat
4
+ module Detector
5
+ class GettextDevel
6
+ def detect?(variables)
7
+ Find.find(variables[:S]) do |file|
8
+ next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
9
+
10
+ File.foreach(file) do |line|
11
+ return true if /AM_GNU_GETTEXT|AM_ICONV|AC_GGZ_INTL/.match?(line.scrub.lstrip)
12
+ end
13
+ end
14
+ false
15
+ end
16
+ end
17
+ end
18
+ end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Gnulib
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
10
10
  return true if line.index('gnulib-tools')
11
11
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class GobjectIntrospection
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  File.directory?(File.join(variables[:D], 'usr', 'lib', 'girepository-1.0'))
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Halibut
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  return true if file.end_with?('.but')
11
11
  end
@@ -3,7 +3,7 @@
3
3
  module Xezat
4
4
  module Detector
5
5
  class Libqt5coreDevel
6
- def detect(variables)
6
+ def detect?(variables)
7
7
  variables.key?(:_qt5_qmake_CYGCLASS_)
8
8
  end
9
9
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Libtool
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  return true if file.end_with?("#{File::SEPARATOR}ltmain.sh")
11
11
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Make
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:B]) do |file|
10
10
  return true if file.end_with?("#{File::SEPARATOR}Makefile", "#{File::SEPARATOR}makefile")
11
11
  end
@@ -3,7 +3,7 @@
3
3
  module Xezat
4
4
  module Detector
5
5
  class Meson
6
- def detect(variables)
6
+ def detect?(variables)
7
7
  variables.key?(:_meson_CYGCLASS_)
8
8
  end
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Xezat
4
4
  module Detector
5
5
  class Nasm
6
- def detect(variables)
6
+ def detect?(variables)
7
7
  if variables.key?(:_meson_CYGCLASS_)
8
8
  File.foreach(File.join(variables[:S], 'meson.build')) do |line|
9
9
  return true if line.include?("find_program('nasm')")
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Ninja
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if variables.key?(:_meson_CYGCLASS_)
10
10
 
11
11
  Find.find(variables[:B]) do |file|
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python27
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python2.7'))
10
10
 
11
11
  Find.find(variables[:D]) do |file|
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python36
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python3.6'))
10
10
 
11
11
  Find.find(variables[:D]) do |file|
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python37
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python3.7'))
10
10
 
11
11
  Find.find(variables[:D]) do |file|
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python38
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python3.8'))
10
10
 
11
11
  Find.find(variables[:D]) do |file|
@@ -5,12 +5,12 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python39Docutils
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
11
 
12
12
  File.foreach(file) do |line|
13
- return true if line.strip.start_with?('AC_CHECK_PROG') && line.index('rst2man').is_a?(Integer)
13
+ return true if line.scrub.strip.start_with?('AC_CHECK_PROG') && line.index('rst2man').is_a?(Integer)
14
14
  end
15
15
  end
16
16
  if variables.key?(:_meson_CYGCLASS_)
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python39
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python3.9'))
10
10
 
11
11
  Find.find(variables[:D]) do |file|
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Roundup
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
10
10
  return true if line.index('roundup')
11
11
  end
@@ -3,7 +3,7 @@
3
3
  module Xezat
4
4
  module Detector
5
5
  class Waf
6
- def detect(variables)
6
+ def detect?(variables)
7
7
  if variables.key?(:_waf_CYGCLASS_)
8
8
  Find.find(variables[:S]) do |file|
9
9
  return false if file.end_with?("#{File::SEPARATOR}waf")
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'find'
4
+
5
+ module Xezat
6
+ module Detector
7
+ class XorgUtilMacros
8
+ def detect?(variables)
9
+ Find.find(variables[:S]) do |file|
10
+ next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
+
12
+ File.foreach(file) do |line|
13
+ return true if line.start_with?('XORG_MACROS_VERSION')
14
+ end
15
+ end
16
+ false
17
+ end
18
+ end
19
+ end
20
+ end
@@ -20,7 +20,7 @@ module Xezat
20
20
  @detectors.each do |name, detector|
21
21
  if variables[:PN].intern == name
22
22
  Xezat.logger.debug(" #{name} ... no (self)")
23
- elsif detector.detect(variables)
23
+ elsif detector.detect?(variables)
24
24
  tools << name
25
25
  Xezat.logger.debug(" #{name} ... yes")
26
26
  else
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'xezat/generator'
4
+ require 'xezat/variables'
5
+
6
+ module Xezat
7
+ module Generator
8
+ class CMake
9
+ include Xezat
10
+
11
+ def initialize(options, cygport)
12
+ @options = options
13
+ @cygport = cygport
14
+ end
15
+
16
+ def generate
17
+ Xezat.logger.debug('Start CMakeLists.txt generation')
18
+ vars = variables(@cygport)
19
+ generate_cmakelists(vars, @options)
20
+ Xezat.logger.debug('End CMakeLists.txt generation')
21
+ end
22
+
23
+ def generate_cmakelists(variables, options)
24
+ srcdir = variables[:CYGCONF_SOURCE] || variables[:CYGCMAKE_SOURCE] || variables[:S]
25
+ srcdir = File.expand_path(File.join(variables[:S], options['srcdir'])) if options['srcdir']
26
+ Xezat.logger.debug(" srcdir = #{srcdir}")
27
+
28
+ cmakelists = File.expand_path(File.join(srcdir, 'CMakeLists.txt'))
29
+ raise UnregeneratableConfigurationError, 'CMakeLists.txt already exists' if File.exist?(cmakelists) && !options['overwrite']
30
+
31
+ Xezat.logger.debug(' Generate CMakeLists.txt')
32
+
33
+ File.atomic_write(cmakelists) do |f|
34
+ f.write(get_cmakelists(variables))
35
+ end
36
+ end
37
+
38
+ def get_cmakelists(variables)
39
+ erb = File.expand_path(File.join(TEMPLATE_DIR, 'cmake', 'cmake.erb'))
40
+ ERB.new(File.readlines(erb).join(nil), trim_mode: '%-').result(binding)
41
+ end
42
+ end
43
+ end
44
+ end