Skip to content

Commit

Permalink
Merge pull request #819 from MediaArea/build
Browse files Browse the repository at this point in the history
Update build scripts
  • Loading branch information
dericed authored Jul 17, 2024
2 parents 434c65b + eb24f1b commit 6a30968
Show file tree
Hide file tree
Showing 20 changed files with 619 additions and 155 deletions.
13 changes: 0 additions & 13 deletions Project/BuildAllFromSource/build
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,11 @@ elif qmake-qt5 --version >/dev/null 2>&1 ; then
BINQMAKE=qmake-qt5
elif qmake5 --version >/dev/null 2>&1 ; then
BINQMAKE=qmake5
elif qmake-qt4 --version >/dev/null 2>&1 ; then
BINQMAKE=qmake-qt4
elif qmake4 --version >/dev/null 2>&1 ; then
BINQMAKE=qmake4
elif $HOME/Qt/5.3/clang_64/bin/qmake --version >/dev/null 2>&1 ; then
BINQMAKE=$HOME/Qt/5.3/clang_64/bin/qmake
elif $HOME/Qt/5.4/clang_64/bin/qmake --version >/dev/null 2>&1 ; then
BINQMAKE=$HOME/Qt/5.3/clang_64/bin/qmake
else
echo qmake not found
exit
fi

if [ ! $(which cmake) ] ; then
echo cmake not found
exit
fi

SCRIPT_DIR=$(cd $(dirname "$0") && pwd)
echo "SCRIPT_DIR: " + $SCRIPT_DIR

Expand Down
108 changes: 63 additions & 45 deletions Project/BuildAllFromSource/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,25 @@ rem ****************************************************************************
rem * build.bat - Batch script for building Windows version of QCTools *
rem * *
rem *Script requirements: *
rem * - Microsoft Visual Studio 2015 at the default place *
rem * - Microsoft Visual Studio 2019 at the default place *
rem * - qctools_AllInclusive source tree *
rem * - Qt binaries tree corresponding to the requested build type (static or shared, x86 or x64) *
rem * in ..\..\..\Qt *
rem * - Qt bin directory corresponding to the requested build type (static or shared, x86 or x64) *
rem * in the PATH *
rem * - Cygwin directory with bash, sed, make and diffutils in the PATH *
rem * - yasm.exe in the PATH if not provided by Cygwin *
rem * Options: *
rem * - /static - build statically linked binary *
rem * - /target x86|x64 - target arch (default x86) *
rem * - /nogui - build only qcli *
rem * - /prebuild_ffmpeg - assume that ffmpeg is already builds *
rem ***********************************************************************************************

rem *** Init ***
set ARCH=x86
set STATIC=
set NOGUI=
set NO_BUILD_FFMPEG=
set QMAKEOPTS=

