@@ -30,7 +30,7 @@ RUN git clone -b 2.4 https://github.com/souffle-lang/souffle && \
3030 make -C build install -j4
3131
3232# ------------------------------------------------------------------------------
33- # Build LIEF
33+ # Install LIEF
3434# ------------------------------------------------------------------------------
3535FROM ubuntu:20.04 AS lief
3636
@@ -41,11 +41,43 @@ RUN apt-get -y update && \
4141 build-essential \
4242 cmake \
4343 git \
44- python3
45-
46- RUN git clone -b 0.13.2 --depth 1 https://github.com/lief-project/LIEF.git /usr/local/src/LIEF && \
47- cmake -DLIEF_PYTHON_API=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF /usr/local/src/LIEF -B/usr/local/src/LIEF/build && \
48- cmake --build /usr/local/src/LIEF/build -j4 --target install
44+ python3 \
45+ python3-pip \
46+ wget
47+
48+ # Install CMake 3.24.0 (needed by LIEF 0.16.6)
49+ ENV CMAKE_VERSION=3.24.0
50+ RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz && \
51+ tar -xzf cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz && \
52+ mv cmake-${CMAKE_VERSION}-linux-x86_64 /opt/cmake && \
53+ rm /usr/bin/cmake && \
54+ ln -s /opt/cmake/bin/cmake /usr/bin/cmake && \
55+ rm cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz
56+
57+ RUN pip install conan==1.59 && \
58+ conan profile new default --detect && \
59+ conan remote add rewriting_remote https://git.grammatech.com/api/v4/packages/conan
60+
61+ ENV LIEF_VERSION="0.16.6"
62+
63+ RUN echo "[requires]\n\
64+ lief/${LIEF_VERSION}@rewriting+extra-packages/stable\n\
65+ \n\
66+ [generators]\n\
67+ CMakeDeps\n\
68+ CMakeToolchain" > /tmp/conanfile.txt
69+
70+ RUN conan install /tmp/conanfile.txt \
71+ --build=missing \
72+ --remote=rewriting_remote \
73+ -pr:b=default -pr:h=default
74+
75+ RUN PKG_DIR=$(find /root/.conan/data/lief/${LIEF_VERSION}/rewriting+extra-packages/stable/package -mindepth 1 -maxdepth 1 -type d) && \
76+ mkdir -p /opt/lief-pkg && \
77+ cp -a $PKG_DIR/include /opt/lief-pkg/ && \
78+ cp -a $PKG_DIR/lib /opt/lief-pkg/ && \
79+ cp -a $PKG_DIR/lib/cmake /opt/lief-pkg/ && \
80+ cp -a $PKG_DIR/lib/pkgconfig /opt/lief-pkg/ || true
4981
5082# ------------------------------------------------------------------------------
5183# Build libehp
@@ -182,7 +214,7 @@ RUN python3 -m pip install --no-cache-dir --upgrade pip && \
182214 pre-commit \
183215 pydot \
184216 sphinx \
185- lief==0.13.2
217+ lief==0.16.6
186218
187219# Setup pre-commit hooks.
188220WORKDIR /ddisasm
@@ -192,9 +224,9 @@ RUN git init && \
192224
193225COPY --from=souffle /usr/local/bin/souffle* /usr/local/bin/
194226COPY --from=souffle /usr/local/include/souffle/ /usr/local/include/souffle
195- COPY --from=lief /usr /lib/libLIEF.a /usr/lib/libLIEF.a
196- COPY --from=lief /usr/include/ LIEF /usr/include /LIEF
197- COPY --from=lief /usr/share/ LIEF /usr/share /LIEF
227+ COPY --from=lief /opt/lief-pkg /lib/libLIEF.a /usr/lib/libLIEF.a
228+ COPY --from=lief /opt/lief-pkg/lib/cmake/ LIEF /usr/lib/cmake /LIEF
229+ COPY --from=lief /opt/lief-pkg/include/ LIEF /usr/include /LIEF
198230COPY --from=libehp /usr/local/lib /usr/local/lib
199231COPY --from=libehp /usr/local/include /usr/local/include
200232COPY --from=UASM /usr/local/bin/uasm /usr/local/bin/uasm
0 commit comments