From 07328609d74d7a622fbc3f09846febdc95b4679e Mon Sep 17 00:00:00 2001 From: Levon Date: Fri, 23 Feb 2024 22:17:56 -0600 Subject: [PATCH] lto --- scripts/build.sh | 20 ++++++++++++++++---- scripts/install_deps.sh | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index a47bddf..24aed5d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -18,6 +18,15 @@ git clone https://github.com/Netflix/vmaf "$VMAF_DIR" --depth 1 git clone https://code.videolan.org/videolan/dav1d.git "$DAV1D_DIR" --depth 1 git clone https://gitlab.xiph.org/xiph/opus.git "$OPUS_DIR" --depth 1 +export ARCH=$(arch) +export COMP_FLAGS="" +if [[ "$ARCH" ]] +then + COMP_FLAGS="-march=native" +fi +echo "COMP_FLAGS: $COMP_FLAGS" + +# for ccache export PATH="/usr/lib/ccache/:$PATH" # build svt-av1 @@ -28,7 +37,7 @@ mkdir build cd build || exit make clean cmake .. -DCMAKE_BUILD_TYPE=Release -DSVT_AV1_LTO=ON \ - -DCMAKE_C_FLAGS="-O3" || exit + -DCMAKE_C_FLAGS="-O3 $COMP_FLAGS" || exit make -j "$(nproc)" || exit sudo make install || exit @@ -53,7 +62,7 @@ mkdir build cd build || exit make clean cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \ - -DCMAKE_C_FLAGS="-flto -O3" || exit + -DCMAKE_C_FLAGS="-flto -O3 $COMP_FLAGS" || exit make -j "$(nproc)" || exit sudo make install || exit @@ -97,8 +106,11 @@ make clean ./configure --enable-libsvtav1 --enable-librav1e \ --enable-libaom --enable-libvmaf \ --enable-libdav1d --enable-libopus \ - --extra-cflags="-O3" \ - --extra-cxxflags="-O3" \ + --arch="$ARCH" --cpu=native \ + --enable-lto \ + --pkg-config-flags="--static" \ + --extra-cflags="-O3 $COMP_FLAGS" \ + --extra-cxxflags="-O3 $COMP_FLAGS" \ --disable-doc --disable-htmlpages \ --disable-podpages --disable-txtpages || exit make -j "$(nproc)" || exit diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index bbaae49..9bcbab4 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -14,5 +14,6 @@ curl https://sh.rustup.rs -sSf | sh -s -- -y source "$HOME/.cargo/env" cargo install cargo-c || exit 1 +pip install --upgrade pip python3 -m pip install virtualenv || exit 1 \ No newline at end of file