xot 0.1.32 → 0.1.34

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a7e1bc3f6614364c9e0351687c284d86fb2acdd6e90ed831b176f2f523227d1
4
- data.tar.gz: 3be0124301e324255f2ab787140524231c42731af1662b5d4e279abec29efc47
3
+ metadata.gz: e9b5197cb38389ca854063207be401c6f07760fca67dadae435addcf6e1d3ea1
4
+ data.tar.gz: fb6537b39bd5bfa38fb2fd7386bedcc6f67bf0c3b5acaabc580bca047da0a5f6
5
5
  SHA512:
6
- metadata.gz: 7ea1f3a95375e0de9722cce59ba6ce229948c42c4bac5de353e737a52d8407985eace63de4559843d8bb9ed2cc0f65838cdcd70c0a8abc39e1f955b045d600c0
7
- data.tar.gz: 3eec5192e6db769cb4b89bd4f7029f4489adaa74ce905802e4d338decd5e38cc7a3e6901f551303fc2f4a603049f80a78cfaf04b92f64851d422604661037ce8
6
+ metadata.gz: 03e7a551c41ba1ce1f40301362fcef7da04618dfff0f2be912ecef8efe6307107283eba58ac1027036404689ffe178b98e32a27a833d9ec034bb07dd6562fbc1
7
+ data.tar.gz: 831b5f8c7ffdf155134850f160e20606f2969b535fcad9b6da649ca1c60fa2e67b27052a319b0714b53b95d57dfbdf0d239aa9023c8e941eab8baf90ef5b41c6
@@ -20,8 +20,11 @@ jobs:
20
20
  - name: setup dependencies
21
21
  run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
22
22
 
23
+ - name: install gems
24
+ run: gem install yard
25
+
23
26
  - name: test
24
- run: rake test
27
+ run: rake quiet test
25
28
 
26
29
  - name: create gem
27
30
  id: gem
@@ -20,8 +20,9 @@ def setup_dependencies(build: true, only: nil)
20
20
 
21
21
  exts.each do |ext|
22
22
  gem = RENAMES[ext.to_sym].then {|s| s || ext}
