rake-compiler-dock 0.7.2 → 1.2.0

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 (46) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +4 -0
  3. data/.github/workflows/ci.yml +168 -0
  4. data/.gitignore +14 -0
  5. data/Dockerfile.jruby +12 -7
  6. data/Dockerfile.mri.erb +271 -0
  7. data/History.md +63 -0
  8. data/README.md +138 -27
  9. data/Rakefile +71 -4
  10. data/{lib/rake_compiler_dock → build}/gem_helper.rb +0 -15
  11. data/build/parallel_docker_build.rb +106 -0
  12. data/build/patches/{ruby-2.5.3 → ruby-2.5.9}/no_sendfile.patch +1 -1
  13. data/build/patches/ruby-3.1.0/no_sendfile.patch +24 -0
  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 -6
  17. data/build/sudoers +1 -1
  18. data/lib/rake_compiler_dock/docker_check.rb +12 -6
  19. data/lib/rake_compiler_dock/starter.rb +69 -53
  20. data/lib/rake_compiler_dock/version.rb +2 -2
  21. data/lib/rake_compiler_dock.rb +10 -0
  22. data/mingw64-ucrt/Dockerfile +62 -0
  23. data/mingw64-ucrt/binutils-mingw-w64-ignore-check-errors.patch +13 -0
  24. data/mingw64-ucrt/gcc-mingw-w64-only-c-c++.patch +13 -0
  25. data/mingw64-ucrt/mingw-w64-enable-ucrt.patch +22 -0
  26. data/rake-compiler-dock.gemspec +2 -2
  27. data/test/env/Dockerfile.alpine +17 -0
  28. data/test/env/Dockerfile.centos +17 -0
  29. data/test/env/Dockerfile.debian +24 -0
  30. data/test/rcd_test/Gemfile +11 -0
  31. data/test/rcd_test/Rakefile +74 -0
  32. data/test/rcd_test/ext/java/RcdTestExtService.java +19 -0
  33. data/test/rcd_test/ext/java/RubyRcdTest.java +16 -0
  34. data/test/rcd_test/ext/mri/extconf.rb +20 -0
  35. data/test/rcd_test/ext/mri/rcd_test_ext.c +35 -0
  36. data/test/rcd_test/ext/mri/rcd_test_ext.h +6 -0
  37. data/test/rcd_test/lib/rcd_test.rb +6 -0
  38. data/test/rcd_test/rcd_test.gemspec +27 -0
  39. data/test/rcd_test/test/test_basic.rb +22 -0
  40. data/test/test_environment_variables.rb +56 -31
  41. data/test/test_parallel_docker_build.rb +70 -0
  42. data.tar.gz.sig +1 -0
  43. metadata +83 -14
  44. metadata.gz.sig +0 -0
  45. data/Dockerfile.mri +0 -122
  46. data/build/patches/rake-compiler-1.0.7/enable-static.diff +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f8966fb1c1fe4aec8b3e82b034c7f1327cefc6c632d5e7d5308d1edbf5d5d58
4
- data.tar.gz: 5d8f0f1075017802cbe0592ea481683f4958806ce3e1fb47f12fe1e2e5763679
3
+ metadata.gz: c37670b488779329186dd39d128aa4b8be99d4394138a9df57d1d2862acf2979
4
+ data.tar.gz: 397b5fb2a1cde23888eda7640a953051452b267c0ebda2d14e64bde954b1d97e
5
5
  SHA512:
