rake_embedded 0.1.4 → 0.1.5

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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -1
  3. data/rake_embedded/version.rb +1 -1
  4. data/rem_core.rb +21 -24
  5. data/scripts/build_functions/gcc/compile.rb +43 -0
  6. data/scripts/build_functions/gcc/default.rb +23 -0
  7. data/scripts/build_functions/gcc/image.rb +34 -0
  8. data/scripts/build_functions/gcc/link.rb +46 -0
  9. data/scripts/build_functions/sdcc/default.rb +23 -0
  10. data/scripts/build_functions/sdcc/image.rb +34 -0
  11. data/scripts/build_functions/sdcc/link.rb +41 -0
  12. data/scripts/download_tasks/download.rb +47 -0
  13. data/scripts/package.rb +53 -64
  14. data/scripts/patch_tasks/{DefaultTasks.rb → patch.rb} +9 -11
  15. data/scripts/prepare_tasks/prepare.rb +80 -0
  16. data/scripts/recipe_handling/recipes.rb +13 -17
  17. data/scripts/remfile_functions/remfile_gen.rb +20 -6
  18. data/shell_scripts/check_deps.sh +18 -14
  19. data/shell_scripts/comment_unused_functions_cppcheck.sh +17 -14
  20. data/shell_scripts/find_func_and_comment.sh +17 -14
  21. data/tests/docker/dockerfile_debian_8.dockertest +3 -2
  22. data/tests/docker/dockerfile_debian_9.dockertest +3 -2
  23. data/tests/docker/dockerfile_ubuntu_14_04.dockertest +3 -2
  24. data/tests/docker/dockerfile_ubuntu_16_04.dockertest +3 -2
  25. data/tests/run_all_rem_tests.sh +17 -0
  26. data/tests/run_docker_test.sh +17 -0
  27. data/tests/run_docker_tests.sh +17 -0
  28. data/tests/tests/TEST_append_features.sh +25 -0
  29. data/tests/tests/TEST_build_test_project.sh +22 -1
  30. data/tests/tests/TEST_check_deps_test_project.sh +17 -0
  31. data/tests/tests/TEST_global_deps.sh +17 -0
  32. data/tests/tests/TEST_remfile.sh +39 -0
  33. data/tests/tests/TEST_remove_unused_functions.sh +18 -1
  34. metadata +13 -5
  35. data/scripts/download_tasks/DefaultTasks.rb +0 -49
  36. data/scripts/prepare_tasks/DefaultTasks.rb +0 -82
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74c975fa72cf4b3e251eef21b1c58e410a450c50
4
- data.tar.gz: 3d0b351e1329012cfbeb101c07026c029cee10ab
3
+ metadata.gz: 8f3dd484badd571285488c81d68d73f5336c8f05
4
+ data.tar.gz: 707d64c3576cb9ecc3d48adbb69974e793de4062
5
5
  SHA512:
6
- metadata.gz: b933a4a9794f7ece35351b0f231fe9eae15bad951390a3f940f0e1a4c07bdaa9406b647add4515751c720b90b97bfa7e55fff66f73fb16a96e33a67934b4253f
7
- data.tar.gz: 8e7157db9eb61c973b860b5e600e40e1962e36d8d36ed3091bbb2c5797fed2889427b0e1c26c15160c48aecc163351ee4e0f9f462d5f14599a95b9983b165148
6
+ metadata.gz: f778c915957b8a1f9dd8b221d85819e4d9af085c4d131a5806f53f373e83d33a4e4b1a052282e1dc7ea59424f143870c354491711568653ad9a9f52d1cb2d252
7
+ data.tar.gz: 40abec82a74b7a571efa6e3114083994c442d60734f561ccc2cbe22b4f7336e4cf257956c719271e0cb5b023e14de197c2f6ba91bf8a7d97ba5a9c07da83db51
data/README.md CHANGED
@@ -21,7 +21,7 @@ REM is a Yocto like buildsystem primarily intended for microcontrollers. It is b
21
21
 
22
22
  ## 1. Install dependencies
