rake-compiler-dock 1.4.0 → 1.5.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -9,15 +9,20 @@ CLEAN.include("tmp")
9
9
  RakeCompilerDock::GemHelper.install_tasks
10
10
 
11
11
  platforms = [
12
- ["x86-mingw32", "i686-w64-mingw32"],
13
- ["x64-mingw32", "x86_64-w64-mingw32"],
12
+ # tuple is [platform, target]
13
+ ["aarch64-linux-gnu", "aarch64-linux-gnu"],
14
+ ["aarch64-linux-musl", "aarch64-linux-musl"],
15
+ ["arm-linux-gnu", "arm-linux-gnueabihf"],
16
+ ["arm-linux-musl", "arm-linux-musleabihf"],
17
+ ["arm64-darwin", "aarch64-apple-darwin"],
14
18
  ["x64-mingw-ucrt", "x86_64-w64-mingw32"],
15
- ["x86-linux", "i686-redhat-linux"],
16
- ["x86_64-linux", "x86_64-redhat-linux"],
19
+ ["x64-mingw32", "x86_64-w64-mingw32"],
20
+ ["x86-linux-gnu", "i686-redhat-linux-gnu"],
21
+ ["x86-linux-musl", "i686-unknown-linux-musl"],
22
+ ["x86-mingw32", "i686-w64-mingw32"],
17
23
  ["x86_64-darwin", "x86_64-apple-darwin"],
18
- ["arm64-darwin", "aarch64-apple-darwin"],
19
- ["arm-linux", "arm-linux-gnueabihf"],
20
- ["aarch64-linux", "aarch64-linux-gnu"],
24
+ ["x86_64-linux-gnu", "x86_64-redhat-linux-gnu"],
25
+ ["x86_64-linux-musl", "x86_64-unknown-linux-musl"],
21
26
  ]
22
27
 
23
28
  namespace :build do
@@ -30,6 +35,9 @@ namespace :build do
30
35
  task sdf do
31
36
  image_name = RakeCompilerDock::Starter.container_image_name(platform: platform)
32
37
  sh(*RakeCompilerDock.docker_build_cmd(platform), "-t", image_name, "-f", "Dockerfile.mri.#{platform}", ".")
38
+ if image_name.include?("linux-gnu")
39
+ sh("docker", "tag", image_name, image_name.sub("linux-gnu", "linux"))
40
+ end
33
41
  end
34
42
 
35
43
  df = ERB.new(File.read("Dockerfile.mri.erb"), trim_mode: ">").result(binding)
@@ -78,14 +86,22 @@ end
78
86
 
79
87
  desc "Update predefined_user_group.rb"
80
88
  task :update_lists do
89
+ def get_user_list(platform)
90
+ puts "getting user list from #{platform} ..."
91
+ `RCD_PLATFORM=#{platform} rake-compiler-dock bash -c "getent passwd"`.each_line.map do |line|
92
+ line.chomp.split(":")[0]
93
+ end.compact.reject(&:empty?) - [RakeCompilerDock::Starter.make_valid_user_name(`id -nu`.chomp)]
94
+ end
81
95
 
82
- users = `rake-compiler-dock bash -c "getent passwd"`.each_line.map do |line|
83
- line.chomp.split(":")[0]
84
- end.compact.reject(&:empty?) - [RakeCompilerDock::Starter.make_valid_user_name(`id -nu`.chomp)]
96
+ def get_group_list(platform)
97
+ puts "getting group list from #{platform} ..."
98
+ `RCD_PLATFORM=#{platform} rake-compiler-dock bash -c "getent group"`.each_line.map do |line|
99
+ line.chomp.split(":")[0]
100
+ end.compact.reject(&:empty?) - [RakeCompilerDock::Starter.make_valid_group_name(`id -ng`.chomp)]
101
+ end
85
102
 
86
- groups = `rake-compiler-dock bash -c "getent group"`.each_line.map do |line|
87
- line.chomp.split(":")[0]
88
- end.compact.reject(&:empty?) - [RakeCompilerDock::Starter.make_valid_group_name(`id -ng`.chomp)]
103
+ users = platforms.flat_map { |platform, _| get_user_list(platform) }.uniq.sort
104
+ groups = platforms.flat_map { |platform, _| get_group_list(platform) }.uniq.sort
89
105
 
90
106
  File.open("lib/rake_compiler_dock/predefined_user_group.rb", "w") do |fd|
91
107
  fd.puts <<-EOT
