From bda17e37f416a6b866c1d5def53017b5a025f106 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Wed, 27 Oct 2021 15:33:46 -0700 Subject: [PATCH] Limit ucontext linking to specific arches --- 2.6/alpine3.13/Dockerfile | 1 - 2.6/alpine3.14/Dockerfile | 1 - 2.7/alpine3.13/Dockerfile | 11 +++++++++-- 2.7/alpine3.14/Dockerfile | 11 +++++++++-- 3.0/alpine3.13/Dockerfile | 10 +++++++++- 3.0/alpine3.14/Dockerfile | 10 +++++++++- Dockerfile.template | 15 +++++++++++---- 7 files changed, 47 insertions(+), 12 deletions(-) diff --git a/2.6/alpine3.13/Dockerfile b/2.6/alpine3.13/Dockerfile index 11f9f1d73..1c1feafe1 100644 --- a/2.6/alpine3.13/Dockerfile +++ b/2.6/alpine3.13/Dockerfile @@ -51,7 +51,6 @@ RUN set -eux; \ libffi-dev \ libxml2-dev \ libxslt-dev \ - libucontext-dev \ linux-headers \ make \ ncurses-dev \ diff --git a/2.6/alpine3.14/Dockerfile b/2.6/alpine3.14/Dockerfile index a882629e1..5a86b5609 100644 --- a/2.6/alpine3.14/Dockerfile +++ b/2.6/alpine3.14/Dockerfile @@ -51,7 +51,6 @@ RUN set -eux; \ libffi-dev \ libxml2-dev \ libxslt-dev \ - libucontext-dev \ linux-headers \ make \ ncurses-dev \ diff --git a/2.7/alpine3.13/Dockerfile b/2.7/alpine3.13/Dockerfile index 6a9bba400..f80d05b4a 100644 --- a/2.7/alpine3.13/Dockerfile +++ b/2.7/alpine3.13/Dockerfile @@ -51,7 +51,6 @@ RUN set -eux; \ libffi-dev \ libxml2-dev \ libxslt-dev \ - libucontext-dev \ linux-headers \ make \ ncurses-dev \ @@ -97,8 +96,16 @@ RUN set -eux; \ mv file.c.new file.c; \ \ autoconf; \ + # fix builds on arm32v6/7 and s390x: https://github.com/docker-library/ruby/issues/308 + # and don't break the other arches: https://github.com/docker-library/ruby/issues/365 + apkArch="$(apk --print-arch)"; \ + case "$apkArch" in \ + s390x | armhf | armv7) \ + apk add --no-cache libucontext-dev; \ + export LIBS='-lucontext'; \ + ;; \ + esac; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - export LIBS='-lucontext'; \ ./configure \ --build="$gnuArch" \ --disable-install-doc \ diff --git a/2.7/alpine3.14/Dockerfile b/2.7/alpine3.14/Dockerfile index 9c0b3c6d9..ebf7c2985 100644 --- a/2.7/alpine3.14/Dockerfile +++ b/2.7/alpine3.14/Dockerfile @@ -51,7 +51,6 @@ RUN set -eux; \ libffi-dev \ libxml2-dev \ libxslt-dev \ - libucontext-dev \ linux-headers \ make \ ncurses-dev \ @@ -97,8 +96,16 @@ RUN set -eux; \ mv file.c.new file.c; \ \ autoconf; \ + # fix builds on arm32v6/7 and s390x: https://github.com/docker-library/ruby/issues/308 + # and don't break the other arches: https://github.com/docker-library/ruby/issues/365 + apkArch="$(apk --print-arch)"; \ + case "$apkArch" in \ + s390x | armhf | armv7) \ + apk add --no-cache libucontext-dev; \ + export LIBS='-lucontext'; \ + ;; \ + esac; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - export LIBS='-lucontext'; \ ./configure \ --build="$gnuArch" \ --disable-install-doc \ diff --git a/3.0/alpine3.13/Dockerfile b/3.0/alpine3.13/Dockerfile index 0edbbe0d2..d5fd52e05 100644 --- a/3.0/alpine3.13/Dockerfile +++ b/3.0/alpine3.13/Dockerfile @@ -51,7 +51,6 @@ RUN set -eux; \ libffi-dev \ libxml2-dev \ libxslt-dev \ - libucontext-dev \ linux-headers \ make \ ncurses-dev \ @@ -97,6 +96,15 @@ RUN set -eux; \ mv file.c.new file.c; \ \ autoconf; \ + # fix builds on arm32v6/7 and s390x: https://github.com/docker-library/ruby/issues/308 + # and don't break the other arches: https://github.com/docker-library/ruby/issues/365 + apkArch="$(apk --print-arch)"; \ + case "$apkArch" in \ + s390x | armhf | armv7) \ + apk add --no-cache libucontext-dev; \ + export LIBS='-lucontext'; \ + ;; \ + esac; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ ./configure \ --build="$gnuArch" \ diff --git a/3.0/alpine3.14/Dockerfile b/3.0/alpine3.14/Dockerfile index bb1a25d50..749d8b72e 100644 --- a/3.0/alpine3.14/Dockerfile +++ b/3.0/alpine3.14/Dockerfile @@ -51,7 +51,6 @@ RUN set -eux; \ libffi-dev \ libxml2-dev \ libxslt-dev \ - libucontext-dev \ linux-headers \ make \ ncurses-dev \ @@ -97,6 +96,15 @@ RUN set -eux; \ mv file.c.new file.c; \ \ autoconf; \ + # fix builds on arm32v6/7 and s390x: https://github.com/docker-library/ruby/issues/308 + # and don't break the other arches: https://github.com/docker-library/ruby/issues/365 + apkArch="$(apk --print-arch)"; \ + case "$apkArch" in \ + s390x | armhf | armv7) \ + apk add --no-cache libucontext-dev; \ + export LIBS='-lucontext'; \ + ;; \ + esac; \ gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ ./configure \ --build="$gnuArch" \ diff --git a/Dockerfile.template b/Dockerfile.template index edd463b72..e4e735838 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -76,7 +76,6 @@ RUN set -eux; \ libffi-dev \ libxml2-dev \ libxslt-dev \ - libucontext-dev \ linux-headers \ make \ ncurses-dev \ @@ -165,10 +164,18 @@ RUN set -eux; \ mv file.c.new file.c; \ \ autoconf; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ -{{ if is_alpine and env.version == "2.7" then ( -}} - export LIBS='-lucontext'; \ +{{ if is_alpine and ( [ "2.7", "3.0" ] | index(env.version) ) then ( -}} + # fix builds on arm32v6/7 and s390x: https://github.com/docker-library/ruby/issues/308 + # and don't break the other arches: https://github.com/docker-library/ruby/issues/365 + apkArch="$(apk --print-arch)"; \ + case "$apkArch" in \ + s390x | armhf | armv7) \ + apk add --no-cache libucontext-dev; \ + export LIBS='-lucontext'; \ + ;; \ + esac; \ {{ ) else "" end -}} + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ ./configure \ --build="$gnuArch" \ --disable-install-doc \