aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mkmf.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix `dir_config` cache for -include and -lib optionsNobuyoshi Nakada2023-10-121-2/+6
| | | | Set to "--with-" options, not "--without-" keys.
* Include default values in `dir_config` cache keysNobuyoshi Nakada2023-10-121-2/+3
| | | | | | | | The extconf.rb in mysql2 gem repeats `dir_config('mysql')`, without and with the default path. The third call returns the former results even with the default path. Since it does not check the results of the third call, that `nil` is passed to `find_library` as a path, and fails with `NoMethodError`.
* Allow nmake to ignore errorsNobuyoshi Nakada2023-07-101-1/+1
| | | | | cmd.exe can redirect file descriptor other than STDOUT, while command.com couldn't.
* Use `File::NULL` instead of hard coded null device namesNobuyoshi Nakada2023-07-101-1/+1
|
* mkmf: Add the extra option `--with-verbose` to enable verbose mode. (#7863)Jun Aruga2023-05-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is to add an extra option to enable verbose mode (V=1) in the generated `Makefile` at runtime of the Ruby to print compiler command lines by the commands below when building native extensions. It's possible to enable the verbose mode by setting the environment variable `MAKEFLAGS="V=1"`[1] implemented in GNU make. However, I wanted to make a consistent user-interface not depending on the specific make's implementation. ``` $ ruby /path/to/extconf.rb -- --with-verbose ``` You can also add the extra option via rake-compiler gem. ``` $ rake compiler -- --with-verbose ``` If the extra option is not given, the value of the `RbConfig::CONFIG["MKMF_VERBOSE"]` enabled by the configure option below is used. ``` $ ./configure --enable-mkmf-verbose ``` For the unit tests, updated the following files. * The `test/mkmf/test_configuration.rb` was created to test the cases with the `configuration` method and this implementation. * Updated the `TestMkmf#assert_separately` to set the extra arguments in `test/mkmf/base.rb`. Updated tests using the `assert_separately`. * Added tests for `MakeMakefile#with_config` in the `test/mkmf/test_config.rb`. [1] https://www.gnu.org/software/make/manual/html_node/Variables_002fRecursion.html Fixes [Bug #19695] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
* mkmf.rb: Refine message from `pkg_config`Nobuyoshi Nakada2023-01-091-53/+60
|
* mkmf.rb: Prefer `caller_locations` over parsing `caller`Nobuyoshi Nakada2023-01-091-1/+5
|
* mkmf.rb: Refactor splitting configure_args and remove duplicate codeNobuyoshi Nakada2023-01-061-16/+6
|
* [Bug #19189] Fallback to the default "pkg-config"Nobuyoshi Nakada2022-12-151-1/+1
|
* Clean compiler intermediate files moreNobuyoshi Nakada2022-12-051-1/+8
|
* Use class methods of `File` over `Kernel.open` and `IO.read`Nobuyoshi Nakada2022-11-211-1/+1
|
* Set timestamp path for the target path to TARGET_SO_DIR_TIMESTAMPNobuyoshi Nakada2022-10-241-3/+6
|
* Fallback PKG_CONFIG to the configured pkg-config alwaysNobuyoshi Nakada2022-10-021-1/+1
|
* [Bug #19005] dynamic_lookup linker option in external librariesNobuyoshi Nakada2022-09-171-0/+1
| | | | | | The warning against `-undefined dynamic_lookup` is just a warning yet, and many gems seem to pay no attention to warnings. Until it fails actually, keep it as a migration path, except for standard extension libraries and bundled extension gems.
* Use $(bindir) for path to executable in mkmfAlan Wu2022-08-041-1/+5
| | | | | | | | | | | | | | | | For the macOS -bundle_loader linker option, we need a path to the Ruby exectuable. $(RUBY) is not necessarily a path since it could be a command line invocation. That happens during build with runruby.rb and can happen post installation if the user passes the --ruby option to a extconf.rb. Use $(bindir) to locate the executable instead. Before installation, $(bindir) doesn't exist, so we need to be able to override $(BUILTRUBY) in such situations so test-spec and bundled extensions could build. Use a new mkmf global, $builtruby, to do this; set it in fake.rb and in extmk.rb. Our build system is quite complex...
* Link ext bundles with bundle loader option for newer ld64Yuta Saito2022-08-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ld64 shipped with Xcode 14 emits a warning when using `-undefined dynamic_lookup`. ``` ld: warning: -undefined dynamic_lookup may not work with chained fixups ``` Actually, `-undefined dynamic_lookup` doesn't work when: 1. Link a *shared library* with the option 2. Link it with a program that uses the chained-fixup introduced from macOS 12 and iOS 15 because `-undefined dynamic_lookup` uses lazy-bindings and they won't be bound while dyld fixes-up by traversing chained-fixup info. However, we build exts as *bundles* and they are loaded only through `dlopen`, so it's safe to use `-undefined dynamic_lookup` in theory. So the warning produced by ld64 is false-positive, and it results failure of option checking in configuration. Therefore, it would be an option to ignore the warning during our configuration. On the other hand, `-undefined dynamic_lookup` is already deprecated on all darwin platforms except for macOS, so it's good time to get rid of the option. ld64 also provides `-bundle_loader <executable>` option, which allows to resolve symbols defined in the executable symtab while linking. It behaves almost the same with `-undefined dynamic_lookup`, but it makes the following changes: 1. Require that unresolved symbols among input objects must be defined in the executable. 2. Lazy symbol binding will lookup only the symtab of the bundle loader executable. (`-undefined dynamic_lookup` lookups all symtab as flat namespace) This patch adds `-bundle_loader $(RUBY)` when non-EXTSTATIC configuration by assuming ruby executable can be linked before building exts. See "New Features" subsection under "Linking" section for chained fixup https://developer.apple.com/documentation/xcode-release-notes/xcode-13-release-notes
* mkmf: Add a configure option to set verbose mode (V=1 or 0) in mkmf.rb.Jun Aruga2022-05-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note this change is only for `configure.ac`, not for Windows using `win32/configure.bat`. ``` $ ./configure --help | grep mkmf --enable-mkmf-verbose enable verbose in mkmf ``` Run the following command to enable the mkmf verbose mode. ``` $ ./configure --enable-mkmf-verbose $ grep MKMF_VERBOSE config.status S["MKMF_VERBOSE"]="1" ``` In this mkmf verbose mode, when compiling a native extension, the `rake compile` prints the compiling commands such as "gcc -I. <...> path/to/file" instead of "compiling path/to/file". ``` $ git clone https://github.com/deivid-rodriguez/byebug.git $ cd byebug $ bundle install --standalone $ bundle exec rake compile ... gcc -I. <...> path/to/file ... ```
* Use compiled instead of compliedKaíque Kandy Koga2022-04-261-2/+2
| | | | Capitalize creates
* Remove unnecessary sortKazuhiro NISHIYAMA2022-04-231-2/+2
| | | | Because `Dir.[]` returns the sorted results since Ruby 3.0.
* Document MakeMakefile#append_cflagsAlan Wu2022-04-051-10/+15
| | | | | | This method is at least 7 years old and is widely used in the wild. Since we need to support it, let's document it to make it discoverable. Add docs and move it out of the `# :stopdoc:` zone.
* [DOC] make internally used classes/methods nodocNobuyoshi Nakada2022-03-201-12/+6
| | | | Empty class documents are generated even with `:stopdoc:`.
* Make implicit function declaration error [Feature #18615]Nobuyoshi Nakada2022-03-171-1/+1
| | | | | Enable `-Werror=implicit-function-declaration` by default for building C extensions for early failures.
* mkmf: unify duplicate code in pkg_configNobuyoshi Nakada2022-01-291-8/+3
|
* mkmf: pkg_config accepts multiple optionsMike Dalessio2022-01-291-23/+25
|
* Prefer flat_mapNobuyoshi Nakada2021-12-101-2/+2
|
* mkmf: take `PKG_CONFIG_PATH` from `dir_config` library pathNobuyoshi Nakada2021-11-261-3/+11
| | | | | So that version dependent pkg-config files can override files in the default locations.
* mkmf: deal with environment variables in MakeMakefile#xpopenNobuyoshi Nakada2021-11-261-9/+35
|
* mkmf: MakeMakefile#xpopen may be passed an option hashNobuyoshi Nakada2021-11-261-1/+1
|
* Make explicit opening filesNobuyoshi Nakada2021-10-151-3/+3
|
* Revert "mkmf.rb: try linking at try_var" [Bug #18235]Nobuyoshi Nakada2021-10-031-9/+1
| | | | | | This reverts commit 524513be399e81bb170ec88aa0d501f33cbde8c3, which can return false positive by existing but unusable symbol, including functions.
* Get rid of incompatible-pointer-types-discards-qualifiers warningNobuyoshi Nakada2021-09-021-2/+11
|
* mkmf.rb: try linking at try_varNobuyoshi Nakada2021-07-081-1/+9
| | | | To check for variables accessible but not declared.
* Library arguments to VC are bare file namesNobuyoshi Nakada2021-07-031-1/+2
|
* Use $ignore_error defined in mkmf.rbNobuyoshi Nakada2021-07-031-1/+1
|
* Remove also debug symbol directory at clean on macOSNobuyoshi Nakada2021-06-241-1/+1
|
* Prefer configured command as RM_RFNobuyoshi Nakada2021-06-241-1/+1
|
* mkmf.rb: convert also arch_hdrdir [Bug #16651]Nobuyoshi Nakada2021-04-111-1/+1
|
* mkmf: fixed install directories of header files in extension libraries [Bug ↵Nobuyoshi Nakada2021-03-301-4/+4
| | | | | | | | | #17761] When installing an extension library which provides a header, that header should be installed under site_ruby (or vendor_ruby when "--vendor" option was given to extconf.rb). However, currently this file is about to be installed in the core include directory.
* MSys is a variant of CygwinNobuyoshi Nakada2021-02-201-1/+1
|
* Replace "iff" with "if and only if"Gannon McGibbon2021-01-191-1/+1
| | | | | | | iff means if and only if, but readers without that knowledge might assume this to be a spelling mistake. To me, this seems like exclusionary language that is unnecessary. Simply using "if and only if" instead should suffice.
* mkmf.rb: remove exts.mk at distcleanNobuyoshi Nakada2021-01-141-1/+1
|
* mkmf.rb: always try_compile as try_headerNobuyoshi Nakada2021-01-021-1/+1
| | | | | Get rid of "present but cannot be compiled" headers, on some multi-architecture platforms.
* transcode-tblgen.rb: make silent a little when just -vNobuyoshi Nakada2020-12-291-0/+1
|
* Separate `send` into `public_send` and `__send__`Nobuyoshi Nakada2020-10-271-2/+2
|
* Make the mkmf methods private in the global [Bug #16896]Nobuyoshi Nakada2020-07-131-1/+6
|
* Added tooldir variableNobuyoshi Nakada2020-04-051-1/+1
|
* Specify explicit separator not to be affected by $;Nobuyoshi Nakada2020-03-081-1/+1
|
* Added link_command for C++Nobuyoshi Nakada2019-09-191-0/+10
|
* Separate @have_devel for C++Nobuyoshi Nakada2019-09-191-0/+8
|
* Look up the language moduleNobuyoshi Nakada2019-09-191-1/+11
| | | | | | Look up language module with `MakeMakefile.[]`, insted of a accessing constant under that module directly, to get rid of expose the constant to the toplevel inadvertently.