Skip to content

Commit

Permalink
Add template for libssl and yjit for 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladybiss committed Feb 3, 2023
1 parent f02f7f8 commit 133f6b6
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ Follow the [README](https://github.com/basecamp/work#first-time-setup) in order

$ bin/build_ruby -d ubuntu:18.04 -a amd64 -i "37s~bionic" -r 2.4.1
$ bin/build_ruby -d ubuntu:18.04:libssl -a amd64 -i "37s~bionic.libssl" -r 3.1.2

# Ruby 3.2.0 + YJIT support
$ bin/build_ruby -d ubuntu:18.04:yjit -a amd64 -i "37s~bionic" -r 3.2.0
$ bin/build_ruby -d ubuntu:18.04:libssl-yjit -a amd64 -i "37s~bionic.libssl" -r 3.2.0

### Other options

Expand Down
5 changes: 5 additions & 0 deletions build_ruby.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var (
"ubuntu:18.04": "ubuntu:18.04",
"ubuntu:18.04:libssl": "ubuntu:18.04:libssl", // drop this variant once we move beyond bionic
"ubuntu:18.04:yjit": "ubuntu:18.04:yjit", // used for building 3.2.0 with yjit support
"ubuntu:18.04:libssl-yjit": "ubuntu:18.04:libssl-yjit", // used for building 3.2.0 with yjit support and new libssl
}

docker_client *docker.Client
Expand Down Expand Up @@ -351,6 +352,8 @@ func dockerFileFromTemplate(distro, ruby_version, arch, iteration string, patche
template_location = "data/Dockerfile-bionic-libssl.template"
case "ubuntu:18.04:yjit": // used for building 3.2.0 with yjit support
template_location = "data/Dockerfile-bionic-yjit.template"
case "ubuntu:18.04:libssl-yjit": // used for building 3.2.0 with yjit support and new libssl
template_location = "data/Dockerfile-bionic-libssl-yjit.template"
default:
template_location = "data/Dockerfile.template"
}
Expand Down Expand Up @@ -386,6 +389,8 @@ func gemfilesFromDistro(distro string) (string, string) {
return "data/Gemfile.bionic", "data/Gemfile.bionic.lock"
case "ubuntu:18.04:yjit": // used for building 3.2.0 with yjit support
return "data/Gemfile.bionic", "data/Gemfile.bionic.lock"
case "ubuntu:18.04:libssl-yjit": // used for building 3.2.0 with yjit support and new libssl
return "data/Gemfile.bionic", "data/Gemfile.bionic.lock"
default:
return "data/Gemfile.template", "data/Gemfile.template.lock"
}
Expand Down
56 changes: 56 additions & 0 deletions data/Dockerfile-bionic-libssl-yjit.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Only produces builds for ruby >= 2.4 due to the newer openssl
# see https://3.basecamp.com/2914079/buckets/21350690/todos/4209849128
#
# We should drop this variant when we move beyond bionic

# Can't use {{.Distro}} since it's ubuntu:18.04:libssl
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y build-essential \
libc6-dev libffi-dev libgdbm-dev libncurses5-dev \
libreadline-dev libssl-dev libyaml-dev zlib1g-dev rustc \
curl ruby ruby-dev
RUN ["/usr/bin/gem", "install", "bundler", "-v", "1.17.3", "--no-rdoc", "--no-ri"]
ADD Gemfile /
ADD Gemfile.lock /
RUN ["bundle", "install"]

RUN curl {{.DownloadUrl}}|tar oxzC /tmp
{{range .Patches}}ADD {{.}} /
{{end}}
WORKDIR /tmp/ruby-{{.RubyVersion}}
RUN for i in `/bin/ls /*.patch`; do patch -p0 < $i; done
RUN CFLAGS='-march=x86-64 -O3 -fno-fast-math -g3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -std=iso9899:1999 -fPIC' ./configure \
--prefix=/opt/ruby{{.RubyVersion}} \
--enable-shared \
--disable-install-doc \
--enable-load-relative \
--enable-yjit
# Seems to only affect some 1.9 series Rubies, but the combined make step:
#
# RUN make -j8 install DESTDIR=/tmp/fpm
#
# that ran the make then make install, was broken. Splitting it up into
# two separate commands works fine:
RUN make -j{{.NumCPU}}
RUN make install DESTDIR=/tmp/fpm

WORKDIR /
RUN fpm \
-s dir \
-t deb \
-n ruby-{{.RubyVersion}} \
-a {{.Arch}} \
-v {{.RubyVersion}} \
{{.Iteration}}
-d libc6-dev \
-d libffi-dev \
-d libgdbm-dev \
-d libncurses5-dev \
-d libreadline-dev \
-d libssl-dev \
-d libyaml-dev \
-d zlib1g-dev \
-C /tmp/fpm \
-p /{{.FileName}} \
opt

0 comments on commit 133f6b6

Please sign in to comment.