Clean repos and fix clean rule

Move common files to common folder
Move patch files to patch folder
Fix clean rule in Makefile (Remove /Dockerfile in path, he is already there)

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
This commit is contained in:
2021-06-29 19:10:34 +02:00
parent 12a662e05c
commit 927f709819
11 changed files with 17 additions and 15 deletions

View File

@ -0,0 +1,68 @@
# crosstool.common-manylinux
#
# Common Docker instructions to install "crosstool-ng" and build a full
# cross-compiler suite from a crosstool-ng configuration, CROSSTOOL_CONFIG.
#
# This import complements the "dockcross/base" image, adding:
# - "ct-ng", a cross-compiler building utilty.
# - A cross-compiler suite configured in "crosstool-ng.config".
#
# The generated cross-compiler will have a CROSS_ROOT of:
# ${XCC_PREFIX}/${CROSS_TRIPLE}
#
# A given platform will need to supply the appropriate "crosstool-ng.config" to
# generate its cross-compiler. This can be built using "ct-ng menuconfig" to
# generate a configuration.
ENV MANYLINUX_DEPS="glibc-devel glibc-devel.i686 libstdc++-devel glib2-devel libX11-devel libXext-devel libXrender-devel mesa-libGL-devel libICE-devel libSM-devel"
ENV PYTHON_COMPILE_DEPS="python-devel zlib-devel bzip2-devel expat-devel ncurses-devel readline-devel tk-devel gdbm-devel libdb-devel libpcap-devel xz-devel openssl-devel keyutils-libs-devel krb5-devel libcom_err-devel libidn-devel curl-devel perl-devel"
ENV TOOLCHAIN_DEPS="devtoolset-9-binutils devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-gcc-gfortran"
# Install dependent packages required for `ct-ng`.
RUN \
yum -y update && \
yum -y install \
gawk \
gperf \
help2man \
texinfo \
flex \
ncurses-devel \
glibc-static \
systemtap-devel \
systemtap-sdt-devel \
${TOOLCHAIN_DEPS} \
${PYTHON_COMPILE_DEPS} \
${MANYLINUX_DEPS} && \
yum clean all
ENV XCC_PREFIX=/usr/xcc
# Add the crosstool-ng script and image-specific toolchain configuration into
# /dockcross/.
#
# Afterwards, we will leave the "ct-ng" config in the image as a reference
# for users.
COPY \
imagefiles/install-crosstool-ng-toolchain.sh \
imagefiles/patch/crosstool-ng/crosstool-ng-expat.patch \
imagefiles/patch/crosstool-ng/Fix-error-with-bash-5-and-up.patch \
manylinux2014-aarch64/crosstool-ng.config \
/dockcross/
# Build and install the toolchain, cleaning up artifacts afterwards.
RUN \
mkdir /dockcross/crosstool && \
cd /dockcross/crosstool && \
/dockcross/install-crosstool-ng-toolchain.sh \
-p "${XCC_PREFIX}" \
-c /dockcross/crosstool-ng.config && \
rm -rf /dockcross/crosstool /dockcross/install-crosstool-ng-toolchain.sh && \
# Remove sudo provided by devtoolset since it doesn't work with
# our sudo wrapper calling gosu.
rm -f /opt/rh/devtoolset-9/root/usr/bin/sudo
# Restore our default workdir (from "dockcross/base").
WORKDIR /work

56
common/common.crosstool Normal file
View File

@ -0,0 +1,56 @@
# crosstool.common
#
# Common Docker instructions to install "crosstool-ng" and build a full
# cross-compiler suite from a crosstool-ng configuration, CROSSTOOL_CONFIG.
#
# This import complements the "dockcross/base" image, adding:
# - "ct-ng", a cross-compiler building utilty.
# - A cross-compiler suite configured in "crosstool-ng.config".
#
# The generated cross-compiler will have a CROSS_ROOT of:
# ${XCC_PREFIX}/${CROSS_TRIPLE}
#
# A given platform will need to supply the appropriate "crosstool-ng.config" to
# generate its cross-compiler. This can be built using "ct-ng menuconfig" to
# generate a configuration.
# Install Debian packages required for `ct-ng`.
RUN apt-get update --yes && apt-get install --no-install-recommends --yes \
gawk \
gperf \
help2man \
python3-dev \
texinfo \
# Packages needed for crosstool-ng 1.24 or higher
unzip \
libtool \
libtool-bin \
&& apt-get clean autoclean --yes \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
ENV XCC_PREFIX=/usr/xcc
# Add the crosstool-ng script and image-specific toolchain configuration into
# /dockcross/.
#
# Afterwards, we will leave the "ct-ng" config in the image as a reference
# for users.
COPY \
imagefiles/install-crosstool-ng-toolchain.sh \
imagefiles/patch/crosstool-ng/crosstool-ng-expat.patch \
imagefiles/patch/crosstool-ng/Fix-error-with-bash-5-and-up.patch \
crosstool-ng.config \
/dockcross/
# Build and install the toolchain, cleaning up artifacts afterwards.
RUN mkdir /dockcross/crosstool \
&& cd /dockcross/crosstool \
&& /dockcross/install-crosstool-ng-toolchain.sh \
-p "${XCC_PREFIX}" \
-c /dockcross/crosstool-ng.config \
-v "${CT_VERSION}" \
&& rm -rf /dockcross/crosstool /dockcross/install-crosstool-ng-toolchain.sh
# Restore our default workdir (from "dockcross/base").
WORKDIR /work

