rakeoe 0.0.2 → 0.0.3
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/rakeoe/binary_base.rb +93 -97
- data/lib/rakeoe/defaults.rb +2 -1
- data/lib/rakeoe/test_framework.rb +2 -0
- data/lib/rakeoe/toolchain.rb +6 -10
- data/lib/rakeoe/version.rb +1 -1
- data/lib/rakeoe.rb +27 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fbe6da29cfe5dab5316240a65e92968b05474db
|
4
|
+
data.tar.gz: afaab703e8c86e60895de7ba6dc67029a1217755
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e70fd91f6c122104d154ea3337a90235dd3a5c2f52d721fae846380d272e75a6b0b8b782330074e6cdb7e36c328558582e18cf47f3504379c21eaa63ac7bb0b4
|
7
|
+
data.tar.gz: 541a1010dbed2d44915fbcada5c10f376f34372870410dfe20c1a772abd13fc8c99d3e16e6ec7755850ef6fac179c0adede5a24f2df4807167a3f89298af4a03
|
data/lib/rakeoe/binary_base.rb
CHANGED
@@ -82,7 +82,7 @@ module RakeOE
|
|
82
82
|
end
|
83
83
|
|
84
84
|
@test_binary = "#{bin_dir}/#{name}-test"
|
85
|
-
@test_inc_dirs = @test_fw.include
|
85
|
+
@test_inc_dirs = @test_fw.include.join(' ')
|
86
86
|
|
87
87
|
handle_prj_type
|
88
88
|
handle_qt if '1' == @settings['USE_QT']
|
@@ -378,115 +378,111 @@ module RakeOE
|
|
378
378
|
|
379
379
|
# map object to source file and make it dependent on creation of all object directories
|
380
380
|
rule /#{build_dir}\/.*\.o/ => [ proc {|tn| obj_to_source(tn, src_dir, build_dir)}] + obj_dirs do |t|
|
381
|
+
if t.name =~ /\/tests\//
|
382
|
+
# test framework additions
|
383
|
+
incs << @test_inc_dirs unless incs.include?(@test_inc_dirs)
|
384
|
+
@settings['ADD_CXXFLAGS'] += @test_fw.cflags
|
385
|
+
@settings['ADD_CFLAGS'] += @test_fw.cflags
|
386
|
+
end
|
381
387
|
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
@settings['ADD_CXXFLAGS'] += @test_fw.cflags
|
387
|
-
@settings['ADD_CFLAGS'] += @test_fw.cflags
|
388
|
+
tc.obj(:source => t.source,
|
389
|
+
:object => t.name,
|
390
|
+
:settings => @settings,
|
391
|
+
:includes => incs.uniq)
|
388
392
|
end
|
389
393
|
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
394
|
+
# map dependency to source file and make it dependent on creation of all object directories
|
395
|
+
rule /#{build_dir}\/.*\.d/ => [ proc {|tn| dep_to_source(tn, src_dir, build_dir)}] + obj_dirs do |t|
|
396
|
+
# don't generate dependencies for assembler files XXX DS: use tc.file_extensions[:as_sources]
|
397
|
+
if (t.source.end_with?('.S') || t.source.end_with?('.s'))
|
398
|
+
tc.touch(t.name)
|
399
|
+
next
|
400
|
+
end
|
395
401
|
|
396
|
-
|
397
|
-
|
402
|
+
if t.name =~ /\/tests\//
|
403
|
+
# test framework additions
|
404
|
+
incs << @test_inc_dirs unless incs.include?(@test_inc_dirs)
|
405
|
+
@settings['ADD_CXXFLAGS'] += @test_fw.cflags
|
406
|
+
@settings['ADD_CFLAGS'] += @test_fw.cflags
|
407
|
+
end
|
398
408
|
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
409
|
+
tc.dep(:source => t.source,
|
410
|
+
:dep => t.name,
|
411
|
+
:settings => @settings,
|
412
|
+
:includes => incs.uniq)
|
413
|
+
end
|
404
414
|
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
415
|
+
# make moc source file dependent on corresponding header file, XXX DS: only if project uses QT
|
416
|
+
rule /#{src_dir}\/.*moc_.*#{Regexp.escape(tc.moc_source)}$/ => [ proc {|tn| tn.gsub(/moc_/, '').ext(tc.moc_header_extension) } ] do |t|
|
417
|
+
tc.moc(:source => t.source,
|
418
|
+
:moc => t.name,
|
419
|
+
:settings => @settings)
|
420
|
+
end
|
410
421
|
end
|
411
422
|
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
end
|
423
|
+
# Search dependent libraries as specified in ADD_LIBS setting
|
424
|
+
# of prj.rake file
|
425
|
+
#
|
426
|
+
# @param [String] settings The project settings definition
|
427
|
+
#
|
428
|
+
# @return [Hash] Containing the following components mapped to an array:
|
429
|
+
# @option return [Array] :local local libs found by toolchain
|
430
|
+
# @option return [Array] :all local + external libs
|
431
|
+
#
|
432
|
+
def search_libs(settings)
|
433
|
+
# get all libs specified in ADD_LIBS
|
434
|
+
libs = settings['ADD_LIBS'].split
|
425
435
|
|
426
|
-
#
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
#
|
431
|
-
# @return [Hash] Containing the following components mapped to an array:
|
432
|
-
# @option return [Array] :local local libs found by toolchain
|
433
|
-
# @option return [Array] :all local + external libs
|
434
|
-
#
|
435
|
-
def search_libs(settings)
|
436
|
-
# get all libs specified in ADD_LIBS
|
437
|
-
libs = settings['ADD_LIBS'].split
|
438
|
-
|
439
|
-
# match libs found by toolchain
|
440
|
-
local_libs = libs.each_with_object(Array.new) do |lib, arr|
|
441
|
-
arr << lib if (PrjFileCache.contain?('LIB', lib) || PrjFileCache.contain?('SOLIB', lib))
|
442
|
-
end
|
436
|
+
# match libs found by toolchain
|
437
|
+
local_libs = libs.each_with_object(Array.new) do |lib, arr|
|
438
|
+
arr << lib if (PrjFileCache.contain?('LIB', lib) || PrjFileCache.contain?('SOLIB', lib))
|
439
|
+
end
|
443
440
|
|
444
|
-
# return value is a hash
|
445
|
-
{
|
446
|
-
|
447
|
-
|
448
|
-
}
|
449
|
-
end
|
441
|
+
# return value is a hash
|
442
|
+
{
|
443
|
+
:local => local_libs,
|
444
|
+
:all => libs
|
445
|
+
}
|
446
|
+
end
|
450
447
|
|
451
|
-
# Iterate over each local library and execute given block
|
452
|
-
#
|
453
|
-
# @param [Block] block The block that is executed
|
454
|
-
#
|
455
|
-
def each_local_lib(&block)
|
456
|
-
libs = search_libs(@settings)
|
457
|
-
libs[:local].each do |lib|
|
458
|
-
|
459
|
-
end
|
460
|
-
end
|
448
|
+
# Iterate over each local library and execute given block
|
449
|
+
#
|
450
|
+
# @param [Block] block The block that is executed
|
451
|
+
#
|
452
|
+
def each_local_lib(&block)
|
453
|
+
libs = search_libs(@settings)
|
454
|
+
libs[:local].each do |lib|
|
455
|
+
yield(lib)
|
456
|
+
end
|
457
|
+
end
|
461
458
|
|
462
|
-
#
|
463
|
-
# Returns absolute paths to dependend local libraries, i.e. libraries
|
464
|
-
# of the current project.
|
465
|
-
#
|
466
|
-
def paths_of_local_libs
|
467
|
-
local_libs = Array.new
|
468
|
-
|
469
|
-
each_local_lib() do |lib|
|
470
|
-
if PrjFileCache.contain?('LIB', lib)
|
471
|
-
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.a"
|
472
|
-
elsif PrjFileCache.contain?('SOLIB', lib)
|
473
|
-
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.so"
|
474
|
-
end
|
475
|
-
end
|
459
|
+
#
|
460
|
+
# Returns absolute paths to dependend local libraries, i.e. libraries
|
461
|
+
# of the current project.
|
462
|
+
#
|
463
|
+
def paths_of_local_libs
|
464
|
+
local_libs = Array.new
|
476
465
|
|
477
|
-
|
478
|
-
|
466
|
+
each_local_lib() do |lib|
|
467
|
+
if PrjFileCache.contain?('LIB', lib)
|
468
|
+
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.a"
|
469
|
+
elsif PrjFileCache.contain?('SOLIB', lib)
|
470
|
+
local_libs << "#{tc.settings['LIB_OUT']}/lib#{lib}.so"
|
471
|
+
end
|
472
|
+
end
|
479
473
|
|
480
|
-
|
481
|
-
|
482
|
-
# @param [String] file Filename to be used for operation
|
483
|
-
# @param [String] string String to be searched for in file
|
484
|
-
#
|
485
|
-
# @return [boolean] true if string found inside file, false otherwise
|
486
|
-
#
|
487
|
-
def fgrep(file, string)
|
488
|
-
open(file) { |f| f.grep(/#{string}/) }
|
489
|
-
end
|
490
|
-
end
|
474
|
+
local_libs
|
475
|
+
end
|
491
476
|
|
477
|
+
# Greps for a string in a file
|
478
|
+
#
|
479
|
+
# @param [String] file Filename to be used for operation
|
480
|
+
# @param [String] string String to be searched for in file
|
481
|
+
#
|
482
|
+
# @return [boolean] true if string found inside file, false otherwise
|
483
|
+
#
|
484
|
+
def fgrep(file, string)
|
485
|
+
open(file).grep(/#{string}/).any?
|
486
|
+
end
|
487
|
+
end
|
492
488
|
end
|
data/lib/rakeoe/defaults.rb
CHANGED
data/lib/rakeoe/toolchain.rb
CHANGED
@@ -68,7 +68,7 @@ class Toolchain
|
|
68
68
|
|
69
69
|
# returns the build directory
|
70
70
|
def build_dir
|
71
|
-
@config.directories[:build]
|
71
|
+
"#{@config.directories[:build]}/#{@target}/#{@config.release}"
|
72
72
|
end
|
73
73
|
|
74
74
|
|
@@ -200,10 +200,12 @@ class Toolchain
|
|
200
200
|
@settings['LIB_SRC_DIR'] = 'src/lib'
|
201
201
|
|
202
202
|
# derived settings
|
203
|
-
@settings['BUILD_DIR'] = "#{build_dir}
|
203
|
+
@settings['BUILD_DIR'] = "#{build_dir}"
|
204
204
|
@settings['LIB_OUT'] = "#{@settings['BUILD_DIR']}/libs"
|
205
205
|
@settings['APP_OUT'] = "#{@settings['BUILD_DIR']}/apps"
|
206
|
-
|
206
|
+
unless @settings['OECORE_TARGET_SYSROOT'].nil? || @settings['OECORE_TARGET_SYSROOT'].empty?
|
207
|
+
@settings['SYS_LFLAGS'] = "-L#{@settings['OECORE_TARGET_SYSROOT']}/lib -L#{@settings['OECORE_TARGET_SYSROOT']}/usr/lib"
|
208
|
+
end
|
207
209
|
|
208
210
|
# set LD_LIBRARY_PATH
|
209
211
|
@settings['LD_LIBRARY_PATH'] = @settings['LIB_OUT']
|
@@ -333,13 +335,7 @@ class Toolchain
|
|
333
335
|
object = params[:object]
|
334
336
|
source = params[:source]
|
335
337
|
incs = compiler_incs_for(params[:includes]) + " #{@settings['LIB_INC']}"
|
336
|
-
|
337
|
-
puts
|
338
|
-
puts "incs for #{object}: #{incs}"
|
339
|
-
puts
|
340
|
-
puts "params[:includes]:#{params[:includes]}"
|
341
|
-
puts
|
342
|
-
=end
|
338
|
+
|
343
339
|
case
|
344
340
|
when cpp_source_extensions.include?(extension)
|
345
341
|
flags = @settings['CXXFLAGS'] + ' ' + params[:settings]['ADD_CXXFLAGS']
|
data/lib/rakeoe/version.rb
CHANGED
data/lib/rakeoe.rb
CHANGED
@@ -22,6 +22,7 @@ module RakeOE
|
|
22
22
|
#
|
23
23
|
# @param config [RakeOE::Config] Configuration as provided by project Rakefile
|
24
24
|
#
|
25
|
+
# @return [RakeOE::Toolchain] Toolchain object
|
25
26
|
def init(config)
|
26
27
|
|
27
28
|
RakeOE::PrjFileCache.sweep_recursive(config.directories[:apps] + config.directories[:libs])
|
@@ -71,7 +72,30 @@ module RakeOE
|
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
74
|
-
desc '
|
75
|
+
desc 'Deploys apps and dynamic objects to deploy_dir/bin, deploy_dir/lib'
|
76
|
+
task :deploy, [:deploy_dir] => :all do |t, args|
|
77
|
+
args.with_defaults(:deploy_dir => config.directories[:deploy])
|
78
|
+
puts "Copy binaries from #{toolchain.build_dir} => #{args.deploy_dir}"
|
79
|
+
begin
|
80
|
+
FileUtils.mkdir_p("#{args.deploy_dir}/bin")
|
81
|
+
FileUtils.mkdir_p("#{args.deploy_dir}/lib")
|
82
|
+
rescue
|
83
|
+
raise
|
84
|
+
end
|
85
|
+
|
86
|
+
# deploy binaries
|
87
|
+
Dir.glob("#{toolchain.build_dir}/apps/*").each do |file|
|
88
|
+
next if file.end_with?('.bin')
|
89
|
+
FileUtils.cp(file, "#{args.deploy_dir}/bin/#{File.basename(file)}") if File.executable?(file)
|
90
|
+
end
|
91
|
+
# deploy dynamic libraries
|
92
|
+
Dir.glob("#{toolchain.build_dir}/libs/*.so").each do |file|
|
93
|
+
next if file.end_with?('.bin')
|
94
|
+
FileUtils.cp(file, "#{args.deploy_dir}/lib/")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
desc 'Dump configuration & toolchain variables'
|
75
99
|
task :dump do
|
76
100
|
puts
|
77
101
|
config.dump
|
@@ -88,6 +112,8 @@ module RakeOE
|
|
88
112
|
|
89
113
|
# kind of mrproper/realclean
|
90
114
|
CLOBBER.include('*.tmp', "#{config.directories[:build]}/*")
|
115
|
+
|
116
|
+
toolchain
|
91
117
|
end
|
92
118
|
end
|
93
119
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rakeoe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schnell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|