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
@@ -1,6 +1,6 @@
1
1
  =begin
2
2
 
3
- Copyright (C) 2015 Franz Flasch <franz.flasch@gmx.at>
3
+ Copyright (C) 2018 Franz Flasch <franz.flasch@gmx.at>
4
4
 
5
5
  This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
6
6
 
@@ -18,16 +18,14 @@
18
18
  along with REM. If not, see <http://www.gnu.org/licenses/>.
19
19
  =end
20
20
 
21
- module DefaultPatch
22
- module Patch
21
+ module Patch
23
22
 
24
- private
23
+ private
25
24
 
26
- def do_patch
27
- main_working_dir = Rake.original_dir
28
- patches.each do |e|
29
- execute "patch -d #{get_pkg_work_dir} -i #{pkg_build_dir}/#{e} -p1 -t"
30
- end
25
+ def do_patch
26
+ main_working_dir = Rake.original_dir
27
+ patches.each do |e|
28
+ execute "patch -d #{get_pkg_work_dir} -i #{pkg_build_dir}/#{e} -p1 -t"
31
29
  end
32
- end
33
- end
30
+ end
31
+ end
@@ -0,0 +1,80 @@
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 PreparePackageBuildDir
22
+
23
+ private
24
+
25
+ def prepare_copy
26
+ base_dir.each do |dir|
27
+ FileUtils.cp_r("#{dir}/.", pkg_build_dir, {:remove_destination => true, :verbose => false})
28
+ end
29
+ end
30
+
31
+ def prepare_clone_git
32
+ execute "git clone #{uri[0].uri} #{pkg_build_dir}"
33
+ if(uri[0].uri_src_rev != "undefined")
34
+ execute "git --git-dir=#{pkg_build_dir}/.git --work-tree=#{pkg_build_dir} checkout #{uri[0].uri_src_rev}"
35
+ end
36
+ end
37
+
38
+ def prepare_checkout_svn
39
+ execute "svn co --non-interactive --trust-server-cert #{uri[0].uri} #{pkg_build_dir}"
40
+ if(uri[0].uri_src_rev != "undefined")
41
+ # TODO: add possibilty to checkout specific revision
42
+ end
43
+ end
44
+
45
+ def prepare_zip
46
+ execute "unzip -qq #{pkg_dl_dir}/#{get_filename_from_uri(uri[0].uri)} -d #{pkg_build_dir}"
47
+ end
48
+
49
+ def prepare_gz
50
+ FileUtils.mkdir_p("#{pkg_build_dir}")
51
+ execute "tar -xvf #{pkg_dl_dir}/#{get_filename_from_uri(uri[0].uri)} -C #{pkg_build_dir}"
52
+ end
53
+
54
+ def do_prepare_clean
55
+ FileUtils.rm_rf(pkg_build_dir)
56
+ end
57
+
58
+ def do_prepare_builddir
59
+ case uri[0].uri_type
60
+ when "local"
61
+ print_debug "LOCAL package"
62
+ when "zip"
63
+ print_debug "ZIP package"
64
+ prepare_zip()
65
+ when "gz"
66
+ print_debug "GZ package"
67
+ prepare_gz();
68
+ when "git"
69
+ print_debug "GIT repo"
70
+ prepare_clone_git()
71
+ when "svn"
72
+ print_debug "SVN repo"
73
+ prepare_checkout_svn()
74
+ else
75
+ print_abort('No valid URI type!')
76
+ end
77
+ # files need to be copied in every case:
78
+ prepare_copy()
79
+ end
80
+ end
@@ -34,7 +34,7 @@ def get_recipes(project_folders, recipe_file_ending)
34
34
  return files
35
35
  end
36
36
 
37
- def prepare_recipes(recipes, append=false)
37
+ def prepare_recipes(recipes)
38
38
  recipe_filenames = []
39
39
  pkgs = []
40
40
 
@@ -50,12 +50,7 @@ def prepare_recipes(recipes, append=false)
50
50
  print_debug "parsing recipe #{r}:"
51
51
 
52
52
  # Parse and include submakefiles
53
- if(append == true)
54
- cur_pkg = SoftwarePackageAppend.new(r)
55
- else
56
- cur_pkg = SoftwarePackage.new(r)
57
- end
58
-
53
+ cur_pkg = SoftwarePackage.new(r)
59
54
  pkgs.push(cur_pkg)
60
55
  end
61
56
  return pkgs
@@ -86,17 +81,18 @@ def merge_recipes_append(recipe_list, append_recipe_list)
86
81
  append_pkg.instance_variable_get(:@instance_var_to_reset).clear
87
82
  end
88
83
 