@@ -0,0 +1,37 @@
1
+ #! /usr/bin/env bash
2
+
3
+ set -o errexit
4
+ set -o pipefail
5
+ set -x
6
+
7
+ # check if target is provided as the first argument, and exit if not
8
+ if [ -z "$1" ]; then
9
+ echo "No target provided"
10
+ exit 1
11
+ fi
12
+ TARGET=$1
13
+
14
+ git clone --depth 1 https://github.com/richfelker/musl-cross-make.git
15
+ pushd musl-cross-make
16
+
17
+ cat > config.mak <<EOF
18
+ TARGET = $TARGET
19
+
20
+ DL_CMD = wget -c --no-verbose -O
21
+
22
+ # to match the location of the apt-installed cross-compiler packages
23
+ OUTPUT = /usr
24
+
25
+ # Recommended options for faster/simpler build:
26
+ COMMON_CONFIG += --disable-nls
27
+ GCC_CONFIG += --enable-languages=c,c++
28
+ GCC_CONFIG += --disable-libquadmath --disable-decimal-float
29
+ GCC_CONFIG += --disable-multilib
30
+ EOF
31
+
32
+ make -j$(nproc) install
33
+
34
+ popd
35
+
36
+ # cleanup
37
+ rm -rf musl-cross-make
@@ -1,8 +1,8 @@
1
1
  diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
2
- index 8317a2a..5a1b3ea 100644
2
+ index 8317a2a3..8ed21718 100644
3
3
  --- a/tasks/bin/cross-ruby.rake
4
4
  +++ b/tasks/bin/cross-ruby.rake
5
- @@ -116,10 +116,22 @@ RUBY_CC_VERSIONS.split(":").each do |ruby_cc_version|
5
+ @@ -116,11 +116,27 @@
6
6
  "--host=#{mingw_host}",
7
7
  "--target=#{mingw_target}",
8
8
  "--build=#{RUBY_BUILD}",
@@ -12,7 +12,8 @@ index 8317a2a..5a1b3ea 100644
12
12
  '--disable-install-doc',
13
13
  '--with-ext=',
14
14
  ]
15
- + if mingw_host=~/darwin/
15
+
16
+ + if mingw_host =~ /darwin/
16
17
  + options += [
17
18
  + '--enable-static',
18
19
  + '--disable-shared',
@@ -23,6 +24,10 @@ index 8317a2a..5a1b3ea 100644
23
24
  + '--enable-shared',
24
25
  + ]
25
26
  + end
26
-
27
+ +
28
+ + # https://github.com/docker-library/ruby/issues/308
29
+ + options << "--with-coroutine=arm32" if major == "2.7" && mingw_target =~ /arm-linux-musl/
30
+ +
27
31
  # Force Winsock2 for Ruby 1.8, 1.9 defaults to it
28
32
  options << "--with-winsock2" if major == "1.8"
33
+ options << "--prefix=#{install_dir}"
data/build/runas CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  groupadd -o -g "$GID" "$GROUP"
4
4
  mkdir -p /tmp/home
5
- useradd -o -g "$GID" -u "$UID" -G rvm,sudo -p "" -b /tmp/home -m "$USER"
5
+ useradd -o -g "$GID" -u "$UID" -G rubyuser,sudo -p "" -b /tmp/home -m "$USER"
6
6
 
7
7
  /usr/bin/sudo -u "$USER" -H BASH_ENV=/etc/rubybashrc -- "$@"
@@ -1,5 +1,5 @@
1
1
  # DO NOT EDIT - This file is generated per 'rake update_lists'
2
2
  module RakeCompilerDock
3
- PredefinedUsers = ["root", "daemon", "bin", "sys", "sync", "games", "man", "lp", "mail", "news", "uucp", "proxy", "www-data", "backup", "list", "irc", "gnats", "nobody", "_apt", "rvm"]
4
- PredefinedGroups = ["root", "daemon", "bin", "sys", "adm", "tty", "disk", "lp", "mail", "news", "uucp", "man", "proxy", "kmem", "dialout", "fax", "voice", "cdrom", "floppy", "tape", "sudo", "audio", "dip", "www-data", "backup", "operator", "list", "irc", "src", "gnats", "shadow", "utmp", "video", "sasl", "plugdev", "staff", "games", "users", "nogroup", "ssh", "rvm"]
3
+ PredefinedUsers = ["_apt", "adm", "backup", "bin", "daemon", "dbus", "ftp", "games", "gnats", "halt", "irc", "list", "lp", "mail", "man", "news", "nobody", "operator", "proxy", "root", "rubyuser", "shutdown", "sync", "sys", "systemd-network", "uucp", "www-data"]
4
+ PredefinedGroups = ["adm", "audio", "backup", "bin", "cdrom", "cgred", "daemon", "dbus", "dialout", "dip", "disk", "fax", "floppy", "ftp", "games", "gnats", "input", "irc", "kmem", "list", "lock", "lp", "mail", "man", "mem", "news", "nobody", "nogroup", "operator", "plugdev", "proxy", "root", "rubyuser", "sasl", "shadow", "src", "ssh", "ssh_keys", "staff", "sudo", "sys", "systemd-journal", "systemd-network", "tape", "tty", "users", "utempter", "utmp", "uucp", "video", "voice", "wheel", "www-data"]
5
5
  end
