Utilities/Release: Add docker specs for Linux aarch64 binaries

Base them on the existing `x86_64` specs.  Update the centos
base image from centos 6 to centos 7 to get aarch64 support.
The resulting binaries require GLIBC 2.17.

Fixes: #17923
This commit is contained in:
Hi Key 2020-11-25 23:20:49 +08:00 committed by Brad King
parent 595551a805
commit e14fb01c41
9 changed files with 347 additions and 0 deletions

View File

@ -0,0 +1,35 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Produce an image containing a portable CMake binary package for Linux/aarch64.
# Build using the CMake source directory as the build context.
# The resulting image will have an '/out' directory containing the package.
# Keep this in sync with the `.gitlab-ci.yml` `release_linux` image.
ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-aarch64-deps-2020-12-21
ARG FROM_IMAGE_DIGEST=@sha256:0bd7dfe4e45593b04e39cd21e44011034610cfd376900558c5ef959bb1af15af
ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST
FROM $FROM_IMAGE
COPY . /opt/cmake/src/cmake
ARG TEST=true
RUN : \
&& mkdir -p /opt/cmake/src/cmake-build \
&& cd /opt/cmake/src/cmake-build \
&& cp ../cmake/Utilities/Release/linux/aarch64/cache.txt CMakeCache.txt \
&& source /opt/rh/devtoolset-7/enable \
&& set -x \
&& ../cmake/bootstrap --parallel=$(nproc) --docdir=doc/cmake \
&& nice make -j $(nproc) \
&& if $TEST; then \
# Run tests that require the full build tree.
bin/ctest --output-on-failure -j 8 -R '^(CMake\.|CMakeLib\.|CMakeServerLib\.|RunCMake\.ctest_memcheck)'; \
fi \
&& bin/cpack -G TGZ \
&& bin/cpack -G STGZ \
&& set +x \
&& mkdir /out \
&& mv cmake-*-Linux-aarch64.* /out \
&& :

View File

@ -0,0 +1,31 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Produce a base image with a build environment for portable CMake binaries.
# Build using the directory containing this file as its own build context.
ARG FROM_IMAGE_NAME=centos:7
ARG FROM_IMAGE_DIGEST=@sha256:43964203bf5d7fe38c6fca6166ac89e4c095e2b0c0a28f6c7c678a1348ddc7fa
ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST
FROM $FROM_IMAGE
RUN : \
&& yum install -y centos-release-scl \
&& yum install -y \
ca-certificates \
curl \
devtoolset-7-gcc \
devtoolset-7-gcc-c++ \
fontconfig-devel \
freetype-devel \
git \
libX11-devel \
libxcb-devel \
make \
patch \
perl \
python3-pip \
xz \
which \
&& yum clean all \
&& :

View File

@ -0,0 +1,44 @@
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_C_STANDARD:STRING=11
CMAKE_CXX_STANDARD:STRING=14
# Require only older APIs where possible.
CMAKE_C_FLAGS:STRING=-D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1
# Link C++ library statically.
CMAKE_EXE_LINKER_FLAGS:STRING=-static-libstdc++ -static-libgcc
# Enable ssl support in curl
CMAKE_USE_OPENSSL:BOOL=ON
OPENSSL_CRYPTO_LIBRARY:STRING=/opt/openssl/lib/libcrypto.a;-pthread
OPENSSL_INCLUDE_DIR:PATH=/opt/openssl/include
OPENSSL_SSL_LIBRARY:FILEPATH=/opt/openssl/lib/libssl.a
# Enable ccmake
BUILD_CursesDialog:BOOL=ON
CURSES_FORM_LIBRARY:FILEPATH=/opt/ncurses/lib/libform.a
CURSES_INCLUDE_PATH:PATH=/opt/ncurses/include
CURSES_NCURSES_LIBRARY:FILEPATH=/opt/ncurses/lib/libncurses.a
# Enable cmake-gui with static qt plugins
BUILD_QtDialog:BOOL=TRUE
CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3
CMAKE_PREFIX_PATH:STRING=/opt/qt
CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES:STRING=/opt/qt/plugins/platforms/libqxcb.a;/opt/qt/lib/libQt5XcbQpa.a;/opt/qt/lib/libQt5ServiceSupport.a;/opt/qt/lib/libQt5EdidSupport.a;/opt/qt/lib/libQt5EventDispatcherSupport.a;/opt/qt/lib/libQt5FontDatabaseSupport.a;/opt/qt/lib/libQt5ThemeSupport.a;/opt/qt/lib/libxcb-static.a;-lxcb;-lfontconfig;-lfreetype
# Build documentation.
SPHINX_EXECUTABLE:FILEPATH=/usr/local/bin/sphinx-build
SPHINX_HTML:BOOL=ON
SPHINX_MAN:BOOL=ON
SPHINX_QTHELP:BOOL=ON
QCOLLECTIONGENERATOR_EXECUTABLE:PATH=/opt/qt/bin/qhelpgenerator
# We bootstrap as part of the build so skip its test.
CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
# Skip Qt5 tests because our Qt is static.
CMake_TEST_Qt5:BOOL=FALSE
# CPack package file name component for this platform.
CPACK_SYSTEM_NAME:STRING=Linux-aarch64