89
- # Now merge the append recipe instance variables with the base recipe
90
- append_pkg.instance_variables.each do |var|
91
- print_any_yellow("#{var} before appending: #{tmp_pkg.instance_variable_get("#{var}")}")
92
84
 
93
- # At the moment only array types will get appended
94
- if tmp_pkg.instance_variable_get(var).kind_of?(Array)
95
- val_to_append = append_pkg.instance_variable_get(var)
96
- tmp_pkg.instance_variable_get(var).concat(val_to_append)
97
- print_any_yellow("Appending #{var} #{val_to_append} to recipe #{tmp_pkg.name}")
98
- print_any_cyan("#{var} is now #{tmp_pkg.instance_variable_get("#{var}")}")
99
- end
85
+ # OK now simply load the new append package into the base package
86
+ tmp_pkg.load_package(append_pkg.get_package_recipe_files[0])
87
+
88
+ # Add the remappend path
89
+ tmp_pkg.add_recipe_path(append_pkg.get_package_recipe_files[0])
90
+
91
+ # Also add the new base_dir
92
+ tmp_pkg.add_base_dir(append_pkg.get_package_recipe_files[0])
93
+
94
+ tmp_pkg.instance_variables.each do |var|
95
+ print_any_cyan("#{var} is now #{tmp_pkg.instance_variable_get("#{var}")}")
100
96
  end
101
97
  end
102
98
  end
@@ -25,15 +25,29 @@ def yaml_store(file, fieldname, data)
25
25
  store = YAML::Store.new(file)
26
26
  store.transaction do
27
27
  store[fieldname] = data
28
- #store["compile_sources"] = { "hello" => "world" }
29
28
  end
30
29
  end
31
30
 
32
- def yaml_parse(file)
33
- pkgs = []
31
+ def yaml_parse(file, append)
34
32
  data = YAML::load_file(file)
35
- data['pkg'].each do |d|
36
- pkgs.push(d)
33
+
34
+ recipes = []
35
+
36
+ data['pkg'].each do |pkg|
37
+ if append == true
38
+ if pkg.include? ".remappend"
39
+ (recipes||= []).push(pkg)
40
+ end
41
+ else
42
+ if !pkg.include? ".remappend"
43
+ (recipes||= []).push(pkg)
44
+ end
45
+ end
46
+ end
47
+
48
+ if recipes.empty?
49
+ return nil
50
+ else
51
+ return recipes
37
52
  end
38
- return pkgs
39
53
  end
@@ -1,18 +1,22 @@
1
1
  #!/bin/bash
2
- #
3
- # Copyright (C) 2016 Franz Flasch <franz.flasch@gmx.at>
4
- # This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
5
- # REM is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- # REM is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
- # You should have received a copy of the GNU General Public License
14
- # along with REM. If not, see <http://www.gnu.org/licenses/>.
15
- #
2
+
3
+ # Copyright (C) 2016 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
+
16
20
 
17
21
  # This script will perform the following tests:
18
22
  # At first a recursive "compile test" build with the complete package dependency chain will be done.
@@ -1,18 +1,21 @@
1
1
  #!/bin/bash
2
- #
3
- # Copyright (C) 2016 Franz Flasch <franz.flasch@gmx.at>
4
- # This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
5
- # REM is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- # REM is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
- # You should have received a copy of the GNU General Public License
14
- # along with REM. If not, see <http://www.gnu.org/licenses/>.
15
- #
2
+
3
+ # Copyright (C) 2016 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/>.
16
19
 
17
20
  folder_to_check=$1
18
21
  folders_to_exclude=($2)
@@ -1,18 +1,21 @@
1
1
  #!/bin/bash
2
- #
3
- # Copyright (C) 2016 Franz Flasch <franz.flasch@gmx.at>
4
- # This file is part of REM - Rake for EMbedded Systems and Microcontrollers.
5
- # REM is free software: you can redistribute it and/or modify
6
- # it under the terms of the GNU General Public License as published by
7
- # the Free Software Foundation, either version 3 of the License, or
8
- # (at your option) any later version.
9
- # REM is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
- # You should have received a copy of the GNU General Public License
14
- # along with REM. If not, see <http://www.gnu.org/licenses/>.
15
- #
2
+
3
+ # Copyright (C) 2016 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/>.
16
19
 
17
20
  file_name=$1
18
21
  begin_of_function=$2
@@ -6,11 +6,12 @@ FROM debian:jessie
6
6
  WORKDIR /home/rem_build
7
7
 
8
8
  RUN apt-get update -y
9
- RUN apt-get install -y rake gcc-arm-none-eabi gcc-avr avr-libc git subversion unzip wget curl make python sdcc sdcc-libraries cppcheck
9
+ RUN apt-get install -y build-essential rake gcc-arm-none-eabi gcc-avr avr-libc git subversion unzip wget curl make python sdcc sdcc-libraries cppcheck
10
10
 
11
11
  # Install mips toolchain manually, as there is no apt-get package available:
12
- RUN wget https://community.imgtec.com/?do-download=linux-x64-mti-bare-metal-2016-05-03 -O mips_toolchain.tar.gz
12
+ RUN wget https://www.mips.com/?do-download=linux-x64-mti-bare-metal-2016-05-03 -O mips_toolchain.tar.gz
13
13
  RUN tar xvf mips_toolchain.tar.gz
14
+ RUN chmod 755 /home/rem_build/mips-mti-elf/2016.05-03/bin /home/rem_build/mips-mti-elf/2016.05-03 /home/rem_build/mips-mti-elf
14
15
  ENV PATH /home/rem_build/mips-mti-elf/2016.05-03/bin/:$PATH
15
16
 
16
17
  RUN git clone https://github.com/franzflasch/REM.git
@@ -6,11 +6,12 @@ FROM debian:stretch
6
6
  WORKDIR /home/rem_build
7
7
 
8
8
  RUN apt-get update -y
9
- RUN apt-get install -y rake gcc-arm-none-eabi gcc-avr avr-libc git subversion unzip wget curl make python sdcc sdcc-libraries cppcheck
9
+ RUN apt-get install -y build-essential rake gcc-arm-none-eabi gcc-avr avr-libc git subversion unzip wget curl make python sdcc sdcc-libraries cppcheck
10
10
 
11
11
  # Install mips toolchain manually, as there is no apt-get package available:
12
- RUN wget https://community.imgtec.com/?do-download=linux-x64-mti-bare-metal-2016-05-03 -O mips_toolchain.tar.gz
12
+ RUN wget https://www.mips.com/?do-download=linux-x64-mti-bare-metal-2016-05-03 -O mips_toolchain.tar.gz
13
13
  RUN tar xvf mips_toolchain.tar.gz
14
+ RUN chmod 755 /home/rem_build/mips-mti-elf/2016.05-03/bin /home/rem_build/mips-mti-elf/2016.05-03 /home/rem_build/mips-mti-elf
14
15
  ENV PATH /home/rem_build/mips-mti-elf/2016.05-03/bin/:$PATH
15
16
 
16
17
  RUN git clone https://github.com/franzflasch/REM.git
@@ -8,11 +8,12 @@ WORKDIR /home/rem_build
8
8
  ENV DEBIAN_FRONTEND noninteractive
9
9
 
10
10
  RUN apt-get update -y
11
- RUN apt-get install -y rake gcc-arm-none-eabi gcc-avr avr-libc git subversion unzip wget curl make python sdcc sdcc-libraries cppcheck
11
+ RUN apt-get install -y build-essential rake gcc-arm-none-eabi gcc-avr avr-libc git subversion unzip wget curl make python sdcc sdcc-libraries cppcheck
12
12
 
13
13
  # Install mips toolchain manually, as there is no apt-get package available:
14
- RUN wget https://community.imgtec.com/?do-download=linux-x64-mti-bare-metal-2016-05-03 -O mips_toolchain.tar.gz
14
+ RUN wget https://www.mips.com/?do-download=linux-x64-mti-bare-metal-2016-05-03 -O mips_toolchain.tar.gz
15
15
  RUN tar xvf mips_toolchain.tar.gz
16
+ RUN chmod 755 /home/rem_build/mips-mti-elf/2016.05-03/bin /home/rem_build/mips-mti-elf/2016.05-03 /home/rem_build/mips-mti-elf
16
17
  ENV PATH /home/rem_build/mips-mti-elf/2016.05-03/bin/:$PATH
17
18
 
18
19
  RUN git clone https://github.com/franzflasch/REM.git
@@ -8,11 +8,12 @@ WORKDIR /home/rem_build
8
8
  ENV DEBIAN_FRONTEND noninteractive
9
9
 
10
10
  RUN apt-get update -y
11
- RUN apt-get install -y rake gcc-arm-none-eabi gcc-avr avr-libc git subversion unzip wget curl make python sdcc sdcc-libraries cppcheck
11
+ RUN apt-get install -y build-essential rake gcc-arm-none-eabi gcc-avr avr-libc git subversion unzip wget curl make python sdcc sdcc-libraries cppcheck
12
12
 
13
13
  # Install mips toolchain manually, as there is no apt-get package available:
14
- RUN wget https://community.imgtec.com/?do-download=linux-x64-mti-bare-metal-2016-05-03 -O mips_toolchain.tar.gz
14
+ RUN wget https://www.mips.com/?do-download=linux-x64-mti-bare-metal-2016-05-03 -O mips_toolchain.tar.gz
15
15
  RUN tar xvf mips_toolchain.tar.gz
16
+ RUN chmod 755 /home/rem_build/mips-mti-elf/2016.05-03/bin /home/rem_build/mips-mti-elf/2016.05-03 /home/rem_build/mips-mti-elf
16
17
  ENV PATH /home/rem_build/mips-mti-elf/2016.05-03/bin/:$PATH
17
18
 
18
19
  RUN git clone https://github.com/franzflasch/REM.git
@@ -1,5 +1,22 @@
1
1
  #!/bin/bash
2
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
+
3
20
  BASEDIR=$(dirname "$0")
4
21
  REM_PATH=$1
5
22
 
@@ -1,5 +1,22 @@
1
1
  #!/bin/bash
2
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
+
3
20
  BASEDIR=$(dirname "$0")
4
21
 
5
22
  docker build -f $BASEDIR/docker/dockerfile_"$1"_"$2".dockertest .
@@ -1,5 +1,22 @@
1
1
  #!/bin/bash
2
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
+
3
20
  BASEDIR=$(dirname "$0")
4
21
 
5
22
  BUILD_ITEM_NAME=()