Commit 98e85041 authored by Volker Hilsheimer's avatar Volker Hilsheimer

Rewrite the build-qt job scripts

Operate on a host-checkout of the super repository.

Unify some of the build-qtmodule scripts, still big gap. Generating
qmake/cmake wrappers is not yet implemented in build-qt.
parent 9a6d9837
......@@ -4,106 +4,59 @@ SETLOCAL ENABLEDELAYEDEXPANSION
call \minicoin\util\parse-opts.cmd %*
call \minicoin\util\discover-make.cmd
SET branch=
SET modules=essential
SET repo=git://code.qt.io/qt/qt5.git
SET sources=../qt5
SET build_dir=qt5-build
SET configure=%QTCONFIGFLAGS%
SET generate_qmake=false
SET error=0
if NOT "%PARAM_branch%" == "" (
SET branch=%PARAM_branch%
) else (
if NOT "!JOBDIR!" == "" (
SET origin=!JOBDIR!
if exist !origin! (
SET repo=
SET sources=!origin!
) else (
echo !origin! is not a Qt5 super repo!
goto :eof
)
)
)
if NOT "%PARAM_modules%" == "" (
SET modules=%PARAM_modules%
)
if NOT "%PARAM_configure%" == "" (
SET configure=%PARAM_configure%
)
if NOT "%PARAM_build%" == "" (
SET build_dir=%build_dir%-%PARAM_build%
if NOT DEFINED JOBDIR (
echo Error: path to host clone of Qt is required!
exit /B 1
)
if NOT "!repo!" == "" (
echo Cloning from '!repo!'
if NOT "!branch!" == "" (
echo Checking out '!branch!'
SET branch="--branch !branch!"
)
git clone !branch! !repo!
cd qt5
REM set defaults
if "!PARAM_build!"=="" SET "PARAM_build=qt-build"
SET "build_dir=!PARAM_build!"
if "!PARAM_target!"=="" SET PARAM_target=""
SET "target=!PARAM_target!"
echo Initializing repository for modules '!modules!'
perl init-repository --force --module-subset=!modules!
cd ..
)
SET error=0
if "!modules!" == "essential" (
SET modules=
if DEFINED FLAG_clean (
echo Cleaning existing build in '!build_dir!'
rmdir /S/Q !build_dir!
)
mkdir !build_dir!
if NOT EXIST !build_dir! mkdir !build_dir!
cd !build_dir!
echo Building !JOBDIR! into !build_dir!
if NOT "!configure!" == "" (
if exist "%USERPROFILE%\!configure!.opt" (
SET "config_opt=%USERPROFILE%\!configure!.opt"
)
if EXIST CMakeCache.txt (
echo Already configured with cmake - run with --clean to reconfigure
) else (
SET config_opt="%USERPROFILE%\config.opt"
if EXIST Makefile (
echo Already configured with qmake - run with --clean to reconfigure
) else (
if EXIST %JOBDIR%/CMakeLists.txt (
if "%PARAM_configure%"=="" SET "PARAM_configure=-GNinja -DFEATURE_developer_build=ON -DBUILD_EXAMPLES=OFF"
echo Configuring !JOBDIR! with cmake: !PARAM_configure!
echo Pass --configure "configure options" to override
cmake !PARAM_configure! !JOBDIR!
) else (
if "%PARAM_configure%"=="" SET "PARAM_configure=-developer-build -confirm-license -opensource -nomake examples"
echo Configuring !JOBDIR! with qmake: !PARAM_configure!
echo Pass --configure "configure options" to override
!JOBDIR!/configure !PARAM_configure!
)
)
)
set error=%ERRORLEVEL%
if exist "!config_opt!" (
copy !config_opt! .\config.opt
SET configure=-redo
echo Using configure options from !config_opt!:
type config.opt
if exist build.ninja (
echo Building '!JOBDIR!' using 'ninja !target!'
ninja !target!
set error=%ERRORLEVEL%
) else if exist Makefile (
echo Building '!JOBDIR!' using '!maketool! !target!'
!maketool! !target!
set error=%ERRORLEVEL%
) else (
SET configure=-confirm-license -developer-build -opensource -nomake examples -nomake tests -debug !configure!
)
echo Configuring with options '!configure!'
call !sources!\configure !configure!
if "!modules!" == "" (
%MAKETOOL%
set generate_qmake=true
goto :qmake
)
FOR %%m in (!modules!) do (
echo Building %%m
call %MAKETOOL% module-%%m
if !errorlevel! neq 0 exit /b !errorlevel!
if "%%m" == "qtbase" SET generate_qmake=true
)
:qmake
if "%generate_qmake%" == "true" (
SET "qmake_name=qmake-latest"
if defined PARAM_build (
SET "qmake_name=qmake-!PARAM_build!"
)
del %USERPROFILE%\!qmake-name!.bat
echo %CD%\qtbase\bin\qmake.exe %%* > %USERPROFILE%\!qmake_name!.bat
del %USERPROFILE%\qmake.bat
mklink %USERPROFILE%\qmake.bat %USERPROFILE%\!qmake_name!.bat
>&2 echo "No build system generated, aborting"
)
:eof
exit /B %error%
#!/usr/bin/env bash
. /minicoin/util/parse-opts.sh "$@"
# set defaults
branch=
modules=essential
repo=git://code.qt.io/qt/qt5.git
sources=../qt5 # location of sources relative to build dir
build_dir=qt5-build
configure=
generate_qmake=false
error=0
if [[ $PARAM_branch != "" ]]; then
# branch implies cloning from upstream, a local clone can't be init'ed from
branch=$PARAM_branch
elif [[ $JOBDIR != "" ]]; then
origin=$JOBDIR
if [[ -f $origin/qt.pro ]]; then
repo=
sources=$origin
else
echo "$origin is not a Qt5 super repo - ignoring"
exit 1
fi
fi
if [[ $PARAM_modules != "" ]]; then
modules=$PARAM_modules
fi
if [[ $PARAM_configure != "" ]]; then
configure=$PARAM_configure
if [ -z $JOBDIR ]
then
echo "Error: path to host clone of Qt is required!"
exit 1
fi
if [[ $PARAM_build != "" ]]; then
build_dir=$build_dir-$PARAM_build
fi
if [[ $repo != "" ]]; then
echo "Cloning from '$repo'"
if [[ $branch != "" ]]; then
echo "Checking out branch '$branch'"
branch="--branch $branch"
fi
git clone $branch $repo
error=$?
cd qt5
echo "Initializing repository for modules '$modules'"
./init-repository --force --mirror=$repo/ --module-subset=$modules
error=$? || error
cd ..
fi
# set defaults
build_dir=${PARAM_build:-"qt-build"}
target=$PARAM_target
if [[ ! $error -eq 0 ]]; then
echo "Error cloning and initializing repo!"
exit $error
fi
error=0
if [[ $modules == "essential" ]]; then
modules=
if [ ! -z $FLAG_clean ]
then
echo "Cleaning existing build in '$build_dir'"
rm -rf $build_dir
fi
mkdir $build_dir
[ -d $build_dir ] || mkdir -p $build_dir &> /dev/null
cd $build_dir
if [[ $configure != "" ]]; then
if [[ -f "$HOME/$configure.opt" ]]; then
config_opt=$HOME/$configure.opt
fi
else
config_opt=$HOME/config.opt
fi
if [[ -f $config_opt ]]; then
cp $config_opt ./config.opt
configure="-redo"
echo "Using configure options from $config_opt:"
cat $config_opt
echo "Building $JOBDIR into $build_dir"
if [ -f CMakeCache.txt ]
then
echo "Already configured with cmake - run with --clean to reconfigure"
elif [ -f Makefile ]
then
echo "Already configured with qmake - run with --clean to reconfigure"
elif [ -f $JOBDIR/CMakeLists.txt ]
then
configure=${PARAM_configure:-"-GNinja -DFEATURE_developer_build=ON -DBUILD_EXAMPLES=OFF"}
echo "Configuring with cmake: $configure"
echo "Pass --configure \"configure options\" to override"
cmake $configure $JOBDIR
else
configure="-confirm-license -developer-build -opensource -nomake examples -nomake tests $configure"
configure=${PARAM_configure:-"-developer-build -confirm-license -opensource -nomake examples"}
echo "Configuring with qmake: $configure"
echo "Pass --configure \"configure options\" to override"
$JOBDIR/configure $configure
fi
echo "Configuring with options '$configure'"
$sources/configure $configure
error=$?
if [[ $modules != "" ]]; then
module_array=()
IFS=',' read -r -a module_array <<< "$modules"
for module in "${module_array[@]}"; do
echo "Building $module"
make -j$(nproc) module-$module
error=$?
if [[ $error != 0 ]]; then
exit $error
fi
if [[ $module == "qtbase" ]]; then
generate_qmake=true
fi
done
if [[ -f build.ninja ]]
then
echo "Building '$JOBDIR' using 'ninja $target'"
ninja $target
error=$?
elif [[ -f Makefile ]]
then
echo "Building '$JOBDIR' using 'make $target -j$(nproc)'"
make $target -j$(nproc)
error=$?
else
make -j$(nproc)
generate_qmake=true
>&2 echo "No build system generated, aborting"
fi
if [[ $generate_qmake == "true" ]]; then
qmake_name=qmake-latest
if [[ $PARAM_build != "" ]]; then
qmake_name=qmake-$PARAM_build
fi
rm ~/$qmake_name > /dev/null 2> /dev/null
echo "$PWD/qtbase/bin/qmake \"\$@\"" > ~/$qmake_name
chmod +x ~/$qmake_name
rm ~/qmake > /dev/null 2> /dev/null
ln -s -f ~/$qmake_name ~/qmake
fi
exit $error
......@@ -4,16 +4,16 @@ SETLOCAL ENABLEDELAYEDEXPANSION
call c:\minicoin\util\parse-opts.cmd %*
call c:\minicoin\util\discover-make.cmd
if NOT DEFINED !JOBDIR! (
echo Error: path to host clone of Qt module is required!
exit /B 1
)
set build=
set generate_qmake=false
set configure=
set target=
if "!JOBDIR!" == "" (
echo Error: path to host clone of Qt module is required!
exit /B 1
)
set "sources=!JOBDIR!"
set module=
for %%F in ("%sources%") do (
......@@ -48,30 +48,36 @@ echo Building %module% from %sources%
if exist CMakeCache.txt (
echo '%module%' already configured with cmake
) else if exist Makefile (
echo '%module%' already configured with qmake
) else if "%module%" == "qtbase" (
set "generate_toollink=qmake"
set "configure=-confirm-license -developer-build -opensource -nomake examples -debug !configure!"
if exist %sources%\CMakeLists.txt (
set "generate_toollink=!generate_toollink! qt-cmake"
set "configure=!configure! -cmake -cmake-generator Ninja"
) else (
if exist Makefile (
echo '%module%' already configured with qmake
) else (
set "configure=!configure! %QTCONFIGFLAGS%"
if "%module%" == "qtbase" (
set "generate_toollink=qmake"
set "configure=-confirm-license -developer-build -opensource -nomake examples -debug !configure!"
if exist %sources%\CMakeLists.txt (
set "generate_toollink=!generate_toollink! qt-cmake"
set "configure=!configure! -cmake -cmake-generator Ninja"
) else (
set "configure=!configure! %QTCONFIGFLAGS%"
)
echo Calling '%sources%\configure !configure!'
call %sources%\configure.bat !configure!
) else (
if exist %sources%\CMakeLists.txt (
echo Generating cmake build for '%module%' for '%MAKETOOL%'
set generator=
if not "%NINJA%" == "" (
set "generator=-GNinja"
set MAKETOOL=%NINJA%
)
call %USERPROFILE%\bin\qt-cmake %sources% !generator!
) else (
echo Generating qmake build for '%module%'
call %USERPROFILE%\bin\qmake %sources%
)
)
)
echo Calling '%sources%\configure !configure!'
call %sources%\configure.bat !configure!
) else if exist %sources%\CMakeLists.txt (
echo Generating cmake build for '%module%' for '%MAKETOOL%'
set generator=
if not "%NINJA%" == "" (
set "generator=-GNinja"
set MAKETOOL=%NINJA%
)
call %USERPROFILE%\bin\qt-cmake %sources% !generator!
) else (
echo Generating qmake build for '%module%'
call %USERPROFILE%\bin\qmake %sources%
)
for %%T in ( %generate_toollink% ) do (
......@@ -103,9 +109,14 @@ if exist build.ninja (
)
echo Building '!target!' using '!ninja!'
call !ninja! !target!
) else if exist Makefile (
if "%target%" == "" set "target=sub-src"
echo Building '!target!' using '!MAKETOOL!'
call !MAKETOOL! "!target!"
) else (
if exist Makefile (
if "%target%" == "" set "target=sub-src"
echo Building '!target!' using '!MAKETOOL!'
call !MAKETOOL! "!target!"
) else (
echo No build system geneated, aborting
EXIT /B 1
)
)
EXIT /B %ERRORLEVEL%
......@@ -2,6 +2,12 @@
. /minicoin/util/parse-opts.sh "$@"
if [ -z $JOBDIR ]
then
echo "Error: path to host clone of Qt is required!"
exit 1
fi
if [[ $XAUTH_FILE != "" ]]
then
# make sure we are logged in
......@@ -9,18 +15,12 @@ then
XAUTHORITY=$XAUTH_FILE sudo xdotool key --clearmodifiers Return
fi
# set defaults
build=
configure=
generate_toollink=()
target=
if [[ $JOBDIR == "" ]]; then
echo "Error: path to host clone of Qt module is required!"
exit 1
fi
sources=$JOBDIR
module=$(basename -s .pro $(ls $sources/*.pro))
if [[ $(echo $module | wc -w) != 1 ]]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment