38 Commits

Author SHA1 Message Date
dearblue db1578c123 Separating the build setup portion from the GEMS setup block
The issue resolved by the preceding patch was solely the C++ exception task within the mruby core.
This patch aims to resolve a similar sequencing issue that also exists in GEMS.

In practice, `mruby-compiler` is sometimes loaded via dependencies rather than being explicitly specified in the build configuration file.
In such cases, when `mruby-compiler/mrbgem.rake` is loaded, it is not yet determined whether C++ exceptions will be used. Consequently, even if it later becomes clear that `core/codegen-cxx.cxx` and `core/y.tab-cxx.cxx` are required, the system could not handle this.

To resolve this issue, we introduce the `MRuby::Gem::Specification#build_settings` method as a mechanism for lazily evaluating build setup.
However, for backward compatibility, the commands are cloned twice in `gem.setup` and `gem.setup_build`.
This is because many existing GEMS configure commands directly within the setup block.

ref. https://github.com/mruby/mruby/issues/6615
2025-09-11 22:53:06 +09:00
dearblue 004fe0b142 Set up all GEMS before mruby core tasks definition
Until now, GEMs dependent on GEMs described in the build configuration file were loaded and set up after mruby core tasks were defined.
This caused an issue where, if C++ exceptions were enabled later by a dependent GEM, the necessary tasks for mruby core were not defined.

fixed https://github.com/mruby/mruby/issues/6615
2025-09-11 22:53:03 +09:00
Ryan Davis 59f08ff148 Fix build strings that must be mutable. Tested with RUBYOPT=--enable-frozen-string-literal make 2025-06-03 18:18:29 -07:00
dearblue 73b2e0bf76 Shrink <BUILD-DIR>/mrbgems/gem_init.c if possible
If none of the GEMs have `mrblib/` or `src/` directories, generate `mrb_init_mrbgems()` which does nothing, and omit `mrb_final_mrbgems()`.

The impetus was to avoid `gem_funcs[]` becoming a zero-length array, which is not allowed by the C standard.
The problem is caused by #5938.
2023-04-02 20:28:14 +09:00
dearblue 1432baec1d Perform chores with mrb_final_mrbgems() function
The main purpose is to ignore exceptions raised by the GEMS finalizer.
2023-03-12 14:31:10 +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
dearblue 396ca2809f Add the generator path to the build/***/gem_init.c file 2023-02-28 22:11:14 +09:00
John Bampton b5af16b93a Add generate_active_gems_txt to rake --tasks 2022-12-26 17:16:50 +10:00
John Bampton 9d32d440eb feat(CI): add the GitHub Super Linter
The GitHub Super Linter is a more robust and better supported
tool than the current GitHub Actions we are using.

Running these checks:

ERROR_ON_MISSING_EXEC_BIT: true
VALIDATE_BASH: true
VALIDATE_BASH_EXEC: true
VALIDATE_EDITORCONFIG: true
VALIDATE_MARKDOWN: true
VALIDATE_SHELL_SHFMT: true
VALIDATE_YAML: true

https://github.com/marketplace/actions/super-linter
https://github.com/github/super-linter

Added the GitHub Super Linter badge to the README.

Also updated the pre-commit framework and added
more documentation on pre-commit.

Added one more pre-commit check: check-executables-have-shebangs

Added one extra check for merge conflicts to our
GitHub Actions.

EditorConfig and Markdown linting.

Minor grammar and spelling fixes.

Update linter.yml
2021-04-16 16:37:52 +09:00
Yukihiro "Matz" Matsumoto 384865997d build: provide global defines by build.defines. 2021-03-22 10:58:47 +09:00
John Bampton 15f7b0182d chore: fix spelling 2021-03-07 04:58:15 +10:00
KOBAYASHI Shuji 3a8d7bdf82 Delay test code build until rake test
With this change, the test code will not be built unless `rake test` is
run, so there will be almost no side effects even if `enable_test` is
always set (but, gems specified by `add_test_dependency` are included
in `libmruby.a`).

Also added are `test: build` task, which only builds the test code
(including the main code), and `test: run` task, which only runs tests
independent of build. Therefore, the idiom for building in parallel and
not running tests in parallel is `rake -m test:build && rake test:run`.
2021-01-08 20:36:54 +09:00
KOBAYASHI Shuji 49896a4d28 Fix ${build_dir}/mrbgems/gem_init.c generation condition; ref #5010
The `${build_dir}/mrbgems/gem_init.c` generation condition has been changed
at #5010, but it is somewhat insufficient, for example, there was a problem
with `rake && rake test`, which was also regenerated in `rake test`.
2020-07-14 19:55:23 +09:00
Kondo Uchio 690b2aa761 Detect newly added mrbgems when re-creating gem_init.c 2020-05-26 23:15:00 +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
take-cheeze b37b312081 Rename libmruby stuff to avoid confusion 2018-10-29 14:07:16 +09:00
dearblue cbf2738861 Reverse gems final 2018-09-02 14:13:09 +09:00
take-cheeze e050cfb349 Add forgotten mkdir_ps. 2018-06-20 18:20:26 +09:00
Yukihiro "Matz" Matsumoto c3710dbb96 Fix a compile error on zero mrbgem case. 2017-10-16 18:46:15 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
cremno 6526bb10f0 don't always generate gem functions
If the src and mrblib directories of a mrbgem don't exist or don't
include "usable" files (for tools like mirb), then functions for gem
initialization and finalization don't have to be generated.
2014-08-04 05:50:05 +02:00
Yukihiro "Matz" Matsumoto fe95f44013 rename mrb_atexit to mrb_state_atexit to clarify a func will be called at the end of state, not process; ref #2211 2014-06-10 17:59:56 +09:00
Yukihiro "Matz" Matsumoto d3fda42eb6 Merge pull request #2359 from take-cheeze/src_gen_dep
Add generator script to dependency so that it will regenerate C codes when it's modified.
2014-06-06 16:38:11 +09:00
take_cheeze fb3c2f6b08 Add generator script to dependency so that it will regenerate C codes when it's modified. 2014-06-04 22:53:36 +09:00
take_cheeze 64300b2c43 Add API mrb_atexit().
`mrb_final_mrbgems` will be called as mrb_state atexit function.
Maybe useful in #1844.
2014-05-08 22:19:14 +09:00
take_cheeze 63bf375b0e Implement default gem info to use when there is no depending gem is defined. 2014-04-23 15:09:01 +09:00
Tomoyuki Sahara e8df8dcae6 display multiple authors better.
Before:
Copyright (c) 2013 ["a", "b"]

After:
Copyright (c) 2013 a, b
2013-07-23 09:53:39 +09:00
Nihad Abbasov 9dd539bb15 remove unused variables 2013-05-09 17:05:59 +05:00
Daniel Bovensiepen a5a7c47e91 Implement GEM dependency check 2013-05-09 01:47:24 +08:00
kurodash 15871eb841 Modified build dependency to exclude 'LEGAL' from libmruby archive. 2013-03-30 15:05:48 +09:00
Daniel Bovensiepen 83961c8f71 LEGAL file generator for binaries 2013-03-28 06:24:07 +00:00
Yuichiro MASUI ab8a5aa572 Change default gem path. 2013-03-10 14:51:59 +09:00
Yuichiro MASUI 0970ca9572 Support to build on pwd != mruby source root 2013-02-23 19:03:59 +09:00
Yuichiro MASUI 5a152c82e6 load MRUBY_CONFIG script after 'build_config.rb' 2013-01-28 18:22:11 +09:00
Yuichiro MASUI 310b0dce8f Added finalizer of mrbgems 2013-01-22 20:18:48 +09:00
Yuichiro MASUI ced80d2b4b Improved build scripts and config files 2013-01-20 22:48:42 +09:00
mattn d8dcee584e build gems if build_config.rb is modified. 2013-01-11 21:01:04 +09:00
Yuichiro MASUI 7c469c0b9d Rebuild CRuby based building script without Makefile
Tested CRuby 1.8.6 and 1.9.3

You can see building configuration in build_config.rb
2013-01-03 02:24:15 +09:00