View File

@ -0,0 +1,141 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Produce an image with custom-built dependencies for portable CMake binaries.
# Build using the directory containing this file as its own build context.
ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-aarch64-base-2020-12-21
ARG FROM_IMAGE_DIGEST=@sha256:c8d9fa279ef09c26e74ff28770ae0db1f4cb75ef53b782ace604daba71a41f65
ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST
FROM $FROM_IMAGE
# Sphinx
RUN : \
&& pip3 install sphinx==2.1.2 \
&& :
# Qt
# Version 5.12.0 was the last to bundle xkbcommon.
COPY qt-install.patch /opt/qt/src/
RUN : \
&& mkdir -p /opt/qt/src/qt-build \
&& cd /opt/qt/src \
&& curl -OL https://download.qt.io/archive/qt/5.12/5.12.0/single/qt-everywhere-src-5.12.0.tar.xz \
&& sha512sum qt-everywhere-src-5.12.0.tar.xz | grep -q 0dd03d2645fb6dac5b58c8caf92b4a0a6900131f1ccfb02443a0df4702b5da0458f4c45e758d1b929ec709b0f4b36900df2fd60a058af9cc8c1a0748b6d57aae \
&& tar xJf qt-everywhere-src-5.12.0.tar.xz \
&& cd qt-build \
&& source /opt/rh/devtoolset-7/enable \
&& ../qt-everywhere-src-5.12.0/configure \
-prefix /opt/qt \
-static \
-release \
-c++std c++11 \
-opensource -confirm-license \
-gui \
-widgets \
-xcb \
-fontconfig \
-sql-sqlite \
-qt-doubleconversion \
-qt-libjpeg \
-qt-libpng \
-qt-pcre \
-qt-sqlite \
-qt-xcb \
-qt-xkbcommon \
-qt-zlib \
-system-freetype \
-no-accessibility \
-no-compile-examples \
-no-cups \
-no-dbus \
-no-directfb \
-no-egl \
-no-eglfs \
-no-evdev \
-no-gbm \
-no-gif \
-no-glib \
-no-gtk \
-no-harfbuzz \
-no-iconv \
-no-icu \
-no-journald \
-no-kms \
-no-libinput \
-no-libproxy \
-no-linuxfb \
-no-ltcg \
-no-mirclient \
-no-mtdev \
-no-opengl \
-no-openssl \
-no-pch \
-no-sql-mysql \
-no-sql-psql \
-no-sql-sqlite2 \
-no-syslog \
-no-system-proxies \
-no-tslib \
-no-use-gold-linker \
-skip declarative \
-skip multimedia \
-skip qtcanvas3d \
-skip qtconnectivity \
-skip qtdeclarative \
-skip qtlocation \
-skip qtmultimedia \
-skip qtsensors \
-skip qtserialport \
-skip qtsvg \
-skip qtwayland \
-skip qtwebchannel \
-skip qtwebengine \
-skip qtwebsockets \
-skip qtwinextras \
-skip qtxmlpatterns \
-nomake examples \
-nomake tests \
&& make install -j $(nproc) \
&& cd /opt/qt \
&& patch -p1 -i src/qt-install.patch \
&& cd /opt \
&& rm -rf /opt/qt/src \
&& :
# Curses
RUN : \
&& mkdir -p /opt/ncurses/src/ncurses-build \
&& cd /opt/ncurses/src \
&& curl -O https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz \
&& sha512sum ncurses-6.1.tar.gz | grep -q e308af43f8b7e01e98a55f4f6c4ee4d1c39ce09d95399fa555b3f0cdf5fd0db0f4c4d820b4af78a63f6cf6d8627587114a40af48cfc066134b600520808a77ee \
&& tar xzf ncurses-6.1.tar.gz \
&& cd ncurses-build \
&& source /opt/rh/devtoolset-7/enable \
&& ../ncurses-6.1/configure \
--prefix=/opt/ncurses \
--with-terminfo-dirs=/etc/terminfo:/lib/terminfo:/usr/share/terminfo \
--with-default-terminfo-dir=/usr/share/terminfo \
--without-shared \
&& make -j $(nproc) \
&& make install.libs install.includes \
&& cd /opt \
&& rm -rf /opt/ncurses/src \
&& :
# OpenSSL
COPY openssl-source.patch /opt/openssl/src/
RUN : \
&& mkdir -p /opt/openssl/src \
&& cd /opt/openssl/src \
&& curl -O https://www.openssl.org/source/openssl-1.1.1f.tar.gz \
&& sha512sum openssl-1.1.1f.tar.gz | grep -q b00bd9b5ad5298fbceeec6bb19c1ab0c106ca5cfb31178497c58bf7e0e0cf30fcc19c20f84e23af31cc126bf2447d3e4f8461db97bafa7bd78f69561932f000c \
&& tar xzf openssl-1.1.1f.tar.gz \
&& cd openssl-1.1.1f \
&& patch -p1 -i ../openssl-source.patch \
&& source /opt/rh/devtoolset-7/enable \
&& ./Configure --prefix=/opt/openssl linux-elf no-asm no-shared -D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 \
&& make install_dev -j $(nproc) \
&& cd /opt \
&& rm -rf /opt/openssl/src \
&& :