45
common/common.debian Normal file
View File

@ -0,0 +1,45 @@
ARG DEBIAN_FRONTEND=noninteractive
RUN \
apt-get update --yes && \
apt-get install --no-install-recommends --yes \
autogen \
automake \
bash \
bc \
bison \
build-essential \
bzip2 \
ca-certificates \
curl \
dirmngr \
file \
flex \
gettext \
gzip \
gnupg \
initramfs-tools \
libncurses5 \
libtool \
make \
ncurses-dev \
pkg-config \
pax \
python3 \
python3-pip \
rsync \
sed \
ssh \
tar \
vim \
wget \
xz-utils \
zip \
zlib1g-dev \
# python-is-python3 \
&& apt-get clean autoclean --yes \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
RUN ln -s /usr/bin/python3 /usr/bin/python \
&& ln -s /usr/bin/pip3 /usr/bin/pip

16
common/common.dockcross Normal file
View File

@ -0,0 +1,16 @@
WORKDIR /usr/src
# Image build scripts
COPY \
imagefiles/install-gosu-binary.sh \
imagefiles/install-gosu-binary-wrapper.sh \
/buildscripts/
RUN \
set -x && \
/buildscripts/install-gosu-binary.sh && \
/buildscripts/install-gosu-binary-wrapper.sh && \
rm -rf /buildscripts
# Runtime scripts
COPY imagefiles/entrypoint.sh imagefiles/dockcross /dockcross/

39
common/common.docker Normal file
View File

@ -0,0 +1,39 @@
WORKDIR /usr/src
ARG GIT_VERSION=2.31.1
ARG CMAKE_VERSION=3.17.1
# Image build scripts
COPY \
imagefiles/build-and-install-cmake.sh \
imagefiles/build-and-install-curl.sh \
imagefiles/build-and-install-git.sh \
imagefiles/build-and-install-ninja.sh \
imagefiles/build-and-install-openssl.sh \
imagefiles/build-and-install-openssh.sh \
imagefiles/install-cmake-binary.sh \
imagefiles/install-liquidprompt-binary.sh \
imagefiles/install-python-packages.sh \
imagefiles/utils.sh \
/buildscripts/
RUN \
X86_FLAG=$([ "$DEFAULT_DOCKCROSS_IMAGE" = "dockcross/manylinux1-x86" -o "$DEFAULT_DOCKCROSS_IMAGE" = "dockcross/manylinux2010-x86" -o "$DEFAULT_DOCKCROSS_IMAGE" = "dockcross/manylinux2014-x86" ] && echo "-32" || echo "") && \
/buildscripts/build-and-install-openssl.sh $X86_FLAG && \
/buildscripts/build-and-install-openssh.sh && \
/buildscripts/build-and-install-curl.sh && \
/buildscripts/build-and-install-git.sh && \
/buildscripts/install-cmake-binary.sh $X86_FLAG && \
/buildscripts/install-liquidprompt-binary.sh && \
PYTHON=$([ -e /opt/python/cp38-cp38/bin/python ] && echo "/opt/python/cp38-cp38/bin/python" || echo "python3") && \
/buildscripts/install-python-packages.sh -python ${PYTHON} && \
/buildscripts/build-and-install-ninja.sh -python ${PYTHON} && \
rm -rf /buildscripts
RUN echo "root:root" | chpasswd
WORKDIR /work
ENTRYPOINT ["/dockcross/entrypoint.sh"]
# Runtime scripts
COPY imagefiles/cmake.sh /usr/local/bin/cmake
COPY imagefiles/ccmake.sh /usr/local/bin/ccmake

View File

@ -0,0 +1,14 @@
# Build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE
ARG IMAGE
ARG VERSION=latest
ARG VCS_REF
ARG VCS_URL
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name=$IMAGE \
org.label-schema.version=$VERSION \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.schema-version="1.0"
ENV DEFAULT_DOCKCROSS_IMAGE ${IMAGE}:${VERSION}

30
common/common.manylinux Normal file
View File

