-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
148 lines (127 loc) · 4.01 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
FROM ubuntu:22.04
SHELL ["/bin/bash", "-c"]
RUN apt update \
&& apt install -y \
git \
python-is-python3 \
xz-utils \
lbzip2 \
automake \
libtool \
autoconf \
make \
qt6-base-dev \
build-essential \
cmake \
zip
WORKDIR /
RUN git clone https://github.com/emscripten-core/emsdk.git
WORKDIR /emsdk
RUN git fetch -a \
&& git checkout 3.1.56
RUN ./emsdk install 3.1.56
RUN ./emsdk activate 3.1.56
RUN . /emsdk/emsdk_env.sh && qtchooser -install qt6 $(which qmake6)
ENV QT_SELECT=qt6
WORKDIR /
RUN git clone https://github.com/google/gumbo-parser.git
WORKDIR /gumbo-parser
RUN git checkout aa91b2
RUN ./autogen.sh
RUN . /emsdk/emsdk_env.sh \
&& emconfigure ./configure
RUN . /emsdk/emsdk_env.sh \
&& emmake make
RUN . /emsdk/emsdk_env.sh \
&& emmake make install
WORKDIR /
RUN git clone https://github.com/jasenhuang/katana-parser.git
WORKDIR /katana-parser
RUN git checkout be6df4
RUN ./autogen.sh
RUN . /emsdk/emsdk_env.sh \
&& emconfigure ./configure
RUN . /emsdk/emsdk_env.sh \
&& emmake make
RUN . /emsdk/emsdk_env.sh \
&& emmake make install
# emscriptens boost does not work because of missing symbols
WORKDIR /
RUN git clone https://github.com/boostorg/boost.git
WORKDIR /boost
RUN git checkout boost-1.84.0
RUN git submodule update --init --recursive
RUN . /emsdk/emsdk_env.sh \
&& CXXFLAGS=-fms-extensions emcmake cmake '-DBOOST_EXCLUDE_LIBRARIES=context;cobalt;coroutine;fiber;log;thread;wave;type_erasure;serialization;locale;contract;graph'
RUN . /emsdk/emsdk_env.sh \
&& emmake make
RUN . /emsdk/emsdk_env.sh \
&& emmake make install
COPY core /core
WORKDIR /core
# ENV DEV_MODE=on
COPY embuild.sh /bin/embuild.sh
RUN embuild.sh UnicodeConverter
RUN embuild.sh Common
# Link zlib into Common instead of including it in the build
RUN sed -i -e 's/build_all_zlib//' \
Common/kernel.pro
RUN sed -i -e 's/build_zlib_as_sources//' \
Common/kernel.pro
# Do not include zlib in the build, but link it later
RUN sed -i -e 's,$$OFFICEUTILS_PATH/src/zlib[^ ]*\.c,,' \
DesktopEditor/graphics/pro/raster.pri
RUN sed -i -e 's,$$OFFICEUTILS_PATH/src/zlib[^ ]*\.c,,' \
DesktopEditor/graphics/pro/freetype.pri
RUN embuild.sh DesktopEditor/graphics/pro
# Do not include freetype in the build, but link it later
RUN sed -i -e 's,$$FREETYPE_PATH/[^ ]*\.c,,' \
DesktopEditor/graphics/pro/freetype.pri
RUN embuild.sh TxtFile/Projects/Linux
RUN embuild.sh OOXML/Projects/Linux/BinDocument
RUN embuild.sh OOXML/Projects/Linux/DocxFormatLib
RUN embuild.sh OOXML/Projects/Linux/PPTXFormatLib
RUN embuild.sh OOXML/Projects/Linux/XlsbFormatLib
RUN embuild.sh MsBinaryFile/Projects/VbaFormatLib/Linux
RUN embuild.sh MsBinaryFile/Projects/DocFormatLib/Linux
RUN embuild.sh MsBinaryFile/Projects/PPTFormatLib/Linux
RUN embuild.sh MsBinaryFile/Projects/XlsFormatLib/Linux
RUN embuild.sh OdfFile/Projects/Linux
RUN embuild.sh RtfFile/Projects/Linux
RUN embuild.sh Common/cfcpp
RUN embuild.sh Common/3dParty/cryptopp/project
# RUN embuild.sh Fb2File
RUN embuild.sh Common/Network
RUN embuild.sh --no-sanitize PdfFile
# RUN embuild.sh HtmlFile2
# RUN embuild.sh EpubFile
# RUN embuild.sh XpsFile
# RUN embuild.sh DjVuFile
# RUN embuild.sh HtmlRenderer
RUN embuild.sh -q "CONFIG+=doct_renderer_empty" DesktopEditor/doctrenderer
RUN embuild.sh DocxRenderer
COPY pre-js.js /pre-js.js
COPY wrap-main.cpp /wrap-main.cpp
RUN cat /wrap-main.cpp >> /core/X2tConverter/src/main.cpp
RUN embuild.sh \
-c -g \
-l "-lgumbo" \
-l "-lkatana" \
-l "-L/usr/local/lib" \
-l "--pre-js /pre-js.js" \
-l "-sEXPORTED_RUNTIME_METHODS=ccall,FS" \
-l "-sEXPORTED_FUNCTIONS=_main1" \
-l "-sALLOW_MEMORY_GROWTH" \
X2tConverter/build/Qt/X2tConverter.pro
WORKDIR /core/build/bin/linux_64/
RUN cp x2t x2t.js
RUN zip x2t.zip x2t.wasm x2t.js
RUN sha512sum x2t.zip > x2t.zip.sha512
WORKDIR /
RUN cp /core/build/bin/linux_64/x2t* .
COPY test.js /test.js
EXPOSE 9229
# CMD . /emsdk/emsdk_env.sh \
# && node --inspect-brk=0.0.0.0:9229 test.js
CMD . /emsdk/emsdk_env.sh \
&& node test.js