From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 5CCED1F466 for ; Mon, 20 Jan 2020 15:49:43 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id AACE1120924; Tue, 21 Jan 2020 00:49:21 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 11824120922 for ; Tue, 21 Jan 2020 00:49:19 +0900 (JST) Received: by filterdrecv-p3mdw1-56c97568b5-qqd9g with SMTP id filterdrecv-p3mdw1-56c97568b5-qqd9g-18-5E25CC06-23 2020-01-20 15:49:26.348831074 +0000 UTC m=+2991976.999382839 Received: from herokuapp.com (unknown [18.232.118.34]) by ismtpd0051p1mdw1.sendgrid.net (SG) with ESMTP id a2DtXSvBSma_OJ7rugincw for ; Mon, 20 Jan 2020 15:49:26.232 +0000 (UTC) Date: Mon, 20 Jan 2020 15:49:26 +0000 (UTC) From: Greg.mpls@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72617 X-Redmine-Project: ruby-master X-Redmine-Issue-Id: 16517 X-Redmine-Issue-Author: MSP-Greg X-Redmine-Sender: MSP-Greg X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?M4W5dkI32Qt1AHWPzmUKqncwpr1RYzW=2Fh5io+QGCFbrJIga3io117duVMKJSj6?= =?us-ascii?Q?G+NDKH9aiYWM1gKBHK1mhUclxSHrr6JZM2h=2FXcR?= =?us-ascii?Q?bDUFkD9WzHchBl5u4W+DGLFkEqyFlNMTovQrz5N?= =?us-ascii?Q?VaBJz7D2VdAXcVZDuGydcJ2x7pSZn45Tddk3OrA?= =?us-ascii?Q?Ve0nff+QSK3DQfOwxBYsJx2H=2FdfcQmaEig9UvNL?= =?us-ascii?Q?wqYXpmpResnaZ8VPk=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96952 Subject: [ruby-core:96952] [Ruby master Feature#16517] mkmf.rb - changes for Windows ? X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #16517 has been updated by MSP-Greg (Greg L). Re the mswin change, the cost is low, and the benefit is high. Re requiring devkit, my request is a specific solution to a specific problem. RubyGems has hooks, and will also load/require specific files, like `operating_system.rb`. `*.gemspec` files also allow for 'free-form' metadata. Rather than the specific solution, should something like the following be added as a hook for packagers in `mkmf.rb`? ```ruby begin require "#{RbConfig::CONFIG['sitelibdir']}/mkmf_pre.rb" rescue end ``` MinGW builds using RubyInstaller2/RIDK use gemspec metadata to install packages/libraries needed to compile/install an extension gem. Something similar could be used in `mkmf_pre.rb` to allow packagers to do the same to 'enable the typical extension build in CI'. *.gemspec metadata could include the names of packages required for Ubuntu, macOS, mingw, and maybe mswin. This could be used for both extension CI builds and gem installation. Certainly would make cross platform building/installing/compiling easier on MRI builds, and minimize the platform specific code needed. @larskanis - Thanks for the post. I apologize for not pinging you here. I'm not quite all there (flu). ---------------------------------------- Feature #16517: mkmf.rb - changes for Windows ? https://bugs.ruby-lang.org/issues/16517#change-83981 * Author: MSP-Greg (Greg L) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- 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. ```ruby if $mingw begin require 'devkit' rescue end end ``` 2) mswin - most compile tools other than msvc will find libraries without a lib prefix. Note the following code in extconf.rb for OpenSSL: ```ruby 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: ```ruby 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. -- https://bugs.ruby-lang.org/