@@ -1,4 +1,4 @@
1
1
  module RakeCompilerDock
2
- VERSION = "1.4.0"
3
- IMAGE_VERSION = "1.4.0"
2
+ VERSION = "1.5.0.rc1"
3
+ IMAGE_VERSION = "1.5.0.rc1"
4
4
  end
@@ -26,7 +26,8 @@ module RakeCompilerDock
26
26
  #
27
27
  # Option +:platform+ can be set to a list of space separated values.
28
28
  # It selects the docker image(s) with an appropriate toolchain.
29
- # Allowed values are +:x86-mingw32+, +x64-mingw32+, +x86-linux+ or +x86_64-linux+.
29
+ # Allowed values are +aarch64-linux-gnu+, +arm-linux-gnu+, +arm64-darwin+, +x64-mingw-ucrt+,
30
+ # +x64-mingw32+, +x86-linux-gnu+, +x86-mingw32+, +x86_64-darwin+, +x86_64-linux-gnu+.
30
31
  # If the list contains multiple values, +cmd+ is consecutively executed in each of the docker images,
31
32
  # Option +:platform+ is ignored when +:rubyvm+ is set to +:jruby+.
32
33
  # Default is "x86-mingw32 x64-mingw32" .
@@ -17,7 +17,13 @@ Use rake-compiler-dock to enter an interactive shell session or add a task to yo
17
17
  # However we do the version check at runtime.
18
18
  # spec.required_ruby_version = '>= 1.9.2'
19
19
 
20
- spec.files = `git ls-files -z`.split("\x0")
20
+ spec.files = begin
21
+ `git ls-files -z`.split("\x0")
22
+ rescue StandardError => e
23
+ warn "WARNING: Could not discover files for gemspec: #{e}"
24
+ []
25
+ end
26
+
21
27
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
28
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
29
  spec.require_paths = ["lib"]
@@ -18,7 +18,25 @@ else
18
18
  ext.ext_dir = 'ext/mri'
19
19
  ext.lib_dir = 'lib/rcd_test'
20
20
  ext.cross_compile = true
21
- ext.cross_platform = %w[x86-mingw32 x64-mingw-ucrt x64-mingw32 x86-linux x86_64-linux aarch64-linux arm-linux x86_64-darwin arm64-darwin]
21
+ ext.cross_platform = %w[
22
+ aarch64-linux
23
+ aarch64-linux-gnu
24
+ aarch64-linux-musl
25
+ arm-linux
26
+ arm-linux-gnu
27
+ arm-linux-musl
28
+ arm64-darwin
29
+ x64-mingw-ucrt
30
+ x64-mingw32
31
+ x86-linux
32
+ x86-linux-gnu
33
+ x86-linux-musl
34
+ x86-mingw32
35
+ x86_64-darwin
36
+ x86_64-linux
37
+ x86_64-linux-gnu
38
+ x86_64-linux-musl
39
+ ]
22
40
  end
23
41
  end
24
42
 
@@ -40,6 +40,19 @@ rcdt_darwin_builtin_available_eh(VALUE self)
40
40
  #endif
41
41
  }
42
42
 
43
+ static VALUE
44
+ rcdt_largefile_op_removed_from_musl(VALUE self)
45
+ {
46
+ // Reference a symbol that was removed in Musl 1.24 🙄
47
+ // https://github.com/sparklemotion/sqlite3-ruby/issues/434
48
+ #ifdef __linux__
49
+ posix_fallocate(STDERR_FILENO, 0, 0);
50
+ return Qtrue;
51
+ #else
52
+ return Qfalse;
53
+ #endif
54
+ }
55
+
43
56
  void
