diff options
Diffstat (limited to 'dynamic-layers/clang-layer/recipes-core/ispc')
| -rw-r--r-- | dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.29.1.bb | 83 |
1 files changed, 46 insertions, 37 deletions
diff --git a/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.29.1.bb b/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.29.1.bb index ed36df43..9b564461 100644 --- a/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.29.1.bb +++ b/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.29.1.bb | |||
| @@ -42,41 +42,45 @@ INSANE_SKIP:${PN} += "file-rdeps buildpaths" | |||
| 42 | INSANE_SKIP:${PN}-dbg += "buildpaths" | 42 | INSANE_SKIP:${PN}-dbg += "buildpaths" |
| 43 | 43 | ||
| 44 | # Only need native tools for building, LLVM 20.1 is bundled | 44 | # Only need native tools for building, LLVM 20.1 is bundled |
| 45 | # ncurses needed for libedit (LLVM dependency) | 45 | # ARCHITECTURAL NOTE: This recipe uses a superbuild approach that builds LLVM internally. |
| 46 | DEPENDS = "bison-native flex-native ninja-native ncurses" | 46 | # CMake isolation flags prevent the superbuild from finding libraries in recipe-sysroot-native. |
| 47 | # | ||
| 48 | # DEPENDS: Only native build tools, NO native libraries | ||
| 49 | DEPENDS = "bison-native flex-native ninja-native" | ||
| 47 | RDEPENDS:${PN}-ptest += "bash python3-multiprocessing" | 50 | RDEPENDS:${PN}-ptest += "bash python3-multiprocessing" |
| 48 | 51 | ||
| 49 | PACKAGECONFIG ??= "" | 52 | PACKAGECONFIG ??= "" |
| 50 | # Default to Threads tasking model; override with TBB if enabled | 53 | # Default to Threads tasking model; override with TBB if enabled |
| 51 | PACKAGECONFIG[tbb] = "-DISPCRT_BUILD_TASK_MODEL=TBB, , tbb" | 54 | PACKAGECONFIG[tbb] = "-DISPCRT_BUILD_TASK_MODEL=TBB, , tbb" |
| 52 | 55 | ||
| 53 | do_compile:prepend() { | 56 | # Use superbuild with bundled LLVM 20.1 |
| 54 | # Clean OE-specific flags from toolchain files for bundled LLVM build | 57 | OECMAKE_SOURCEPATH = "${S}/superbuild" |
| 58 | |||
| 59 | # Minimal patching of generated toolchain files to use full compiler paths | ||
| 60 | do_configure:append() { | ||
| 55 | for toolchain in stage1-toolchain.cmake stage2-toolchain.cmake; do | 61 | for toolchain in stage1-toolchain.cmake stage2-toolchain.cmake; do |
| 56 | [ -f ${B}/${toolchain} ] || continue | 62 | if [ -f ${B}/${toolchain} ]; then |
| 57 | sed -i -e 's|set(CMAKE_C\(XX\)\?_FLAGS.*|set(CMAKE_C\1_FLAGS "")|g' \ | 63 | # Replace symbolic compiler names with full paths for Yocto build environment |
| 58 | -e 's|set(CMAKE_\(EXE\|SHARED\|MODULE\)_LINKER_FLAGS.*|set(CMAKE_\1_LINKER_FLAGS "")|g' \ | 64 | sed -i -e "s|set(CMAKE_C_COMPILER cc)|set(CMAKE_C_COMPILER ${BUILD_CC})|" \ |
| 59 | ${B}/${toolchain} | 65 | -e "s|set(CMAKE_CXX_COMPILER c++)|set(CMAKE_CXX_COMPILER ${BUILD_CXX})|" \ |
| 66 | ${B}/${toolchain} | ||
| 67 | |||
| 68 | # Clear Yocto cross-compilation flags incompatible with host superbuild | ||
| 69 | sed -i -e 's|set(CMAKE_C\(XX\)\?_FLAGS .*|set(CMAKE_C\1_FLAGS "" CACHE STRING "CFLAGS")|' \ | ||
| 70 | -e 's|set(CMAKE_\(EXE\|SHARED\|MODULE\)_LINKER_FLAGS .*|set(CMAKE_\1_LINKER_FLAGS "" CACHE STRING "LDFLAGS")|' \ | ||
| 71 | ${B}/${toolchain} | ||
| 72 | fi | ||
| 60 | done | 73 | done |
| 61 | |||
| 62 | # Use native compilers for stage1 | ||
| 63 | [ -f ${B}/stage1-toolchain.cmake ] && sed -i \ | ||
| 64 | -e "s|set(CMAKE_C_COMPILER cc)|set(CMAKE_C_COMPILER ${BUILD_CC})|" \ | ||
| 65 | -e "s|set(CMAKE_CXX_COMPILER c++)|set(CMAKE_CXX_COMPILER ${BUILD_CXX})|" \ | ||
| 66 | ${B}/stage1-toolchain.cmake && \ | ||
| 67 | echo "set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)" >> ${B}/stage1-toolchain.cmake | ||
| 68 | } | 74 | } |
| 69 | 75 | ||
| 70 | |||
| 71 | |||
| 72 | # Use superbuild with bundled LLVM 20.1 | ||
| 73 | OECMAKE_SOURCEPATH = "${S}/superbuild" | ||
| 74 | |||
| 75 | EXTRA_OECMAKE += " \ | 76 | EXTRA_OECMAKE += " \ |
| 76 | --preset os \ | 77 | --preset os \ |
| 77 | -G Ninja \ | ||
| 78 | -DLLVM_VERSION=20.1 \ | 78 | -DLLVM_VERSION=20.1 \ |
| 79 | -DLLVM_DISABLE_ASSERTIONS=ON \ | 79 | -DLLVM_DISABLE_ASSERTIONS=ON \ |
| 80 | -DLLVM_ENABLE_LIBEDIT=OFF \ | ||
| 81 | -DLLVM_ENABLE_TERMINFO=OFF \ | ||
| 82 | -DLLVM_ENABLE_ZLIB=OFF \ | ||
| 83 | -DLLVM_ENABLE_ZSTD=OFF \ | ||
| 80 | -DLLVM_URL=${UNPACKDIR}/git/llvm-project \ | 84 | -DLLVM_URL=${UNPACKDIR}/git/llvm-project \ |
| 81 | -DVC_INTRINSICS_URL=${UNPACKDIR}/git/vc-intrinsics \ | 85 | -DVC_INTRINSICS_URL=${UNPACKDIR}/git/vc-intrinsics \ |
| 82 | -DVC_INTRINSICS_SHA=${SRCREV_vc} \ | 86 | -DVC_INTRINSICS_SHA=${SRCREV_vc} \ |
| @@ -98,16 +102,25 @@ EXTRA_OECMAKE += " \ | |||
| 98 | -DISPC_IOS_TARGET=OFF \ | 102 | -DISPC_IOS_TARGET=OFF \ |
| 99 | -DISPC_PS_TARGET=OFF \ | 103 | -DISPC_PS_TARGET=OFF \ |
| 100 | -DXE_DEPS=OFF \ | 104 | -DXE_DEPS=OFF \ |
| 105 | -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=NEVER \ | ||
| 106 | -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER \ | ||
| 107 | -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER \ | ||
| 101 | " | 108 | " |
| 102 | 109 | ||
| 103 | do_compile() { | 110 | do_compile() { |
| 104 | # Unset OE-specific flags for stage1 LLVM build | ||
| 105 | export CFLAGS_FOR_BUILD="" | ||
| 106 | export CXXFLAGS_FOR_BUILD="" | ||
| 107 | export LDFLAGS_FOR_BUILD="" | ||
| 108 | |||
| 109 | bbnote "Building ispc with bundled LLVM 20.1" | 111 | bbnote "Building ispc with bundled LLVM 20.1" |
| 110 | cmake --build "${B}" --target all -- ${EXTRA_OECMAKEBUILD} | 112 | |
| 113 | # Scope environment clearing to just the cmake build command | ||
| 114 | # This prevents Yocto cross-compilation flags from contaminating the host superbuild | ||
| 115 | env \ | ||
| 116 | CFLAGS= \ | ||
| 117 | CXXFLAGS= \ | ||
| 118 | CPPFLAGS= \ | ||
| 119 | LDFLAGS= \ | ||
| 120 | CMAKE_PREFIX_PATH= \ | ||
| 121 | CMAKE_LIBRARY_PATH= \ | ||
| 122 | CMAKE_INCLUDE_PATH= \ | ||
| 123 | cmake --build "${B}" --target all -- ${EXTRA_OECMAKEBUILD} | ||
| 111 | } | 124 | } |
| 112 | 125 | ||
| 113 | # Superbuild installs ispc to build/ispc-stage2 instead of ${D} | 126 | # Superbuild installs ispc to build/ispc-stage2 instead of ${D} |
| @@ -123,9 +136,9 @@ do_install:append:class-target() { | |||
| 123 | install -m 0755 ${S}/scripts/run_tests.py ${D}${libdir}/ispc/gio/ | 136 | install -m 0755 ${S}/scripts/run_tests.py ${D}${libdir}/ispc/gio/ |
| 124 | install -m 0644 ${S}/scripts/common.py ${D}${libdir}/ispc/gio/ | 137 | install -m 0644 ${S}/scripts/common.py ${D}${libdir}/ispc/gio/ |
| 125 | cp -r ${S}/tests ${D}${libdir}/ispc/gio/ | 138 | cp -r ${S}/tests ${D}${libdir}/ispc/gio/ |
| 126 | cp ${S}/test_static.isph ${D}${libdir}/ispc/gio/ || true | 139 | cp ${S}/tests/test_static.isph ${D}${libdir}/ispc/gio/ || true |
| 127 | cp ${S}/fail_db.txt ${D}${libdir}/ispc/gio/ || true | 140 | cp ${S}/tests/fail_db.txt ${D}${libdir}/ispc/gio/ || true |
| 128 | cp ${S}/test_static.cpp ${D}${libdir}/ispc/gio/ || true | 141 | cp ${S}/tests/test_static.cpp ${D}${libdir}/ispc/gio/ || true |
| 129 | } | 142 | } |
| 130 | 143 | ||
| 131 | do_install_ptest:class-target() { | 144 | do_install_ptest:class-target() { |
| @@ -133,15 +146,11 @@ do_install_ptest:class-target() { | |||
| 133 | install -m 0755 ${S}/scripts/run_tests.py ${D}${PTEST_PATH}/ | 146 | install -m 0755 ${S}/scripts/run_tests.py ${D}${PTEST_PATH}/ |
| 134 | install -m 0644 ${S}/scripts/common.py ${D}${PTEST_PATH}/ | 147 | install -m 0644 ${S}/scripts/common.py ${D}${PTEST_PATH}/ |
| 135 | cp -r ${S}/tests ${D}${PTEST_PATH}/ | 148 | cp -r ${S}/tests ${D}${PTEST_PATH}/ |
| 136 | cp ${S}/test_static.isph ${D}${PTEST_PATH}/ || true | 149 | cp ${S}/tests/test_static.isph ${D}${PTEST_PATH}/ || true |
| 137 | cp ${S}/fail_db.txt ${D}${PTEST_PATH}/ || true | 150 | cp ${S}/tests/fail_db.txt ${D}${PTEST_PATH}/ || true |
| 138 | cp ${S}/test_static.cpp ${D}${PTEST_PATH}/ || true | 151 | cp ${S}/tests/test_static.cpp ${D}${PTEST_PATH}/ || true |
| 139 | } | 152 | } |
| 140 | 153 | ||
| 141 | PACKAGES:prepend:class-target = "${PN}-test " | ||
| 142 | FILES:${PN}-test:class-target = "${libdir}/ispc/gio/*" | ||
| 143 | RDEPENDS:${PN}-test:class-target += "bash python3-multiprocessing ${PN}" | ||
| 144 | |||
| 145 | pkg_postinst:${PN}() { | 154 | pkg_postinst:${PN}() { |
| 146 | #!/bin/sh | 155 | #!/bin/sh |
| 147 | # Create /lib64 symlink if it doesn't exist (needed for ispc binary built with /lib64 interpreter path) | 156 | # Create /lib64 symlink if it doesn't exist (needed for ispc binary built with /lib64 interpreter path) |
