From c230bc2f7f43ef09fa8c02a5d48318f33e392ec8 Mon Sep 17 00:00:00 2001 From: _ <> Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Update --- .github/workflows/llvm_clang.yml | 224 ++--- CMakeLists.txt | 35 +- README.md | 143 +-- cargo_config.in | 14 +- ccache_conf.in | 2 +- cmake/custom_steps.cmake | 2 +- cmake/packages_check.cmake | 56 +- cmake/toolchain_check.cmake | 27 +- exec.in | 4 +- packages/11-mingw-arm64.conf | 12 + packages/CMakeLists.txt | 43 +- packages/OpenCL.pc.in | 10 + packages/amf-headers.cmake | 2 +- packages/angle-headers.cmake | 2 +- packages/aom.cmake | 5 + packages/{nettle.cmake => aria2.cmake} | 24 +- ...libmfx.cmake => autoreconf_template.cmake} | 16 +- packages/brotli.cmake | 4 +- packages/{libressl.cmake => c-ares.cmake} | 20 +- .../{uavs3d.cmake => cmake_template.cmake} | 15 +- packages/cryptopp.cmake | 18 - ...001-Skip-compiling-unnecessary-stuff.patch | 25 - packages/curl.cmake | 25 - packages/davs2.cmake | 23 - packages/directx-header.cmake | 22 + packages/expat.cmake | 3 +- packages/fdk-aac.cmake | 21 + packages/ffmpeg.cmake | 46 +- packages/flac.cmake | 26 - ...g-0001-Custom-changes-for-mpv-builds.patch | 136 --- .../fontconfig-0002-Do-not-use-dirent.h.patch | 25 - packages/fontconfig.cmake | 1 - packages/fribidi.cmake | 3 +- packages/game-music-emu.cmake | 8 +- packages/glslang.cmake | 3 +- packages/gmp.cmake | 16 - packages/lame.cmake | 3 +- .../libbs2b-0001-build-library-only.patch | 55 -- packages/libbs2b.cmake | 19 - packages/libdovi.cmake | 6 +- packages/libmediainfo.cmake | 24 + packages/libopusenc.cmake | 21 - ...ssl-0001-remove-postfix-in-libs-name.patch | 53 -- packages/libsdl2.cmake | 3 +- packages/libsixel.cmake | 24 - packages/libsodium.cmake | 16 - packages/libssh.cmake | 1 + packages/libssh2.cmake | 23 + packages/libuv.cmake | 16 - packages/libva-utils.cmake | 23 + packages/libvpx.cmake | 9 +- packages/libwebp.cmake | 2 +- packages/libxml2.cmake | 3 +- ...add-win32-utf-8-filesystem-functions.patch | 855 ------------------ packages/luajit.cmake | 68 +- packages/luajit.pc.in | 8 +- packages/mbedtls-0001-include-cpuid.patch | 29 - packages/mbedtls.cmake | 46 - ...ove-warn-never-print-file-attributes.patch | 56 -- packages/megasdk-0002-fix-compile.patch | 97 -- packages/megasdk.cmake | 37 - packages/mesa.cmake | 40 +- packages/meson_template.cmake | 25 + packages/mpv-debug-plugin.cmake | 23 + packages/mpv-menu-plugin.cmake | 23 + packages/mpv.cmake | 9 +- ...kip-compiling-testsuite-and-examples.patch | 25 - packages/opencl-header.cmake | 18 + packages/opencl.cmake | 27 + packages/openssl.cmake | 17 +- packages/opus-tools.cmake | 26 - packages/opus.cmake | 3 + packages/opusfile.cmake | 22 - packages/rav1e.cmake | 5 +- packages/readline.cmake | 20 - packages/speex.cmake | 2 +- packages/sqlite.cmake | 4 +- packages/svtav1.cmake | 26 + packages/termcap.cmake | 20 - packages/vkoverhead.cmake | 22 + packages/vmaf.cmake | 24 + packages/x264.cmake | 24 - packages/x265.cmake | 166 +--- packages/xvidcore-2-win64.patch | 11 - packages/xvidcore.cmake | 34 - packages/xxhash.cmake | 4 +- packages/xz.cmake | 1 + packages/zenlib.cmake | 19 + packages/zlib.cmake | 6 +- packages/zstd.cmake | 2 +- toolchain/CMakeLists.txt | 1 + toolchain/cppwinrt.cmake | 20 + toolchain/gcc/gcc-compiler.in | 3 + toolchain/gcc/gcc.cmake | 22 +- toolchain/llvm/llvm-compiler-rt-builtin.cmake | 6 +- toolchain/llvm/llvm-compiler-rt.cmake | 6 +- toolchain/llvm/llvm-compiler.in | 29 +- toolchain/llvm/llvm-ld.in | 16 +- toolchain/llvm/llvm-libcxx.cmake | 7 +- toolchain/llvm/llvm.cmake | 27 +- toolchain/mingw-w64-crt.cmake | 4 +- toolchain/mingw-w64-headers.cmake | 1 + toolchain/rustup.cmake | 3 +- toolchain/winpthreads.cmake | 4 +- utils/debug.sh | 12 + utils/download.sh | 4 + utils/llvm-pgo-gen.sh | 15 + utils/llvm-pgo-use.sh | 16 + utils/pgo-gen.sh | 13 + utils/pgo-use.sh | 14 + utils/reset.sh | 13 + utils/setup.sh | 11 + utils/setup_aarch64.sh | 13 + utils/update.sh | 4 + 114 files changed, 1071 insertions(+), 2399 deletions(-) create mode 100644 packages/11-mingw-arm64.conf create mode 100644 packages/OpenCL.pc.in rename packages/{nettle.cmake => aria2.cmake} (53%) rename packages/{libmfx.cmake => autoreconf_template.cmake} (68%) rename packages/{libressl.cmake => c-ares.cmake} (54%) rename packages/{uavs3d.cmake => cmake_template.cmake} (73%) delete mode 100644 packages/cryptopp.cmake delete mode 100644 packages/curl-0001-Skip-compiling-unnecessary-stuff.patch delete mode 100644 packages/curl.cmake delete mode 100644 packages/davs2.cmake create mode 100644 packages/directx-header.cmake create mode 100644 packages/fdk-aac.cmake delete mode 100644 packages/flac.cmake delete mode 100644 packages/fontconfig-0001-Custom-changes-for-mpv-builds.patch delete mode 100644 packages/fontconfig-0002-Do-not-use-dirent.h.patch delete mode 100644 packages/gmp.cmake delete mode 100644 packages/libbs2b-0001-build-library-only.patch delete mode 100644 packages/libbs2b.cmake create mode 100644 packages/libmediainfo.cmake delete mode 100644 packages/libopusenc.cmake delete mode 100644 packages/libressl-0001-remove-postfix-in-libs-name.patch delete mode 100644 packages/libsixel.cmake delete mode 100644 packages/libsodium.cmake create mode 100644 packages/libssh2.cmake delete mode 100644 packages/libuv.cmake create mode 100644 packages/libva-utils.cmake delete mode 100644 packages/luajit-0001-add-win32-utf-8-filesystem-functions.patch delete mode 100644 packages/mbedtls-0001-include-cpuid.patch delete mode 100644 packages/mbedtls.cmake delete mode 100644 packages/megasdk-0001-megacli-remove-warn-never-print-file-attributes.patch delete mode 100644 packages/megasdk-0002-fix-compile.patch delete mode 100644 packages/megasdk.cmake create mode 100644 packages/meson_template.cmake create mode 100644 packages/mpv-debug-plugin.cmake create mode 100644 packages/mpv-menu-plugin.cmake delete mode 100644 packages/nettle-0001-skip-compiling-testsuite-and-examples.patch create mode 100644 packages/opencl-header.cmake create mode 100644 packages/opencl.cmake delete mode 100644 packages/opus-tools.cmake delete mode 100644 packages/opusfile.cmake delete mode 100644 packages/readline.cmake create mode 100644 packages/svtav1.cmake delete mode 100644 packages/termcap.cmake create mode 100644 packages/vkoverhead.cmake create mode 100644 packages/vmaf.cmake delete mode 100644 packages/x264.cmake delete mode 100644 packages/xvidcore-2-win64.patch delete mode 100644 packages/xvidcore.cmake create mode 100644 packages/zenlib.cmake create mode 100644 toolchain/cppwinrt.cmake create mode 100755 utils/debug.sh create mode 100755 utils/download.sh create mode 100755 utils/llvm-pgo-gen.sh create mode 100755 utils/llvm-pgo-use.sh create mode 100755 utils/pgo-gen.sh create mode 100755 utils/pgo-use.sh create mode 100755 utils/reset.sh create mode 100755 utils/setup.sh create mode 100755 utils/setup_aarch64.sh create mode 100755 utils/update.sh diff --git a/.github/workflows/llvm_clang.yml b/.github/workflows/llvm_clang.yml index 21ca31cae..2455d4d54 100644 --- a/.github/workflows/llvm_clang.yml +++ b/.github/workflows/llvm_clang.yml @@ -18,10 +18,16 @@ jobs: strategy: fail-fast: false container: - image: docker://ghcr.io/shinchiro/archlinux:latest + image: cachyos/cachyos-v3:latest steps: - name: Setup git config run: | + sudo pacman -Syu --noconfirm + sudo pacman -S --noconfirm --needed base-devel git gyp ninja cmake ragel yasm nasm asciidoc enca gperf unzip xz llvm clang lld libc++ libc++abi python-pip curl wget python-cairo mimalloc ccache + mkdir -p /home/opt/7zip + wget -qO - https://www.7-zip.org/a/7z2301-linux-x64.tar.xz | tar -xJf - -C /home/opt/7zip 7zzs + sudo ln -s /home/opt/7zip/7zzs /usr/bin/7z + pip3 install -U --break-system-packages setuptools rst2pdf mako jsonschema meson git config --global user.name "github-actions" git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --global pull.rebase true @@ -33,103 +39,125 @@ jobs: with: ref: master - - name: Loading clang root - id: clang_root_cache - uses: actions/cache/restore@main - with: - path: clang_root - key: ${{ secrets.CACHE_VERSION }}-clang_root-${{ github.run_id }} - restore-keys: ${{ secrets.CACHE_VERSION }}-clang_root - - - name: Loading x86_64 toolchain - id: x86_64_cache - uses: actions/cache/restore@main - with: - path: build_x86_64 - key: ${{ secrets.CACHE_VERSION }}-clang-x86_64_toolchain-${{ github.run_id }} - restore-keys: ${{ secrets.CACHE_VERSION }}-clang-x86_64_toolchain - - - name: Loading x86_64_v3 toolchain - id: x86_64_v3_cache - uses: actions/cache/restore@main - with: - path: build_x86_64_v3 - key: ${{ secrets.CACHE_VERSION }}-clang-x86_64_v3_toolchain-${{ github.run_id }} - restore-keys: ${{ secrets.CACHE_VERSION }}-clang-x86_64_v3_toolchain - - - name: Loading i686 toolchain - id: i686_cache - uses: actions/cache/restore@main - with: - path: build_i686 - key: ${{ secrets.CACHE_VERSION }}-clang-i686_toolchain-${{ github.run_id }} - restore-keys: ${{ secrets.CACHE_VERSION }}-clang-i686_toolchain - - - name: Loading aarch64 toolchain - id: aarch64_cache - if: false - uses: actions/cache/restore@main - with: - path: build_aarch64 - key: ${{ secrets.CACHE_VERSION }}-clang-aarch64_toolchain-${{ github.run_id }} - restore-keys: ${{ secrets.CACHE_VERSION }}-clang-aarch64_toolchain - - - name: Loading repository cache - id: repository_cache - if: false - uses: actions/cache/restore@main - with: - path: src_packages - key: ${{ secrets.CACHE_VERSION }}-repository-${{ github.run_id }} - restore-keys: ${{ secrets.CACHE_VERSION }}-repository - - name: Running custom command if: ${{ github.event.inputs.command != '' }} continue-on-error: true run: ${{ github.event.inputs.command }} - - name: Building LLVM - if: ${{ steps.clang_root_cache.outputs.cache-matched-key == '' }} + - name: Building LLVM with ThinLTO and IR Profile Instrumentation run: | - cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64/x86_64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64 -S $PWD + cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PGO=GEN -DGCC_ARCH=x86-64-v3 -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64/x86_64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64 -S $PWD ninja -C build_x86_64 llvm - ninja -C build_x86_64 rustup - ninja -C build_x86_64 cargo-clean + ninja -C build_x86_64 llvm-fullclean || true - name: Building x86_64 toolchain - if: ${{ steps.x86_64_cache.outputs.cache-matched-key == '' }} run: | - cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64/x86_64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64 -S $PWD + cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PGO=GEN -DGCC_ARCH=x86-64-v3 -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64/x86_64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64 -S $PWD ninja -C build_x86_64 llvm-clang + rm -rf build_x86_64/toolchain/{mingw-w64-headers,mingw-w64-crt,winpthreads,llvm-libcxx,llvm-compiler-rt-builtin}-prefix || true + + - name: Building aarch64 toolchain + run: | + cmake -DTARGET_ARCH=aarch64-w64-mingw32 -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PGO=GEN -DGCC_ARCH=armv8.2-a -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_aarch64/aarch64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_aarch64 -S $PWD + ninja -C build_aarch64 llvm-clang + rm -rf build_aarch64/toolchain/{mingw-w64-headers,mingw-w64-crt,winpthreads,llvm-libcxx,llvm-compiler-rt-builtin}-prefix || true - - name: Building x86_64-v3 toolchain - if: ${{ steps.x86_64_v3_cache.outputs.cache-matched-key == '' }} + - name: PGO training with shaderc x86_64 run: | - cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DCOMPILER_TOOLCHAIN=clang -DGCC_ARCH=x86-64-v3 -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64_v3/x86_64_v3-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64_v3 -S $PWD - ninja -C build_x86_64_v3 llvm-clang + cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PGO=GEN -DCLANG_PACKAGES_LTO=ON -DGCC_ARCH=x86-64-v3 -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64/x86_64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64 -S $PWD + ninja -C build_x86_64 shaderc + ninja -C build_x86_64 shaderc-fullclean || true + rm -rf $PWD/build_x86_64/x86_64-w64-mingw32/thinlto || true - - name: Building i686 toolchain - if: ${{ steps.i686_cache.outputs.cache-matched-key == '' }} + - name: PGO training with shaderc aarch64 run: | - cmake -DTARGET_ARCH=i686-w64-mingw32 -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_i686/i686-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_i686 -S $PWD - ninja -C build_i686 llvm-clang + cmake -DTARGET_ARCH=aarch64-w64-mingw32 -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PGO=GEN -DCLANG_PACKAGES_LTO=ON -DGCC_ARCH=armv8.2-a -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_aarch64/aarch64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_aarch64 -S $PWD + ninja -C build_aarch64 shaderc + ninja -C build_aarch64 shaderc-fullclean || true + rm -rf $PWD/build_aarch64/aarch64-w64-mingw32/thinlto || true - - name: Building aarch64 toolchain - if: false + - name: Merging IR profraw to profdata + run: | + llvm-profdata merge $PWD/clang_root/profiles/*.profraw -o llvm-ir.profdata + rm -rf $PWD/clang_root/profiles/* || true + + - name: Building LLVM with ThinLTO and CSIR Profile Instrumentation + run: | + cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PGO=CSGEN -DLLVM_PROFDATA_FILE=llvm-ir.profdata -DGCC_ARCH=x86-64-v3 -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64/x86_64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64 -S $PWD + ninja -C build_x86_64 llvm + ninja -C build_x86_64 llvm-fullclean || true + + - name: Re-Building x86_64 toolchain + run: | + cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PGO=CSGEN -DGCC_ARCH=x86-64-v3 -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64/x86_64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64 -S $PWD + ninja -C build_x86_64 llvm-clang + rm -rf build_x86_64/toolchain/{mingw-w64-headers,mingw-w64-crt,winpthreads,llvm-libcxx,llvm-compiler-rt-builtin}-prefix || true + + - name: Re-Building aarch64 toolchain run: | - cmake -DTARGET_ARCH=aarch64-w64-mingw32 -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_aarch64/aarch64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_aarch64 -S $PWD + cmake -DTARGET_ARCH=aarch64-w64-mingw32 -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PGO=CSGEN -DGCC_ARCH=armv8.2-a -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_aarch64/aarch64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_aarch64 -S $PWD ninja -C build_aarch64 llvm-clang + rm -rf build_aarch64/toolchain/{mingw-w64-headers,mingw-w64-crt,winpthreads,llvm-libcxx,llvm-compiler-rt-builtin}-prefix || true + + - name: CSPGO training with shaderc x86_64 + run: | + cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PGO=CSGEN -DCLANG_PACKAGES_LTO=ON -DGCC_ARCH=x86-64-v3 -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64/x86_64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64 -S $PWD + ninja -C build_x86_64 shaderc + ninja -C build_x86_64 shaderc-fullclean || true + rm -rf $PWD/build_x86_64/x86_64-w64-mingw32/thinlto || true + + - name: CSPGO training with shaderc aarch64 + run: | + cmake -DTARGET_ARCH=aarch64-w64-mingw32 -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PGO=CSGEN -DCLANG_PACKAGES_LTO=ON -DGCC_ARCH=armv8.2-a -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_aarch64/aarch64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_aarch64 -S $PWD + ninja -C build_aarch64 shaderc + ninja -C build_aarch64 shaderc-fullclean || true + rm -rf $PWD/build_aarch64/aarch64-w64-mingw32/thinlto || true + + - name: Merging CSIR profraw to profdata + run: | + llvm-profdata merge $PWD/clang_root/profiles/*.profraw llvm-ir.profdata -o llvm-csir.profdata + rm -rf $PWD/clang_root/profiles/* || true + echo "llvm-csir_path=$(echo $PWD/llvm-csir.profdata)" >> $GITHUB_ENV + + - name: Building LLVM with ThinLTO and CSPGO + run: | + cmake -DTARGET_ARCH=x86_64-w64-mingw32 -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PGO=USE -DLLVM_PROFDATA_FILE=llvm-csir.profdata -DGCC_ARCH=x86-64-v3 -DCOMPILER_TOOLCHAIN=clang -DCMAKE_INSTALL_PREFIX=$PWD/clang_root -DMINGW_INSTALL_PREFIX=$PWD/build_x86_64/x86_64-w64-mingw32 -DSINGLE_SOURCE_LOCATION=$PWD/src_packages -DRUSTUP_LOCATION=$PWD/clang_root/install_rustup -G Ninja -B build_x86_64 -S $PWD + ninja -C build_x86_64 llvm + ninja -C build_x86_64 llvm-fullclean || true + echo "llvm_path=$(echo $PWD/clang_root/bin/llvm)" >> $GITHUB_ENV + + - name: Upload llvm + uses: ncipollo/release-action@v1 + with: + prerelease: false + artifacts: ${{ env.llvm_path }} + replacesArtifacts: true + tag: llvm + name: llvm + allowUpdates: true + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload llvm profdata + uses: ncipollo/release-action@v1 + with: + prerelease: false + artifacts: ${{ env.llvm-csir_path }} + replacesArtifacts: true + tag: llvm-profdata + name: llvm-profdata + allowUpdates: true + token: ${{ secrets.GITHUB_TOKEN }} - name: Cleanup run: | - rm -rf {build_i686,build_x86_64,build_x86_64_v3,build_aarch64}/{toolchain,packages} || true + rm -rf {build_x86_64,build_aarch64}/{toolchain,packages} || true + rm -rf $PWD/clang_root/llvm-thinlto || true - name: Collecting logs if: always() run: | - mkdir -p build_x86_64_logs build_i686_logs build_aarch64_logs + mkdir -p build_x86_64_logs build_aarch64_logs cp -fr $(find build_x86_64 -type f -iname "*-*.log") build_x86_64_logs || true - cp -fr $(find build_i686 -type f -iname "*-*.log") build_i686_logs || true cp -fr $(find build_aarch64 -type f -iname "*-*.log") build_aarch64_logs || true 7z a -m0=lzma2 -mx=9 -ms=on logs.7z build*logs @@ -146,55 +174,3 @@ jobs: with: path: clang_root key: ${{ secrets.CACHE_VERSION }}-clang_root-${{ github.run_id }} - - - name: Saving x86_64 toolchain - uses: actions/cache/save@main - with: - path: build_x86_64 - key: ${{ secrets.CACHE_VERSION }}-clang-x86_64_toolchain-${{ github.run_id }} - - - name: Saving x86_64_v3 toolchain - uses: actions/cache/save@main - with: - path: build_x86_64_v3 - key: ${{ secrets.CACHE_VERSION }}-clang-x86_64_v3_toolchain-${{ github.run_id }} - - - name: Saving i686 toolchain - uses: actions/cache/save@main - with: - path: build_i686 - key: ${{ secrets.CACHE_VERSION }}-clang-i686_toolchain-${{ github.run_id }} - - - name: Saving aarch64 toolchain - if: false - uses: actions/cache/save@main - with: - path: build_aarch64 - key: ${{ secrets.CACHE_VERSION }}-clang-aarch64_toolchain-${{ github.run_id }} - - - name: Saving repository cache - if: false - uses: actions/cache/save@main - with: - path: src_packages - key: ${{ secrets.CACHE_VERSION }}-repository-${{ github.run_id }} - - call_workflow: - name: Run mpv_clang - runs-on: ubuntu-latest - needs: build_llvm - env: - GH_TOKEN: ${{ github.token }} - steps: - - name: Run mpv_clang.yml - run: | - curl -u shinchiro:$GH_TOKEN -X POST -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/actions/workflows/mpv_clang.yml/dispatches -d @- < clean -dfx") else() - set(remove_cmd "rm -rf /* && git -C clean -df") + set(remove_cmd "bash -c 'rm -rf /*' && bash -c 'rm -rf /.*' && git -C clean -df") endif() set(COMMAND_FORCE_UPDATE COMMAND bash -c "git -C am --abort 2> /dev/null || true" COMMAND ${stamp_dir}/reset_head.sh diff --git a/cmake/packages_check.cmake b/cmake/packages_check.cmake index 26e6c979e..1ecd8d9a1 100644 --- a/cmake/packages_check.cmake +++ b/cmake/packages_check.cmake @@ -3,7 +3,7 @@ if(COMPILER_TOOLCHAIN STREQUAL "gcc") set(vapoursynth_script_pkgconfig_libs "-lvsscript") set(vapoursynth_manual_install_copy_lib COMMAND ${CMAKE_COMMAND} -E copy /libvsscript.a ${MINGW_INSTALL_PREFIX}/lib/libvsscript.a COMMAND ${CMAKE_COMMAND} -E copy /libvapoursynth.a ${MINGW_INSTALL_PREFIX}/lib/libvapoursynth.a) - set(ffmpeg_extra_libs "-lstdc++") + set(ffmpeg_extra_libs "-lstdc++ -pthread") set(libjxl_unaligned_vector "-Wa,-muse-unaligned-vector-move") # fix crash on AVX2 proc (64bit) due to unaligned stack memory set(mpv_copy_debug COMMAND ${CMAKE_COMMAND} -E copy /mpv.debug ${CMAKE_CURRENT_BINARY_DIR}/mpv-debug/mpv.debug) set(mpv_add_debuglink COMMAND ${EXEC} ${TARGET_ARCH}-objcopy --only-keep-debug /mpv.exe /mpv.debug @@ -11,6 +11,7 @@ if(COMPILER_TOOLCHAIN STREQUAL "gcc") COMMAND ${EXEC} ${TARGET_ARCH}-objcopy --add-gnu-debuglink=/mpv.debug /mpv.exe COMMAND ${EXEC} ${TARGET_ARCH}-strip -s /mpv.com COMMAND ${EXEC} ${TARGET_ARCH}-strip -s /libmpv-2.dll) + set(rust_target "gnu") elseif(COMPILER_TOOLCHAIN STREQUAL "clang") set(vapoursynth_pkgconfig_libs "-lVapourSynth -Wl,-delayload=VapourSynth.dll") set(vapoursynth_script_pkgconfig_libs "-lVSScript -Wl,-delayload=VSScript.dll") @@ -19,23 +20,64 @@ elseif(COMPILER_TOOLCHAIN STREQUAL "clang") set(ffmpeg_extra_libs "-lc++") set(ffmpeg_hardcoded_tables "--enable-hardcoded-tables") set(mpv_lto_mode "-Db_lto_mode=thin") - set(mpv_copy_debug COMMAND ${CMAKE_COMMAND} -E copy /mpv.pdb ${CMAKE_CURRENT_BINARY_DIR}/mpv-debug/mpv.pdb) + set(mpv_copy_debug COMMAND ${CMAKE_COMMAND} -E copy /mpv.pdb ${CMAKE_CURRENT_BINARY_DIR}/mpv-debug/mpv.pdb + COMMAND ${CMAKE_COMMAND} -E copy /libmpv-2.pdb ${CMAKE_CURRENT_BINARY_DIR}/mpv-debug/libmpv-2.pdb) + set(rust_target "gnullvm") if(CLANG_PACKAGES_LTO) + if(TARGET_CPU STREQUAL "x86_64") + set(rust_cfi "-Zcf-protection=full") + endif() set(cargo_lto_rustflags "CARGO_PROFILE_RELEASE_LTO=thin - RUSTFLAGS='-C linker-plugin-lto -C embed-bitcode -C lto=thin'") + RUSTFLAGS='-Ctarget-cpu=${GCC_ARCH} -Ccontrol-flow-guard=yes -Zehcont-guard=yes -Clinker-plugin-lto=yes -Ztls-model=local-exec -Cembed-bitcode=yes -Clto=thin -Cllvm-args=-fp-contract=fast -Zcombine-cgu=yes -Zinline-mir=yes -Zmir-opt-level=4 -Zthreads=${CPU_COUNT} ${rust_cfi}'") set(ffmpeg_lto "--enable-lto=thin") - set(x264_lto "--enable-lto") - if(GCC_ARCH_HAS_AVX) - set(zlib_lto "-DFNO_LTO_AVAILABLE=OFF") - # prevent zlib-ng from adding -fno-lto + if(NOT (GCC_ARCH_HAS_AVX OR (TARGET_CPU STREQUAL "aarch64"))) + set(zlib_nlto "LTO=0") endif() endif() endif() if(TARGET_CPU STREQUAL "x86_64") set(dlltool_image "i386:x86-64") + set(openssl_target "mingw64") + set(openssl_ec_opt "enable-ec_nistp_64_gcc_128") + set(libvpx_target "x86_64-win64-gcc") + set(vapoursynth "vapoursynth") + set(ffmpeg_vapoursynth "--enable-vapoursynth") + set(mpv_vapoursynth "-Drubberband=enabled") + set(mpv_gl "-Dgl=enabled -Degl-angle=enabled") + set(xxhash_dispatch "-DDISPATCH=ON") + set(xxhash_cflags "-DXXH_X86DISPATCH_ALLOW_AVX=1") + set(nvcodec-headers "nvcodec-headers") + set(ffmpeg_cuda "--enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc") elseif(TARGET_CPU STREQUAL "i686") set(dlltool_image "i386") + set(openssl_target "mingw") + set(libvpx_target "x86-win32-gcc") + set(vapoursynth "vapoursynth") + set(ffmpeg_vapoursynth "--enable-vapoursynth") + set(mpv_vapoursynth "-Drubberband=enabled") + set(mpv_gl "-Dgl=enabled -Degl-angle=enabled") + set(xxhash_dispatch "-DDISPATCH=ON") + set(xxhash_cflags "-DXXH_X86DISPATCH_ALLOW_AVX=1") + set(nvcodec-headers "nvcodec-headers") + set(ffmpeg_cuda "--enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc") elseif(TARGET_CPU STREQUAL "aarch64") set(dlltool_image "arm64") + set(openssl_target "mingw-arm64") + set(openssl_ec_opt "enable-ec_nistp_64_gcc_128") + set(libvpx_target "arm64-win64-gcc") + set(libvpx_neon "--disable-neon-i8mm --disable-neon-dotprod") + set(mpv_gl "-Dgl=disabled -Degl-angle=disabled") + set(xz_crc "-DHAVE_ARM64_CRC32=ON -DALLOW_ARM64_CRC32=ON") + set(aom_neon "-DENABLE_NEON_DOTPROD=OFF -DENABLE_NEON_I8MM=OFF -DHAVE_NEON_DOTPROD=OFF -DHAVE_NEON_I8MM=OFF -DCONFIG_RUNTIME_CPU_DETECT=OFF") +endif() + +if(CLANG_PACKAGES_PGO STREQUAL "GEN") + set(brotli_tools "-DBROTLI_BUILD_TOOLS=ON") + set(zstd_tools "-DZSTD_BUILD_PROGRAMS=ON") + set(openssl_tools "") +else() + set(brotli_tools "-DBROTLI_BUILD_TOOLS=OFF") + set(zstd_tools "-DZSTD_BUILD_PROGRAMS=OFF") + set(openssl_tools "no-apps") endif() diff --git a/cmake/toolchain_check.cmake b/cmake/toolchain_check.cmake index 77d8c1d45..4f3b25196 100644 --- a/cmake/toolchain_check.cmake +++ b/cmake/toolchain_check.cmake @@ -7,24 +7,37 @@ elseif(COMPILER_TOOLCHAIN STREQUAL "clang") set(llvm_wrapper "llvm-wrapper") set(llvm_libcxx "llvm-libcxx") set(cfguard "--enable-cfguard") - set(opt "-O3") + set(opt "-O3 -ffp-contract=fast -funroll-loops") + if(LLVM_ENABLE_CCACHE) + set(llvm_ccache "-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache") + endif() + if(LLVM_ENABLE_LTO STREQUAL "Thin") + set(llvm_lto "-flto=thin -fwhole-program-vtables -fsplit-lto-unit") + endif() + if(LLVM_ENABLE_PGO STREQUAL "GEN") + set(llvm_pgo "-fprofile-generate=${LLVM_PROFILE_DATA_DIR} -fprofile-update=atomic") + elseif(LLVM_ENABLE_PGO STREQUAL "CSGEN") + set(llvm_pgo "-fcs-profile-generate=${LLVM_PROFILE_DATA_DIR} -fprofile-update=atomic -fprofile-use=${LLVM_PROFDATA_FILE}") + elseif(LLVM_ENABLE_PGO STREQUAL "USE") + set(llvm_pgo "-fprofile-use=${LLVM_PROFDATA_FILE}") + endif() endif() if(TARGET_CPU STREQUAL "x86_64") set(crt_lib "--disable-lib32 --enable-lib64") set(LIBOMP_ASMFLAGS_M64 "-DLIBOMP_ASMFLAGS=-m64") - set(M_TUNE "generic") - set(cfi "-mguard=cf") + set(clang_cfi "-mguard=cf -fcf-protection=full -Xclang -ehcontguard") + set(lld_cfi "-Xlink=-guard:cf,longjmp,ehcont -Xlink=-cetcompat") + set(libcxx_cet "-DLIBUNWIND_ENABLE_CET=ON -DCXX_SUPPORTS_FCF_PROTECTION_EQ_FULL_FLAG=ON -DCXX_SUPPORTS_MSHSTK_FLAG=ON") + set(compiler_rt_cet "-DCOMPILER_RT_ENABLE_CET=TRUE") if (GCC_ARCH STREQUAL "x86-64") - unset(cfi) unset(opt) endif() elseif(TARGET_CPU STREQUAL "i686") set(crt_lib "--enable-lib32 --disable-lib64") - set(M_TUNE "generic") unset(opt) elseif(TARGET_CPU STREQUAL "aarch64") set(crt_lib "--disable-lib32 --disable-lib64 --enable-libarm64") - set(M_TUNE "generic") - set(cfi "-mguard=cf") + set(clang_cfi "-mguard=cf -Xclang -ehcontguard") + set(lld_cfi "-Xlink=-guard:cf,longjmp,ehcont") endif() diff --git a/exec.in b/exec.in index a210b0baf..274f0ba4f 100755 --- a/exec.in +++ b/exec.in @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash +export O_PATH="$PATH" export PATH="@CMAKE_INSTALL_PREFIX@/bin:@RUSTUP_LOCATION@/.cargo/bin:$PATH" export PKG_CONFIG="pkgconf --static" export PKG_CONFIG_LIBDIR="@MINGW_INSTALL_PREFIX@/lib/pkgconfig" @@ -6,5 +7,6 @@ export RUSTUP_HOME="@RUSTUP_LOCATION@/.rustup" export CARGO_HOME="@RUSTUP_LOCATION@/.cargo" export LD_PRELOAD="@MALLOC@" export CCACHE_DIR="@MINGW_INSTALL_PREFIX@/ccache" +export LLVM_PROFILE_FILE="/dev/null" eval $* diff --git a/packages/11-mingw-arm64.conf b/packages/11-mingw-arm64.conf new file mode 100644 index 000000000..e9195747e --- /dev/null +++ b/packages/11-mingw-arm64.conf @@ -0,0 +1,12 @@ +## -*- mode: perl; -*- +# Windows on Arm clang gnu targets. +# + +my %targets = ( + "mingw-arm64" => { + inherit_from => [ "mingw-common" ], + bn_ops => add("SIXTY_FOUR_BIT"), + asm_arch => "aarch64", + perlasm_scheme => "win64", + }, +); diff --git a/packages/CMakeLists.txt b/packages/CMakeLists.txt index 7671c0ce5..f52d7e822 100644 --- a/packages/CMakeLists.txt +++ b/packages/CMakeLists.txt @@ -1,7 +1,6 @@ set_property(DIRECTORY PROPERTY EP_STEP_TARGETS download) include(${PROJECT_SOURCE_DIR}/cmake/packages_check.cmake) list(APPEND ep - gmp xz lzo uchardet @@ -20,10 +19,9 @@ list(APPEND ep speex libmodplug libvpx - xvidcore game-music-emu libpng - x264 + vmaf x265 libdvdcss libdvdread @@ -32,8 +30,6 @@ list(APPEND ep luajit fribidi expat - nettle - mbedtls libxml2 brotli freetype2 @@ -56,15 +52,12 @@ list(APPEND ep dav1d libwebp vapoursynth - libbs2b openssl libssh libsrt libarchive highway libjxl - uavs3d - davs2 angle-headers mujs spirv-headers @@ -81,28 +74,30 @@ list(APPEND ep fast_float libdovi rav1e + svtav1 libplacebo libva libzvbi libaribcaption - libsixel + opencl-header + opencl + fdk-aac + directx-header ffmpeg mpv mpv-release mpv-packaging - curl - flac - opusfile - libopusenc - opus-tools - termcap - readline - cryptopp + mpv-debug-plugin + mpv-menu-plugin sqlite - libuv - libsodium - megasdk mesa + libva-utils + c-ares + libssh2 + aria2 + vkoverhead + zenlib + libmediainfo ) foreach(package IN LISTS ep) if(NOT ${SINGLE_SOURCE_LOCATION} STREQUAL "") @@ -120,12 +115,13 @@ list(LENGTH ep ep_length) message(STATUS "Parsing ${ep_length} packages") # Exclude packages which dont depend on mpv when update -list(APPEND removed "flac" "opusfile" "libopusenc" "opus-tools" "termcap" "readline" "cryptopp" "sqlite" "libuv" "libsodium" "megasdk" "libsixel" "curl" "libressl" "mbedtls" "nettle" "gmp" "mesa") +list(APPEND removed "sqlite" "libssh2" "c-ares" "aria2") list(REMOVE_ITEM repo ${removed}) list(REMOVE_ITEM ep ${removed}) list(TRANSFORM repo APPEND "-force-update" OUTPUT_VARIABLE update) list(TRANSFORM ep APPEND "-download" OUTPUT_VARIABLE download) list(TRANSFORM ep APPEND "-fullclean" OUTPUT_VARIABLE fullclean) +list(TRANSFORM ep APPEND "-removebuild" OUTPUT_VARIABLE removebuild) add_custom_target(update COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${update} @@ -141,6 +137,11 @@ add_custom_target(package-fullclean COMMENT "Remove all stamp files, reset git HEAD" ) +add_custom_target(package-removebuild + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${removebuild} + COMMENT "Remove all build directory" +) + add_custom_target(cargo-clean COMMAND ${EXEC} cargo install --git https://github.com/matthiaskrgr/cargo-cache.git --no-default-features --features ci-autoclean cargo-cache COMMAND ${EXEC} cargo-cache diff --git a/packages/OpenCL.pc.in b/packages/OpenCL.pc.in new file mode 100644 index 000000000..fffacd0d8 --- /dev/null +++ b/packages/OpenCL.pc.in @@ -0,0 +1,10 @@ +prefix=@MINGW_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include/ +Name: OpenCL +Description: OpenCL ICD Loader +Version: 3.0 +Libs: -L${libdir} -l:OpenCL.a +Libs.private: -lole32 -lshlwapi -lcfgmgr32 +Cflags: -I${includedir} diff --git a/packages/amf-headers.cmake b/packages/amf-headers.cmake index 1e99ac274..2a449c930 100644 --- a/packages/amf-headers.cmake +++ b/packages/amf-headers.cmake @@ -2,7 +2,7 @@ ExternalProject_Add(amf-headers GIT_REPOSITORY https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--sparse --filter=tree:0" - GIT_CLONE_POST_COMMAND "sparse-checkout set amf/public/include" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone amf/public/include" UPDATE_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/packages/angle-headers.cmake b/packages/angle-headers.cmake index 80ef1571b..590aad500 100644 --- a/packages/angle-headers.cmake +++ b/packages/angle-headers.cmake @@ -4,7 +4,7 @@ ExternalProject_Add(angle-headers GIT_REMOTE_NAME origin GIT_TAG main GIT_CLONE_FLAGS "--sparse --filter=tree:0" - GIT_CLONE_POST_COMMAND "sparse-checkout set include/EGL include/KHR" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone include/EGL include/KHR" GIT_SUBMODULES "" UPDATE_COMMAND "" CONFIGURE_COMMAND "" diff --git a/packages/aom.cmake b/packages/aom.cmake index 85446e0b6..101f9960b 100644 --- a/packages/aom.cmake +++ b/packages/aom.cmake @@ -1,4 +1,6 @@ ExternalProject_Add(aom + DEPENDS + vmaf GIT_REPOSITORY https://aomedia.googlesource.com/aom SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--filter=tree:0" @@ -20,6 +22,9 @@ ExternalProject_Add(aom -DENABLE_TESTDATA=OFF -DCONFIG_UNIT_TESTS=0 -DCONFIG_AV1_DECODER=0 + -DCONFIG_TUNE_VMAF=1 + -DDEBUG_CMAKE_DISABLE_COMPILER_TESTS=ON + ${aom_neon} BUILD_COMMAND ${EXEC} ninja -C INSTALL_COMMAND ${EXEC} ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 diff --git a/packages/nettle.cmake b/packages/aria2.cmake similarity index 53% rename from packages/nettle.cmake rename to packages/aria2.cmake index 1da0c757b..49de61106 100644 --- a/packages/nettle.cmake +++ b/packages/aria2.cmake @@ -1,20 +1,30 @@ -ExternalProject_Add(nettle - GIT_REPOSITORY https://gitlab.com/shinchiro/nettle.git +ExternalProject_Add(aria2 + DEPENDS + libxml2 + libssh2 + c-ares + sqlite + zlib + GIT_REPOSITORY https://github.com/Andarwinux/aria2.git SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--filter=tree:0" - PATCH_COMMAND ${EXEC} git am --3way ${CMAKE_CURRENT_SOURCE_DIR}/nettle-*.patch UPDATE_COMMAND "" CONFIGURE_COMMAND ${EXEC} autoreconf -fi && CONF=1 /configure --host=${TARGET_ARCH} --prefix=${MINGW_INSTALL_PREFIX} --disable-shared - --disable-openssl - --disable-documentation + --enable-static + --with-libcares + --with-libssh2 + --with-libxml2 + --with-sqlite3 + --with-wintls + --with-libz BUILD_COMMAND ${MAKE} INSTALL_COMMAND ${MAKE} install BUILD_IN_SOURCE 1 LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) -force_rebuild_git(nettle) -cleanup(nettle install) +force_rebuild_git(aria2) +cleanup(aria2 install) diff --git a/packages/libmfx.cmake b/packages/autoreconf_template.cmake similarity index 68% rename from packages/libmfx.cmake rename to packages/autoreconf_template.cmake index 8c7d6bb9d..894ba5d1c 100644 --- a/packages/libmfx.cmake +++ b/packages/autoreconf_template.cmake @@ -1,18 +1,24 @@ -ExternalProject_Add(libmfx - GIT_REPOSITORY https://github.com/lu-zero/mfx_dispatch.git +ExternalProject_Add(name + DEPENDS + name + GIT_REPOSITORY url SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--filter=tree:0" + GIT_REMOTE_NAME origin + GIT_TAG branch/tag/sha + GIT_RESET sha UPDATE_COMMAND "" + PATCH_COMMAND "" CONFIGURE_COMMAND ${EXEC} autoreconf -fi && CONF=1 /configure --host=${TARGET_ARCH} --prefix=${MINGW_INSTALL_PREFIX} - --disable-shared --enable-static + --disable-shared BUILD_COMMAND ${MAKE} INSTALL_COMMAND ${MAKE} install BUILD_IN_SOURCE 1 LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) -force_rebuild_git(libmfx) -cleanup(libmfx install) +force_rebuild_git(name) +cleanup(name install) \ No newline at end of file diff --git a/packages/brotli.cmake b/packages/brotli.cmake index 2a59f147f..e687dd8a9 100644 --- a/packages/brotli.cmake +++ b/packages/brotli.cmake @@ -2,7 +2,7 @@ ExternalProject_Add(brotli GIT_REPOSITORY https://github.com/google/brotli.git SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--sparse --filter=tree:0" - GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !tests" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !tests !js !java !research" UPDATE_COMMAND "" CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B -G Ninja @@ -13,7 +13,7 @@ ExternalProject_Add(brotli -DBUILD_SHARED_LIBS=OFF -DSHARE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} -DBROTLI_EMSCRIPTEN=OFF - -DBROTLI_BUILD_TOOLS=OFF + ${brotli_tools} BUILD_COMMAND ${EXEC} ninja -C INSTALL_COMMAND ${EXEC} ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 diff --git a/packages/libressl.cmake b/packages/c-ares.cmake similarity index 54% rename from packages/libressl.cmake rename to packages/c-ares.cmake index 703c9d19a..a4df2ad45 100644 --- a/packages/libressl.cmake +++ b/packages/c-ares.cmake @@ -1,8 +1,9 @@ -ExternalProject_Add(libressl - URL https://cdn.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.1.5.tar.gz - URL_HASH SHA256=2c13ddcec5081c0e7ba7f93d8370a91911173090f1922007e1d90de274500494 - DOWNLOAD_DIR ${SOURCE_LOCATION} - PATCH_COMMAND patch -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/libressl-0001-remove-postfix-in-libs-name.patch +ExternalProject_Add(c-ares + GIT_REPOSITORY https://github.com/c-ares/c-ares.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + GIT_TAG main + UPDATE_COMMAND "" CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B -G Ninja -DCMAKE_BUILD_TYPE=Release @@ -10,11 +11,14 @@ ExternalProject_Add(libressl -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=OFF - -DLIBRESSL_APPS=OFF - -DLIBRESSL_TESTS=OFF + -DCARES_BUILD_TOOLS=OFF + -DCARES_SHARED=OFF + -DCARES_STATIC=ON + -DCARES_INSTALL=ON BUILD_COMMAND ${EXEC} ninja -C INSTALL_COMMAND ${EXEC} ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) -cleanup(libressl install) +force_rebuild_git(c-ares) +cleanup(c-ares install) diff --git a/packages/uavs3d.cmake b/packages/cmake_template.cmake similarity index 73% rename from packages/uavs3d.cmake rename to packages/cmake_template.cmake index 0d92d85fa..d99287a0c 100644 --- a/packages/uavs3d.cmake +++ b/packages/cmake_template.cmake @@ -1,8 +1,14 @@ -ExternalProject_Add(uavs3d - GIT_REPOSITORY https://github.com/uavs3/uavs3d.git +ExternalProject_Add(name + DEPENDS + name + GIT_REPOSITORY url SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--filter=tree:0" + GIT_REMOTE_NAME origin + GIT_TAG branch/tag/sha + GIT_RESET sha UPDATE_COMMAND "" + PATCH_COMMAND "" CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B -G Ninja -DCMAKE_BUILD_TYPE=Release @@ -10,11 +16,10 @@ ExternalProject_Add(uavs3d -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=OFF - -DCOMPILE_10BIT=ON BUILD_COMMAND ${EXEC} ninja -C INSTALL_COMMAND ${EXEC} ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) -force_rebuild_git(uavs3d) -cleanup(uavs3d install) +force_rebuild_git(name) +cleanup(name install) diff --git a/packages/cryptopp.cmake b/packages/cryptopp.cmake deleted file mode 100644 index 91c39cd48..000000000 --- a/packages/cryptopp.cmake +++ /dev/null @@ -1,18 +0,0 @@ -ExternalProject_Add(cryptopp - URL https://github.com/weidai11/cryptopp/archive/CRYPTOPP_8_2_0.tar.gz - URL_HASH SHA256=e3bcd48a62739ad179ad8064b523346abb53767bcbefc01fe37303412292343e - DOWNLOAD_DIR ${SOURCE_LOCATION} - CONFIGURE_COMMAND "" - BUILD_COMMAND ${MAKE} - CXX=${TARGET_ARCH}-g++ - CC=${TARGET_ARCH}-gcc - AR=${TARGET_ARCH}-ar - RANLIB=${TARGET_ARCH}-ranlib - INSTALL_COMMAND ${MAKE} - PREFIX=${MINGW_INSTALL_PREFIX} - install - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -cleanup(cryptopp install) diff --git a/packages/curl-0001-Skip-compiling-unnecessary-stuff.patch b/packages/curl-0001-Skip-compiling-unnecessary-stuff.patch deleted file mode 100644 index 1b0144ee2..000000000 --- a/packages/curl-0001-Skip-compiling-unnecessary-stuff.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 1521b617218a0554f285f5217c193a8ed2e00296 Mon Sep 17 00:00:00 2001 -From: shinchiro -Date: Fri, 8 Dec 2017 19:49:23 +0800 -Subject: [PATCH] Skip compiling unnecessary stuff - ---- - Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index 8e5ef911..2369e213 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -156,7 +156,7 @@ CLEANFILES = $(VC6_LIBDSP) $(VC6_SRCDSP) $(VC7_LIBVCPROJ) $(VC7_SRCVCPROJ) \ - bin_SCRIPTS = curl-config - - SUBDIRS = lib src --DIST_SUBDIRS = $(SUBDIRS) tests packages scripts include docs -+DIST_SUBDIRS = $(SUBDIRS) include - - pkgconfigdir = $(libdir)/pkgconfig - pkgconfig_DATA = libcurl.pc --- -2.15.0 - diff --git a/packages/curl.cmake b/packages/curl.cmake deleted file mode 100644 index 5b73db33d..000000000 --- a/packages/curl.cmake +++ /dev/null @@ -1,25 +0,0 @@ -ExternalProject_Add(curl - DEPENDS - mbedtls - GIT_REPOSITORY https://github.com/curl/curl.git - SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" - PATCH_COMMAND ${EXEC} git am --3way ${CMAKE_CURRENT_SOURCE_DIR}/curl-*.patch - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} autoreconf -fi && CONF=1 /configure - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --disable-shared - --with-mbedtls=${MINGW_INSTALL_PREFIX} - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -force_rebuild_git(curl) -cleanup(curl install) - -# Download the cacert.pem file: https://curl.haxx.se/docs/caextract.html -# Rename the cacert.pem file to curl-ca-bundle.crt -# Put in same directory as curl.exe diff --git a/packages/davs2.cmake b/packages/davs2.cmake deleted file mode 100644 index aa34171f1..000000000 --- a/packages/davs2.cmake +++ /dev/null @@ -1,23 +0,0 @@ -if(${TARGET_CPU} MATCHES "i686") - set(disable_asm "--disable-asm") -endif() - -ExternalProject_Add(davs2 - GIT_REPOSITORY https://github.com/pkuvcl/davs2.git - SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} cd /build/linux && CONF=1 ./configure - --host=${TARGET_ARCH} - --cross-prefix=${TARGET_CPU}-w64-mingw32- - --prefix=${MINGW_INSTALL_PREFIX} - --disable-cli - ${disable_asm} - BUILD_COMMAND ${MAKE} -C /build/linux - INSTALL_COMMAND ${MAKE} -C /build/linux install - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -force_rebuild_git(davs2) -cleanup(davs2 install) diff --git a/packages/directx-header.cmake b/packages/directx-header.cmake new file mode 100644 index 000000000..e71c41fe0 --- /dev/null +++ b/packages/directx-header.cmake @@ -0,0 +1,22 @@ +ExternalProject_Add(directx-header + GIT_REPOSITORY https://github.com/microsoft/DirectX-Headers.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + GIT_REMOTE_NAME origin + GIT_TAG main + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 meson setup + --prefix=${MINGW_INSTALL_PREFIX} + --libdir=${MINGW_INSTALL_PREFIX}/lib + --cross-file=${MESON_CROSS} + --buildtype=release + --default-library=static + -Dbuild-test=false + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(directx-header) +force_meson_configure(directx-header) +cleanup(directx-header install) diff --git a/packages/expat.cmake b/packages/expat.cmake index 8d40dac6f..a39602cae 100644 --- a/packages/expat.cmake +++ b/packages/expat.cmake @@ -1,7 +1,8 @@ ExternalProject_Add(expat GIT_REPOSITORY https://github.com/libexpat/libexpat.git SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" + GIT_CLONE_FLAGS "--sparse --filter=tree:0" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !testdata" UPDATE_COMMAND "" GIT_REMOTE_NAME origin CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H/expat -B diff --git a/packages/fdk-aac.cmake b/packages/fdk-aac.cmake new file mode 100644 index 000000000..bbbd826ad --- /dev/null +++ b/packages/fdk-aac.cmake @@ -0,0 +1,21 @@ +ExternalProject_Add(fdk-aac + GIT_REPOSITORY https://github.com/mstorsjo/fdk-aac.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B + -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} + -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} + -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} + -DBUILD_SHARED_LIBS=OFF + -DFDK_AAC_INSTALL_CMAKE_CONFIG_MODULE=ON + -DFDK_AAC_INSTALL_PKGCONFIG_MODULE=ON + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(fdk-aac) +cleanup(fdk-aac install) diff --git a/packages/ffmpeg.cmake b/packages/ffmpeg.cmake index e620f2f48..d065ccf50 100644 --- a/packages/ffmpeg.cmake +++ b/packages/ffmpeg.cmake @@ -2,7 +2,7 @@ ExternalProject_Add(ffmpeg DEPENDS amf-headers avisynth-headers - nvcodec-headers + ${nvcodec-headers} bzip2 lame lcms2 @@ -16,7 +16,6 @@ ExternalProject_Add(ffmpeg libmodplug libpng libsoxr - libbs2b libvpx libwebp libzimg @@ -26,9 +25,7 @@ ExternalProject_Add(ffmpeg opus speex vorbis - x264 - ${ffmpeg_x265} - xvidcore + x265 libxml2 libvpl libopenmpt @@ -39,16 +36,22 @@ ExternalProject_Add(ffmpeg libaribcaption aom rav1e + svtav1 dav1d - vapoursynth - uavs3d - davs2 + ${vapoursynth} rubberband libva openal-soft + fdk-aac + opencl + vulkan + vmaf + directx-header + game-music-emu GIT_REPOSITORY https://github.com/FFmpeg/FFmpeg.git SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" + GIT_CLONE_FLAGS "--sparse --filter=tree:0" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !tests/ref/fate" UPDATE_COMMAND "" CONFIGURE_COMMAND ${EXEC} CONF=1 /configure --cross-prefix=${TARGET_ARCH}- @@ -61,9 +64,10 @@ ExternalProject_Add(ffmpeg ${ffmpeg_hardcoded_tables} --enable-gpl --enable-version3 + --enable-nonfree --enable-postproc --enable-avisynth - --enable-vapoursynth + ${ffmpeg_vapoursynth} --enable-libass --enable-libbluray --enable-libdvdnav @@ -75,23 +79,20 @@ ExternalProject_Add(ffmpeg --enable-libmodplug --enable-libopenmpt --enable-libmp3lame + --enable-libgme --enable-lcms2 --enable-libopus --enable-libsoxr --enable-libspeex --enable-libvorbis - --enable-libbs2b --enable-librubberband --enable-libvpx --enable-libwebp - --enable-libx264 --enable-libx265 --enable-libaom --enable-librav1e + --enable-libsvtav1 --enable-libdav1d - --enable-libdavs2 - --enable-libuavs3d - --enable-libxvid --enable-libzimg --enable-openssl --enable-libxml2 @@ -104,10 +105,7 @@ ExternalProject_Add(ffmpeg --enable-libshaderc --enable-libzvbi --enable-libaribcaption - --enable-cuda-llvm - --enable-cuvid - --enable-nvdec - --enable-nvenc + ${ffmpeg_cuda} --enable-amf --enable-openal --enable-opengl @@ -115,12 +113,20 @@ ExternalProject_Add(ffmpeg --disable-ffplay --disable-ffprobe --enable-vaapi + --enable-libfdk-aac + --enable-libvmaf + --enable-opencl + --enable-openal + --enable-opengl --disable-vdpau --disable-videotoolbox --disable-decoder=libaom_av1 + --disable-stripping + --disable-ptx-compression ${ffmpeg_lto} - --extra-cflags='-Wno-error=int-conversion' + --extra-cflags='-I${MINGW_INSTALL_PREFIX}/include/directx -D__REQUIRED_RPCNDR_H_VERSION__=475' "--extra-libs='${ffmpeg_extra_libs}'" # -lstdc++ / -lc++ needs by libjxl and shaderc + "--nvccflags='--cuda-gpu-arch=sm_86 -O3'" BUILD_COMMAND ${MAKE} INSTALL_COMMAND ${MAKE} install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 diff --git a/packages/flac.cmake b/packages/flac.cmake deleted file mode 100644 index 0c0bd5fa8..000000000 --- a/packages/flac.cmake +++ /dev/null @@ -1,26 +0,0 @@ -ExternalProject_Add(flac - DEPENDS ogg - GIT_REPOSITORY https://github.com/xiph/flac.git - SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} /autogen.sh && CONF=1 /configure - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --enable-static - --disable-shared - --disable-doxygen-docs - --disable-xmms-plugin - --disable-thorough-tests - --disable-oggtest - --disable-examples - --disable-stack-smash-protection - CFLAGS='-D_FORTIFY_SOURCE=0' - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -force_rebuild_git(flac) -cleanup(flac install) diff --git a/packages/fontconfig-0001-Custom-changes-for-mpv-builds.patch b/packages/fontconfig-0001-Custom-changes-for-mpv-builds.patch deleted file mode 100644 index 4932abda5..000000000 --- a/packages/fontconfig-0001-Custom-changes-for-mpv-builds.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 78670422540b05da11084cf885c19d0286a236c4 Mon Sep 17 00:00:00 2001 -From: shinchiro -Date: Sun, 20 Sep 2020 10:44:07 +0800 -Subject: [PATCH] Custom changes for mpv builds - -Based on original lachs0r's patch for fontconfig ---- - src/fcdir.c | 34 +++++++++++++++++++++++----------- - src/fcinit.c | 35 +++++++++++++++++++++++++++++++++++ - 2 files changed, 58 insertions(+), 11 deletions(-) - -diff --git a/src/fcdir.c b/src/fcdir.c -index 2e4fdc6..68aad94 100644 ---- a/src/fcdir.c -+++ b/src/fcdir.c -@@ -72,18 +72,9 @@ FcFileScanFontConfig (FcFontSet *set, - int old_nfont = set->nfont; - const FcChar8 *sysroot = FcConfigGetSysRoot (config); - -- if (FcDebug () & FC_DBG_SCAN) -- { -- printf ("\tScanning file %s...", file); -- fflush (stdout); -- } -- - if (!FcFreeTypeQueryAll (file, -1, NULL, NULL, set)) - return FcFalse; - -- if (FcDebug () & FC_DBG_SCAN) -- printf ("done\n"); -- - for (i = old_nfont; i < set->nfont; i++) - { - FcPattern *font = set->fonts[i]; -@@ -233,7 +224,7 @@ FcDirScanConfig (FcFontSet *set, - base = file_prefix + strlen ((char *) file_prefix); - - if (FcDebug () & FC_DBG_SCAN) -- printf ("\tScanning dir %s\n", s_dir); -+ fprintf (stderr, "[fontconfig] Scanning dir %s\n", dir); - - d = opendir ((char *) s_dir); - if (!d) -@@ -270,8 +261,29 @@ FcDirScanConfig (FcFontSet *set, - /* - * Scan file files to build font patterns - */ -+ char buf1[512], buf2[512], pad[512], *str = &buf1[0], *prev = &buf2[0], *tmp; -+ int j, diff; -+ prev[0] = pad[0] = 0; -+ - for (i = 0; i < files->num; i++) -- FcFileScanConfig (set, dirs, files->strs[i], config); -+ { -+ snprintf (str, 512, "\r[%d/%d] %s", i+1, files->num, files->strs[i]); -+ -+ for (diff = strlen (prev) - strlen (str), j = 0; diff > 0; diff--, j++) -+ pad[j] = ' '; -+ -+ pad[j] = 0; -+ -+ if (FcDebug () & FC_DBG_SCAN) -+ fprintf (stderr, "%s%s", str, pad); -+ -+ tmp = str; str = prev; prev = tmp; -+ -+ FcFileScanConfig (set, dirs, files->strs[i], config); -+ } -+ -+ if (FcDebug () & FC_DBG_SCAN) -+ fprintf (stderr, "\n[fontconfig] Finished scanning dir %s\n", dir); - - bail2: - FcStrSetDestroy (files); -diff --git a/src/fcinit.c b/src/fcinit.c -index c05cdc5..347f8b4 100644 ---- a/src/fcinit.c -+++ b/src/fcinit.c -@@ -35,6 +35,12 @@ - #pragma message("To suppress these warnings, define FC_NO_MT.") - #endif - -+#ifdef _WIN32 -+#define _WIN32_IE 0x0500 -+#include -+#include -+#endif -+ - static FcConfig * - FcInitFallbackConfig (const FcChar8 *sysroot) - { -@@ -53,12 +59,41 @@ FcInitFallbackConfig (const FcChar8 *sysroot) - config = FcConfigCreate (); - if (!config) - goto bail0; -+ -+#ifdef _WIN32 -+ char *buf = malloc (MAX_PATH+1); -+ if (!buf) goto bail1; -+ if (SHGetFolderPathA (NULL, CSIDL_FONTS|CSIDL_FLAG_CREATE, NULL, -+ SHGFP_TYPE_CURRENT, buf) == S_OK) { -+ if (!FcConfigAddConfigDir (config, (FcChar8 *) buf)) -+ goto bail2; -+ } -+ -+ char *buf2 = malloc (MAX_PATH+1); -+ if (!buf) goto bail2; -+ if (SHGetFolderPathA (NULL, CSIDL_LOCAL_APPDATA|CSIDL_FLAG_CREATE, NULL, -+ SHGFP_TYPE_CURRENT, buf2) == S_OK) { -+ if (buf2[strlen(buf2)-1] != '\\') -+ strcat (buf2, "\\"); -+ strcat (buf2, "fontconfig"); -+ if (!FcConfigAddCacheDir (config, (FcChar8 *) buf2)) -+ goto bail3; -+ } -+#else - FcConfigSetSysRoot (config, sysroot); - if (!FcConfigParseAndLoadFromMemory (config, fallback, FcFalse)) - goto bail1; -+#endif - - return config; - -+#ifdef _WIN32 -+bail3: -+ free(buf2); -+bail2: -+ free(buf); -+#endif -+ - bail1: - FcConfigDestroy (config); - bail0: --- -2.43.0 - diff --git a/packages/fontconfig-0002-Do-not-use-dirent.h.patch b/packages/fontconfig-0002-Do-not-use-dirent.h.patch deleted file mode 100644 index bbd27ac6f..000000000 --- a/packages/fontconfig-0002-Do-not-use-dirent.h.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 783da283864a7423cb30563176eac6f20445dcc7 Mon Sep 17 00:00:00 2001 -From: Zhong Lufan -Date: Fri, 7 Oct 2022 21:17:09 +0800 -Subject: [PATCH] Do not use dirent.h - -Because this causes some quirks on some partitions on Windows. ---- - meson.build | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/meson.build b/meson.build -index a9ec544..1bd807e 100644 ---- a/meson.build -+++ b/meson.build -@@ -47,7 +47,6 @@ pkgmod = import('pkgconfig') - python3 = import('python').find_installation() - - check_headers = [ -- ['dirent.h'], - ['fcntl.h'], - ['stdlib.h'], - ['string.h'], --- -2.38.0 - diff --git a/packages/fontconfig.cmake b/packages/fontconfig.cmake index 64b41d549..0f6528aab 100644 --- a/packages/fontconfig.cmake +++ b/packages/fontconfig.cmake @@ -10,7 +10,6 @@ ExternalProject_Add(fontconfig GIT_REMOTE_NAME origin GIT_TAG main GIT_CLONE_FLAGS "--filter=tree:0" - PATCH_COMMAND ${EXEC} git am --3way ${CMAKE_CURRENT_SOURCE_DIR}/fontconfig-*.patch CONFIGURE_COMMAND ${EXEC} CONF=1 meson setup --prefix=${MINGW_INSTALL_PREFIX} --libdir=${MINGW_INSTALL_PREFIX}/lib diff --git a/packages/fribidi.cmake b/packages/fribidi.cmake index 4b64f3749..40455a4f6 100644 --- a/packages/fribidi.cmake +++ b/packages/fribidi.cmake @@ -1,7 +1,8 @@ ExternalProject_Add(fribidi GIT_REPOSITORY https://github.com/fribidi/fribidi.git SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" + GIT_CLONE_FLAGS "--sparse --filter=tree:0" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !test" UPDATE_COMMAND "" CONFIGURE_COMMAND ${EXEC} CONF=1 meson setup --prefix=${MINGW_INSTALL_PREFIX} diff --git a/packages/game-music-emu.cmake b/packages/game-music-emu.cmake index 06b431603..3c1f2c2a2 100644 --- a/packages/game-music-emu.cmake +++ b/packages/game-music-emu.cmake @@ -1,17 +1,19 @@ ExternalProject_Add(game-music-emu - GIT_REPOSITORY https://bitbucket.org/mpyne/game-music-emu.git + GIT_REPOSITORY https://github.com/libgme/game-music-emu.git SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--filter=tree:0" UPDATE_COMMAND "" CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B + -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=OFF -DENABLE_UBSAN=NO - BUILD_COMMAND ${MAKE} -C - INSTALL_COMMAND ${MAKE} -C install + -DCMAKE_DISABLE_FIND_PACKAGE_SDL2=ON + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) diff --git a/packages/glslang.cmake b/packages/glslang.cmake index 3df29f47b..ca59d429d 100644 --- a/packages/glslang.cmake +++ b/packages/glslang.cmake @@ -1,7 +1,8 @@ ExternalProject_Add(glslang GIT_REPOSITORY https://github.com/KhronosGroup/glslang.git SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" + GIT_CLONE_FLAGS "--sparse --filter=tree:0" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !Test" GIT_REMOTE_NAME origin GIT_TAG main UPDATE_COMMAND "" diff --git a/packages/gmp.cmake b/packages/gmp.cmake deleted file mode 100644 index 34b5c00cf..000000000 --- a/packages/gmp.cmake +++ /dev/null @@ -1,16 +0,0 @@ -ExternalProject_Add(gmp - URL https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz - URL_HASH SHA256=a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898 - DOWNLOAD_DIR ${SOURCE_LOCATION} - CONFIGURE_COMMAND ${EXEC} CONF=1 /configure - CC_FOR_BUILD=cc - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --enable-static - --disable-shared - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -cleanup(gmp install) diff --git a/packages/lame.cmake b/packages/lame.cmake index 371f029f4..3ac7732eb 100644 --- a/packages/lame.cmake +++ b/packages/lame.cmake @@ -11,14 +11,13 @@ ExternalProject_Add(lame GIT_CLONE_FLAGS "--filter=tree:0" UPDATE_COMMAND "" PATCH_COMMAND chmod 755 ${DEBPATCH} && ${DEBPATCH} - CONFIGURE_COMMAND ${EXEC} autoreconf -fi && CONF=1 /configure + CONFIGURE_COMMAND ${EXEC} CONF=1 /configure --host=${TARGET_ARCH} --prefix=${MINGW_INSTALL_PREFIX} --disable-shared --disable-frontend BUILD_COMMAND ${MAKE} INSTALL_COMMAND ${MAKE} install - BUILD_IN_SOURCE 1 LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) diff --git a/packages/libbs2b-0001-build-library-only.patch b/packages/libbs2b-0001-build-library-only.patch deleted file mode 100644 index 44f3be5a5..000000000 --- a/packages/libbs2b-0001-build-library-only.patch +++ /dev/null @@ -1,55 +0,0 @@ -From dce3ad5987efa9b41741bde7f8ab159618d52eff Mon Sep 17 00:00:00 2001 -From: shinchiro -Date: Sun, 23 Feb 2020 19:04:18 +0800 -Subject: [PATCH] Build library only - ---- - configure.ac | 8 +------- - src/Makefile.am | 5 ----- - 2 files changed, 1 insertion(+), 12 deletions(-) - -diff --git a/configure.ac b/configure.ac -index c3d1c59..126bf65 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -14,11 +14,6 @@ AC_PROG_CC - AC_PROG_LIBTOOL - PKG_PROG_PKG_CONFIG - --# Checks for libraries. --PKG_CHECK_EXISTS([sndfile], [], [ -- AC_MSG_ERROR(Please install libsndfile.) --]) -- - # Checks for header files. - AC_CHECK_HEADERS([fcntl.h malloc.h string.h]) - -@@ -27,8 +22,7 @@ AC_HEADER_STDBOOL - AC_TYPE_SIZE_T - - # Checks for library functions. --AC_FUNC_MALLOC --AC_CHECK_FUNCS([strrchr]) -+AC_CHECK_FUNCS([malloc strrchr]) - - AC_CONFIG_FILES([libbs2b.pc - Makefile -diff --git a/src/Makefile.am b/src/Makefile.am -index 414aeec..98ed494 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -1,11 +1,6 @@ - lib_LTLIBRARIES = \ - libbs2b.la - --bin_PROGRAMS = \ -- bs2bconvert \ -- bs2bstream -- -- - bs2b_HEADERS = \ - bs2b.h \ - bs2bclass.h \ --- -2.17.1 - diff --git a/packages/libbs2b.cmake b/packages/libbs2b.cmake deleted file mode 100644 index d6cb80345..000000000 --- a/packages/libbs2b.cmake +++ /dev/null @@ -1,19 +0,0 @@ -ExternalProject_Add(libbs2b - GIT_REPOSITORY https://github.com/alexmarsev/libbs2b.git - SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" - PATCH_COMMAND ${EXEC} git am --3way ${CMAKE_CURRENT_SOURCE_DIR}/libbs2b-*.patch - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} /autogen.sh && CONF=1 /configure - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --enable-static - --disable-shared - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -force_rebuild_git(libbs2b) -cleanup(libbs2b install) diff --git a/packages/libdovi.cmake b/packages/libdovi.cmake index a0aacede8..e5c803539 100644 --- a/packages/libdovi.cmake +++ b/packages/libdovi.cmake @@ -2,7 +2,7 @@ ExternalProject_Add(libdovi GIT_REPOSITORY https://github.com/quietvoid/dovi_tool.git SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--sparse --filter=tree:0" - GIT_CLONE_POST_COMMAND "sparse-checkout set dolby_vision" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone dolby_vision" GIT_REMOTE_NAME origin GIT_TAG main UPDATE_COMMAND "" @@ -10,12 +10,12 @@ ExternalProject_Add(libdovi CONFIGURE_COMMAND "" BUILD_COMMAND ${EXEC} CARGO_BUILD_TARGET_DIR= - CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 ${cargo_lto_rustflags} cargo cinstall --manifest-path /dolby_vision/Cargo.toml --prefix ${MINGW_INSTALL_PREFIX} - --target ${TARGET_CPU}-pc-windows-gnu + --target ${TARGET_CPU}-pc-windows-${rust_target} + -Z build-std=std,panic_abort,core,alloc --release --library-type staticlib INSTALL_COMMAND "" diff --git a/packages/libmediainfo.cmake b/packages/libmediainfo.cmake new file mode 100644 index 000000000..1912fffb0 --- /dev/null +++ b/packages/libmediainfo.cmake @@ -0,0 +1,24 @@ +ExternalProject_Add(libmediainfo + DEPENDS + zlib + zenlib + GIT_REPOSITORY https://github.com/MediaArea/MediaInfoLib.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H/Project/CMake -B + -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} + -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} + -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} + -DBUILD_SHARED_LIBS=ON + -DBUILD_ZLIB=OFF + -DBUILD_ZENLIB=OFF + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(libmediainfo) +cleanup(libmediainfo install) diff --git a/packages/libopusenc.cmake b/packages/libopusenc.cmake deleted file mode 100644 index 36180eb9d..000000000 --- a/packages/libopusenc.cmake +++ /dev/null @@ -1,21 +0,0 @@ -ExternalProject_Add(libopusenc - DEPENDS - opus - GIT_REPOSITORY https://github.com/xiph/libopusenc.git - SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} /autogen.sh && CONF=1 /configure - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --disable-shared - --disable-doc - --disable-examples - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -force_rebuild_git(libopusenc) -cleanup(libopusenc install) diff --git a/packages/libressl-0001-remove-postfix-in-libs-name.patch b/packages/libressl-0001-remove-postfix-in-libs-name.patch deleted file mode 100644 index ba96d7b98..000000000 --- a/packages/libressl-0001-remove-postfix-in-libs-name.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 3d3edec7866fea90ee2c5c2d6d22458fabbeef7d Mon Sep 17 00:00:00 2001 -From: shinchiro -Date: Sun, 15 Mar 2020 21:31:40 +0800 -Subject: [PATCH] remove postfix in libs name - ---- - crypto/CMakeLists.txt | 2 +- - ssl/CMakeLists.txt | 2 +- - tls/CMakeLists.txt | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt -index e6cfc65..31e33ba 100644 ---- a/crypto/CMakeLists.txt -+++ b/crypto/CMakeLists.txt -@@ -985,7 +985,7 @@ target_include_directories(crypto - - export_symbol(crypto ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym) - target_link_libraries(crypto ${PLATFORM_LIBS}) --if (WIN32) -+if (BUILD_SHARED_LIBS AND WIN32) - set(CRYPTO_POSTFIX -${CRYPTO_MAJOR_VERSION}) - endif() - set_target_properties(crypto PROPERTIES -diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt -index 39f8192..9d71986 100644 ---- a/ssl/CMakeLists.txt -+++ b/ssl/CMakeLists.txt -@@ -62,7 +62,7 @@ target_include_directories(ssl - - export_symbol(ssl ${CMAKE_CURRENT_SOURCE_DIR}/ssl.sym) - target_link_libraries(ssl crypto ${PLATFORM_LIBS}) --if (WIN32) -+if (BUILD_SHARED_LIBS AND WIN32) - set(SSL_POSTFIX -${SSL_MAJOR_VERSION}) - endif() - set_target_properties(ssl PROPERTIES -diff --git a/tls/CMakeLists.txt b/tls/CMakeLists.txt -index f64b1c3..71270b1 100644 ---- a/tls/CMakeLists.txt -+++ b/tls/CMakeLists.txt -@@ -39,7 +39,7 @@ target_include_directories(tls - - export_symbol(tls ${CMAKE_CURRENT_SOURCE_DIR}/tls.sym) - target_link_libraries(tls ssl crypto ${PLATFORM_LIBS}) --if (WIN32) -+if (BUILD_SHARED_LIBS AND WIN32) - set(TLS_POSTFIX -${TLS_MAJOR_VERSION}) - endif() - set_target_properties(tls PROPERTIES --- -2.17.1 - diff --git a/packages/libsdl2.cmake b/packages/libsdl2.cmake index ac5ccd59a..f84e5dd76 100644 --- a/packages/libsdl2.cmake +++ b/packages/libsdl2.cmake @@ -4,7 +4,8 @@ ExternalProject_Add(libsdl2 libiconv GIT_REPOSITORY https://github.com/libsdl-org/SDL.git SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" + GIT_CLONE_FLAGS "--sparse --filter=tree:0" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !test" UPDATE_COMMAND "" GIT_REMOTE_NAME origin GIT_TAG SDL2 diff --git a/packages/libsixel.cmake b/packages/libsixel.cmake deleted file mode 100644 index edb66e705..000000000 --- a/packages/libsixel.cmake +++ /dev/null @@ -1,24 +0,0 @@ -ExternalProject_Add(libsixel - DEPENDS - libpng - libjpeg - GIT_REPOSITORY https://github.com/saitoha/libsixel.git - GIT_CLONE_FLAGS "--filter=tree:0" - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} CONF=1 /configure - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --with-jpeg - --with-png - --disable-img2sixel - --disable-sixel2png - --disable-python - --enable-static - --disable-shared - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -force_rebuild_git(libsixel) -cleanup(libsixel install) diff --git a/packages/libsodium.cmake b/packages/libsodium.cmake deleted file mode 100644 index 83ba28b14..000000000 --- a/packages/libsodium.cmake +++ /dev/null @@ -1,16 +0,0 @@ -ExternalProject_Add(libsodium - URL https://github.com/jedisct1/libsodium/archive/1.0.18.tar.gz - URL_HASH SHA256=d59323c6b712a1519a5daf710b68f5e7fde57040845ffec53850911f10a5d4f4 - DOWNLOAD_DIR ${SOURCE_LOCATION} - CONFIGURE_COMMAND ${EXEC} /autogen.sh && CONF=1 /configure - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --enable-static - --disable-shared - BUILD_COMMAND ${MAKE} CFLAGS='-D_FORTIFY_SOURCE=0' - INSTALL_COMMAND ${MAKE} install - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -cleanup(libsodium install) diff --git a/packages/libssh.cmake b/packages/libssh.cmake index 78add3997..5f909d4a3 100644 --- a/packages/libssh.cmake +++ b/packages/libssh.cmake @@ -15,6 +15,7 @@ ExternalProject_Add(libssh -DBUILD_SHARED_LIBS=OFF -DWITH_ZLIB=ON -DWITH_EXAMPLES=OFF + -DCMAKE_C_FLAGS='${CMAKE_C_FLAGS} -DHAVE_COMPILER__FUNC__=1' BUILD_COMMAND ${EXEC} ninja -C COMMAND bash -c "echo {'Libs.private: -lwsock32 -liphlpapi -lpthread','\nRequires.private: libssl','\nCflags.private: -DLIBSSH_STATIC'} >> /libssh.pc" INSTALL_COMMAND ${EXEC} ninja -C install diff --git a/packages/libssh2.cmake b/packages/libssh2.cmake new file mode 100644 index 000000000..bc069aa5e --- /dev/null +++ b/packages/libssh2.cmake @@ -0,0 +1,23 @@ +ExternalProject_Add(libssh2 + GIT_REPOSITORY https://github.com/libssh2/libssh2.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B + -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} + -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} + -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} + -DBUILD_SHARED_LIBS=OFF + -DBUILD_TESTING=OFF + -DCRYPTO_BACKEND=WinCNG + -DENABLE_ZLIB_COMPRESSION=ON + -DRUN_DOCKER_TESTS=OFF + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(libssh2) +cleanup(libssh2 install) diff --git a/packages/libuv.cmake b/packages/libuv.cmake deleted file mode 100644 index 6a7c10508..000000000 --- a/packages/libuv.cmake +++ /dev/null @@ -1,16 +0,0 @@ -ExternalProject_Add(libuv - URL https://github.com/libuv/libuv/archive/v1.40.0.tar.gz - URL_HASH SHA256=70fe1c9ba4f2c509e8166c0ca2351000237da573bb6c82092339207a9715ba6b - DOWNLOAD_DIR ${SOURCE_LOCATION} - CONFIGURE_COMMAND ${EXEC} /autogen.sh && CONF=1 /configure - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --enable-static - --disable-shared - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -cleanup(libuv install) diff --git a/packages/libva-utils.cmake b/packages/libva-utils.cmake new file mode 100644 index 000000000..f2e6232d9 --- /dev/null +++ b/packages/libva-utils.cmake @@ -0,0 +1,23 @@ +ExternalProject_Add(libva-utils + DEPENDS + libva + directx-header + GIT_REPOSITORY https://github.com/intel/libva-utils.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 meson setup + --prefix=${MINGW_INSTALL_PREFIX} + --libdir=${MINGW_INSTALL_PREFIX}/lib + --cross-file=${MESON_CROSS} + --buildtype=release + --default-library=static + -Dwin32=true + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(libva-utils) +force_meson_configure(libva-utils) +cleanup(libva-utils install) diff --git a/packages/libvpx.cmake b/packages/libvpx.cmake index 5404c9796..49f6d0ac2 100644 --- a/packages/libvpx.cmake +++ b/packages/libvpx.cmake @@ -1,11 +1,5 @@ -if(${TARGET_CPU} MATCHES "x86_64") - set(libvpx_target "x86_64-win64-gcc") -else() - set(libvpx_target "x86-win32-gcc") -endif() - ExternalProject_Add(libvpx - GIT_REPOSITORY https://chromium.googlesource.com/webm/libvpx.git + GIT_REPOSITORY https://github.com/webmproject/libvpx.git SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--filter=tree:0" GIT_REMOTE_NAME origin @@ -24,6 +18,7 @@ ExternalProject_Add(libvpx --as=yasm --enable-debug --enable-vp9-highbitdepth + ${libvpx_neon} BUILD_COMMAND ${MAKE} INSTALL_COMMAND ${MAKE} install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 diff --git a/packages/libwebp.cmake b/packages/libwebp.cmake index 46224de5c..7fd756928 100644 --- a/packages/libwebp.cmake +++ b/packages/libwebp.cmake @@ -3,7 +3,7 @@ ExternalProject_Add(libwebp zlib libpng libjpeg - GIT_REPOSITORY https://chromium.googlesource.com/webm/libwebp.git + GIT_REPOSITORY https://github.com/webmproject/libwebp.git SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--filter=tree:0" GIT_REMOTE_NAME origin diff --git a/packages/libxml2.cmake b/packages/libxml2.cmake index 7d0f8d4dd..2148bd564 100644 --- a/packages/libxml2.cmake +++ b/packages/libxml2.cmake @@ -4,7 +4,8 @@ ExternalProject_Add(libxml2 libiconv GIT_REPOSITORY https://github.com/GNOME/libxml2.git SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" + GIT_CLONE_FLAGS "--sparse --filter=tree:0" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !result !test" UPDATE_COMMAND "" CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B -G Ninja diff --git a/packages/luajit-0001-add-win32-utf-8-filesystem-functions.patch b/packages/luajit-0001-add-win32-utf-8-filesystem-functions.patch deleted file mode 100644 index 7e36a4ca2..000000000 --- a/packages/luajit-0001-add-win32-utf-8-filesystem-functions.patch +++ /dev/null @@ -1,855 +0,0 @@ -From c92ec4586cb91e430aa2c9d7894cf0128a729633 Mon Sep 17 00:00:00 2001 -From: shinchiro -Date: Tue, 25 Jul 2023 22:53:21 +0800 -Subject: [PATCH] Add win32 UTF-8 filesystem functions - -Taken from https://github.com/wm4/libinsanity ---- - src/Makefile | 2 +- - src/Makefile.dep | 3 +- - src/lib_io.c | 1 + - src/lib_os.c | 1 + - src/lib_package.c | 1 + - src/lj_clib.c | 1 + - src/lj_fs_io.c | 582 +++++++++++++++++++++++++++++++++++++++++ - src/lj_fs_io.h | 60 +++++ - src/lj_fs_io_replace.h | 50 ++++ - src/lj_load.c | 1 + - src/lj_trace.c | 1 + - src/ljamalg.c | 1 + - 12 files changed, 702 insertions(+), 2 deletions(-) - create mode 100644 src/lj_fs_io.c - create mode 100644 src/lj_fs_io.h - create mode 100644 src/lj_fs_io_replace.h - -diff --git a/src/Makefile b/src/Makefile -index 68a9a7c..26137e4 100644 ---- a/src/Makefile -+++ b/src/Makefile -@@ -513,7 +513,7 @@ LJCORE_O= lj_assert.o lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o lj_buf.o \ - lj_asm.o lj_trace.o lj_gdbjit.o \ - lj_ctype.o lj_cdata.o lj_cconv.o lj_ccall.o lj_ccallback.o \ - lj_carith.o lj_clib.o lj_cparse.o \ -- lj_lib.o lj_alloc.o lib_aux.o \ -+ lj_lib.o lj_alloc.o lj_fs_io.o lib_aux.o \ - $(LJLIB_O) lib_init.o lj_str_hash.o - - ifeq (x64,$(TARGET_LJARCH)) -diff --git a/src/Makefile.dep b/src/Makefile.dep -index 400ef8b..5f26250 100644 ---- a/src/Makefile.dep -+++ b/src/Makefile.dep -@@ -47,6 +47,7 @@ lib_table.o: lib_table.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \ - lj_tab.h lj_ff.h lj_ffdef.h lj_lib.h lj_libdef.h - lj_alloc.o: lj_alloc.c lj_def.h lua.h luaconf.h lj_arch.h lj_alloc.h \ - lj_prng.h -+lj_fs_io.o: lj_fs_io.c lj_fs_io.h - lj_api.o: lj_api.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ - lj_err.h lj_errmsg.h lj_debug.h lj_str.h lj_tab.h lj_func.h lj_udata.h \ - lj_meta.h lj_state.h lj_bc.h lj_frame.h lj_trace.h lj_jit.h lj_ir.h \ -@@ -237,7 +238,7 @@ ljamalg.o: ljamalg.c lua.h luaconf.h lauxlib.h lj_assert.c lj_obj.h \ - lj_opt_narrow.c lj_opt_dce.c lj_opt_loop.c lj_snap.h lj_opt_split.c \ - lj_opt_sink.c lj_mcode.c lj_snap.c lj_record.c lj_record.h lj_ffrecord.h \ - lj_crecord.c lj_crecord.h lj_ffrecord.c lj_recdef.h lj_asm.c lj_asm.h \ -- lj_emit_*.h lj_asm_*.h lj_trace.c lj_gdbjit.h lj_gdbjit.c lj_alloc.c \ -+ lj_emit_*.h lj_asm_*.h lj_trace.c lj_gdbjit.h lj_gdbjit.c lj_alloc.c lj_fs_io.c \ - lib_aux.c lib_base.c lj_libdef.h lib_math.c lib_string.c lib_table.c \ - lib_io.c lib_os.c lib_package.c lib_debug.c lib_bit.c lib_jit.c \ - lib_ffi.c lib_buffer.c lib_init.c -diff --git a/src/lib_io.c b/src/lib_io.c -index c22faa2..3014b06 100644 ---- a/src/lib_io.c -+++ b/src/lib_io.c -@@ -25,6 +25,7 @@ - #include "lj_strfmt.h" - #include "lj_ff.h" - #include "lj_lib.h" -+#include "lj_fs_io_replace.h" - - /* Userdata payload for I/O file. */ - typedef struct IOFileUD { -diff --git a/src/lib_os.c b/src/lib_os.c -index 4b4e150..0515579 100644 ---- a/src/lib_os.c -+++ b/src/lib_os.c -@@ -22,6 +22,7 @@ - #include "lj_buf.h" - #include "lj_str.h" - #include "lj_lib.h" -+#include "lj_fs_io_replace.h" - - #if LJ_TARGET_POSIX - #include -diff --git a/src/lib_package.c b/src/lib_package.c -index 63a9121..70fdc53 100644 ---- a/src/lib_package.c -+++ b/src/lib_package.c -@@ -16,6 +16,7 @@ - #include "lj_obj.h" - #include "lj_err.h" - #include "lj_lib.h" -+#include "lj_fs_io_replace.h" - - /* ------------------------------------------------------------------------ */ - -diff --git a/src/lj_clib.c b/src/lj_clib.c -index f0ef6ed..8b22824 100644 ---- a/src/lj_clib.c -+++ b/src/lj_clib.c -@@ -17,6 +17,7 @@ - #include "lj_cdata.h" - #include "lj_clib.h" - #include "lj_strfmt.h" -+#include "lj_fs_io_replace.h" - - /* -- OS-specific functions ----------------------------------------------- */ - -diff --git a/src/lj_fs_io.c b/src/lj_fs_io.c -new file mode 100644 -index 0000000..80668b7 ---- /dev/null -+++ b/src/lj_fs_io.c -@@ -0,0 +1,582 @@ -+// This file is copyrighted. -+ -+#define lj_fs_io_c -+#define LUA_CORE -+ -+#ifdef __MINGW32__ -+ -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "lj_fs_io.h" -+ -+// Like free(), but do not clobber errno and the win32 error state. It is -+// unknown whether MSVCRT's free() clobbers these, but do not take any chances. -+static void free_keep_err(void *ptr) -+{ -+ int err = errno; -+ DWORD bill = GetLastError(); -+ -+ free(ptr); -+ -+ errno = err; -+ SetLastError(bill); -+} -+ -+static void set_errno_from_lasterror(void) -+{ -+ // This just handles the error codes expected from CreateFile at the moment -+ switch (GetLastError()) { -+ case ERROR_FILE_NOT_FOUND: -+ errno = ENOENT; -+ break; -+ case ERROR_SHARING_VIOLATION: -+ case ERROR_ACCESS_DENIED: -+ errno = EACCES; -+ break; -+ case ERROR_FILE_EXISTS: -+ case ERROR_ALREADY_EXISTS: -+ errno = EEXIST; -+ break; -+ case ERROR_PIPE_BUSY: -+ errno = EAGAIN; -+ break; -+ default: -+ errno = EINVAL; -+ break; -+ } -+} -+ -+// Returns NULL + errno on failure. -+static wchar_t *lin_utf8_to_winchar(const char *in) -+{ -+ int res = MultiByteToWideChar(CP_UTF8, 0, in, -1, NULL, 0); -+ if (res <= 0) { -+ set_errno_from_lasterror(); -+ return NULL; -+ } -+ wchar_t *str = malloc(res * sizeof(wchar_t)); -+ if (!str) { -+ errno = ENOMEM; -+ return NULL; -+ } -+ if (MultiByteToWideChar(CP_UTF8, 0, in, -1, str, res) <= 0) { -+ set_errno_from_lasterror(); -+ return NULL; -+ } -+ return str; -+} -+ -+// Returns NULL + errno on failure. -+static char *lin_winchar_to_utf8(const wchar_t *in) -+{ -+ int res = WideCharToMultiByte(CP_UTF8, 0, in, -1, NULL, 0, NULL, NULL); -+ if (res <= 0) { -+ set_errno_from_lasterror(); -+ return NULL; -+ } -+ char *str = malloc(res); -+ if (!str) { -+ errno = ENOMEM; -+ return NULL; -+ } -+ if (WideCharToMultiByte(CP_UTF8, 0, in, -1, str, res, NULL, NULL) <= 0) { -+ set_errno_from_lasterror(); -+ return NULL; -+ } -+ return str; -+} -+ -+static time_t filetime_to_unix_time(int64_t wintime) -+{ -+ static const int64_t hns_per_second = 10000000ll; -+ static const int64_t win_to_unix_epoch = 11644473600ll; -+ return wintime / hns_per_second - win_to_unix_epoch; -+} -+ -+static bool get_file_ids_win8(HANDLE h, lin_dev_t *dev, lin_ino_t *ino) -+{ -+ FILE_ID_INFO ii; -+ if (!GetFileInformationByHandleEx(h, FileIdInfo, &ii, sizeof(ii))) -+ return false; -+ *dev = ii.VolumeSerialNumber; -+ // The definition of FILE_ID_128 differs between mingw-w64 and the Windows -+ // SDK, but we can ignore that by just memcpying it. This will also -+ // truncate the file ID on 32-bit Windows, which doesn't support __int128. -+ // 128-bit file IDs are only used for ReFS, so that should be okay. -+ assert(sizeof(*ino) <= sizeof(ii.FileId)); -+ memcpy(ino, &ii.FileId, sizeof(*ino)); -+ return true; -+} -+ -+static bool get_file_ids(HANDLE h, lin_dev_t *dev, lin_ino_t *ino) -+{ -+ // GetFileInformationByHandle works on FAT partitions and Windows 7, but -+ // doesn't work in UWP and can produce non-unique IDs on ReFS -+ BY_HANDLE_FILE_INFORMATION bhfi; -+ if (!GetFileInformationByHandle(h, &bhfi)) -+ return false; -+ *dev = bhfi.dwVolumeSerialNumber; -+ *ino = ((lin_ino_t)bhfi.nFileIndexHigh << 32) | bhfi.nFileIndexLow; -+ return true; -+} -+ -+// Like fstat(), but with a Windows HANDLE -+static int hstat(HANDLE h, struct lin_stat *buf) -+{ -+ // Handle special (or unknown) file types first -+ switch (GetFileType(h) & ~FILE_TYPE_REMOTE) { -+ case FILE_TYPE_PIPE: -+ *buf = (struct lin_stat){ .st_nlink = 1, .st_mode = _S_IFIFO | 0644 }; -+ return 0; -+ case FILE_TYPE_CHAR: // character device -+ *buf = (struct lin_stat){ .st_nlink = 1, .st_mode = _S_IFCHR | 0644 }; -+ return 0; -+ case FILE_TYPE_UNKNOWN: -+ errno = EBADF; -+ return -1; -+ } -+ -+ struct lin_stat st = { 0 }; -+ -+ FILE_BASIC_INFO bi; -+ if (!GetFileInformationByHandleEx(h, FileBasicInfo, &bi, sizeof(bi))) { -+ errno = EBADF; -+ return -1; -+ } -+ st.st_atime = filetime_to_unix_time(bi.LastAccessTime.QuadPart); -+ st.st_mtime = filetime_to_unix_time(bi.LastWriteTime.QuadPart); -+ st.st_ctime = filetime_to_unix_time(bi.ChangeTime.QuadPart); -+ -+ FILE_STANDARD_INFO si; -+ if (!GetFileInformationByHandleEx(h, FileStandardInfo, &si, sizeof(si))) { -+ errno = EBADF; -+ return -1; -+ } -+ st.st_nlink = si.NumberOfLinks; -+ -+ // Here we pretend Windows has POSIX permissions by pretending all -+ // directories are 755 and regular files are 644 -+ if (si.Directory) { -+ st.st_mode |= _S_IFDIR | 0755; -+ } else { -+ st.st_mode |= _S_IFREG | 0644; -+ st.st_size = si.EndOfFile.QuadPart; -+ } -+ -+ if (!get_file_ids_win8(h, &st.st_dev, &st.st_ino)) { -+ // Fall back to the Windows 7 method (also used for FAT in Win8) -+ if (!get_file_ids(h, &st.st_dev, &st.st_ino)) { -+ errno = EBADF; -+ return -1; -+ } -+ } -+ -+ *buf = st; -+ return 0; -+} -+ -+int lin_stat(const char *path, struct lin_stat *buf) -+{ -+ wchar_t *wpath = lin_utf8_to_winchar(path); -+ if (!wpath) -+ return -1; -+ HANDLE h = CreateFileW(wpath, FILE_READ_ATTRIBUTES, -+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, -+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | SECURITY_SQOS_PRESENT | -+ SECURITY_IDENTIFICATION, NULL); -+ free(wpath); -+ if (h == INVALID_HANDLE_VALUE) { -+ set_errno_from_lasterror(); -+ return -1; -+ } -+ -+ int ret = hstat(h, buf); -+ CloseHandle(h); -+ return ret; -+} -+ -+int lin_fstat(int fd, struct lin_stat *buf) -+{ -+ HANDLE h = (HANDLE)_get_osfhandle(fd); -+ if (h == INVALID_HANDLE_VALUE) { -+ errno = EBADF; -+ return -1; -+ } -+ // Use our hstat() function rather than MSVCRT's fstat() because ours -+ // supports directories and device/inode numbers. -+ return hstat(h, buf); -+} -+ -+int lin_open(const char *filename, int oflag, ...) -+{ -+ // Always use all share modes, which is useful for opening files that are -+ // open in other processes, and also more POSIX-like -+ static const DWORD share = -+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; -+ // Setting FILE_APPEND_DATA and avoiding GENERIC_WRITE/FILE_WRITE_DATA -+ // will make the file handle use atomic append behavior -+ static const DWORD append = -+ FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA; -+ -+ DWORD access = 0; -+ DWORD disposition = 0; -+ DWORD flags = 0; -+ -+ switch (oflag & (_O_RDONLY | _O_RDWR | _O_WRONLY | _O_APPEND)) { -+ case _O_RDONLY: -+ access = GENERIC_READ; -+ flags |= FILE_FLAG_BACKUP_SEMANTICS; // For opening directories -+ break; -+ case _O_RDWR: -+ access = GENERIC_READ | GENERIC_WRITE; -+ break; -+ case _O_RDWR | _O_APPEND: -+ case _O_RDONLY | _O_APPEND: -+ access = GENERIC_READ | append; -+ break; -+ case _O_WRONLY: -+ access = GENERIC_WRITE; -+ break; -+ case _O_WRONLY | _O_APPEND: -+ access = append; -+ break; -+ default: -+ errno = EINVAL; -+ return -1; -+ } -+ -+ switch (oflag & (_O_CREAT | _O_EXCL | _O_TRUNC)) { -+ case 0: -+ case _O_EXCL: // Like MSVCRT, ignore invalid use of _O_EXCL -+ disposition = OPEN_EXISTING; -+ break; -+ case _O_TRUNC: -+ case _O_TRUNC | _O_EXCL: -+ disposition = TRUNCATE_EXISTING; -+ break; -+ case _O_CREAT: -+ disposition = OPEN_ALWAYS; -+ flags |= FILE_ATTRIBUTE_NORMAL; -+ break; -+ case _O_CREAT | _O_TRUNC: -+ disposition = CREATE_ALWAYS; -+ break; -+ case _O_CREAT | _O_EXCL: -+ case _O_CREAT | _O_EXCL | _O_TRUNC: -+ disposition = CREATE_NEW; -+ flags |= FILE_ATTRIBUTE_NORMAL; -+ break; -+ } -+ -+ // Opening a named pipe as a file can allow the pipe server to impersonate -+ // the calling process, which could be a security issue. Set SQOS flags, so -+ // pipe servers can only identify our process, not impersonate it. -+ if (disposition != CREATE_NEW) -+ flags |= SECURITY_SQOS_PRESENT | SECURITY_IDENTIFICATION; -+ -+ // Keep the same semantics for some MSVCRT-specific flags -+ if (oflag & _O_TEMPORARY) { -+ flags |= FILE_FLAG_DELETE_ON_CLOSE; -+ access |= DELETE; -+ } -+ if (oflag & _O_SHORT_LIVED) -+ flags |= FILE_ATTRIBUTE_TEMPORARY; -+ if (oflag & _O_SEQUENTIAL) { -+ flags |= FILE_FLAG_SEQUENTIAL_SCAN; -+ } else if (oflag & _O_RANDOM) { -+ flags |= FILE_FLAG_RANDOM_ACCESS; -+ } -+ -+ // Open the Windows file handle -+ wchar_t *wpath = lin_utf8_to_winchar(filename); -+ if (!wpath) -+ return -1; -+ HANDLE h = CreateFileW(wpath, access, share, NULL, disposition, flags, NULL); -+ free(wpath); -+ if (h == INVALID_HANDLE_VALUE) { -+ set_errno_from_lasterror(); -+ return -1; -+ } -+ -+ // Map the Windows file handle to a CRT file descriptor. Note: MSVCRT only -+ // cares about the following oflags. -+ oflag &= _O_APPEND | _O_RDONLY | _O_RDWR | _O_WRONLY; -+ oflag |= _O_NOINHERIT; // We never create inheritable handles -+ int fd = _open_osfhandle((intptr_t)h, oflag); -+ if (fd < 0) { -+ CloseHandle(h); -+ return -1; -+ } -+ -+ return fd; -+} -+ -+int lin_creat(const char *filename, int mode) -+{ -+ return lin_open(filename, _O_CREAT | _O_WRONLY | _O_TRUNC, mode); -+} -+ -+FILE *lin_fopen(const char *filename, const char *mode) -+{ -+ if (!mode[0]) { -+ errno = EINVAL; -+ return NULL; -+ } -+ -+ int rwmode; -+ int oflags = 0; -+ switch (mode[0]) { -+ case 'r': -+ rwmode = _O_RDONLY; -+ break; -+ case 'w': -+ rwmode = _O_WRONLY; -+ oflags |= _O_CREAT | _O_TRUNC; -+ break; -+ case 'a': -+ rwmode = _O_WRONLY; -+ oflags |= _O_CREAT | _O_APPEND; -+ break; -+ default: -+ errno = EINVAL; -+ return NULL; -+ } -+ -+ // Parse extra mode flags -+ for (const char *pos = mode + 1; *pos; pos++) { -+ switch (*pos) { -+ case '+': rwmode = _O_RDWR; break; -+ case 'x': oflags |= _O_EXCL; break; -+ // Ignore unknown flags (glibc does too) -+ default: break; -+ } -+ } -+ -+ // Open a CRT file descriptor -+ int fd = lin_open(filename, rwmode | oflags); -+ if (fd < 0) -+ return NULL; -+ -+ // Add 'b' to the mode so the CRT knows the file is opened in binary mode -+ char bmode[] = { mode[0], 'b', rwmode == _O_RDWR ? '+' : '\0', '\0' }; -+ FILE *fp = fdopen(fd, bmode); -+ if (!fp) { -+ close(fd); -+ return NULL; -+ } -+ -+ return fp; -+} -+ -+// Windows' MAX_PATH/PATH_MAX/FILENAME_MAX is fixed to 260, but this limit -+// applies to unicode paths encoded with wchar_t (2 bytes on Windows). The UTF-8 -+// version could end up bigger in memory. In the worst case each wchar_t is -+// encoded to 3 bytes in UTF-8, so in the worst case we have: -+// wcslen(wpath) * 3 <= strlen(utf8path) -+// Thus we need LIN_PATH_MAX as the UTF-8/char version of PATH_MAX. -+// Also make sure there's free space for the terminating \0. -+// (For codepoints encoded as UTF-16 surrogate pairs, UTF-8 has the same length.) -+#define LIN_PATH_MAX (FILENAME_MAX * 3 + 1) -+ -+struct lin_dir { -+ DIR crap; // must be first member, unused, will be set to garbage -+ _WDIR *wdir; -+ union { -+ struct dirent dirent; -+ // dirent has space only for FILENAME_MAX bytes. _wdirent has space for -+ // FILENAME_MAX wchar_t, which might end up bigger as UTF-8 in some -+ // cases. Guarantee we can always hold _wdirent.d_name converted to -+ // UTF-8 (see LIN_PATH_MAX). -+ // This works because dirent.d_name is the last member of dirent. -+ char space[LIN_PATH_MAX]; -+ }; -+}; -+ -+DIR* lin_opendir(const char *path) -+{ -+ wchar_t *wpath = lin_utf8_to_winchar(path); -+ if (!wpath) -+ return NULL; -+ _WDIR *wdir = _wopendir(wpath); -+ free_keep_err(wpath); -+ if (!wdir) -+ return NULL; -+ struct lin_dir *ldir = calloc(1, sizeof(*ldir)); -+ if (!ldir) { -+ _wclosedir(wdir); -+ errno = ENOMEM; -+ return NULL; -+ } -+ // DIR is supposed to be opaque, but unfortunately the MinGW headers still -+ // define it. Make sure nobody tries to use it. -+ memset(&ldir->crap, 0xCD, sizeof(ldir->crap)); -+ ldir->wdir = wdir; -+ return (DIR*)ldir; -+} -+ -+struct dirent* lin_readdir(DIR *dir) -+{ -+ struct lin_dir *ldir = (struct lin_dir*)dir; -+ struct _wdirent *wdirent = _wreaddir(ldir->wdir); -+ if (!wdirent) -+ return NULL; -+ size_t buffersize = sizeof(ldir->space) - offsetof(struct dirent, d_name); -+ if (WideCharToMultiByte(CP_UTF8, 0, wdirent->d_name, -1, ldir->dirent.d_name, -+ buffersize, NULL, NULL) <= 0) -+ { -+ set_errno_from_lasterror(); -+ return NULL; -+ } -+ ldir->dirent.d_ino = 0; -+ ldir->dirent.d_reclen = 0; -+ ldir->dirent.d_namlen = strlen(ldir->dirent.d_name); -+ return &ldir->dirent; -+} -+ -+int lin_closedir(DIR *dir) -+{ -+ struct lin_dir *ldir = (struct lin_dir*)dir; -+ int res = _wclosedir(ldir->wdir); -+ free_keep_err(ldir); -+ return res; -+} -+ -+int lin_mkdir(const char *path, int mode) -+{ -+ wchar_t *wpath = lin_utf8_to_winchar(path); -+ if (!wpath) -+ return -1; -+ int res = _wmkdir(wpath); -+ free(wpath); -+ return res; -+} -+ -+char *lin_getcwd(char *buf, size_t size) -+{ -+ if (size >= SIZE_MAX / 3 - 1) { -+ errno = ENOMEM; -+ return NULL; -+ } -+ size_t wbuffer = size * 3 + 1; -+ wchar_t *wres = malloc(sizeof(wchar_t) * wbuffer); -+ if (!wres) { -+ errno = ENOMEM; -+ return NULL; -+ } -+ DWORD wlen = GetFullPathNameW(L".", wbuffer, wres, NULL); -+ if (wlen >= wbuffer || wlen == 0) { -+ free(wres); -+ errno = wlen ? ERANGE : ENOENT; -+ return NULL; -+ } -+ char *t = lin_winchar_to_utf8(wres); -+ free_keep_err(wres); -+ if (!t) -+ return NULL; -+ size_t st = strlen(t); -+ if (st >= size) { -+ free(t); -+ errno = ERANGE; -+ return NULL; -+ } -+ memcpy(buf, t, st + 1); -+ free(t); -+ return buf; -+} -+ -+off_t lin_lseek(int fd, off_t offset, int whence) -+{ -+ HANDLE h = (HANDLE)_get_osfhandle(fd); -+ if (h != INVALID_HANDLE_VALUE && GetFileType(h) != FILE_TYPE_DISK) { -+ errno = ESPIPE; -+ return (off_t)-1; -+ } -+ return _lseeki64(fd, offset, whence); -+} -+ -+static INIT_ONCE init_getenv_once = INIT_ONCE_STATIC_INIT; -+static char **utf8_environ; -+ -+static void free_env(void) -+{ -+ for (size_t n = 0; utf8_environ && utf8_environ[n]; n++) -+ free(utf8_environ[n]); -+ free(utf8_environ); -+ utf8_environ = NULL; -+} -+ -+// Note: UNIX getenv() returns static strings, and we try to do the same. Since -+// using putenv() is not multithreading safe, we don't expect env vars to change -+// at runtime, and converting/allocating them in advance is ok. -+static void init_getenv(void) -+{ -+ wchar_t *wenv = GetEnvironmentStringsW(); -+ if (!wenv) -+ goto done; -+ -+ wchar_t *wenv_cur = wenv; -+ size_t num_env = 0; -+ while (1) { -+ size_t len = wcslen(wenv_cur); -+ if (!len) -+ break; -+ num_env++; -+ wenv_cur += len + 1; -+ } -+ -+ utf8_environ = calloc(sizeof(utf8_environ[0]), num_env + 1); -+ if (!utf8_environ) -+ goto done; -+ -+ wenv_cur = wenv; -+ size_t cur_env = 0; -+ while (1) { -+ size_t len = wcslen(wenv_cur); -+ if (!len) -+ break; -+ assert(cur_env < num_env); -+ // On OOM, best-effort -+ utf8_environ[cur_env] = lin_winchar_to_utf8(wenv_cur); -+ if (utf8_environ[cur_env]) -+ cur_env++; -+ wenv_cur += len + 1; -+ } -+ -+done: -+ FreeEnvironmentStringsW(wenv); -+ -+ // Avoid showing up in leak detectors etc. -+ atexit(free_env); -+} -+ -+char *lin_getenv(const char *name) -+{ -+ BOOL pending; -+ if (!InitOnceBeginInitialize(&init_getenv_once, 0, &pending, NULL)) -+ return NULL; -+ if (pending) { -+ init_getenv(); -+ InitOnceComplete(&init_getenv_once, 0, NULL); -+ } -+ -+ size_t name_len = strlen(name); -+ for (size_t n = 0; utf8_environ && utf8_environ[n]; n++) { -+ char *env = utf8_environ[n]; -+ if (strncasecmp(env, name, name_len) == 0 && env[name_len] == '=') -+ return env + name_len + 1; -+ } -+ -+ return NULL; -+} -+ -+#endif -diff --git a/src/lj_fs_io.h b/src/lj_fs_io.h -new file mode 100644 -index 0000000..0bdcd20 ---- /dev/null -+++ b/src/lj_fs_io.h -@@ -0,0 +1,60 @@ -+// This file is copyrighted. -+ -+#ifndef _LJ_FS_IO_H -+#define _LJ_FS_IO_H -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifdef __MINGW32__ -+ -+int lin_open(const char *filename, int oflag, ...); -+int lin_creat(const char *filename, int mode); -+FILE *lin_fopen(const char *filename, const char *mode); -+DIR *lin_opendir(const char *path); -+struct dirent *lin_readdir(DIR *dir); -+int lin_closedir(DIR *dir); -+int lin_mkdir(const char *path, int mode); -+char *lin_getcwd(char *buf, size_t size); -+off_t lin_lseek(int fd, off_t offset, int whence); -+ -+// lin_stat types. MSVCRT's dev_t and ino_t are way too short to be unique. -+typedef uint64_t lin_dev_t; -+#ifdef _WIN64 -+typedef unsigned __int128 lin_ino_t; -+#else -+// 32-bit Windows doesn't have a __int128-type, which means ReFS file IDs will -+// be truncated and might collide. This is probably not a problem because ReFS -+// is not available in consumer versions of Windows. -+typedef uint64_t lin_ino_t; -+#endif -+ -+// lin_stat uses a different structure to MSVCRT, with 64-bit inodes -+struct lin_stat { -+ lin_dev_t st_dev; -+ lin_ino_t st_ino; -+ unsigned short st_mode; -+ unsigned int st_nlink; -+ short st_uid; -+ short st_gid; -+ lin_dev_t st_rdev; -+ int64_t st_size; -+ time_t st_atime; -+ time_t st_mtime; -+ time_t st_ctime; -+}; -+ -+int lin_stat(const char *path, struct lin_stat *buf); -+int lin_fstat(int fd, struct lin_stat *buf); -+ -+char *lin_getenv(const char *name); -+ -+#endif /* __MINGW32__ */ -+ -+#endif -diff --git a/src/lj_fs_io_replace.h b/src/lj_fs_io_replace.h -new file mode 100644 -index 0000000..604e279 ---- /dev/null -+++ b/src/lj_fs_io_replace.h -@@ -0,0 +1,50 @@ -+// This file is copyrighted. -+ -+#ifndef _LJ_FS_IO_REPLACE -+#define _LJ_FS_IO_REPLACE -+ -+#include "lj_fs_io.h" -+ -+#ifdef __MINGW32__ -+ -+#define dev_t lin_dev_t -+#define ino_t lin_ino_t -+ -+#define open(...) lin_open(__VA_ARGS__) -+#define creat(...) lin_creat(__VA_ARGS__) -+#define fopen(...) lin_fopen(__VA_ARGS__) -+#define opendir(...) lin_opendir(__VA_ARGS__) -+#define readdir(...) lin_readdir(__VA_ARGS__) -+#define closedir(...) lin_closedir(__VA_ARGS__) -+#define mkdir(...) lin_mkdir(__VA_ARGS__) -+#define getcwd(...) lin_getcwd(__VA_ARGS__) -+#define getenv(...) lin_getenv(__VA_ARGS__) -+ -+#undef lseek -+#define lseek(...) lin_lseek(__VA_ARGS__) -+ -+// Affects both "stat()" and "struct stat". -+#undef stat -+#define stat lin_stat -+ -+#undef fstat -+#define fstat(...) lin_fstat(__VA_ARGS__) -+ -+#define utime(...) _utime(__VA_ARGS__) -+#define utimbuf _utimbuf -+ -+#ifndef O_BINARY -+#define O_BINARY 0 -+#endif -+ -+#ifndef O_CLOEXEC -+#define O_CLOEXEC 0 -+#endif -+ -+#ifndef FD_CLOEXEC -+#define FD_CLOEXEC 0 -+#endif -+ -+#endif /* __MINGW32__ */ -+ -+#endif -diff --git a/src/lj_load.c b/src/lj_load.c -index 0aab488..150be4e 100644 ---- a/src/lj_load.c -+++ b/src/lj_load.c -@@ -22,6 +22,7 @@ - #include "lj_lex.h" - #include "lj_bcdump.h" - #include "lj_parse.h" -+#include "lj_fs_io_replace.h" - - /* -- Load Lua source code and bytecode ----------------------------------- */ - -diff --git a/src/lj_trace.c b/src/lj_trace.c -index f816337..f15c4c7 100644 ---- a/src/lj_trace.c -+++ b/src/lj_trace.c -@@ -31,6 +31,7 @@ - #include "lj_vmevent.h" - #include "lj_target.h" - #include "lj_prng.h" -+#include "lj_fs_io_replace.h" - - /* -- Error handling ------------------------------------------------------ */ - -diff --git a/src/ljamalg.c b/src/ljamalg.c -index 4d85950..68fb34b 100644 ---- a/src/ljamalg.c -+++ b/src/ljamalg.c -@@ -18,6 +18,7 @@ - #include "lua.h" - #include "lauxlib.h" - -+#include "lj_fs_io.c" - #include "lj_assert.c" - #include "lj_gc.c" - #include "lj_err.c" --- -2.41.0 - diff --git a/packages/luajit.cmake b/packages/luajit.cmake index 4499eb6a9..04d1ea054 100644 --- a/packages/luajit.cmake +++ b/packages/luajit.cmake @@ -1,58 +1,34 @@ -if(CYGWIN OR MSYS) - # It's much easier to just use the target CC on Cygwin than to worry about - # pointer size mismatches - set(LUAJIT_HOST_GCC ${TARGET_ARCH}-gcc) -else() - set(LUAJIT_HOST_GCC gcc) -endif() - -if(${TARGET_CPU} MATCHES "i686") - set(LUAJIT_GCC_ARGS "-m32") - set(DISABLE_JIT "-DLUAJIT_DISABLE_JIT") -else() - set(LUAJIT_GCC_ARGS "-m64") -endif() - -set(EXPORT - "CROSS=${TARGET_ARCH}- - TARGET_SYS=Windows - BUILDMODE=static - FILE_T=luajit.exe - CFLAGS='-DUNICODE' - XCFLAGS='-DLUAJIT_ENABLE_LUA52COMPAT ${DISABLE_JIT}' - PREFIX=${MINGW_INSTALL_PREFIX} Q=" -) - -# luajit ships with a broken pkg-config file configure_file(${CMAKE_CURRENT_SOURCE_DIR}/luajit.pc.in ${CMAKE_CURRENT_BINARY_DIR}/luajit.pc @ONLY) - ExternalProject_Add(luajit DEPENDS libiconv - GIT_REPOSITORY https://github.com/openresty/luajit2.git + GIT_REPOSITORY https://github.com/Wohlsoft/LuaJIT.git SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--filter=tree:0" GIT_REMOTE_NAME origin - GIT_TAG v2.1-agentzh - PATCH_COMMAND ${EXEC} git am --3way ${CMAKE_CURRENT_SOURCE_DIR}/luajit-*.patch + GIT_TAG v2.1 UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND ${MAKE} -C /src - "HOST_CC='${LUAJIT_HOST_GCC} ${LUAJIT_GCC_ARGS}'" - ${EXPORT} - amalg - INSTALL_COMMAND ${MAKE} - "HOST_CC='${LUAJIT_HOST_GCC} ${LUAJIT_GCC_ARGS}'" - ${EXPORT} - install - BUILD_IN_SOURCE 1 + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B + -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} + -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} + -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_CROSSCOMPILING=ON + -DCMAKE_UNITY_BUILD=ON + -DUNITY_BUILD_BATCH_SIZE=0 + -DCMAKE_UNITY_BUILD_BATCH_SIZE=0 + -DLUAJIT_BUILD_TOOL=OFF + -DLJ_ENABLE_LARGEFILE=ON + -DCMAKE_SYSTEM_VERSION=10 + -DLUAJIT_FORCE_UTF8_FOPEN=ON + -DCMAKE_C_FLAGS='-DLUAJIT_ENABLE_LUA52COMPAT' + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + COMMAND bash -c "cp ${CMAKE_CURRENT_BINARY_DIR}/luajit.pc ${MINGW_INSTALL_PREFIX}/lib/pkgconfig/luajit.pc" LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) -ExternalProject_Add_Step(luajit install-pc - DEPENDEES install - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/luajit.pc ${MINGW_INSTALL_PREFIX}/lib/pkgconfig/luajit.pc -) - force_rebuild_git(luajit) -cleanup(luajit install-pc) +cleanup(luajit install) diff --git a/packages/luajit.pc.in b/packages/luajit.pc.in index 506e1501d..9dd45d587 100644 --- a/packages/luajit.pc.in +++ b/packages/luajit.pc.in @@ -9,11 +9,11 @@ prefix=@MINGW_INSTALL_PREFIX@ multilib=lib exec_prefix=${prefix} libdir=${exec_prefix}/${multilib} -libname=luajit-${abiver} -includedir=${prefix}/include/luajit-${majver}.${minver} +libname=luajit +includedir=${prefix}/include/luajit -INSTALL_LMOD=${prefix}/share/lua/${abiver} -INSTALL_CMOD=${prefix}/${multilib}/lua/${abiver} +INSTALL_LMOD=${prefix}/share/lua +INSTALL_CMOD=${prefix}/${multilib}/lua Name: LuaJIT Description: Just-in-time compiler for Lua diff --git a/packages/mbedtls-0001-include-cpuid.patch b/packages/mbedtls-0001-include-cpuid.patch deleted file mode 100644 index 60ce5ab3d..000000000 --- a/packages/mbedtls-0001-include-cpuid.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 7e76bfbcead3e11ddcc8f597719ed52f663cad12 Mon Sep 17 00:00:00 2001 -From: shinchiro -Date: Sun, 8 Oct 2023 01:34:27 +0800 -Subject: [PATCH] include cpuid.h only - -Ref: https://github.com/Mbed-TLS/mbedtls/commit/d671917 ---- - library/aesni.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/library/aesni.c b/library/aesni.c -index 5f25a824..711112ba 100644 ---- a/library/aesni.c -+++ b/library/aesni.c -@@ -33,11 +33,7 @@ - #if defined(MBEDTLS_AESNI_HAVE_CODE) - - #if MBEDTLS_AESNI_HAVE_CODE == 2 --#if !defined(_WIN32) - #include --#else --#include --#endif - #include - #endif - --- -2.42.0 - diff --git a/packages/mbedtls.cmake b/packages/mbedtls.cmake deleted file mode 100644 index 67b74d994..000000000 --- a/packages/mbedtls.cmake +++ /dev/null @@ -1,46 +0,0 @@ -ExternalProject_Add(mbedtls - GIT_REPOSITORY https://github.com/Mbed-TLS/mbedtls.git - SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" - PATCH_COMMAND ${EXEC} git am --3way ${CMAKE_CURRENT_SOURCE_DIR}/mbedtls-*.patch - UPDATE_COMMAND "" - GIT_REMOTE_NAME origin - GIT_TAG master - GIT_RESET 1ec69067fa1351427f904362c1221b31538c8b57 # v3.5.0 - CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B - -G Ninja - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} - -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} - -DBUILD_SHARED_LIBS=OFF - -DENABLE_PROGRAMS=OFF - -DENABLE_TESTING=OFF - -DGEN_FILES=ON - -DUSE_STATIC_MBEDTLS_LIBRARY=ON - -DUSE_SHARED_MBEDTLS_LIBRARY=OFF - -DINSTALL_MBEDTLS_HEADERS=ON - -DMBEDTLS_FATAL_WARNINGS=OFF - -DCMAKE_C_FLAGS='${CMAKE_C_FLAGS} -mpclmul -msse2 -maes' # needed for i686's target - BUILD_COMMAND ${EXEC} ninja -C - INSTALL_COMMAND ${EXEC} ninja -C install - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -force_rebuild_git(mbedtls) -cleanup(mbedtls install) - -set(mbedtls_pc ${MINGW_INSTALL_PREFIX}/lib/pkgconfig/mbedtls.pc) -file(WRITE ${mbedtls_pc} -"prefix=${MINGW_INSTALL_PREFIX} -exec_prefix=\${prefix} -libdir=\${exec_prefix}/lib -includedir=\${prefix}/include - -Name: mbedtls -Description: mbedtls -Version: 3.5.0 -Libs: -L\${libdir} -lmbedtls -lmbedx509 -lmbedcrypto -Libs.private: -lbcrypt -lws2_32 -Cflags: -I\${includedir} -") diff --git a/packages/megasdk-0001-megacli-remove-warn-never-print-file-attributes.patch b/packages/megasdk-0001-megacli-remove-warn-never-print-file-attributes.patch deleted file mode 100644 index 5f923ae4f..000000000 --- a/packages/megasdk-0001-megacli-remove-warn-never-print-file-attributes.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 45e6d25b66c94b594069d2fcab7dbb3b8da3fde1 Mon Sep 17 00:00:00 2001 -From: shinchiro -Date: Sun, 11 Oct 2020 19:30:12 +0800 -Subject: [PATCH] megacli: remove warn & never print file attributes - ---- - examples/megacli.cpp | 6 ------ - src/http.cpp | 1 - - src/win32/fs.cpp | 2 +- - 3 files changed, 1 insertion(+), 8 deletions(-) - -diff --git a/examples/megacli.cpp b/examples/megacli.cpp -index 419bbb5a0..a79efffe7 100644 ---- a/examples/megacli.cpp -+++ b/examples/megacli.cpp -@@ -1872,12 +1872,6 @@ static void dumptree(Node* n, bool recurse, int depth, const char* title, ofstre - stream << " " << handlestr.chars; - } - -- const char* p; -- if ((p = strchr(n->fileattrstring.c_str(), ':'))) -- { -- stream << ", has attributes " << p + 1; -- } -- - if (n->plink) - { - stream << ", shared as exported"; -diff --git a/src/http.cpp b/src/http.cpp -index 1c7d61567..391849218 100644 ---- a/src/http.cpp -+++ b/src/http.cpp -@@ -388,7 +388,6 @@ void HttpReq::post(MegaClient* client, const char* data, unsigned len) - { - if (httpio) - { -- LOG_warn << "Ensuring that the request is finished before sending it again"; - httpio->cancel(this); - init(); - } -diff --git a/src/win32/fs.cpp b/src/win32/fs.cpp -index 590fb005c..d6abdcfd3 100644 ---- a/src/win32/fs.cpp -+++ b/src/win32/fs.cpp -@@ -24,7 +24,7 @@ - - #if defined(_WIN32) || defined(WINDOWS_PHONE) - #include --#include -+#include - #endif - - namespace mega { --- -2.27.0 - diff --git a/packages/megasdk-0002-fix-compile.patch b/packages/megasdk-0002-fix-compile.patch deleted file mode 100644 index f60edca02..000000000 --- a/packages/megasdk-0002-fix-compile.patch +++ /dev/null @@ -1,97 +0,0 @@ -From ae703a0142d4091b17f5880eb4e18a22b064f135 Mon Sep 17 00:00:00 2001 -From: shinchiro -Date: Thu, 10 Dec 2020 23:16:11 +0800 -Subject: [PATCH] fix compile for v3.7.8 - ---- - src/filesystem.cpp | 2 +- - src/win32/fs.cpp | 16 ++++++++-------- - 2 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/src/filesystem.cpp b/src/filesystem.cpp -index 067846dc6..028096ff2 100644 ---- a/src/filesystem.cpp -+++ b/src/filesystem.cpp -@@ -914,7 +914,7 @@ LocalPath LocalPath::fromPlatformEncoded(string path) - assert(!(path.size() % 2)); - LocalPath p; - p.localpath.resize(path.size() / sizeof(wchar_t)); -- memcpy(p.localpath.data(), path.data(), p.localpath.size() * sizeof(wchar_t)); -+ memcpy(const_cast(p.localpath.data()), path.data(), p.localpath.size() * sizeof(wchar_t)); - return p; - #else - LocalPath p; -diff --git a/src/win32/fs.cpp b/src/win32/fs.cpp -index 5b57036f2..112091f84 100644 ---- a/src/win32/fs.cpp -+++ b/src/win32/fs.cpp -@@ -725,7 +725,7 @@ void WinFileSystemAccess::path2local(const string* path, std::wstring* local) co - int len = MultiByteToWideChar(CP_UTF8, 0, - path->c_str(), - -1, -- local->data(), -+ (LPWSTR)local->data(), - int(local->size())); - if (len) - { -@@ -776,13 +776,13 @@ bool WinFileSystemAccess::getsname(const LocalPath& namePath, LocalPath& snamePa - DWORD r = DWORD(name.size()); - sname.resize(r); - -- DWORD rr = GetShortPathNameW(name.data(), sname.data(), r); -+ DWORD rr = GetShortPathNameW(name.data(), (LPWSTR)sname.data(), r); - - sname.resize(rr); - - if (rr >= r) - { -- rr = GetShortPathNameW(name.data(), sname.data(), rr); -+ rr = GetShortPathNameW(name.data(), (LPWSTR)sname.data(), rr); - sname.resize(rr); - } - -@@ -1121,7 +1121,7 @@ bool WinFileSystemAccess::expanselocalpath(LocalPath& pathArg, LocalPath& absolu - } - - absolutepathArg.localpath.resize(len); -- int newlen = GetFullPathNameW(pathArg.localpath.data(), len, absolutepathArg.localpath.data(), NULL); -+ int newlen = GetFullPathNameW(pathArg.localpath.data(), len, (LPWSTR)absolutepathArg.localpath.data(), NULL); - if (newlen <= 0 || newlen >= len) - { - absolutepathArg.localpath = pathArg.localpath; -@@ -1505,12 +1505,12 @@ WinDirNotify::WinDirNotify(LocalPath& localbasepath, const LocalPath& ignore, Wi - std::wstring longname; - auto r = localbasepath.localpath.size() + 20; - longname.resize(r); -- auto rr = GetLongPathNameW(localbasepath.localpath.data(), longname.data(), DWORD(r)); -+ auto rr = GetLongPathNameW(localbasepath.localpath.data(), (LPWSTR)longname.data(), DWORD(r)); - - longname.resize(rr); - if (rr >= r) - { -- rr = GetLongPathNameW(localbasepath.localpath.data(), longname.data(), rr); -+ rr = GetLongPathNameW(localbasepath.localpath.data(), (LPWSTR)longname.data(), rr); - longname.resize(rr); - } - -@@ -1594,7 +1594,7 @@ bool WinFileSystemAccess::getlocalfstype(const LocalPath& path, FileSystemType& - wstring mountPoint(MAX_PATH + 1, L'\0'); - - if (!GetVolumePathNameW(path.localpath.c_str(), -- mountPoint.data(), -+ (LPWSTR)mountPoint.data(), - MAX_PATH + 1)) - { - return type = FS_UNKNOWN, false; -@@ -1657,7 +1657,7 @@ bool WinFileSystemAccess::issyncsupported(LocalPath& localpathArg, bool *isnetwo - path.resize(MAX_PATH * sizeof(WCHAR)); - fsname.resize(MAX_PATH * sizeof(WCHAR)); - -- if (GetVolumePathNameW(localpathArg.localpath.data(), path.data(), MAX_PATH) -+ if (GetVolumePathNameW(localpathArg.localpath.data(), (LPWSTR)path.data(), MAX_PATH) - && GetVolumeInformationW((LPCWSTR)path.data(), NULL, 0, NULL, NULL, NULL, (LPWSTR)fsname.data(), MAX_PATH)) - { - if (!memcmp(fsname.data(), VBoxSharedFolderFS, sizeof(VBoxSharedFolderFS))) --- -2.27.0 - diff --git a/packages/megasdk.cmake b/packages/megasdk.cmake deleted file mode 100644 index 7baabe0f8..000000000 --- a/packages/megasdk.cmake +++ /dev/null @@ -1,37 +0,0 @@ -ExternalProject_Add(megasdk - DEPENDS - zlib - cryptopp - sqlite - termcap - readline - libuv - libsodium - GIT_REPOSITORY https://github.com/meganz/sdk.git - SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" - UPDATE_COMMAND "" - PATCH_COMMAND ${EXEC} git am --3way ${CMAKE_CURRENT_SOURCE_DIR}/megasdk-*.patch - CONFIGURE_COMMAND ${EXEC} /autogen.sh && CONF=1 /configure - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --enable-static - --disable-shared - --disable-silent-rules - --without-openssl - --without-cares - --without-curl - --without-freeimage - --with-winhttp=${MINGW_INSTALL_PREFIX} - --with-termcap=${MINGW_INSTALL_PREFIX} - --with-readline=${MINGW_INSTALL_PREFIX} - --with-libuv=${MINGW_INSTALL_PREFIX} - --with-sodium=${MINGW_INSTALL_PREFIX} - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install-strip - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -force_rebuild_git(megasdk) -cleanup(megasdk install) diff --git a/packages/mesa.cmake b/packages/mesa.cmake index 5a026655c..5c95f247f 100644 --- a/packages/mesa.cmake +++ b/packages/mesa.cmake @@ -1,8 +1,14 @@ ExternalProject_Add(mesa + DEPENDS + directx-header + libva + zlib + zstd GIT_REPOSITORY https://gitlab.freedesktop.org/mesa/mesa.git SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--filter=tree:0" GIT_TAG main + GIT_REMOTE_NAME origin UPDATE_COMMAND "" CONFIGURE_COMMAND ${EXEC} CONF=1 meson setup --prefix=${MINGW_INSTALL_PREFIX} @@ -14,28 +20,32 @@ ExternalProject_Add(mesa "-Dcpp_args='-D__REQUIRED_RPCNDR_H_VERSION__=475'" -Db_lto=true ${mpv_lto_mode} - -Dshared-glapi=disabled + -Dbuild-tests=false + -Dcpp_rtti=false -Degl=disabled + -Denable-glcpp-tests=false + -Dgallium-d3d12-video=true + -Dgallium-drivers=d3d12 + -Dgallium-opencl=disabled + -Dgallium-va=enabled + -Dgallium-xa=disabled -Dgles1=disabled -Dgles2=disabled - -Dgallium-opencl=disabled - -Dmicrosoft-clc=disabled + -Dlibunwind=disabled -Dllvm=disabled - -Dgallium-xa=disabled - -Denable-glcpp-tests=false + -Dmicrosoft-clc=disabled + -Dmin-windows-version=11 -Dopengl=false -Dosmesa=false - -Dbuild-tests=false - -Dcpp_rtti=false - -Dgallium-drivers=d3d12 - -Dgallium-va=enabled - -Dgallium-d3d12-video=true - -Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec,av1dec,av1enc,vp9dec - -Dmin-windows-version=10 - -Dvulkan-drivers= + -Dshared-glapi=disabled + -Dspirv-to-dxil=false -Dtools= - BUILD_COMMAND ${EXEC} ninja -C - INSTALL_COMMAND ${EXEC} ninja -C install + -Dvideo-codecs=all + -Dvulkan-drivers=microsoft-experimental + -Dzlib=enabled + -Dzstd=enabled + BUILD_COMMAND ${EXEC} WPD=0 ninja -C + INSTALL_COMMAND ${EXEC} WPD=0 ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) diff --git a/packages/meson_template.cmake b/packages/meson_template.cmake new file mode 100644 index 000000000..d2a4c747c --- /dev/null +++ b/packages/meson_template.cmake @@ -0,0 +1,25 @@ +ExternalProject_Add(name + DEPENDS + name + GIT_REPOSITORY url + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + GIT_REMOTE_NAME origin + GIT_TAG branch/tag/sha + GIT_RESET sha + UPDATE_COMMAND "" + PATCH_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 meson + --prefix=${MINGW_INSTALL_PREFIX} + --libdir=${MINGW_INSTALL_PREFIX}/lib + --cross-file=${MESON_CROSS} + --buildtype=release + --default-library=static + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(name) +force_meson_configure(name) +cleanup(name install) diff --git a/packages/mpv-debug-plugin.cmake b/packages/mpv-debug-plugin.cmake new file mode 100644 index 000000000..c0db91720 --- /dev/null +++ b/packages/mpv-debug-plugin.cmake @@ -0,0 +1,23 @@ +ExternalProject_Add(mpv-debug-plugin + DEPENDS + mpv + GIT_REPOSITORY https://github.com/Andarwinux/mpv-debug-plugin.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + GIT_TAG main + GIT_REMOTE_NAME origin + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B + -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} + -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} + -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} + -DBUILD_SHARED_LIBS=OFF + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND bash -c "cp /debug.dll ${MINGW_INSTALL_PREFIX}/bin" + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(mpv-debug-plugin) +cleanup(mpv-debug-plugin install) diff --git a/packages/mpv-menu-plugin.cmake b/packages/mpv-menu-plugin.cmake new file mode 100644 index 000000000..e57a41305 --- /dev/null +++ b/packages/mpv-menu-plugin.cmake @@ -0,0 +1,23 @@ +ExternalProject_Add(mpv-menu-plugin + DEPENDS + mpv + GIT_REPOSITORY https://github.com/tsl0922/mpv-menu-plugin.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + GIT_TAG main + GIT_REMOTE_NAME origin + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B + -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} + -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} + -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} + -DBUILD_SHARED_LIBS=OFF + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND bash -c "cp /menu.dll ${MINGW_INSTALL_PREFIX}/bin" + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(mpv-menu-plugin) +cleanup(mpv-menu-plugin install) diff --git a/packages/mpv.cmake b/packages/mpv.cmake index 3cf19ce0c..5ecaf1605 100644 --- a/packages/mpv.cmake +++ b/packages/mpv.cmake @@ -1,6 +1,7 @@ ExternalProject_Add(mpv DEPENDS angle-headers + ${nvcodec-headers} ffmpeg fribidi lcms2 @@ -20,7 +21,7 @@ ExternalProject_Add(mpv shaderc libplacebo spirv-cross - vapoursynth + ${vapoursynth} libsdl2 GIT_REPOSITORY https://github.com/mpv-player/mpv.git SOURCE_DIR ${SOURCE_LOCATION} @@ -51,10 +52,10 @@ ExternalProject_Add(mpv -Dopenal=enabled -Dspirv-cross=enabled -Dvulkan=enabled - -Dvapoursynth=enabled - -Degl-angle=enabled + ${mpv_vapoursynth} + ${mpv_gl} BUILD_COMMAND ${EXEC} LTO_JOB=1 PDB=1 ninja -C - INSTALL_COMMAND "" + INSTALL_COMMAND ${EXEC} ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) diff --git a/packages/nettle-0001-skip-compiling-testsuite-and-examples.patch b/packages/nettle-0001-skip-compiling-testsuite-and-examples.patch deleted file mode 100644 index c0278a55a..000000000 --- a/packages/nettle-0001-skip-compiling-testsuite-and-examples.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 643583ce3f9fd0f1456ac9d63d3610e4035d714e Mon Sep 17 00:00:00 2001 -From: shinchiro -Date: Sun, 2 Aug 2020 07:57:24 +0800 -Subject: [PATCH] skip compiling testsuite and examples - ---- - Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.in b/Makefile.in -index c73a9e0..73a804d 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -19,7 +19,7 @@ OPT_NETTLE_SOURCES = @OPT_NETTLE_SOURCES@ - - FAT_TEST_LIST = @FAT_TEST_LIST@ - --SUBDIRS = tools testsuite examples -+SUBDIRS = tools - - include config.make - --- -2.27.0 - diff --git a/packages/opencl-header.cmake b/packages/opencl-header.cmake new file mode 100644 index 000000000..74af042c4 --- /dev/null +++ b/packages/opencl-header.cmake @@ -0,0 +1,18 @@ +ExternalProject_Add(opencl-header + GIT_REPOSITORY https://github.com/KhronosGroup/OpenCL-Headers.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + UPDATE_COMMAND "" + GIT_REMOTE_NAME origin + GIT_TAG main + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B + -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} + BUILD_COMMAND "" + INSTALL_COMMAND ${EXEC} ninja -C install + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_INSTALL 1 +) +force_rebuild_git(opencl-header) +cleanup(opencl-header install) + diff --git a/packages/opencl.cmake b/packages/opencl.cmake new file mode 100644 index 000000000..7c9d477f0 --- /dev/null +++ b/packages/opencl.cmake @@ -0,0 +1,27 @@ +ExternalProject_Add(opencl + DEPENDS opencl-header + GIT_REPOSITORY https://github.com/KhronosGroup/OpenCL-ICD-Loader.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + UPDATE_COMMAND "" + GIT_REMOTE_NAME origin + GIT_TAG main + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -E copy ${CMAKE_CURRENT_SOURCE_DIR}/OpenCL.pc.in /OpenCL.pc.in && cmake -H -B + -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} + -DOPENCL_ICD_LOADER_HEADERS_DIR=${MINGW_INSTALL_PREFIX}/include + -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} + -DENABLE_WERROR=OFF + -DOPENCL_ICD_LOADER_BUILD_SHARED_LIBS=OFF + -DOPENCL_ICD_LOADER_DISABLE_OPENCLON12=ON + -DOPENCL_ICD_LOADER_PIC=ON + -DOPENCL_ICD_LOADER_BUILD_TESTING=OFF + -DENABLE_OPENCL_LAYERINFO=OFF + -DBUILD_TESTING=OFF + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) +force_rebuild_git(opencl) +cleanup(opencl install) diff --git a/packages/openssl.cmake b/packages/openssl.cmake index 2151780ce..05757e964 100644 --- a/packages/openssl.cmake +++ b/packages/openssl.cmake @@ -1,9 +1,3 @@ -if(${TARGET_CPU} MATCHES "i686") - set(mingw "mingw") -else() - set(mingw "mingw64") - set(ec "enable-ec_nistp_64_gcc_128") -endif() ExternalProject_Add(openssl DEPENDS zlib @@ -11,15 +5,19 @@ ExternalProject_Add(openssl brotli GIT_REPOSITORY https://github.com/openssl/openssl.git SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" + GIT_CLONE_FLAGS "--sparse --filter=tree:0" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !test" GIT_SUBMODULES "" UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} CONF=1 /Configure + CONFIGURE_COMMAND ${EXEC} cp ${CMAKE_CURRENT_SOURCE_DIR}/11-mingw-arm64.conf /Configurations/ && CONF=1 /Configure --cross-compile-prefix=${TARGET_ARCH}- --prefix=${MINGW_INSTALL_PREFIX} --libdir=lib --release no-autoload-config + ${openssl_target} + ${openssl_ec_opt} + ${openssl_tools} no-ssl3-method enable-brotli no-whirlpool @@ -32,10 +30,8 @@ ExternalProject_Add(openssl no-module no-legacy no-tests - ${mingw} threads no-docs - no-apps no-ocsp no-ssl3 no-cmac @@ -60,7 +56,6 @@ ExternalProject_Add(openssl no-dh no-bf zlib - ${ec} BUILD_COMMAND ${MAKE} build_sw INSTALL_COMMAND ${MAKE} install_sw LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 diff --git a/packages/opus-tools.cmake b/packages/opus-tools.cmake deleted file mode 100644 index 8331de92b..000000000 --- a/packages/opus-tools.cmake +++ /dev/null @@ -1,26 +0,0 @@ -ExternalProject_Add(opus-tools - DEPENDS - ogg - opus - flac - opusfile - libopusenc - GIT_REPOSITORY https://github.com/xiph/opus-tools.git - SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} /autogen.sh && CONF=1 /configure - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --disable-stack-protector - CFLAGS='-D_FORTIFY_SOURCE=0' - LDFLAGS='-static' - FLAC_CFLAGS='-DFLAC__NO_DLL' - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install-strip - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -force_rebuild_git(opus-tools) -cleanup(opus-tools install) diff --git a/packages/opus.cmake b/packages/opus.cmake index e05916921..184674af1 100644 --- a/packages/opus.cmake +++ b/packages/opus.cmake @@ -17,6 +17,9 @@ ExternalProject_Add(opus --buildtype=release --default-library=static -Dhardening=false + -Ddeep-plc=enabled + -Ddred=enabled + -Dosce=enabled -Dextra-programs=disabled -Dtests=disabled -Ddocs=disabled diff --git a/packages/opusfile.cmake b/packages/opusfile.cmake deleted file mode 100644 index e426b8f4b..000000000 --- a/packages/opusfile.cmake +++ /dev/null @@ -1,22 +0,0 @@ -ExternalProject_Add(opusfile - DEPENDS - opus - GIT_REPOSITORY https://github.com/xiph/opusfile.git - SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} /autogen.sh && CONF=1 /configure - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --disable-shared - --disable-doc - --disable-examples - --disable-http - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -force_rebuild_git(opusfile) -cleanup(opusfile install) diff --git a/packages/rav1e.cmake b/packages/rav1e.cmake index 118e65a95..b51ec4620 100644 --- a/packages/rav1e.cmake +++ b/packages/rav1e.cmake @@ -7,7 +7,6 @@ ExternalProject_Add(rav1e CONFIGURE_COMMAND "" BUILD_COMMAND ${EXEC} CARGO_BUILD_TARGET_DIR= - CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 CARGO_PROFILE_RELEASE_DEBUG=false CARGO_PROFILE_RELEASE_INCREMENTAL=false CARGO_PROFILE_RELEASE_LTO=off @@ -15,9 +14,9 @@ ExternalProject_Add(rav1e cargo cinstall --manifest-path /Cargo.toml --prefix ${MINGW_INSTALL_PREFIX} - --target ${TARGET_CPU}-pc-windows-gnu + --target ${TARGET_CPU}-pc-windows-${rust_target} + -Z build-std=std,panic_abort,core,alloc --release - --crt-static --library-type staticlib INSTALL_COMMAND "" LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 diff --git a/packages/readline.cmake b/packages/readline.cmake deleted file mode 100644 index 113c47c37..000000000 --- a/packages/readline.cmake +++ /dev/null @@ -1,20 +0,0 @@ -ExternalProject_Add(readline - DEPENDS - termcap - GIT_REPOSITORY https://git.sailfishos.org/mirror/readline.git - SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} CONF=1 /configure - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - --enable-static - --disable-shared - --without-curses - CFLAGS='-DNEED_EXTERN_PC -DS_IFLNK=0120000' - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -cleanup(readline install) diff --git a/packages/speex.cmake b/packages/speex.cmake index 9498c81b6..556ef9a61 100644 --- a/packages/speex.cmake +++ b/packages/speex.cmake @@ -1,6 +1,6 @@ ExternalProject_Add(speex DEPENDS - ogg + ogg GIT_REPOSITORY https://github.com/xiph/speex.git SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--filter=tree:0" diff --git a/packages/sqlite.cmake b/packages/sqlite.cmake index 53441fa3b..d15bcc775 100644 --- a/packages/sqlite.cmake +++ b/packages/sqlite.cmake @@ -1,6 +1,6 @@ ExternalProject_Add(sqlite - URL https://www.sqlite.org/2020/sqlite-autoconf-3330000.tar.gz - URL_HASH SHA3_256=6e94e9453cedf8f2023e3923f856741d1e28a2271e9f93d24d95fa48870edaad + URL https://www.sqlite.org/2023/sqlite-autoconf-3440000.tar.gz + URL_HASH SHA3_256=6869046465eae886f1a9f2c8debeeba44d34328693aa77a5bd4a3cfed93d6556 DOWNLOAD_DIR ${SOURCE_LOCATION} CONFIGURE_COMMAND ${EXEC} autoreconf -fi && CONF=1 /configure --host=${TARGET_ARCH} diff --git a/packages/svtav1.cmake b/packages/svtav1.cmake new file mode 100644 index 000000000..c51ea4006 --- /dev/null +++ b/packages/svtav1.cmake @@ -0,0 +1,26 @@ +ExternalProject_Add(svtav1 + GIT_REPOSITORY https://gitlab.com/AOMediaCodec/SVT-AV1.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B + -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} + -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} + -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} + -DBUILD_SHARED_LIBS=OFF + -DENABLE_NASM=ON + -DENABLE_AVX512=ON + -DBUILD_DEC=OFF + -DBUILD_TESTING=OFF + -DBUILD_ENC=ON + -DSVT_AV1_LTO=OFF + -DBUILD_APPS=OFF + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(svtav1) +cleanup(svtav1 install) diff --git a/packages/termcap.cmake b/packages/termcap.cmake deleted file mode 100644 index 4dfa794d4..000000000 --- a/packages/termcap.cmake +++ /dev/null @@ -1,20 +0,0 @@ -ExternalProject_Add(termcap - URL https://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz - URL_HASH SHA256=91a0e22e5387ca4467b5bcb18edf1c51b930262fd466d5fda396dd9d26719100 - DOWNLOAD_DIR ${SOURCE_LOCATION} - CONFIGURE_COMMAND ${EXEC} CONF=1 /configure - --prefix=${MINGW_INSTALL_PREFIX} - --enable-static - --disable-shared - BUILD_COMMAND ${MAKE} - CXX=${TARGET_ARCH}-g++ - CC=${TARGET_ARCH}-gcc - AR=${TARGET_ARCH}-ar - RANLIB=${TARGET_ARCH}-ranlib - INSTALL_COMMAND ${MAKE} - RANLIB=${TARGET_ARCH}-ranlib - install - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -cleanup(termcap install) diff --git a/packages/vkoverhead.cmake b/packages/vkoverhead.cmake new file mode 100644 index 000000000..17ffb8569 --- /dev/null +++ b/packages/vkoverhead.cmake @@ -0,0 +1,22 @@ +ExternalProject_Add(vkoverhead + GIT_REPOSITORY https://github.com/zmike/vkoverhead.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + GIT_TAG main + GIT_REMOTE_NAME origin + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 meson setup + --prefix=${MINGW_INSTALL_PREFIX} + --libdir=${MINGW_INSTALL_PREFIX}/lib + --cross-file=${MESON_CROSS} + --default-library=static + --buildtype=release + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + COMMAND bash -c "cp /vkoverhead.exe ${MINGW_INSTALL_PREFIX}/bin" + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(vkoverhead) +force_meson_configure(vkoverhead) +cleanup(vkoverhead install) diff --git a/packages/vmaf.cmake b/packages/vmaf.cmake new file mode 100644 index 000000000..4a904adb3 --- /dev/null +++ b/packages/vmaf.cmake @@ -0,0 +1,24 @@ +ExternalProject_Add(vmaf + GIT_REPOSITORY https://github.com/Netflix/vmaf.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 meson setup /libvmaf + --prefix=${MINGW_INSTALL_PREFIX} + --libdir=${MINGW_INSTALL_PREFIX}/lib + --cross-file=${MESON_CROSS} + --buildtype=release + --default-library=static + -Dbuilt_in_models=true + -Denable_tests=false + -Denable_docs=false + -Denable_avx512=true + -Denable_float=true + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(vmaf) +force_meson_configure(vmaf) +cleanup(vmaf install) diff --git a/packages/x264.cmake b/packages/x264.cmake deleted file mode 100644 index 88043d28f..000000000 --- a/packages/x264.cmake +++ /dev/null @@ -1,24 +0,0 @@ -ExternalProject_Add(x264 - GIT_REPOSITORY https://code.videolan.org/videolan/x264.git - SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} CONF=1 /configure - --host=${TARGET_ARCH} - --cross-prefix=${TARGET_ARCH}- - --prefix=${MINGW_INSTALL_PREFIX} - --enable-static - --disable-cli - --disable-swscale - --disable-lavf - --disable-ffms - --disable-gpac - --disable-lsmash - ${x264_lto} - BUILD_COMMAND ${MAKE} - INSTALL_COMMAND ${MAKE} install - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -force_rebuild_git(x264) -cleanup(x264 install) diff --git a/packages/x265.cmake b/packages/x265.cmake index 52be5142e..58fea84a9 100644 --- a/packages/x265.cmake +++ b/packages/x265.cmake @@ -1,184 +1,26 @@ -if(${TARGET_CPU} MATCHES "x86_64") - set(high_bit_depth "-DHIGH_BIT_DEPTH=ON -DENABLE_HDR10_PLUS=ON") - # 10bit/12bit only supported in x64. - set(ffmpeg_x265 "x265-8+10bit") -else() - set(high_bit_depth "-DHIGH_BIT_DEPTH=OFF") - set(ffmpeg_x265 "x265-10bit") -endif() - ExternalProject_Add(x265 GIT_REPOSITORY https://github.com/shinchiro/x265.git SOURCE_DIR ${SOURCE_LOCATION} GIT_CLONE_FLAGS "--filter=tree:0" UPDATE_COMMAND "" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - LOG_DOWNLOAD 1 LOG_UPDATE 1 -) - -get_property(source_dir TARGET x265 PROPERTY _EP_SOURCE_DIR) -get_property(binary_dir TARGET x265 PROPERTY _EP_BINARY_DIR) - -ExternalProject_Add(x265-10bit - DEPENDS - x265 - DOWNLOAD_COMMAND "" - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H${source_dir}/source -B - -G Ninja - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} - -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} - -DBUILD_SHARED_LIBS=OFF - ${high_bit_depth} - -DENABLE_SHARED=OFF - -DENABLE_CLI=OFF - -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy - BUILD_COMMAND ${EXEC} ninja -C - INSTALL_COMMAND ${EXEC} ninja -C install - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -ExternalProject_Add(x265-10bit-lib - DEPENDS - x265 - DOWNLOAD_COMMAND "" - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H${source_dir}/source -B + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H/source -B -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=OFF + -DMAIN12=ON -DHIGH_BIT_DEPTH=ON -DENABLE_HDR10_PLUS=ON - -DEXPORT_C_API=OFF - -DENABLE_SHARED=OFF - -DENABLE_CLI=OFF - -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy - BUILD_COMMAND ${EXEC} ninja -C - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy /libx265.a ${binary_dir}/libx265_main10.a - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -ExternalProject_Add(x265-12bit-lib - DEPENDS - x265 - DOWNLOAD_COMMAND "" - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H${source_dir}/source -B - -G Ninja - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} - -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} - -DBUILD_SHARED_LIBS=OFF + -DENABLE_LIBVMAF=ON -DHIGH_BIT_DEPTH=ON - -DENABLE_HDR10_PLUS=ON - -DMAIN12=ON - -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF - -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy - BUILD_COMMAND ${EXEC} ninja -C - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy /libx265.a ${binary_dir}/libx265_main12.a - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -set(COMBINE ${CMAKE_CURRENT_BINARY_DIR}/x265-prefix/src/combine-libs.sh) -file(WRITE ${COMBINE} -"#!/bin/bash -dir=$1 -echo create libx265.a > $dir/combine-libs.mri -for lib in $2 $3 $4 -do - echo addlib $lib >> $dir/combine-libs.mri -done -echo save >> $dir/combine-libs.mri -echo end >> $dir/combine-libs.mri -${EXEC} ${TARGET_ARCH}-ar -M < $dir/combine-libs.mri -") - -ExternalProject_Add(x265-8+10bit - DEPENDS - x265 - x265-10bit-lib - DOWNLOAD_COMMAND "" - LIST_SEPARATOR ^^ - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy ${binary_dir}/libx265_main10.a - COMMAND ${EXEC} CONF=1 cmake -H${source_dir}/source -B - -G Ninja - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} - -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} - -DBUILD_SHARED_LIBS=OFF - -DEXTRA_LIB='x265_main10.a' - -DEXTRA_LINK_FLAGS=-L. - -DLINKED_10BIT=ON - -DENABLE_SHARED=OFF - -DENABLE_CLI=OFF - -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy - BUILD_COMMAND ${EXEC} ninja -C - COMMAND ${CMAKE_COMMAND} -E copy /libx265.a /libx265_main.a - COMMAND chmod 755 ${COMBINE} - COMMAND ${COMBINE} libx265_main.a libx265_main10.a - INSTALL_COMMAND ${EXEC} ninja -C install/strip - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -ExternalProject_Add(x265-8+10+12bit - DEPENDS - x265 - x265-12bit-lib - x265-10bit-lib - DOWNLOAD_COMMAND "" - LIST_SEPARATOR ^^ - UPDATE_COMMAND "" - CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy ${binary_dir}/libx265_main10.a - COMMAND ${CMAKE_COMMAND} -E copy ${binary_dir}/libx265_main12.a - COMMAND ${EXEC} CONF=1 cmake -H${source_dir}/source -B - -G Ninja - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} - -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} - -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} - -DBUILD_SHARED_LIBS=OFF - -DEXTRA_LIB='x265_main10.a^^x265_main12.a' - -DEXTRA_LINK_FLAGS=-L. - -DLINKED_10BIT=ON - -DLINKED_12BIT=ON - -DENABLE_SHARED=OFF - -DENABLE_CLI=OFF - -DCMAKE_ASM_NASM_FLAGS=-w-macro-params-legacy BUILD_COMMAND ${EXEC} ninja -C - COMMAND ${CMAKE_COMMAND} -E copy /libx265.a /libx265_main.a - COMMAND chmod 755 ${COMBINE} - COMMAND ${COMBINE} libx265_main.a libx265_main10.a libx265_main12.a - INSTALL_COMMAND ${EXEC} ninja -C install/strip + INSTALL_COMMAND ${EXEC} ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) -function(delete_dir) - foreach(arg IN LISTS ARGV) - ExternalProject_Add_Step(${arg} delete-dir - DEPENDEES install - COMMAND bash -c "rm -rf /*" - COMMENT "Delete build directory" - ) - endforeach() -endfunction() - force_rebuild_git(x265) cleanup(x265 install) -cleanup(x265-10bit-lib install) -cleanup(x265-12bit-lib install) -cleanup(x265-10bit install) -cleanup(x265-8+10bit install) -cleanup(x265-8+10+12bit install) -delete_dir(x265-10bit-lib x265-12bit-lib x265-10bit x265-8+10bit x265-8+10+12bit) diff --git a/packages/xvidcore-2-win64.patch b/packages/xvidcore-2-win64.patch deleted file mode 100644 index 36b716884..000000000 --- a/packages/xvidcore-2-win64.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- build/generic/configure.in_ 2013-09-07 21:47:14.000000000 +0200 -+++ build/generic/configure.in 2013-09-07 22:22:13.162261180 +0200 -@@ -20,7 +20,7 @@ - minimum_nasm_minor_version=0 - minimum_nasm_major_version=2 - nasm_prog="nasm" --yasm_prog="yasm" -+yasm_prog="yasm -DNO_PREFIX" - - dnl Default CFLAGS -- Big impact on overall speed - our_cflags_defaults="-Wall" diff --git a/packages/xvidcore.cmake b/packages/xvidcore.cmake deleted file mode 100644 index 0d0024e34..000000000 --- a/packages/xvidcore.cmake +++ /dev/null @@ -1,34 +0,0 @@ -ExternalProject_Add(xvidcore - URL "https://downloads.xvid.com/downloads/xvidcore-1.3.7.tar.bz2" - URL_HASH SHA256=aeeaae952d4db395249839a3bd03841d6844843f5a4f84c271ff88f7aa1acff7 - DOWNLOAD_DIR ${SOURCE_LOCATION} - CONFIGURE_COMMAND ${EXEC} cd /build/generic && CONF=1 ./configure # running configure outside that directory will make it happily ignore --host while building - --host=${TARGET_ARCH} - --prefix=${MINGW_INSTALL_PREFIX} - BUILD_COMMAND ${MAKE} -C build/generic BUILD_DIR=build SHARED_LIB= - INSTALL_COMMAND install -d ${MINGW_INSTALL_PREFIX}/include - COMMAND install -m644 src/xvid.h ${MINGW_INSTALL_PREFIX}/include/ - COMMAND install -d ${MINGW_INSTALL_PREFIX}/lib - COMMAND install -m644 build/generic/build/xvidcore.a ${MINGW_INSTALL_PREFIX}/lib/libxvidcore.a - BUILD_IN_SOURCE 1 - LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 -) - -ExternalProject_Add_Step(xvidcore autoconf - DEPENDEES download update patch - DEPENDERS configure - COMMAND ${EXEC} autoconf - WORKING_DIRECTORY /build/generic - LOG 1 -) - -if(${TARGET_CPU} MATCHES "x86_64") - ExternalProject_Add_Step(xvidcore win64-fix - DEPENDEES download update patch - DEPENDERS autoconf - COMMAND patch -p0 < ${CMAKE_CURRENT_SOURCE_DIR}/xvidcore-2-win64.patch - WORKING_DIRECTORY - ) -endif() - -cleanup(xvidcore install) diff --git a/packages/xxhash.cmake b/packages/xxhash.cmake index 304b2614f..998857864 100644 --- a/packages/xxhash.cmake +++ b/packages/xxhash.cmake @@ -12,9 +12,9 @@ ExternalProject_Add(xxhash -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=OFF - -DDISPATCH=ON + ${xxhash_dispatch} -DXXHASH_BUILD_XXHSUM=OFF - -DCMAKE_C_FLAGS='${CMAKE_C_FLAGS} -DXXH_X86DISPATCH_ALLOW_AVX=1' + -DCMAKE_C_FLAGS='${CMAKE_C_FLAGS} ${xxhash_cflags}' BUILD_COMMAND ${EXEC} ninja -C INSTALL_COMMAND ${EXEC} ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 diff --git a/packages/xz.cmake b/packages/xz.cmake index b8ed3d781..62ec0de81 100644 --- a/packages/xz.cmake +++ b/packages/xz.cmake @@ -12,6 +12,7 @@ ExternalProject_Add(xz -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DENABLE_THREADS=ON + ${xz_crc} BUILD_COMMAND ${EXEC} ninja -C INSTALL_COMMAND ${EXEC} ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 diff --git a/packages/zenlib.cmake b/packages/zenlib.cmake new file mode 100644 index 000000000..b3f9f7fb6 --- /dev/null +++ b/packages/zenlib.cmake @@ -0,0 +1,19 @@ +ExternalProject_Add(zenlib + GIT_REPOSITORY https://github.com/MediaArea/ZenLib.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H/Project/CMake -B + -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} + -DCMAKE_INSTALL_PREFIX=${MINGW_INSTALL_PREFIX} + -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} + -DBUILD_SHARED_LIBS=OFF + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(zenlib) +cleanup(zenlib install) diff --git a/packages/zlib.cmake b/packages/zlib.cmake index 62b10851f..ddbbbb438 100644 --- a/packages/zlib.cmake +++ b/packages/zlib.cmake @@ -17,9 +17,9 @@ ExternalProject_Add(zlib -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF -DZLIBNG_ENABLE_TESTS=OFF - ${zlib_lto} - BUILD_COMMAND ${EXEC} ninja -C - INSTALL_COMMAND ${EXEC} ninja -C install + -DFNO_LTO_AVAILABLE=OFF + BUILD_COMMAND ${EXEC} ${zlib_nlto} ninja -C + INSTALL_COMMAND ${EXEC} ${zlib_nlto} ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) diff --git a/packages/zstd.cmake b/packages/zstd.cmake index 5c5e00ebb..48f887d41 100644 --- a/packages/zstd.cmake +++ b/packages/zstd.cmake @@ -15,7 +15,7 @@ ExternalProject_Add(zstd -DZSTD_BUILD_CONTRIB=OFF -DZSTD_BUILD_TESTS=OFF -DZSTD_LEGACY_SUPPORT=OFF - -DZSTD_BUILD_PROGRAMS=OFF + ${zstd_tools} -DZSTD_PROGRAMS_LINK_SHARED=OFF -DZSTD_BUILD_SHARED=OFF -DZSTD_BUILD_STATIC=ON diff --git a/toolchain/CMakeLists.txt b/toolchain/CMakeLists.txt index d331f82e8..b99064b6f 100644 --- a/toolchain/CMakeLists.txt +++ b/toolchain/CMakeLists.txt @@ -18,6 +18,7 @@ list(APPEND ep llvm-openmp winpthreads llvm-clang + cppwinrt ) foreach(package IN LISTS ep) if(NOT ${SINGLE_SOURCE_LOCATION} STREQUAL "") diff --git a/toolchain/cppwinrt.cmake b/toolchain/cppwinrt.cmake new file mode 100644 index 000000000..764c25459 --- /dev/null +++ b/toolchain/cppwinrt.cmake @@ -0,0 +1,20 @@ +ExternalProject_Add(cppwinrt + GIT_REPOSITORY https://github.com/microsoft/cppwinrt.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + UPDATE_COMMAND "" + GIT_REMOTE_NAME origin + GIT_TAG master + CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H -B + -G Ninja + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + BUILD_COMMAND ${EXEC} ninja -C + INSTALL_COMMAND ${EXEC} ninja -C install + COMMAND bash -c "wget -O /Windows.winmd https://github.com/microsoft/windows-rs/raw/master/crates/libs/bindgen/default/Windows.winmd" + COMMAND ${EXEC} cppwinrt -in /Windows.winmd -out ${MINGW_INSTALL_PREFIX}/include/ + LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 +) + +force_rebuild_git(cppwinrt) +cleanup(cppwinrt install) diff --git a/toolchain/gcc/gcc-compiler.in b/toolchain/gcc/gcc-compiler.in index d4bc4d874..d0e386b56 100644 --- a/toolchain/gcc/gcc-compiler.in +++ b/toolchain/gcc/gcc-compiler.in @@ -1,6 +1,9 @@ #!/bin/bash PROG=@CMAKE_INSTALL_PREFIX@/bin/cross-@compiler@ +FLAGS="-march=@GCC_ARCH@ -mtune=@M_TUNE@" FLAGS="$FLAGS @opt@" +FLAGS="$FLAGS -w -Wno-error=incompatible-pointer-types" +FLAGS="$FLAGS -Wl,--allow-multiple-definition -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00" if [ "$CONF" == "1" ]; then SKIP_OPT="-g0 -O0 -fno-lto -fno-data-sections -fno-function-sections" diff --git a/toolchain/gcc/gcc.cmake b/toolchain/gcc/gcc.cmake index ae1b86a07..9372ba53b 100644 --- a/toolchain/gcc/gcc.cmake +++ b/toolchain/gcc/gcc.cmake @@ -1,10 +1,12 @@ ExternalProject_Add(gcc DEPENDS mingw-w64-headers - URL https://mirrorservice.org/sites/sourceware.org/pub/gcc/snapshots/13-20240309/gcc-13-20240309.tar.xz - # https://mirrorservice.org/sites/sourceware.org/pub/gcc/snapshots/13-20240309/sha512.sum - URL_HASH SHA512=2d1e0374ebdee526f0549319fc9c364968c52a0d4aaa16759f00453cb083fe58d8f463c47d97f3bb74a0a92e251989eb75a50ee5800b4569978c72d25446b44e - DOWNLOAD_DIR ${SOURCE_LOCATION} + GIT_REPOSITORY https://github.com/gcc-mirror/gcc.git + SOURCE_DIR ${SOURCE_LOCATION} + GIT_CLONE_FLAGS "--filter=tree:0" + GIT_TAG master + GIT_REMOTE_NAME origin + UPDATE_COMMAND "" CONFIGURE_COMMAND /configure --target=${TARGET_ARCH} --prefix=${CMAKE_INSTALL_PREFIX} @@ -16,13 +18,16 @@ ExternalProject_Add(gcc --disable-nls --disable-shared --disable-win32-registry - --with-arch=${GCC_ARCH} - --with-tune=generic - --enable-threads=posix + --enable-threads=win32 + --enable-libstdcxx-threads=yes --without-included-gettext --enable-lto - --enable-checking=release + --disable-libgomp + --disable-checking --disable-sjlj-exceptions + --enable-default-pie + --enable-host-pie + --enable-host-bind-now BUILD_COMMAND make -j${MAKEJOBS} all-gcc INSTALL_COMMAND make install-strip-gcc STEP_TARGETS download install @@ -41,4 +46,5 @@ ExternalProject_Add_Step(gcc final LOG 1 ) +force_rebuild_git(gcc) cleanup(gcc final) diff --git a/toolchain/llvm/llvm-compiler-rt-builtin.cmake b/toolchain/llvm/llvm-compiler-rt-builtin.cmake index 70013ca0b..c7bf139d7 100644 --- a/toolchain/llvm/llvm-compiler-rt-builtin.cmake +++ b/toolchain/llvm/llvm-compiler-rt-builtin.cmake @@ -22,14 +22,16 @@ ExternalProject_Add(llvm-compiler-rt-builtin -DCOMPILER_RT_USE_BUILTINS_LIBRARY=TRUE -DCOMPILER_RT_BUILD_BUILTINS=TRUE -DCOMPILER_RT_EXCLUDE_ATOMIC_BUILTIN=FALSE + -DCOMPILER_RT_INCLUDE_TESTS=FALSE + ${compiler_rt_cet} -DLLVM_CONFIG_PATH="" -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY -DSANITIZER_CXX_ABI=libc++ - BUILD_COMMAND ${EXEC} LTO=0 ninja -C + BUILD_COMMAND ${EXEC} LTO=0 PGO=0 ninja -C COMMAND bash -c "cp /lib/windows/libclang* ${MINGW_INSTALL_PREFIX}/lib" - INSTALL_COMMAND ${EXEC} LTO=0 ninja -C install + INSTALL_COMMAND ${EXEC} LTO=0 PGO=0 ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) diff --git a/toolchain/llvm/llvm-compiler-rt.cmake b/toolchain/llvm/llvm-compiler-rt.cmake index a941beb16..b22b7548b 100644 --- a/toolchain/llvm/llvm-compiler-rt.cmake +++ b/toolchain/llvm/llvm-compiler-rt.cmake @@ -18,6 +18,8 @@ ExternalProject_Add(llvm-compiler-rt -DCOMPILER_RT_DEFAULT_TARGET_ONLY=TRUE -DCOMPILER_RT_USE_BUILTINS_LIBRARY=TRUE -DCOMPILER_RT_BUILD_BUILTINS=FALSE + -DCOMPILER_RT_INCLUDE_TESTS=FALSE + ${compiler_rt_cet} -DLLVM_CONFIG_PATH="" -DCMAKE_FIND_ROOT_PATH=${MINGW_INSTALL_PREFIX} -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY @@ -25,8 +27,8 @@ ExternalProject_Add(llvm-compiler-rt -DSANITIZER_CXX_ABI=libc++ -DCMAKE_CXX_FLAGS='-std=c++11' -DCMAKE_EXE_LINKER_FLAGS_INIT='-lc++abi' - BUILD_COMMAND ${EXEC} LTO=0 ninja -C - INSTALL_COMMAND ${EXEC} LTO=0 ninja -C install + BUILD_COMMAND ${EXEC} LTO=0 PGO=0 ninja -C + INSTALL_COMMAND ${EXEC} LTO=0 PGO=0 ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) cleanup(llvm-compiler-rt install) diff --git a/toolchain/llvm/llvm-compiler.in b/toolchain/llvm/llvm-compiler.in index a88d59fc2..107055671 100644 --- a/toolchain/llvm/llvm-compiler.in +++ b/toolchain/llvm/llvm-compiler.in @@ -1,27 +1,40 @@ #!/bin/bash PROG=@CMAKE_INSTALL_PREFIX@/bin/@clang_compiler@ -TARGET=@TARGET_ARCH@ -FLAGS="$FLAGS -target $TARGET -march=@GCC_ARCH@ -mtune=@M_TUNE@" +TARGET=@TARGET_CPU@ +FLAGS="$FLAGS -target $TARGET-pc-windows-gnu -march=@GCC_ARCH@ -mtune=@M_TUNE@" FLAGS="$FLAGS @driver_mode@ --sysroot @MINGW_INSTALL_PREFIX@" FLAGS="$FLAGS -fuse-ld=lld --ld-path=@TARGET_ARCH@-ld" -FLAGS="$FLAGS -Wno-unused-command-line-argument" +FLAGS="$FLAGS -Wno-unused-command-line-argument -Wno-int-conversion -Wno-vla-cxx-extension -Wno-packed -Wno-unused-function -Wno-macro-redefined -Wno-backend-plugin" +FLAGS="$FLAGS -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -DNDEBUG" +FLAGS="$FLAGS -ftls-model=local-exec" if [ "$CONF" == "1" ]; then - SKIP_OPT="-g0 -O0 -fno-lto -fno-data-sections -fno-function-sections" + SKIP_OPT="-g0 -O0 -fno-lto -fno-data-sections -fno-function-sections -fno-whole-program-vtables" else - FLAGS="$FLAGS -gcodeview @cfi@ @opt@" + FLAGS="$FLAGS -gcodeview @clang_cfi@ @opt@ -pipe -fno-emulated-tls -fstrict-flex-arrays=3 -fvisibility=hidden -fstrict-vtable-pointers -fforce-emit-vtables" if [ "@ENABLE_CCACHE@" == "ON" ]; then CCACHE="ccache" fi if [ "$GC" != "0" ]; then - CLANG_GC="-fdata-sections -ffunction-sections" + CLANG_GC="-fdata-sections -ffunction-sections -funique-section-names -fomit-frame-pointer -momit-leaf-frame-pointer -fmerge-all-constants" fi if [ "$LTO" != "0" ] && [ "@CLANG_PACKAGES_LTO@" == "ON" ]; then - LTO_FLAGS="-flto=thin" + LTO_FLAGS="-flto=thin -fno-split-lto-unit -fwhole-program-vtables" if [ "@LLD_LTO_ALL_THREADS@" == "ON" ] && [ "$LTO_JOB" != "1" ]; then LTO_FLAGS="$LTO_FLAGS -flto-jobs=@CPU_COUNT@" fi fi + if [ "@LLVM_ENABLE_PGO@" == "GEN" ] || [ "@LLVM_ENABLE_PGO@" == "CSGEN" ]; then + export LLVM_PROFILE_FILE="@LLVM_PROFILE_DATA_DIR@/clang-%m.profraw" #enable profraw output only when CONF!=1 + fi +fi + +if [ "@CLANG_PACKAGES_PGO@" == "GEN" ] && [ "$PGO" != "0" ]; then + PGO_FLAGS="-fprofile-generate="@CLANG_PACKAGES_PROFILE_DATA_DIR@" -fprofile-update=atomic" +else + if [ "@CLANG_PACKAGES_PGO@" == "USE" ] && [ "$PGO" != "0" ]; then + PGO_FLAGS="-fprofile-use=@CLANG_PACKAGES_PROFDATA_FILE@" + fi fi -$CCACHE "$PROG" $LTO_FLAGS "$@" $FLAGS $CLANG_GC @CLANG_FLAGS@ @linker@ $SKIP_OPT +$CCACHE "$PROG" $LTO_FLAGS $PGO_FLAGS "$@" $FLAGS $CLANG_GC @CLANG_FLAGS@ @linker@ $SKIP_OPT diff --git a/toolchain/llvm/llvm-ld.in b/toolchain/llvm/llvm-ld.in index da39cd44a..fd9436681 100644 --- a/toolchain/llvm/llvm-ld.in +++ b/toolchain/llvm/llvm-ld.in @@ -1,20 +1,28 @@ #!/bin/bash PROG=@CMAKE_INSTALL_PREFIX@/bin/ld.lld TARGET=@TARGET_ARCH@ -POLICY="cache_size_bytes=1g:prune_interval=1m" +POLICY="cache_size_bytes=4g:prune_interval=1m" FLAGS="-m @ld_m_flag@" FLAGS="$FLAGS --thinlto-cache-dir=@MINGW_INSTALL_PREFIX@/thinlto --thinlto-cache-policy=$POLICY" +FLAGS="$FLAGS --no-insert-timestamp --major-os-version=10 --major-subsystem-version=6 --minor-subsystem-version=2 --file-alignment=4096" if [ "$CONF" == "1" ]; then SKIP_OPT="-O0 --lto-O0 --lto-CGO0 --no-gc-sections --no-guard-cf --build-id=none" else - FLAGS="$FLAGS -O3 --lto-O3 --lto-CGO3 -s -Xlink=-release" + FLAGS="$FLAGS -O3 --lto-O3 --lto-CGO3 -s -Xlink=-release @lld_cfi@" if [ "$GC" != "0" ]; then - LLD_GC="--gc-sections --icf=safe" + LLD_GC="--gc-sections --icf=all" fi if [ "$PDB" == "1" ]; then FLAGS="$FLAGS --pdb=" fi + if [ "$MIMALLOC" == "1" ]; then + MALLOC_FLAGS="--whole-archive @MINGW_INSTALL_PREFIX@/lib/libmimalloc-static.a @MINGW_INSTALL_PREFIX@/lib/mimalloc_override.o --no-whole-archive -lc++" + fi + if [ "@LLVM_ENABLE_PGO@" == "GEN" ] || [ "@LLVM_ENABLE_PGO@" == "CSGEN" ]; then + export LLVM_PROFILE_FILE="@LLVM_PROFILE_DATA_DIR@/lld-%m.profraw" #enable profraw output only when CONF!=1 + export LLD_IN_TEST=1 #https://github.com/llvm/llvm-project/issues/52861 + fi fi -"$PROG" "$@" $FLAGS $LLD_GC @LLD_FLAGS@ $SKIP_OPT +"$PROG" $MALLOC_FLAGS "$@" $FLAGS $LLD_GC @LLD_FLAGS@ $SKIP_OPT diff --git a/toolchain/llvm/llvm-libcxx.cmake b/toolchain/llvm/llvm-libcxx.cmake index 25b0deda5..36bc27c85 100644 --- a/toolchain/llvm/llvm-libcxx.cmake +++ b/toolchain/llvm/llvm-libcxx.cmake @@ -22,6 +22,7 @@ ExternalProject_Add(llvm-libcxx -DLIBUNWIND_USE_COMPILER_RT=TRUE -DLIBUNWIND_ENABLE_SHARED=OFF -DLIBUNWIND_ENABLE_STATIC=ON + ${libcxx_cet} -DLIBCXX_USE_COMPILER_RT=ON -DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC=ON @@ -29,6 +30,8 @@ ExternalProject_Add(llvm-libcxx -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_LIBDIR_SUFFIX="" -DLIBCXX_INCLUDE_TESTS=FALSE + -DLIBUNWIND_INCLUDE_TESTS=FALSE + -DLIBCXXABI_INCLUDE_TESTS=FALSE -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=FALSE -DLIBCXX_HAS_WIN32_THREAD_API=ON -DLIBCXXABI_HAS_WIN32_THREAD_API=ON @@ -36,8 +39,8 @@ ExternalProject_Add(llvm-libcxx -DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXXABI_ENABLE_SHARED=OFF -DLIBCXXABI_LIBDIR_SUFFIX="" - BUILD_COMMAND ${EXEC} LTO=0 ninja -C - INSTALL_COMMAND ${EXEC} LTO=0 ninja -C install + BUILD_COMMAND ${EXEC} LTO=0 PGO=0 ninja -C + INSTALL_COMMAND ${EXEC} LTO=0 PGO=0 ninja -C install COMMAND bash -c "cp ${MINGW_INSTALL_PREFIX}/lib/libc++.a ${MINGW_INSTALL_PREFIX}/lib/libstdc++.a" LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) diff --git a/toolchain/llvm/llvm.cmake b/toolchain/llvm/llvm.cmake index de6979a59..1d9199abe 100644 --- a/toolchain/llvm/llvm.cmake +++ b/toolchain/llvm/llvm.cmake @@ -1,21 +1,24 @@ -set(clang_version "18") +set(clang_version "19") ExternalProject_Add(llvm GIT_REPOSITORY https://github.com/llvm/llvm-project.git SOURCE_DIR ${SOURCE_LOCATION} - GIT_CLONE_FLAGS "--filter=tree:0" + GIT_CLONE_FLAGS "--sparse --filter=tree:0" + GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !*/test" UPDATE_COMMAND "" GIT_REMOTE_NAME origin - GIT_TAG release/18.x + GIT_TAG main LIST_SEPARATOR , - CONFIGURE_COMMAND ${EXEC} CONF=1 cmake -H/llvm -B + CONFIGURE_COMMAND ${EXEC} CONF=1 PATH=$O_PATH cmake -H/llvm -B -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + ${llvm_ccache} + "-DLLVM_THINLTO_CACHE_PATH='${CMAKE_INSTALL_PREFIX}/llvm-thinlto'" -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON - -DLLVM_TARGETS_TO_BUILD='X86,NVPTX' + -DLLVM_TARGETS_TO_BUILD='AArch64,X86,NVPTX' -DLLVM_ENABLE_PROJECTS='clang,lld' -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_LIBCXX=ON @@ -42,6 +45,7 @@ ExternalProject_Add(llvm -DBUILD_SHARED_LIBS=OFF -DLIBCLANG_BUILD_STATIC=ON -DLLVM_BUILD_UTILS=OFF + -DCLANG_BUILD_TOOLS=OFF -DCLANG_TOOL_AMDGPU_ARCH_BUILD=OFF -DCLANG_TOOL_APINOTES_TEST_BUILD=OFF -DCLANG_TOOL_ARCMT_TEST_BUILD=OFF @@ -53,6 +57,7 @@ ExternalProject_Add(llvm -DCLANG_TOOL_CLANG_FORMAT_BUILD=OFF -DCLANG_TOOL_CLANG_FORMAT_VS_BUILD=OFF -DCLANG_TOOL_CLANG_FUZZER_BUILD=OFF + -DCLANG_TOOL_CLANG_INSTALLAPI_BUILD=OFF -DCLANG_TOOL_CLANG_IMPORT_TEST_BUILD=OFF -DCLANG_TOOL_CLANG_LINKER_WRAPPER_BUILD=OFF -DCLANG_TOOL_CLANG_OFFLOAD_BUNDLER_BUILD=OFF @@ -75,6 +80,7 @@ ExternalProject_Add(llvm -DLLVM_TOOL_GOLD_BUILD=OFF -DLLVM_TOOL_LLC_BUILD=OFF -DLLVM_TOOL_LLI_BUILD=OFF + -DLLVM_TOOL_LLVM_DRIVER_BUILD=ON -DLLVM_TOOL_LLVM_AS_BUILD=OFF -DLLVM_TOOL_LLVM_AS_FUZZER_BUILD=OFF -DLLVM_TOOL_LLVM_BCANALYZER_BUILD=OFF @@ -141,10 +147,13 @@ ExternalProject_Add(llvm -DLLVM_TOOL_VERIFY_USELISTORDER_BUILD=OFF -DLLVM_TOOL_VFABI_DEMANGLE_FUZZER_BUILD=OFF -DLLVM_TOOL_XCODE_TOOLCHAIN_BUILD=OFF - "-DCMAKE_C_FLAGS='-g0'" - "-DCMAKE_CXX_FLAGS='-g0'" - "-DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=lld -Xlinker --build-id=none -Xlinker -s -Xlinker --icf=all'" - -DLLVM_TOOLCHAIN_TOOLS='llvm-ar,llvm-ranlib,llvm-objdump,llvm-rc,llvm-cvtres,llvm-nm,llvm-strings,llvm-readobj,llvm-dlltool,llvm-pdbutil,llvm-objcopy,llvm-strip,llvm-cov,llvm-profdata,llvm-addr2line,llvm-symbolizer,llvm-windres,llvm-ml,llvm-readelf,llvm-size,llvm-config' + "-DCMAKE_C_FLAGS='-march=native -pipe -g0 ${llvm_lto} ${llvm_pgo}'" + "-DCMAKE_CXX_FLAGS='-march=native -pipe -g0 ${llvm_lto} ${llvm_pgo}'" + "-DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=lld -Xlinker -s -Xlinker --icf=all -Xlinker --thinlto-cache-policy=cache_size_bytes=1g:prune_interval=1m'" + -DLLVM_ENABLE_ZSTD=OFF + -DLLVM_ENABLE_LIBXML2=OFF + -DLLVM_ENABLE_TERMINFO=OFF + -DLLVM_TOOLCHAIN_TOOLS='llvm-driver,llvm-ar,llvm-ranlib,llvm-objdump,llvm-rc,llvm-cvtres,llvm-nm,llvm-strings,llvm-readobj,llvm-dlltool,llvm-pdbutil,llvm-objcopy,llvm-strip,llvm-cov,llvm-profdata,llvm-addr2line,llvm-symbolizer,llvm-windres,llvm-ml,llvm-readelf,llvm-size,llvm-config' BUILD_COMMAND ${EXEC} ninja -C INSTALL_COMMAND ${EXEC} ninja -C install LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 diff --git a/toolchain/mingw-w64-crt.cmake b/toolchain/mingw-w64-crt.cmake index bae129b3b..98e106f18 100644 --- a/toolchain/mingw-w64-crt.cmake +++ b/toolchain/mingw-w64-crt.cmake @@ -15,8 +15,8 @@ ExternalProject_Add(mingw-w64-crt --with-default-msvcrt=ucrt ${crt_lib} ${cfguard} - BUILD_COMMAND ${MAKE} LTO=0 GC=0 - INSTALL_COMMAND ${MAKE} LTO=0 GC=0 install-strip + BUILD_COMMAND ${MAKE} LTO=0 PGO=0 GC=0 + INSTALL_COMMAND ${MAKE} LTO=0 PGO=0 GC=0 install-strip LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) diff --git a/toolchain/mingw-w64-headers.cmake b/toolchain/mingw-w64-headers.cmake index f7882beaf..52c011966 100644 --- a/toolchain/mingw-w64-headers.cmake +++ b/toolchain/mingw-w64-headers.cmake @@ -13,6 +13,7 @@ ExternalProject_Add(mingw-w64-headers --with-default-msvcrt=ucrt BUILD_COMMAND "" INSTALL_COMMAND make install-strip + COMMAND bash -c "cp ${MINGW_INSTALL_PREFIX}/include/windows.h ${MINGW_INSTALL_PREFIX}/include/Windows.h" LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) diff --git a/toolchain/rustup.cmake b/toolchain/rustup.cmake index 250a5a04d..0ec3fbf51 100644 --- a/toolchain/rustup.cmake +++ b/toolchain/rustup.cmake @@ -4,8 +4,9 @@ ExternalProject_Add(rustup SOURCE_DIR rustup-prefix/src CONFIGURE_COMMAND ${EXEC} CONF=1 curl -sSf https://sh.rustup.rs | - sh -s -- -y --default-toolchain stable --target x86_64-pc-windows-gnu,i686-pc-windows-gnu --no-modify-path --profile minimal + sh -s -- -y --default-toolchain nightly --no-modify-path --profile minimal BUILD_COMMAND ${EXEC} rustup update + COMMAND ${EXEC} rustup component add rust-src INSTALL_COMMAND ${EXEC} cargo install cargo-c --profile=release-strip --features=vendored-openssl LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) diff --git a/toolchain/winpthreads.cmake b/toolchain/winpthreads.cmake index 5ba415dcc..c9865ca1b 100644 --- a/toolchain/winpthreads.cmake +++ b/toolchain/winpthreads.cmake @@ -9,8 +9,8 @@ ExternalProject_Add(winpthreads --prefix=${MINGW_INSTALL_PREFIX} --disable-shared --enable-static - BUILD_COMMAND ${MAKE} LTO=0 GC=0 - INSTALL_COMMAND ${MAKE} LTO=0 GC=0 install-strip + BUILD_COMMAND ${MAKE} LTO=0 PGO=0 GC=0 + INSTALL_COMMAND ${MAKE} LTO=0 PGO=0 GC=0 install-strip LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) diff --git a/utils/debug.sh b/utils/debug.sh new file mode 100755 index 000000000..ac2600599 --- /dev/null +++ b/utils/debug.sh @@ -0,0 +1,12 @@ +#!/bin/sh +cmake -DTARGET_ARCH=x86_64-w64-mingw32 \ +-DGCC_ARCH=native \ +-DSINGLE_SOURCE_LOCATION=../src_packages \ +-DCOMPILER_TOOLCHAIN=clang \ +-DLLVM_ENABLE_LTO=Thin \ +-DENABLE_CCACHE=ON \ +-DCLANG_PACKAGES_LTO=ON \ +-DCLANG_FLAGS="-mprefer-vector-width=512" \ +-G Ninja \ +-B /build +./utils/download.sh diff --git a/utils/download.sh b/utils/download.sh new file mode 100755 index 000000000..7fe1e1475 --- /dev/null +++ b/utils/download.sh @@ -0,0 +1,4 @@ +#!/bin/sh +while ! ninja -C /build download; do + sleep 1 +done diff --git a/utils/llvm-pgo-gen.sh b/utils/llvm-pgo-gen.sh new file mode 100755 index 000000000..fa9541bfc --- /dev/null +++ b/utils/llvm-pgo-gen.sh @@ -0,0 +1,15 @@ +#!/bin/bash +cmake -DTARGET_ARCH=x86_64-w64-mingw32 \ +-DGCC_ARCH=native \ +-DSINGLE_SOURCE_LOCATION=../src_packages \ +-DCOMPILER_TOOLCHAIN=clang \ +-DLLVM_ENABLE_LTO=Thin \ +-DENABLE_CCACHE=OFF \ +-DLLVM_ENABLE_CCACHE=OFF \ +-DCLANG_PACKAGES_LTO=ON \ +-DCLANG_PACKAGES_PGO=OFF \ +-DLLVM_ENABLE_PGO=GEN \ +-DCLANG_FLAGS="-mprefer-vector-width=512" \ +-G Ninja \ +-B /build +./utils/download.sh diff --git a/utils/llvm-pgo-use.sh b/utils/llvm-pgo-use.sh new file mode 100755 index 000000000..2d21e8b8b --- /dev/null +++ b/utils/llvm-pgo-use.sh @@ -0,0 +1,16 @@ +#!/bin/bash +cmake -DTARGET_ARCH=x86_64-w64-mingw32 \ +-DGCC_ARCH=native \ +-DSINGLE_SOURCE_LOCATION=../src_packages \ +-DCOMPILER_TOOLCHAIN=clang \ +-DLLVM_ENABLE_LTO=Thin \ +-DENABLE_CCACHE=ON \ +-DLLVM_ENABLE_CCACHE=ON \ +-DCLANG_PACKAGES_LTO=ON \ +-DCLANG_PACKAGES_PGO=OFF \ +-DLLVM_ENABLE_PGO=USE \ +-DLLVM_PROFDATA_FILE="/build/llvm.profdata" \ +-DCLANG_FLAGS="-mprefer-vector-width=512" \ +-G Ninja \ +-B /build +./utils/download.sh diff --git a/utils/pgo-gen.sh b/utils/pgo-gen.sh new file mode 100755 index 000000000..ba7a2f959 --- /dev/null +++ b/utils/pgo-gen.sh @@ -0,0 +1,13 @@ +#!/bin/sh +cmake -DTARGET_ARCH=x86_64-w64-mingw32 \ +-DGCC_ARCH=native \ +-DSINGLE_SOURCE_LOCATION=../src_packages \ +-DCOMPILER_TOOLCHAIN=clang \ +-DLLVM_ENABLE_LTO=Thin \ +-DENABLE_CCACHE=OFF \ +-DCLANG_PACKAGES_LTO=ON \ +-DCLANG_PACKAGES_PGO=GEN \ +-DCLANG_FLAGS="-mprefer-vector-width=512" \ +-G Ninja \ +-B /build +./utils/download.sh diff --git a/utils/pgo-use.sh b/utils/pgo-use.sh new file mode 100755 index 000000000..b373a3c70 --- /dev/null +++ b/utils/pgo-use.sh @@ -0,0 +1,14 @@ +#!/bin/sh +cmake -DTARGET_ARCH=x86_64-w64-mingw32 \ +-DGCC_ARCH=native \ +-DSINGLE_SOURCE_LOCATION=../src_packages \ +-DCOMPILER_TOOLCHAIN=clang \ +-DLLVM_ENABLE_LTO=Thin \ +-DENABLE_CCACHE=ON \ +-DCLANG_PACKAGES_LTO=ON \ +-DCLANG_PACKAGES_PGO=USE \ +-DCLANG_PACKAGES_PROFDATA_FILE="/build/pgo.profdata" \ +-DCLANG_FLAGS="-mprefer-vector-width=512" \ +-G Ninja \ +-B /build +./utils/download.sh diff --git a/utils/reset.sh b/utils/reset.sh new file mode 100755 index 000000000..1d06222c3 --- /dev/null +++ b/utils/reset.sh @@ -0,0 +1,13 @@ +#!/bin/sh +cmake -DTARGET_ARCH=x86_64-w64-mingw32 \ +-DGCC_ARCH=native \ +-DSINGLE_SOURCE_LOCATION=../src_packages \ +-DCOMPILER_TOOLCHAIN=clang \ +-DLLVM_ENABLE_LTO=Thin \ +-DENABLE_CCACHE=ON \ +-DCLANG_PACKAGES_LTO=ON \ +-DCLANG_PACKAGES_PGO=OFF \ +-DCLANG_FLAGS="-mprefer-vector-width=512" \ +-G Ninja \ +-B /build +./utils/download.sh diff --git a/utils/setup.sh b/utils/setup.sh new file mode 100755 index 000000000..3589fc589 --- /dev/null +++ b/utils/setup.sh @@ -0,0 +1,11 @@ +#!/bin/sh +cmake -DTARGET_ARCH=x86_64-w64-mingw32 \ +-DGCC_ARCH=native \ +-DSINGLE_SOURCE_LOCATION=../src_packages \ +-DCOMPILER_TOOLCHAIN=clang \ +-DLLVM_ENABLE_LTO=Thin \ +-DENABLE_CCACHE=ON \ +-DCLANG_PACKAGES_LTO=ON \ +-DCLANG_FLAGS="-mprefer-vector-width=512" \ +-G Ninja \ +-B /build diff --git a/utils/setup_aarch64.sh b/utils/setup_aarch64.sh new file mode 100755 index 000000000..137f05331 --- /dev/null +++ b/utils/setup_aarch64.sh @@ -0,0 +1,13 @@ +#!/bin/sh +cmake -DTARGET_ARCH=aarch64-w64-mingw32 \ +-DGCC_ARCH=armv8.2-a \ +-DSINGLE_SOURCE_LOCATION="/build/src_packages" \ +-DRUSTUP_LOCATION="/build/install_rustup" \ +-DCMAKE_INSTALL_PREFIX="/build/install" \ +-DMINGW_INSTALL_PREFIX="/build_aarch64/install/aarch64-w64-mingw32" \ +-DCOMPILER_TOOLCHAIN=clang \ +-DLLVM_ENABLE_LTO=Thin \ +-DENABLE_CCACHE=ON \ +-DCLANG_PACKAGES_LTO=ON \ +-G Ninja \ +-B /build_aarch64 diff --git a/utils/update.sh b/utils/update.sh new file mode 100755 index 000000000..30cfe5c4e --- /dev/null +++ b/utils/update.sh @@ -0,0 +1,4 @@ +#!/bin/sh +while ! ninja -C /build update; do + sleep 1 +done