23
- clone = "git clone --depth 1 https://github.com/xord/#{ext}.git ../#{ext}"
24
23
  ver = gemspec[/add_runtime_dependency.*['"]#{gem}['"].*['"]\s*~>\s*([\d\.]+)\s*['"]/, 1]
24
+ opts = '-c advice.detachedHead=false --depth 1'
25
+ clone = "git clone #{opts} https://github.com/xord/#{ext}.git ../#{ext}"
25
26
 
26
27
  # 'rake subtree:push' pushes all subrepos, so cloning by new tag
27
28
  # often fails before tagging each new tag
data/ChangeLog.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # xot ChangeLog
2
2
 
3
3
 
4
+ ## [v0.1.34] - 2023-04-30
5
+
6
+ - Fix bugs
7
+
8
+
9
+ ## [v0.1.33] - 2023-04-22
10
+
11
+ - use '-isystem' option for vendor headers
12
+ - disable warnings on compiling vendor sources
13
+ - OSX: add '-Wl,-undefined,dynamic_lookup' to ldflags
14
+ - add VENDOR_NOCOMPILE option
15
+ - Rakefile: add 'quiet' option
16
+
17
+
4
18
  ## [v0.1.32] - 2023-03-01
5
19
 
6
20
  - fix bugs
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.32
1
+ 0.1.34
data/lib/xot/extconf.rb CHANGED
@@ -28,24 +28,30 @@ module Xot
28
28
  def setup()
29
29
  yield if block_given?
30
30
 
31
- extensions.each do |x|
32
- name = x.name.downcase
31
+ extensions.each do |ext|
32
+ name = ext.name.downcase
33
33
  headers << "#{name}.h"
34
34
  libs << name
35
35
  end
36
36
 
37
+ ldflags = $LDFLAGS.dup
38
+ if osx?
39
+ opt = '-Wl,-undefined,dynamic_lookup'
40
+ ldflags << " #{opt}" unless ($DLDFLAGS || '').include?(opt)
41
+ end
42
+
37
43
  local_libs << (clang? ? 'c++' : 'stdc++')
38
44
 
39
45
  $CPPFLAGS = make_cppflags $CPPFLAGS, defs, inc_dirs
40
46
  $CFLAGS = make_cflags $CFLAGS + ' -x c++'
41
47
  $CXXFLAGS = make_cflags $CXXFLAGS + ' -x c++' if $CXXFLAGS
42
- $LDFLAGS = make_ldflags $LDFLAGS, lib_dirs, frameworks
48
+ $LDFLAGS = make_ldflags ldflags, lib_dirs, frameworks
43
49
  $LOCAL_LIBS << local_libs.map {|s| " -l#{s}"}.join
44
50
  end
45
51
 
46
52
  def create_makefile(*args)
47
- extensions.each do |x|
48
- dir_config x.name.downcase, x.inc_dir, x.lib_dir
53
+ extensions.each do |ext|
54
+ dir_config ext.name.downcase, ext.inc_dir, ext.lib_dir
49
55
  end
50
56
 
51
57
  exit 1 unless headers.all? {|s| have_header s}
data/lib/xot/rake/util.rb CHANGED
@@ -160,7 +160,7 @@ module Xot
160
160
  end
161
161
 
162
162
  def compile_erb_str(str)
163
- ERB.new(str, nil, '%').result binding
163
+ ERB.new(str, trim_mode: '%').result binding
164
164
  end
165
165
 
166
166
  def params(max, sep = '', &block)
@@ -202,13 +202,14 @@ module Xot
202
202
  end
203
203
 
204
204
  def append_env(name, *args)
205
- ENV[name] = (ENV[name] || '') + " #{args.join ' '}"
205
+ ENV[name] = (ENV[name] || '') + " #{args.flatten.join ' '}"
206
206
  end
207
207
 
208
208
  def make_cppflags(flags = '', defs = [], incdirs = [])
209
209
  s = flags.dup
210
- s += make_cppflags_defs(defs) .map {|s| " -D#{s}"}.join
211
- s += make_cppflags_incdirs(incdirs).map {|s| " -I#{s}"}.join
210
+ s += make_cppflags_defs(defs) .map {|s| " -D#{s}"}.join
211
+ s += make_cppflags_incdirs(incdirs) .map {|s| " -I#{s}"}.join
212
+ s += make_cppflags_sys_incdirs(incdirs).map {|s| " -isystem#{s}"}.join
212
213
  s
213
214
  end
214
215
 
@@ -223,7 +224,11 @@ module Xot
223
224
  end
224
225
 
225
226
  def make_cppflags_incdirs(dirs = [])
226
- dirs.dup + ruby_inc_dirs
227
+ dirs.reject {|dir| dir =~ %r|vendor/|}
228
+ end
229
+
230
+ def make_cppflags_sys_incdirs(dirs = [])
231
+ dirs.select {|dir| dir =~ %r|vendor/|} + ruby_inc_dirs
227
232
  end
228
233
 
229
234
  def ruby_inc_dirs()
@@ -316,9 +321,10 @@ module Xot
316
321
  make_cppflags flags, defs, inc_dirs
317
322
  end
318
323
 
319
- def cxxflags()
324
+ def cxxflags(warnings = true)
320
325
  cflags = env :CFLAGS, RbConfig::CONFIG['CFLAGS']
321
326
  cxxflags = env :CXXFLAGS, RbConfig::CONFIG['CXXFLAGS']
327
+ cflags = cflags.gsub(/-W[\w\-]+/, '') + ' -w' unless warnings
322
328
  make_cflags "#{cflags} #{cxxflags}"
323
329
  end
324
330
 
@@ -326,6 +332,24 @@ module Xot
326
332
  env :ARFLAGS, RbConfig::CONFIG['ARFLAGS'] || 'crs'
327
333
  end
328
334
 
335
+ def default_tasks(default = nil)
336
+ verbose? env(:VERBOSE, true)
337
+
338
+ if default
339
+ task :default => default
340
+ else
341
+ task :default
342
+ end
343
+
344
+ task :quiet do
345
+ verbose? false
346
+ end
347
+
348
+ task :debug do
349
+ debug? true
350
+ end
351
+ end
352
+
329
353
 
330
354
  end# Rake
331
355
 
data/lib/xot/rake.rb CHANGED
@@ -55,24 +55,6 @@ module Xot
55
55
  env :TESTS_EXCLUDE, []
56
56
  end
57
57
 
58
- def default_tasks(default = nil)
59
- verbose? env(:VERBOSE, false)
60
-
61
- if default
62
- task :default => default
63
- else
64
- task :default
65
- end
66
-
67
- task :verbose do
68
- verbose? true
69
- end
70
-
71
- task :debug do
72
- debug? true
73
- end
74
- end
75
-
76
58
  def build_native_library()
77
59
  outname = "lib#{target_name}.a"
78
60
  out = File.join lib_dir, outname
@@ -161,7 +143,8 @@ module Xot
161
143
 
162
144
  desc "build #{extout}"
163
145
  file extout => [:lib, makefile] do
164
- sh %( cd #{ext_dir} && make )
146
+ opts = ::Rake.verbose ? 'V=1' : ''
147
+ sh %( cd #{ext_dir} && make #{opts} )
165
148
  end
166
149
 
167
150
  desc "create #{makefile}"
@@ -278,19 +261,19 @@ module Xot
278
261
  end
279
262
 
280
263
  def use_external_library(
281
- repos, branch: nil, tag: nil,
282
- incdir: nil, srcdir: nil, excludes: [],
283
- submodules: [], post_submodules: nil)
284
-
264
+ repos, branch: nil, tag: nil, commit: nil,
265
+ incdirs: nil, srcdirs: nil, excludes: [],
266
+ submodules: [], post_submodules: nil,
267
+ &after_clone_block)
268
+
269
+ name = repos[%r{/([^/]+?)(:?\.git)?$}, 1]
270
+ dir = "#{vendor_dir}/#{name}"
271
+ incdirs = [incdirs].flatten.map {|s| s ? "#{dir}/#{s}" : dir}
272
+ srcdirs = [srcdirs].flatten.map {|s| s ? "#{dir}/#{s}" : dir}
285
273
  excludes = [excludes].flatten
286
274
 
287
- name = repos[%r{/([^/]+?)(:?\.git)?$}, 1]
288
- dir = "#{vendor_dir}/#{name}"
289
- incdir = dir + (incdir ? "/#{incdir}" : '')
290
- srcdir = dir + (srcdir ? "/#{srcdir}" : '')
291
-
292
- append_env 'INCDIRS', incdir
293
- append_env 'SRCDIRS', srcdir
275
+ append_env 'INCDIRS', incdirs
276
+ append_env 'SRCDIRS', srcdirs
294
277
  append_env 'EXCLUDES', excludes unless excludes.empty?
295
278
 
296
279
  alias_task :vendor => "vendor:#{name}"
@@ -303,10 +286,14 @@ module Xot
303
286
  namespace name do
304
287
  desc "clone #{name}"
305
288
  file dir do
306
- opts = '--depth=1'
307
- opts += " --branch=#{branch || tag}" if branch || tag
289
+ opts = '-c advice.detachedHead=false --depth 1'
290
+ opts += " --branch #{branch || tag}" if branch || tag
308
291
  opts += " --recursive" if submodules.empty?
309
292
  sh %( git clone #{opts} #{repos} #{dir} )
293
+ Dir.chdir dir do
294
+ sh %( git fetch --depth 1 origin #{commit} )
295
+ sh %( git checkout #{commit} )
296
+ end if commit
310
297
  unless submodules.empty?
311
298
  Dir.chdir dir do
312
299
  submodules.each do |path|
@@ -316,8 +303,11 @@ module Xot
316
303
  sh post_submodules if post_submodules
317
304
  end
318
305
  end
319
- vendor_srcs_map(srcdir).each do |src, obj|
320
- sh %( #{cxx} -c #{cppflags} #{cxxflags} -o #{obj} #{src} )
306
+ Dir.chdir(dir) {after_clone_block.call} if after_clone_block
307
+ unless env :VENDOR_NOCOMPILE, false
308
+ vendor_srcs_map(*srcdirs).each do |src, obj|
309
+ sh %( #{cxx} -c #{cppflags} #{cxxflags false} -o #{obj} #{src} )
310
+ end
321
311
  end
322
312
  end
323
313
 
@@ -337,7 +327,7 @@ module Xot
337
327
  use_external_library 'https://github.com/boostorg/boost',
338
328
  branch: branch,
339
329
  tag: tag,
340
- srcdir: 'NOSRC',
330
+ srcdirs: 'NOSRC',
341
331
  submodules: default_modules | modules.map {|mod| "libs/#{mod}"},
342
332
  post_submodules: './bootstrap.sh && ./b2 headers'
343
333
  end
@@ -366,6 +356,9 @@ module Xot
366
356
 
367
357
  desc "setup all external libraries"
368
358
  alias_task :vendor
359
+
360
+ desc "convert erb files"
361
+ alias_task :erb
369
362
  end
370
363
 
371
364
 
data/test/helper.rb CHANGED
@@ -5,9 +5,10 @@
5
5
  .map {|s| File.expand_path "../#{s}/lib", __dir__}
6
6
  .each {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}
7
7
 
8
- require 'test/unit'
9
8
  require 'xot'
10
9
  require 'xot/test'
11
10
  require_relative '../ext/xot/tester'
12
11
 
12
+ require 'test/unit'
13
+
13
14
  include Xot::Test
data/test/test_setter.rb CHANGED
@@ -27,7 +27,13 @@ class TestSetter < Test::Unit::TestCase
27
27
 
28
28
  def test_set_by_hash()
29
29
  o = temp
30
- o.set :x => 1, :y => 2
30
+ o.set x: 1, y: 2
31
+ assert_equal [1, 2], [o.x, o.y]
32
+ end
33
+
34
+ def test_set_by_kwargs()
35
+ o = temp
36
+ o.set **{x: 1, y: 2}
31
37
  assert_equal [1, 2], [o.x, o.y]
32
38
  end
33
39
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.32
4
+ version: 0.1.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubygems_version: 3.4.6
123
+ rubygems_version: 3.4.10
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: A Utility library for C++ developemt.