From c1636d1bcfaa097ab5c2c714b87a3c59d1be3e75 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Sat, 28 Sep 2019 19:07:44 +0000 Subject: [PATCH] builder: fixes for ffmpeg + misc. Use git master for `graphite2` and a better cmake patch, with these `DIST_ARGS`: ``` -DGRAPHITE2_NFILEFACE=ON -DGRAPHITE2_TESTS=OFF -DGRAPHITE2_DOCS=OFF ``` Use `DIST_CONFIGURE_OVERRIDES` instead of `DIST_ARGS` for `libvpx` and `ffmpeg` because their configure scripts error on the `--sysconfdir` arg. Change all other references to `libvpx` and `ffmpeg` `DIST_ARGS` to use `DIST_CONFIGURE_OVERRIDES` instead. Add `-j1` to `xvidcore` `MAKE_ARGS` because it sometimes fails parallel builds. Change the `mkdir` commands to `mkdir -p` in `mingw.sh` because `core.sh` now also makes those directories. In `mingw.sh` for `libvpx` extra `CFLAGS`, add `-mstackrealign` for 32 bit builds and `-fno-asynchronous-unwind-tables` for 64 bit builds. The latter is necessary to build, taken from the msys2 `libvpx` mingw package. Also add the `stdint.h` `-include` option to `CFLAGS` for libtheora and ffmpeg because they use the `libogg` headers. Signed-off-by: Rafael Kitover --- tools/builder/core.sh | 19 ++++++------------- tools/builder/mingw-cross.sh | 12 ++---------- tools/builder/mingw.sh | 14 +++++++++----- tools/builder/unix.sh | 2 +- tools/osx/builder | 8 +++++++- 5 files changed, 25 insertions(+), 30 deletions(-) diff --git a/tools/builder/core.sh b/tools/builder/core.sh index 777f74f8..faed8382 100644 --- a/tools/builder/core.sh +++ b/tools/builder/core.sh @@ -184,7 +184,7 @@ DISTS=$DISTS' sfml https://github.com/SFML/SFML/archive/013d053277c980946bc7761a2a088f1cbb788f8c.tar.gz lib/libsfml-system-s.a shared-mime-info http://freedesktop.org/~hadess/shared-mime-info-1.9.tar.xz bin/update-mime-database wxwidgets https://github.com/wxWidgets/wxWidgets/archive/1753ed403765269bf9f6d3bb540f7e77a8758e39.tar.gz lib/libwx_baseu-3.1*.a - graphite2 https://github.com/silnrsi/graphite/releases/download/1.3.13/graphite2-1.3.13.tgz lib/libgraphite2.a + graphite2 https://github.com/silnrsi/graphite/archive/ce0e793f22127d7ba6422d440bd83b58f864ef7e.tar.gz lib/libgraphite2.a xvidcore http://downloads.xvid.org/downloads/xvidcore-1.3.5.tar.bz2 lib/libxvidcore.a fribidi https://github.com/fribidi/fribidi/releases/download/v1.0.1/fribidi-1.0.1.tar.bz2 lib/libfribidi.a libgsm http://www.quut.com/gsm/gsm-1.0.18.tar.gz lib/libgsm.a @@ -247,7 +247,7 @@ DIST_PATCHES=$DIST_PATCHES' m4 https://raw.githubusercontent.com/gentoo/gentoo/master/sys-devel/m4/files/m4-1.4.18-glibc228.patch docbook2x https://gist.githubusercontent.com/rkitover/0b5dcc95a0703a9b0e0e7eb6d325a98e/raw/e256d2fad8d19633ac8abe02a0d1e119063d1fd9/docbook2x.patch ccache https://gist.githubusercontent.com/rkitover/4dd30c2841a2131be8715038f538d622/raw/40a8f0f50aa6ca5f9658a0c37aa17393cc80c109/ccache-3.4.2-msys.patch - graphite2 https://gist.githubusercontent.com/ZachBacon/759066387c5680e0966e8a5e59711423/raw/9c1654cf3efa794181be6ef2d78f17d77ed63a9e/static.patch + graphite2 https://gist.githubusercontent.com/rkitover/e753f41a7f6461ad412c2d076ec24e0f/raw/d0c2b8cccd556e407e15da8a2e739a902bd1a3b5/graphite2-static-cmake-opts.patch python2 https://gist.githubusercontent.com/rkitover/2d9e5baff1f1cc4f2618dee53083bd35/raw/7f33fcf5470a9f1013ac6ae7bb168368a98fe5a0/python-2.7.14-custom-static-openssl.patch https://gist.githubusercontent.com/rkitover/afab7ed3ac7ce1860c43a258571c8ae1/raw/6f5fc90a7acf5f5c3ffda2edf402b28f469a4b3b/python-2.7.14-static-libintl.patch python3 https://gist.githubusercontent.com/rkitover/93d89a679705875c59275fb0a8f22b45/raw/6149e7fa3920d6c674c79448c5a4c9313620e06c/python-3.6.3-custom-static-openssl.patch https://gist.githubusercontent.com/rkitover/b18f19eafda3775a9652cc9cdf3ec914/raw/ed14c34bf9f205ccc3a4684dbdb83f8620162b98/python-3.6.3-static-libintl.patch intltool https://gist.githubusercontent.com/rkitover/d638882f52e5d5f8e392cbf6842cd6d0/raw/dcfbe358bbb8b89f88b40a9c3402494552fd33f8/intltool-0.51.0.patch @@ -334,6 +334,8 @@ DIST_CONFIGURE_OVERRIDES="$DIST_CONFIGURE_OVERRIDES zlib ./configure --prefix=/usr --static XML-SAX echo no | PERL_MM_USE_DEFAULT=0 perl Makefile.PL wxwidgets ./configure \$CONFIGURE_REQUIRED_ARGS --disable-shared --prefix=/usr --enable-stl --disable-precomp-headers --enable-cxx11 --enable-permissive --with-opengl --with-libpng + libvpx ./configure --disable-shared --enable-static --prefix=/usr --disable-unit-tests --disable-tools --disable-docs --disable-examples + ffmpeg ./configure --disable-shared --enable-static --prefix=/usr --pkg-config-flags=--static --enable-nonfree --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-version3 --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-openssl --enable-lzma --extra-cflags='-DMODPLUG_STATIC -DZMQ_STATIC' --extra-cxxflags='-DMODPLUG_STATIC -DZMQ_STATIC' --extra-objcflags='-DMODPLUG_STATIC -DZMQ_STATIC' " DIST_BUILD_OVERRIDES="$DIST_BUILD_OVERRIDES @@ -380,8 +382,8 @@ DIST_ARGS="$DIST_ARGS libcroco --disable-Bsymbolic freetype --with-harfbuzz=no harfbuzz --with-cairo=no --with-icu=no + graphite2 -DGRAPHITE2_NFILEFACE=ON -DGRAPHITE2_TESTS=OFF -DGRAPHITE2_DOCS=OFF flac --disable-ogg - libvpx --disable-unit-tests --disable-tools --disable-docs --disable-examples libxavs --disable-asm libzvbi --without-x libxml2 --without-python @@ -390,18 +392,8 @@ DIST_ARGS="$DIST_ARGS vidstab -DUSE_OMP=NO libx264 --enable-pic libx265 -DHIGH_BIT_DEPTH=ON -DENABLE_ASSEMBLY=OFF -DENABLE_CLI=OFF - - ffmpeg --pkg-config-flags=--static --enable-nonfree --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-version3 --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-libzvbi --enable-openssl --enable-lzma --extra-cflags='-DMODPLUG_STATIC -DZMQ_STATIC' --extra-cxxflags='-DMODPLUG_STATIC -DZMQ_STATIC' --extra-objcflags='-DMODPLUG_STATIC -DZMQ_STATIC' - -# -# TODO: add these if possible (from brew) --enable-indev=qtkit --enable-securetransport --enable-chromaprint --enable-ffplay --enable-frei0r --enable-libbs2b --enable-libcaca --enable-libfdk-aac --enable-libgme --enable-libgsm --enable-librtmp --enable-librubberband --enable-libssh --enable-libtesseract --enable-libtwolame --enable-webp --enable-libzimg -# -# these require > 10.7: -# --enable-opencl # requires 10.8 -# --enable-videotoolbox # requires 10.8 " - export DIST_BARE_MAKE_ARGS='CC="$CC"' export ALL_MAKE_ARGS='V=1 VERBOSE=1' @@ -414,6 +406,7 @@ DIST_MAKE_ARGS="$DIST_MAKE_ARGS zip generic expat DOCBOOK_TO_MAN=docbook2man shared-mime-info -j1 + xvidcore -j1 fontconfig LIBS=\"-lintl -liconv\" " diff --git a/tools/builder/mingw-cross.sh b/tools/builder/mingw-cross.sh index 280f7cd4..777636a2 100644 --- a/tools/builder/mingw-cross.sh +++ b/tools/builder/mingw-cross.sh @@ -132,14 +132,6 @@ table_line_append DIST_ARGS libsoxr '-DHAVE_WORDS_BIGENDIAN_EXITCODE=0' vpx_target=x86-win32-gcc [ "$target_bits" -eq 64 ] && vpx_target=x86_64-win64-gcc -table_line_replace DIST_CONFIGURE_OVERRIDES libvpx "./configure --target=$vpx_target \$CONFIGURE_ARGS $(table_line DIST_ARGS libvpx)" +table_line_append DIST_CONFIGURE_OVERRIDES libvpx --target=$vpx_target -table_line_remove DIST_ARGS libvpx - -table_line_replace DIST_CONFIGURE_OVERRIDES ffmpeg "\ - ./configure --arch=$target_cpu --target-os=mingw32 --cross-prefix=${target_arch}- \ - --pkg-config='\$BUILD_ROOT/host/bin/pkg-config' \ - \$CONFIGURE_ARGS $(table_line DIST_ARGS ffmpeg) \ -" - -table_line_remove DIST_ARGS ffmpeg +table_line_append DIST_CONFIGURE_OVERRIDES ffmpeg "--arch=$target_cpu --target-os=mingw32 --cross-prefix=${target_arch}- --enable-cross-compile --pkg-config='$BUILD_ROOT/host/bin/pkg-config'" diff --git a/tools/builder/mingw.sh b/tools/builder/mingw.sh index 2993ac35..99dd18d0 100644 --- a/tools/builder/mingw.sh +++ b/tools/builder/mingw.sh @@ -41,7 +41,7 @@ export BUILD_ENV if [ ! -L "$BUILD_ROOT/root" ]; then mv "$BUILD_ROOT/root" "$BUILD_ROOT/target" - mkdir "$BUILD_ROOT/host" + mkdir -p "$BUILD_ROOT/host" ln -sf "$BUILD_ROOT/target" "$BUILD_ROOT/root" cp -a "$BUILD_ROOT/target/"* "$BUILD_ROOT/host" @@ -51,7 +51,7 @@ if [ ! -L "$BUILD_ROOT/root" ]; then ln -s "$BUILD_ROOT/target/$d" "$BUILD_ROOT/host/$d" done - mkdir "$BUILD_ROOT/host/bin" "$BUILD_ROOT/target/bin" + mkdir -p "$BUILD_ROOT/host/bin" "$BUILD_ROOT/target/bin" fi ln -sf "$BUILD_ROOT/target" "$BUILD_ROOT/root" @@ -342,12 +342,10 @@ table_line_replace DIST_CONFIGURE_TYPES xvidcore autoreconf table_line_append DIST_ARGS libsoxr '-DWITH_OPENMP=NO' -table_line_append DIST_ARGS ffmpeg "--extra-ldflags='-Wl,-allow-multiple-definition' --extra-libs='-lwsock32 -lws2_32 -liphlpapi -lfreetype'" +table_line_append DIST_CONFIGURE_OVERRIDES ffmpeg "--extra-ldflags='-Wl,-allow-multiple-definition' --extra-libs='-lwsock32 -lws2_32 -liphlpapi -lfreetype'" table_line_append DIST_ARGS gettext "--enable-threads=windows" -table_line_append DIST_ARGS graphite2 "-DBUILD_SHARED_LIBS=OFF" - table_line_append DIST_ARGS glib "--with-threads=posix --disable-libelf" table_line_append DIST_PATCHES glib "\ @@ -382,3 +380,9 @@ table_line_append DIST_POST_BUILD wxwidgets ":; \ mv \$BUILD_ROOT/root/include/langinfo.bak \$BUILD_ROOT/root/include/langinfo.h; \ fi; " + +if [ "$target_bits" = 32 ]; then + table_line_append DIST_EXTRA_CFLAGS libvpx -mstackrealign +else + table_line_append DIST_EXTRA_CFLAGS libvpx -fno-asynchronous-unwind-tables +fi diff --git a/tools/builder/unix.sh b/tools/builder/unix.sh index cb2b443b..a76bcf0c 100644 --- a/tools/builder/unix.sh +++ b/tools/builder/unix.sh @@ -172,6 +172,6 @@ table_line_append DIST_ARGS openal '-DLIBTYPE=STATIC' table_line_append DIST_MAKE_ARGS libvpx "AS='yasm -DPIC'" -table_line_append DIST_ARGS ffmpeg '--enable-pic' +table_line_append DIST_CONFIGURE_OVERRIDES ffmpeg '--enable-pic' table_line_append DIST_EXTRA_LDFLAGS ffmpeg '-lgomp' diff --git a/tools/osx/builder b/tools/osx/builder index 9f5195e6..de23f319 100755 --- a/tools/osx/builder +++ b/tools/osx/builder @@ -72,6 +72,10 @@ table_line_append DIST_EXTRA_CFLAGS libogg "-include \"$(xcode-select -p)\"/P table_line_append DIST_EXTRA_CFLAGS libvorbis "-include \"$(xcode-select -p)\"/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdint.h" +table_line_append DIST_EXTRA_CFLAGS libtheora "-include \"$(xcode-select -p)\"/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdint.h" + +table_line_append DIST_EXTRA_CFLAGS ffmpeg "-include \"$(xcode-select -p)\"/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdint.h" + # -Wl,-no_compact_unwind must be passed in LDFLAGS to openssl table_line_append DIST_MAKE_ARGS openssl "LDFLAGS=\"\$LDFLAGS\"" @@ -108,7 +112,9 @@ table_line_append DIST_PRE_BUILD libzmq "sed -i.bak 's/-lstdc++/-lc++/g' src/lib table_line_append DIST_PRE_BUILD ffmpeg "sed -i.bak 's/-lstdc++/-lc++/g' configure" table_line_append DIST_CONFIGURE_OVERRIDES wxwidgets "--with-macosx-version-min=\$MACOSX_DEPLOYMENT_TARGET LDFLAGS=\"\$LDFLAGS -stdlib=libc++\"" -table_line_append DIST_ARGS ffmpeg "--disable-videotoolbox --extra-ldflags='-framework CoreText'" + table_line_append DIST_ARGS libmodplug "CC=clang++ CXX=clang++" +table_line_append DIST_CONFIGURE_OVERRIDES ffmpeg "--disable-videotoolbox --extra-ldflags='-framework CoreText'" + builder "$@"