1DOLLY 82TOOLCHAIN mojo-llvm3REQUIRES HOST runtime@04REQUIRES HOST display@05REQUIRES HOST input@06REQUIRES HOST dso@07REQUIRES HOST http@08REQUIRES HOST sockets@09REQUIRES HOST threads@01011# Build-only: the LLVM, MLIR and Clang Basic libraries the Mojo compiler12# links, at the revision Mojo pins, compiled inside Dolly by its own cc and13# c++, over the zstd package: LLVM's Support compresses with Zstandard, and14# Mojo's precompiled packages are compressed.15FROM /demos/cmake/Dollyfile-cmake-build ec172ae8a3b79bf8dcf9ea2b9c070699dcf05b337ea738e2b6657bb1d0fb700416# LLVM's CMake requires a Python 3 interpreter.17INSTALL /demos/python/Dollyfile-python caf80d3cd27594e1ed0bc4bbd8d586359be411b6f5328e5d3fe89c4a6951576f18INSTALL /demos/tools/Dollyfile-zstd a139fc9b0d1a31f41803cc986d6e96456ed6d4ee683d7fe259df24a6b2f3a62b19REQUIRES TOOL cmake20REQUIRES TOOL make21REQUIRES TOOL python22REQUIRES TOOL cc23REQUIRES TOOL c++24REQUIRES TOOL ar25REQUIRES TOOL gzip26REQUIRES TOOL tar27REQUIRES TOOL patch28REQUIRES TOOL time29REQUIRES TOOL find30REQUIRES TOOL cp31REQUIRES TOOL mkdir32REQUIRES TOOL rm3334SOURCE /dist/static/mojo/mojo-llvm.tar.gz bb20b5265be3bcb4387eb866060e3fa6ba5a07fb132fad481793b6db0699ac75 /tmp/mojo-llvm.tar.gz35SLOP time slop -c 'gzip -dc /tmp/mojo-llvm.tar.gz | tar -xf - -C /'36SLOP rm /tmp/mojo-llvm.tar.gz37# As demos/llvm: config.guess runs and knows no Dolly host.38SOURCE /dist/static/mojo/llvm-host-triple.patch ec739fd5932c1040d07344a8511bae4da4157ff2bcafa348f06a555b71a10981 /tmp/llvm-host-triple.patch39SLOP patch -p1 -d /tmp/mojo-llvm -i /tmp/llvm-host-triple.patch40# Mojo's own patch to LLVM's code generator (bazel/public-patches/llvm_source.bzl);41# its others change LLDB and the Bazel overlay, which are not built.42SOURCE /dist/static/mojo/llvm-machinefunction-sti-ref-to-ptr.patch 6226c7dca544ff5ea5cf384bafecdfb49a4ef8f43d88c3996d310f25a42d6a53 /tmp/llvm-sti.patch43SLOP patch -p1 -d /tmp/mojo-llvm -i /tmp/llvm-sti.patch4445# As demos/llvm configures the seed's LLVM, with MLIR and Zstandard and46# without LLD. The default target is what Mojo compiles for when it is given47# none: a Dolly program, which its own target description turns into the48# wasm64-unknown-emscripten of Dolly's libc archives.49FILE /tmp/mojo-llvm/Dolly.cmake50    set(CMAKE_BUILD_TYPE Release CACHE STRING "")51    set(CMAKE_C_FLAGS "-std=gnu17" CACHE STRING "")52    set(CMAKE_CXX_FLAGS "-include endian.h -DCLANG_BUILD_STATIC" CACHE STRING "")53    set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON CACHE BOOL "")54    set(CMAKE_RULE_MESSAGES OFF CACHE BOOL "")55    set(LLVM_ENABLE_WARNINGS OFF CACHE BOOL "")56    set(LLVM_ENABLE_PROJECTS "clang;mlir" CACHE STRING "")57    set(LLVM_TARGETS_TO_BUILD WebAssembly CACHE STRING "")58    set(LLVM_HOST_TRIPLE wasm64-unknown-emscripten CACHE STRING "")59    set(LLVM_DEFAULT_TARGET_TRIPLE wasm64-unknown-dolly CACHE STRING "")60    set(LLVM_FORCE_VC_REVISION 4154b56ccc70220dca3fa1226fc8a24bafd90ac3 CACHE STRING "")61    set(LLVM_FORCE_VC_REPOSITORY https://github.com/llvm/llvm-project.git CACHE STRING "")62    foreach(option THREADS TERMINFO LIBEDIT LIBPFM ZLIB LIBXML2 CURL BINDINGS)63      set(LLVM_ENABLE_${option} OFF CACHE STRING "")64    endforeach()65    set(LLVM_ENABLE_ZSTD FORCE_ON CACHE STRING "")66    set(LLVM_USE_STATIC_ZSTD ON CACHE BOOL "")67    set(zstd_INCLUDE_DIR /usr/include CACHE PATH "")68    set(zstd_LIBRARY /usr/lib/libzstd.a CACHE FILEPATH "")69    set(zstd_STATIC_LIBRARY /usr/lib/libzstd.a CACHE FILEPATH "")70    foreach(option TESTS EXAMPLES BENCHMARKS DOCS)71      set(LLVM_INCLUDE_${option} OFF CACHE BOOL "")72    endforeach()73    set(LLVM_BUILD_LLVM_DYLIB OFF CACHE BOOL "")74    set(LLVM_LINK_LLVM_DYLIB OFF CACHE BOOL "")75    set(MLIR_ENABLE_BINDINGS_PYTHON OFF CACHE BOOL "")76    set(MLIR_ENABLE_EXECUTION_ENGINE OFF CACHE BOOL "")77SLOP time cmake -C /tmp/mojo-llvm/Dolly.cmake -S /tmp/mojo-llvm/llvm -B /tmp/mojo-llvm/build7879# The roots of what Mojo's BUILD.bazel files name of @llvm-project, MLIR's80# first; Make builds the TableGen tools and the libraries below them. Four jobs,81# as many as nproc reports; -k reports every failing unit, not only the first.82SLOP CWD /tmp/mojo-llvm/build time make -k -j4 MLIRCAPIIR MLIRCAPITransforms MLIRLspServerSupportLib \83  MLIRIndexToLLVM MLIRReconcileUnrealizedCasts MLIRBuiltinToLLVMIRTranslation MLIRLLVMToLLVMIRTranslation \84  MLIRNVVMToLLVMIRTranslation MLIRROCDLToLLVMIRTranslation clangBasic LLVMOrcDebugging LLVMMCJIT \85  LLVMWebAssemblyCodeGen LLVMWebAssemblyAsmParser LLVMWebAssemblyDisassembler86# The TableGen tools, the archives, and every header and TableGen source of87# the three projects with the configured and generated ones over them.88SLOP mkdir -p /opt/mojo-llvm/bin /opt/mojo-llvm/lib /opt/mojo-llvm/include89SLOP CWD /tmp/mojo-llvm/build slop -c 'cp bin/llvm-tblgen bin/mlir-tblgen /opt/mojo-llvm/bin && cp lib/*.a /opt/mojo-llvm/lib'90SLOP CWD /tmp/mojo-llvm cp -R llvm/include/llvm llvm/include/llvm-c mlir/include/mlir mlir/include/mlir-c clang/include/clang clang/include/clang-c /opt/mojo-llvm/include91SLOP CWD /tmp/mojo-llvm/build slop -c 'for tree in include tools/mlir/include tools/clang/include; do for f in $(cd $tree && find . -name CMakeFiles -prune -o -type f \( -name "*.inc" -o -name "*.def" -o -name "*.h" \) -print); do mkdir -p "/opt/mojo-llvm/include/${f%/*}"; cp "$tree/$f" "/opt/mojo-llvm/include/$f"; done; done'92SLOP cp /tmp/mojo-llvm/llvm/LICENSE.TXT /opt/mojo-llvm/LICENSE.TXT93SLOP rm -rf /tmp/mojo-llvm /tmp/llvm-host-triple.patch /tmp/llvm-sti.patch9495FOLDER /opt/mojo-llvm96SLOP /opt/mojo-llvm/bin/mlir-tblgen --version9798ENTRY /bin/foreground -i /bin/slop99