44
57
  Init_rcd_test_ext(void)
45
58
  {
@@ -48,4 +61,5 @@ Init_rcd_test_ext(void)
48
61
  rb_define_singleton_method(rb_mRcdTest, "darwin_builtin_available?", rcdt_darwin_builtin_available_eh, 0);
49
62
  rb_define_singleton_method(rb_mRcdTest, "isinf?", rcdt_isinf_eh, 1);
50
63
  rb_define_singleton_method(rb_mRcdTest, "isnan?", rcdt_isnan_eh, 1);
64
+ rb_define_singleton_method(rb_mRcdTest, "largefile_op_removed_from_musl", rcdt_largefile_op_removed_from_musl, 0);
51
65
  }
@@ -1,6 +1,11 @@
1
1
  #ifndef RCD_TEST_EXT_H
2
2
  #define RCD_TEST_EXT_H 1
3
3
 
4
+ // see rcdt_largefile_op_removed_from_musl
5
+ #define _LARGEFILE_SOURCE 1
6
+ #define _FILE_OFFSET_BITS 64
7
+ #include <fcntl.h>
8
+
4
9
  #include "ruby.h"
5
10
 
6
11
  #endif /* RCD_TEST_EXT_H */
@@ -12,16 +12,17 @@ Gem::Specification.new do |spec|
12
12
  spec.required_ruby_version = ">= 2.0.0"
13
13
  spec.license = "MIT"
14
14
 
15
- # Specify which files should be added to the gem when it is released.
16
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
19
- end
15
+ spec.files = [
16
+ "ext/java/RcdTestExtService.java",
17
+ "ext/java/RubyRcdTest.java",
18
+ "ext/mri/extconf.rb",
19
+ "ext/mri/rcd_test_ext.c",
20
+ "ext/mri/rcd_test_ext.h",
21
+ "lib/rcd_test.rb",
22
+ ]
23
+
20
24
  spec.bindir = "exe"
21
25
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
22
26
  spec.require_paths = ["lib"]
23
27
  spec.extensions = ["ext/mri/extconf.rb"]
24
-
25
- # Uncomment to register a new dependency of your gem
26
- # spec.add_dependency "example-gem", "~> 1.0"
27
28
  end
@@ -22,10 +22,17 @@ class TestBasic < Minitest::Test
22
22
 
23
23
  def test_floating_point_classification_macros
24
24
  skip("jruby should not run libc-specific tests") if RUBY_ENGINE == "jruby"
25
+
25
26
  refute(RcdTest.isinf?(42.0))
26
27
  assert(RcdTest.isinf?(Float::INFINITY))
27
28
  refute(RcdTest.isnan?(42.0))
28
29
  assert(RcdTest.isnan?(Float::NAN))
29
30
  end
30
31
 
32
+ def test_largefile_op_removed_from_musl
33
+ skip("jruby should not run libc-specific tests") if RUBY_ENGINE == "jruby"
34
+
35
+ is_linux = RUBY_PLATFORM.include?("linux")
36
+ assert_equal(is_linux, RcdTest.largefile_op_removed_from_musl)
37
+ end
31
38
  end
data/test/test_starter.rb CHANGED
@@ -11,8 +11,8 @@ class TestStarter < Test::Unit::TestCase
11
11
  def test_make_valid_user_name
12
12
  assert_equal "mouse-click", Starter.make_valid_user_name("Mouse-Click")
13
13
  assert_equal "very_very_very_l-ame_with_spaces", Starter.make_valid_user_name("Very very very long name with spaces")
14
- assert_equal "_nobody", Starter.make_valid_user_name("nobody")
15
- assert_equal "_rvm", Starter.make_valid_user_name("rvm")
14
+ assert_equal "_halt", Starter.make_valid_user_name("halt")
15
+ assert_equal "_rubyuser", Starter.make_valid_user_name("rubyuser")
16
16
  assert_equal "staff", Starter.make_valid_user_name("staff")
17
17
  assert_equal "a", Starter.make_valid_user_name("a")
18
18
  assert_equal "_", Starter.make_valid_user_name("")
@@ -22,8 +22,8 @@ class TestStarter < Test::Unit::TestCase
22
22
  def test_make_valid_group_name
23
23
  assert_equal "mouse-click", Starter.make_valid_group_name("Mouse-Click")
24
24
  assert_equal "very_very_very_l-ame_with_spaces", Starter.make_valid_group_name("Very very very long name with spaces")
