forked from GrammaTech/ddisasm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
185 lines (166 loc) · 7.39 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# ------------------------------------------------------------------------------
# Install Souffle
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS souffle
RUN apt-get update -y && apt-get install -y cmake lsb-release
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
automake \
bison \
build-essential \
doxygen \
flex \
git \
libffi-dev \
libsqlite3-dev \
libtool \
mcpp \
sqlite3 \
zlib1g-dev
RUN git clone -b 2.2 https://github.com/souffle-lang/souffle && \
cd souffle && \
cmake . -Bbuild -DCMAKE_BUILD_TYPE=Release -DSOUFFLE_USE_CURSES=0 -DSOUFFLE_USE_SQLITE=0 -DSOUFFLE_DOMAIN_64BIT=1 && \
cd build && \
make install -j4
# ------------------------------------------------------------------------------
# Install LIEF
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS LIEF
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
build-essential \
cmake \
git \
python3
RUN git clone -b 0.11.5 --depth 1 https://github.com/lief-project/LIEF.git /usr/local/src/LIEF
RUN cmake -DLIEF_PYTHON_API=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF /usr/local/src/LIEF -B/usr/local/src/LIEF/build
RUN cmake --build /usr/local/src/LIEF/build -j --target all install
# ------------------------------------------------------------------------------
# Install libehp
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS libehp
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
build-essential \
cmake \
git
RUN git clone https://git.zephyr-software.com/opensrc/libehp.git /usr/local/src/libehp
RUN git -C /usr/local/src/libehp reset --hard ddb106c4c1e521bf4b282d17e2a8abf0aa0fe721
RUN cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DEHP_BUILD_SHARED_LIBS=OFF /usr/local/src/libehp -B/usr/local/src/libehp/build
RUN cmake --build /usr/local/src/libehp/build -j --target all install
# ------------------------------------------------------------------------------
# Install GTIRB
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS gtirb
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
cmake \
build-essential \
protobuf-compiler \
libboost-filesystem-dev \
libboost-filesystem1.71.0 \
python3 \
git
RUN git clone --depth 1 https://github.com/GrammaTech/gtirb /usr/local/src/gtirb
RUN cmake -DGTIRB_JAVA_API=OFF -DGTIRB_CL_API=OFF /usr/local/src/gtirb -B/usr/local/src/gtirb/build
RUN cmake --build /usr/local/src/gtirb/build -j --target all install
# ------------------------------------------------------------------------------
# Install gtirb-pprinter
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS gtirb-pprinter
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
cmake \
build-essential \
protobuf-compiler \
libboost-filesystem-dev \
libboost-filesystem1.71.0 \
libboost-system-dev \
libboost-system1.71.0 \
libboost-program-options-dev \
libboost-program-options1.71.0 \
python3 \
git \
wget
RUN wget https://download.grammatech.com/gtirb/files/apt-repo/pool/unstable/libc/libcapstone-dev/libcapstone-dev_5.0.0-gtdev_amd64.deb \
&& dpkg -i libcapstone-dev_*_amd64.deb \
&& rm libcapstone-dev_*_amd64.deb
COPY --from=gtirb /usr/local/lib /usr/local/lib
COPY --from=gtirb /usr/local/include /usr/local/include
RUN git clone --depth 1 https://github.com/GrammaTech/gtirb-pprinter /usr/local/src/gtirb-pprinter
RUN cmake /usr/local/src/gtirb-pprinter -B/usr/local/src/gtirb-pprinter/build
RUN cmake --build /usr/local/src/gtirb-pprinter/build -j --target all install
# ------------------------------------------------------------------------------
# Install Ddisasm
# ------------------------------------------------------------------------------
FROM ubuntu:20.04 AS ddisasm
RUN export DEBIAN_FRONTEND=noninteractive
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
RUN apt-get -y update \
&& apt-get -y install \
build-essential \
clang \
cmake \
g++ \
git \
lib32gcc-9-dev \
lib32stdc++-9-dev \
libboost-filesystem-dev \
libboost-filesystem1.71.0 \
libboost-program-options-dev \
libboost-program-options1.71.0 \
libboost-system-dev \
libboost-system1.71.0 \
libc-dev-i386-cross \
mcpp \
pandoc \
protobuf-compiler \
python3 \
wget
RUN wget https://download.grammatech.com/gtirb/files/apt-repo/pool/unstable/libc/libcapstone-dev/libcapstone-dev_5.0.0-gtdev_amd64.deb \
&& dpkg -i libcapstone-dev_*_amd64.deb \
&& rm libcapstone-dev_*_amd64.deb
COPY --from=souffle /usr/local/bin/souffle* /usr/local/bin/
COPY --from=souffle /usr/local/include /usr/local/include
COPY --from=LIEF /usr/lib/libLIEF.a /usr/lib/libLIEF.a
COPY --from=LIEF /usr/include/LIEF /usr/include/LIEF
COPY --from=LIEF /usr/share/LIEF /usr/share/LIEF
COPY --from=libehp /usr/local/lib /usr/local/lib
COPY --from=libehp /usr/local/include /usr/local/include
COPY --from=gtirb /usr/local/lib /usr/local/lib
COPY --from=gtirb /usr/local/include /usr/local/include
COPY --from=gtirb-pprinter /usr/local/bin/gtirb* /usr/local/bin/
COPY --from=gtirb-pprinter /usr/local/lib /usr/local/lib
COPY --from=gtirb-pprinter /usr/local/include /usr/local/include
ARG DDISASM_URL=https://github.com/GrammaTech/ddisasm
ARG DDISASM_BRANCH=master
RUN git clone --depth 1 -b $DDISASM_BRANCH $DDISASM_URL /usr/local/src/ddisasm
RUN cmake -DLIEF_ROOT=/usr/ -DCMAKE_BUILD_TYPE=Release /usr/local/src/ddisasm -B/usr/local/src/ddisasm/build
RUN cmake --build /usr/local/src/ddisasm/build -j --target all install
# ------------------------------------------------------------------------------
# Final image
# ------------------------------------------------------------------------------
FROM ubuntu:20.04
COPY --from=ddisasm /lib/x86_64-linux-gnu/libboost_filesystem.so.1.71.0 /lib/x86_64-linux-gnu/libboost_filesystem.so.1.71.0
COPY --from=ddisasm /lib/x86_64-linux-gnu/libboost_program_options.so.1.71.0 /lib/x86_64-linux-gnu/libboost_program_options.so.1.71.0
COPY --from=ddisasm /lib/libcapstone.so.5 /lib/libcapstone.so.5
COPY --from=ddisasm /lib/x86_64-linux-gnu/libgomp.so.1 /lib/x86_64-linux-gnu/libgomp.so.1
COPY --from=ddisasm /usr/local/lib/libgtirb.so.* /usr/local/lib/
COPY --from=ddisasm /usr/local/lib/libgtirb_layout.so.* /usr/local/lib/
COPY --from=ddisasm /usr/local/lib/libgtirb_pprinter.so.* /usr/local/lib/
COPY --from=ddisasm /lib/x86_64-linux-gnu/libprotobuf.so.17 /lib/x86_64-linux-gnu/libprotobuf.so.17
COPY --from=ddisasm /usr/local/bin/ddisasm /usr/local/bin/
COPY --from=ddisasm /usr/local/bin/gtirb* /usr/local/bin/
ENV LD_LIBRARY_PATH=/usr/local/lib
RUN gtirb-pprinter --version
RUN ddisasm --version