@ -0,0 +1,30 @@
# Image build scripts
COPY \
manylinux-common/install-python-packages.sh \
/buildscripts/
RUN \
set -x && \
yum -y install \
$([ "$DEFAULT_DOCKCROSS_IMAGE" = "dockcross/manylinux2014-x86" ] && echo "" || echo "epel-release") \
gpg \
python3-devel \
zlib-devel \
gettext \
openssh-clients \
pax \
wget \
zip \
&& \
yum clean all && \
# Remove sudo provided by devtoolset since it doesn't work with
# our sudo wrapper calling gosu.
rm -f /opt/rh/devtoolset-2/root/usr/bin/sudo && \
rm -f /opt/rh/devtoolset-7/root/usr/bin/sudo && \
rm -f /opt/rh/devtoolset-8/root/usr/bin/sudo && \
rm -f /opt/rh/devtoolset-9/root/usr/bin/sudo && \
/buildscripts/install-python-packages.sh && \
rm -rf /buildscripts
# Runtime scripts
COPY manylinux-common/pre_exec.sh /dockcross/

127
common/common.windows Normal file
View File

@ -0,0 +1,127 @@
#
# Before including this script, make sure to set:
#
# WINEARCH environment variable to either "win64" or "win32"
# MXE_TARGET_ARCH argument to either "x86_64" or "i686". See http://mxe.cc/
# MXE_TARGET_THREAD argument to either "" or ".posix". Default is win32. See http://mxe.cc/
# MXE_TARGET_LINK argument to either "static" or "shared"
#
# For example:
#
# ENV WINEARCH win64
# ARG MXE_TARGET_ARCH=x86_64
# ARG MXE_TARGET_THREAD=
# ARG MXE_TARGET_LINK=shared
#
# mxe master 2020-12-21
ARG MXE_GIT_TAG=a7a45e4e51fe70032305b828a001aac848f74fdb
ENV CMAKE_TOOLCHAIN_FILE /usr/src/mxe/usr/${MXE_TARGET_ARCH}-w64-mingw32.${MXE_TARGET_LINK}${MXE_TARGET_THREAD}/share/cmake/mxe-conf.cmake
ARG DEBIAN_FRONTEND=noninteractive
#
# WINE is used as an emulator for try_run and tests with CMake.
#
# Other dependencies are from the listed MXE requirements:
# http://mxe.cc/#requirements
# 'cmake' is omitted because it is installed from source in the base image
#
RUN \
apt-get update && \
apt-get install --no-install-recommends --yes \
autoconf \
automake \
autopoint \
bash \
bison \
bzip2 \
flex \
gettext \
git \
g++ \
g++-multilib \
gperf \
intltool \
libffi-dev \
libgdk-pixbuf2.0-dev \
libtool-bin \
libltdl-dev \
libssl-dev \
libxml-parser-perl \
libc6-dev-i386 \
lzip \
make \
openssl \
p7zip-full \
patch \
perl \
pkg-config \
python \
ruby \
scons \
sed \
unzip \
wget \
wine \
xz-utils \
&& \
#
# Install Wine
#
dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y wine32 && \
wine hostname && \
#
# Download MXE sources
#
cd /usr/src && \
git clone https://github.com/mxe/mxe.git && \
cd mxe && \
git checkout ${MXE_GIT_TAG} && \
#
# Configure "settings.mk" required to build MXE
#
cd /usr/src/mxe && \
echo "MXE_TARGETS := ${MXE_TARGET_ARCH}-w64-mingw32.${MXE_TARGET_LINK}${MXE_TARGET_THREAD}" > settings.mk && \
echo "MXE_USE_CCACHE :=" >> settings.mk && \
echo "MXE_PLUGIN_DIRS := plugins/gcc10" >> settings.mk && \
echo "LOCAL_PKG_LIST := cc cmake" >> settings.mk && \
echo ".DEFAULT local-pkg-list:" >> settings.mk && \
echo "local-pkg-list: \$(LOCAL_PKG_LIST)" >> settings.mk && \
#
# Build MXE
#
cd /usr/src/mxe && \
make JOBS=$(nproc) && \
#
# Cleanup: By keeping the MXE build system (Makefile, ...), derived images will be able to install
# additional packages.
#
rm -rf log pkg && \
#
# Update MXE toolchain file
#
echo 'set(CMAKE_CROSSCOMPILING_EMULATOR "/usr/bin/wine")' >> ${CMAKE_TOOLCHAIN_FILE} && \
#
# Replace cmake and cpack binaries
#
cd /usr/bin && \
rm cmake cpack && \
ln -s /usr/src/mxe/usr/bin/${MXE_TARGET_ARCH}-w64-mingw32.${MXE_TARGET_LINK}${MXE_TARGET_THREAD}-cmake cmake && \
ln -s /usr/src/mxe/usr/bin/${MXE_TARGET_ARCH}-w64-mingw32.${MXE_TARGET_LINK}${MXE_TARGET_THREAD}-cpack cpack
ENV PATH ${PATH}:/usr/src/mxe/usr/bin
ENV CROSS_TRIPLE ${MXE_TARGET_ARCH}-w64-mingw32.${MXE_TARGET_LINK}${MXE_TARGET_THREAD}
ENV AS=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-as \
AR=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ar \
CC=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-gcc \
CPP=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-cpp \
CXX=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-g++ \
LD=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ld \
FC=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-gfortran
WORKDIR /work