25
- assert_equal "nobody", Starter.make_valid_group_name("nobody")
26
- assert_equal "_rvm", Starter.make_valid_group_name("rvm")
25
+ assert_equal "halt", Starter.make_valid_group_name("halt")
26
+ assert_equal "_rubyuser", Starter.make_valid_group_name("rubyuser")
27
27
  assert_equal "_staff", Starter.make_valid_group_name("staff")
28
28
  assert_equal "a", Starter.make_valid_group_name("a")
29
29
  assert_equal "_", Starter.make_valid_group_name("")
@@ -113,7 +113,7 @@ class TestStarter < Test::Unit::TestCase
113
113
  assert(Starter.container_jrubyvm?({:rubyvm => "jruby"}))
114
114
  assert(Starter.container_jrubyvm?({:platform => "jruby"}))
115
115
  refute(Starter.container_jrubyvm?({:rubyvm => "mri"}))
116
- refute(Starter.container_jrubyvm?({:platform => "x86_64-linux"}))
116
+ refute(Starter.container_jrubyvm?({:platform => "x86_64-linux-gnu"}))
117
117
  end
118
118
 
119
119
  def test_platforms
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-compiler-dock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Kanis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-27 00:00:00.000000000 Z
11
+ date: 2024-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,10 +84,9 @@ files:
84
84
  - build/gem_helper.rb
85
85
  - build/math_h.patch
86
86
  - build/mk_i686.rb
87
+ - build/mk_musl_cross.sh
87
88
  - build/mk_osxcross.sh
88
89
  - build/parallel_docker_build.rb
89
- - build/patches/ruby-2.5.9/no_sendfile.patch
90
- - build/patches/ruby-3.1.3/no_sendfile.patch
91
90
  - build/patches2/rake-compiler-1.2.5/0004-Enable-build-of-static-libruby.patch
92
91
  - build/rcd-env.sh
93
92
  - build/runas
@@ -137,9 +136,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
136
  version: '0'
138
137
  required_rubygems_version: !ruby/object:Gem::Requirement
139
138
  requirements:
140
- - - ">="
139
+ - - ">"
141
140
  - !ruby/object:Gem::Version
142
- version: '0'
141
+ version: 1.3.1
143
142
  requirements: []
144
143
  rubygems_version: 3.4.19
145
144
  signing_key:
@@ -1,24 +0,0 @@
1
- diff --git a/configure b/configure
2
- index ebe3d8c..a336b73 100755
3
- --- a/configure
4
- +++ b/configure
5
- @@ -18943,7 +18943,6 @@ do :
6
- ac_fn_c_check_func "$LINENO" "sendfile" "ac_cv_func_sendfile"
7
- if test "x$ac_cv_func_sendfile" = xyes; then :
8
- cat >>confdefs.h <<_ACEOF
9
- -#define HAVE_SENDFILE 1
10
- _ACEOF
11
-
12
- fi
13
- diff --git a/io.c b/io.c
14
- index 82c5940538..a8d3661ec8 100644
15
- --- a/io.c
16
- +++ b/io.c
17
- @@ -10721,7 +10721,6 @@ nogvl_copy_stream_wait_write(struct copy_stream_struct *stp)
18
- }
19
-
20
- #if defined HAVE_COPY_FILE_RANGE || (defined __linux__ && defined __NR_copy_file_range)
21
- -# define USE_COPY_FILE_RANGE
22
- #endif
23
-
24
- #ifdef USE_COPY_FILE_RANGE
@@ -1,24 +0,0 @@
1
- diff --git a/configure b/configure
2
- index ebe3d8c..a336b73 100755
3
- --- a/configure
4
- +++ b/configure
5
- @@ -18943,7 +18943,6 @@ do :
6
- ac_fn_c_check_func "$LINENO" "sendfile" "ac_cv_func_sendfile"
7
- if test "x$ac_cv_func_sendfile" = xyes; then :
8
- cat >>confdefs.h <<_ACEOF
9
- -#define HAVE_SENDFILE 1
10
- _ACEOF
11
-
12
- fi
13
- diff --git a/io.c b/io.c
14
- index 48592ac51a..2635ac8ec6 100644
15
- --- a/io.c
16
- +++ b/io.c
17
- @@ -11111,6 +11111,7 @@ nogvl_copy_stream_wait_write(struct copy_stream_struct *stp)
18
- return 0;
19
- }
20
-
21
- +#undef USE_COPY_FILE_RANGE
22
- #ifdef USE_COPY_FILE_RANGE
23
-
24
- static ssize_t