|
| 1 | +# Note that this script can accept some limited command-line arguments, run |
| 2 | +# `julia build_tarballs.jl --help` to see a usage message. |
| 3 | +using BinaryBuilder, Pkg |
| 4 | + |
| 5 | +name = "ROCmCompilerSupport" |
| 6 | +version = v"4.0.0" |
| 7 | + |
| 8 | +# Collection of sources required to build |
| 9 | +sources = [ |
| 10 | + ArchiveSource("https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/archive/rocm-$(version).tar.gz", |
| 11 | + "f389601fb70b2d9a60d0e2798919af9ddf7b8376a2e460141507fe50073dfb31"), # 4.0.0 |
| 12 | + DirectorySource("./bundled"), |
| 13 | +] |
| 14 | + |
| 15 | +# Bash recipe for building across all platforms |
| 16 | +script = raw""" |
| 17 | +ln -s ${bindir}/../tools/* ${bindir}/ |
| 18 | +
|
| 19 | +cd ${WORKSPACE}/srcdir/ROCm-CompilerSupport*/lib/comgr |
| 20 | +
|
| 21 | +# first manually build bc2h utility |
| 22 | +cd cmake && mkdir bc2h && cd bc2h |
| 23 | +cp ../bc2h.cmake CMakeLists.txt |
| 24 | +CC=$HOSTCC cmake -DCMAKE_C_COMPILER=$HOSTCC . |
| 25 | +make |
| 26 | +cd ../.. |
| 27 | +
|
| 28 | +# then build everything else |
| 29 | +atomic_patch -p1 $WORKSPACE/srcdir/patches/disable-1031.patch |
| 30 | +atomic_patch -p1 $WORKSPACE/srcdir/patches/disable-tests.patch |
| 31 | +atomic_patch -p1 $WORKSPACE/srcdir/patches/disable-bc2h.patch |
| 32 | +mkdir build && cd build |
| 33 | +cp ../cmake/bc2h/bc2h . |
| 34 | +# TODO: -DROCM_DIR=${prefix} |
| 35 | +cmake -DCMAKE_PREFIX_PATH=${prefix} \ |
| 36 | + -DCMAKE_INSTALL_PREFIX=${prefix} \ |
| 37 | + -DCMAKE_BUILD_TYPE=Release \ |
| 38 | + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN%.*}_clang.cmake \ |
| 39 | + -DLLVM_DIR="${prefix}/lib/cmake/llvm" \ |
| 40 | + -DClang_DIR="${prefix}/lib/cmake/clang" \ |
| 41 | + -DLLD_DIR="${prefix}/lib/cmake/ldd" \ |
| 42 | + .. |
| 43 | +PATH=../cmake/bc2h:$PATH make -j${nproc} |
| 44 | +make install |
| 45 | +
|
| 46 | +find $WORKSPACE/destdir/bin -type l -delete |
| 47 | +""" |
| 48 | + |
| 49 | +# These are the platforms we will build for by default, unless further |
| 50 | +# platforms are passed in on the command line |
| 51 | +platforms = [ |
| 52 | + # TODO: cxx03 |
| 53 | + Platform("x86_64", "linux"; libc="glibc", cxxstring_abi="cxx11"), |
| 54 | + Platform("x86_64", "linux"; libc="musl", cxxstring_abi="cxx11"), |
| 55 | +] |
| 56 | + |
| 57 | +# The products that we will ensure are always built |
| 58 | +products = [ |
| 59 | + LibraryProduct(["libamd_comgr"], :libamd_comgr; dont_dlopen=true), |
| 60 | +] |
| 61 | + |
| 62 | +# Dependencies that must be installed before this package can be built |
| 63 | +dependencies = [ |
| 64 | + Dependency("hsa_rocr_jll"), |
| 65 | + Dependency("ROCmDeviceLibs_jll"), |
| 66 | + BuildDependency(PackageSpec(; name="LLVM_full_jll", version=v"11.0.1")), |
| 67 | +] |
| 68 | + |
| 69 | +# Build the tarballs, and possibly a `build.jl` as well. |
| 70 | +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies, |
| 71 | + preferred_gcc_version=v"8", preferred_llvm_version=v"11") |
0 commit comments