6
- metadata.gz: 87eb25a8c230147d54c119e4738c2c95a9afe49d88c3dc463cc64f712fae18d9b237cfe7270292d6044969c7fcd0f215a33b5e74ad8b2578c0823d7dc1496039
7
- data.tar.gz: 42a89f7a0f73263d06165e0d12da16b2a0c7c58618641e45734d04df3c8c1dad9891502169c1123dcb47bd0cfb232e115eb1159847d7fecd6d9774cf3733b1ca
6
+ metadata.gz: 36bbf85db406a3d1a34997a110847fdcfca2fa61ae6d4f21430c931d91ee8880c0973172dfa531bc1a8284043ae5c51455411b3baee98ac589cbfafc30cba1e5
7
+ data.tar.gz: 92c54b094f5a8049201ee538a36d8c9f4c5e8a221476380231e4ba42f0dc4b92ee3b8e0d2dba83acfaa08d6f6cc21a2b5516ddcb9675f5e4b080db775f92d4c1
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,4 @@
1
+ Y�-��`����9����+���^�FpP�I=�[�5��z��F+���oH��rɾv�v�]��>��F���G�x��h0�G����f�Ze��l�d���1
2
+ ���@�`ѐ���R�H�{��^�� b���%� �}_�~��7̎s�/V(�ț d��a|�����9���N/�g� ��-�<n2�&�b��R{���$'Ҡ���g��m���E�8'��
3
+ \B�VS��1�l��]?Y��}+�
4
+ C�Uפx��(a���t�'.#����WW�\��Ԟ�-0��ό__L;'�w<��\�l�� #�/�������|�ءۙ46�� ���ed|��=,��G�eܗ7A}�H����6��+
@@ -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,5 +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
8
+ /Dockerfile.mri.x86-linux
9
+ /Dockerfile.mri.x86-mingw32
10
+ /Dockerfile.mri.x86_64-darwin
11
+ /Dockerfile.mri.x86_64-linux
3
12
  /Gemfile.lock
4
13
  /_yardoc/
5
14
  /coverage/
@@ -12,3 +21,8 @@
12
21
  *.o
13
22
  *.a
14
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,16 +1,21 @@
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-17-jdk-headless maven && \
6
+ rm -rf /var/lib/apt/lists/*
5
7
 
6
8
  # Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000
7
9
  RUN groupadd -r rvm && useradd -r -g rvm -G sudo -p "" --create-home rvm && \
8
10
  echo "source /etc/profile.d/rvm.sh" >> /etc/rubybashrc
9
11
  USER rvm
10
12
 
13
+ RUN mkdir ~/.gnupg && \
14
+ echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
15
+
11
16
  # install rvm, RVM 1.26.0+ has signed releases, source rvm for usage outside of package scripts
12
- RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
13
- (curl -L http://get.rvm.io | sudo bash -s stable) && \
17
+ RUN gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
18
+ (curl -L http://get.rvm.io | sudo bash) && \
14
19
  bash -c " \
15
20
  source /etc/rubybashrc && \
16
21
  rvmsudo rvm cleanup all "
@@ -22,7 +27,7 @@ ENV BASH_ENV /etc/rubybashrc
22
27
  # install rubies and fix permissions on
23
28
  RUN bash -c " \
24
29
  export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
25
- for v in jruby-9.2.5.0 ; do \
30
+ for v in jruby-9.3.2.0 ; do \
26
31
  rvm install --binary \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \
27
32
  done && \
28
33
  rvm cleanup all && \
@@ -42,8 +47,8 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \
42
47
 
43
48
  USER root
44
49
 
45
- RUN bash -c "rvm alias create default jruby-9.2.5.0"
46
- RUN echo "rvm use jruby-9.2.5.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
47
52
 
48
53
  # Add rvm to the global bashrc
49
54
  RUN echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc
@@ -0,0 +1,271 @@
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
21
+ RUN apt-get -y update && \
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 && \
23
+ rm -rf /var/lib/apt/lists/*
24
+ <% end %>
25
+
26
+ # Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000
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
+
35
+ USER rvm
36
+
37
+ RUN mkdir ~/.gnupg && \
38
+ chmod 700 ~/.gnupg && \
39
+ echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
40
+
41
+ # install rvm, RVM 1.26.0+ has signed releases, source rvm for usage outside of package scripts
42
+ RUN gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
43
+ (curl -L http://get.rvm.io | sudo bash) && \
44
+ bash -c " \
45
+ source /etc/rubybashrc && \
46
+ rvm autolibs disable && \
47
+ rvmsudo rvm cleanup all "
48
+
49
+ # Import patch files for ruby and gems
50
+ COPY build/patches /home/rvm/patches/
51
+
52
+ # install rubies and fix permissions on
53
+ ENV RVM_RUBIES 2.5.9 3.1.0
54
+ RUN bash -c " \
55
+ export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
56
+ for v in ${RVM_RUBIES} ; do \
57
+ rvm install \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \
58
+ done && \
59
+ rvm cleanup all && \
60
+ find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
61
+
62
+ # Install rake-compiler and typical gems in all Rubies
63
+ # do not generate documentation for gems
64
+ RUN echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \
65
+ bash -c " \
66
+ rvm all do gem update --system --no-document && \
67
+ rvm all do gem install --no-document bundler 'bundler:~>1.16' 'rake-compiler:1.1.6' hoe mini_portile rubygems-tasks mini_portile2 && \
68
+ find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
69
+
70
+ # Install rake-compiler's cross rubies in global dir instead of /root
71
+ RUN sudo mkdir -p /usr/local/rake-compiler && \
72
+ sudo chown rvm.rvm /usr/local/rake-compiler && \
73
+ ln -s /usr/local/rake-compiler ~/.rake-compiler
74
+
75
+ # Add cross compilers for Windows and Linux
76
+ USER root
77
+
78
+ <% if platform=~/x64-mingw-ucrt/ %>
79
+ COPY --from=larskanis/mingw64-ucrt:20.04 /build/*.deb /debs/
80
+ RUN dpkg -i /debs/binutils-mingw-w64-x86-64_2.34-6ubuntu1.3+8.8_amd64.deb \
81
+ /debs/g++-mingw-w64-x86-64_9.3.0-17ubuntu1~20.04+22~exp1ubuntu4_amd64.deb \
82
+ /debs/gcc-mingw-w64-base_9.3.0-17ubuntu1~20.04+22~exp1ubuntu4_amd64.deb \
83
+ /debs/gcc-mingw-w64-x86-64_9.3.0-17ubuntu1~20.04+22~exp1ubuntu4_amd64.deb \
84
+ /debs/mingw-w64-common_7.0.0-2_all.deb \
85
+ /debs/mingw-w64-tools_7.0.0-2_amd64.deb \
86
+ /debs/mingw-w64-x86-64-dev_7.0.0-2_all.deb
87
+
88
+ <% elsif !manylinux %>
89
+ RUN apt-get -y update && \
90
+ apt-get install -y <%
91
+ if platform=~/darwin/ %> clang python lzma-dev libxml2-dev libssl-dev libc++-10-dev <% end %><%
92
+ if platform=~/aarch64-linux/ %> gcc-aarch64-linux-gnu g++-aarch64-linux-gnu <% end %><%
93
+ if platform=~/arm-linux/ %> gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf <% end %><%
94
+ if platform=~/x86-mingw32/ %> gcc-mingw-w64-i686 g++-mingw-w64-i686 <% end %><%
95
+ if platform=~/x64-mingw32/ %> gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 <% end %> && \
96
+ rm -rf /var/lib/apt/lists/*
97
+ <% end %>
98
+
99
+ RUN bash -c " \
100
+ rvm alias create default 3.1.0 && \
101
+ rvm use default "
102
+
103
+ <% if manylinux %>
104
+ # Create dev tools x86-linux-*
105
+ COPY build/mk_i686.rb /root/
106
+ RUN bash -c " \
107
+ ruby /root/mk_i686.rb "
108
+ <% end %>
109
+
110
+ <% if platform=~/darwin/ %>
111
+ RUN git clone -q --depth=1 https://github.com/tpoechtrager/osxcross.git /opt/osxcross && rm -rf /opt/osxcross/.git && \
112
+ cd /opt/osxcross/tarballs && \
113
+ curl -L -o MacOSX11.1.sdk.tar.xz https://github.com/larskanis/MacOSX-SDKs/releases/download/11.1/MacOSX11.1.sdk.tar.xz && \
114
+ tar -xf MacOSX11.1.sdk.tar.xz -C . && \
115
+ cp -rf /usr/lib/llvm-10/include/c++ MacOSX11.1.sdk/usr/include/c++ && \
116
+ cp -rf /usr/include/x86_64-linux-gnu/c++/9/bits/ MacOSX11.1.sdk/usr/include/c++/v1/bits && \
117
+ tar -cJf MacOSX11.1.sdk.tar.xz MacOSX11.1.sdk && \
118
+ cd /opt/osxcross && \
119
+ UNATTENDED=1 SDK_VERSION=11.1 OSX_VERSION_MIN=10.13 USE_CLANG_AS=1 ./build.sh && \
120
+ ln -s /usr/bin/llvm-config-10 /usr/bin/llvm-config && \
121
+ ENABLE_COMPILER_RT_INSTALL=1 SDK_VERSION=11.1 ./build_compiler_rt.sh && \
122
+ rm -rf *~ build tarballs/*
123
+
124
+ RUN echo "export PATH=/opt/osxcross/target/bin:\$PATH" >> /etc/rubybashrc && \
125
+ echo "export MACOSX_DEPLOYMENT_TARGET=10.13" >> /etc/rubybashrc && \
126
+ echo "export OSXCROSS_MP_INC=1" >> /etc/rubybashrc
127
+
128
+ # Add links to build tools without target version kind of:
129
+ # arm64-apple-darwin-clang => arm64-apple-darwin20.1-clang
130
+ RUN rm /opt/osxcross/target/bin/*-apple-darwin-* ; \
131
+ 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
132
+
133
+ # There's no objdump in osxcross but we can use llvm's
134
+ RUN ln -s /usr/lib/llvm-10/bin/llvm-objdump /opt/osxcross/target/bin/x86_64-apple-darwin-objdump && \
135
+ ln -s /usr/lib/llvm-10/bin/llvm-objdump /opt/osxcross/target/bin/aarch64-apple-darwin-objdump
136
+
137
+ <% end %>
138
+
139
+ # Patch rake-compiler to build and install static libraries for Linux rubies
140
+ USER rvm
141
+ COPY build/patches2 /home/rvm/patches/
142
+ RUN bash -c " \
143
+ for v in ${RVM_RUBIES} ; do \
144
+ cd /usr/local/rvm/gems/ruby-\$v/gems/rake-compiler-1.1.6 && \
145
+ echo applying patches to ruby-\$v /home/rvm/patches/rake-compiler-1.1.6/*.patch && \
146
+ ( git apply /home/rvm/patches/rake-compiler-1.1.6/*.patch || true ) \
147
+ done "
148
+
149
+ # Patch rubies for cross build
150
+ #USER root
151
+ #RUN bash -c " \
152
+ # for v in 2.7.0 3.0.0 3.1.0 ; do \
153
+ # curl -SL http://cache.ruby-lang.org/pub/ruby/\${v:0:3}/ruby-\$v.tar.xz | tar -xJC /root/ && \
154
+ # cd /root/ruby-\$v && \
155
+ # git apply /home/rvm/patches/ruby-\$v/*.patch && \
156
+ # cd .. && \
157
+ # mkdir -p /usr/local/rake-compiler/sources/ && \
158
+ # tar cjf /usr/local/rake-compiler/sources/ruby-\$v.tar.bz2 ruby-\$v && \
159
+ # chown rvm /usr/local/rake-compiler -R && \
160
+ # rm -rf /root/ruby-\$v ; \
161
+ # done "
162
+ #USER rvm
163
+
164
+ <%
165
+ axrubies = if platform =~ /x64-mingw-ucrt/
166
+ [
167
+ # Rubyinstaller-3.1.0+ is platform x64-mingw-ucrt
168
+ ["3.1.0", "3.1.0", true],
169
+ ]
170
+ elsif platform =~ /x64-mingw32/
171
+ [
172
+ # Rubyinstaller prior to 3.1.0 is platform x64-mingw32
173
+ ["2.6.0:2.5.0:2.4.0", "2.5.9", false],
174
+ ["3.0.0:2.7.0", "3.1.0", true],
175
+ ]
176
+ else
177
+ [
178
+ # Build xruby versions prior ruby2_keywords in parallel using ruby-2.5
179
+ ["2.6.0:2.5.0:2.4.0", "2.5.9", false],
180
+ # Build xruby versions with ruby2_keywords in parallel using ruby-3.x
181
+ ["3.1.0:3.0.0:2.7.0", "3.1.0", true],
182
+ ]
183
+ end
184
+
185
+ axrubies.each do |xrubies, rvm, parallel| %>
186
+ ENV XRUBIES <%= xrubies %>
187
+
188
+ <% strip = '-s' if platform !~ /darwin/ %>
189
+ # Build xruby versions in parallel
190
+ # Then cleanup all build artifacts
191
+ RUN bash -c " \
192
+ rvm use <%= rvm %> && \
193
+ export CPPFLAGS='<%= "-D__USE_MINGW_ANSI_STDIO=1" if platform=~/x64-mingw-ucrt/ %>' && \
194
+ export CFLAGS='-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong <%= strip %>' && \
195
+ export LDFLAGS='-pipe <%= strip %>' && \
196
+ <%= "export LIBS='-l:libssp.a' &&" if platform =~ /mingw/ %> \
197
+ <%= "export CC=#{target}-clang &&" if platform =~ /darwin/ %> \
198
+ export MAKE='make V=1 <%= "-j`nproc`" if parallel %>' && \
199
+ rake-compiler cross-ruby VERSION=$XRUBIES HOST=<%= target %> && \
200
+ rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources && \
201
+ find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
202
+ <% end %>
203
+
204
+ <% if platform=~/linux/ %>
205
+ # Avoid linking against libruby shared object.
206
+ # See also https://github.com/rake-compiler/rake-compiler-dock/issues/13
207
+ RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.so | xargs rm
208
+ RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby-static.a | while read f ; do cp $f `echo $f | sed s/-static//` ; done
209
+ RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.a | while read f ; do ar t $f | xargs ar d $f ; done
210
+ 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
+ <% end %>
212
+
213
+ <% if platform=~/mingw/ %>
214
+ # RubyInstaller doesn't install libgcc -> link it static.
215
+ RUN find /usr/local/rake-compiler/ruby/*mingw*/ -name rbconfig.rb | while read f ; do sed -i 's/."LDFLAGS". = "/&-static-libgcc /' $f ; done
216
+ # Raise Windows-API to Vista (affects ruby < 2.6 only)
217
+ RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/0x0501/0x0600/' $f ; done
218
+ # Don't link to static libruby
219
+ RUN find /usr/local/rake-compiler/ruby -name *msvcrt-ruby*.dll.a | while read f ; do n=`echo $f | sed s/.dll//` ; mv $f $n ; done
220
+ <% end %>
221
+
222
+ USER root
223
+
224
+ # Fix paths in rake-compiler/config.yml
225
+ RUN sed -i -- "s:/root/.rake-compiler:/usr/local/rake-compiler:g" /usr/local/rake-compiler/config.yml
226
+
227
+
228
+ <% if platform=~/mingw/ %>
229
+ # Install wrappers for strip commands as a workaround for "Protocol error" in boot2docker.
230
+ COPY build/strip_wrapper /root/
231
+ RUN mv /usr/bin/<%= target %>-strip /usr/bin/<%= target %>-strip.bin && \
232
+ ln /root/strip_wrapper /usr/bin/<%= target %>-strip
233
+
234
+ # Use posix pthread for mingw so that C++ standard library for thread could be
235
+ # available such as std::thread, std::mutex, so on.
236
+ # https://sourceware.org/pthreads-win32/
237
+ RUN printf "1\n" | update-alternatives --config <%= target %>-gcc && \
238
+ printf "1\n" | update-alternatives --config <%= target %>-g++
239
+ <% end %>
240
+
241
+ <% if manylinux %>
242
+ # Enable modern compiler toolset of manylinux image
243
+ RUN echo "export PATH=\$DEVTOOLSET_ROOTPATH/usr/bin:\$PATH" >> /etc/rubybashrc
244
+
245
+ # Add prefixed versions of compiler tools
246
+ 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
247
+
248
+ # ruby-2.5 links to libcrypt, which isn't necessary for extensions
249
+ RUN find /usr/local/rake-compiler/ruby -name rbconfig.rb | while read f ; do sed -i 's/-lcrypt//' $f ; done
250
+ <% end %>
251
+
252
+ <% if platform=~/arm64-darwin/ %>
253
+ # Add a arm64 darwin target as alternative to aarch64
254
+ 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
255
+ <% end %>
256
+
257
+ # Install SIGINT forwarder
258
+ COPY build/sigfw.c /root/
259
+ RUN gcc $HOME/sigfw.c -o /usr/bin/sigfw
260
+
261
+ # Install user mapper
262
+ COPY build/runas /usr/bin/
263
+ COPY build/rcd-env.sh /etc/profile.d/
264
+ RUN echo "source /etc/profile.d/rcd-env.sh" >> /etc/rubybashrc
265
+
266
+ # Install sudoers configuration
267
+ COPY build/sudoers /etc/sudoers.d/rake-compiler-dock
268
+
269
+ ENV RUBY_CC_VERSION 3.1.0:3.0.0:2.7.0:2.6.0:2.5.0:2.4.0
270
+
271
+ CMD bash
data/History.md CHANGED
@@ -1,3 +1,66 @@
1
+ 1.2.0 / 2022-01-04
2
+ ------------------
3
+
4
+ * Add Ruby-3.1 as native rvm and cross ruby versions.
5
+ * Remove Ruby-2.2 and 2.3 from RUBY_CC_VERSION and cross rubies.
6
+ * Add Linux cross build targets "arm-linux" and "aarch64-linux".
7
+ * Add cross build target "x64-mingw-ucrt" for ruby-3.1 on Windows.
8
+ * Add `wget` and `git` to Linux image.
9
+ * Add `maven` to JRuby image.
10
+ * Update JRuby to 9.3.2.0
11
+ * Fix default value of platform for JRuby. #50
12
+ * Update openjdk version from 14 to 17
13
+ * Add a test gem and build and run it on all supported platforms on Github Actions.
14
+ * Allow alternative build command like `docker buildx build`
15
+ * Provide compiler-rt libraries for darwin builds. #60
16
+ * Extract build environment from `runas` into `rcd-env.sh` and loaded it in non-interactive non-login shells. #57
17
+
18
+
19
+ 1.1.0 / 2020-12-29
20
+ ------------------
21
+
22
+ * Use ManyLinux2014 as docker base image for linux targets.
23
+ That way compatibility to very old linux dists can be provided, while still using modern compilers.
24
+ * Add macOS cross build targets "x86_64-darwin" and "arm64-darwin".
25
+ They are based on MacOSX-SDK-11.1
26
+ * Add Ruby-3.0 as native rvm and cross ruby version.
27
+ * Remove Ruby-2.2 from RUBY_CC_VERSION and cross rubies.
28
+ * Update to Ubuntu-20.04 for Mingw and JRuby targets.
29
+ * Set `ExtensionTask#no_native=true` to fix issues with cross_compiling callback not being called.
30
+ See discussion here: https://github.com/rake-compiler/rake-compiler/pull/171
31
+ * Allow setting an alternative dockerhub user per `DOCKERHUB_USER`.
32
+
33
+
34
+ 1.0.1 / 2020-01-13
35
+ ------------------
36
+
37
+ * Fix error when using rake-compiler-dock on non-tty STDIN. #31
38
+
39
+
40
+ 1.0.0 / 2020-01-04
41
+ ------------------
42
+ * Add ruby-2.7.0 cross ruby.
43
+ * Use per-target docker images.
44
+ There are currently 5 docker images:
45
+ * larskanis/rake-compiler-dock-mri-x86-mingw32
46
+ * larskanis/rake-compiler-dock-mri-x64-mingw32
47
+ * larskanis/rake-compiler-dock-mri-x86-linux
48
+ * larskanis/rake-compiler-dock-mri-x86_64-linux
49
+ * larskanis/rake-compiler-dock-jruby
50
+
51
+ Since every image has only the taget specific compilers and rubies, care has to be taken, that only rake tasks are triggered, that belong to the specific target.
52
+ See the README.md for more information.
53
+ * Ensure the separate docker images always use as much as possible common docker images layers to avoid increased download sizes.
54
+ * Pass GEM_PRIVATE_KEY_PASSPHRASE to the container.
55
+ * Update JRuby to 9.2.9.0 and native CRuby to 2.5.7.
56
+ * Create empty ~/.gem to be used for gem signing key.
57
+ * Ensure terminal is in cooked mode after build.
58
+ This fixes terminal misconfiguration after parallel builds.
59
+ * Raise Windows-API to Vista (affects ruby < 2.6 only)
60
+ * Use posix pthread for mingw so that C++ standard library for thread could be available such as std::thread, std::mutex, so on.
61
+ * Make the system to have GLIBC 2.12 instead of 2.23 so that generated ruby package can run on CentOS 6 with GLIBC 2.12
62
+
63
+
1
64
  0.7.2 / 2019-03-18
2
65
  ------------------
3
66
  * Fix missing libruby.a of cross rubies. Fixes #26