23
23
  ```Shell
24
- sudo apt-get install rubygems gcc-arm-none-eabi gcc-avr avr-libc git subversion unzip wget make python sdcc sdcc-libraries cppcheck
24
+ sudo apt-get install rubygems gcc-arm-none-eabi gcc-avr avr-libc git subversion unzip wget curl make python sdcc sdcc-libraries cppcheck
25
25
  ```
26
26
 
27
27
  ## 2. Install REM buildsystem
@@ -141,6 +141,9 @@ After the successful execution you should reinvoke the rem build command to rebu
141
141
  - nrf24le1_24
142
142
  - nrf24le1_32
143
143
  - nrf24le1_48
144
+ - nrf51822
144
145
  * Microchip
145
146
  - PIC32MX2
146
147
  - PIC32MZ2048
148
+ * RISC-V
149
+ - HiFive1
@@ -1,3 +1,3 @@
1
1
  module RakeEmbedded
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
data/rem_core.rb CHANGED
@@ -25,6 +25,9 @@ require_relative "scripts/misc/print_functions"
25
25
  # Global Config
26
26
  require_relative "scripts/global_config/global_config"
27
27
 
28
+ # At first set the main rakefile base directory
29
+ global_config.set_rakefile_dir(File.dirname(__FILE__))
30
+
28
31
  if(SIMPLECOV == "1")
29
32
  require 'simplecov'
30
33
  SimpleCov.command_name "rem codecoverage"
@@ -48,9 +51,9 @@ else
48
51
  end
49
52
 
50
53
  # Prepare and Patch tasks:
51
- require_relative "scripts/download_tasks/DefaultTasks"
52
- require_relative "scripts/prepare_tasks/DefaultTasks"
53
- require_relative "scripts/patch_tasks/DefaultTasks"
54
+ require_relative "scripts/download_tasks/download"
55
+ require_relative "scripts/prepare_tasks/prepare"
56
+ require_relative "scripts/patch_tasks/patch"
54
57
 
55
58
  # Generic
56
59
  require_relative "scripts/package"
@@ -76,38 +79,33 @@ namespace :package do
76
79
  global_package_list = []
77
80
  global_dep_chain = []
78
81
 
79
- # At first set the main rakefile base directory
80
- global_config.set_rakefile_dir(File.dirname(__FILE__))
81
-
82
82
  # Check if a rem_file was already generated
83
83
  if File.exist?(global_config.get_remfile())
84
- temp_pkgs = yaml_parse(global_config.get_remfile())
85
- # We need to extend all build functions here, as they're not
86
- # restored when loading the yaml file
87
- temp_pkgs.each { |pkg| pkg.post_initialize() }
84
+ rem_recipes = yaml_parse(global_config.get_remfile(), false)
85
+ remappend_recipes = yaml_parse(global_config.get_remfile(), true)
88
86
  else
89
87
  print_debug("Parsing recipes...")
90
88
  rem_recipes = get_recipes("#{global_config.get_project_folder()}", "rem")
91
- if rem_recipes == nil
92
- print_abort ("No recipes found!")
93
- end
89
+ remappend_recipes = get_recipes("#{global_config.get_project_folder()}", "remappend")
90
+ end
94
91
 
95
- temp_pkgs = prepare_recipes(rem_recipes)
92
+ if rem_recipes == nil
93
+ print_abort ("No recipes found!")
94
+ end
96
95
 
97
- remappend_recipes = get_recipes("#{global_config.get_project_folder()}", "remappend")
98
- if remappend_recipes != nil
99
- temp_pkgs_append = prepare_recipes(remappend_recipes, true)
100
- merge_recipes_append(temp_pkgs, temp_pkgs_append)
101
- end
96
+ temp_pkgs = prepare_recipes(rem_recipes)
102
97
 
103
- temp_pkgs = filter_packages(temp_pkgs, "#{global_config.arch}", "#{global_config.mach}")
104
- temp_pkgs.each { |pkg| pkg.post_initialize() }
98
+ if remappend_recipes != nil
99
+ temp_pkgs_append = prepare_recipes(remappend_recipes)
100
+ merge_recipes_append(temp_pkgs, temp_pkgs_append)
105
101
  end
106
102
 
103
+ temp_pkgs = filter_packages(temp_pkgs, "#{global_config.arch}", "#{global_config.mach}")
104
+
107
105
  global_package_list = temp_pkgs
108
106
 
109
107
  # We get a list of all dependencies of the global dependencies
110
- # so that we eclude these from adding the global one
108
+ # so that we exclude these from adding the global one
111
109
  # otherwise we would get a lot of circular dependencies
112
110
  glob_dep_list_to_exclude = []
113
111
  global_config.get_global_deps.each do |glob_dep|
@@ -196,7 +194,7 @@ namespace :package do
196
194
  dep_ref_array = []
197
195
  dep_chain.each do |dep|
198
196
  dep_ref = pkg_get_ref_by_name(package_list, dep, pkg_ref.name)
199
- dep_ref_array.push(dep_ref)
197
+ dep_ref_array.concat(dep_ref.get_package_recipe_files)
200
198
  print_any_green("Writing #{dep_ref.name}")
201
199
  end
202
200
  yaml_store(remfile, "pkg", dep_ref_array)
@@ -475,7 +473,6 @@ namespace :package do
475
473
  global_package_list.each do |pkg|
476
474
  print_debug "#{pkg.name}"
477
475
  print_debug "\t\t\t#{pkg.version[0]}"
478
- print_debug ""
479
476
  end
480
477
  end
481
478
  end
