Skip to content

Instantly share code, notes, and snippets.

@shinchiro
Last active April 6, 2020 18:02
Show Gist options
  • Save shinchiro/3553eab077428f0316bfe3c85608859d to your computer and use it in GitHub Desktop.
Save shinchiro/3553eab077428f0316bfe3c85608859d to your computer and use it in GitHub Desktop.
Script for building x265
#!/bin/sh
# This script will be put outside of x265's repo folder, side by side.
# Clone x265 repo first before running this script: hg clone https://bitbucket.org/multicoreware/x265
# Tell our build toolchain folder.
# If built with MSYS2, there's no need for this. Also '-DCMAKE_TOOLCHAIN_FILE' command should be removed.
export PATH="/home/shinchiro/build/build64/install/bin:$PATH"
export CXXFLAGS='-march=znver1'
FILE_PATH=$(realpath $0)
SCRIPT_DIR_PATH=$(dirname $FILE_PATH)
cd $SCRIPT_DIR_PATH/x265
# Apply some patch
git apply $SCRIPT_DIR_PATH/patches/x265-*.patch
cd ./build/msys
# Building 10bit x265
cmake -G Ninja ../../source -DNATIVE_BUILD=ON -DHIGH_BIT_DEPTH=ON -DENABLE_SHARED=OFF -DCMAKE_TOOLCHAIN_FILE=toolchain-x86_64-w64-mingw32.cmake
ninja -j$(nproc)
# Doing this will wait 'make' to actually finished before doing hg operation
# hg update -C
strip -s x265.exe
mv x265.exe $SCRIPT_DIR_PATH
cd ../..
git clean -dfx
git reset --hard @{u}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment