diff -Nru rake-compiler-1.0.5/debian/changelog rake-compiler-1.1.1/debian/changelog --- rake-compiler-1.0.5/debian/changelog 2020-04-02 16:38:22.000000000 +0000 +++ rake-compiler-1.1.1/debian/changelog 2020-09-01 09:16:39.000000000 +0000 @@ -1,3 +1,16 @@ +rake-compiler (1.1.1-1) unstable; urgency=medium + + [ Debian Janitor ] + * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, + Repository-Browse. + + [ Youhei SASAKI ] + * New upstream version 1.1.1 + * d/rake-compiler.docs: follow upstream renaming + * d/ruby-tests.rake, d/rules: Cosmetic + + -- Youhei SASAKI Tue, 01 Sep 2020 18:16:39 +0900 + rake-compiler (1.0.5-2) unstable; urgency=medium * Add ruby-rspec as a runtime dependency diff -Nru rake-compiler-1.0.5/debian/rake-compiler.docs rake-compiler-1.1.1/debian/rake-compiler.docs --- rake-compiler-1.0.5/debian/rake-compiler.docs 2020-04-02 16:24:04.000000000 +0000 +++ rake-compiler-1.1.1/debian/rake-compiler.docs 2020-09-01 09:10:12.000000000 +0000 @@ -1 +1 @@ -README.rdoc +README.md diff -Nru rake-compiler-1.0.5/debian/ruby-tests.rake rake-compiler-1.1.1/debian/ruby-tests.rake --- rake-compiler-1.0.5/debian/ruby-tests.rake 2020-04-02 16:24:04.000000000 +0000 +++ rake-compiler-1.1.1/debian/ruby-tests.rake 2020-09-01 09:10:12.000000000 +0000 @@ -1,5 +1,5 @@ -# -*- mode: ruby; coding: utf-8 -*- -require "rspec/core/rake_task" -task :default => :spec -RSpec::Core::RakeTask.new(:spec) - +require 'gem2deb/rake/spectask' + +Gem2Deb::Rake::RSpecTask.new do |spec| + spec.pattern = './spec/**/*_spec.rb' +end diff -Nru rake-compiler-1.0.5/debian/rules rake-compiler-1.1.1/debian/rules --- rake-compiler-1.0.5/debian/rules 2020-04-02 16:26:49.000000000 +0000 +++ rake-compiler-1.1.1/debian/rules 2020-09-01 09:10:12.000000000 +0000 @@ -1,15 +1,7 @@ #!/usr/bin/make -f -#export DH_VERBOSE=1 -# -# Uncomment to ignore all test failures (but the tests will run anyway) -#export DH_RUBY_IGNORE_TESTS=all -# -# Uncomment to ignore some test failures (but the tests will run anyway). -# Valid values: -#export DH_RUBY_IGNORE_TESTS=ruby1.8 ruby1.9.1 require-rubygems -# -# If you need to specify the .gemspec (eg there is more than one) -#export DH_RUBY_GEMSPEC=gem.gemspec + +export GEM2DEB_TEST_RUNNER = --check-dependencies +export DH_RUBY = --gem-install %: dh $@ --buildsystem=ruby --with ruby diff -Nru rake-compiler-1.0.5/debian/tests/control rake-compiler-1.1.1/debian/tests/control --- rake-compiler-1.0.5/debian/tests/control 2020-04-02 16:24:04.000000000 +0000 +++ rake-compiler-1.1.1/debian/tests/control 2020-09-01 09:10:12.000000000 +0000 @@ -1,3 +1,4 @@ Test-Command: gem2deb-test-runner --autopkgtest 2>&1 -Depends: @, gem2deb-test-runner +Depends: gem2deb-test-runner, + @ Restrictions: allow-stderr diff -Nru rake-compiler-1.0.5/debian/upstream/metadata rake-compiler-1.1.1/debian/upstream/metadata --- rake-compiler-1.0.5/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ rake-compiler-1.1.1/debian/upstream/metadata 2020-09-01 09:16:17.000000000 +0000 @@ -0,0 +1,4 @@ +Bug-Database: https://github.com/rake-compiler/rake-compiler/issues +Bug-Submit: https://github.com/rake-compiler/rake-compiler/issues/new +Repository: https://github.com/rake-compiler/rake-compiler.git +Repository-Browse: https://github.com/rake-compiler/rake-compiler diff -Nru rake-compiler-1.0.5/History.txt rake-compiler-1.1.1/History.txt --- rake-compiler-1.0.5/History.txt 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/History.txt 2020-07-09 20:40:15.000000000 +0000 @@ -1,3 +1,57 @@ +=== 1.1.1 / 2020-07-10 + +* Changes: + * Bump the default Java bytecode to 1.7. + #172 [Patch by Charles Oliver Nutter] + +* Enhancements: + * Add support for finding x86_64 MinGW GCC. + #164 [Patch by Lars Kanis] + * Strip cross compiled shared library automatically. + #165 [Patch by Lars Kanis] + +=== 1.1.0 / 2019-12-25 + +* Bugfixes: + * Fix a bug that JavaExtenstionTask can't build anything. + #163 [Reported by Kai Kuchenbecker] + +=== 1.0.9 / 2019-12-23 + +* Changes: + * Use "-Xlint" option for JRuby native extension by default. + #158 [Patch by Stephen George] + +* Enhancements: + * Make customizable compiler Xlint option for JRuby native extension. + #118 [Patch by Hiroshi Hatake] + * Add support for Ruby 2.7. + #161 [Reported by Masaki Hara] + +=== 1.0.8 / 2019-09-21 + +* Enhancements: + * Added Rake::JavaExtensionTask#encoding= to pass the -encoding option to + javac. + #157 [Patch by Tiago Dias] + +* Bugfixes: + * Drop EOL'd rubyforge_project directive from .gemspec. + #155 [Patch by Olle Jonsson] + +=== 1.0.7 / 2019-01-04 + +* Bugfixes: + * Fix a bug that JRuby class path detection is failed on + cross-compilation. + #149 #151 [Reported by Chalupa Petr][Patch by Prashant Vithani] + +=== 1.0.6 / 2018-12-23 + +* Enhancements: + * Stop to make unreleased Ruby installable. + #150 [Reported by MSP-Greg] + === 1.0.5 / 2018-08-31 * Enhancements: diff -Nru rake-compiler-1.0.5/lib/rake/extensioncompiler.rb rake-compiler-1.1.1/lib/rake/extensioncompiler.rb --- rake-compiler-1.0.5/lib/rake/extensioncompiler.rb 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/lib/rake/extensioncompiler.rb 2020-07-09 20:40:15.000000000 +0000 @@ -37,7 +37,7 @@ paths = ENV['PATH'].split(File::PATH_SEPARATOR) # the pattern to look into (captures *nix and windows executables) - pattern = "{mingw32-,i?86*mingw*}gcc{,.*}" + pattern = "{mingw32-,i?86*mingw*,x86*mingw*}gcc{,.*}" @mingw_gcc_executable = paths.find do |path| # cleanup paths before globbing diff -Nru rake-compiler-1.0.5/lib/rake/extensiontask.rb rake-compiler-1.1.1/lib/rake/extensiontask.rb --- rake-compiler-1.0.5/lib/rake/extensiontask.rb 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/lib/rake/extensiontask.rb 2020-07-09 20:40:15.000000000 +0000 @@ -26,6 +26,7 @@ @no_native = false @config_includes = [] @ruby_versions_per_platform = {} + @make = nil end def cross_platform @@ -260,7 +261,7 @@ end spec.required_ruby_version = [ ">= #{ruby_api_version(sorted_ruby_versions.first)}", - "< #{ruby_api_version(sorted_ruby_versions.last).succ}" + "< #{ruby_api_version(sorted_ruby_versions.last).succ}.dev" ] # clear the extensions defined in the specs diff -Nru rake-compiler-1.0.5/lib/rake/javaextensiontask.rb rake-compiler-1.1.1/lib/rake/javaextensiontask.rb --- rake-compiler-1.0.5/lib/rake/javaextensiontask.rb 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/lib/rake/javaextensiontask.rb 2020-07-09 20:40:15.000000000 +0000 @@ -17,6 +17,11 @@ # Generate class files for specific VM version attr_accessor :target_version + attr_accessor :encoding + + # Specify lint option + attr_accessor :lint_option + def platform @platform ||= 'java' end @@ -29,10 +34,12 @@ super @source_pattern = '**/*.java' @classpath = nil - @java_compiling = nil @debug = false - @source_version = '1.6' - @target_version = '1.6' + @source_version = '1.7' + @target_version = '1.7' + @encoding = nil + @java_compiling = nil + @lint_option = nil end def define @@ -92,10 +99,19 @@ EOF warn_once(not_jruby_compile_msg) unless defined?(JRUBY_VERSION) - classpath_arg = java_classpath_arg(@classpath) - debug_arg = @debug ? '-g' : '' - - sh "javac #{java_extdirs_arg} -target #{@target_version} -source #{@source_version} -Xlint:unchecked #{debug_arg} #{classpath_arg} -d #{tmp_path} #{source_files.join(' ')}" + javac_command_line = [ + "javac", + "-target", @target_version, + "-source", @source_version, + java_lint_arg, + "-d", tmp_path, + ] + javac_command_line.concat(java_encoding_args) + javac_command_line.concat(java_extdirs_args) + javac_command_line.concat(java_classpath_args) + javac_command_line << "-g" if @debug + javac_command_line.concat(source_files) + sh(*javac_command_line) # Checkpoint file touch "#{tmp_path}/.build" @@ -185,24 +201,36 @@ end # - # Discover Java Extension Directories and build an extdirs argument + # Discover Java Extension Directories and build an extdirs arguments # - def java_extdirs_arg + def java_extdirs_args extdirs = Java::java.lang.System.getProperty('java.ext.dirs') rescue nil - extdirs = ENV['JAVA_EXT_DIR'] unless extdirs - java_extdir = extdirs.nil? ? "" : "-extdirs \"#{extdirs}\"" + extdirs ||= ENV['JAVA_EXT_DIR'] + if extdirs.nil? + [] + else + ["-extdirs", extdirs] + end end # - # Discover the Java/JRuby classpath and build a classpath argument + # Build an encoding arguments # - # @params - # *args:: Additional classpath arguments to append + def java_encoding_args + if @encoding.nil? + [] + else + ["-encoding", @encoding] + end + end + + # + # Discover the Java/JRuby classpath and build a classpath arguments # # Copied verbatim from the ActiveRecord-JDBC project. There are a small myriad # of ways to discover the Java classpath correctly. # - def java_classpath_arg(*args) + def java_classpath_args jruby_cpath = nil if RUBY_PLATFORM =~ /java/ begin @@ -212,16 +240,49 @@ rescue => e end end + + # jruby_cpath might not be present from Java-9 onwards as it removes + # sun.boot.class.path. Check if JRUBY_HOME is set as env variable and try + # to find jruby.jar under JRUBY_HOME + unless jruby_cpath + jruby_home = ENV['JRUBY_HOME'] + if jruby_home + candidate = File.join(jruby_home, 'lib', 'jruby.jar') + jruby_cpath = candidate if File.exist?(candidate) + end + end + + # JRUBY_HOME is not necessarily set in JRuby-9.x + # Find the libdir from RbConfig::CONFIG and find jruby.jar under the + # found lib path unless jruby_cpath libdir = RbConfig::CONFIG['libdir'] - if libdir.start_with? "classpath:" - raise 'Cannot build with jruby-complete' + if libdir.start_with?("uri:classloader:") + raise 'Cannot build with jruby-complete from Java 9 onwards' end - jruby_cpath = File.join(libdir, "jruby.jar") + candidate = File.join(libdir, "jruby.jar") + jruby_cpath = candidate if File.exist?(candidate) + end + + unless jruby_cpath + raise "Could not find jruby.jar. Please set JRUBY_HOME or use jruby in rvm" + end + + if @classpath and @classpath.size > 0 + jruby_cpath = [jruby_cpath, *@classpath].join(File::PATH_SEPARATOR) end - jruby_cpath += File::PATH_SEPARATOR + args.join(File::PATH_SEPARATOR) unless args.empty? - jruby_cpath ? "-cp \"#{jruby_cpath}\"" : "" + ["-cp", jruby_cpath] end + # + # Convert a `-Xlint:___` linting option such as `deprecation` into a full javac argument, such as `-Xlint:deprecation`. + # + # @return [String] Default: _Simply `-Xlint` is run, which enables recommended warnings. + # + def java_lint_arg + return '-Xlint' unless @lint_option + + "-Xlint:#{@lint_option}" + end end end diff -Nru rake-compiler-1.0.5/rake-compiler.gemspec rake-compiler-1.1.1/rake-compiler.gemspec --- rake-compiler-1.0.5/rake-compiler.gemspec 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/rake-compiler.gemspec 2020-07-09 20:40:15.000000000 +0000 @@ -3,7 +3,7 @@ Gem::Specification.new do |s| # basic information s.name = "rake-compiler" - s.version = "1.0.5" + s.version = "1.1.1" s.platform = Gem::Platform::RUBY # description and details @@ -18,6 +18,7 @@ s.add_dependency 'rake' # development dependencies + s.add_development_dependency 'bundler' s.add_development_dependency 'rspec', '~> 2.8.0' s.add_development_dependency 'cucumber', '~> 1.1.4' @@ -29,7 +30,7 @@ s.files += Dir.glob("spec/**/*.rb") s.files += Dir.glob("tasks/**/*.rake") s.files += ["Rakefile", "Gemfile"] - s.files += Dir.glob("*.{rdoc,txt,yml}") + s.files += Dir.glob("*.{md,rdoc,txt,yml}") s.bindir = 'bin' s.executables = ['rake-compiler'] @@ -37,13 +38,12 @@ s.require_path = 'lib' # documentation - s.rdoc_options << '--main' << 'README.rdoc' << '--title' << 'rake-compiler -- Documentation' + s.rdoc_options << '--main' << 'README.md' << '--title' << 'rake-compiler -- Documentation' - s.extra_rdoc_files = %w(README.rdoc LICENSE.txt History.txt) + s.extra_rdoc_files = %w(README.md LICENSE.txt History.txt) # project information s.homepage = 'https://github.com/rake-compiler/rake-compiler' - s.rubyforge_project = 'rake-compiler' s.licenses = ['MIT'] # author and contributors diff -Nru rake-compiler-1.0.5/README.md rake-compiler-1.1.1/README.md --- rake-compiler-1.0.5/README.md 1970-01-01 00:00:00.000000000 +0000 +++ rake-compiler-1.1.1/README.md 2020-07-09 20:40:15.000000000 +0000 @@ -0,0 +1,465 @@ +# What is rake-compiler? + +rake-compiler is first and foremost a productivity tool for Ruby developers. +Its goal is to make the busy developer's life easier by simplifying the building +and packaging of Ruby extensions by simplifying code and reducing duplication. + +It follows **convention over configuration** by advocating a standardized build and +package structure for both C and Java based RubyGems. + +rake-compiler is the result of many hard-won experiences dealing with several +diverse RubyGems that provided native extensions for different platforms and +different user configurations in different ways. Details such as differences in +code portability, differences in code clarity, and differences in project directory +structure often made it very difficult for newcomers to those RubyGems. + +From these challenges, rake-compiler was born with the single-minded goal of +making the busy RubyGem developer's life much less difficult. + +## Feature Overview + +Some of the benefits rake-compiler provides include: + +* No custom rake tasks required. Less code duplication and errors. + +* Painlessly build extensions on different platforms (Linux, OSX and Windows). + +* Painlessly build extensions for different Ruby implementations (JRuby, + Rubinius and MRI). + +* Allow multiple extensions to be compiled inside the same gem. + +* Painlessly build "fat" native gems for Windows users (from Linux or OSX). + +* Mimics RubyGems standard installation process, helping as a test environment. + +* Simplifies cross platform extension compilation (targeting Windows from Linux). + +## OK, I'm sold! Show me how to install it! + +Simple: + + $ gem install rake-compiler + +## That's easy. How do I use it? + +Now that you have installed rake-compiler, it's time to give your project a +standardized structure. + +### Using a standardized project structure + +Let's say you want to compile an extension called 'hello_world'. Organizing +your project's code tree in the following way will help rake-compiler do +its job: + + |-- ext + | `-- hello_world + | |-- extconf.rb + | |-- HelloWorldService.java + | `-- hello_world.c + |-- lib + `-- Rakefile + +TIP: Having a consistent project directory structure will help developers and +newcomers find and understand your code, making it easier for them to +contribute back to your project. + +### Adding the code to enable rake-compiler + +Now the fun part. It's time to introduce the code to your projects Rakefile +to tell it to use rake-compiler to build your extension: + + # File: extconf.rb + + # these lines must exist already + require 'mkmf' + create_makefile('hello_world') + + # File: Rakefile + + require 'rake/extensiontask' + + Rake::ExtensionTask.new('hello_world') + +That's it? Yes, that's it! No other lines of code are needed for +rake-compiler to work its magic. + +Though, you need to make sure the parameter to `create_makefile` +and `ExtensionTask.new` are the same or rake-compiler will not mimic +the RubyGems standard install process. You can override this standard +behaviour if needed, see the instructions for "non-standard project structure" +below for details. + +If you want to do the same for a JRuby extension written in Java, it's just +as easy: + + # File: Rakefile + + require 'rake/javaextensiontask' + + Rake::JavaExtensionTask.new('hello_world') + +### The simple process + +Those **two** simple lines of code automatically added the Rake tasks needed to +build your 'hello_world' extension. For example, checking the Rake tasks on +MRI Ruby 1.8.x/1.9 returns something similar to: + + $ rake -T + (in /home/user/my_extension) + rake compile # Compile the extension(s) + rake compile:hello_world # Compile just the hello_world extension + +Simply calling `compile` like + + $ rake compile + +performs the entire compile and build process for you and places the resulting +extension inside the `lib` directory of your project. + +To pass `dir_config` options to the compilation, add to the command line: + + $ rake compile -- --with-foo-[dir|lib|bin|...]=/path/to/foo + +NOTE: Please be aware that building C extensions requires the proper +development environment for your Platform, including libraries, headers +and build tools. Check your distro / vendor documentation on how to install +these development resources. + +NOTE: Building Java extensions requires the `javac`, part of the Java +Development Kit (JDK). This should be included by default on Mac OS X, and +downloadable from http://java.sun.com for other operating systems. + +### Generating native RubyGems + +A common usage scenario for rake-compiler is generating native gems that +bundle your extensions. As mentioned above, if you have your development +environment configured correctly, the following examples work even when +building native gems on Windows systems. + +Creating native gems is really easy with rake-compiler's +`Rake::ExtensionTask`: + + # somewhere in your Rakefile, define your gem spec + spec = Gem::Specification.new do |s| + s.name = "my_gem" + s.platform = Gem::Platform::RUBY + s.extensions = FileList["ext/**/extconf.rb"] + end + + # add your default gem packing task + Gem::PackageTask.new(spec) do |pkg| + end + + # feed the ExtensionTask with your spec + Rake::ExtensionTask.new('hello_world', spec) + +As expected, you can still build your pure-ruby gem in the usual way +(standard output) by running: + + $ rake gem + (in /projects/oss/my_gem.git) + mkdir -p pkg + Successfully built RubyGem + Name: my_gem + Version: 0.1.0 + File: my_gem-0.1.0.gem + mv my_gem-0.1.0.gem pkg/my_gem-0.1.0.gem + +Plus, rake-compiler tasks give you the extra functionality needed to build +native gems by running: + + # rake native gem + (... compilation output ...) + mkdir -p pkg + Successfully built RubyGem + Name: my_gem + Version: 0.1.0 + File: my_gem-0.1.0.gem + mv my_gem-0.1.0.gem pkg/my_gem-0.1.0.gem + Successfully built RubyGem + Name: my_gem + Version: 0.1.0 + File: my_gem-0.1.0-x86-mingw32.gem + mv my_gem-0.1.0-x86-mingw32.gem pkg/my_gem-0.1.0-x86-mingw32.gem + +Did you notice that you get two gems for the price of one? How's that for a +time saver? + +Similarly, it's just as easy to do the same thing for JRuby extensions: + + # rake java gem + (... compilation output ...) + mkdir -p pkg + Successfully built RubyGem + Name: my_gem + Version: 0.1.0 + File: my_gem-0.1.0.gem + mv my_gem-0.1.0.gem pkg/my_gem-0.1.0.gem + Successfully built RubyGem + Name: my_gem + Version: 0.1.0 + File: my_gem-0.1.0-java.gem + mv my_gem-0.1.0-java.gem pkg/my_gem-0.1.0-java.gem + + +### Great, but can I use a non-standard project structure? + +Yes you can! While the conventional project structure is recommended, you may +want, or need, to tweak those conventions. Rake-compiler allows you to customize +several settings for `Rake::ExtensionTask`: + + Rake::ExtensionTask.new do |ext| + ext.name = 'hello_world' # indicate the name of the extension. + ext.ext_dir = 'ext/weird_world' # search for 'hello_world' inside it. + ext.lib_dir = 'lib/my_lib' # put binaries into this folder. + ext.config_script = 'custom_extconf.rb' # use instead of the default 'extconf.rb'. + ext.tmp_dir = 'tmp' # temporary folder used during compilation. + ext.source_pattern = "*.{c,cpp}" # monitor file changes to allow simple rebuild. + ext.config_options << '--with-foo' # supply additional options to configure script. + ext.gem_spec = spec # optionally indicate which gem specification + # will be used. + end + + +### Show me all of the supported configuration options + +| Option | Supported By | Description | +| -------------------- | --------------------- | ---------------------------------------- | +| name | Both | Required. Give the target binary a name. | +| gem_spec | Both | [Optional] Indicate which gem specification will be used. | +| tmp_dir | Both | [Optional] Temporary folder used during compilation. | +| ext_dir | Both | [Optional] Where to search for `name`. Default: `ext/#{@name}`. | +| lib_dir | Both | [Optional] Put binaries into this folder. Default: `lib`. | +| config_options | Both | [Optional] Supply additional options to configure script. | +| source_pattern | Both | [Optional] Monitor file changes to allow simple rebuild. Default for CRuby: `*.{c,cc,cpp}`. Default for Java: `**/*.java`. | +| _extra_options_ | ExtensionTask (CRuby) | [Optional] _Any options you add to ARGV on the command line are passed on as complilation flags if they begin with a dash (-)._ | +| config_script | ExtensionTask (CRuby) | [Optional] Specify alternate configuration file name when [Adding the code to enable rake-compiler](#adding-the-code-to-enable-rake-compiler). Default: `extconf.rb`. | +| cross_compile | ExtensionTask (CRuby) | [Optional] See [Cross compilation - the future is now.](#cross-compilation---the-future-is-now) Default: `false`. | +| cross_platform | ExtensionTask (CRuby) | [Optional] See [Cross compilation - the future is now.](#cross-compilation---the-future-is-now) Default: `i386-mingw32`. | +| cross_config_options | ExtensionTask (CRuby) | [Optional] See [Cross compilation - the future is now.](#cross-compilation---the-future-is-now) Default: `[]`. | +| no_native | ExtensionTask (CRuby) | [Optional] Set to true to prevent non-CRuby platforms from defining native tasks. Default: `false`. | +| config_includes | ExtensionTask (CRuby) | [Optional] Specify an Array of paths to include as `-I...:...` includes during compilation. Default: `['.']`. | +| classpath | JavaExtensionTask | [Optional] Specify additional classpath paths as an Array. Default: _Uses the current CLASSPATH._ | +| debug | JavaExtensionTask | [Optional] Whether to set the debug flag during complication. Default: `false`. | +| source_version | JavaExtensionTask | [Optional] The JRE version that your source code requires to compile. Default: `1.6`. | +| target_version | JavaExtensionTask | [Optional] The oldest JRE version you want to support. Default: `1.6`. | +| encoding | JavaExtensionTask | [Optional] Specify an -encoding option to provide to the compiler. Default: `nil`. | +| lint_option | JavaExtensionTask | [Optional] Specify a `-Xlint:___` linting option such as `deprecation`, `all`, `none`, etc. (Run `javac -help -X` to see all available options.)
Default: _Simply `-Xlint` is run, which enables recommended warnings._ | + + +## Cross compilation - the future is now. + +Rake-compiler also provides a standardized way to generate, from either Linux +or OSX, extensions and gem binaries for your Windows users! + +How can this be you say? Simple, rake-compiler's cross compilation features +take advantage of GCC's host/target capabilities to build 'target' binaries on +different 'host' OS's. + +### How do I do this from Linux or OSX? + +#### The Easy Way + +Use rake-compiler-dock, a gem that makes use of a virtual machine provisioned with +all the necessary build tools. You can add a task to your Rakefile, that +cross-compiles and packages your gem into Windows fat binaries (with 1.8 to 2.2 +and x86/x64 support). See https://github.com/rake-compiler/rake-compiler-dock for more +information. + +#### The Manual Way + +In addition to having the development tool chain installed (GCC), you also need to +install your platform's `mingw32` cross compilation package. + +Installation depends upon your operating system/distribution. On Ubuntu and Debian +host machines, a simple `apt-get install mingw32` will be enough. + +On Arch, `mingw32` is installed by running `pacman -S mingw32-gcc` + +On OSX, we no longer recommend the usage of MacPorts `mingw32` package because +it stagnated in GCC version 3.4.5. + +Instead we recommend you download mingw-w64 automated build packages available at +SourceForge: + +http://sourceforge.net/downloads/mingw-w64/ + +Browse into *Toolchains targetting Win32* and then *Automated Builds*. + +Files will be ordered by recency, find the latest one with version 1.0 in it, +like this one: + + mingw-w32-1.0-bin_i686-darwin_20110422.tar.bz2 + +Download and extract. After that, make sure the bin directory is added to the PATH, eg: + + export PATH=~/mingw-w64/w32/bin:$PATH + +You can add this to your `.profile` to avoid the repitition. + +#### I've got my tool-chain installed, now what? + +First, you need to build Ruby for Windows on your Linux or OSX system. + +Relax, no need to freak out! Let rake-compiler do all the heavy lifting for you: + + rake-compiler cross-ruby + +And you're done. It will automatically download, configure and compile the latest +stable version of Ruby for Windows, and place it into your `~/.rake-compiler` +directory. + +This will create `~/.rake-compiler/config.yml` file so that rake-compiler +knows where to find the `rbconfig.rb` file that matches the Ruby version +on the Windows host system you're cross-compiling for. An example: + + # File: ~/.rake-compiler/config.yml + + rbconfig-x86-mingw32-1.8.6: /path/to/ruby-1.8.6/rbconfig.rb + rbconfig-x86-mingw32-1.8.7: /path/to/ruby-1.8.7/rbconfig.rb + rbconfig-x86-mingw32-1.9.2: /path/to/ruby-1.9.2/rbconfig.rb + +If, instead, you want to build a different Ruby version than the default one, please +supply a `VERSION`: + + rake-compiler cross-ruby VERSION=1.8.6-p114 + +If you, like me, have multiple versions of MinGW packages installed, you can +specify the HOST that will be used to cross compile Ruby: + + rake-compiler cross-ruby HOST=x86-mingw32 # (OSX mingw32 port) + +The host will vary depending on provider (mingw32 versus mingw-w64 projects). +Please consult the documentation and website of the MinGW package provider before +reporting any issues. + +#### OK, let's cross compile some gems! + +Now, you only need specify a few additional options in your extension definition: + + Rake::ExtensionTask.new('my_extension', gem_spec) do |ext| + # enable cross compilation (requires cross compile toolchain) + ext.cross_compile = true + + # set a single platform or an array of platforms to target + ext.cross_platform = ['x86-mingw32', 'x64-mingw32'] + + # cross-compile options will be passed to extconf.rb for each + # platform build, with platform-specific options in a hash. + ext.cross_config_options << '--with-common-option' + ext.cross_config_options << { + 'x86-mswin32-60 => '--with-some-option', + 'x64-mingw32' => '--enable-64bits', + } + ext.cross_config_options << '--with-final-option' + + # perform alterations on the gemspec when cross compiling + ext.cross_compiling do |gem_spec| + # such as packaging a file that isn't specified in the gemspec + gem_spec.files << 'lib/generated_file.rb' + # or adding a new installation message + gem_spec.post_install_message = "You installed the binary version of this gem!" + end + end + +By default, cross compilation targets 'i386-mingw32' which is the default +GCC platform for Ruby. MRI Ruby's current official distribution uses +`i386-mswin32-60`. The RubyInstaller distribution uses +`x86-mingw32` and `x64-mingw32` for 32-bit and 64-bit +Windows targets, respectively. Note that `i386` and `x86` +are synonymous here; `x86` is preferred going forward. + +The format for `cross_config_options` is an array of strings and +hashes. Hashes will be fetched for each value of `cross_platform` +as the build iterates, or ignored if there is no value for that platform. +You can mix-and-match strings and hashes to get desired option ordering. + +#### Warning, magician about to do some tricks, don't blink! + +Cross compiling is still very simple: + + rake cross compile + +And now, building gems for your Windows users is just 6 more letters: + + rake cross native gem + +And you're done, yeah. + +#### But wait, there's more + +You can specify which version of Ruby to build the extension against: + + rake cross compile RUBY_CC_VERSION=1.8.6 + +For example, if you installed `1.9.2`, you can do: + + rake cross compile RUBY_CC_VERSION=1.9.2 + +Even better, you can target multiple versions (ie. 1.8.6 and 1.9.2) in +the same gem via: + + rake cross compile RUBY_CC_VERSION=1.8.6:1.9.2 + +And better yet, you can bundle both binary extensions into one so-called "fat" +gem via: + + rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.2 + +That will place binaries for both the 1.8 and 1.9 versions of your Ruby +extensions inside your project's `lib_dir` directory: + + lib/1.8/my_extension.so + lib/1.9/my_extension.so + +NOTE: building "fat" gems is currently only supported by rake-compiler when +cross compiling from a Linux or OSX host. Patches are welcome if building +"fat" gems from Windows hosts is desired, or natively for your platform :-) + +Now it's up to you to make your gem load the proper binary at runtime: + + begin + RUBY_VERSION =~ /(\d+\.\d+)/ + require "#{$1}/my_extension" + rescue LoadError + require "my_extension" + end + +The above technique will lookup first for 1.8 or 1.9 version of the extension +and when not found, will look for the plain extension. + +This approach catch the cases of provided fat binaries or gems compiled by the +end user installing the gem. It has also been implemented successfully in +several projects. + +## What are you talking about? (Give me examples) + +I know all the above sounds like a complete foreign language (it does even for me!). +So, what if I show you some examples? + +Check our wiki with links to the proper rake files used by many developers and +projects and how they use rake-compiler. + +http://github.com/rake-compiler/rake-compiler/wiki/projects-using-rake-compiler + +## Future + +rake-compiler is a work in progress and we appreciate any and all feedback +during the development of it! (and contributions too!) + +You can find more information about rake-compiler: + +* GitHub: https://github.com/rake-compiler/rake-compiler +* Issues: https://github.com/rake-compiler/rake-compiler/issues +* Docs: http://rubydoc.info/gems/rake-compiler +* Wiki: https://github.com/rake-compiler/rake-compiler/wiki + +## Disclaimer + +If you have any trouble, don't hesitate to contact the author. As always, +I'm not going to say "Use at your own risk" because I don't want this library +to be risky. + +If you trip on something, I'll share the liability by repairing things +as quickly as I can. Your responsibility is to report the inadequacies. diff -Nru rake-compiler-1.0.5/README.rdoc rake-compiler-1.1.1/README.rdoc --- rake-compiler-1.0.5/README.rdoc 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/README.rdoc 1970-01-01 00:00:00.000000000 +0000 @@ -1,438 +0,0 @@ -= What is rake-compiler? - -rake-compiler is first and foremost a productivity tool for Ruby developers. -Its goal is to make the busy developer's life easier by simplifying the building -and packaging of Ruby extensions by simplifying code and reducing duplication. - -It follows *convention over configuration* by advocating a standardized build and -package structure for both C and Java based RubyGems. - -rake-compiler is the result of many hard-won experiences dealing with several -diverse RubyGems that provided native extensions for different platforms and -different user configurations in different ways. Details such as differences in -code portability, differences in code clarity, and differences in project directory -structure often made it very difficult for newcomers to those RubyGems. - -From these challenges, rake-compiler was born with the single-minded goal of -making the busy RubyGem developer's life much less difficult. - -== Feature Overview - -Some of the benefits rake-compiler provides include: - -* No custom rake tasks required. Less code duplication and errors. - -* Painlessly build extensions on different platforms (Linux, OSX and Windows). - -* Painlessly build extensions for different Ruby implementations (JRuby, - Rubinius and MRI). - -* Allow multiple extensions to be compiled inside the same gem. - -* Painlessly build "fat" native gems for Windows users (from Linux or OSX). - -* Mimics RubyGems standard installation process, helping as a test environment. - -* Simplifies cross platform extension compilation (targeting Windows from Linux). - -== OK, I'm sold! Show me how to install it! - -Simple: - - $ gem install rake-compiler - -== That's easy. How do I use it? - -Now that you have installed rake-compiler, it's time to give your project a -standardized structure. - -=== Using a standardized project structure - -Let's say you want to compile an extension called 'hello_world'. Organizing -your project's code tree in the following way will help rake-compiler do -its job: - - |-- ext - | `-- hello_world - | |-- extconf.rb - | |-- HelloWorldService.java - | `-- hello_world.c - |-- lib - `-- Rakefile - -TIP: Having a consistent project directory structure will help developers and -newcomers find and understand your code, making it easier for them to -contribute back to your project. - -=== Adding the code to enable rake-compiler - -Now the fun part. It's time to introduce the code to your projects Rakefile -to tell it to use rake-compiler to build your extension: - - # File: extconf.rb - - # these lines must exist already - require 'mkmf' - create_makefile('hello_world') - - - # File: Rakefile - - require 'rake/extensiontask' - - Rake::ExtensionTask.new('hello_world') - -That's it? Yes, that's it! No other lines of code are needed for -rake-compiler to work its magic. - -Though, you need to make sure the parameter to create_makefile -and ExtensionTask.new are the same or rake-compiler will not mimic -the RubyGems standard install process. You can override this standard -behaviour if needed, see the instructions for "non-standard project structure" -below for details. - -If you want to do the same for a JRuby extension written in Java, it's just -as easy: - - # File: Rakefile - - require 'rake/javaextensiontask' - - Rake::JavaExtensionTask.new('hello_world') - -=== The simple process - -Those *two* simple lines of code automatically added the Rake tasks needed to -build your 'hello_world' extension. For example, checking the Rake tasks on -MRI Ruby 1.8.x/1.9 returns something similar to: - - $ rake -T - (in /home/user/my_extension) - rake compile # Compile the extension(s) - rake compile:hello_world # Compile just the hello_world extension - -Simply calling compile like - - $ rake compile - -performs the entire compile and build process for you and places the resulting -extension inside the lib directory of your project. - -To pass dir_config options to the compilation, add to the command line: - - $ rake compile -- --with-foo-[dir|lib|bin|...]=/path/to/foo - -NOTE: Please be aware that building C extensions requires the proper -development environment for your Platform, including libraries, headers -and build tools. Check your distro / vendor documentation on how to install -these development resources. - -NOTE: Building Java extensions requires the javac, part of the Java -Development Kit (JDK). This should be included by default on Mac OS X, and -downloadable from http://java.sun.com for other operating systems. - -=== Generating native RubyGems - -A common usage scenario for rake-compiler is generating native gems that -bundle your extensions. As mentioned above, if you have your development -environment configured correctly, the following examples work even when -building native gems on Windows systems. - -Creating native gems is really easy with rake-compiler's Rake::ExtensionTask: - - # somewhere in your Rakefile, define your gem spec - spec = Gem::Specification.new do |s| - s.name = "my_gem" - s.platform = Gem::Platform::RUBY - s.extensions = FileList["ext/**/extconf.rb"] - end - - # add your default gem packing task - Gem::PackageTask.new(spec) do |pkg| - end - - # feed the ExtensionTask with your spec - Rake::ExtensionTask.new('hello_world', spec) - -As expected, you can still build your pure-ruby gem in the usual way -(standard output) by running: - - $ rake gem - (in /projects/oss/my_gem.git) - mkdir -p pkg - Successfully built RubyGem - Name: my_gem - Version: 0.1.0 - File: my_gem-0.1.0.gem - mv my_gem-0.1.0.gem pkg/my_gem-0.1.0.gem - -Plus, rake-compiler tasks give you the extra functionality needed to build -native gems by running: - - # rake native gem - (... compilation output ...) - mkdir -p pkg - Successfully built RubyGem - Name: my_gem - Version: 0.1.0 - File: my_gem-0.1.0.gem - mv my_gem-0.1.0.gem pkg/my_gem-0.1.0.gem - Successfully built RubyGem - Name: my_gem - Version: 0.1.0 - File: my_gem-0.1.0-x86-mingw32.gem - mv my_gem-0.1.0-x86-mingw32.gem pkg/my_gem-0.1.0-x86-mingw32.gem - -Did you notice that you get two gems for the price of one? How's that for a -time saver? - -Similarly, it's just as easy to do the same thing for JRuby extensions: - - # rake java gem - (... compilation output ...) - mkdir -p pkg - Successfully built RubyGem - Name: my_gem - Version: 0.1.0 - File: my_gem-0.1.0.gem - mv my_gem-0.1.0.gem pkg/my_gem-0.1.0.gem - Successfully built RubyGem - Name: my_gem - Version: 0.1.0 - File: my_gem-0.1.0-java.gem - mv my_gem-0.1.0-java.gem pkg/my_gem-0.1.0-java.gem - - -=== Great, but can I use a non-standard project structure? - -Yes you can! While the conventional project structure is recommended, you may -want, or need, to tweak those conventions. Rake-compiler allows you to customize -several settings for Rake::ExtensionTask: - - Rake::ExtensionTask.new do |ext| - ext.name = 'hello_world' # indicate the name of the extension. - ext.ext_dir = 'ext/weird_world' # search for 'hello_world' inside it. - ext.lib_dir = 'lib/my_lib' # put binaries into this folder. - ext.config_script = 'custom_extconf.rb' # use instead of the default 'extconf.rb'. - ext.tmp_dir = 'tmp' # temporary folder used during compilation. - ext.source_pattern = "*.{c,cpp}" # monitor file changes to allow simple rebuild. - ext.config_options << '--with-foo' # supply additional options to configure script. - ext.gem_spec = spec # optionally indicate which gem specification - # will be used. - end - -== Cross compilation - the future is now. - -Rake-compiler also provides a standardized way to generate, from either Linux -or OSX, extensions and gem binaries for your Windows users! - -How can this be you say? Simple, rake-compiler's cross compilation features -take advantage of GCC's host/target capabilities to build 'target' binaries on -different 'host' OS's. - -=== How do I do this from Linux or OSX? - -==== The Easy Way - -Use rake-compiler-dock, a gem that makes use of a virtual machine provisioned with -all the necessary build tools. You can add a task to your Rakefile, that -cross-compiles and packages your gem into Windows fat binaries (with 1.8 to 2.2 -and x86/x64 support). See https://github.com/rake-compiler/rake-compiler-dock for more -information. - -==== The Manual Way - -In addition to having the development tool chain installed (GCC), you also need to -install your platform's mingw32 cross compilation package. - -Installation depends upon your operating system/distribution. On Ubuntu and Debian -host machines, a simple apt-get install mingw32 will be enough. - -On Arch, mingw32 is installed by running pacman -S mingw32-gcc - -On OSX, we no longer recommend the usage of MacPorts mingw32 package because -it stagnated in GCC version 3.4.5. - -Instead we recommend you download mingw-w64 automated build packages available at -SourceForge: - -http://sourceforge.net/downloads/mingw-w64/ - -Browse into Toolchains targetting Win32 and then Automated Builds. - -Files will be ordered by recency, find the latest one with version 1.0 in it, -like this one: - - mingw-w32-1.0-bin_i686-darwin_20110422.tar.bz2 - -Download and extract. After that, make sure the bin directory is added to the PATH, eg: - - export PATH=~/mingw-w64/w32/bin:$PATH - -You can add this to your .profile to avoid the repitition. - -==== I've got my tool-chain installed, now what? - -First, you need to build Ruby for Windows on your Linux or OSX system. - -Relax, no need to freak out! Let rake-compiler do all the heavy lifting for you: - - rake-compiler cross-ruby - -And you're done. It will automatically download, configure and compile the latest -stable version of Ruby for Windows, and place it into your ~/.rake-compiler -directory. - -This will create ~/.rake-compiler/config.yml file so that rake-compiler -knows where to find the rbconfig.rb file that matches the Ruby version -on the Windows host system you're cross-compiling for. An example: - - # File: ~/.rake-compiler/config.yml - - rbconfig-x86-mingw32-1.8.6: /path/to/ruby-1.8.6/rbconfig.rb - rbconfig-x86-mingw32-1.8.7: /path/to/ruby-1.8.7/rbconfig.rb - rbconfig-x86-mingw32-1.9.2: /path/to/ruby-1.9.2/rbconfig.rb - -If, instead, you want to build a different Ruby version than the default one, please -supply a VERSION: - - rake-compiler cross-ruby VERSION=1.8.6-p114 - -If you, like me, have multiple versions of MinGW packages installed, you can -specify the HOST that will be used to cross compile Ruby: - - rake-compiler cross-ruby HOST=x86-mingw32 # (OSX mingw32 port) - -The host will vary depending on provider (mingw32 versus mingw-w64 projects). -Please consult the documentation and website of the MinGW package provider before -reporting any issues. - -==== OK, let's cross compile some gems! - -Now, you only need specify a few additional options in your extension definition: - - Rake::ExtensionTask.new('my_extension', gem_spec) do |ext| - # enable cross compilation (requires cross compile toolchain) - ext.cross_compile = true - - # set a single platform or an array of platforms to target - ext.cross_platform = ['x86-mingw32', 'x64-mingw32'] - - # cross-compile options will be passed to extconf.rb for each - # platform build, with platform-specific options in a hash. - ext.cross_config_options << '--with-common-option' - ext.cross_config_options << { - 'x86-mswin32-60 => '--with-some-option', - 'x64-mingw32' => '--enable-64bits', - } - ext.cross_config_options << '--with-final-option' - - # perform alterations on the gemspec when cross compiling - ext.cross_compiling do |gem_spec| - # such as packaging a file that isn't specified in the gemspec - gem_spec.files << 'lib/generated_file.rb' - # or adding a new installation message - gem_spec.post_install_message = "You installed the binary version of this gem!" - end - end - -By default, cross compilation targets 'i386-mingw32' which is the default -GCC platform for Ruby. MRI Ruby's current official distribution uses -i386-mswin32-60. The RubyInstaller distribution uses -x86-mingw32 and x64-mingw32 for 32-bit and 64-bit -Windows targets, respectively. Note that i386 and x86 -are synonymous here; x86 is preferred going forward. - -The format for cross_config_options is an array of strings and -hashes. Hashes will be fetched for each value of cross_platform -as the build iterates, or ignored if there is no value for that platform. -You can mix-and-match strings and hashes to get desired option ordering. - -==== Warning, magician about to do some tricks, don't blink! - -Cross compiling is still very simple: - - rake cross compile - -And now, building gems for your Windows users is just 6 more letters: - - rake cross native gem - -And you're done, yeah. - -==== But wait, there's more - -You can specify which version of Ruby to build the extension against: - - rake cross compile RUBY_CC_VERSION=1.8.6 - -For example, if you installed 1.9.2, you can do: - - rake cross compile RUBY_CC_VERSION=1.9.2 - -Even better, you can target multiple versions (ie. 1.8.6 and 1.9.2) in -the same gem via: - - rake cross compile RUBY_CC_VERSION=1.8.6:1.9.2 - -And better yet, you can bundle both binary extensions into one so-called "fat" -gem via: - - rake cross native gem RUBY_CC_VERSION=1.8.6:1.9.2 - -That will place binaries for both the 1.8 and 1.9 versions of your Ruby -extensions inside your project's lib_dir directory: - - lib/1.8/my_extension.so - lib/1.9/my_extension.so - -NOTE: building "fat" gems is currently only supported by rake-compiler when -cross compiling from a Linux or OSX host. Patches are welcome if building -"fat" gems from Windows hosts is desired, or natively for your platform :-) - -Now it's up to you to make your gem load the proper binary at runtime: - - begin - RUBY_VERSION =~ /(\d+\.\d+)/ - require "#{$1}/my_extension" - rescue LoadError - require "my_extension" - end - -The above technique will lookup first for 1.8 or 1.9 version of the extension -and when not found, will look for the plain extension. - -This approach catch the cases of provided fat binaries or gems compiled by the -end user installing the gem. It has also been implemented successfully in -several projects. - -== What are you talking about? (Give me examples) - -I know all the above sounds like a complete foreign language (it does even for me!). -So, what if I show you some examples? - -Check our wiki with links to the proper rake files used by many developers and -projects and how they use rake-compiler. - -http://github.com/rake-compiler/rake-compiler/wiki/projects-using-rake-compiler - -== Future - -rake-compiler is a work in progress and we appreciate any and all feedback -during the development of it! (and contributions too!) - -You can find more information about rake-compiler: - -* GitHub: https://github.com/rake-compiler/rake-compiler -* Issues: https://github.com/rake-compiler/rake-compiler/issues -* Docs: http://rubydoc.info/gems/rake-compiler -* Wiki: https://github.com/rake-compiler/rake-compiler/wiki - -== Disclaimer - -If you have any trouble, don't hesitate to contact the author. As always, -I'm not going to say "Use at your own risk" because I don't want this library -to be risky. - -If you trip on something, I'll share the liability by repairing things -as quickly as I can. Your responsibility is to report the inadequacies. diff -Nru rake-compiler-1.0.5/spec/lib/rake/extensiontask_spec.rb rake-compiler-1.1.1/spec/lib/rake/extensiontask_spec.rb --- rake-compiler-1.0.5/spec/lib/rake/extensiontask_spec.rb 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/spec/lib/rake/extensiontask_spec.rb 2020-07-09 20:40:15.000000000 +0000 @@ -490,8 +490,8 @@ end expected_required_ruby_versions = [ - Gem::Requirement.new([">= 1.8", "< 2.11"]), - Gem::Requirement.new([">= 1.8", "< 2.11"]), + Gem::Requirement.new([">= 1.8", "< 2.11.dev"]), + Gem::Requirement.new([">= 1.8", "< 2.11.dev"]), ] cross_specs.collect(&:required_ruby_version).should == expected_required_ruby_versions cross_specs.collect(&:extensions).should == [[], []] diff -Nru rake-compiler-1.0.5/spec/lib/rake/javaextensiontask_spec.rb rake-compiler-1.1.1/spec/lib/rake/javaextensiontask_spec.rb --- rake-compiler-1.0.5/spec/lib/rake/javaextensiontask_spec.rb 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/spec/lib/rake/javaextensiontask_spec.rb 2020-07-09 20:40:15.000000000 +0000 @@ -76,9 +76,14 @@ @ext.config_options.should be_empty end + it 'should have no lint option preset to delegate' do + @ext.lint_option.should be_falsey + end + it 'should default to Java platform' do @ext.platform.should == 'java' end + end context '(tasks)' do before :each do @@ -165,6 +170,31 @@ end end end + + context 'A custom extension' do + let(:extension) do + Rake::JavaExtensionTask.new('extension_two') do |ext| + ext.lint_option = lint_option if lint_option + end + end + + context 'without a specified lint option' do + let(:lint_option) { nil } + + it 'should honor the lint option' do + (extension.lint_option).should be_falsey + (extension.send :java_lint_arg).should eq '-Xlint' + end + end + + context "with a specified lint option of 'deprecated'" do + let(:lint_option) { 'deprecated'.freeze } + + it 'should honor the lint option' do + (extension.lint_option).should eq lint_option + (extension.send :java_lint_arg).should eq '-Xlint:deprecated' + end + end end end private diff -Nru rake-compiler-1.0.5/tasks/bin/cross-ruby.rake rake-compiler-1.1.1/tasks/bin/cross-ruby.rake --- rake-compiler-1.0.5/tasks/bin/cross-ruby.rake 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/tasks/bin/cross-ruby.rake 2020-07-09 20:40:15.000000000 +0000 @@ -58,13 +58,16 @@ ENV.delete(var) end +source_dir = "#{USER_HOME}/sources/#{RUBY_CC_VERSION}" +build_dir = "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}" + # define a location where sources will be stored -directory "#{USER_HOME}/sources/#{RUBY_CC_VERSION}" -directory "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}" +directory source_dir +directory build_dir # clean intermediate files and folders -CLEAN.include("#{USER_HOME}/sources/#{RUBY_CC_VERSION}") -CLEAN.include("#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}") +CLEAN.include(source_dir) +CLEAN.include(build_dir) # remove the final products and sources CLOBBER.include("#{USER_HOME}/sources") @@ -87,36 +90,12 @@ # Extract the sources source_file = RUBY_SOURCE ? RUBY_SOURCE.split('/').last : "#{RUBY_CC_VERSION}.tar.bz2" -file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}" => ["#{USER_HOME}/sources/#{source_file}"] do |t| +file source_dir => ["#{USER_HOME}/sources/#{source_file}"] do |t| chdir File.dirname(t.name) do t.prerequisites.each { |f| sh "tar xf #{File.basename(f)}" } end end -# backup makefile.in -file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in.bak" => ["#{USER_HOME}/sources/#{RUBY_CC_VERSION}"] do |t| - cp "#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in", t.name -end - -# correct the makefiles -file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in" => ["#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in.bak"] do |t| - content = File.open(t.name, 'rb') { |f| f.read } - - out = "" - - content.each_line do |line| - if line =~ /^\s*ALT_SEPARATOR =/ - out << "\t\t ALT_SEPARATOR = \"\\\\\\\\\"; \\\n" - else - out << line - end - end - - when_writing("Patching Makefile.in") { - File.open(t.name, 'wb') { |f| f.write(out) } - } -end - task :mingw32 do unless MINGW_HOST then warn "You need to install mingw32 cross compile functionality to be able to continue." @@ -126,8 +105,7 @@ end # generate the makefile in a clean build location -file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}", - "#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in"] do |t| +file "#{build_dir}/Makefile" => [build_dir, source_dir] do |t| options = [ "--host=#{MINGW_HOST}", @@ -135,7 +113,8 @@ "--build=#{RUBY_BUILD}", '--enable-shared', '--disable-install-doc', - '--with-ext=' + '--with-ext=', + 'LDFLAGS=-pipe -s', ] # Force Winsock2 for Ruby 1.8, 1.9 defaults to it @@ -149,14 +128,14 @@ end # make -file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/ruby.exe" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile"] do |t| +file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t| chdir File.dirname(t.prerequisites.first) do sh MAKE end end # make install -file "#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}/bin/ruby.exe" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/ruby.exe"] do |t| +file "#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}/bin/ruby.exe" => ["#{build_dir}/ruby.exe"] do |t| chdir File.dirname(t.prerequisites.first) do sh "#{MAKE} install" end @@ -210,4 +189,3 @@ desc "Build #{RUBY_CC_VERSION} suitable for cross-platform development." task 'cross-ruby' => [:mingw32, :install, 'update-config'] - diff -Nru rake-compiler-1.0.5/tasks/gem.rake rake-compiler-1.1.1/tasks/gem.rake --- rake-compiler-1.0.5/tasks/gem.rake 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/tasks/gem.rake 2020-07-09 20:40:15.000000000 +0000 @@ -1,10 +1,5 @@ -require 'rubygems/package_task' +require "bundler/gem_helper" -gemspec_path = File.join(__dir__, "..", "rake-compiler.gemspec") -gemspec_path = File.expand_path(gemspec_path) -GEM_SPEC = eval(File.read(gemspec_path), TOPLEVEL_BINDING, gemspec_path) - -gem_package = Gem::PackageTask.new(GEM_SPEC) do |pkg| - pkg.need_tar = false - pkg.need_zip = false -end +base_dir = File.join(__dir__, "..") +helper = Bundler::GemHelper.new(base_dir) +helper.install diff -Nru rake-compiler-1.0.5/tasks/news.rake rake-compiler-1.1.1/tasks/news.rake --- rake-compiler-1.0.5/tasks/news.rake 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/tasks/news.rake 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -desc 'Generate email template to standard output' -task :announce do - fail "no GEM_SPEC is found or defined. 'announce' task cannot work without it." unless defined?(GEM_SPEC) - - # read project info and overview - notes = begin - r = File.read("README.rdoc") - r.split(/^(=+ .*)/)[1..4].join.strip - rescue - warn "Missing README.rdoc" - '' - end - - # read changes - changes = begin - h = File.read("History.txt") - h.split(/^(===+ .*)/)[1..2].join.strip - rescue - warn "Missing History.txt" - '' - end - - # standard fields - subject = "#{GEM_SPEC.name} #{GEM_SPEC.version} Released" - title = "#{GEM_SPEC.name} version #{GEM_SPEC.version} has been released!" - body = "#{notes}\n\nChanges:\n\n#{changes}" - urls = [GEM_SPEC.homepage].map { |u| "* <#{u.strip}>" }.join("\n") - - puts "=" * 80, "" - puts "Subject: [ANN] #{subject}" - puts - puts title - puts - puts urls - puts - puts body - puts - puts "=" * 80, "" -end diff -Nru rake-compiler-1.0.5/tasks/release.rake rake-compiler-1.1.1/tasks/release.rake --- rake-compiler-1.0.5/tasks/release.rake 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/tasks/release.rake 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -desc 'Package gems and upload to RubyGems' -task :release, [:version] => [:package] do |t, args| - args.with_defaults(:version => "") - ver = args.version - - fail "no GEM_SPEC is found or defined. 'release' task cannot work without it." unless defined?(GEM_SPEC) - - # compare versions to avoid mistakes - unless ver == GEM_SPEC.version.to_s then - fail "Version mismatch (supplied and specification versions differ)." - end - - files = FileList["pkg/#{GEM_SPEC.name}-#{GEM_SPEC.version}*.*"].to_a - fail "No files found for the release." if files.empty? - - puts "Files to release:" - files.each do |f| - puts " * #{f}" - end - - puts "Releasing #{GEM_SPEC.name} version #{GEM_SPEC.version}..." - files.each do |f| - system "gem push #{f}" - end - puts "Done." -end diff -Nru rake-compiler-1.0.5/.travis.yml rake-compiler-1.1.1/.travis.yml --- rake-compiler-1.0.5/.travis.yml 2018-08-31 05:59:26.000000000 +0000 +++ rake-compiler-1.1.1/.travis.yml 2020-07-09 20:40:15.000000000 +0000 @@ -1,14 +1,11 @@ language: ruby notifications: - recipients: - - rake-compiler@ml.commit-email.info + webhooks: + - https://webhook.commit-email.info/ before_script: - gem update bundler rvm: - - 2.1.2 - - 2.2 - - 2.3.0 + - 2.4 + - 2.5 + - 2.6 - ruby-head -matrix: - allow_failures: - - rvm: ruby-head