@@ -0,0 +1,43 @@
1
+ =begin
2
+
3
+ Copyright (C) 2018 Franz Flasch <franz.flasch@gmx.at>
4
+
5
+ This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
6
+
7
+ REM is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ REM is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with REM. If not, see <http://www.gnu.org/licenses/>.
19
+ =end
20
+
21
+ module Compile
22
+ private
23
+ def do_compile_clean
24
+ end
25
+
26
+ def do_compile
27
+ print_debug "hey I am the Default compile function"
28
+
29
+ print_debug "IncDirsDependsPrepared: #{inc_dirs_depends_prepared}"
30
+ print_debug "IncDirsPrepared: #{inc_dirs_prepared}"
31
+ print_debug "SrcFilesPrepared: #{src_files_prepared}"
32
+
33
+ inc_dirs_string = inc_dirs_depends_prepared.map { |element| "-I #{element} " }.join("")
34
+ inc_dirs_string << inc_dirs_prepared.map { |element| "-I #{element} " }.join("")
35
+
36
+ defines_string = defs.map { |element| "-D#{element} " }.join("")
37
+ defines_string << "#{global_config.get_defines()}"
38
+
39
+ src_files_prepared.each_with_index do |src, obj|
40
+ execute "#{global_config.get_compiler} #{defines_string} #{global_config.get_compile_flags} #{inc_dirs_string} -c #{src} -o #{obj_files_prepared[obj]}"
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,23 @@
1
+ =begin
2
+
3
+ Copyright (C) 2018 Franz Flasch <franz.flasch@gmx.at>
4
+
5
+ This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
6
+
7
+ REM is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ REM is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with REM. If not, see <http://www.gnu.org/licenses/>.
19
+ =end
20
+
21
+ require_relative "./compile"
22
+ require_relative "./link"
23
+ require_relative "./image"
@@ -0,0 +1,34 @@
1
+ =begin
2
+
3
+ Copyright (C) 2018 Franz Flasch <franz.flasch@gmx.at>
4
+
5
+ This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
6
+
7
+ REM is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ REM is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with REM. If not, see <http://www.gnu.org/licenses/>.
19
+ =end
20
+
21
+ module Image
22
+ private
23
+ def do_make_bin
24
+ execute "#{global_config.get_obj_cp} #{global_config.get_obj_copy_flags} -S -O binary #{pkg_deploy_dir}/#{name}.elf #{pkg_deploy_dir}/#{name}.bin"
25
+ end
26
+
27
+ def do_make_hex
28
+ execute "#{global_config.get_obj_cp} #{global_config.get_obj_copy_flags} -S -O ihex #{pkg_deploy_dir}/#{name}.elf #{pkg_deploy_dir}/#{name}.hex"
29
+ end
30
+
31
+ def do_make_srec
32
+ execute "#{global_config.get_obj_cp} #{global_config.get_obj_copy_flags} -S -O srec #{pkg_deploy_dir}/#{name}.elf #{pkg_deploy_dir}/#{name}.srec"
33
+ end
34
+ end
@@ -0,0 +1,46 @@
1
+ =begin
2
+
3
+ Copyright (C) 2018 Franz Flasch <franz.flasch@gmx.at>
4
+
5
+ This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
6
+
7
+ REM is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ REM is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with REM. If not, see <http://www.gnu.org/licenses/>.
19
+ =end
20
+
21
+ module Link
22
+ private
23
+ def do_link_clean
24
+ end
25
+
26
+ def do_prepare_link_string
27
+ tmp_str = ""
28
+ global_linker_flags.each do |e|
29
+ tmp_str.concat("#{e} ")
30
+ end
31
+
32
+ # Set linker script
33
+ unless linker_script[0].to_s.strip.empty?
34
+ tmp_str.concat("-T #{pkg_build_dir}/#{linker_script[0]} ")
35
+ end
36
+
37
+ return tmp_str
38
+ end
39
+
40
+ def do_link(objs)
41
+ print_debug "hey I am the Default link function"
42
+ print_debug "Objects to link: #{objs}"
43
+ objs_string = objs.join(" ")
44
+ execute "#{global_config.get_compiler} #{objs_string} #{global_config.get_link_flags} -Wl,-Map=#{pkg_deploy_dir}/#{name}.map -o #{pkg_deploy_dir}/#{name}.elf"
45
+ end
46
+ end
@@ -0,0 +1,23 @@
1
+ =begin
2
+
3
+ Copyright (C) 2018 Franz Flasch <franz.flasch@gmx.at>
4
+
5
+ This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
6
+
7
+ REM is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ REM is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with REM. If not, see <http://www.gnu.org/licenses/>.
19
+ =end
20
+
21
+ require_relative "../gcc/compile"
22
+ require_relative "./link"
23
+ require_relative "./image"
@@ -0,0 +1,34 @@
1
+ =begin
2
+
3
+ Copyright (C) 2018 Franz Flasch <franz.flasch@gmx.at>
4
+
5
+ This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
6
+
7
+ REM is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ REM is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with REM. If not, see <http://www.gnu.org/licenses/>.
19
+ =end
20
+
21
+ module Image
22
+ private
23
+ def do_make_bin
24
+ print_abort("Not implemented")
25
+ end
26
+
27
+ def do_make_hex
28
+ print_abort("Not implemented")
29
+ end
30
+
31
+ def do_make_srec
32
+ print_abort("Not implemented")
33
+ end
34
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+
3
+ Copyright (C) 2018 Franz Flasch <franz.flasch@gmx.at>
4
+
5
+ This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
6
+
7
+ REM is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ REM is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with REM. If not, see <http://www.gnu.org/licenses/>.
19
+ =end
20
+
21
+ module Link
22
+ private
23
+ def do_link_clean
24
+ end
25
+
26
+ def do_prepare_link_string
27
+ tmp_str = ""
28
+ global_linker_flags.each do |e|
29
+ tmp_str.concat("#{e} ")
30
+ end
31
+
32
+ return tmp_str
33
+ end
34
+
35
+ def do_link(objs)
36
+ print_debug "hey I am the Default link function"
37
+ print_debug "Objects to link: #{objs}"
38
+ objs_string = objs.join(" ")
39
+ execute "#{global_config.get_compiler} #{global_config.get_link_flags()} #{objs_string} -o #{pkg_deploy_dir}/#{name}.ihx"
40
+ end
41
+ end
@@ -0,0 +1,47 @@
1
+ =begin
2
+
3
+ Copyright (C) 2018 Franz Flasch <franz.flasch@gmx.at>
4
+
5
+ This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
6
+
7
+ REM is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ REM is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with REM. If not, see <http://www.gnu.org/licenses/>.
19
+ =end
20
+
21
+ module DownloadPackage
22
+
23
+ private
24
+
25
+ def download_compressed_file
26
+ #execute "wget -c #{uri[0].uri} -P #{pkg_dl_dir}"
27
+ FileUtils.mkdir_p("#{pkg_dl_dir}")
28
+ execute "curl -o #{pkg_dl_dir}/#{get_filename_from_uri(uri[0].uri)} -LOk #{uri[0].uri}"
29
+ end
30
+
31
+ def do_download_clean
32
+ FileUtils.rm_rf("#{pkg_dl_dir}")
33
+ end
34
+
35
+ def do_download
36
+ case uri[0].uri_type
37
+ when "zip"
38
+ print_debug "Zip package"
39
+ download_compressed_file()
40
+ when "gz"
41
+ print_debug "GZ package"
42
+ download_compressed_file()
43
+ else
44
+ print_debug('No zip package, falling through...')
45
+ end
46
+ end
47
+ end
data/scripts/package.rb CHANGED
@@ -56,6 +56,8 @@ module PackageDescriptor
56
56
  # unique hash of the package
