FROM quay.io/pypa/manylinux_2_28_x86_64:2022-11-19-1b19e81

RUN dnf update -y
RUN dnf install -y ninja-build hwloc-devel
# Install boost
ADD https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.gz /boost_1_71_0.tar.gz
RUN tar -xzvf /boost_1_71_0.tar.gz
WORKDIR /boost_1_71_0
RUN ./bootstrap.sh && ./b2 --with-filesystem install
# Build HPX
RUN git clone https://github.com/STEllAR-GROUP/hpx.git /hpx
WORKDIR /hpx
RUN git checkout 1.7.1
RUN mkdir build
# empty HPX_WITH_MAX_CPU_COUNT = dynamic
# ref https://github.com/STEllAR-GROUP/hpx/blob/1.7.1/CMakeLists.txt#L759
RUN cd build && cmake \
		-DHPX_WITH_MAX_CPU_COUNT="" \
		-DHPX_WITH_FETCH_ASIO=on \
		-DHPX_FILESYSTEM_WITH_BOOST_FILESYSTEM_COMPATIBILITY=ON \
		-DHPX_WITH_MALLOC=system ..
RUN cd build && make -j2

FROM scratch
COPY --from=0 /hpx/ /hpx/
