diff --git a/BuildAll.sh b/BuildAll.sh index 1818159..2e8ccfa 100644 --- a/BuildAll.sh +++ b/BuildAll.sh @@ -6,10 +6,6 @@ set -u # Treat unset variables as an error when substituting. export CMAKE_BUILD_TYPE="Release" -# Choose between clang/clang++ or gcc/g++ -export CC="gcc" -export CXX="g++" - # Build CCL cd /home/ccl conan profile detect --force diff --git a/Dockerfile b/Dockerfile index 88c5b4c..043415c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,94 +1,49 @@ # ubunutu is the base image -FROM ubuntu:jammy as cpp-builder +FROM quay.io/pypa/manylinux_2_28_x86_64 as builder LABEL version="1.0" LABEL maintainer="IRBorisov iborisov@acconcept.ru" LABEL description="Linux build environment" -ARG LINUX_FLAVOR=ubuntu -ARG LINUX_DISTR=jammy ARG DEBIAN_FRONTEND=noninteractive # Install standard packages -RUN apt-get update -qq && \ - apt-get full-upgrade -y && \ - apt-get install -y --no-install-recommends \ +RUN dnf update && \ + dnf upgrade -y && \ + dnf install -y \ nano \ + make \ wget \ curl \ - tar \ - unzip \ - git \ - software-properties-common \ - build-essential \ - gpg-agent && \ - rm -rf /var/lib/apt/lists/* + tar && \ + dnf update -y && \ + dnf clean all -# Install Python and Conan -RUN add-apt-repository -y ppa:deadsnakes/ppa && \ - apt-get update -qq && \ - apt-get install -y --no-install-recommends \ - python3.12 \ - python3.12-venv \ - python3.12-dev && \ - curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 && \ - python3.12 -m pip install --upgrade pip setuptools && \ - python3.12 -m pip install conan && \ - rm -rf /var/lib/apt/lists/* - -# Add GCC compiler +# GCC compiler ARG GCC_VER="13" -RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ - apt-get update -qq && \ - apt-get install -y --no-install-recommends \ - gcc-${GCC_VER} \ - g++-${GCC_VER} && \ - update-alternatives --install /usr/bin/gcc gcc $(which gcc-${GCC_VER}) 100 && \ - update-alternatives --install /usr/bin/g++ g++ $(which g++-${GCC_VER}) 100 && \ - rm -rf /var/lib/apt/lists/* +RUN dnf install -y \ + gcc-toolset-${GCC_VER} \ + gcc-toolset-${GCC_VER}-gcc-c++ && \ + dnf remove -y gcc-toolset-12-* && \ + dnf clean all -# Add Clang compiler -ARG LLVM_VER="18" -RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - 2>/dev/null -RUN add-apt-repository -y "deb http://apt.llvm.org/${LINUX_DISTR}/ llvm-toolchain-${LINUX_DISTR}-${LLVM_VER} main" && \ - apt-get update -qq && \ - apt-get install -y --no-install-recommends \ - clang-${LLVM_VER} \ - clang-tools-${LLVM_VER} \ - clangd-${LLVM_VER} \ - lld-${LLVM_VER} \ - lldb-${LLVM_VER} \ - llvm-${LLVM_VER} \ - llvm-${LLVM_VER}-dev \ - llvm-${LLVM_VER}-runtime \ - libc++-${LLVM_VER}-dev \ - libc++abi-${LLVM_VER}-dev \ - libclang-${LLVM_VER}-dev \ - libclang-common-${LLVM_VER}-dev \ - libfuzzer-${LLVM_VER}-dev \ - clang-tidy-${LLVM_VER} && \ - update-alternatives --install /usr/bin/clang clang $(which clang-${LLVM_VER}) 100 && \ - update-alternatives --install /usr/bin/clang++ clang++ $(which clang++-${LLVM_VER}) 100 && \ - update-alternatives --install /usr/bin/clang-tidy clang-tidy $(which clang-tidy-${LLVM_VER}) 1 && \ - rm -rf /var/lib/apt/lists/* +ENV CC="/opt/rh/gcc-toolset-${GCC_VER}/root/bin/gcc" +ENV CXX="/opt/rh/gcc-toolset-${GCC_VER}/root/bin/g++" +ENV PATH="/opt/python/cp312-cp312/bin:/opt/rh/gcc-toolset-13/root/bin:${PATH}" -# Add CMake -RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \ - | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \ - apt-add-repository "deb https://apt.kitware.com/${LINUX_FLAVOR}/ ${LINUX_DISTR} main" && \ - apt-get update -qq && \ - apt-get install -y --no-install-recommends \ - cmake && \ - rm -rf /var/lib/apt/lists/* - -# Cleanup cached apt data we don't need anymore -RUN apt-get autoclean -y && \ - apt-get autoremove -y && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* +# Install build tools +RUN python3.12 -m pip install \ + auditwheel \ + wheel \ + build \ + ninja \ + cmake \ + conan # ====================== END OF CPP-Python environment ================== -FROM cpp-builder as CCL +FROM builder as CCL + +ENV TARGET_PLATFORM='manylinux_2_28_x86_64' WORKDIR /home diff --git a/pyconcept/scripts/Build.sh b/pyconcept/scripts/Build.sh index 5eac964..e249dcc 100644 --- a/pyconcept/scripts/Build.sh +++ b/pyconcept/scripts/Build.sh @@ -1,13 +1,16 @@ -# Build script for Linux -set -e +# pyconcept Build script +# * using auditwheel to create standardazied packages +set -e # Exit immediately if a command exits with a non-zero status. +set -u # Treat unset variables as an error when substituting. + +export CMAKE_BUILD_TYPE="Release" packageName='pyconcept' output='../output/py' -pythonEnv='venv/bin/python3' +python='python3.12' -# Setup python env -python3.12 -m venv venv -${pythonEnv} -m pip install -r requirements-build.txt +# Setup python dependencies +${python} -m pip install -r requirements-build.txt # Import sources from ccl mkdir -p ccl @@ -17,16 +20,23 @@ cd ../pyconcept # Build pyconcept rm -rf ${output}/${packageName} -${pythonEnv} -m build --no-isolation --wheel --outdir=${output}/${packageName} +# ${python} -m build --no-isolation --wheel --outdir=${output}/${packageName} +${python} -m pip wheel . -w "${output}/${packageName}" +wheel=$(find ${output}/${packageName} -name '*.whl') +auditwheel \ + repair ${wheel} \ + --plat "${TARGET_PLATFORM}" \ + -w "${output}/${packageName}" + +rm ${wheel} wheel=$(find ${output}/${packageName} -name '*.whl') # Test pyconcept -${pythonEnv} -m pip uninstall -y ${packageName} -${pythonEnv} -m pip install ${wheel} -${pythonEnv} -m unittest +${python} -m pip uninstall -y ${packageName} +${python} -m pip install ${wheel} +${python} -m unittest -# rm -rf venv # rm -rf build exit 0 \ No newline at end of file