rake-compiler-dock 1.0.1 → 1.2.1

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/ci.yml +168 -0
  4. data/.gitignore +11 -1
  5. data/Dockerfile.jruby +7 -6
  6. data/Dockerfile.mri.erb +170 -73
  7. data/History.md +42 -0
  8. data/README.md +95 -36
  9. data/Rakefile +45 -10
  10. data/build/math_h.patch +189 -0
  11. data/build/parallel_docker_build.rb +7 -3
  12. data/build/patches/{ruby-2.5.7 → ruby-2.5.9}/no_sendfile.patch +0 -0
  13. data/build/patches/{ruby-2.7.0 → ruby-3.1.0}/no_sendfile.patch +6 -6
  14. data/build/patches2/rake-compiler-1.1.6/0004-Enable-build-of-static-libruby.patch +28 -0
  15. data/build/rcd-env.sh +6 -0
  16. data/build/runas +1 -8
  17. data/build/sudoers +1 -1
  18. data/lib/rake_compiler_dock/starter.rb +3 -2
  19. data/lib/rake_compiler_dock/version.rb +2 -2
  20. data/mingw64-ucrt/Dockerfile +62 -0
  21. data/mingw64-ucrt/binutils-mingw-w64-ignore-check-errors.patch +13 -0
  22. data/mingw64-ucrt/gcc-mingw-w64-only-c-c++.patch +13 -0
  23. data/mingw64-ucrt/mingw-w64-enable-ucrt.patch +22 -0
  24. data/rake-compiler-dock.gemspec +2 -2
  25. data/test/env/Dockerfile.alpine +17 -0
  26. data/test/env/Dockerfile.centos +22 -0
  27. data/test/env/Dockerfile.debian +24 -0
  28. data/test/rcd_test/Gemfile +11 -0
  29. data/test/rcd_test/Rakefile +75 -0
  30. data/test/rcd_test/ext/java/RcdTestExtService.java +19 -0
  31. data/test/rcd_test/ext/java/RubyRcdTest.java +16 -0
  32. data/test/rcd_test/ext/mri/extconf.rb +23 -0
  33. data/test/rcd_test/ext/mri/rcd_test_ext.c +51 -0
  34. data/test/rcd_test/ext/mri/rcd_test_ext.h +6 -0
  35. data/test/rcd_test/lib/rcd_test.rb +6 -0
  36. data/test/rcd_test/rcd_test.gemspec +27 -0
  37. data/test/rcd_test/test/test_basic.rb +31 -0
  38. data/test/test_environment_variables.rb +56 -31
  39. data/test/test_parallel_docker_build.rb +19 -6
  40. data.tar.gz.sig +0 -0
  41. metadata +79 -19
  42. metadata.gz.sig +0 -0
  43. data/build/patches2/hoe-3.20.0/0001-Load-encrypted-private-key-using-ENV-GEM_PRIVATE_KEY.patch +0 -32
  44. data/build/patches2/rake-compiler-1.1.0/0001-Allow-parallel-builds-of-cross-rubies.patch +0 -119
  45. data/build/patches2/rake-compiler-1.1.0/0001-Enable-build-of-static-libruby.patch +0 -28
  46. data/build/patches2/rake-compiler-1.1.0/0001-Fix-determining-of-ruby-versions-in-rake-native-gem.patch +0 -44
  47. data/build/patches2/rake-compiler-1.1.0/0002-Extend-mingw-search-pattern-to-find-x86_64-gcc.patch +0 -26
  48. data/build/patches2/rake-compiler-1.1.0/0002-Strip-cross-built-shared-library-files-while-linking.patch +0 -29
  49. data/build/patches2/ruby-2.7.0/ruby2_keywords.patch +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cfdfefd55e7a9101359d39e3aaed0e8a63c046b0a1952efe5d291032b582b37
4
- data.tar.gz: cc50befca4c133b28bc13834a1c619250bd1aa4d7743e95fcfef47cd62330082
3
+ metadata.gz: 99e2b1ce6f914bd9b6449320d1c65bb5ac3cdd7f9afcf0189ee15a48e0bd8aac
4
+ data.tar.gz: 661f6b93c01a36993f89f121d1316d999c3e2f61fa7d577660a1e9d6a5898ff4
5
5
  SHA512:
