55# cd Code/MinimalLib/docker
66#
77# 2. build the JS and WASM libraries
8- # (the build-arg arguments are all optional)
8+ # (the build-arg arguments are all optional; in the following
9+ # example we select the more performant, though still experimental,
10+ # native WASM exception handling):
911# docker build -t rdkit-minimallib --network=host \
1012# --build-arg "RDKIT_GIT_URL=https://github.com/myfork/rdkit.git" \
11- # --build-arg "RDKIT_BRANCH=mybranch" .
13+ # --build-arg "RDKIT_BRANCH=mybranch" \
14+ # --build-arg "EXCEPTION_HANDLING=-fwasm-exceptions".
1215#
1316# 3. create a temporary container and copy built libraries
1417# from the container to your local filesystem, then destroy
2225ARG RDKIT_GIT_URL="https://github.com/rdkit/rdkit.git"
2326ARG RDKIT_BRANCH="master"
2427ARG EMSDK_VERSION="latest"
28+ ARG EXCEPTION_HANDLING="-fexceptions -sNO_DISABLE_EXCEPTION_CATCHING"
2529ARG BOOST_MAJOR_VERSION="1"
26- ARG BOOST_MINOR_VERSION="84 "
30+ ARG BOOST_MINOR_VERSION="87 "
2731ARG BOOST_PATCH_VERSION="0"
32+ ARG FREETYPE_VERSION="2.13.3"
2833
2934FROM debian:bookworm as build-stage
3035ARG RDKIT_GIT_URL
3136ARG RDKIT_BRANCH
3237ARG EMSDK_VERSION
38+ ARG EXCEPTION_HANDLING
3339ARG BOOST_MAJOR_VERSION
3440ARG BOOST_MINOR_VERSION
3541ARG BOOST_PATCH_VERSION
42+ ARG FREETYPE_VERSION
3643
3744LABEL maintainer=
"Greg Landrum <[email protected] >" 3845
@@ -49,16 +56,15 @@ RUN apt-get update && apt-get upgrade -y && apt install -y \
4956
5057ENV LANG C
5158
52- WORKDIR /opt
59+ WORKDIR /src
5360ARG BOOST_DOT_VERSION="${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_PATCH_VERSION}"
5461ARG BOOST_UNDERSCORE_VERSION="${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_${BOOST_PATCH_VERSION}"
55- RUN wget -q https://boostorg.jfrog .io/artifactory/main /release/${BOOST_DOT_VERSION}/source/boost_${BOOST_UNDERSCORE_VERSION}.tar.gz && \
62+ RUN wget -q https://archives.boost .io/release/${BOOST_DOT_VERSION}/source/boost_${BOOST_UNDERSCORE_VERSION}.tar.gz && \
5663 tar xzf boost_${BOOST_UNDERSCORE_VERSION}.tar.gz
57- WORKDIR /opt /boost_${BOOST_UNDERSCORE_VERSION}
64+ WORKDIR /src /boost_${BOOST_UNDERSCORE_VERSION}
5865RUN ./bootstrap.sh --prefix=/opt/boost --with-libraries=system && \
5966 ./b2 install
6067
61-
6268WORKDIR /opt
6369RUN git clone https://github.com/emscripten-core/emsdk.git
6470
@@ -68,30 +74,41 @@ RUN ./emsdk install ${EMSDK_VERSION} && \
6874
6975# RUN source ./emsdk_env.sh
7076
71- RUN mkdir /src
77+ RUN echo "source /opt/emsdk/emsdk_env.sh > /dev/null 2>&1" >> ~/.bashrc
78+ SHELL ["/bin/bash" , "-c" , "-l" ]
79+
80+ WORKDIR /src
81+ RUN wget -q https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
82+ tar xzf freetype-${FREETYPE_VERSION}.tar.gz
83+ WORKDIR /src/freetype-${FREETYPE_VERSION}
84+ RUN mkdir build
85+ WORKDIR /src/freetype-${FREETYPE_VERSION}/build
86+ RUN emcmake cmake -DCMAKE_BUILD_TYPE=Release -DWITH_ZLIB=OFF -DWITH_BZip2=OFF -DWITH_PNG=OFF \
87+ -DCMAKE_C_FLAGS="${EXCEPTION_HANDLING}" -DCMAKE_EXE_LINKER_FLAGS="${EXCEPTION_HANDLING}" \
88+ -DCMAKE_INSTALL_PREFIX=/opt/freetype ..
89+ RUN make -j2 && make -j2 install
90+
7291WORKDIR /src
7392ENV RDBASE=/src/rdkit
7493RUN git clone ${RDKIT_GIT_URL}
7594WORKDIR $RDBASE
7695RUN git fetch --all --tags && \
7796 git checkout ${RDKIT_BRANCH}
78-
7997RUN mkdir build
8098WORKDIR $RDBASE/build
81-
82- RUN echo "source /opt/emsdk/emsdk_env.sh > /dev/null 2>&1" >> ~/.bashrc
83- SHELL ["/bin/bash" , "-c" , "-l" ]
84- RUN emcmake cmake -DBoost_INCLUDE_DIR=/opt/boost/include -DRDK_BUILD_FREETYPE_SUPPORT=ON -DRDK_BUILD_MINIMAL_LIB=ON \
99+ RUN emcmake cmake -DRDK_BUILD_FREETYPE_SUPPORT=ON -DRDK_BUILD_MINIMAL_LIB=ON \
85100 -DRDK_BUILD_PYTHON_WRAPPERS=OFF -DRDK_BUILD_CPP_TESTS=OFF -DRDK_BUILD_INCHI_SUPPORT=ON \
86101 -DRDK_USE_BOOST_SERIALIZATION=OFF -DRDK_OPTIMIZE_POPCNT=OFF -DRDK_BUILD_THREADSAFE_SSS=OFF \
87102 -DRDK_BUILD_DESCRIPTORS3D=OFF -DRDK_TEST_MULTITHREADED=OFF \
88103 -DRDK_BUILD_MAEPARSER_SUPPORT=OFF -DRDK_BUILD_COORDGEN_SUPPORT=ON \
104+ -DBoost_DIR=/opt/boost/lib/cmake/Boost-${BOOST_DOT_VERSION} \
105+ -Dboost_headers_DIR=/opt/boost/lib/cmake/boost_headers-${BOOST_DOT_VERSION} \
89106 -DRDK_BUILD_SLN_SUPPORT=OFF -DRDK_USE_BOOST_IOSTREAMS=OFF \
90- -DFREETYPE_INCLUDE_DIRS=/opt/emsdk/upstream/emscripten/cache/sysroot /include/freetype2 \
91- -DFREETYPE_LIBRARY=/opt/emsdk/upstream/emscripten/cache/sysroot/ lib/wasm32-emscripten /libfreetype.a \
92- -DCMAKE_CXX_FLAGS="-Wno-enum-constexpr-conversion -s DISABLE_EXCEPTION_CATCHING=0 " \
93- -DCMAKE_C_FLAGS="-Wno-enum-constexpr-conversion -DCOMPILE_ANSI_ONLY" \
94- -DCMAKE_EXE_LINKER_FLAGS="-s MODULARIZE=1 -s EXPORT_NAME=\" 'initRDKitModule'\" " ..
107+ -DFREETYPE_INCLUDE_DIRS=/opt/freetype /include/freetype2 \
108+ -DFREETYPE_LIBRARY=/opt/freetype/ lib/libfreetype.a \
109+ -DCMAKE_CXX_FLAGS="${EXCEPTION_HANDLING} -O3 -DNDEBUG " \
110+ -DCMAKE_C_FLAGS="${EXCEPTION_HANDLING} -O3 -DNDEBUG -DCOMPILE_ANSI_ONLY" \
111+ -DCMAKE_EXE_LINKER_FLAGS="${EXCEPTION_HANDLING} -s STACK_OVERFLOW_CHECK=1 -s USE_PTHREADS=0 -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s MODULARIZE=1 -s EXPORT_NAME=\" 'initRDKitModule'\" " ..
95112
96113# "patch" to make the InChI code work with emscripten:
97114RUN cp /src/rdkit/External/INCHI-API/src/INCHI_BASE/src/util.c /src/rdkit/External/INCHI-API/src/INCHI_BASE/src/util.c.bak && \
0 commit comments