diff --git a/.github/workflows/_matrix.yml b/.github/workflows/_matrix.yml index 67cb4f4..439995f 100644 --- a/.github/workflows/_matrix.yml +++ b/.github/workflows/_matrix.yml @@ -27,6 +27,8 @@ env: GH_OSSUTIL_REGION: ${{ secrets.GH_OSSUTIL_REGION }} GH_OSSUTIL_PKGS: ${{ secrets.GH_OSSUTIL_PKGS }} GH_OSSUTIL_CNAME: ${{ secrets.GH_OSSUTIL_CNAME }} + INST_DIR: ${{ github.workspace }}/${{ github.workflow }} + CCACHE_DIR: ${{ github.workspace }}/.ccache jobs: _preset: @@ -64,6 +66,10 @@ jobs: matrix=$(cat .github/matrix.json | jq -c -M "map(. | select($jq_expr) )") matrix=$(echo ${matrix} | jq -c -M "map(if ${host_macos} then . + {os: \"macos-14\"} else . end)") + + [ "${{ github.workflow }}" == "llvm" ] && \ + { matrix=$(echo ${matrix} | jq -c -M 'map(. | select((.platform=="macosx")) )'); } + printf "\e[1m\e[33m%s\e[0m\n" "matrix: $matrix" echo "matrix={\"include\":$(echo $matrix)}" >> "$GITHUB_OUTPUT" - name: set matrix container @@ -91,8 +97,6 @@ jobs: shell: ${{ startsWith(matrix.os, 'windows') && 'pwsh' || 'bash' }} working-directory: ${{ github.workspace }} env: - INST_DIR: ${{ github.workspace }}/${{ github.workflow }} - CCACHE_DIR: ${{ github.workspace }}/.ccache CCACHE_GHA_KEY: ${{ github.workflow }}-${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} CCACHE_GHA_KEY_RESTORE: ${{ github.workflow }}-${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }} PKG_ZIP_NAME: ${{ github.workflow }}_${{ matrix.platform }}_${{ matrix.arch }}_${{ needs._preset.outputs.pkgver }}_${{ matrix.pkg_type }} @@ -116,6 +120,9 @@ jobs: - name: buildx library - ${{ github.workflow }} run: | ./build_${{ matrix.platform }}_${{ matrix.arch }}.sh ${{ github.workflow }} ${{ matrix.pkg_type }} + + # keep file permissions and case sensitivity + tar -cvf ${{ env.PKG_ZIP_NAME }}.tar ${{ github.workflow }} - name: gh action ccache save uses: actions/cache/save@v4 with: @@ -125,7 +132,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: ${{ env.PKG_ZIP_NAME }} - path: ${{ env.INST_DIR }} + path: ${{ env.PKG_ZIP_NAME }}.tar - name: commit to pre-compiled storage if: ${{ github.event_name == 'push' && (! inputs.disable_upload) }} run: | @@ -145,19 +152,16 @@ jobs: shell: bash working-directory: ${{ github.workspace }} env: - INST_DIR: ${{ github.workspace }}/${{ github.workflow }} - CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_GHA_KEY: ${{ github.workflow }}-${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} + CCACHE_GHA_KEY_RESTORE: ${{ github.workflow }}-${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }} + PKG_ZIP_NAME: ${{ github.workflow }}_${{ matrix.platform }}_${{ matrix.arch }}_${{ needs._preset.outputs.pkgver }}_${{ matrix.pkg_type }} steps: - name: set required env + if: ${{ matrix.platform == 'linux' }} run: | - CCACHE_GHA_KEY='${{ github.workflow }}-${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}' - CCACHE_GHA_KEY_RESTORE='${{ github.workflow }}-${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }}' - PKG_ZIP_NAME='${{ github.workflow }}_${{ matrix.platform }}_${{ matrix.arch }}_${{ needs._preset.outputs.pkgver }}_${{ matrix.pkg_type }}' - if [[ ${{ matrix.platform == 'linux' }} ]]; then - CCACHE_GHA_KEY='${{ github.workflow }}-${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.lib_impl }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}' - CCACHE_GHA_KEY_RESTORE='${{ github.workflow }}-${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.lib_impl }}' - PKG_ZIP_NAME='${{ github.workflow }}_${{ matrix.platform }}_${{ matrix.arch }}-${{ matrix.lib_impl }}_${{ needs._preset.outputs.pkgver }}_${{ matrix.pkg_type }}' - fi + CCACHE_GHA_KEY='${{ github.workflow }}-${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.lib_impl }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}' + CCACHE_GHA_KEY_RESTORE='${{ github.workflow }}-${{ matrix.pkg_type }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.lib_impl }}' + PKG_ZIP_NAME='${{ github.workflow }}_${{ matrix.platform }}_${{ matrix.arch }}-${{ matrix.lib_impl }}_${{ needs._preset.outputs.pkgver }}_${{ matrix.pkg_type }}' echo "CCACHE_GHA_KEY=${CCACHE_GHA_KEY}" >> "$GITHUB_ENV" echo "CCACHE_GHA_KEY_RESTORE=${CCACHE_GHA_KEY_RESTORE}" >> "$GITHUB_ENV" @@ -189,6 +193,9 @@ jobs: SCRIPT_NAME='crossbuild_${{ matrix.platform }}_${{ matrix.lib_impl }}_${{ matrix.arch }}.sh' fi ./${SCRIPT_NAME} ${{ github.workflow }} ${{ matrix.pkg_type }} + + # keep file permissions and case sensitivity + tar -cvf ${{ env.PKG_ZIP_NAME }}.tar ${{ github.workflow }} - name: gh action ccache save uses: actions/cache/save@v4 with: @@ -198,7 +205,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: ${{ env.PKG_ZIP_NAME }} - path: ${{ env.INST_DIR }} + path: ${{ env.PKG_ZIP_NAME }}.tar - name: commit to pre-compiled storage if: ${{ github.event_name == 'push' && (! inputs.disable_upload) }} run: | diff --git a/.github/workflows/llvm.yml b/.github/workflows/llvm.yml new file mode 100644 index 0000000..5921238 --- /dev/null +++ b/.github/workflows/llvm.yml @@ -0,0 +1,37 @@ +name: llvm +on: + workflow_dispatch: + push: + branches: + - main + paths: + - '.github/matrix*.json' + - '.github/workflows/_matrix.yml' + - '.github/workflows/llvm.yml' + - 'deps/llvm' + - 'patches/llvm/**' + - 'scripts/llvm.sh' + - 'build.sh' + - 'env-*.sh' + - 'pkg-conf.sh' + pull_request: + branches: + - main + paths: + - '.github/matrix*.json' + - '.github/workflows/_matrix.yml' + - '.github/workflows/llvm.yml' + - 'deps/llvm' + - 'patches/llvm/**' + - 'scripts/llvm.sh' + - 'build.sh' + - 'env-*.sh' + - 'pkg-conf.sh' + +jobs: + build: + secrets: inherit + uses: ./.github/workflows/_matrix.yml + with: + allow_failure: true + disable_upload: true diff --git a/.gitmodules b/.gitmodules index 4c41a43..cdb414f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,7 +9,13 @@ url = https://github.com/libsdl-org/SDL.git [submodule "deps/llvm"] path = deps/llvm - url = https://github.com/llvm/llvm-project.git + url = http://mirrors.bfsu.edu.cn/git/llvm-project.git [submodule "deps/zlib-ng"] path = deps/zlib-ng url = https://github.com/zlib-ng/zlib-ng.git +[submodule "deps/libedit"] + path = deps/libedit + url = https://salsa.debian.org/debian/libedit.git +[submodule "deps/ncurses"] + path = deps/ncurses + url = https://salsa.debian.org/debian/ncurses.git diff --git a/build.ps1 b/build.ps1 index f515c3e..be40435 100644 --- a/build.ps1 +++ b/build.ps1 @@ -78,6 +78,13 @@ $compile = { Pop-Location } & "${PROJ_ROOT}\scripts\${PKG_NAME}.ps1" + + + if (${env:CLANGD_CODE_COMPLETION} -ne "1") { + Get-ChildItem "${env:PKG_INST_DIR}" + } + $BUILD_DATE = (Get-Date -UFormat "+%Y-%m-%dT%H:%M:%S %Z") + Write-Host -ForegroundColor Magenta "${env:SUBPROJ_SRC} - Build Done @${BUILD_DATE}" } if (($PKG_NAME -eq $null) -or ($PKG_NAME -eq "")) { diff --git a/deps/libedit b/deps/libedit new file mode 160000 index 0000000..5f25a9d --- /dev/null +++ b/deps/libedit @@ -0,0 +1 @@ +Subproject commit 5f25a9d7097fa3c3c256cb55a17fa21eeb769350 diff --git a/deps/llvm b/deps/llvm index 3b5b5c1..e21dc4b 160000 --- a/deps/llvm +++ b/deps/llvm @@ -1 +1 @@ -Subproject commit 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff +Subproject commit e21dc4bd5474d04b8e62d7331362edcc5648d7e5 diff --git a/deps/ncurses b/deps/ncurses new file mode 160000 index 0000000..f39aae7 --- /dev/null +++ b/deps/ncurses @@ -0,0 +1 @@ +Subproject commit f39aae71b102ddf73e62aa90714fd022d21f375b diff --git a/env-apple.sh b/env-apple.sh index 597cd5b..9a5aabe 100755 --- a/env-apple.sh +++ b/env-apple.sh @@ -7,12 +7,15 @@ TARGET_ARCH=${2} case ${TARGET_PLATFORM} in "macosx") TARGET_FLAG="macosx" + export CMAKE_EXTRA="-D CMAKE_SYSTEM_NAME=Darwin ${CMAKE_EXTRA}" ;; "iphoneos") TARGET_FLAG="iphoneos" + export CMAKE_EXTRA="-D CMAKE_SYSTEM_NAME=iOS ${CMAKE_EXTRA}" ;; "iphonesimulator") TARGET_FLAG="ios-simulator" + export CMAKE_EXTRA="-D CMAKE_SYSTEM_NAME=iOS ${CMAKE_EXTRA}" ;; *) printf "\e[1m\e[31m%s\e[0m\n" "Unsupported TARGET PLATFORM: '${TARGET_PLATFORM}'." @@ -28,6 +31,7 @@ export SYSROOT="$(xcrun --sdk ${TARGET_PLATFORM} --show-sdk-path)" export CROSS_FLAGS="-arch ${TARGET_ARCH} -m${TARGET_FLAG}-version-min=${TARGET_DEPLOYMENT}" export CC="clang"; export CXX="clang++"; export OBJC="clang"; export OBJCXX="clang++"; +export HOSTCC="clang"; export HOSTCXX="clang++" export PARALLEL_JOBS="$(sysctl -n hw.ncpu)" if command -v ccache >/dev/null 2>&1 ; then export CCACHE_SRC="$(command -v ccache)" @@ -39,13 +43,11 @@ if command -v ccache >/dev/null 2>&1 ; then fi export CMAKE_EXTRA=$(cat <<- EOF +-D CMAKE_CROSSCOMPILING:BOOL=TRUE \ +-D CMAKE_SYSTEM_PROCESSOR=${TARGET_ARCH} \ -D CMAKE_OSX_ARCHITECTURES=${TARGET_ARCH} \ -D CMAKE_OSX_SYSROOT=${TARGET_PLATFORM} \ -D CMAKE_OSX_DEPLOYMENT_TARGET=${TARGET_DEPLOYMENT} \ -D CMAKE_MACOSX_BUNDLE:BOOL=0 ${CMAKE_EXTRA} EOF ) -if [ "${TARGET_PLATFORM}" == "iphoneos" ] || \ - [ "${TARGET_PLATFORM}" == "iphonesimulator" ]; then - export CMAKE_EXTRA="-D CMAKE_SYSTEM_NAME=iOS ${CMAKE_EXTRA}" -fi diff --git a/patches/llvm/01_fix_cmake_cross_build.patch b/patches/llvm/01_fix_cmake_cross_build.patch new file mode 100644 index 0000000..8f06eb2 --- /dev/null +++ b/patches/llvm/01_fix_cmake_cross_build.patch @@ -0,0 +1,43 @@ +diff --git a/.gitignore b/.gitignore +index 20c4f52cd378..80bd660499d3 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -70,3 +70,6 @@ pythonenv* + /clang/utils/analyzer/projects/*/RefScanBuildResults + # automodapi puts generated documentation files here. + /lldb/docs/python_api/ ++ ++/.env ++/.cache +diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +index 5d2b4b03fe60..2161fe0eaf23 100644 +--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp ++++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +@@ -66,6 +66,9 @@ + #define TRAP_HWBKPT 4 + #endif + ++#ifndef AT_HWCAP2 ++#define AT_HWCAP2 26 ++#endif + #ifndef HWCAP2_MTE + #define HWCAP2_MTE (1 << 18) + #endif +diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake +index 55bf3be75642..1c838b1f81b7 100644 +--- a/llvm/cmake/modules/CrossCompile.cmake ++++ b/llvm/cmake/modules/CrossCompile.cmake +@@ -15,10 +15,10 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype) + if (EXISTS ${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake) + set(CROSS_TOOLCHAIN_FLAGS_INIT + -DCMAKE_TOOLCHAIN_FILE=\"${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake\") +- elseif (NOT CMAKE_CROSSCOMPILING) ++ elseif (CMAKE_CROSSCOMPILING) + set(CROSS_TOOLCHAIN_FLAGS_INIT +- -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} +- -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ++ -DCMAKE_C_COMPILER=${CMAKE_C_HOST_COMPILER} ++ -DCMAKE_CXX_COMPILER=${CMAKE_CXX_HOST_COMPILER} + ) + endif() + set(CROSS_TOOLCHAIN_FLAGS_${target_name} ${CROSS_TOOLCHAIN_FLAGS_INIT} diff --git a/scripts/llvm.ps1 b/scripts/llvm.ps1 index 9f7daee..aaf8754 100644 --- a/scripts/llvm.ps1 +++ b/scripts/llvm.ps1 @@ -1,15 +1,10 @@ # ---------------------------- -# prepare env -# ---------------------------- -# if (-not (Test-Path -PathType Container -Path "${env:SUBPROJ_SRC}\.env")) { -# Push-Location "${env:SUBPROJ_SRC}" -# python -m venv .env - -# .\.env\Scripts\python -m pip install ${env:PYPI_MIRROR} --upgrade pip -# .\.env\Scripts\python -m pip install ${env:PYPI_MIRROR} ninja -# Pop-Location +# if (-not (Test-Path -PathType Container -Path "${env:PROJ_ROOT}\.env")) { +# Push-Location "${env:PROJ_ROOT}"; python -m venv .env; Pop-Location # } -# & ${env:SUBPROJ_SRC}\.env\Scripts\activate.ps1 +# & ${env:PROJ_ROOT}\.env\Scripts\activate.ps1 +# python -m pip install ${env:PYPI_MIRROR} --upgrade pip +# python -m pip install ${env:PYPI_MIRROR} --upgrade ninja # ---------------------------- # static or shared # ---------------------------- @@ -44,6 +39,7 @@ if ($LIB_RELEASE -ieq "1") { "@ $PKG_INST_STRIP = "--strip" } else { + <# $PKG_BULD_TYPE = @" `` -D CMAKE_BUILD_TYPE=Debug `` @@ -53,6 +49,9 @@ if ($LIB_RELEASE -ieq "1") { -D CMAKE_MODULE_LINKER_FLAGS_DEBUG="/debug /INCREMENTAL:NO" "@ $PKG_INST_STRIP = "" + #> + Write-Host -ForegroundColor Red "Unsupported LIB_RELEASE: '${LIB_RELEASE}'." + exit 1 } # ---------------------------- # compile :p @@ -63,17 +62,6 @@ New-Item -ItemType Directory -Path "${env:PKG_INST_DIR}" *> $null Remove-Item "${env:PKG_BULD_DIR}" -Recurse -Force -ErrorAction SilentlyContinue New-Item -ItemType Directory -Path "${env:PKG_BULD_DIR}" *> $null -switch ($env:PKG_ARCH) { - 'amd64' { - $LLVM_TARGET = "X86" - break - } - default { - Write-Host -ForegroundColor Red "Invalid PKG_ARCH: '${PKG_ARCH}'." - exit 1 - } -} - ${env:CFLAGS} = "/utf-8" ${env:CXXFLAGS} = "/utf-8" @@ -95,16 +83,21 @@ cmake -G Ninja `` -D LLVM_INCLUDE_TESTS:BOOL=0 `` -D LLVM_INCLUDE_DOCS:BOOL=0 `` -D LLVM_INCLUDE_UTILS:BOOL=0 `` - -D LLVM_TARGETS_TO_BUILD="${LLVM_TARGET}" `` + -D LLVM_TARGETS_TO_BUILD="AArch64;ARM;RISCV;WebAssembly;X86" `` -D LLDB_USE_SYSTEM_DEBUGSERVER:BOOL=1 "@ Write-Host -ForegroundColor Cyan "${CMAKE_COMMAND}" Invoke-Expression -Command "${CMAKE_COMMAND}" # build & install -cmake --build "${env:PKG_BULD_DIR}" -cmake --install "${env:PKG_BULD_DIR}" ${PKG_INST_STRIP} - -Get-ChildItem "${env:PKG_INST_DIR}" -$BUILD_DATE = (Get-Date -UFormat "+%Y-%m-%dT%H:%M:%S %Z") -Write-Host -ForegroundColor Magenta "${env:SUBPROJ_SRC} - Build Done @${BUILD_DATE}" +cmake --build "${env:PKG_BULD_DIR}" -j ${env:PARALLEL_JOBS} ` + --target 'clangd;lldb;lldb-dap;lldb-server;lldb-instr;llvm-symbolizer' +cmake --install "${env:PKG_BULD_DIR}\tools" ${PKG_INST_STRIP} --component llvm-symbolizer +cmake --install "${env:PKG_BULD_DIR}\tools\lldb\tools" ${PKG_INST_STRIP} --component lldb +cmake --install "${env:PKG_BULD_DIR}\tools\lldb\tools" ${PKG_INST_STRIP} --component lldb-argdumper +cmake --install "${env:PKG_BULD_DIR}\tools\lldb\tools" ${PKG_INST_STRIP} --component lldb-dap +cmake --install "${env:PKG_BULD_DIR}\tools\lldb\tools" ${PKG_INST_STRIP} --component lldb-instr +cmake --install "${env:PKG_BULD_DIR}\tools\lldb\tools" ${PKG_INST_STRIP} --component lldb-server +cmake --install "${env:PKG_BULD_DIR}\tools\lldb" ${PKG_INST_STRIP} --component liblldb +cmake --install "${env:PKG_BULD_DIR}\tools\clang" ${PKG_INST_STRIP} --component clangd +cmake --install "${env:PKG_BULD_DIR}\tools\clang" ${PKG_INST_STRIP} --component clang-resource-headers diff --git a/scripts/llvm.sh b/scripts/llvm.sh index 575262d..7fe8dde 100755 --- a/scripts/llvm.sh +++ b/scripts/llvm.sh @@ -2,18 +2,22 @@ set -e # ---------------------------- -# prepare env +if [ ! -e "${PROJ_ROOT}/.env" ]; then + pushd -- ${PROJ_ROOT}; python3 -m venv .env; popd +fi +source ${PROJ_ROOT}/.env/bin/activate +python3 -m pip install ${PYPI_MIRROR} --upgrade pip +python3 -m pip install ${PYPI_MIRROR} --upgrade ninja +# ---------------------------- +# packages # ---------------------------- -if [ ! -e "${SUBPROJ_SRC}/.env" ]; then - pushd -- "${SUBPROJ_SRC}" +source "${PROJ_ROOT}/pkg-conf.sh" +[ "${PKG_PLATFORM}" != "macosx" ] && \ { - python3 -m venv .env - .env/bin/python3 -m pip install ${PYPI_MIRROR} --upgrade pip - .env/bin/python3 -m pip install ${PYPI_MIRROR} ninja + dl_pkgc zlib-ng 'c939498' static } - popd -fi -source ${SUBPROJ_SRC}/.env/bin/activate + +printf "\e[1m\e[35m%s\e[0m\n" "${PKG_CONFIG_PATH}" # ---------------------------- # static or shared # ---------------------------- @@ -48,41 +52,65 @@ fi { rm -rf ${PKG_INST_DIR}; mkdir -p "${PKG_INST_DIR}"; } { rm -rf ${PKG_BULD_DIR}; mkdir -p "${PKG_BULD_DIR}"; } -case ${PKG_ARCH} in - "amd64" | "x86_64") - LLVM_TARGET="X86" - ;; - "arm64") - LLVM_TARGET="AArch64" - ;; - *) - printf "\e[1m\e[31m%s\e[0m\n" "Invalid PKG_ARCH: '${PKG_ARCH}'." - exit 1 - ;; -esac - CMAKE_COMMAND=$(cat <<- EOF cmake -G Ninja \ -S "${SUBPROJ_SRC}/llvm" -B "${PKG_BULD_DIR}" \ - -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON \ + -D CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON \ -D CMAKE_INSTALL_PREFIX="${PKG_INST_DIR}" \ -D CMAKE_INSTALL_LIBDIR:PATH=lib \ + -D CMAKE_PREFIX_PATH="${PKG_DEPS_CMAKE}" \ + -D CMAKE_FIND_ROOT_PATH="${SYSROOT};${PKG_DEPS_CMAKE}" \ ${PKG_BULD_TYPE} ${PKG_TYPE_FLAG} ${CMAKE_EXTRA} \ -D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lldb" \ -D CLANG_PLUGIN_SUPPORT:BOOL=0 \ - -D LLVM_APPEND_VC_REV:BOOL=0 \ + -D LLVM_APPEND_VC_REV:BOOL=0 \ -D LLVM_ENABLE_BINDINGS:BOOL=0 \ -D LLVM_INCLUDE_BENCHMARKS:BOOL=0 \ - -D LLVM_INCLUDE_EXAMPLES:BOOL=0 \ + -D LLVM_INCLUDE_EXAMPLES:BOOL=0 \ -D LLVM_INCLUDE_TESTS:BOOL=0 \ - -D LLVM_INCLUDE_DOCS:BOOL=0 \ + -D LLVM_INCLUDE_DOCS:BOOL=0 \ -D LLVM_INCLUDE_UTILS:BOOL=0 \ - -D LLVM_TARGETS_TO_BUILD="${LLVM_TARGET}" \ + -D LLVM_ENABLE_ZLIB="FORCE_ON" \ + -D LLVM_ENABLE_ZSTD="OFF" \ + -D LLVM_TARGETS_TO_BUILD="AArch64;ARM;RISCV;WebAssembly;X86" \ -D LLDB_USE_SYSTEM_DEBUGSERVER:BOOL=1 EOF ) + +case ${PKG_PLATFORM} in + "iphoneos" | "iphonesimulator") + printf "\e[1m\e[31m%s\e[0m\n" "Unsupported PLATFORM: '${PKG_PLATFORM}'." + exit 1 + ;; + "macosx") + [ "${PKG_ARCH}" == "x86_64" ] && { LLVM_ARCH="X86"; } + [ "${PKG_ARCH}" == "arm64" ] && { LLVM_ARCH="AArch64"; } + CMAKE_COMMAND="${CMAKE_COMMAND} -D LLVM_HOST_TRIPLE=${PKG_ARCH}-apple-darwin -D LLVM_TARGET_ARCH=${LLVM_ARCH} \ + -D CMAKE_C_HOST_COMPILER='${HOSTCC}' -D CMAKE_CXX_HOST_COMPILER='${HOSTCXX}'" + ;; + "linux") + if [ "${CROSS_BUILD_ENABLED}" == "1" ]; then + [ "${PKG_ARCH}" == "amd64" ] && { LLVM_ARCH="X86"; } + [ "${PKG_ARCH}" == "arm64" ] && { LLVM_ARCH="AArch64"; } + [ "${PKG_ARCH}" == "armv7" ] && { LLVM_ARCH="ARM"; } + CMAKE_COMMAND="${CMAKE_COMMAND} -D LLVM_HOST_TRIPLE=${TARGET_TRIPLE} -D LLVM_TARGET_ARCH=${LLVM_ARCH} \ + -D CMAKE_C_HOST_COMPILER='${HOSTCC}' -D CMAKE_CXX_HOST_COMPILER='${HOSTCXX}'" + fi + ;; + *) + ;; +esac printf "\e[1m\e[36m%s\e[0m\n" "${CMAKE_COMMAND}"; eval ${CMAKE_COMMAND} # build & install -cmake --build "${PKG_BULD_DIR}" -cmake --install "${PKG_BULD_DIR}" ${PKG_INST_STRIP} +cmake --build "${PKG_BULD_DIR}" -j ${PARALLEL_JOBS} \ + --target 'clangd;lldb;lldb-dap;lldb-server;lldb-instr;llvm-symbolizer' +cmake --install "${PKG_BULD_DIR}/tools" ${PKG_INST_STRIP} --component llvm-symbolizer +cmake --install "${PKG_BULD_DIR}/tools/lldb/tools" ${PKG_INST_STRIP} --component lldb +cmake --install "${PKG_BULD_DIR}/tools/lldb/tools" ${PKG_INST_STRIP} --component lldb-argdumper +cmake --install "${PKG_BULD_DIR}/tools/lldb/tools" ${PKG_INST_STRIP} --component lldb-dap +cmake --install "${PKG_BULD_DIR}/tools/lldb/tools" ${PKG_INST_STRIP} --component lldb-instr +cmake --install "${PKG_BULD_DIR}/tools/lldb/tools" ${PKG_INST_STRIP} --component lldb-server +cmake --install "${PKG_BULD_DIR}/tools/lldb" ${PKG_INST_STRIP} --component liblldb +cmake --install "${PKG_BULD_DIR}/tools/clang" ${PKG_INST_STRIP} --component clangd +cmake --install "${PKG_BULD_DIR}/tools/clang" ${PKG_INST_STRIP} --component clang-resource-headers