6
- metadata.gz: 8ed46ae89b00549dba2a66a7b079e2d7977f4031fcf38658f4f030bf6923a1b7e49da02986635766f7d0bd86a1bf4ff7f6252ea2d6d79dba86c00488e2a928fe
7
- data.tar.gz: 193b8d63b2d747f652dd33e10b7c7c950ad92b46eff8067dfe14f11a18b126d90049dc7ea1ec57689f6fe3a38eb3358e8e3f8ffdf50dcbe3bdfb41b6d8db1886
6
+ metadata.gz: 3a4639688aeeb8c3b6d0142fadcf6c088f86f3672aca2873df1af672b22b7cff93245905ac6b00aac0c4467f495a5df6d9309f3660bbf27ee8f98d3dc47d8b92
7
+ data.tar.gz: bbc042289e0ad041c42a5b6fd13ee55930546535505e59d310c11d7b9a0130718f5c84f78bc6b539437b58e1329ad2a5a2e082125fffeefd40f6173df739eab1
checksums.yaml.gz.sig ADDED
Binary file
@@ -0,0 +1,168 @@
1
+ name: Build docker images
2
+ concurrency:
3
+ group: "${{github.workflow}}-${{github.ref}}"
4
+ cancel-in-progress: true
5
+ on: [push, pull_request]
6
+
7
+ jobs:
8
+ # These jobs use Buildx layer caching
9
+ docker_build:
10
+ name: Build
11
+
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ include:
16
+ - platform: x86-mingw32
17
+ - platform: x64-mingw-ucrt
18
+ - platform: x64-mingw32
19
+ - platform: x86-linux
20
+ - platform: x86_64-linux
21
+ - platform: x86_64-darwin
22
+ - platform: arm64-darwin
23
+ - platform: arm-linux
24
+ - platform: aarch64-linux
25
+ - platform: jruby
26
+
27
+ runs-on: ubuntu-latest
28
+ env:
29
+ PLATFORM: ${{ matrix.platform }}
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+
33
+ - name: Cache Docker layers
34
+ uses: actions/cache@v2
35
+ with:
36
+ path: tmp/build-cache
37
+ key: ${{ runner.os }}-${{ matrix.platform }}-buildx-${{ github.sha }}
38
+ restore-keys: |
39
+ ${{ runner.os }}-${{ matrix.platform }}-buildx
40
+
41
+ - uses: ruby/setup-ruby@v1
42
+ with:
43
+ ruby-version: "3.0"
44
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
45
+
46
+ - name: Build docker image
47
+ run: |
48
+ docker buildx create --driver docker-container --use
49
+ bundle exec rake build:${PLATFORM} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new --load"
50
+
51
+ - name: Move build cache and remove outdated layers
52
+ run: |
53
+ rm -rf tmp/build-cache
54
+ mv tmp/build-cache-new tmp/build-cache
55
+
56
+ - name: Build rcd_test.gem
57
+ run: |
58
+ gem build rake-compiler-dock.gemspec
59
+ gem install -l rake-compiler-dock-*.gem
60
+ cd test/rcd_test/
61
+ bundle install
62
+ bundle exec rake gem:${PLATFORM}
63
+
64
+ - name: Upload binary gem
65
+ uses: actions/upload-artifact@v2
66
+ with:
67
+ name: gem-${{ matrix.platform }}
68
+ path: test/rcd_test/pkg/*-*-*.gem
69
+
70
+ - name: Upload source gem
71
+ uses: actions/upload-artifact@v2
72
+ if: matrix.platform == 'jruby'
73
+ with:
74
+ name: gem-ruby
75
+ path: test/rcd_test/pkg/*-?.?.?.gem
76
+
77
+
78
+ job_test_native:
79
+ name: Test
80
+ needs: docker_build
81
+ strategy:
82
+ fail-fast: false
83
+ matrix:
84
+ include:
85
+ - os: windows
86
+ ruby: "3.0"
87
+ platform: x64-mingw32
88
+ - os: windows
89
+ ruby: "2.4"
90
+ platform: x64-mingw32
91
+ - os: macos
92
+ ruby: "3.0"
93
+ platform: x86_64-darwin
94
+ - os: macos
95
+ ruby: "2.4"
96
+ platform: x86_64-darwin
97
+ - os: ubuntu
98
+ ruby: "3.0"
99
+ platform: x86_64-linux
100
+ - os: ubuntu
101
+ ruby: "2.4"
102
+ platform: x86_64-linux
103
+ - os: ubuntu
104
+ ruby: jruby-head
105
+ platform: jruby
106
+ - os: ubuntu
107
+ ruby: "3.0"
108
+ platform: ruby
109
+
110
+ runs-on: ${{ matrix.os }}-latest
111
+ steps:
112
+ - uses: actions/checkout@v2
113
+ - name: Set up Ruby
114
+ uses: ruby/setup-ruby@v1
115
+ with:
116
+ ruby-version: ${{ matrix.ruby }}
117
+
118
+ - run: ruby --version
119
+
120
+ - name: Download gem from build job
121
+ uses: actions/download-artifact@v2
122
+ with:
123
+ name: gem-${{ matrix.platform }}
124
+
125
+ - run: gem install --local *.gem --verbose
126
+
127
+ - name: Run tests
128
+ run: |
129
+ cd test/rcd_test/
130
+ bundle install
131
+ ruby -rrcd_test -S rake test
132
+
133
+ job_test_multiarch:
134
+ name: Test
135
+ needs: docker_build
136
+ strategy:
137
+ fail-fast: false
138
+ matrix:
139
+ include:
140
+ - from_image: amd64/centos
141
+ platform: x86_64-linux
142
+ dockerfile: centos
143
+ - from_image: navikey/raspbian-bullseye
144
+ platform: arm-linux
145
+ dockerfile: debian
146
+ - from_image: arm64v8/ubuntu
147
+ platform: aarch64-linux
148
+ dockerfile: debian
149
+ - from_image: i386/alpine
150
+ platform: x86-linux
151
+ dockerfile: alpine
152
+ - from_image: arm32v6/alpine
153
+ platform: arm-linux
154
+ dockerfile: alpine
155
+
156
+ runs-on: ubuntu-latest
157
+ steps:
158
+ - uses: actions/checkout@v2
159
+ - name: Download gem from build job
160
+ uses: actions/download-artifact@v2
161
+ with:
162
+ name: gem-${{ matrix.platform }}
163
+
164
+ - name: Build image and Run tests
165
+ run: |
166
+ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
167
+ docker build --rm --build-arg from_image=${{matrix.from_image}} -t ruby-test -f test/env/Dockerfile.${{matrix.dockerfile}} .
168
+ docker run --rm -t --network=host -v `pwd`:/build ruby-test
data/.gitignore CHANGED
@@ -1,9 +1,14 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
+ /Dockerfile.mri.aarch64-linux
4
+ /Dockerfile.mri.arm-linux
5
+ /Dockerfile.mri.arm64-darwin
6
+ /Dockerfile.mri.arm64-linux
7
+ /Dockerfile.mri.x64-mingw32
3
8
  /Dockerfile.mri.x86-linux
4
9
  /Dockerfile.mri.x86-mingw32
10
+ /Dockerfile.mri.x86_64-darwin
5
11
  /Dockerfile.mri.x86_64-linux
6
- /Dockerfile.mri.x64-mingw32
7
12
  /Gemfile.lock
8
13
  /_yardoc/
9
14
  /coverage/
@@ -16,3 +21,8 @@
16
21
  *.o
17
22
  *.a
18
23
  mkmf.log
24
+ .byebug_history
25
+ test/rcd_test/Gemfile.lock
26
+ test/rcd_test/pkg/
27
+ test/rcd_test/tmp/
28
+ test/rcd_test/vendor/
data/Dockerfile.jruby CHANGED
@@ -1,7 +1,8 @@
1
- FROM ubuntu:18.04
1
+ FROM ubuntu:20.04
2
2
 
3
+ ENV DEBIAN_FRONTEND noninteractive
3
4
  RUN apt-get -y update && \
4
- apt-get install -y curl git-core xz-utils wget unzip sudo gpg dirmngr openjdk-11-jdk-headless && \
5
+ apt-get install -y curl git-core xz-utils wget unzip sudo gpg dirmngr openjdk-11-jdk-headless maven && \
5
6
  rm -rf /var/lib/apt/lists/*
6
7
 
7
8
  # Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000
@@ -13,7 +14,7 @@ RUN mkdir ~/.gnupg && \
13
14
  echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
14
15
 
15
16
  # install rvm, RVM 1.26.0+ has signed releases, source rvm for usage outside of package scripts
16
- RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
17
+ RUN gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
17
18
  (curl -L http://get.rvm.io | sudo bash) && \
18
19
  bash -c " \
19
20
  source /etc/rubybashrc && \
@@ -26,7 +27,7 @@ ENV BASH_ENV /etc/rubybashrc
26
27
  # install rubies and fix permissions on
27
28
  RUN bash -c " \
28
29
  export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
29
- for v in jruby-9.2.9.0 ; do \
30
+ for v in jruby-9.3.2.0 ; do \
30
31
  rvm install --binary \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \
31
32
  done && \
32
33
  rvm cleanup all && \
@@ -46,8 +47,8 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \
46
47
 
47
48
  USER root
48
49
 
49
- RUN bash -c "rvm alias create default jruby-9.2.9.0"
50
- RUN echo "rvm use jruby-9.2.9.0 > /dev/null" >> /etc/rubybashrc
50
+ RUN bash -c "rvm alias create default jruby-9.3.2.0"
51
+ RUN echo "rvm use jruby-9.3.2.0 > /dev/null" >> /etc/rubybashrc
51
52
 
52
53
  # Add rvm to the global bashrc
53
54
  RUN echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc
data/Dockerfile.mri.erb CHANGED
@@ -1,12 +1,37 @@
1
- FROM ubuntu:<%= platform=~/linux/ ? "16.04" : "18.04" %>
2
-
1
+ <%
2
+ image = case platform
3
+ when /x86_64-linux/ then "quay.io/pypa/manylinux2014_x86_64"
4
+ when /x86-linux/ then "quay.io/pypa/manylinux2014_i686"
5
+ else "ubuntu:20.04"
6
+ end
7
+ manylinux = !!(image =~ /manylinux/)
8
+ %>
9
+ FROM <%= image %>
10
+
11
+ <% if manylinux %>
12
+ # install packages which rvm will require
13
+ RUN yum install -y autoconf gcc-c++ libtool readline-devel sqlite-devel ruby openssl-devel xz cmake sudo less libffi-devel git wget
14
+
15
+ # Prepare sudo and delete sudo as alias to gosu
16
+ RUN rm -f /usr/local/bin/sudo && \
17
+ groupadd -r sudo && \
18
+ echo "%sudo ALL=(ALL) ALL" >> /etc/sudoers
19
+ <% else %>
20
+ ENV DEBIAN_FRONTEND noninteractive
3
21
  RUN apt-get -y update && \
4
- apt-get install -y curl git-core xz-utils build-essential wget unzip sudo gnupg2 dirmngr && \
22
+ apt-get install -y curl git-core xz-utils build-essential zlib1g-dev libreadline-dev libssl-dev wget unzip sudo gnupg2 dirmngr cmake pkg-config && \
5
23
  rm -rf /var/lib/apt/lists/*
24
+ <% end %>
6
25
 
7
26
  # Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000
8
- RUN groupadd -r rvm && useradd -r -g rvm -G sudo -p "" --create-home rvm && \
9
- echo "source /etc/profile.d/rvm.sh" >> /etc/rubybashrc
27
+ RUN groupadd -r rvm && useradd -r -g rvm -G sudo -p "" --create-home rvm
28
+
29
+ # Make sure rvm and later settings are available in interactive and non-interactive shells
30
+ RUN echo "source /etc/profile.d/rvm.sh" >> /etc/rubybashrc && \
31
+ echo "source /etc/rubybashrc" >> /etc/bashrc && \
32
+ echo "source /etc/rubybashrc" >> /etc/bash.bashrc
33
+ ENV BASH_ENV /etc/rubybashrc
34
+
10
35
  USER rvm
11
36
 
12
37
  RUN mkdir ~/.gnupg && \
@@ -14,20 +39,21 @@ RUN mkdir ~/.gnupg && \
14
39
  echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
15
40
 
16
41
  # install rvm, RVM 1.26.0+ has signed releases, source rvm for usage outside of package scripts
17
- RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
42
+ RUN gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
18
43
  (curl -L http://get.rvm.io | sudo bash) && \
19
44
  bash -c " \
20
45
  source /etc/rubybashrc && \
46
+ rvm autolibs disable && \
21
47
  rvmsudo rvm cleanup all "
22
48
 
23
49
  # Import patch files for ruby and gems
24
50
  COPY build/patches /home/rvm/patches/
25
- ENV BASH_ENV /etc/rubybashrc
26
51
 
27
52
  # install rubies and fix permissions on
53
+ ENV RVM_RUBIES 2.5.9 3.1.0
28
54
  RUN bash -c " \
29
55
  export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
30
- for v in 2.5.7 ; do \
56
+ for v in ${RVM_RUBIES} ; do \
31
57
  rvm install \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \
32
58
  done && \
33
59
  rvm cleanup all && \
@@ -38,7 +64,7 @@ RUN bash -c " \
38
64
  RUN echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \
39
65
  bash -c " \
40
66
  rvm all do gem update --system --no-document && \
41
- rvm all do gem install --no-document bundler 'bundler:~>1.16' rake-compiler hoe mini_portile rubygems-tasks mini_portile2 && \
67
+ rvm all do gem install --no-document bundler 'bundler:~>1.16' 'rake-compiler:1.1.6' hoe mini_portile rubygems-tasks mini_portile2 && \
42
68
  find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
43
69
 
44
70
  # Install rake-compiler's cross rubies in global dir instead of /root
@@ -48,66 +74,133 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \
48
74
 
49
75
  # Add cross compilers for Windows and Linux
50
76
  USER root
77
+
78
+ <% if platform=~/x64-mingw-ucrt/ %>
79
+ COPY --from=larskanis/mingw64-ucrt:20.04 \
80
+ /build/binutils-mingw-w64-x86-64_2.34-6ubuntu1.3+8.8_amd64.deb \
81
+ /build/g++-mingw-w64-x86-64_9.3.0-17ubuntu1~20.04+22~exp1ubuntu4_amd64.deb \
82
+ /build/gcc-mingw-w64-base_9.3.0-17ubuntu1~20.04+22~exp1ubuntu4_amd64.deb \
83
+ /build/gcc-mingw-w64-x86-64_9.3.0-17ubuntu1~20.04+22~exp1ubuntu4_amd64.deb \
84
+ /build/mingw-w64-common_7.0.0-2_all.deb \
85
+ /build/mingw-w64-x86-64-dev_7.0.0-2_all.deb \
86
+ /debs/
87
+ RUN dpkg -i /debs/*.deb
88
+
89
+ <% elsif !manylinux %>
51
90
  RUN apt-get -y update && \
52
- apt-get install -y moreutils <%
91
+ apt-get install -y <%
92
+ if platform=~/darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><%
93
+ if platform=~/aarch64-linux/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
94
+ if platform=~/arm-linux/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
53
95
  if platform=~/x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
54
- if platform=~/x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %><%
55
- if platform=~/x86-linux/ %> gcc-multilib g++-multilib <% end %> && \
96
+ if platform=~/x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
56
97
  rm -rf /var/lib/apt/lists/*
98
+ <% end %>
57
99
 
58
100
  RUN bash -c " \
59
- rvm alias create default 2.5.7 && \
101
+ rvm alias create default 3.1.0 && \
60
102
  rvm use default "
61
103
 
62
- <% if platform=~/linux/ %>
104
+ <% if manylinux %>
63
105
  # Create dev tools x86-linux-*
64
106
  COPY build/mk_i686.rb /root/
65
107
  RUN bash -c " \
66
108
  ruby /root/mk_i686.rb "
67
109
  <% end %>
68
110
 
69
- USER rvm
70
-
71
- COPY build/patches2 /home/rvm/patches/
72
- # Patch rake-compiler to build and install static libraries for Linux rubies
73
- RUN cd /usr/local/rvm/gems/ruby-2.5.7/gems/rake-compiler-1.1.0 && \
74
- ( git apply /home/rvm/patches/rake-compiler-1.1.0/*.patch || true )
75
- RUN cd /usr/local/rvm/gems/ruby-2.5.7/gems/hoe-3.20.0 && \
76
- ( git apply /home/rvm/patches/hoe-3.20.0/*.patch || true )
111
+ <% if platform=~/darwin/ %>
112
+ RUN git clone -q --depth=1 https://github.com/tpoechtrager/osxcross.git /opt/osxcross && rm -rf /opt/osxcross/.git && \
113
+ cd /opt/osxcross/tarballs && \
114
+ curl -L -o MacOSX11.1.sdk.tar.xz https://github.com/larskanis/MacOSX-SDKs/releases/download/11.1/MacOSX11.1.sdk.tar.xz && \
115
+ tar -xf MacOSX11.1.sdk.tar.xz -C . && \
116
+ cp -rf /usr/lib/llvm-10/include/c++ MacOSX11.1.sdk/usr/include/c++ && \
117
+ cp -rf /usr/include/x86_64-linux-gnu/c++/9/bits/ MacOSX11.1.sdk/usr/include/c++/v1/bits && \
118
+ tar -cJf MacOSX11.1.sdk.tar.xz MacOSX11.1.sdk && \
119
+ cd /opt/osxcross && \
120
+ UNATTENDED=1 SDK_VERSION=11.1 OSX_VERSION_MIN=10.13 USE_CLANG_AS=1 ./build.sh && \
121
+ ln -s /usr/bin/llvm-config-10 /usr/bin/llvm-config && \
122
+ ENABLE_COMPILER_RT_INSTALL=1 SDK_VERSION=11.1 ./build_compiler_rt.sh && \
123
+ rm -rf *~ build tarballs/*
124
+
125
+ RUN echo "export PATH=/opt/osxcross/target/bin:\$PATH" >> /etc/rubybashrc && \
126
+ echo "export MACOSX_DEPLOYMENT_TARGET=10.13" >> /etc/rubybashrc && \
127
+ echo "export OSXCROSS_MP_INC=1" >> /etc/rubybashrc
128
+
129
+ # Add links to build tools without target version kind of:
130
+ # arm64-apple-darwin-clang => arm64-apple-darwin20.1-clang
131
+ RUN rm /opt/osxcross/target/bin/*-apple-darwin-* ; \
132
+ find /opt/osxcross/target/bin/ -name '*-apple-darwin[0-9]*' | sort | while read f ; do d=`echo $f | sed s/darwin[0-9\.]*/darwin/`; echo $f '"$@"' | tee $d && chmod +x $d ; done
133
+
134
+ # There's no objdump in osxcross but we can use llvm's
135
+ RUN ln -s /usr/lib/llvm-10/bin/llvm-objdump /opt/osxcross/target/bin/x86_64-apple-darwin-objdump && \
136
+ ln -s /usr/lib/llvm-10/bin/llvm-objdump /opt/osxcross/target/bin/aarch64-apple-darwin-objdump
77
137
 
138
+ <% end %>
78
139
 
79
- # Patch ruby-2.7.0 for cross build
80
- USER root
81
- RUN curl -SL http://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0.tar.xz | tar -xJC /root/ && \
82
- cd /root/ruby-2.7.0 && \
83
- git apply /home/rvm/patches/ruby-2.7.0/*.patch && \
84
- cd .. && \
85
- mkdir -p /usr/local/rake-compiler/sources/ && \
86
- tar cjf /usr/local/rake-compiler/sources/ruby-2.7.0.tar.bz2 ruby-2.7.0 && \
87
- chown rvm /usr/local/rake-compiler -R && \
88
- rm -rf /root/ruby-2.7.0
140
+ # Patch rake-compiler to build and install static libraries for Linux rubies
89
141
  USER rvm
90
-
91
-
92
- ENV XRUBIES 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.2
93
-
94
- # First do downloads sequentially since they can not run in parallel
95
- # Then build all xruby versions in parallel
142
+ COPY build/patches2 /home/rvm/patches/
143
+ RUN bash -c " \
144
+ for v in ${RVM_RUBIES} ; do \
145
+ cd /usr/local/rvm/gems/ruby-\$v/gems/rake-compiler-1.1.6 && \
146
+ echo applying patches to ruby-\$v /home/rvm/patches/rake-compiler-1.1.6/*.patch && \
147
+ ( git apply /home/rvm/patches/rake-compiler-1.1.6/*.patch || true ) \
148
+ done "
149
+
150
+ # Patch rubies for cross build
151
+ #USER root
152
+ #RUN bash -c " \
153
+ # for v in 2.7.0 3.0.0 3.1.0 ; do \
154
+ # curl -SL http://cache.ruby-lang.org/pub/ruby/\${v:0:3}/ruby-\$v.tar.xz | tar -xJC /root/ && \
155
+ # cd /root/ruby-\$v && \
156
+ # git apply /home/rvm/patches/ruby-\$v/*.patch && \
157
+ # cd .. && \
158
+ # mkdir -p /usr/local/rake-compiler/sources/ && \
159
+ # tar cjf /usr/local/rake-compiler/sources/ruby-\$v.tar.bz2 ruby-\$v && \
160
+ # chown rvm /usr/local/rake-compiler -R && \
161
+ # rm -rf /root/ruby-\$v ; \
162
+ # done "
163
+ #USER rvm
164
+
165
+ <%
166
+ axrubies = if platform =~ /x64-mingw-ucrt/
167
+ [
168
+ # Rubyinstaller-3.1.0+ is platform x64-mingw-ucrt
169
+ ["3.1.0", "3.1.0", true],
170
+ ]
171
+ elsif platform =~ /x64-mingw32/
172
+ [
173
+ # Rubyinstaller prior to 3.1.0 is platform x64-mingw32
174
+ ["2.6.0:2.5.0:2.4.0", "2.5.9", false],
175
+ ["3.0.0:2.7.0", "3.1.0", true],
176
+ ]
177
+ else
178
+ [
179
+ # Build xruby versions prior ruby2_keywords in parallel using ruby-2.5
180
+ ["2.6.0:2.5.0:2.4.0", "2.5.9", false],
181
+ # Build xruby versions with ruby2_keywords in parallel using ruby-3.x
182
+ ["3.1.0:3.0.0:2.7.0", "3.1.0", true],
183
+ ]
184
+ end
185
+
186
+ axrubies.each do |xrubies, rvm, parallel| %>
187
+ ENV XRUBIES <%= xrubies %>
188
+
189
+ <% strip = '-s' if platform !~ /darwin/ %>
190
+ # Build xruby versions in parallel
96
191
  # Then cleanup all build artifacts
97
- RUN for rv in $XRUBIES; do \
98
- bash -c "rake-compiler prepare-sources VERSION=$rv HOST=x86_64-linux"; \
99
- done; \
100
- for rv in $XRUBIES; do \
101
- for host in <%= target %>; do \
102
- echo -n "'env MAKE=\"make V=0\" rake-compiler cross-ruby VERSION=$rv HOST=$host' " >> ~/xbuild_rubies; \
103
- done; \
104
- done && \
105
- cat ~/xbuild_rubies; \
106
- bash -c " \
107
- export CFLAGS='-s -O1 -fno-omit-frame-pointer -fno-fast-math' && \
108
- parallel -- $( cat ~/xbuild_rubies ) && \
192
+ RUN bash -c " \
193
+ rvm use <%= rvm %> && \
194
+ export CPPFLAGS='<%= "-D__USE_MINGW_ANSI_STDIO=1" if platform=~/x64-mingw-ucrt/ %>' && \
195
+ export CFLAGS='-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong <%= strip %>' && \
196
+ export LDFLAGS='-pipe <%= strip %>' && \
197
+ <%= "export LIBS='-l:libssp.a' &&" if platform =~ /mingw/ %> \
198
+ <%= "export CC=#{target}-clang &&" if platform =~ /darwin/ %> \
199
+ export MAKE='make V=1 <%= "-j`nproc`" if parallel %>' && \
200
+ rake-compiler cross-ruby VERSION=$XRUBIES HOST=<%= target %> && \
109
201
  rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources && \
110
202
  find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
203
+ <% end %>
111
204
 
112
205
  <% if platform=~/linux/ %>
113
206
  # Avoid linking against libruby shared object.
@@ -115,7 +208,7 @@ RUN for rv in $XRUBIES; do \
115
208
  RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.so | xargs rm
116
209
  RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby-static.a | while read f ; do cp $f `echo $f | sed s/-static//` ; done
