Project

General

Profile

Actions

Feature #16517

open

mkmf.rb - changes for Windows ?

Added by MSP-Greg (Greg L) almost 5 years ago. Updated about 2 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:96938]

Description

I propose two changes to mkmf.rb to make it more Windows friendly.

  1. mingw - devkit has been the standard for 'enabling' compile tools in publicly available MinGW builds for quite a while. Could something like the following be added? Not sure whether to rescue on LoadError or not, or whether to output anything if it doesn't load.
if $mingw
  begin
    require 'devkit'
  rescue
  end
end
  1. mswin - most compile tools other than msvc will find libraries without a lib prefix. Note the following code in extconf.rb for OpenSSL:
ret = have_library("crypto", "CRYPTO_malloc") &&
  have_library("ssl", "SSL_new")
return ret if ret

if $mswin
  # OpenSSL >= 1.1.0: libcrypto.lib and libssl.lib.
  if have_library("libcrypto", "CRYPTO_malloc") &&
      have_library("libssl", "SSL_new")
    return true
  end

If something like the following was added, the above wouldn't be needed:

if $mswin
  alias_method :orig_find_library, :find_library
  
  def find_library(lib, func, *paths, &b)
    orig_find_library(lib, func, *paths, b) || orig_find_library("lib#{lib}", func, *paths, b)
  end

  alias_method :orig_have_library, :have_library

  def have_library(lib, func = nil, headers = nil, opt = "", &b)
    orig_have_library(lib, func, headers, opt, b) || orig_have_library("lib#{lib}", func, headers, opt, b)
  end
end

Adding something similar to above two items would remove the need for Windows specific build code in many extension gems.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0