Commit Graph

202 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 7538ee8f5d gperf: remove obsolete command line options -p and -g 2025-03-28 06:16:00 +09:00
Yukihiro "Matz" Matsumoto d13e6ff8c9 include/presym.h: MRB_GVSYM() for global variables is now available 2024-12-14 16:03:35 +09:00
dearblue c7ca1038d2 Remove unused MRuby::Build#list_install_excludes method
This method was added by commit 0ac755dbc8 (#6407).
It was added during the initial conception, but was ultimately no longer needed.
2024-11-26 22:05:47 +09:00
dearblue 0ac755dbc8 Allow to exclude specific files in rake install
Introduce the `MRuby::Build#install_excludes` attribute.
This attribute is an array to which you add strings, regular expressions, and proc objects that will serve as filters to exclude.

This feature was inspired by @hoshiumiarata's comment.
https://github.com/mruby/mruby/issues/6352#issuecomment-2426721517
2024-11-04 20:44:13 +09:00
dearblue 79f4a67268 Avoid warnings in lib/**/*.rb
```console
% find -s lib -type f -name '*.rb' -exec ruby -cw {} \;
lib/mruby/build/command.rb:320: warning: `+' after local variable or literal is interpreted as binary operator
lib/mruby/build/command.rb:320: warning: even though it seems like unary operator
Syntax OK
Syntax OK
Syntax OK
Syntax OK
Syntax OK
lib/mruby/gem.rb:469: warning: `&' interpreted as argument prefix
Syntax OK
Syntax OK
Syntax OK
Syntax OK
```
2024-08-12 21:06:31 +09:00
dearblue f4f3a061be Changed the instruction table in opcode.md
- Added the index number corresponding to the instruction code.
  - Omitted trailing `|` from table elements.
    The table elements in GitHub Flavored Markdown can't wrap wherever wanted.
    And trying to align the end of it tends to make the whole thing longer.
2024-06-22 23:21:43 +09:00
John Bampton 88e2eb0188 Fix spelling 2024-06-21 08:14:17 +10:00
Yukihiro "Matz" Matsumoto fbe21a0321 tools/lrama: bundle Lrama 0.6.9 (copied from CRuby source) 2024-06-10 14:26:26 +09:00
dearblue 0fcf54b47d Allow to change the output directory name of the libmruby file
Add the `MRuby::Build#libdir_name` accessor and the `MRUBY_SYSTEM_LIBDIR_NAME` environment variable.

Resolved #6240
2024-06-09 22:49:46 +09:00
dearblue 464ac4581e Make MRuby::Gems::List#{each,<<} method return self
Returning internal objects is undesirable.
2024-01-20 22:49:31 +09:00
dearblue 8284234229 Get from local only if there is no default branch name
The branch name of the cloned repository should be determined by the build configuration file.

fixes #6087
2023-10-28 19:02:50 +09:00
dearblue 9b0d516310 Fixed MRuby::Build#define_installer
Symbolic links were created with absolute paths, but to cope with path fluctuations between build and reference, they are now relative paths.

ref. #6084
2023-10-21 19:42:26 +09:00
dearblue 25f360803c Fixes escape sequence bug and enhancements in Presym scanning
In #6011, a hexadecimal escape sequence followed by a hexadecimal character would cause a compile error.
Also, avoid using "Numbered Parameter" which older Ruby does not have (e.g. AppVeyor).

ref. #6044
2023-09-08 22:57:24 +09:00
Yukihiro "Matz" Matsumoto 455a5689f3 lib/mruby/build/command.rb: skip mrbgems in parent directory; fix #6029
If `mrbgems` is included in the parent directory path (MRUBY_ROOT), it
confuses gem path and build path.
2023-07-17 13:24:47 +09:00
dearblue a7bee69452 Fixed visibility of MRuby::Command::Compiler#setup_debug
In #5977 it was incorrectly set to `private`.
2023-05-26 21:37:29 +09:00
Colin MacKenzie IV 1a0c31130c Allow tests to be disabled for specific gems; warn about disabled tests 2023-05-15 12:43:37 -04:00
dearblue 03a42b52ee Encode and decode escape characters for presym
The purpose is to deal with `$"`, which has been treated as three characters including the escape character.
2023-05-14 17:54:13 +09:00
Yukihiro "Matz" Matsumoto 3d5cc1ab8f Merge pull request #6007 from dearblue/define_installer
Correct the `MRuby::Build#define_installer`
2023-05-10 23:54:27 +09:00
Yukihiro "Matz" Matsumoto d3f030f02a Merge pull request #5999 from alpha-netzilla/fix_poppen_mode
lib/mruby/build/command.rb: narrow down poppen mode
2023-05-08 17:00:28 +09:00
Yukihiro "Matz" Matsumoto 599982454e Merge pull request #6008 from dearblue/bintest-dirfree 2023-05-07 19:10:59 +09:00
dearblue 5a4c319dd8 Avoid adding <MRUBY_ROOT>/bintest which does not exist
The `<MRUBY_ROOT>/bintest` directory does not exist in current mruby.
2023-05-06 22:08:48 +09:00
dearblue eb4c7d0edf Make "bintest" independent of directory
Previously, "bintest" would fail to run unless `MRUBY_ROOT` and `Dir.pwd` were the same.
2023-05-06 22:00:57 +09:00
dearblue 44f9fa1b61 Correct the MRuby::Build#define_installer
This is a complement to #5928.
The previous PR had the following problem:

  - The `<INSTALL_DIR>/bin/*` file could not be replaced if the destination of the symbolic link was lost.
  - The wrong link destination was written if `MRuby::Build.install_dir` was a relative path.
2023-05-06 21:54:49 +09:00
alpha.netzilla 3409c1f309 lib/mruby/build/command.rb: narrow down poppen mode 2023-05-05 19:23:18 +09:00
Yukihiro "Matz" Matsumoto 5956496267 lib/mruby/build/command.rb: remove unnecessary block parameter; fix #5995 2023-05-03 12:41:52 +09:00
dearblue 0f2c1caa96 Make MRuby::Build#enable_debug compiler flag setting abstract
Previously, compiler flags were only added for GCC or similar.
The situation has not changed, but it has become easier to improve.

I expect `MRuby::Command::Compiler#setup_debug` to be defined as a singleton method inside the block given to `MRuby::Toolchain.new`.
2023-04-09 11:21:50 +09:00
Yukihiro "Matz" Matsumoto a8d840da19 Merge pull request #5928 from dearblue/task/install
Improved `rake install`
2023-03-13 08:05:20 +09:00
dearblue c474ae8cc4 Perform chores with mrb_init_mrbgems() function
Make the `mrb_init_mrbgems()` function do the cleanup and error handling.
Instead, simplify processing in the `GENERATED_TMP_mrb_XXX_gem_init()` function.

Previously, `mrb_load_irep()` or `mrb_load_proc()` would kill the process when an exception occurred.
With this patch, it is now caught by `mrb_core_init_protect()`.
2023-03-12 10:25:54 +09:00
Yukihiro "Matz" Matsumoto 629d81f57b Merge pull request #5937 from dearblue/note-gem-init
Add the generator path to the `build/***/gem_init.c` file
2023-03-12 08:01:38 +09:00
dearblue 38d5ed44e1 Avoid exposure for REnv objects
The `REnv` object is difficult to deal with, and it would be ideal if the user did not have to manipulate it directly.
In some previous situations, it was necessary to call `mrb_env_unshare()`, a non-API function, after `mrb_load_string()` or similar.

With this patch, it is no longer necessary for users to use `mrb_env_unshare()` directly, as it is now handled internally simply by using the `mrb_vm_ci_env_clear()` function.
Also, `mrb_vm_ci_env_set()` is demoted from the `MRB_API` function for the same reason.

ref. commit 1ab3da6f08
2023-03-05 17:45:47 +09:00
dearblue 396ca2809f Add the generator path to the build/***/gem_init.c file 2023-02-28 22:11:14 +09:00
Yukihiro "Matz" Matsumoto 1ab3da6f08 vm.c (ci_env_set): inline ci_env_set()
Along with making preparing mrb_vm_ci_env_clar() as a replacement of
mrb_vm_ci_env_set(mrb, NULL).
2023-02-23 17:16:10 +09:00
dearblue 7c7ed3c27a Write symbolik links or batch files in INSTALL_DIR
Since `bin/mruby-config` now points to a directory relative to itself, it is no longer possible to reach `include/` or `lib/`.
Therefore, avoid placing entities in them.
2023-02-12 23:25:05 +09:00
dearblue 3d996a84cc Takes the environment variable DESTDIR in rake install
If the environment variable `DESTDIR` is set, the writing destination is `<DESTDIR>/<PREFIX>/...`.
It is assumed to be used for package work.
2023-02-12 21:02:31 +09:00
dearblue 0e9a71e50a Install other build targets with rake install:full
Build targets other than "host" will be installed under `<PREFIX>/mruby/<build-name>`.
This can be changed with `build.install_prefix = dir`.
2023-02-12 21:02:30 +09:00
dearblue aac2fd7055 Copy header files to the build directory
This is so that the build directory can be regarded as a temporary installation directory to work in.

Directories set in `MRuby::Gem::Specification#export_include_paths` are used as they are if they are subdirectories placed under `gem.dir`.
Files are placed under `<build-dir>/include/mruby/gems/<gem-name>/<gem-include_paths>` to separate each GEM.

When GEM is compiled by building `libmruby.a`, the same `include_paths` will be set as before, so it is expected that no unintended references will be made.
2023-02-12 21:02:28 +09:00
dearblue c020d8507e Separate rake install related stuff into tasks/install.rake 2023-02-12 21:02:27 +09:00
Gwendolyn Boatrite 8b728e4056 Fix cloning gem when destination path contains spaces
This was how clone command was previously being generated, for example:

```
git clone  --recursive --branch "master" --depth 1 https://github.com/mattn/mruby-onig-regexp.git /path/to mruby with spaces/mruby-3.1.0/build/repos/wasm/mruby-onig-regexp
```

Now it's changed so the path is quoted and will work when containing
spaces:

```
git clone  --recursive --branch "master" --depth 1 https://github.com/mattn/mruby-onig-regexp.git "/path/to mruby with spaces/mruby-3.1.0/build/repos/wasm/mruby-onig-regexp"
```

Similar for the other commands.
2022-12-11 17:18:29 -06:00
dearblue 32d48a5f0e Escaping pipes in the code of table elements
ref. https://github.github.com/gfm/#example-200
2022-12-03 14:40:30 +09:00
dearblue 5e62990748 Add task rake doc:update-opcode.md
Allow to update `doc/internal/opcode.md` file mechanically from `include/mruby/ops.h` file.

At the same time, the `doc/internal/opcode.md` file has been updated.
Consecutive hyphens at the end of the table were removed as they would have created noise as markdown flavours.
2022-11-20 21:58:13 +09:00
John Bampton 2438195289 ruby: remove unneeded parenthesis from methods
commit eeb33da43035b5400f8d1830ea52a68691b3a678
Author: John Bampton <jbampton@gmail.com>
Date:   Mon Oct 31 23:53:43 2022 +1000

    Fix up

commit 80923c8f92a58b2f33a36d6403de7f6341973110
Merge: bc89500f6 416f012f6
Author: John Bampton <jbampton@users.noreply.github.com>
Date:   Mon Oct 31 20:12:59 2022 +1000

    Merge branch 'master' into ruby-remove-parenthesis

commit bc89500f6357c453b457516452ffcc7fd03fee88
Author: John Bampton <jbampton@gmail.com>
Date:   Mon Oct 31 14:39:20 2022 +1000

    ruby: remove unneeded parenthesis from methods
2022-11-01 00:25:09 +10:00
John Bampton ea8964ef35 ruby: standardize whitespace 2022-10-31 16:25:56 +10:00
John Bampton 7870409cf1 Remove unneeded trailing semi-colons from Ruby files 2022-10-26 23:48:27 +10:00
John Bampton 1626758ccc Replace gsub with tr
Using `tr` is faster than `gsub` when replacing a single character in a string with another single character
2022-10-26 18:17:17 +10:00
dearblue be3c0e5f4f Improve out-of-memory tolerance of mrb_env_unshare()
Exception raising can now be controlled by the caller.

The main purpose on this patch is:

- Suppress exceptions from `obj_free()` in `src/gc.c` with `mrb_env_unshare()`.

- Consider the possibility that calls to `mrb_malloc()` may cause `e` objects to be subject to GC.

  When control is returned to `mrb_env_unshare()`, `struct free_obj::next` in the same offset as `struct REnv::stack` is rewritten.
  Unexpected results then occur when the object is reused.
  Also, if `mrb_heap_page` containing an `e` object is freed, it may cause `SIGSEGV` at that point.

- Protects the value of the stack on `callinfo` that just exits if GC occurs inside `mrb_env_unshare()`.

  ```ruby
  def m
    b = -> { b }
  end

  p m.call
  # => print block object, not nil
  ```

  This patch does not raise a `NoMemoryError` exception in `mrb_env_unshare()` and can detect that error.
  Thus, the problem fixed in # 3087 is not resurrected.

Also, it may seem that this patch should suppress exceptions raised by `cipop()` during `mrb_protect_error()` and `mrb_vm_exec()` unwinds.
However, `mrb_callinfo::u.env` by `CINFO_DIRECT` is not seen to be set.
So in that case `mrb_env_unshare()` is assumed to be originally exception-free.
2022-07-30 22:32:00 +09:00
dearblue b012ebfa79 Ignore git checkout if nil commit-hash
If there is no `.lock` file and no commit hash specified, avoid `git checkout --detach`.
This behavior will be the same as up to mruby-3.1.

ref. #5638
2022-07-14 21:58:20 +09:00
Chris Reuter b297809b51 Fix conf.gem path: build_config argument.
The mrbgem guide (`doc/guides/mrbgems.md`) documents the `path:`
argument for `conf.gem` as being used to point to the root directory
of a gem when that gem is retrieved via git but is located in a
subdirectory of the checkout.

The actual code does not do this.  Instead, it treats path as (mostly)
identical to the `gemdir:` argument; that is, it points to a local
directory containing the gem.

This change fixes this by making `path:` behave as documented.
2022-05-18 14:02:47 -04:00
dearblue be782b7d36 Setting Command#build correctly in automatic "mrbc" build for presym
This was the cause of the command line flag being affected by changes in the parent build.
So, for example, if `mruby-rational` was included, even the automatically added `mrbc` builds included `MRB_USE_RATIONAL`.
2022-04-19 21:48:50 +09:00
dearblue 267dd15767 Allow build settings to define if benchmarks are covered or not
Each build target can be explicitly disabled from benchmarking with `MRuby::Build#disable_benchmark`.

Also, the build target "host", which was previously excluded, is now included in the benchmark.
2022-03-06 15:35:05 +09:00
Chris Reuter 73df87f7bd Added a dependency on 'yaml' to load_gems.rb.
It appears that some execution paths no longer load YAML before it is
needed so we explicitly `require` it here.
2022-02-23 14:23:57 -05:00