117
210
  RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.a | while read f ; do ar t $f | xargs ar d $f ; done
118
- RUN find /usr/local/rake-compiler/ruby/*linux*/ -name mkmf.rb | while read f ; do sed -i ':a;N;$!ba;s/TRY_LINK = [^\n]*\n[^\n]*\n[^\n]*LOCAL_LIBS)/& -lruby-static/' $f ; done
211
+ RUN find /usr/local/rake-compiler/ruby/*linux*/ -name mkmf.rb | while read f ; do sed -i ':a;N;$!ba;s/TRY_LINK = [^\n]*\n[^\n]*\n[^\n]*LOCAL_LIBS)/& -lruby-static -lpthread -lrt -ldl <% if platform=~/x86/ %> -lcrypt <% end %>/' $f ; done
119
212
  <% end %>
120
213
 
121
214
  <% if platform=~/mingw/ %>
@@ -129,18 +222,9 @@ RUN find /usr/local/rake-compiler/ruby -name *msvcrt-ruby*.dll.a | while read f
129
222
 
130
223
  USER root
131
224
 
132
- # Add more libraries and tools to support cross build
133
- RUN <%
134
- if platform=~/x86-linux/ %> dpkg --add-architecture i386 && <% end %> \
135
- apt-get -y update && \
136
- apt-get install -y cmake <%
137
- if platform=~/x86-linux/ %> libc6-dev:i386 libudev-dev:i386 <% end %><%
138
- if platform=~/x86_64-linux/ %> libudev-dev <% end %> && \
139
- rm -rf /var/lib/apt/lists/*
225
+ # Fix paths in rake-compiler/config.yml
226
+ RUN sed -i -- "s:/root/.rake-compiler:/usr/local/rake-compiler:g" /usr/local/rake-compiler/config.yml
140
227
 
141
- # Fix paths in rake-compiler/config.yml and add rvm and mingw-tools to the global bashrc
142
- RUN sed -i -- "s:/root/.rake-compiler:/usr/local/rake-compiler:g" /usr/local/rake-compiler/config.yml && \
143
- echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc
144
228
 
145
229
  <% if platform=~/mingw/ %>
146
230
  # Install wrappers for strip commands as a workaround for "Protocol error" in boot2docker.
@@ -148,10 +232,6 @@ COPY build/strip_wrapper /root/
148
232
  RUN mv /usr/bin/<%= target %>-strip /usr/bin/<%= target %>-strip.bin && \
149
233
  ln /root/strip_wrapper /usr/bin/<%= target %>-strip
150
234
 
151
- # Don't link to winpthread.dll but link static, since the DLL is not distributed with RubyInstaller
152
- RUN find / -name libwinpthread.dll.a | xargs rm
153
- RUN find / -name libwinpthread-1.dll | xargs rm
154
-
155
235
  # Use posix pthread for mingw so that C++ standard library for thread could be
156
236
  # available such as std::thread, std::mutex, so on.
157
237
  # https://sourceware.org/pthreads-win32/
@@ -159,22 +239,39 @@ RUN printf "1\n" | update-alternatives --config <%= target %>-gcc && \
159
239
  printf "1\n" | update-alternatives --config <%= target %>-g++
160
240
  <% end %>
161
241
 
162
- <% if platform=~/linux/ %>
163
- # Make the system to have GLIBC 2.12 instead of 2.23 so that
164
- # generated ruby package can run on CentOS 6 with GLIBC 2.12
165
- RUN sed -i 's/__GLIBC_MINOR__\t[0-9][0-9]/__GLIBC_MINOR__\t12/' /usr/include/features.h
242
+ <% if manylinux %>
243
+ # Enable modern compiler toolset of manylinux image
244
+ RUN echo "export PATH=\$DEVTOOLSET_ROOTPATH/usr/bin:\$PATH" >> /etc/rubybashrc
245
+
246
+ # Add prefixed versions of compiler tools
247
+ RUN for f in addr2line gcc gcov-tool ranlib ar dwp gcc-ranlib nm readelf as elfedit gcc-ar gprof objcopy size c++filt g++ gcov ld objdump strings cpp gcc-nm pkg-config strip ; do ln -sf $DEVTOOLSET_ROOTPATH/usr/bin/$f $DEVTOOLSET_ROOTPATH/usr/bin/<%= target %>-$f ; done
248
+
249
+ # ruby-2.5 links to libcrypt, which isn't necessary for extensions
250
+ RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/-lcrypt//' $f ; done
251
+
252
+ # Use builtin functions of newer gcc to avoid linker issues on Musl based Linux
253
+ COPY build/math_h.patch /root/
254
+ RUN cd /usr/include/ && \
255
+ patch -p1 < /root/math_h.patch
256
+ <% end %>
257
+
258
+ <% if platform=~/arm64-darwin/ %>
259
+ # Add a arm64 darwin target as alternative to aarch64
260
+ RUN grep -E 'rbconfig-aarch64-darwin' /usr/local/rake-compiler/config.yml | sed 's/rbconfig-[a-z0-9_]*-darwin/rbconfig-<%= platform %>/' >> /usr/local/rake-compiler/config.yml
166
261
  <% end %>
167
262
 
168
263
  # Install SIGINT forwarder
169
264
  COPY build/sigfw.c /root/
170
- RUN gcc $HOME/sigfw.c -o /usr/local/bin/sigfw
265
+ RUN gcc $HOME/sigfw.c -o /usr/bin/sigfw
171
266
 
172
267
  # Install user mapper
173
- COPY build/runas /usr/local/bin/
268
+ COPY build/runas /usr/bin/
269
+ COPY build/rcd-env.sh /etc/profile.d/
270
+ RUN echo "source /etc/profile.d/rcd-env.sh" >> /etc/rubybashrc
174
271
 
175
272
  # Install sudoers configuration
176
273
  COPY build/sudoers /etc/sudoers.d/rake-compiler-dock
177
274
 
178
- ENV RUBY_CC_VERSION 2.7.0:2.6.0:2.5.0:2.4.0:2.3.0:2.2.2
275
+ ENV RUBY_CC_VERSION 3.1.0:3.0.0:2.7.0:2.6.0:2.5.0:2.4.0
179
276
 
180
277
  CMD bash
data/History.md CHANGED
@@ -1,3 +1,45 @@
1
+ 1.2.1 / 2022-03-17
2
+ ------------------
3
+
4
+ * Fix testing for ruby C-API functions in mkmf. #65, #67
5
+ * Use openjdk 11 to make maven work on ubuntu 20.04. #64
6
+ * Remove x86_64-w64-mingw32-pkg-config from the x64-mingw-ucrt image. #63
7
+ * Add a patch for math.h to use gcc builtins and to improve compat with musl based systems. #42
8
+
9
+
10
+ 1.2.0 / 2022-01-04
11
+ ------------------
12
+
13
+ * Add Ruby-3.1 as native rvm and cross ruby versions.
14
+ * Remove Ruby-2.2 and 2.3 from RUBY_CC_VERSION and cross rubies.
15
+ * Add Linux cross build targets "arm-linux" and "aarch64-linux".
16
+ * Add cross build target "x64-mingw-ucrt" for ruby-3.1 on Windows.
17
+ * Add `wget` and `git` to Linux image.
18
+ * Add `maven` to JRuby image.
19
+ * Update JRuby to 9.3.2.0
20
+ * Fix default value of platform for JRuby. #50
21
+ * Update openjdk version from 14 to 17
22
+ * Add a test gem and build and run it on all supported platforms on Github Actions.
23
+ * Allow alternative build command like `docker buildx build`
24
+ * Provide compiler-rt libraries for darwin builds. #60
25
+ * Extract build environment from `runas` into `rcd-env.sh` and loaded it in non-interactive non-login shells. #57
26
+
27
+
28
+ 1.1.0 / 2020-12-29
29
+ ------------------
30
+
31
+ * Use ManyLinux2014 as docker base image for linux targets.
32
+ That way compatibility to very old linux dists can be provided, while still using modern compilers.
33
+ * Add macOS cross build targets "x86_64-darwin" and "arm64-darwin".
34
+ They are based on MacOSX-SDK-11.1
35
+ * Add Ruby-3.0 as native rvm and cross ruby version.
36
+ * Remove Ruby-2.2 from RUBY_CC_VERSION and cross rubies.
37
+ * Update to Ubuntu-20.04 for Mingw and JRuby targets.
38
+ * Set `ExtensionTask#no_native=true` to fix issues with cross_compiling callback not being called.
39
+ See discussion here: https://github.com/rake-compiler/rake-compiler/pull/171
40
+ * Allow setting an alternative dockerhub user per `DOCKERHUB_USER`.
41
+
42
+
1
43
  1.0.1 / 2020-01-13
2
44
  ------------------
3
45