Commit Graph

98 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 600e3330b3 Scan source files only from cdump enabled gems. 2020-11-14 18:52:57 +09:00
KOBAYASHI Shuji 08df172e91 Remove unused constant in lib/mruby/build/command.rb 2020-11-14 16:50:00 +09:00
KOBAYASHI Shuji 0c55b85fb0 Simplify MRuby::Command#_run to avoid duplicated compilation
ref: https://github.com/mruby/mruby/pull/4959#discussion_r402086196

Compiles twice because it falls back to `build.filename(command)` when
`command` fails. This process was added at 9968af4 to support `ccache gcc`
etc. At that time, it seems that it was necessary because
`build.filename(command)` quoted the whole `command`, but now it does not
quote, so we can just run `build.filename(command)`.

### Example

  ```console
  $ echo 1 > src/a.c
  $ rake -v
  ```

#### Before this patch:

  ```console
  (snip)
  gcc -std=gnu99 -g -O3 -Wall -Wundef -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wwrite-strings -I"/mruby/mruby/include" -MMD -o "/mruby/mruby/build/host/src/a.o" -c "/mruby/mruby/src/a.c"
  /mruby/mruby/src/a.c:1:1: error: expected identifier or '('
  1
  ^
  1 error generated.
  gcc -std=gnu99 -g -O3 -Wall -Wundef -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wwrite-strings -I"/mruby/mruby/include" -MMD -o "/mruby/mruby/build/host/src/a.o" -c "/mruby/mruby/src/a.c"
  /mruby/mruby/src/a.c:1:1: error: expected identifier or '('
  1
  ^
  1 error generated.
  rake aborted!
  (snip)
  ```

#### After this patch:

  ```console
  (snip)
  gcc -std=gnu99 -g -O3 -Wall -Wundef -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wwrite-strings -I"/mruby/mruby/include" -MMD -o "/mruby/mruby/build/host/src/a.o" -c "/mruby/mruby/src/a.c"
  /mruby/mruby/src/a.c:1:1: error: expected identifier or '('
  1
  ^
  1 error generated.
  rake aborted!
  (snip)
  ```
2020-11-13 21:49:12 +09:00
Yukihiro "Matz" Matsumoto ddfac9aba0 Search gem from MRUBY_ROOT if build config is in build_config. 2020-11-02 15:14:36 +09:00
Yukihiro "Matz" Matsumoto 6cc29ed377 Fix the condition to detect core mrbgems. 2020-10-30 07:15:11 +09:00
Yukihiro "Matz" Matsumoto a5d05ea8b7 Use mrb dump format for non core mrbgems by default.
If you confirm the gem is cdump safe, add `spec.enable_cdump` in
`mrbgem.rake` file. Some external gems e.g. `mruby-mgem-template` do
not work with cdump.
2020-10-29 22:52:29 +09:00
Yukihiro "Matz" Matsumoto 86981dafb1 Use clear if instead of unless for condition. 2020-10-29 22:52:29 +09:00
Yukihiro "Matz" Matsumoto 5dff2194a2 Use instance variable @dir instead of access method dir. 2020-10-29 22:52:29 +09:00
Yukihiro "Matz" Matsumoto 78f7162508 Remove mrblib_dir and objs_dir configuration from gems.
Always use `mrblib` and 'src` for directory names.
2020-10-29 22:52:28 +09:00
Yukihiro "Matz" Matsumoto 24ffa4386a The path of the gem should be relative from MRUBY_ROOT.
It was relative from the directory of the build configuration file, but
the document says it's relative from `MRUBY_ROOT`. When the default
configuration file was `MRUBY_ROOT/build_config.rb`, it was OK for most
of the cases.
2020-10-29 11:49:05 +09:00
Yukihiro "Matz" Matsumoto 33742d941f Move build_config.rb -> build_config/default.rb; ref #5098
In addition, update the documents referring `build_config.rb` which is
no longer used. The new `build_config.rb` describes the new configuration
structure in the comment.
2020-10-29 11:49:05 +09:00
Yukihiro "Matz" Matsumoto 41d5df03ed Use Dir.glob instead of map. 2020-10-29 10:43:09 +09:00
KOBAYASHI Shuji 81c2108819 Revert MRUBY_TARGET mechanism; ref #5096
* In explanation of mruby, the expression `build_config.rb` is frequently
  used including official documents, so I think that it will not make sense
  if the file is no longer used.