set OLD_CD="%CD%"
set OLD_PATH=%PATH%
Expand All @@ -32,6 +37,8 @@ rem *** Parse command line ***
:cmdline
if not "%1"=="" (
if /I "%1"=="/static" set STATIC=1
if /I "%1"=="/nogui" set NOGUI=1
if /I "%1"=="/prebuild_ffmpeg" set NO_BUILD_FFMPEG=1
if /I "%1"=="/target" (
set ARCH=%2
shift
Expand All @@ -45,67 +52,78 @@ if not "%ARCH%"=="x86" if not "%ARCH%"=="x64" (
goto:clean
)

if "%ARCH%"=="x86" set PLATFORM=Win32
if "%ARCH%"=="x64" set PLATFORM=x64

rem *** Get VC tools path ***
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %ARCH%

rem *** Build zlib ***
if "%ARCH%"=="x86" (
cd "%BUILD_DIR%\zlib\contrib\masmx86"
del *.obj *.lst
rem sed from cygwin
sed -i "s/ml \/coff/ml \/safeseh \/coff/g" bld_ml32.bat
call bld_ml32.bat
) else (
cd "%BUILD_DIR%\zlib\contrib\masmx64"
del *.obj *.lst
call bld_ml64.bat
)

cd "%BUILD_DIR%\zlib\contrib\vstudio\vc14"
if defined STATIC (
sed -i "s/>MultiThreadedDLL</>MultiThreaded</g" zlibstat.vcxproj
) else (
sed -i "s/>MultiThreaded</>MultiThreadedDLL</g" zlibstat.vcxproj
set QMAKEOPTS=STATIC^=1
)

MSBuild zlibstat.vcxproj /t:Clean;Build /p:Configuration=Release;Platform=%PLATFORM%
rem *** Get VC tools path ***
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%

rem *** Build ffmpeg ***
cd "%BUILD_DIR%\ffmpeg"
if "%ARCH%"=="x86" set PLATFORM=Win32
if "%ARCH%"=="x64" set PLATFORM=x64

set FFMPEG_CMDLINE=--prefix^=. --enable-gpl --enable-version3 --toolchain^=msvc
set FFMPEG_CMDLINE=--prefix^=. --disable-programs --enable-gpl --enable-version3 --toolchain^=msvc
set FFMPEG_CMDLINE=%FFMPEG_CMDLINE% --disable-securetransport --disable-videotoolbox
set FFMPEG_CMDLINE=%FFMPEG_CMDLINE% --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --disable-debug
set FFMPEG_CMDLINE=%FFMPEG_CMDLINE% --disable-doc --disable-debug
set FFMPEG_CMDLINE=%FFMPEG_CMDLINE% --enable-libfreetype --extra-cflags^=-I../freetype/include

set FFMPEG_CMDLINE=%FFMPEG_CMDLINE% --extra-libs^=../freetype/objs/%PLATFORM%/ReleaseStatic/freetype.lib

if defined STATIC (
set FFMPEG_CMDLINE=%FFMPEG_CMDLINE% --enable-static --disable-shared
) else (
set FFMPEG_CMDLINE=%FFMPEG_CMDLINE% --enable-shared --disable-static
)

if exist Makefile bash --login -c "make clean uninstall"
bash --login -c "./configure %FFMPEG_CMDLINE%"
bash --login -c "make install"
if not defined NO_BUILD_FFMPEG (
rem *** Build freetype ***
cd "%BUILD_DIR%\freetype\builds\windows\vc2010"
devenv /upgrade freetype.vcxproj
MSBuild /t:Clean;Build /p:Configuration="Release Static";Platform=%PLATFORM%

cd "%BUILD_DIR%\freetype"
move /Y "objs\%PLATFORM%\Release Static" "objs\%PLATFORM%\ReleaseStatic"

rem *** Build ffmpeg ***
cd "%BUILD_DIR%\ffmpeg"
if exist Makefile bash --login -c "make clean uninstall"
if exist lib bash --login -c "rm -f lib/*.lib"
bash --login -c "./configure %FFMPEG_CMDLINE%"
bash --login -c "make install"

if defined STATIC forfiles /S /M *.a /C "cmd /c rename @file ///*.lib"
)

rem *** Build qwt ***
cd "%BUILD_DIR%\qwt"
rem TODO: Make dynamically linked version of QWT work
if exist Makefile nmake clean

..\Qt\bin\qmake -recursive
nmake Release
if not defined NOGUI (
rem TODO: Make dynamically linked version of QWT work
if exist Makefile nmake distclean
set QWT_STATIC=1
set QWT_NO_SVG=1
set QWT_NO_OPENGL=1
set QWT_NO_DESIGNER=1
qmake -recursive
nmake Release
)

rem *** Build QCTools ***
cd "%BUILD_DIR%\qctools\Project\MSVC2015\GUI"
call qt_update.bat
rmdir /S /Q "%BUILD_DIR%\qctools\Project\QtCreator\build"
mkdir "%BUILD_DIR%\qctools\Project\QtCreator\build"
cd "%BUILD_DIR%\qctools\Project\QtCreator\build"

cd "%BUILD_DIR%\qctools\Project\MSVC2015"
if defined STATIC (
MSBuild /t:Clean;Build /p:Configuration=StaticRelease;Platform=%PLATFORM%
qmake %QMAKEOPTS% DEFINES+=QT_AVPLAYER_MULTIMEDIA QMAKE_CXXFLAGS+=/Zi QMAKE_LFLAGS+=/INCREMENTAL:NO QMAKE_LFLAGS+=/Debug ..
if not defined NOGUI (
nmake
) else (
MSBuild /t:Clean;Build /p:Configuration=Release;Platform=%PLATFORM%
nmake sub-qctools-cli
)

if not defined STATIC (
windeployqt qctools-gui/release/QtAVPlayer.dll
windeployqt qctools-gui/release/QCTools.exe

windeployqt qctools-cli/release/qcli.exe
)

rem *** Cleaning ***
Expand Down
17 changes: 7 additions & 10 deletions Project/BuildAllFromSource/build_qctools.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
cd qctools/Project/QtCreator
if sw_vers >/dev/null 2>&1 ; then
#Qt 5.2 can not well detect the platform version for 10.9 then FFmpeg static link fails
MAJOR_MAC_VERSION=$(sw_vers -productVersion | awk -F '.' '{print $1 "." $2}')
$BINQMAKE QMAKE_MAC_SDK=macosx$MAJOR_MAC_VERSION
else
$BINQMAKE
fi
rm -fr qctools/Project/QtCreator/build
mkdir qctools/Project/QtCreator/build
pushd qctools/Project/QtCreator/build >/dev/null 2>&1
$BINQMAKE .. DEFINES+=QT_AVPLAYER_MULTIMEDIA
sed -i'' 's/-framework QtAVPlayer//g' qctools-gui/Makefile.*
make
cd ../../..
popd >/dev/null 2>&1

echo QCTools binary is in qctools/Project/QtCreator
echo QCTools binary is in qctools/Project/QtCreator/build/qctools-gui
12 changes: 11 additions & 1 deletion Project/BuildAllFromSource/init.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#! /bin/bash

if qmake --version >/dev/null 2>&1 ; then
BINQMAKE=qmake
elif qmake-qt5 --version >/dev/null 2>&1 ; then
BINQMAKE=qmake-qt5
elif qmake5 --version >/dev/null 2>&1 ; then
BINQMAKE=qmake5
else
echo qmake not found
exit
fi

echo "PWD: " + $PWD

START_DIR=$(cd $(dirname "$0") && pwd)
Expand All @@ -10,5 +21,4 @@ echo "SCRIPT_DIR: " + $SCRIPT_DIR
echo "INSTALL_DIR: " + $INSTALL_DIR
echo "START_DIR: " + $START_DIR

BINQMAKE=qmake
echo "BINQMAKE: " + $BINQMAKE
96 changes: 66 additions & 30 deletions Project/BuildAllFromSource/init_ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,91 @@
echo "PWD: " + $PWD

_install_yasm(){
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar -zxvf yasm-1.3.0.tar.gz
rm yasm-1.3.0.tar.gz
wget -q http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar -zxf yasm-1.3.0.tar.gz
mv yasm-1.3.0 yasm
}

if [ ! -d ffmpeg ] ; then
git clone --depth 1 git://source.ffmpeg.org/ffmpeg.git ffmpeg
fi

cd ffmpeg
FFMPEG_CONFIGURE_OPTS=(--enable-gpl --enable-version3 --disable-securetransport --disable-videotoolbox --enable-shared --disable-static --disable-doc --disable-ffplay --disable-ffprobe --disable-debug --disable-lzma --disable-iconv --enable-pic)
if [ ! -d freetype ] ; then
curl -LO https://download.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.bz2
tar -xf freetype-2.10.0.tar.bz2
mv freetype-2.10.0 freetype
fi

if sw_vers >/dev/null 2>&1 ; then
FFMPEG_CONFIGURE_OPTS+=(--extra-cflags="-mmacosx-version-min=10.8" --extra-ldflags="-mmacosx-version-min=10.8")
fi
if [ ! -d harfbuzz ] ; then
curl -LO https://github.com/harfbuzz/harfbuzz/releases/download/8.2.2/harfbuzz-8.2.2.tar.xz
tar -Jxf harfbuzz-8.2.2.tar.xz
rm harfbuzz-8.2.2.tar.xz
mv harfbuzz-8.2.2 harfbuzz
fi

chmod u+x configure
chmod u+x version.sh
if yasm --version >/dev/null 2>&1 ; then
echo "FFMPEG_CONFIGURE_OPTS = ${FFMPEG_CONFIGURE_OPTS[@]}"
./configure "${FFMPEG_CONFIGURE_OPTS[@]}"
if [ "$?" -ne 0 ] ; then #on some distro, yasm version is too old
cd "$INSTALL_DIR"
if [ ! -d yasm ] ; then
_install_yasm
fi
cd yasm/
./configure --prefix=`pwd`/usr
make
make install
cd "${INSTALL_DIR}/ffmpeg"
FFMPEG_CONFIGURE_OPTS+=(--x86asmexe=../yasm/usr/bin/yasm)
echo "FFMPEG_CONFIGURE_OPTS = ${FFMPEG_CONFIGURE_OPTS[@]}"
./configure "${FFMPEG_CONFIGURE_OPTS[@]}"
fi
else
cd freetype
chmod u+x configure
if sw_vers >/dev/null 2>&1 ; then
./configure --prefix="$(pwd)/usr" --without-harfbuzz --without-zlib --without-bzip2 --without-png --enable-static --disable-shared CFLAGS=-mmacosx-version-min=10.12 LDFLAGS=-mmacosx-version-min=10.12
else
./configure --prefix="$(pwd)/usr" --without-harfbuzz --without-zlib --without-bzip2 --without-png --enable-static --disable-shared
fi
make
make install
cd ..

cd harfbuzz
mkdir build
cd build
if sw_vers >/dev/null 2>&1 ; then
CFLAGS=-mmacosx-version-min=10.12 LDFLAGS=-mmacosx-version-min=10.12 PKG_CONFIG_PATH=$PWD/../../freetype/usr/lib/pkgconfig meson setup --prefix $(pwd)/../usr --default-library=static -Dglib=disabled -Dgobject=disabled -Dcairo=disabled -Dchafa=disabled -Dicu=disabled -Dgraphite=disabled -Dgraphite2=disabled -Dgdi=disabled -Ddirectwrite=disabled -Dcoretext=disabled -Dwasm=disabled -Dtests=disabled -Dintrospection=disabled -Ddocs=disabled -Ddoc_tests=false -Dutilities=disabled ..
else
PKG_CONFIG_PATH=$PWD/../../freetype/usr/lib/pkgconfig meson setup --prefix $(pwd)/../usr --default-library=static -Dglib=disabled -Dgobject=disabled -Dcairo=disabled -Dchafa=disabled -Dicu=disabled -Dgraphite=disabled -Dgraphite2=disabled -Dgdi=disabled -Ddirectwrite=disabled -Dcoretext=disabled -Dwasm=disabled -Dtests=disabled -Dintrospection=disabled -Ddocs=disabled -Ddoc_tests=false -Dutilities=disabled ..
fi
ninja
ninja install
cd ..
cd ..

cd ffmpeg
FFMPEG_CONFIGURE_OPTS=(--enable-gpl --enable-version3 --disable-autodetect --disable-programs --disable-securetransport --disable-videotoolbox --enable-static --disable-shared --disable-doc --disable-debug --disable-lzma --disable-iconv --enable-pic --prefix="$(pwd)" --enable-libfreetype --enable-libharfbuzz --extra-cflags="-I../freetype/usr/include/freetype2" --extra-cflags="-I../harfbuzz/usr/include/harfbuzz" --extra-libs="../freetype/usr/lib/libfreetype.a" --extra-libs="../harfbuzz/usr/lib/libharfbuzz.a")
if sw_vers >/dev/null 2>&1 ; then
FFMPEG_CONFIGURE_OPTS+=(--extra-cflags="-mmacosx-version-min=10.12" --extra-ldflags="-mmacosx-version-min=10.12")
fi

chmod u+x configure
chmod u+x version.sh
if yasm --version >/dev/null 2>&1 ; then
echo "FFMPEG_CONFIGURE_OPTS = ${FFMPEG_CONFIGURE_OPTS[@]}"
./configure "${FFMPEG_CONFIGURE_OPTS[@]}"
if [ "$?" -ne 0 ] ; then #on some distro, yasm version is too old
cd "$INSTALL_DIR"
if [ ! -d yasm ] ; then
_install_yasm
fi
cd yasm/
./configure --prefix=`pwd`/usr
./configure --prefix="$(pwd)/usr"
make
make install
cd "${INSTALL_DIR}/ffmpeg"
FFMPEG_CONFIGURE_OPTS+=(--x86asmexe=../yasm/usr/bin/yasm)
echo "FFMPEG_CONFIGURE_OPTS = ${FFMPEG_CONFIGURE_OPTS[@]}"
./configure "${FFMPEG_CONFIGURE_OPTS[@]}"
fi
make
else
cd "$INSTALL_DIR"
if [ ! -d yasm ] ; then
_install_yasm
fi
cd yasm/
./configure --prefix=`pwd`/usr
make
make install
cd "${INSTALL_DIR}/ffmpeg"
FFMPEG_CONFIGURE_OPTS+=(--x86asmexe=../yasm/usr/bin/yasm)
echo "FFMPEG_CONFIGURE_OPTS = ${FFMPEG_CONFIGURE_OPTS[@]}"
./configure "${FFMPEG_CONFIGURE_OPTS[@]}"
fi
make
make install
cd "$INSTALL_DIR"
9 changes: 5 additions & 4 deletions Project/BuildAllFromSource/init_qwt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
echo "PWD: " + $PWD

if [ ! -d qwt ] ; then
wget https://github.com/ElderOrb/qwt/archive/v6.1.5.zip
unzip v6.1.5.zip
mv qwt-6.1.5 qwt
rm v6.1.5.zip
wget wget -q https://github.com/ElderOrb/qwt/archive/master.zip
unzip master.zip
mv qwt-master qwt
rm master.zip
fi
cd qwt
export QWT_STATIC=1 QWT_NO_SVG=1 QWT_NO_OPENGL=1 QWT_NO_DESIGNER=1
$BINQMAKE
make
cd "$INSTALL_DIR"
Loading

0 comments on commit 6a30968

Please # to comment.