xezat 0.3.1 → 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.
- checksums.yaml +4 -4
- data/lib/xezat/command/generate.rb +9 -0
- data/lib/xezat/detector/asciidoc.rb +1 -1
- data/lib/xezat/detector/autoconf-archive.rb +27 -0
- data/lib/xezat/detector/autoconf.rb +1 -1
- data/lib/xezat/detector/automake.rb +1 -1
- data/lib/xezat/detector/boost.m4.rb +1 -1
- data/lib/xezat/detector/cmake.rb +1 -1
- data/lib/xezat/detector/docbook2X.rb +1 -1
- data/lib/xezat/detector/font-util.rb +20 -0
- data/lib/xezat/detector/gengetopt.rb +1 -1
- data/lib/xezat/detector/gettext-devel.rb +2 -2
- data/lib/xezat/detector/gnulib.rb +1 -1
- data/lib/xezat/detector/gobject-introspection.rb +1 -1
- data/lib/xezat/detector/halibut.rb +1 -1
- data/lib/xezat/detector/libQt5Core-devel.rb +1 -1
- data/lib/xezat/detector/libtool.rb +1 -1
- data/lib/xezat/detector/make.rb +1 -1
- data/lib/xezat/detector/meson.rb +1 -1
- data/lib/xezat/detector/nasm.rb +1 -1
- data/lib/xezat/detector/ninja.rb +1 -1
- data/lib/xezat/detector/python27.rb +1 -1
- data/lib/xezat/detector/python36.rb +1 -1
- data/lib/xezat/detector/python37.rb +1 -1
- data/lib/xezat/detector/python38.rb +1 -1
- data/lib/xezat/detector/python39-docutils.rb +2 -2
- data/lib/xezat/detector/python39.rb +1 -1
- data/lib/xezat/detector/roundup.rb +1 -1
- data/lib/xezat/detector/waf.rb +1 -1
- data/lib/xezat/detector/xorg-util-macros.rb +20 -0
- data/lib/xezat/detectors.rb +1 -1
- data/lib/xezat/generator/cmake.rb +44 -0
- data/lib/xezat/generator/pkgconfig.rb +5 -7
- data/lib/xezat/generator.rb +6 -0
- data/lib/xezat/main.rb +1 -0
- data/lib/xezat/variables.rb +16 -4
- data/lib/xezat/version.rb +1 -1
- data/lib/xezat.rb +10 -1
- data/share/xezat/autoconf-archive.yml +583 -0
- data/share/xezat/template/cmake/cmake.erb +22 -0
- data/share/xezat/var2yaml.sh +1 -0
- data/xezat.gemspec +31 -11
- metadata +41 -34
- data/.fasterer.yml +0 -6
- data/.github/workflows/ruby.yml +0 -45
- data/.gitignore +0 -11
- data/.gitmodules +0 -3
- data/.rspec +0 -2
- data/.rubocop.yml +0 -36
- data/.ruby-version +0 -1
- data/Gemfile +0 -8
- data/Rakefile +0 -8
- data/bin/console +0 -15
- data/bin/setup +0 -8
- /data/share/xezat/template/{Makefile.am → pkgconfig/Makefile.am} +0 -0
- /data/share/xezat/template/{cmake.erb → pkgconfig/cmake.erb} +0 -0
- /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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19e1eef962e59cf81c84a69ea321838d0b0542952073b429cb0f9af0d8cd7dd3
|
4
|
+
data.tar.gz: 88a9a875473d8e11ab01651393740b06af772b9c1f7ce18e9e3fc74909971b1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf83fa1fbc96dfd22a07d64c974fc3d279cd00a3021315d18948011d44354624d8e426c88bdd654bd63c27a63b01ece6f47a842ed9cba54fb77cf50fa1d754d2
|
7
|
+
data.tar.gz: b4132baf3892fccce8e9b19f6701751878be50a74e08551cc601c921a1ccfe25f3b29f7730d160a7cda93c51306a95ba47e4234ce99a84754b40b4849a50f5e6
|
@@ -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
|
@@ -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
|
data/lib/xezat/detector/cmake.rb
CHANGED
@@ -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
|
@@ -3,12 +3,12 @@
|
|
3
3
|
module Xezat
|
4
4
|
module Detector
|
5
5
|
class GettextDevel
|
6
|
-
def detect(variables)
|
6
|
+
def detect?(variables)
|
7
7
|
Find.find(variables[:S]) do |file|
|
8
8
|
next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
|
9
9
|
|
10
10
|
File.foreach(file) do |line|
|
11
|
-
return true if /AM_GNU_GETTEXT|AM_ICONV|AC_GGZ_INTL/.match?(line.lstrip)
|
11
|
+
return true if /AM_GNU_GETTEXT|AM_ICONV|AC_GGZ_INTL/.match?(line.scrub.lstrip)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
false
|
data/lib/xezat/detector/make.rb
CHANGED
data/lib/xezat/detector/meson.rb
CHANGED
data/lib/xezat/detector/nasm.rb
CHANGED
data/lib/xezat/detector/ninja.rb
CHANGED
@@ -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_)
|
data/lib/xezat/detector/waf.rb
CHANGED
@@ -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
|
data/lib/xezat/detectors.rb
CHANGED
@@ -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
|
@@ -3,12 +3,10 @@
|
|
3
3
|
require 'English'
|
4
4
|
require 'facets/file/atomic_open'
|
5
5
|
require 'facets/file/atomic_write'
|
6
|
+
require 'xezat/generator'
|
6
7
|
require 'xezat/variables'
|
7
8
|
|
8
9
|
module Xezat
|
9
|
-
class UnregeneratableConfigurationError < StandardError
|
10
|
-
end
|
11
|
-
|
12
10
|
class AutotoolsFileNotFoundError < StandardError
|
13
11
|
end
|
14
12
|
|
@@ -51,7 +49,7 @@ module Xezat
|
|
51
49
|
end
|
52
50
|
|
53
51
|
def get_pkg_config(variables)
|
54
|
-
erb = File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig.erb'))
|
52
|
+
erb = File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig', 'pkgconfig.erb'))
|
55
53
|
ERB.new(File.readlines(erb).join(nil), trim_mode: '%-').result(binding)
|
56
54
|
end
|
57
55
|
|
@@ -72,7 +70,7 @@ module Xezat
|
|
72
70
|
end
|
73
71
|
|
74
72
|
def get_cmakelists(variables)
|
75
|
-
erb = File.expand_path(File.join(TEMPLATE_DIR, 'cmake.erb'))
|
73
|
+
erb = File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig', 'cmake.erb'))
|
76
74
|
ERB.new(File.readlines(erb).join(nil), trim_mode: '%-').result(binding)
|
77
75
|
end
|
78
76
|
|
@@ -84,7 +82,7 @@ module Xezat
|
|
84
82
|
configure_ac = File.expand_path(File.join(srcdir, 'configure.in')) unless File.exist?(configure_ac)
|
85
83
|
raise AutotoolsFileNotFoundError unless File.exist?(configure_ac)
|
86
84
|
|
87
|
-
original_ac = File.read(configure_ac)
|
85
|
+
original_ac = File.read(configure_ac).scrub
|
88
86
|
|
89
87
|
if /#{pn}.pc/.match?(original_ac)
|
90
88
|
Xezat.logger.debug(" Not rewrite #{configure_ac}")
|
@@ -104,7 +102,7 @@ module Xezat
|
|
104
102
|
break
|
105
103
|
end
|
106
104
|
|
107
|
-
commands_am = File.read(File.expand_path(File.join(TEMPLATE_DIR, 'Makefile.am')))
|
105
|
+
commands_am = File.read(File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig', 'Makefile.am')))
|
108
106
|
File.atomic_open(makefile_am, 'a') do |fm|
|
109
107
|
fm.write(commands_am)
|
110
108
|
end
|
data/lib/xezat/main.rb
CHANGED
@@ -8,6 +8,7 @@ require 'xezat/version'
|
|
8
8
|
module Xezat
|
9
9
|
class Main < Thor
|
10
10
|
include ZshCompletion::Command
|
11
|
+
|
11
12
|
class_option :config, type: :string, aliases: '-c', desc: 'specify config', default: CONFIG_FILE
|
12
13
|
class_option :help, type: :boolean, aliases: '-h', desc: 'help message'
|
13
14
|
|
data/lib/xezat/variables.rb
CHANGED
@@ -10,7 +10,7 @@ require 'yaml'
|
|
10
10
|
require 'xezat'
|
11
11
|
|
12
12
|
module Xezat
|
13
|
-
def variables(cygport)
|
13
|
+
def variables(cygport, var2yaml_fetcher: nil)
|
14
14
|
cygport_dir = File.dirname(File.absolute_path(cygport))
|
15
15
|
cache_file = File.expand_path(File.join(cygport_dir, "#{File.basename(cygport, '.cygport')}.#{Etc.uname[:machine]}.yml"))
|
16
16
|
|
@@ -23,9 +23,11 @@ module Xezat
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
result = if var2yaml_fetcher
|
27
|
+
var2yaml_fetcher.call(cygport)
|
28
|
+
else
|
29
|
+
execute_var2yaml(cygport)
|
30
|
+
end
|
29
31
|
|
30
32
|
result.gsub!(/^.*\*\*\*.*$/, '')
|
31
33
|
|
@@ -55,4 +57,14 @@ module Xezat
|
|
55
57
|
lineno += 1
|
56
58
|
end
|
57
59
|
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def execute_var2yaml(cygport)
|
64
|
+
command = ['bash', File.expand_path(File.join(DATA_DIR, 'var2yaml.sh')), cygport]
|
65
|
+
result, error, status = Open3.capture3(command.join(' '))
|
66
|
+
raise CygportProcessError, error unless status.success?
|
67
|
+
|
68
|
+
result
|
69
|
+
end
|
58
70
|
end
|
data/lib/xezat/version.rb
CHANGED
data/lib/xezat.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'colorize'
|
3
4
|
require 'logger'
|
4
5
|
|
5
6
|
module Xezat
|
@@ -14,7 +15,15 @@ module Xezat
|
|
14
15
|
end
|
15
16
|
Xezat.logger = Logger.new($stdout)
|
16
17
|
Xezat.logger.formatter = proc { |severity, datetime, _progname, message|
|
17
|
-
"#{datetime}: [#{severity}] #{message}\n"
|
18
|
+
format = "#{datetime}: [#{severity}] #{message}\n"
|
19
|
+
case severity
|
20
|
+
when 'ERROR'
|
21
|
+
format.colorize(:red)
|
22
|
+
when 'WARN'
|
23
|
+
format.colorize(:yellow)
|
24
|
+
else
|
25
|
+
format
|
26
|
+
end
|
18
27
|
}
|
19
28
|
|
20
29
|
class CygportProcessError < StandardError
|