From 0cfb7b5ffa463a2298af1490dde1de1c5c7d8f25 Mon Sep 17 00:00:00 2001 From: paring Date: Wed, 3 May 2023 18:06:33 +0900 Subject: [PATCH] feat: windows build script --- build-current.sh | 3 +++ build-win64.sh | 2 +- build.sh | 3 ++- scripts/build-ffmpeg.sh | 10 ++++++++-- 4 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 build-current.sh diff --git a/build-current.sh b/build-current.sh new file mode 100644 index 0000000..6edfb13 --- /dev/null +++ b/build-current.sh @@ -0,0 +1,3 @@ +export OPENH264_OS=$(uname | tr A-Z a-z | tr -d \\-0-9. | sed -E 's/^(net|open|free)bsd/bsd/') + +CC=gcc CXX=g++ AR=ar bash build.sh diff --git a/build-win64.sh b/build-win64.sh index d235199..e2d2706 100755 --- a/build-win64.sh +++ b/build-win64.sh @@ -1,3 +1,3 @@ TOOLCHAIN=x86_64-w64-mingw32 -FFMPEG_OS=win64 OPENH264_ARCH=x86_64 OPENH264_OS=mingw_nt CC=$TOOLCHAIN-gcc CXX=$TOOLCHAIN-g++ AR=$TOOLCHAIN-ar bash build.sh --arch x86_64 \ No newline at end of file +FFMPEG_OS=win64 FFMPEG_MSBUILD=1 OPENH264_ARCH=x86_64 OPENH264_OS=msvc CC=cl CXX=cl AR=lib bash build.sh --arch x86_64 diff --git a/build.sh b/build.sh index 3e21969..816ed9e 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,6 @@ export ARCH=$(uname -m) -export JOBS=$(awk -v count=$(nproc) 'BEGIN { print ( int( count / 2 ) ) }') +# do not use all cpus because my computer dies +export JOBS=$(awk -v count=$(nproc) 'BEGIN { print ( int( count - 1 ) ) }') while [[ $# -gt 0 ]]; do case $1 in diff --git a/scripts/build-ffmpeg.sh b/scripts/build-ffmpeg.sh index 092ecab..398a05d 100644 --- a/scripts/build-ffmpeg.sh +++ b/scripts/build-ffmpeg.sh @@ -6,12 +6,18 @@ cd $ffmpegPath make distclean +flags="--cc=$CC --cxx=$CXX" + +if [[ -z $FFMPEG_MSVC ]]; then + flags="--toolchain=msvc" +fi + ./configure --disable-gpl --disable-nonfree --disable-doc --disable-network \ --disable-ffprobe --disable-ffplay --enable-static --disable-shared \ --enable-libopenh264 \ --prefix=$PREFIX --enable-cross-compile --arch=$ARCH \ - --cc="$CC" --cxx="$CXX" \ - --pkg-config-flags="--static" --target-os=$FFMPEG_OS + --pkg-config-flags="--static" --target-os=$FFMPEG_OS \ + ${flags} make -j$JOBS