57
57
  attr_reader :unique_hash
58
58
 
59
+ # abs path to rem file:
60
+ attr_reader :recipe_paths
59
61
  # base_dir: recipe file location
60
62
  attr_reader :base_dir
61
63
  # pkg_dl_dir: download location
@@ -90,14 +92,6 @@ module PackageDescriptor
90
92
  # pkg_work_dir: work directory
91
93
  attr_reader :pkg_work_dir
92
94
 
93
- # specific package data - not really used at the moment, but it is intended to
94
- # be used for build tasks other than the DefaultTasks - please see below:
95
- # At the moment the this class is only extended by default tasks
96
- attr_reader :download_specific_data
97
- attr_reader :prepare_specific_data
98
- attr_reader :patch_specific_data
99
- attr_reader :build_specific_data
100
-
101
95
  ### SETTERS ###
102
96
 
103
97
  # No ARRAY values
@@ -109,7 +103,15 @@ module PackageDescriptor
109
103
  @unique_hash = hash
110
104
  end
111
105
 
112
- # ARRAY values - (only the first one is used)
106
+ # ARRAY values
107
+ def add_recipe_path(recipe_file)
108
+ (@recipe_paths||= []).push(recipe_file)
109
+ end
110
+
111
+ def add_base_dir(recipe_file)
112
+ (@base_dir||= []).push(get_dirname_from_uri(recipe_file))
113
+ end
114
+
113
115
  def set_uri(uri)
114
116
  tmp_str = string_strip(uri).strip
115
117
  (@uri = []).concat([PackageUri.new(tmp_str)])
@@ -136,10 +138,6 @@ module PackageDescriptor
136
138
  (@linker_script = []).concat(string_strip_to_array(script))
137
139
  end
138
140
 
139
- def set_build_specific_data(data)
140
- (@build_specific_data = []).concat([data])
141
- end
142
-
143
141
  # full ARRAY values
144
142
  def set_src(src)
145
143
  (@srcs ||= []).concat(string_strip_to_array(src))
@@ -176,6 +174,10 @@ module PackageDescriptor
176
174
 
177
175
 
178
176
  ### GETTERS ###
177
+ def get_package_recipe_files
178
+ return recipe_paths
179
+ end
180
+
179
181
  def get_package_state_file(which)
180
182
  return "#{pkg_state_dir}/#{which}"
181
183
  end
@@ -198,10 +200,6 @@ module PackageDescriptor
198
200
  return mach[0].strip()
199
201
  end
200
202
 
201
- def get_build_specific_data
202
- return build_specific_data[0]
203
- end
204
-
205
203
  private
206
204
  ### Private set methods
207
205
 
@@ -210,7 +208,8 @@ module PackageDescriptor
210
208
  set_name(get_filename_without_extension_from_uri(recipe_file))
211
209
  set_unique_hash("nohash")
212
210
 
213
- (@base_dir||= []).push(get_dirname_from_uri(recipe_file))
211
+ add_base_dir(recipe_file)
212
+ add_recipe_path(recipe_file)
214
213
  end
215
214
 
216
215
  def default_setup_settables()
@@ -237,8 +236,6 @@ module PackageDescriptor
237
236
  @linker_script = set_linker_script("")
238
237
 
239
238
  @instance_var_to_reset = []
240
-
241
- @build_specific_data = set_build_specific_data(nil)
242
239
  end
243
240
 
244
241
  def set_download_done()
@@ -265,10 +262,7 @@ class SoftwarePackage
265
262
  # Extend with various modules here
266
263
  include PackageBuildFunctions
267
264
 
268
- def initialize(recipe_file)
269
- default_setup_identifiers(recipe_file)
270
- default_setup_settables()
271
-
265
+ def load_package(recipe_file)
272
266
  # OK, we are done with the default setup, now load the recipe file and setup internals
273
267
  sw_package_set(self)
274
268
  load "./#{recipe_file}"
@@ -276,6 +270,13 @@ class SoftwarePackage
276
270
  # override the above defined function here, this way it is possible
277
271
  # to use "sw_package." in the method context also (for e.g if custom build methods are used)
278
272
  def sw_package; return self; end
273
+ end
274
+
275
+ def initialize(recipe_file)
276
+ default_setup_identifiers(recipe_file)
277
+ default_setup_settables()
278
+
279
+ load_package(recipe_file)
279
280
 
280
281
  @src_files_prepared = []
281
282
  @obj_files_prepared = []
@@ -288,56 +289,44 @@ class SoftwarePackage
288
289
  # Make sanity checks here:
289
290
  check_duplicates_exit_with_error(deps, "deps in package #{name}")
290
291
  check_duplicates_exit_with_error(srcs, "srcs in package #{name}")
291
- end
292
292
 
293
- def post_initialize
293
+ extend DownloadPackage
294
+ extend PreparePackageBuildDir
295
+ extend Patch
296
+ extend Compile
297
+ extend Link
298
+ extend Image
299
+ end
294
300
 
295
- case "#{download_specific_data.class.name}"
296
- when "NilClass"
297
- extend DefaultDownload::DownloadPackage
298
- else
299
- print_abort("Package download_type #{download_specific_data.class.name} not known")
301
+ def override_func(name, &block)
302
+ (class << self; self; end).class_eval do
303
+ define_method name, &block
300
304
  end
305
+ end
301
306
 
302
- case "#{prepare_specific_data.class.name}"
303
- when "NilClass"
304
- extend DefaultPrepare::PreparePackageBuildDir
305
- else
306
- print_abort("Package download_type #{prepare_specific_data.class.name} not known")
307
+ def invalidate_build_funcs
308
+ self.override_func :do_compile_clean do
309
+ print_abort("not implemented")
307
310
  end
308
311
 
309
- case "#{patch_specific_data.class.name}"
310
- when "NilClass"
311
- extend DefaultPatch::Patch
312
- else
313
- print_abort("Package download_type #{patch_specific_data.class.name} not known")
312
+ self.override_func :do_compile do
313
+ print_abort("not implemented")
314
314
  end
315
315
 
316
- case "#{build_specific_data[0].class.name}"
317
- when "NilClass"
318
- extend Default::Compile
319
- extend Default::Link
320
- extend Default::Image
321
- when "MakeTasksDesc"
322
- extend MakePkg::Compile
323
- extend MakePkg::Link
324
- extend MakePkg::Image
325
- print_any_yellow("Using class #{build_specific_data[0].class.name} for package #{name}")
326
- else
327
- print_abort("Package build_type #{build_specific_data[0].class.name} not known")
316
+ self.override_func :do_link_clean do
317
+ print_abort("not implemented")
328
318
  end
329
- end
330
- end
331
319
 
332
- class SoftwarePackageAppend
333
- include PackageDescriptor
320
+ self.override_func :do_link do |objs|
321
+ print_abort("not implemented")
322
+ end
334
323
 
335
- def initialize(recipe_file)
336
- # Only setup the identifiers
337
- default_setup_identifiers(recipe_file)
324
+ self.override_func :do_make_bin do
325
+ print_abort("not implemented")
326
+ end
338
327
 
339
- # OK, we are done with the default setup, now load the recipe file and setup internals
340
- sw_package_set(self)
341
- load "./#{recipe_file}"
342
- end
328
+ self.override_func :do_make_hex do
329
+ print_abort("not implemented")
330
+ end
331
+ end
343
332
  end