11# syntax=docker/dockerfile:1.17-labs
22ARG REGISTRY="docker.io"
3- ARG UBUNTU_MAJOR_VERSION="22"
43ARG BASE_IMAGE="ubuntu:22.04"
54ARG TARGET_LIST="x86_64-softmmu,i386-softmmu,arm-softmmu,aarch64-softmmu,ppc-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu"
65ARG CAPSTONE_VERSION="5.0.5"
@@ -26,10 +25,20 @@ COPY ./panda/dependencies/${BASE_IMAGE/:/_}_build.txt /tmp/build_dep.txt
2625RUN apt-get -qq update && \
2726 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $(cat /tmp/build_dep.txt | grep -o '^[^#]*' ) && \
2827 apt-get clean && \
29- python3 -m pip install --upgrade --no-cache-dir pip && \
30- python3 -m pip install --upgrade --no-cache-dir "cffi>1.14.3" && \
31- python3 -m pip install --upgrade --no-cache-dir "capstone" && \
32- curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
28+ curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal && \
29+ UBUNTU_VERSION=$(lsb_release -rs) && \
30+ if dpkg --compare-versions "$UBUNTU_VERSION" ge "23.04" ; then \
31+ python3 -m pip install --upgrade --no-cache-dir "cffi>1.14.3" --break-system-packages && \
32+ python3 -m pip install --upgrade --no-cache-dir "capstone" --break-system-packages; \
33+ python3 -m pip install setuptools_scm --break-system-packages && \
34+ python3 -m pip install build --break-system-packages; \
35+ else \
36+ python3 -m pip install --upgrade --no-cache-dir pip && \
37+ python3 -m pip install --upgrade --no-cache-dir "cffi>1.14.3" && \
38+ python3 -m pip install --upgrade --no-cache-dir "capstone" ; \
39+ python3 -m pip install setuptools_scm && \
40+ python3 -m pip install build; \
41+ fi
3342
3443# Then install capstone debian package
3544RUN cd /tmp && \
@@ -67,13 +76,13 @@ COPY .git /panda/
6776RUN git -C /panda submodule update --init dtc && \
6877 git -C /panda rev-parse HEAD > /usr/local/panda_commit_hash && \
6978 mkdir /panda/build && cd /panda/build && \
70- python3 -m pip install setuptools_scm && \
71- python3 -m pip install build && \
7279 python3 -m setuptools_scm -r .. --strip-dev 2>/dev/null >/tmp/savedversion && \
7380 /panda/configure \
7481 --target-list="${TARGET_LIST}" \
7582 --prefix=/usr/local \
7683 --disable-numa \
84+ --extra-cflags=-Wno-error \
85+ --extra-cxxflags=-Wno-error \
7786 --enable-llvm && \
7887 rm -rf /panda/.git
7988
@@ -105,7 +114,12 @@ RUN make -C /panda/build install && \
105114RUN cd /panda/panda/python/core && \
106115 python3 create_panda_datatypes.py --install && \
107116 PRETEND_VERSION=$(cat /tmp/savedversion) python3 -m build --wheel . && \
108- PRETEND_VERSION=$(cat /tmp/savedversion) pip install .
117+ UBUNTU_VERSION=$(lsb_release -rs) && \
118+ if dpkg --compare-versions "$UBUNTU_VERSION" ge "23.04" ; then \
119+ python3 -m pip install dist/*.whl --break-system-packages; \
120+ else \
121+ python3 -m pip install dist/*.whl; \
122+ fi
109123
110124# BUG: PANDA sometimes fails to generate all the necessary files for PyPANDA. This is a temporary fix to detect and fail when this occurs
111125RUN ls -alt $(pip show pandare | grep Location: | awk '{print $2}' )/pandare/autogen/
@@ -153,6 +167,7 @@ RUN ldconfig && \
153167
154168
155169FROM base AS packager
170+ ARG PACKAGE_VERSION
156171
157172# Install necessary tools for packaging
158173RUN apt-get -qq update && \
@@ -180,7 +195,6 @@ RUN cd /package-root && \
180195 find . -type f ! -path './DEBIAN/*' -exec md5sum {} + | sed 's| \. /| |' > /package-root/DEBIAN/md5sums
181196
182197# Update control file with the correct version, and place installed size
183- ARG PACKAGE_VERSION
184198RUN INSTALLED_SIZE=$(du -sk /package-root | cut -f1) && \
185199 sed -i "s/^Installed-Size:.*/Installed-Size: ${INSTALLED_SIZE}/" /package-root/DEBIAN/control
186200RUN sed -i "s/^Version:.*/Version: ${PACKAGE_VERSION}/" /package-root/DEBIAN/control
0 commit comments