View File

@ -0,0 +1,12 @@
# enable pthread APIs disabled by our _POSIX_SOURCE definitions
--- openssl-source/crypto/threads_pthread.c.orig
+++ openssl-source/crypto/threads_pthread.c
@@ -6,6 +6,8 @@
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
+#undef _POSIX_C_SOURCE
+#undef _POSIX_SOURCE
#include <openssl/crypto.h>
#include "internal/cryptlib.h"

View File

@ -0,0 +1,24 @@
# Add Qt Core dependencies missing from static Qt build.
--- qt-install/lib/cmake/Qt5Core/Qt5CoreConfig.cmake.orig
+++ qt-install/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
@@ -111,7 +111,7 @@
list(REMOVE_DUPLICATES Qt5Core_COMPILE_DEFINITIONS)
list(REMOVE_DUPLICATES Qt5Core_EXECUTABLE_COMPILE_FLAGS)
- set(_Qt5Core_LIB_DEPENDENCIES "")
+ set(_Qt5Core_LIB_DEPENDENCIES "${_qt5Core_install_prefix}/lib/libqtpcre2.a")
add_library(Qt5::Core STATIC IMPORTED)
# Add Qt Gui dependencies missing from static Qt build.
--- qt-install/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake.orig
+++ qt-install/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake
@@ -111,7 +111,7 @@
list(REMOVE_DUPLICATES Qt5Gui_COMPILE_DEFINITIONS)
list(REMOVE_DUPLICATES Qt5Gui_EXECUTABLE_COMPILE_FLAGS)
- set(_Qt5Gui_LIB_DEPENDENCIES "Qt5::Core")
+ set(_Qt5Gui_LIB_DEPENDENCIES "Qt5::Core;${_qt5Gui_install_prefix}/lib/libqtlibpng.a")
add_library(Qt5::Gui STATIC IMPORTED)

View File

@ -0,0 +1,26 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Produce a base image with a test environment for packaged CMake binaries.
# Build using the directory containing this file as its own build context.
ARG FROM_IMAGE_NAME=debian:10
ARG FROM_IMAGE_DIGEST=@sha256:ab0ba5b78bfe01d61ac4f9919cd0e7bef8beefa0a77d3d710bfc8630d96804b8
ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST
FROM $FROM_IMAGE
RUN : \
&& apt-get update \
&& apt-get install -y \
dpkg \
file \
gcc \
g++ \
gfortran \
qt5-default \
make \
ninja-build \
&& apt-get clean \
&& :
COPY test-make.bash test-ninja.bash /

View File

@ -0,0 +1,17 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
set -e
set -x
mkdir -p /opt/cmake/src/cmake-make
cd /opt/cmake/src/cmake-make
echo >CMakeCache.txt '
CMake_TEST_IPO_WORKS_C:BOOL=ON
CMake_TEST_IPO_WORKS_CXX:BOOL=ON
CMake_TEST_IPO_WORKS_Fortran:BOOL=ON
CMake_TEST_NO_NETWORK:BOOL=ON
CMake_TEST_Qt5:BOOL=ON
'
cmake ../cmake -DCMake_TEST_HOST_CMAKE=1 -G "Unix Makefiles"
make -j $(nproc)
ctest --output-on-failure -j $(nproc)

View File

@ -0,0 +1,17 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
set -e
set -x
mkdir -p /opt/cmake/src/cmake-ninja
cd /opt/cmake/src/cmake-ninja
echo >CMakeCache.txt '
CMAKE_Fortran_COMPILER:STRING=
CMake_TEST_IPO_WORKS_C:BOOL=ON
CMake_TEST_IPO_WORKS_CXX:BOOL=ON
CMake_TEST_NO_NETWORK:BOOL=ON
CMake_TEST_Qt5:BOOL=ON
'
cmake ../cmake -DCMake_TEST_HOST_CMAKE=1 -G "Ninja"
ninja
ctest --output-on-failure -j $(nproc)