* The `MRUBY_TARGET` mechanism seems to have little improvement, so I don't
  think it should be changed to avoid unnecessary confusion.
* `MRUBY_TARGET` and `MRuby.targets` represent somewhat different things,
  so using the same term "target" is a bit confusing.

The mechanism that can be written short when using a file under
`build_config` (renamed from `target`) directory remains
(`build_config/${MRUBY_CONFIG}.rb` is used if the path specified
in `MRUBY_CONFIG` doesn't exist).
2020-10-19 15:03:22 +09:00
Yukihiro "Matz" Matsumoto 5b40bb8d15 Avoid using C struct dump for test Ruby code.
Files under `test/t` and `mrbgem/*/test` are for tests, not for actual
execution. So symbols in those files need not to be pre-allocated. This
change slightly reduce the memory consumption.
2020-10-14 15:52:14 +09:00
Rory OConnell 5592c7413a Remove compiler feature detection 2020-10-12 18:20:14 +09:00
Rory OConnell 2b05cf48d0 Work around removing tmp dir 2020-10-12 18:20:13 +09:00
Rory OConnell cfe8b0c81d Add methods for asking about compiler features 2020-10-12 18:20:12 +09:00
Yukihiro "Matz" Matsumoto 2bb84f1f1a Update build process for both host and cross compile. 2020-10-12 16:21:52 +09:00
Yukihiro "Matz" Matsumoto b7fe929232 Update Rakefile.
So that you can omit `host` target. Now `host-debug` works.
2020-10-12 16:21:51 +09:00
Yukihiro "Matz" Matsumoto c45674aff0 Rename mruby_version in the lockfile to mruby; close #4658 2020-10-12 16:21:44 +09:00
Yukihiro "Matz" Matsumoto 1520c97e17 Add default host target for cross compiling.
You don't have to define explicit `host` build target any more.
2020-10-12 16:21:40 +09:00
Yukihiro "Matz" Matsumoto 84a68ca5ae Make sure bintest only works with host target. 2020-10-12 16:21:26 +09:00
Yukihiro "Matz" Matsumoto 52507b1083 Generate C struct from irep instead of binary dump. 2020-10-12 16:21:10 +09:00
KOBAYASHI Shuji 1122124f97 Revert part of "Start GitHub Actions" (4ce3997c)
Because some changes have been overridden.
2020-10-12 16:21:01 +09:00
Takeshi Watanabe 9712379e0f Start GitHub Actions; close #4903 2020-10-12 16:21:00 +09:00
Yukihiro "Matz" Matsumoto fdbfeaf533 Build process updated:
You have to specify `TARGET` to specify a configuration, e.g.

```
rake TARGET=host-debug all test
```

When you port `mruby` to a new configuration:
1. copy an existing configuration under `target` directory
2. modify the new configuration file
3. build using the new configuration
4. send PR if you please
2020-10-12 16:20:47 +09:00
Yukihiro "Matz" Matsumoto e440681a06 Merge pull request #5081 from wataash/d-format-comment
*.d format is version-independent
2020-09-17 21:05:42 +09:00
Wataru Ashihara ea3b02e387 *.d format is version-independent
As pointed out by @shuujii on https://github.com/mruby/mruby/pull/5079 ,
multi-path in single-line could be appear even with older-gcc or clang.
2020-09-17 21:04:45 +09:00
Wataru Ashihara 069d9bb4d7 Fix skipping reading file 2020-09-17 20:30:17 +09:00
Wataru Ashihara e8723a4f3f Fix *.d parsing with gcc 9.3.0
Before this commit:

  $ rake
  ...
  $ rm build/host/src/gc.o
  $ rake
  rake aborted!
  Don't know how to build task '/home/foo/mruby/build/host/src/gc.o' (See the list of available tasks with `rake --tasks`)
  ...

After this commit:

  $ rake
  ...
  $ rm build/host/src/gc.o
  $ rake
  CC    src/gc.c -> build/host/src/gc.o
  ...

With gcc 9.3.0 on Ubuntu 20.04, build/host/src/array.d looks like:

  /build/host/src/array.o: /src/array.c \
   /include/mruby.h /include/mrbconf.h \
   /include/mruby/common.h \
   ...
   /include/mruby/range.h \
   /src/value_array.h

and it has been parsed to:

  [
                                           # /src/array.c missing
    "/include/mruby.h /include/mrbconf.h", # incorrectly parsed
    "/include/mruby/common.h",
    ...
    "/src/value_array.h",
  ]

After this change, *.d will be parsed correctly.

  [
    "/src/array.c",
    "/include/mruby.h",
    "/include/mrbconf.h",
    "/include/mruby/common.h",
    ...
    "/src/value_array.h",
  ]
2020-09-17 20:02:55 +09:00
Yukihiro "Matz" Matsumoto c27e451931 Merge pull request #4933 from dearblue/variables
Fix take over file scope variables with `mruby` and `mirb` command
2020-09-10 18:12:38 +09:00
Yukihiro "Matz" Matsumoto f0bad600e0 Remove endian configuration methods.
Since we made our opcode byte based, we need no endian option (`-e`
and `-E`) to `mrbc`.
2020-06-11 16:18:50 +09:00
KOBAYASHI Shuji 53ea8abea6 Revert part of "Start GitHub Actions" (4ce3997c)
Because some changes have been overridden.
2020-05-26 11:48:42 +09:00
Takeshi Watanabe 4ce3997ca4 Start GitHub Actions; close #4903 2020-05-24 22:34:28 +09:00
dearblue 9c1220e14d Sorting the list of gems at build time by name
Printing them in sorted order makes it easier to find the desired gem.
But it has come to completely ignore the dependency.
2020-04-29 16:55:18 +09:00
mimaki a8ab74a6dc Merged cygwin_filename() into filename() because Cygwin pathnames are in UNIX format. 2020-04-08 13:27:14 +09:00
Yukihiro "Matz" Matsumoto 7ab5353f80 Merge pull request #4960 from Reckordp/BuildAndroid
Validate windows by Dir testing
2020-04-05 14:17:09 +09:00
Yukihiro "Matz" Matsumoto 3cef380b20 Revert part of #4959
To prevent infinite loop on errors; reported by @shuujii
2020-04-04 11:50:59 +09:00
Reckordp 707933aa8e Helper for link window's library 2020-04-03 20:34:00 +07:00
Dominic Sisneros e3875ae8c5 build when directories and files have spaces
Modified the build to quote filenames so that it builds when files have spaces
2020-04-01 11:55:35 -06:00
dearblue 9840e5352b Isolate top-level local variables by file scope; fix #4931 2020-01-29 23:30:13 +09:00
KOBAYASHI Shuji bb98fd78c3 Use Rake.verbose instead of $verbose and $pp_show in build scripts
The incompatibility that the commands of `FileUtils` origin output verbose
by default due to the changes in d8a5163b and 26e6e75b is also fixed.
2019-12-28 17:03:37 +09:00
KOBAYASHI Shuji 26e6e75ba6 Use Rake DSL instead of commands of FileUtils
- Respect `--verbose(-v)` and `--dry-run(-n)` options.
- Silence warnings to keyword arguments on Ruby 2.7.
2019-12-27 16:49:32 +09:00
kishima b63f1912df add double quotes for cygwin filenames #4904 2019-12-23 23:36:59 +09:00
dearblue f08d9b288d Use git checkout instead of git reset
With this change, if the checkout fails, it will stop with an error.

The purpose is to avoid deleting working branch history when
developing gem.
2019-12-22 15:09:29 +09:00
dearblue dc15c2838f Display directory with git command 2019-12-22 14:26:00 +09:00
dearblue acef52c35e Perform shellquote on referenced string 2019-12-21 17:25:22 +09:00
KOBAYASHI Shuji b5946822af Defer getting caller_dir until needed in MRuby::LoadGems#gem 2019-11-10 19:40:07 +09:00
mimaki f68212cc7a Fix file/directory name parameter for git command. 2019-10-29 20:56:12 +09:00
take-cheeze 4877dbf2a9 Print mrbc command on verbose mode 2019-10-19 01:42:34 +09:00