diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
commit | c04dcc2e7d834218ef2d4194331e383402495ae1 (patch) | |
tree | 7333e38d10d75386e60f336b80c2443c1166031d /tools/buildsteps/windows | |
parent | Initial commit. (diff) | |
download | kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip |
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/buildsteps/windows')
56 files changed, 2363 insertions, 0 deletions
diff --git a/tools/buildsteps/windows/BuildSetup.bat b/tools/buildsteps/windows/BuildSetup.bat new file mode 100644 index 0000000..6d2180a --- /dev/null +++ b/tools/buildsteps/windows/BuildSetup.bat @@ -0,0 +1,300 @@ +@ECHO OFF +REM setup all paths +PUSHD %~dp0\..\..\.. +SET base_dir=%CD% +POPD + +REM read the version values from version.txt +FOR /f "tokens=1,*" %%i IN (%base_dir%\version.txt) DO SET %%i=%%j + +SET APP_VERSION=%VERSION_MAJOR%.%VERSION_MINOR% +IF NOT [%VERSION_TAG%] == [] ( + SET APP_VERSION=%APP_VERSION%-%VERSION_TAG% +) + +rem ----Usage---- +rem BuildSetup [clean|noclean] [noprompt] [nobinaryaddons] [sh] +rem clean to force a full rebuild +rem noclean to force a build without clean +rem noprompt to avoid all prompts +rem nobinaryaddons to skip building binary addons +rem sh to use sh shell instead rxvt +CLS +TITLE %APP_NAME% for Windows Build Script +rem ----PURPOSE---- +rem - Create a working application build with a single click +rem ------------------------------------------------------------- +rem Config +rem If you get an error that Visual studio was not found, SET your path for VSNET main executable. +rem ------------------------------------------------------------- +rem CONFIG START +SET buildmode=ask +SET promptlevel=prompt +SET buildbinaryaddons=true +SET exitcode=0 +SET useshell=rxvt +FOR %%b in (%*) DO ( + IF %%b==clean SET buildmode=clean + IF %%b==noclean SET buildmode=noclean + IF %%b==noprompt SET promptlevel=noprompt + IF %%b==nobinaryaddons SET buildbinaryaddons=false + IF %%b==sh SET useshell=sh +) + +SET PreferredToolArchitecture=x64 +SET buildconfig=Release +set WORKSPACE=%base_dir%\kodi-build.%TARGET_PLATFORM% + + + :: sets the BRANCH env var + FOR /f %%a IN ('getbranch.bat') DO SET BRANCH=%%a + + rem CONFIG END + rem ------------------------------------------------------------- + goto COMPILE_CMAKE_EXE + +:COMPILE_CMAKE_EXE + ECHO Wait while preparing the build. + ECHO ------------------------------------------------------------ + ECHO Compiling %APP_NAME% branch %BRANCH%... + + IF %buildmode%==clean ( + RMDIR /S /Q %WORKSPACE% + ) + MKDIR %WORKSPACE% + PUSHD %WORKSPACE% + + cmake.exe -G "%cmakeGenerator%" -A %cmakeArch% -T host=x64 %cmakeProps% %base_dir% + IF %errorlevel%==1 ( + set DIETEXT="%APP_NAME%.EXE failed to build!" + goto DIE + ) + + cmake.exe --build . --config "%buildconfig%" + IF %errorlevel%==1 ( + set DIETEXT="%APP_NAME%.EXE failed to build!" + goto DIE + ) + + set EXE="%WORKSPACE%\%buildconfig%\%APP_NAME%.exe" + set PDB="%WORKSPACE%\%buildconfig%\%APP_NAME%.pdb" + set D3D="%WORKSPACE%\D3DCompile*.DLL" + + POPD + ECHO Done! + ECHO ------------------------------------------------------------ + IF "%cmakeProps%" NEQ "" GOTO MAKE_APPX + GOTO MAKE_BUILD_EXE + + +:MAKE_BUILD_EXE + ECHO Copying files... + PUSHD %base_dir%\project\Win32BuildSetup + IF EXIST BUILD_WIN32\application rmdir BUILD_WIN32\application /S /Q + rem Add files to exclude.txt that should not be included in the installer + + Echo Thumbs.db>>exclude.txt + Echo Desktop.ini>>exclude.txt + Echo dsstdfx.bin>>exclude.txt + Echo exclude.txt>>exclude.txt + Echo xbmc.log>>exclude.txt + Echo xbmc.old.log>>exclude.txt + Echo kodi.log>>exclude.txt + Echo kodi.old.log>>exclude.txt + Echo .so\>>exclude.txt + Echo .h\>>exclude.txt + Echo .cpp\>>exclude.txt + Echo .exp\>>exclude.txt + Echo .lib\>>exclude.txt + rem Exclude userdata files + Echo userdata\advancedsettings.xml>>exclude.txt + Echo userdata\guisettings.xml>>exclude.txt + Echo userdata\mediasources.xml>>exclude.txt + Echo userdata\ModeLines_template.xml>>exclude.txt + Echo userdata\passwords.xml>>exclude.txt + Echo userdata\profiles.xml>>exclude.txt + Echo userdata\sources.xml>>exclude.txt + Echo userdata\upnpserver.xml>>exclude.txt + rem Exclude userdata folders + Echo userdata\addon_data\>>exclude.txt + Echo userdata\cache\>>exclude.txt + Echo userdata\database\>>exclude.txt + Echo userdata\playlists\>>exclude.txt + Echo userdata\thumbnails\>>exclude.txt + + rem Exclude dlls from system to avoid duplicates + Echo .dll>>exclude_dll.txt + + md BUILD_WIN32\application + + xcopy %EXE% BUILD_WIN32\application > NUL + xcopy %D3D% BUILD_WIN32\application > NUL + xcopy %base_dir%\userdata BUILD_WIN32\application\userdata /E /Q /I /Y /EXCLUDE:exclude.txt > NUL + copy %base_dir%\LICENSE.md BUILD_WIN32\application > NUL + copy %base_dir%\privacy-policy.txt BUILD_WIN32\application > NUL + copy %base_dir%\known_issues.txt BUILD_WIN32\application > NUL + + xcopy %WORKSPACE%\addons BUILD_WIN32\application\addons /E /Q /I /Y /EXCLUDE:exclude.txt > NUL + xcopy %WORKSPACE%\*.dll BUILD_WIN32\application /Q /I /Y > NUL + xcopy %WORKSPACE%\libbluray-*.jar BUILD_WIN32\application /Q /I /Y > NUL + xcopy %WORKSPACE%\system BUILD_WIN32\application\system /E /Q /I /Y /EXCLUDE:exclude.txt+exclude_dll.txt > NUL + xcopy %WORKSPACE%\media BUILD_WIN32\application\media /E /Q /I /Y /EXCLUDE:exclude.txt > NUL + + REM create AppxManifest.xml + @PowerShell "(GC .\AppxManifest.xml.in)|%%{$_" ^ + " -Replace '@APP_NAME@', '%APP_NAME%'" ^ + " -Replace '@COMPANY_NAME@', '%COMPANY_NAME%'" ^ + " -Replace '@TARGET_ARCHITECTURE@', '%TARGET_ARCHITECTURE%'" ^ + " -Replace '@VERSION_CODE@', '%VERSION_CODE%'" ^ + " -Replace '@PACKAGE_IDENTITY@', '%PACKAGE_IDENTITY%'" ^ + " -Replace '@PACKAGE_PUBLISHER@', '%PACKAGE_PUBLISHER%'" ^ + " -Replace '@PACKAGE_DESCRIPTION@', '%PACKAGE_DESCRIPTION%'" ^ + "}|SC .\BUILD_WIN32\application\AppxManifest.xml" + + SET build_path=%CD% + IF %buildbinaryaddons%==true ( + ECHO ------------------------------------------------------------ + ECHO Building addons... + cd %base_dir%\tools\buildsteps\windows + IF %buildmode%==clean ( + call make-addons.bat clean + ) + call make-addons.bat + IF %errorlevel%==1 ( + set DIETEXT="failed to build addons" + cd %build_path% + goto DIE + ) + + cd %build_path% + IF EXIST error.log del error.log > NUL + ) + + rem restore title, some scripts mess these up + TITLE %APP_NAME% for Windows Build Script + + IF EXIST exclude.txt del exclude.txt > NUL + IF EXIST exclude_dll.txt del exclude_dll.txt > NUL + POPD + + ECHO ------------------------------------------------------------ + ECHO Build Succeeded! + GOTO NSIS_EXE + +:NSIS_EXE + ECHO ------------------------------------------------------------ + ECHO Generating installer includes... + PUSHD %base_dir%\project\Win32BuildSetup + call genNsisIncludes.bat + ECHO ------------------------------------------------------------ + call getdeploydependencies.bat + CALL extract_git_rev.bat > NUL + SET APP_SETUPFILE=%APP_NAME%Setup-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.exe + SET APP_PDBFILE=%APP_NAME%Setup-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.pdb + ECHO Creating installer %APP_SETUPFILE%... + IF EXIST %APP_SETUPFILE% del %APP_SETUPFILE% > NUL + + rem determine if current system is 32 or 64 bits + SET HOST_BITS=32 + IF %PROCESSOR_ARCHITECTURE% == AMD64 SET HOST_BITS=64 + IF %PROCESSOR_ARCHITECTURE% == ARM64 SET HOST_BITS=64 + + IF %HOST_BITS% == 64 ( + SET NSIS_REG_KEY=HKLM\Software\Wow6432Node\NSIS + ) ELSE ( + SET NSIS_REG_KEY=HKLM\Software\NSIS + ) + + rem get path to makensis.exe from registry, first try tab delim + FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "%NSIS_REG_KEY%" /ve') DO SET NSISExePath=%%B + + IF NOT EXIST "%NSISExePath%" ( + rem try with space delim instead of tab + FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "%NSIS_REG_KEY%" /ve') DO SET NSISExePath=%%B + ) + + IF NOT EXIST "%NSISExePath%" ( + rem fails on localized windows (Default) becomes (Par D�faut) + FOR /F "tokens=3* delims= " %%A IN ('REG QUERY "%NSIS_REG_KEY%" /ve') DO SET NSISExePath=%%B + ) + + IF NOT EXIST "%NSISExePath%" ( + FOR /F "tokens=3* delims= " %%A IN ('REG QUERY "%NSIS_REG_KEY%" /ve') DO SET NSISExePath=%%B + ) + + SET NSISExe=%NSISExePath%\makensis.exe + "%NSISExe%" /V1 /X"SetCompressor /FINAL lzma" /Dapp_root="%CD%\BUILD_WIN32" /DAPP_NAME="%APP_NAME%" /DTARGET_ARCHITECTURE="%TARGET_ARCHITECTURE%" /DVERSION_NUMBER="%VERSION_CODE%.0" /DCOMPANY_NAME="%COMPANY_NAME%" /DWEBSITE="%WEBSITE%" /Dapp_revision="%GIT_REV%" /Dapp_branch="%BRANCH%" /D%TARGET_ARCHITECTURE% "genNsisInstaller.nsi" + IF NOT EXIST "%APP_SETUPFILE%" ( + POPD + set DIETEXT=Failed to create %APP_SETUPFILE%. NSIS installed? + goto DIE + ) + copy %PDB% %APP_PDBFILE% > nul + ECHO ------------------------------------------------------------ + ECHO Done! + ECHO Setup is located at %CD%\%APP_SETUPFILE% + ECHO ------------------------------------------------------------ + POPD + GOTO END + +:MAKE_APPX + set app_ext=msix + set app_path=%base_dir%\project\UWPBuildSetup + if not exist "%app_path%" mkdir %app_path% + call %base_dir%\project\Win32BuildSetup\extract_git_rev.bat > NUL + for /F %%a IN ('dir /B /S %WORKSPACE%\AppPackages ^| findstr /I /R "%APP_NAME%_.*_%TARGET_ARCHITECTURE%_%buildconfig%\.%app_ext%$"') DO ( + copy /Y %%a %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.%app_ext% + copy /Y %%~dpna.cer %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.cer + copy /Y %%~dpna.appxsym %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.appxsym + goto END_APPX + ) + rem Release builds don't have Release in it's name + for /F %%a IN ('dir /B /S %WORKSPACE%\AppPackages ^| findstr /I /R "%APP_NAME%_.*_%TARGET_ARCHITECTURE%\.%app_ext%$"') DO ( + copy /Y %%a %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.%app_ext% + copy /Y %%~dpna.cer %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.cer + copy /Y %%~dpna.appxsym %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.appxsym + goto END_APPX + ) + + rem apxx file has win32 instead of x86 in it's name + if %TARGET_ARCHITECTURE%==x86 ( + for /F %%a IN ('dir /B /S %WORKSPACE%\AppPackages ^| findstr /I /R "%APP_NAME%_.*_win32_%buildconfig%\.%app_ext%$"') DO ( + copy /Y %%a %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.%app_ext% + copy /Y %%~dpna.cer %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.cer + copy /Y %%~dpna.appxsym %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.appxsym + goto END_APPX + ) + + rem Release builds don't have Release in it's name + for /F %%a IN ('dir /B /S %WORKSPACE%\AppPackages ^| findstr /I /R "%APP_NAME%_.*_win32\.%app_ext%$"') DO ( + copy /Y %%a %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.%app_ext% + copy /Y %%~dpna.cer %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.cer + copy /Y %%~dpna.appxsym %app_path%\%APP_NAME%-%GIT_REV%-%BRANCH%-%TARGET_ARCHITECTURE%.appxsym + goto END_APPX + ) + ) + +:END_APPX + ECHO ------------------------------------------------------------ + ECHO Done! + ECHO Setup is located at %app_path% + ECHO ------------------------------------------------------------ + GOTO END + +:DIE + ECHO ------------------------------------------------------------ + ECHO !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!- + ECHO ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR + ECHO !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!- + set DIETEXT=ERROR: %DIETEXT% + echo %DIETEXT% + SET exitcode=1 + ECHO ------------------------------------------------------------ + GOTO END + +:END + IF %promptlevel% NEQ noprompt ( + ECHO Press any key to exit... + pause > NUL + ) + EXIT /B %exitcode% diff --git a/tools/buildsteps/windows/arm-uwp/BuildSetup.bat b/tools/buildsteps/windows/arm-uwp/BuildSetup.bat new file mode 100644 index 0000000..8fd6e03 --- /dev/null +++ b/tools/buildsteps/windows/arm-uwp/BuildSetup.bat @@ -0,0 +1,19 @@ +@ECHO OFF + +PUSHD %~dp0\.. + +CALL vswhere.bat arm store +IF ERRORLEVEL 1 ( + ECHO ERROR! BuildSetup.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) + +SET cmakeGenerator=Visual Studio %vsver% +SET cmakeArch=ARM +SET TARGET_ARCHITECTURE=arm +SET TARGET_PLATFORM=%TARGET_ARCHITECTURE%-uwp +SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion% + +CALL BuildSetup.bat %* +POPD diff --git a/tools/buildsteps/windows/arm-uwp/bootstrap-addons.bat b/tools/buildsteps/windows/arm-uwp/bootstrap-addons.bat new file mode 100644 index 0000000..0e672f0 --- /dev/null +++ b/tools/buildsteps/windows/arm-uwp/bootstrap-addons.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat arm store +IF ERRORLEVEL 1 ( + ECHO ERROR! bootstrap-addons.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL bootstrap-addons %* +POPD diff --git a/tools/buildsteps/windows/arm-uwp/download-dependencies.bat b/tools/buildsteps/windows/arm-uwp/download-dependencies.bat new file mode 100644 index 0000000..36b23ff --- /dev/null +++ b/tools/buildsteps/windows/arm-uwp/download-dependencies.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL download-dependencies.bat win10-arm +POPD diff --git a/tools/buildsteps/windows/arm-uwp/download-msys2.bat b/tools/buildsteps/windows/arm-uwp/download-msys2.bat new file mode 100644 index 0000000..8c041ba --- /dev/null +++ b/tools/buildsteps/windows/arm-uwp/download-msys2.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL download-msys2.bat %* +POPD diff --git a/tools/buildsteps/windows/arm-uwp/make-addons.bat b/tools/buildsteps/windows/arm-uwp/make-addons.bat new file mode 100644 index 0000000..6c23384 --- /dev/null +++ b/tools/buildsteps/windows/arm-uwp/make-addons.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat arm store +IF ERRORLEVEL 1 ( + ECHO ERROR! make-addons.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL make-addons.bat win10 %* +POPD diff --git a/tools/buildsteps/windows/arm-uwp/make-mingwlibs.bat b/tools/buildsteps/windows/arm-uwp/make-mingwlibs.bat new file mode 100644 index 0000000..6a59615 --- /dev/null +++ b/tools/buildsteps/windows/arm-uwp/make-mingwlibs.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat arm store +IF ERRORLEVEL 1 ( + ECHO ERROR! make-mingwlibs.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL make-mingwlibs.bat buildArm win10 %* +POPD diff --git a/tools/buildsteps/windows/arm-uwp/prepare-env.bat b/tools/buildsteps/windows/arm-uwp/prepare-env.bat new file mode 100644 index 0000000..354a5cf --- /dev/null +++ b/tools/buildsteps/windows/arm-uwp/prepare-env.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL prepare-env.bat +POPD diff --git a/tools/buildsteps/windows/bootstrap-addons.bat b/tools/buildsteps/windows/bootstrap-addons.bat new file mode 100644 index 0000000..cbd2b44 --- /dev/null +++ b/tools/buildsteps/windows/bootstrap-addons.bat @@ -0,0 +1,91 @@ +@ECHO OFF + +SETLOCAL + +SET EXITCODE=0 + +SET clean=false +if "%1" == "clean" ( + SET clean=true +) ELSE ( + IF "%1" NEQ "" ( + SET REPOSITORY=%1 + + IF "%2" NEQ "" ( + SET REPOSITORY_REVISION=%2 + ) + ) +) + +PUSHD %~dp0\..\..\.. +SET WORKDIR=%CD% +POPD + +rem setup some paths that we need later +SET CUR_PATH=%CD% +SET BASE_PATH=%WORKDIR%\cmake +SET ADDONS_PATH=%BASE_PATH%\addons +SET ADDONS_BOOTSTRAP_PATH=%ADDONS_PATH%\bootstrap +SET BOOTSTRAP_BUILD_PATH=%ADDONS_PATH%\build\bootstrap +SET ADDONS_DEFINITION_PATH=%ADDONS_PATH%\addons + +IF %clean% == true ( + rem remove the build directory if it exists + IF EXIST "%BOOTSTRAP_BUILD_PATH%" ( + ECHO Cleaning build directory... + RMDIR "%BOOTSTRAP_BUILD_PATH%" /S /Q > NUL + ) + + rem clean the addons definition path if it exists + IF EXIST "%ADDONS_DEFINITION_PATH%" ( + ECHO Cleaning bootstrapped addons... + RMDIR "%ADDONS_DEFINITION_PATH%" /S /Q > NUL + ) + + GOTO END +) + +rem create the build directory +IF NOT EXIST "%BOOTSTRAP_BUILD_PATH%" MKDIR "%BOOTSTRAP_BUILD_PATH%" + +rem create the addons definition directory +IF NOT EXIST "%ADDONS_DEFINITION_PATH%" MKDIR "%ADDONS_DEFINITION_PATH%" + +rem go into the build directory +CD "%BOOTSTRAP_BUILD_PATH%" + +ECHO -------------------------------------------------- +ECHO Bootstrapping addons +ECHO -------------------------------------------------- + +rem execute cmake to generate makefiles processable by nmake +cmake "%ADDONS_BOOTSTRAP_PATH%" -G "NMake Makefiles" ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_INSTALL_PREFIX=%ADDONS_DEFINITION_PATH% ^ + -DBUILD_DIR=%BOOTSTRAP_BUILD_PATH% ^ + -DREPOSITORY_TO_BUILD="%REPOSITORY%" ^ + -DREPOSITORY_REVISION="%REPOSITORY_REVISION%" +IF ERRORLEVEL 1 ( + ECHO cmake error level: %ERRORLEVEL% + GOTO ERROR +) + +rem execute nmake to prepare the buildsystem +nmake +IF ERRORLEVEL 1 ( + ECHO nmake failed with error level: %ERRORLEVEL% +) +rem everything was fine +GOTO END + +:ERROR +rem something went wrong +ECHO Failed to bootstrap addons +SET EXITCODE=1 + +:END +rem go back to the original directory +cd %CUR_PATH% + +rem exit the script with the defined exitcode +EXIT /B %EXITCODE% diff --git a/tools/buildsteps/windows/buildffmpeg.sh b/tools/buildsteps/windows/buildffmpeg.sh new file mode 100644 index 0000000..f2e72cb --- /dev/null +++ b/tools/buildsteps/windows/buildffmpeg.sh @@ -0,0 +1,129 @@ +#!/bin/bash + +[[ -f buildhelpers.sh ]] && + source buildhelpers.sh + +FFMPEG_CONFIG_FILE=/xbmc/tools/buildsteps/windows/ffmpeg_options.txt +FFMPEG_VERSION_FILE=/xbmc/tools/depends/target/ffmpeg/FFMPEG-VERSION +FFMPEG_BASE_OPTS="--disable-debug --disable-doc --enable-gpl --enable-w32threads" +FFMPEG_DEFAULT_OPTS="" +FFMPEG_TARGET_OS=mingw32 + +do_loaddeps $FFMPEG_VERSION_FILE +FFMPEGDESTDIR=$PREFIX + +do_getFFmpegConfig() { + if [[ -f "$FFMPEG_CONFIG_FILE" ]]; then + FFMPEG_OPTS_SHARED="$FFMPEG_BASE_OPTS $(cat "$FFMPEG_CONFIG_FILE" | sed -e 's:\\::g' -e 's/#.*//')" + else + FFMPEG_OPTS_SHARED="$FFMPEG_BASE_OPTS $FFMPEG_DEFAULT_OPTS" + fi + + if [ "$ARCH" == "x86_64" ]; then + FFMPEG_TARGET_OS=mingw64 + elif [ "$ARCH" == "x86" ]; then + FFMPEG_TARGET_OS=mingw32 + do_addOption "--cpu=i686" + elif [ "$ARCH" == "arm" ]; then + FFMPEG_TARGET_OS=mingw32 + do_addOption "--cpu=armv7" + fi + + # add options for static modplug + if do_checkForOptions "--enable-libmodplug"; then + do_addOption "--extra-cflags=-DMODPLUG_STATIC" + fi + + # handle gplv3 libs + if do_checkForOptions "--enable-libopencore-amrwb --enable-libopencore-amrnb \ + --enable-libvo-aacenc --enable-libvo-amrwbenc"; then + do_addOption "--enable-version3" + fi + + do_removeOption "--enable-nonfree" + do_removeOption "--enable-libfdk-aac" + do_removeOption "--enable-nvenc" + do_removeOption "--enable-libfaac" + + # remove libs that don't work with shared + do_removeOption "--enable-decklink" + do_removeOption "--enable-libutvideo" + do_removeOption "--enable-libgme" +} + +do_checkForOptions() { + local isPresent=1 + for option in "$@"; do + for option2 in $option; do + if echo "$FFMPEG_OPTS_SHARED" | grep -q -E -e "$option2"; then + isPresent=0 + fi + done + done + return $isPresent +} + +do_addOption() { + local option=${1%% *} + local shared=$2 + if ! do_checkForOptions "$option"; then + FFMPEG_OPTS_SHARED="$FFMPEG_OPTS_SHARED $option" + fi +} + +do_removeOption() { + local option=${1%% *} + FFMPEG_OPTS_SHARED=$(echo "$FFMPEG_OPTS_SHARED" | sed "s/ *$option//g") +} + +do_getFFmpegConfig + +# enable OpenSSL, because schannel has issues +do_removeOption "--enable-gnutls" +do_addOption "--disable-gnutls" +do_addOption "--enable-openssl" +do_addOption "--enable-nonfree" +do_addOption "--toolchain=msvc" +do_addOption "--disable-mediafoundation" + +if [ "$ARCH" == "x86_64" ]; then + FFMPEG_TARGET_OS=win64 +elif [ "$ARCH" = "x86" ]; then + FFMPEG_TARGET_OS=win32 +elif [ "$ARCH" = "arm" ]; then + FFMPEG_TARGET_OS=win32 +fi + +export CFLAGS="" +export CXXFLAGS="" +export LDFLAGS="" + +extra_cflags="-I$LOCALDESTDIR/include -I/depends/$TRIPLET/include -DWIN32_LEAN_AND_MEAN" +extra_ldflags="-LIBPATH:\"$LOCALDESTDIR/lib\" -LIBPATH:\"$MINGW_PREFIX/lib\" -LIBPATH:\"/depends/$TRIPLET/lib\"" +if [ $win10 == "yes" ]; then + do_addOption "--enable-cross-compile" + extra_cflags=$extra_cflags" -MD -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WIN32_WINNT=0x0A00" + extra_ldflags=$extra_ldflags" -APPCONTAINER WindowsApp.lib" +fi + +# compile ffmpeg with debug symbols +if do_checkForOptions "--enable-debug"; then + extra_cflags=$extra_cflags" -MDd" + extra_ldflags=$extra_ldflags" -NODEFAULTLIB:libcmt" +fi + +cd $LOCALBUILDDIR + +do_clean_get $1 +[ -f config.mak ] && make distclean +do_print_status "$LIBNAME-$VERSION (${TRIPLET})" "$blue_color" "Configuring" + +[[ -z "$extra_cflags" ]] && extra_cflags=-DPTW32_STATIC_LIB +[[ -z "$extra_ldflags" ]] && extra_ldflags=-static-libgcc + +$LOCALSRCDIR/configure --target-os=$FFMPEG_TARGET_OS --prefix=$FFMPEGDESTDIR --arch=$ARCH \ + $FFMPEG_OPTS_SHARED \ + --extra-cflags="$extra_cflags" --extra-ldflags="$extra_ldflags" + +do_makelib +exit $? diff --git a/tools/buildsteps/windows/buildhelpers.sh b/tools/buildsteps/windows/buildhelpers.sh new file mode 100644 index 0000000..2a059de --- /dev/null +++ b/tools/buildsteps/windows/buildhelpers.sh @@ -0,0 +1,216 @@ +#!/bin/bash + +MAKEFLAGS="$1" +BGPROCESSFILE="$2" + +cpuCount=1 +if [[ $NUMBER_OF_PROCESSORS > 1 ]]; then + if [[ $NUMBER_OF_PROCESSORS > 4 ]]; then + cpuCount=$NUMBER_OF_PROCESSORS + else + cpuCount=`expr $NUMBER_OF_PROCESSORS + $NUMBER_OF_PROCESSORS / 2` + fi +fi +if [[ ! $cpuCount =~ ^[0-9]+$ ]]; then + cpuCount="$(($(nproc)/2))" +fi + +if which tput >/dev/null 2>&1; then + ncolors=$(tput colors) + if test -n "$ncolors" && test "$ncolors" -ge 8; then + bold_color=$(tput bold) + blue_color=$(tput setaf 4) + orange_color=$(tput setaf 3) + green_color=$(tput setaf 2) + red_color=$(tput setaf 1) + reset_color=$(tput sgr0) + fi + ncols=72 +fi + +if [[ ! -d /build/src ]]; then + mkdir /build/src +fi + +do_wget() { + local URL="$1" + local archive="$2" + + if [[ -z $archive ]]; then + wget --tries=5 --retry-connrefused --waitretry=2 --no-check-certificate -c -P /downloads/ $URL + else + wget --tries=5 --retry-connrefused --waitretry=2 --no-check-certificate -c $URL -O /downloads/$archive + fi +} + +do_makeinstall() { + make -j"$cpuCount" "$@" + make install +} + +do_makelib() { + do_print_status "$LIBNAME-$VERSION (${TRIPLET})" "$blue_color" "Compiling" + do_makeinstall $1 + if [ $? == 0 ]; then + do_print_status "$LIBNAME-$VERSION (${TRIPLET})" "$green_color" "Done" + else + do_print_status "$LIBNAME-$VERSION (${TRIPLET})" "$red_color" "Error" + fi +} + +do_print_status() { + local pad=$(printf '%0.1s' "."{1..72}) + local padlen=$((${#pad}-${#1}-${#3})) + printf '%s %*.*s%s%s%s\n' "${bold_color}$1${reset_color}" 0 "$padlen" "$pad" " [$2" "$3" "$reset_color]" +} + +do_print_progress() { + echo -e "\e]0;$* in $(get_first_subdir)\007" + echo -e "${bold_color}$* in $(get_first_subdir)${reset_color}" +} + +get_first_subdir() { + local subdir="${PWD#*build/}" + if [[ "$subdir" != "$PWD" ]]; then + subdir="${subdir%%/*}" + echo "$subdir" + else + echo "." + fi +} + +do_pkgConfig() { + local pkg=${1%% *} + local version=$2 + [[ -z "$version" ]] && version="${1##*= }" + [[ "$version" = "$1" ]] && version="" || version=" $version" + local prefix=$(pkg-config --variable=prefix --silence-errors "$1") + [[ ! -z "$prefix" ]] && prefix="$(cygpath -u "$prefix")" + if [[ "$prefix" = "$LOCALDESTDIR" || "$prefix" = "/trunk${LOCALDESTDIR}" ]]; then + do_print_status "${pkg} ${version}" "$green_color" "Up-to-date" + return 1 + else + do_print_status "${pkg} ${version}" "$red_color" "Not installed" + fi +} + +do_autoreconf() { + if [[ ! -f $LOCALSRCDIR/configure ]]; then + local CURDIR=$(pwd) + cd $LOCALSRCDIR + autoreconf -fiv + cd $CURDIR + fi +} + +do_clean() { + if [[ "$1" == "clean" ]]; then + if [ -d "$LIBBUILDDIR" ]; then + do_print_status "$LIBNAME ($TRIPLET)" "$red_color" "Removing" + rm -rf "$LIBBUILDDIR" + fi + fi +} + +do_download() { + if [ ! -d "$LOCALSRCDIR" ]; then + if [ ! -f /downloads/$ARCHIVE ]; then + do_print_status "$LIBNAME-$VERSION" "$orange_color" "Downloading" + do_wget $BASE_URL/$VERSION.tar.gz $ARCHIVE + fi + + do_print_status "$LIBNAME-$VERSION" "$blue_color" "Extracting" + mkdir $LOCALSRCDIR && cd $LOCALSRCDIR + tar -xaf /downloads/$ARCHIVE --strip 1 + fi + # applying patches + local patches=(/xbmc/tools/buildsteps/windows/patches/*-$LIBNAME-*.patch) + for patch in ${patches[@]}; do + echo "Applying patch ${patch}" + if [[ -f $patch ]]; then + patch -p1 -d $LOCALSRCDIR -i $patch -N -r - + fi + done +} + +do_loaddeps() { + local file="$1" + LIBNAME=$(grep "LIBNAME=" $file | sed 's/LIBNAME=//g;s/#.*$//g;/^$/d') + BASE_URL=$(grep "BASE_URL=" $file | sed 's/BASE_URL=//g;s/#.*$//g;/^$/d') + VERSION=$(grep "VERSION=" $file | sed 's/VERSION=//g;s/#.*$//g;/^$/d') + GITREV=$(git ls-remote $BASE_URL $VERSION | awk '{print substr($1, 1, 10)}') + if [[ -z "$GITREV" ]]; then + ARCHIVE=$LIBNAME-$(echo "${VERSION}" | sed 's/\//-/g').tar.gz + else + ARCHIVE=$LIBNAME-$GITREV.tar.gz + fi + BASE_URL=$BASE_URL/archive + local libsrcdir=$LIBNAME-$VERSION + if [[ ! -z "$GITREV" ]]; then + libsrcdir=$LIBNAME-$GITREV + fi + LOCALSRCDIR=$LOCALBUILDDIR/src/$libsrcdir + LIBBUILDDIR=$LOCALBUILDDIR/$LIBNAME-$TRIPLET +} + +do_clean_get() { + do_clean $1 + do_download + + if [[ ! -d "$LIBBUILDDIR" ]]; then + mkdir "$LIBBUILDDIR" + fi + cd "$LIBBUILDDIR" +} + + +PATH_CHANGE_REV_FILENAME=".last_success_revision" + +#hash a dir based on the git revision and $TRIPLET +#params paths to be hashed +function getBuildHash () +{ + local hashStr + hashStr="$(git rev-list HEAD --max-count=1 -- $@)" + hashStr="$hashStr $@ $TRIPLET" + echo $hashStr +} + +#param1 path to be checked for changes +function pathChanged () +{ + local ret + local checkPath + ret="0" + #no optims in release builds! + if [ "$Configuration" == "Release" ] + then + echo "1" + return + fi + + checkPath="$1" + shift 1 + if [ -e $checkPath/$PATH_CHANGE_REV_FILENAME ] + then + if [ "$(cat $checkPath/$PATH_CHANGE_REV_FILENAME)" != "$(getBuildHash $checkPath $@)" ] + then + ret="1" + fi + else + ret="1" + fi + + echo $ret +} + +#param1 path to be tagged with hash +function tagSuccessFulBuild () +{ + local pathToTag + pathToTag="$1" + shift 1 + # tag last successful build with revisions of the given dir + # needs to match the checks in function getBuildHash + echo "$(getBuildHash $pathToTag $@)" > $pathToTag/$PATH_CHANGE_REV_FILENAME +} diff --git a/tools/buildsteps/windows/download-dependencies.bat b/tools/buildsteps/windows/download-dependencies.bat new file mode 100644 index 0000000..0a129fd --- /dev/null +++ b/tools/buildsteps/windows/download-dependencies.bat @@ -0,0 +1,72 @@ +@ECHO OFF + +SETLOCAL + +PUSHD %~dp0\..\..\.. +SET WORKSPACE=%CD% +POPD + +SET TARGETPLATFORM=%1 +SET NATIVEPLATFORM=%2 + +IF "%TARGETPLATFORM%" == "" SET TARGETPLATFORM=win32 +IF "%NATIVEPLATFORM%" == "" SET NATIVEPLATFORM=win32 + +ECHO TARGETPLATFORM: %TARGETPLATFORM% +ECHO NATIVEPLATFORM: %NATIVEPLATFORM% + +REM If KODI_MIRROR is not set externally to this script, set it to the default mirror URL +IF "%KODI_MIRROR%" == "" SET KODI_MIRROR=http://mirrors.kodi.tv +echo Downloading from mirror %KODI_MIRROR% + +REM Locate the BuildDependencies directory, based on the path of this script +SET BUILD_DEPS_PATH=%WORKSPACE%\project\BuildDependencies +SET APP_PATH=%WORKSPACE%\project\BuildDependencies\%TARGETPLATFORM% +SET TMP_PATH=%BUILD_DEPS_PATH%\scripts\tmp + +REM Change to the BuildDependencies directory, if we're not there already +PUSHD %BUILD_DEPS_PATH% + +REM Can't run rmdir and md back to back. access denied error otherwise. +IF EXIST %TMP_PATH% rmdir %TMP_PATH% /S /Q + +SET DL_PATH="%BUILD_DEPS_PATH%\downloads" +SET WGET=%BUILD_DEPS_PATH%\bin\wget +SET ZIP=%BUILD_DEPS_PATH%\..\Win32BuildSetup\tools\7z\7za + +IF NOT EXIST %DL_PATH% md %DL_PATH% + +md %TMP_PATH% + +cd scripts + +SET FORMED_OK_FLAG=%TMP_PATH%\got-all-formed-packages +REM Trick to preserve console title +start /b /wait cmd.exe /c get_formed.cmd +IF NOT EXIST %FORMED_OK_FLAG% ( + ECHO ERROR: Not all formed packages are ready! + ECHO. + ECHO I tried to get the packages from %KODI_MIRROR%; + ECHO if this download mirror seems to be having problems, try choosing another from + ECHO the list on http://mirrors.kodi.tv/timestamp.txt?mirrorlist, and setting %%KODI_MIRROR%% to + ECHO point to it, like so: + ECHO C:\^> SET KODI_MIRROR=http://example.com/pub/xbmc/ + ECHO. + ECHO Then, rerun this script. + + REM Restore the previous current directory + POPD + + ENDLOCAL + + EXIT /B 101 +) + +rmdir %TMP_PATH% /S /Q + +REM Restore the previous current directory +POPD + +ENDLOCAL + +EXIT /B 0 diff --git a/tools/buildsteps/windows/download-msys2.bat b/tools/buildsteps/windows/download-msys2.bat new file mode 100644 index 0000000..34c3472 --- /dev/null +++ b/tools/buildsteps/windows/download-msys2.bat @@ -0,0 +1,406 @@ +::------------------------------------------------------------------------------------- +:: LICENSE ------------------------------------------------------------------------- +::------------------------------------------------------------------------------------- +:: This Windows Batchscript is for setup a compiler environment for building ffmpeg and other media tools under Windows. +:: +:: Copyright (C) 2013 jb_alvarado +:: +:: This program is free software: you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published by +:: the Free Software Foundation, either version 3 of the License, or +:: (at your option) any later version. +:: +:: This program is distributed in the hope that it will be useful, +:: but WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +:: GNU General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with this program. If not, see <http://www.gnu.org/licenses/>. +::------------------------------------------------------------------------------------- + +@echo off +title msys2 + +PUSHD %~dp0\..\..\.. +SET WORKSPACE=%CD% +POPD + +set msysver=20210725 +set msys2=msys64 +set instdir=%WORKSPACE%\project\BuildDependencies +set msyspackages=diffutils gcc make patch perl tar yasm +set gaspreprocurl=https://github.com/FFmpeg/gas-preprocessor/archive/master.tar.gz +set usemirror=yes +set opt=mintty + +:: if KODI_MIRROR is not set externally to this script, set it to the default mirror URL +if "%KODI_MIRROR%"=="" set KODI_MIRROR=http://mirrors.kodi.tv +if "%usemirror%"=="yes" ( + echo ------------------------------------------------------------------------------- + echo. Downloading will be performed from mirror %KODI_MIRROR% + echo ------------------------------------------------------------------------------- + set MSYS_MIRROR=%KODI_MIRROR%/build-deps/win32/msys2 +) + +set downloaddir=%instdir%\downloads2 +set unpack_exe=%instdir%\..\Win32BuildSetup\tools\7z\7za.exe + +for %%b in (%*) do ( + if %%b==sh (set opt=sh) +) + +:: use 32bit msys2 on x86 machine +if %PROCESSOR_ARCHITECTURE%=="x86" set msys2=msys32 +if %msys2%==msys32 (set arch=i686) else (set arch=x86_64) +set msysfile=msys2-base-%arch%-%msysver%.tar.xz +if %opt%==mintty ( + set sh=%instdir%\%msys2%\usr\bin\mintty.exe -d -i /msys2.ico /usr/bin/bash +) else ( + set sh=%instdir%\%msys2%\usr\bin\sh.exe +) + +::------------------------------------------------------------------ +::download and install basic msys2 system: +::------------------------------------------------------------------ +if exist "%instdir%\%msys2%\msys2_shell.cmd" GOTO minttySettings + if not exist %downloaddir% mkdir %downloaddir% + +:download +if exist "%downloaddir%\%msysfile%" ( + setlocal EnableDelayedExpansion + for /F "tokens=*" %%A in ("%downloaddir%\%msysfile%") do set fileSize=%%~zA + if !fileSize!==0 del %downloaddir%\%msysfile% + endlocal + ) + +if exist "%downloaddir%\%msysfile%" GOTO unpack + echo ------------------------------------------------------------------------------- + echo.- Download msys2 basic system (Kodi mirrors: %usemirror%) + echo ------------------------------------------------------------------------------- + + set msysurl=http://sourceforge.net/projects/msys2/files/Base/%arch%/%msysfile%/download + if %usemirror%==yes ( + ::download msys2 from our mirror + set msysurl=%MSYS_MIRROR%/%msysfile% + ) + %instdir%\bin\wget --tries=20 --retry-connrefused --waitretry=2 --no-check-certificate -c -O %downloaddir%\%msysfile% %msysurl% + if errorlevel == 1 ( + if exist "%downloaddir%\%msysfile%" del %downloaddir%\%msysfile% + if %usemirror%==yes ( + set usemirror=no + goto download + ) + echo ERROR: Unable to download msys2! + exit /B 1 + ) + +:unpack +if exist "%downloaddir%\%msysfile%" ( + echo ------------------------------------------------------------------------------- + echo.- Installing msys2 basic system + echo ------------------------------------------------------------------------------- + %unpack_exe% x %downloaddir%\%msysfile% -so 2>NUL | %unpack_exe% x -aoa -si -ttar -o%instdir% >NUL 2>NUL + ) + +if not exist %instdir%\%msys2%\usr\bin\msys-2.0.dll ( + echo ------------------------------------------------------------------------------- + echo.- Installing msys2 basic system failed, + echo ------------------------------------------------------------------------------- + exit /B 1 + ) + +:minttySettings +if exist "%instdir%\%msys2%\home\%USERNAME%\.minttyrc" GOTO updatemirrors +if not exist "%instdir%\%msys2%\home\%USERNAME%" mkdir "%instdir%\%msys2%\home\%USERNAME%" + ( + echo.BoldAsFont=no + echo.BackgroundColour=57,57,57 + echo.ForegroundColour=221,221,221 + echo.Transparency=medium + echo.FontHeight=^9 + echo.FontSmoothing=full + echo.AllowBlinking=yes + echo.Columns=120 + echo.Rows=30 + echo.Term=xterm-256color + echo.CursorType=block + echo.ClicksPlaceCursor=yes + echo.Black=38,39,41 + echo.Red=249,38,113 + echo.Green=166,226,46 + echo.Yellow=253,151,31 + echo.Blue=102,217,239 + echo.Magenta=158,111,254 + echo.Cyan=94,113,117 + echo.White=248,248,242 + echo.BoldBlack=85,68,68 + echo.BoldRed=249,38,113 + echo.BoldGreen=166,226,46 + echo.BoldYellow=253,151,31 + echo.BoldBlue=102,217,239 + echo.BoldMagenta=158,111,254 + echo.BoldCyan=163,186,191 + echo.BoldWhite=248,248,242 + )>>"%instdir%\%msys2%\home\%USERNAME%\.minttyrc" + +:updatemirrors +if not "%usemirror%"=="yes" GOTO rebase + echo.------------------------------------------------------------------------------- + echo.update pacman mirrors + echo.------------------------------------------------------------------------------- + setlocal EnableDelayedExpansion + + for %%f in (msys,mingw32,mingw64) do ( + set filename=%instdir%\%msys2%\etc\pacman.d\mirrorlist.%%f + set oldfile=!filename!.old + if not exist !oldfile! if exist !filename! ( + set mirror=%MSYS_MIRROR%/repos/%%f + if %%f==msys set mirror=!mirror!2/$arch + move !filename! !oldfile!>nul + for /F "usebackq delims=" %%a in (!oldfile!) do ( + echo %%a | find /i "server = http://repo.msys2.org/">nul && ( + echo.Server = !mirror! + )>>!filename! + echo %%a>>!filename! + ) + ) + ) + endlocal + +:rebase +if %msys2%==msys32 ( + echo.------------------------------------------------------------------------------- + echo.rebase msys32 system + echo.------------------------------------------------------------------------------- + call %instdir%\msys32\autorebase.bat + ) + +:preparedirs +if not exist %instdir%\build mkdir %instdir%\build +if not exist %instdir%\downloads2 mkdir %instdir%\downloads2 +if not exist %instdir%\locals mkdir %instdir%\locals +if not exist %instdir%\locals\win32 mkdir %instdir%\locals\win32 +if not exist %instdir%\locals\x64 mkdir %instdir%\locals\x64 + +if not exist %instdir%\locals\win32\share ( + echo.------------------------------------------------------------------------------- + echo.create local win32 folders + echo.------------------------------------------------------------------------------- + mkdir %instdir%\locals\win32\bin + mkdir %instdir%\locals\win32\etc + mkdir %instdir%\locals\win32\include + mkdir %instdir%\locals\win32\lib + mkdir %instdir%\locals\win32\lib\pkgconfig + mkdir %instdir%\locals\win32\share + ) + +if not exist %instdir%\locals\x64\share ( + echo.------------------------------------------------------------------------------- + echo.create local x64 folders + echo.------------------------------------------------------------------------------- + mkdir %instdir%\locals\x64\bin + mkdir %instdir%\locals\x64\etc + mkdir %instdir%\locals\x64\include + mkdir %instdir%\locals\x64\lib + mkdir %instdir%\locals\x64\lib\pkgconfig + mkdir %instdir%\locals\x64\share + ) + +if not exist %instdir%\%msys2%\etc\fstab. GOTO writeFstab +for /f "tokens=2 delims=/" %%a in ('findstr /i xbmc %instdir%\%msys2%\etc\fstab.') do set searchRes=%%a +if "%searchRes%"=="xbmc" GOTO installbase + +:writeFstab +echo ------------------------------------------------------------------------------- +echo.- write fstab mount file +echo ------------------------------------------------------------------------------- +set cygdrive=no +if exist %instdir%\%msys2%\etc\fstab. ( + for /f %%b in ('findstr /i binary %instdir%\%msys2%\etc\fstab.') do set cygdrive=yes + ) +if "%cygdrive%"=="no" echo.none / cygdrive binary,posix=0,noacl,user 0 ^0>>%instdir%\%msys2%\etc\fstab. +( + echo. + echo.%instdir%\build\ /build + echo.%instdir%\downloads\ /downloads + echo.%instdir%\locals\win32\ /local32 + echo.%instdir%\locals\x64\ /local64 + echo.%instdir%\%msys2%\mingw32\ /mingw32 + echo.%instdir%\%msys2%\mingw64\ /mingw64 + echo.%instdir%\downloads2\ /var/cache/pacman/pkg + echo.%instdir%\win32\ /depends/win32 + echo.%instdir%\x64\ /depends/x64 + echo.%instdir%\win10-arm\ /depends/win10-arm + echo.%instdir%\win10-win32\ /depends/win10-win32 + echo.%instdir%\win10-x64\ /depends/win10-x64 + echo.%instdir%\..\..\ /xbmc +)>>%instdir%\%msys2%\etc\fstab. + +:installbase +if exist "%instdir%\%msys2%\etc\pac-base-old.pk" del "%instdir%\%msys2%\etc\pac-base-old.pk" +if exist "%instdir%\%msys2%\etc\pac-base-new.pk" ren "%instdir%\%msys2%\etc\pac-base-new.pk" pac-base-old.pk + +for %%i in (%msyspackages%) do echo.%%i>>%instdir%\%msys2%\etc\pac-base-new.pk + +if exist %instdir%\%msys2%\usr\bin\make.exe GOTO rebase2 + echo.------------------------------------------------------------------------------- + echo.install msys2 base system + echo.------------------------------------------------------------------------------- + if exist %instdir%\pacman.sh del %instdir%\pacman.sh + ( + echo.echo -ne "\033]0;install base system\007" + echo.pacman --noconfirm -S $(cat /etc/pac-base-new.pk ^| sed -e 's#\\##'^) + echo.sleep ^3 + echo.exit + )>>%instdir%\pacman.sh + %sh% --login %instdir%\pacman.sh & + del %instdir%\pacman.sh + + for %%i in (%instdir%\%msys2%\usr\ssl\cert.pem) do ( + if %%~zi==0 ( + echo.update-ca-trust>>cert.sh + echo.sleep ^3>>cert.sh + echo.exit>>cert.sh + %sh% --login %instdir%\cert.sh + del cert.sh + ) + ) + +:rebase2 +if %msys2%==msys32 ( + echo.------------------------------------------------------------------------------- + echo.second rebase msys32 system + echo.------------------------------------------------------------------------------- + call %instdir%\msys32\autorebase.bat + ) + +::------------------------------------------------------------------ +:: write config profiles: +::------------------------------------------------------------------ + +:writeProfile32 +if exist %instdir%\locals\win32\etc\profile.local GOTO writeProfile64 + echo ------------------------------------------------------------------------------- + echo.- write profile for 32 bit compiling + echo ------------------------------------------------------------------------------- + ( + echo.# + echo.# /local32/etc/profile.local + echo.# + echo. + echo.MSYSTEM=MINGW32 + echo. + echo.alias dir='ls -la --color=auto' + echo.alias ls='ls --color=auto' + echo.export CC=gcc + echo.export python=/usr/bin/python + echo. + echo.MSYS2_PATH="/usr/local/bin:/usr/bin" + echo.MANPATH="/usr/share/man:/mingw32/share/man:/local32/man:/local32/share/man" + echo.INFOPATH="/usr/local/info:/usr/share/info:/usr/info:/mingw32/share/info" + echo.MINGW_PREFIX="/mingw32" + echo.MINGW_CHOST="i686-w64-mingw32" + echo.export MSYSTEM MINGW_PREFIX MINGW_CHOST + echo. + echo.DXSDK_DIR="/mingw32/i686-w64-mingw32" + echo.ACLOCAL_PATH="/mingw32/share/aclocal:/usr/share/aclocal" + echo.PKG_CONFIG_LOCAL_PATH="/local32/lib/pkgconfig" + echo.PKG_CONFIG_PATH="/local32/lib/pkgconfig:/mingw32/lib/pkgconfig" + echo.CPPFLAGS="-I/local32/include -D_FORTIFY_SOURCE=2" + echo.CFLAGS="-I/local32/include -mms-bitfields -mthreads -mtune=generic -pipe" + echo.CXXFLAGS="-I/local32/include -mms-bitfields -mthreads -mtune=generic -pipe" + echo.LDFLAGS="-L/local32/lib -mthreads -pipe" + echo.export DXSDK_DIR ACLOCAL_PATH PKG_CONFIG_PATH PKG_CONFIG_LOCAL_PATH CPPFLAGS CFLAGS CXXFLAGS LDFLAGS MSYSTEM + echo. + echo.PYTHONHOME=/usr + echo.PYTHONPATH="/usr/lib/python2.7:/usr/lib/python2.7/Tools/Scripts" + echo. + echo.PATH=".:/local32/bin:/mingw32/bin:${MSYS2_PATH}:${INFOPATH}:${PYTHONHOME}:${PYTHONPATH}:${PATH}" + echo.PS1='\[\033[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' + echo.export PATH PS1 + echo. + echo.# package build directory + echo.LOCALBUILDDIR=/build + echo.# package installation prefix + echo.LOCALDESTDIR=/local32 + echo.export LOCALBUILDDIR LOCALDESTDIR + )>>%instdir%\locals\win32\etc\profile.local + ) + +:writeProfile64 +if exist %instdir%\locals\x64\etc\profile.local GOTO loadGasPreproc + echo ------------------------------------------------------------------------------- + echo.- write profile for 64 bit compiling + echo ------------------------------------------------------------------------------- + ( + echo.# + echo.# /local64/etc/profile.local + echo.# + echo. + echo.MSYSTEM=MINGW64 + echo. + echo.alias dir='ls -la --color=auto' + echo.alias ls='ls --color=auto' + echo.export CC=gcc + echo.export python=/usr/bin/python + echo. + echo.MSYS2_PATH="/usr/local/bin:/usr/bin" + echo.MANPATH="/usr/share/man:/mingw64/share/man:/local64/man:/local64/share/man" + echo.INFOPATH="/usr/local/info:/usr/share/info:/usr/info:/mingw64/share/info" + echo.MINGW_PREFIX="/mingw64" + echo.MINGW_CHOST="x86_64-w64-mingw32" + echo.export MSYSTEM MINGW_PREFIX MINGW_CHOST + echo. + echo.DXSDK_DIR="/mingw64/x86_64-w64-mingw32" + echo.ACLOCAL_PATH="/mingw64/share/aclocal:/usr/share/aclocal" + echo.PKG_CONFIG_LOCAL_PATH="/local64/lib/pkgconfig" + echo.PKG_CONFIG_PATH="/local64/lib/pkgconfig:/mingw64/lib/pkgconfig" + echo.CPPFLAGS="-I/local64/include -D_FORTIFY_SOURCE=2" + echo.CFLAGS="-I/local64/include -mms-bitfields -mthreads -mtune=generic -pipe" + echo.CXXFLAGS="-I/local64/include -mms-bitfields -mthreads -mtune=generic -pipe" + echo.LDFLAGS="-L/local64/lib -pipe" + echo.export DXSDK_DIR ACLOCAL_PATH PKG_CONFIG_PATH PKG_CONFIG_LOCAL_PATH CPPFLAGS CFLAGS CXXFLAGS LDFLAGS MSYSTEM + echo. + echo.PYTHONHOME=/usr + echo.PYTHONPATH="/usr/lib/python2.7:/usr/lib/python2.7/Tools/Scripts" + echo. + echo.PATH=".:/local64/bin:/mingw64/bin:${MSYS2_PATH}:${INFOPATH}:${PYTHONHOME}:${PYTHONPATH}:${PATH}" + echo.PS1='\[\033[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' + echo.export PATH PS1 + echo. + echo.# package build directory + echo.LOCALBUILDDIR=/build + echo.# package installation prefix + echo.LOCALDESTDIR=/local64 + echo.export LOCALBUILDDIR LOCALDESTDIR + )>>%instdir%\locals\x64\etc\profile.local + ) + +:loadGasPreproc +set gaspreprocfile=gas-preprocessor.tar.gz +if exist %downloaddir%\%gaspreprocfile% goto extractGasPreproc + echo ------------------------------------------------------------------------------- + echo.- Downloading gas-preprocessor.pl + echo ------------------------------------------------------------------------------- + %instdir%\bin\wget --tries=20 --retry-connrefused --waitretry=2 --no-check-certificate -c -O %downloaddir%\%gaspreprocfile% %gaspreprocurl% + +:extractGasPreproc +if exist %instdir%\%msys2%\usr\bin\gas-preprocessor.pl goto end + echo ------------------------------------------------------------------------------- + echo.- Installing gas-preprocessor.pl + echo ------------------------------------------------------------------------------- + %unpack_exe% x %downloaddir%\%gaspreprocfile% -so 2>NUL | %unpack_exe% e -si -ttar -o%instdir%\%msys2%\usr\bin *.pl -r >NUL 2>NUL + +:end +cd %instdir% +IF ERRORLEVEL == 1 ( + ECHO Something goes wrong... + exit /B 1 + ) + +echo.------------------------------------------------------------------------------- +echo.install msys2 system done +echo.------------------------------------------------------------------------------- + +@echo on diff --git a/tools/buildsteps/windows/ffmpeg_options.txt b/tools/buildsteps/windows/ffmpeg_options.txt new file mode 100644 index 0000000..fbaf417 --- /dev/null +++ b/tools/buildsteps/windows/ffmpeg_options.txt @@ -0,0 +1,19 @@ +--disable-avdevice +--disable-crystalhd +--disable-cuda +--disable-cuvid +--disable-devices +--disable-dxva2 +--disable-gnutls +--disable-nvenc +--disable-openssl +--disable-programs +--disable-shared +--enable-encoder=ac3,aac,wmav2,png,mjpeg +--enable-muxer=spdif,adts,asf,ipod +--enable-postproc +--enable-protocol=http +--enable-runtime-cpudetect +--enable-static +--enable-zlib +--enable-libdav1d diff --git a/tools/buildsteps/windows/getbranch.bat b/tools/buildsteps/windows/getbranch.bat new file mode 100644 index 0000000..a078c05 --- /dev/null +++ b/tools/buildsteps/windows/getbranch.bat @@ -0,0 +1,56 @@ +@echo off +rem this gets the current branch from either the branchname (if we attached) or +rem by using scientific branch fetching algorithms [tm] git is in detached HEAD state +rem result will be in env var %BRANCH% +SET BRANCH= +SET DETACHED=1 +:: detect detached head +git symbolic-ref HEAD >nul 2>&1 +IF %ERRORLEVEL%==0 ( + SET DETACHED=0 +) +rem find the branchname - if current branch is a pr we have to take this into account aswell +rem (would be refs/heads/pr/number/head then) +rem normal branch would be refs/heads/branchname +IF %DETACHED%==0 ( + FOR /f %%a IN ('git symbolic-ref HEAD') DO SET BRANCH=%%a + SETLOCAL EnableDelayedExpansion + SET BRANCH=!BRANCH:*/=! + SETLOCAL DisableDelayedExpansion + GOTO branchfound +) + +:: when building with jenkins there's no branch. First git command gets the branches +:: and then prefers a non pr branch if one exists +:: (this mimics what the linux side does via sed and head -n1 +:: but is empty in a normal build environment. Second git command gets the branch there. +SET command=git branch -r --points-at HEAD +%command% >nul 2>&1 +IF NOT %ERRORLEVEL%==0 ( + SET command=git branch -r --contains HEAD +) + +%command% | findstr "%GITHUB_REPO%\/" | findstr /V "%GITHUB_REPO%\/pr\/" >nul +IF %ERRORLEVEL%==0 ( + FOR /f %%a IN ('%%command%% ^| findstr "%GITHUB_REPO%\/" ^| findstr /V "%GITHUB_REPO%\/pr\/"') DO ( + SET BRANCH=%%a + GOTO branchfound + ) +) ELSE ( + FOR /f %%a IN ('%%command%% ^| findstr "%GITHUB_REPO%\/"') DO ( + SET BRANCH=%%a + GOTO branchfound + ) +) + +:branchfound +SETLOCAL EnableDelayedExpansion +IF NOT "!BRANCH!"=="" ( + :: BRANCH is now (head|GITHUB_REPO)/(branchname|pr/number/(head|merge)) + SET BRANCH=!BRANCH:/pr/=/PR! + SET BRANCH=!BRANCH:*/=! + SET BRANCH=!BRANCH:/=-! +) +SETLOCAL DisableDelayedExpansion + +ECHO.%BRANCH% diff --git a/tools/buildsteps/windows/make-addons.bat b/tools/buildsteps/windows/make-addons.bat new file mode 100644 index 0000000..b8e0ac5 --- /dev/null +++ b/tools/buildsteps/windows/make-addons.bat @@ -0,0 +1,169 @@ +@ECHO OFF + +SET EXITCODE=0 + +SET install=false +SET clean=false +SET package=false +SET addon= +SET store= + +SETLOCAL EnableDelayedExpansion +FOR %%b IN (%*) DO ( + IF %%~b == install ( + SET install=true + ) ELSE ( IF %%~b == clean ( + SET clean=true + ) ELSE ( IF %%~b == package ( + SET package=true + ) ELSE ( IF %%~b == win10 ( + SET store=store + ) ELSE ( + SET addon=!addon! %%~b + )))) +) +SETLOCAL DisableDelayedExpansion + +PUSHD %~dp0\..\..\.. +SET WORKDIR=%CD% +POPD + +rem setup some paths that we need later +SET CUR_PATH=%CD% +SET BASE_PATH=%WORKDIR%\cmake +SET SCRIPTS_PATH=%BASE_PATH%\scripts\windows%store% +SET ADDONS_PATH=%BASE_PATH%\addons +SET ADDON_DEPENDS_PATH=%ADDONS_PATH%\output +SET ADDONS_BUILD_PATH=%ADDONS_PATH%\build + +SET ADDONS_SUCCESS_FILE=%ADDONS_PATH%\.success +SET ADDONS_FAILURE_FILE=%ADDONS_PATH%\.failure + +SET ERRORFILE=%ADDONS_PATH%\make-addons.error + +rem remove the success and failure files from a previous build +DEL /F %ADDONS_SUCCESS_FILE% > NUL 2>&1 +DEL /F %ADDONS_FAILURE_FILE% > NUL 2>&1 + +IF %clean% == true ( + rem remove the build directory if it exists + IF EXIST "%ADDONS_BUILD_PATH%" ( + ECHO Cleaning build directory... + RMDIR "%ADDONS_BUILD_PATH%" /S /Q > NUL + ) + + rem remove the build directory if it exists + IF EXIST "%ADDON_DEPENDS_PATH%" ( + ECHO Cleaning dependencies... + RMDIR "%ADDON_DEPENDS_PATH%" /S /Q > NUL + ) + + GOTO END +) + +rem create the depends directory +IF NOT EXIST "%ADDON_DEPENDS_PATH%" MKDIR "%ADDON_DEPENDS_PATH%" + +rem create the build directory +IF NOT EXIST "%ADDONS_BUILD_PATH%" MKDIR "%ADDONS_BUILD_PATH%" + +rem go into the build directory +CD "%ADDONS_BUILD_PATH%" + +rem determine the proper install path for the built addons +IF %install% == true ( + SET ADDONS_INSTALL_PATH=%WORKSPACE%\addons +) ELSE ( + SET ADDONS_INSTALL_PATH=%WORKDIR%\project\Win32BuildSetup\BUILD_WIN32\addons +) + +ECHO -------------------------------------------------- +ECHO Building addons +ECHO -------------------------------------------------- + +IF "%addon%" NEQ "" ( + SET CMAKE_EXTRA=%CMAKE_EXTRA% -DADDONS_TO_BUILD="%addon%" +) + +IF "%ADDON_SRC_PREFIX%" NEQ "" ( + SET CMAKE_EXTRA=%CMAKE_EXTRA% -DADDON_SRC_PREFIX=%ADDON_SRC_PREFIX% +) + +IF "%ADDONS_DEFINITION_DIR" NEQ "" ( + SET CMAKE_EXTRA=%CMAKE_EXTRA% -DADDONS_DEFINITION_DIR=%ADDONS_DEFINITION_DIR% +) + +IF "%store%" NEQ "" ( + SET CMAKE_EXTRA=%CMAKE_EXTRA% -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion% +) + +rem execute cmake to generate makefiles processable by nmake +cmake "%ADDONS_PATH%" -G "NMake Makefiles" ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_USER_MAKE_RULES_OVERRIDE="%SCRIPTS_PATH%/CFlagOverrides.cmake" ^ + -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%SCRIPTS_PATH%/CXXFlagOverrides.cmake" ^ + -DCMAKE_INSTALL_PREFIX=%ADDONS_INSTALL_PATH% ^ + -DCMAKE_SOURCE_DIR=%WORKDIR% ^ + -DBUILD_DIR=%ADDONS_BUILD_PATH% ^ + -DADDON_DEPENDS_PATH=%ADDON_DEPENDS_PATH% ^ + -DPACKAGE_ZIP=ON ^ + %CMAKE_EXTRA% + +IF ERRORLEVEL 1 ( + ECHO cmake error level: %ERRORLEVEL% > %ERRORFILE% + GOTO ERROR +) + +rem get the list of addons that can actually be built +SET ADDONS_TO_MAKE= +SETLOCAL EnableDelayedExpansion +FOR /f "delims=" %%i IN ('cmake --build . --target supported_addons') DO ( + SET line="%%i" + SET addons=!line:ALL_ADDONS_BUILDING=! + IF NOT "!addons!" == "!line!" ( + SET ADDONS_TO_MAKE=!addons:~3,-1! + ) +) +SETLOCAL DisableDelayedExpansion + +rem loop over all addons to build +FOR %%a IN (%ADDONS_TO_MAKE%) DO ( + ECHO Building %%a... + rem execute cmake to build the addons + cmake --build . --target %%a + IF ERRORLEVEL 1 ( + ECHO nmake %%a error level: %ERRORLEVEL% > %ERRORFILE% + ECHO %%a >> %ADDONS_FAILURE_FILE% + ) ELSE ( + if %package% == true ( + nmake package-%%a + IF ERRORLEVEL 1 ( + ECHO nmake package-%%a error level: %ERRORLEVEL% > %ERRORFILE% + ECHO %%a >> %ADDONS_FAILURE_FILE% + ) ELSE ( + ECHO %%a >> %ADDONS_SUCCESS_FILE% + ) + ) ELSE ( + ECHO %%a >> %ADDONS_SUCCESS_FILE% + ) + ) +) + +rem everything was fine +GOTO END + +:ERROR +rem something went wrong +FOR %%a IN (%ADDONS_TO_BUILD%) DO ( + ECHO %%a >> %ADDONS_FAILURE_FILE% +) +ECHO Failed to build addons +ECHO See %ERRORFILE% for more details +SET EXITCODE=1 + +:END +rem go back to the original directory +cd %CUR_PATH% + +rem exit the script with the defined exitcode +EXIT /B %EXITCODE% diff --git a/tools/buildsteps/windows/make-mingwlibs.bat b/tools/buildsteps/windows/make-mingwlibs.bat new file mode 100644 index 0000000..62c41f0 --- /dev/null +++ b/tools/buildsteps/windows/make-mingwlibs.bat @@ -0,0 +1,88 @@ +@ECHO OFF + +rem batch file to compile mingw libs via BuildSetup +PUSHD %~dp0\..\..\.. +SET WORKDIR=%CD% +POPD + +REM recreates clean ffmpeg build dir +SET BUILD_DIR=%WORKDIR%\project\BuildDependencies\build +IF EXIST %BUILD_DIR% rmdir %BUILD_DIR% /S /Q +IF NOT EXIST %BUILD_DIR% mkdir %BUILD_DIR% + +SET PROMPTLEVEL=prompt +SET BUILDMODE=clean +SET opt=mintty +SET build32=yes +SET build64=no +SET buildArm=no +SET vcarch=x86 +SET msys2=msys64 +SET win10=no +SET TARGETPLATFORM=win32 + +FOR %%b in (%*) DO ( + IF %%b==noprompt SET PROMPTLEVEL=noprompt + IF %%b==clean SET BUILDMODE=clean + IF %%b==noclean SET BUILDMODE=noclean + IF %%b==sh SET opt=sh + IF %%b==build64 ( + SET build64=yes + SET build32=no + SET buildArm=no + SET vcarch=amd64 + SET TARGETPLATFORM=x64 + ) + IF %%b==buildArm ( + SET build64=no + SET build32=no + SET buildArm=yes + SET vcarch=arm + SET TARGETPLATFORM=arm + ) + IF %%b==win10 ( + SET win10=yes + ) +) +:: Export full current PATH from environment into MSYS2 +set MSYS2_PATH_TYPE=inherit + +REM Prepend the msys and mingw paths onto %PATH% +SET MSYS_INSTALL_PATH=%WORKDIR%\project\BuildDependencies\msys +SET PATH=%MSYS_INSTALL_PATH%\mingw\bin;%MSYS_INSTALL_PATH%\bin;%PATH% +SET ERRORFILE=%WORKDIR%\project\Win32BuildSetup\errormingw +SET BS_DIR=%WORKDIR%\project\Win32BuildSetup + +IF EXIST %ERRORFILE% del %ERRORFILE% > NUL + +rem compiles a bunch of mingw libs and not more +IF %opt%==sh ( + IF EXIST %WORKDIR%\project\BuildDependencies\%msys2%\usr\bin\sh.exe ( + ECHO starting sh shell + %WORKDIR%\project\BuildDependencies\%msys2%\usr\bin\sh.exe --login -i /xbmc/tools/buildsteps/windows/make-mingwlibs.sh --prompt=%PROMPTLEVEL% --mode=%BUILDMODE% --build32=%build32% --build64=%build64% --buildArm=%buildArm% --win10=%win10% + GOTO END + ) ELSE ( + GOTO ENDWITHERROR + ) +) +IF EXIST %WORKDIR%\project\BuildDependencies\%msys2%\usr\bin\mintty.exe ( + ECHO starting mintty shell + %WORKDIR%\project\BuildDependencies\%msys2%\usr\bin\mintty.exe -d -i /msys2.ico /usr/bin/bash --login /xbmc/tools/buildsteps/windows/make-mingwlibs.sh --prompt=%PROMPTLEVEL% --mode=%BUILDMODE% --build32=%build32% --build64=%build64% --buildArm=%buildArm% --win10=%win10% + GOTO END +) +GOTO ENDWITHERROR + +:ENDWITHERROR + ECHO msys environment not found + ECHO bla>%ERRORFILE% + EXIT /B 1 + +:END + ECHO exiting msys environment + IF EXIST %ERRORFILE% ( + ECHO failed to build mingw libs + EXIT /B 1 + ) + EXIT /B 0 + +ENDLOCAL diff --git a/tools/buildsteps/windows/make-mingwlibs.sh b/tools/buildsteps/windows/make-mingwlibs.sh new file mode 100644 index 0000000..e5a3594 --- /dev/null +++ b/tools/buildsteps/windows/make-mingwlibs.sh @@ -0,0 +1,162 @@ +[[ -f $(dirname $0)/buildhelpers.sh ]] && + source $(dirname $0)/buildhelpers.sh + +Win32BuildSetup=/xbmc/project/Win32BuildSetup +ERRORFILE=$Win32BuildSetup/errormingw +TOUCH=/bin/touch +RM=/bin/rm +NOPROMPT=0 +MAKECLEAN="" +MAKEFLAGS="" +TRIPLET="" + +while true; do + case $1 in + --build32=* ) build32="${1#*=}"; shift ;; + --build64=* ) build64="${1#*=}"; shift ;; + --buildArm=* ) buildArm="${1#*=}"; shift ;; + --prompt=* ) PROMPTLEVEL="${1#*=}"; shift ;; + --mode=* ) BUILDMODE="${1#*=}"; shift ;; + --win10=* ) win10="${1#*=}"; shift ;; + -- ) shift; break ;; + -* ) shift ;; + * ) break ;; + esac +done + +if [[ $build32 = "yes" ]]; then + TRIPLET=win32 + ARCH=x86 +elif [[ $build64 = "yes" ]]; then + TRIPLET=x64 + ARCH=x86_64 +elif [[ $buildArm = "yes" ]]; then + TRIPLET=arm + ARCH=arm +else + echo "-------------------------------------------------------------------------------" + echo " none of build types (build32, build64 or buildArm) was specified " + echo "-------------------------------------------------------------------------------" + # wait for key press + if [ "$PROMPTLEVEL" != "noprompt" ]; then + echo press a key to close the window + read + fi + exit +fi + +if [[ $win10 = "no" ]]; then + export _WIN32_WINNT=0x0600 + export NTDDI_VERSION=0x06000000 +elif [[ $win10 = "yes" ]]; then + TRIPLET=win10-$TRIPLET +fi + +export TRIPLET ARCH + +throwerror() { + $TOUCH $ERRORFILE + echo failed to compile $1 + if [ $NOPROMPT == 0 ]; then + read + fi +} + +checkfiles() { + for i in $@; do + if [ ! -f "$PREFIX/$i" ]; then + throwerror "$PREFIX/$i" + exit 1 + fi + done +} + +buildProcess() { +export PREFIX=/xbmc/project/BuildDependencies/mingwlibs/$TRIPLET +if [ "$(pathChanged $PREFIX /xbmc/tools/buildsteps/windows /xbmc/tools/depends/target/ffmpeg/FFMPEG-VERSION)" == "0" ]; then + return +fi + +if [ -d "$PREFIX" ]; then + rm -rdf $PREFIX/* +fi + +cd /xbmc/tools/buildsteps/windows + +# compile our mingw dlls +echo "-------------------------------------------------------------------------------" +echo " compiling mingw libs $TRIPLET" +echo +echo " NOPROMPT = $NOPROMPT" +echo " MAKECLEAN = $MAKECLEAN" +echo " WORKSPACE = $WORKSPACE" +echo +echo "-------------------------------------------------------------------------------" + +echo -ne "\033]0;building FFmpeg $TRIPLET\007" +echo "-------------------------------------------------" +echo " building FFmpeg $TRIPLET" +echo "-------------------------------------------------" +./buildffmpeg.sh $MAKECLEAN +checkfiles lib/avcodec.lib lib/avformat.lib lib/avutil.lib lib/postproc.lib lib/swscale.lib lib/avfilter.lib lib/swresample.lib +echo "-------------------------------------------------" +echo " building of FFmpeg $TRIPLET done..." +echo "-------------------------------------------------" +echo "-------------------------------------------------------------------------------" +echo " compile mingw libs $TRIPLET done..." +echo "-------------------------------------------------------------------------------" + +tagSuccessFulBuild $PREFIX /xbmc/tools/buildsteps/windows /xbmc/tools/depends/target/ffmpeg/FFMPEG-VERSION +} + +run_builds() { + local profile_path="" + if [[ $build32 = "yes" ]]; then + profile_path=/local32/etc/profile.local + elif [[ $build64 = "yes" ]]; then + profile_path=/local64/etc/profile.local + elif [[ $buildArm = "yes" ]]; then + profile_path=/local32/etc/profile.local + fi + + if [ ! -z $profile_path ]; then + if [[ ! -f "$profile_path" ]]; then + echo "-------------------------------------------------------------------------------" + echo " $TRIPLET build environment not configured, please run download-msys2.bat" + echo "-------------------------------------------------------------------------------" + else + source $profile_path + buildProcess + echo "-------------------------------------------------------------------------------" + echo " compile all libs $TRIPLET done..." + echo "-------------------------------------------------------------------------------" + fi + fi +} + +# cleanup +if [ -f $ERRORFILE ]; then + $RM $ERRORFILE +fi + +# check for noprompt +if [ "$PROMPTLEVEL" == "noprompt" ]; then + NOPROMPT=1 +fi + +if [ "$BUILDMODE" == "clean" ]; then + MAKECLEAN="clean" +else + MAKECLEAN="noclean" +fi + +run_builds + +echo -e "\033]0;compiling done...\007" +echo + +# wait for key press +if [ $NOPROMPT == 0 ]; then + echo press a key to close the window + read +fi diff --git a/tools/buildsteps/windows/patches/0001-ffmpeg-windows-configure-detect-openssl.patch b/tools/buildsteps/windows/patches/0001-ffmpeg-windows-configure-detect-openssl.patch new file mode 100644 index 0000000..b8e5b2f --- /dev/null +++ b/tools/buildsteps/windows/patches/0001-ffmpeg-windows-configure-detect-openssl.patch @@ -0,0 +1,25 @@ +From 08ae41e824e04ab48eafde763c72d1ff3e878a41 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak <lorusak@gmail.com> +Date: Sat, 10 Apr 2021 08:16:11 -0700 +Subject: [PATCH 1/4] ffmpeg: windows: configure: detect openssl + +--- + configure | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/configure b/configure +index d7a3f507e8..4b85e881b1 100755 +--- a/configure ++++ b/configure +@@ -6530,6 +6530,8 @@ enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OP + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto || + check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || ++ check_lib openssl openssl/ssl.h OPENSSL_init_ssl -llibssl -llibcrypto -lws2_32 -lgdi32 -ladvapi32 -luser32 || ++ check_lib openssl openssl/ssl.h SSL_library_init -llibeay32 -lssleay32 || + die "ERROR: openssl not found"; } + enabled pocketsphinx && require_pkg_config pocketsphinx pocketsphinx pocketsphinx/pocketsphinx.h ps_init + enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create && +-- +2.29.2 + diff --git a/tools/buildsteps/windows/patches/0002-ffmpeg-windows-configure-fix-zlib-conflict.patch b/tools/buildsteps/windows/patches/0002-ffmpeg-windows-configure-fix-zlib-conflict.patch new file mode 100644 index 0000000..064be1d --- /dev/null +++ b/tools/buildsteps/windows/patches/0002-ffmpeg-windows-configure-fix-zlib-conflict.patch @@ -0,0 +1,26 @@ +From 1e57e7f49f1a74ee11d3c8dd5d407f35eecd5167 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak <lorusak@gmail.com> +Date: Sat, 10 Apr 2021 08:16:48 -0700 +Subject: [PATCH 2/4] ffmpeg: windows: configure: fix zlib conflict + +--- + configure | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/configure b/configure +index 4b85e881b1..da457705d1 100755 +--- a/configure ++++ b/configure +@@ -7627,6 +7627,9 @@ print_config CONFIG_ "$config_files" $CONFIG_LIST \ + $CONFIG_EXTRA \ + $ALL_COMPONENTS \ + ++echo "#if defined(HAVE_UNISTD_H) && HAVE_UNISTD_H == 0" >> $TMPH ++echo "#undef HAVE_UNISTD_H" >> $TMPH ++echo "#endif" >> $TMPH + echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH + echo "endif # FFMPEG_CONFIG_MAK" >> ffbuild/config.mak + +-- +2.29.2 + diff --git a/tools/buildsteps/windows/patches/0003-ffmpeg-windows-configure-allow-building-static.patch b/tools/buildsteps/windows/patches/0003-ffmpeg-windows-configure-allow-building-static.patch new file mode 100644 index 0000000..bbb3e0a --- /dev/null +++ b/tools/buildsteps/windows/patches/0003-ffmpeg-windows-configure-allow-building-static.patch @@ -0,0 +1,34 @@ +From efb771d944e96bcbb24635bcae99a43dffab262e Mon Sep 17 00:00:00 2001 +From: Lukas Rusak <lorusak@gmail.com> +Date: Sat, 10 Apr 2021 08:17:11 -0700 +Subject: [PATCH 3/4] ffmpeg: windows: configure: allow building static + +--- + configure | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/configure b/configure +index da457705d1..e3a8f45ff4 100755 +--- a/configure ++++ b/configure +@@ -5440,6 +5440,8 @@ case $target_os in + enabled shared && ! enabled small && test_cmd $windres --version && enable gnu_windres + enabled x86_32 && check_ldflags -Wl,--large-address-aware + shlibdir_default="$bindir_default" ++ LIBPREF="" ++ LIBSUF=".lib" + SLIBPREF="" + SLIBSUF=".dll" + SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' +@@ -5489,6 +5491,8 @@ case $target_os in + fi + enabled x86_32 && check_ldflags -LARGEADDRESSAWARE + shlibdir_default="$bindir_default" ++ LIBPREF="" ++ LIBSUF=".lib" + SLIBPREF="" + SLIBSUF=".dll" + SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' +-- +2.29.2 + diff --git a/tools/buildsteps/windows/patches/0004-ffmpeg-windows-configure-detect-libdav1d.patch b/tools/buildsteps/windows/patches/0004-ffmpeg-windows-configure-detect-libdav1d.patch new file mode 100644 index 0000000..617c87a --- /dev/null +++ b/tools/buildsteps/windows/patches/0004-ffmpeg-windows-configure-detect-libdav1d.patch @@ -0,0 +1,25 @@ +From d475edac8c6890fbaea5ca20d552c60aead0f04a Mon Sep 17 00:00:00 2001 +From: Lukas Rusak <lorusak@gmail.com> +Date: Sat, 10 Apr 2021 08:19:27 -0700 +Subject: [PATCH 4/4] ffmpeg: windows: configure: detect libdav1d + +--- + configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index e3a8f45ff4..983d7e1078 100755 +--- a/configure ++++ b/configure +@@ -6358,7 +6358,7 @@ enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && + die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } + enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas + enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create -lcodec2 +-enabled libdav1d && require_pkg_config libdav1d "dav1d >= 0.5.0" "dav1d/dav1d.h" dav1d_version ++enabled libdav1d && require libdav1d dav1d/dav1d.h dav1d_version -llibdav1d + enabled libdavs2 && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open + enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new + enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion +-- +2.29.2 + diff --git a/tools/buildsteps/windows/patches/readme.txt b/tools/buildsteps/windows/patches/readme.txt new file mode 100644 index 0000000..80632dc --- /dev/null +++ b/tools/buildsteps/windows/patches/readme.txt @@ -0,0 +1,6 @@ +The folder contains patches for libs which will be built by mingw +in the following format: + + dddd-libname-*.patch + +The build system will apply these patches automatically
\ No newline at end of file diff --git a/tools/buildsteps/windows/prepare-env.bat b/tools/buildsteps/windows/prepare-env.bat new file mode 100644 index 0000000..bcbaded --- /dev/null +++ b/tools/buildsteps/windows/prepare-env.bat @@ -0,0 +1,27 @@ +@ECHO OFF + +PUSHD %~dp0\..\..\.. +SET WORKSPACE=%CD% +POPD + +ECHO Workspace is %WORKSPACE% + +cd %WORKSPACE% +rem clean the BUILD_WIN32 at first to avoid problems with possible git files in there +IF EXIST %WORKSPACE%\project\Win32BuildSetup\BUILD_WIN32 rmdir %WORKSPACE%\project\Win32BuildSetup\BUILD_WIN32 /S /Q + +rem also clean 'build' dir used to build ffmpeg as git clean has trouble to remove some times +IF EXIST %WORKSPACE%\project\BuildDependencies\build rmdir %WORKSPACE%\project\BuildDependencies\build /S /Q + +rem daemonized executables block mingw from being cleaned with git +TASKKILL /IM "dirmngr.exe" /F >nul 2>&1 +TASKKILL /IM "gpg-agent.exe" /F >nul 2>&1 + +rem we assume git in path as this is a requirement +rem git clean the untracked files and directories +rem but keep the downloaded dependencies +rem also keeps MSYS2 installation +SET GIT_CLEAN_CMD=git clean -xffd -e "project/BuildDependencies/downloads" -e "project/BuildDependencies/downloads2" -e "project/BuildDependencies/mingwlibs" -e "project/BuildDependencies/msys64" -e "project/BuildDependencies/tools" -e "cmake/addons/build/download/msys2-base-*.tar.xz" + +ECHO running %GIT_CLEAN_CMD% +%GIT_CLEAN_CMD% diff --git a/tools/buildsteps/windows/run-tests.bat b/tools/buildsteps/windows/run-tests.bat new file mode 100644 index 0000000..2bde835 --- /dev/null +++ b/tools/buildsteps/windows/run-tests.bat @@ -0,0 +1,70 @@ +@ECHO OFF +SETLOCAL ENABLEDELAYEDEXPANSION + +REM setup all paths +PUSHD %~dp0\..\..\.. +SET WORKSPACE=%CD% +POPD +cd %WORKSPACE%\kodi-build.%TARGET_PLATFORM% + +REM read the version values from version.txt +FOR /f "tokens=1,2" %%i IN (%WORKSPACE%\version.txt) DO IF "%%i" == "APP_NAME" SET APP_NAME=%%j + +CLS +COLOR 1B +TITLE %APP_NAME% testsuite Build-/Runscript + +rem ------------------------------------------------------------- +rem CONFIG START +SET exitcode=0 +SET useshell=sh +SET buildconfig=Release +SET PreferredToolArchitecture=x64 + + + rem CONFIG END + rem ------------------------------------------------------------- + +echo Building %buildconfig% +IF EXIST buildlog.html del buildlog.html /q + +ECHO Compiling testsuite... +cmake.exe --build . --config "%buildconfig%" --target %APP_NAME%-test + +IF %errorlevel%==1 ( + set DIETEXT="%APP_NAME%-test.exe failed to build! See %CD%\..\vs2010express\XBMC\%buildconfig%\objs\XBMC.log" + type "%CD%\..\vs2010express\XBMC\%buildconfig%\objs\XBMC.log" + goto DIE +) +ECHO Done building! +ECHO ------------------------------------------------------------ + +:RUNTESTSUITE +ECHO Running testsuite... + "%buildconfig%\%APP_NAME%-test.exe" --gtest_output=xml:%WORKSPACE%\gtestresults.xml + + rem Adapt gtest xml output to be conform with junit xml + rem this basically looks for lines which have "notrun" in the <testcase /> tag + rem and adds a <skipped/> subtag into it. For example: + rem <testcase name="IsStarted" status="notrun" time="0" classname="TestWebServer"/> + rem becomes + rem <testcase name="IsStarted" status="notrun" time="0" classname="TestWebServer"><skipped/></testcase> + @PowerShell "(GC %WORKSPACE%\gtestresults.xml)|%%{$_ -Replace '(<testcase.+)("notrun")(.+)(/>)','$1$2$3><skipped/></testcase>'}|SC %WORKSPACE%\gtestresults-skipped.xml" + del %WORKSPACE%\gtestresults.xml + move %WORKSPACE%\gtestresults-skipped.xml %WORKSPACE%\gtestresults.xml +ECHO Done running testsuite! +ECHO ------------------------------------------------------------ +GOTO END + +:DIE + ECHO ------------------------------------------------------------ + ECHO !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!- + ECHO ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR + ECHO !-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!- + set DIETEXT=ERROR: %DIETEXT% + echo %DIETEXT% + SET exitcode=1 + ECHO ------------------------------------------------------------ + +:END + EXIT /B %exitcode% diff --git a/tools/buildsteps/windows/vswhere.bat b/tools/buildsteps/windows/vswhere.bat new file mode 100644 index 0000000..b8c60b9 --- /dev/null +++ b/tools/buildsteps/windows/vswhere.bat @@ -0,0 +1,86 @@ +@ECHO OFF + +IF "%1"=="" ( + ECHO ERROR! vswhere.bat: architecture not specified + EXIT /B 1 +) + +REM running vcvars more than once can cause problems; exit early if using the same configuration, error if different +IF "%VSWHERE_SET%"=="%*" ( + ECHO vswhere.bat: VC vars already configured for %VSWHERE_SET% + GOTO :EOF +) +IF "%VSWHERE_SET%" NEQ "" ( + ECHO ERROR! vswhere.bat: VC vars are configured for %VSWHERE_SET% + EXIT /B 1 +) + +REM Trick to make the path absolute +PUSHD %~dp0\..\..\..\project\BuildDependencies +SET builddeps=%CD% +POPD + +SET arch=%1 +SET vcarch=amd64 +SET vcstore=%2 +SET vcvars=no +SET sdkver= + +SET vsver= +SET toolsdir=%arch% + +IF "%arch%" NEQ "x64" ( + SET vcarch=%vcarch%_%arch% +) + +IF "%arch%"=="x86" ( + SET toolsdir=win32 +) + +IF "%vcstore%"=="store" ( + SET sdkver=10.0.18362.0 + SET toolsdir="win10-%toolsdir%" +) + +SET vswhere="%builddeps%\%toolsdir%\tools\vswhere\vswhere.exe" + +FOR /f "usebackq tokens=1* delims=" %%i in (`%vswhere% -latest -property installationPath`) do ( + IF EXIST "%%i\VC\Auxiliary\Build\vcvarsall.bat" ( + SET vcvars="%%i\VC\Auxiliary\Build\vcvarsall.bat" + SET vsver=15 2017 + ECHO %%i | findstr "2019" >NUL 2>NUL + IF NOT ERRORLEVEL 1 SET vsver=16 2019 + ECHO %%i | findstr "2022" >NUL 2>NUL + IF NOT ERRORLEVEL 1 SET vsver=17 2022 + ) +) + +IF %vcvars%==no ( + FOR /f "usebackq tokens=1* delims=" %%i in (`%vswhere% -legacy -property installationPath`) do ( + ECHO %%i | findstr "14" >NUL 2>NUL + IF NOT ERRORLEVEL 1 ( + IF EXIST "%%i\VC\vcvarsall.bat" ( + SET vcvars="%%i\VC\vcvarsall.bat" + SET vsver=14 2015 + ) + ) + ) +) + +IF %vcvars%==no ( + ECHO "ERROR! Could not find vcvarsall.bat" + EXIT /B 1 +) + +REM vcvars changes the cwd so we need to store it and restore it +PUSHD %~dp0 +CALL %vcvars% %vcarch% %vcstore% %sdkver% +POPD + +IF ERRORLEVEL 1 ( + ECHO "ERROR! something went wrong when calling" + ECHO %vcvars% %vcarch% %vcstore% %sdkver% + EXIT /B 1 +) + +SET VSWHERE_SET=%* diff --git a/tools/buildsteps/windows/win32-uwp/BuildSetup.bat b/tools/buildsteps/windows/win32-uwp/BuildSetup.bat new file mode 100644 index 0000000..5ddf234 --- /dev/null +++ b/tools/buildsteps/windows/win32-uwp/BuildSetup.bat @@ -0,0 +1,18 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x86 store +IF ERRORLEVEL 1 ( + ECHO ERROR! BuildSetup.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) + +SET cmakeGenerator=Visual Studio %vsver% +SET cmakeArch=Win32 +SET TARGET_ARCHITECTURE=x86 +SET TARGET_PLATFORM=win32-uwp +SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion% + +CALL BuildSetup.bat %* +POPD diff --git a/tools/buildsteps/windows/win32-uwp/bootstrap-addons.bat b/tools/buildsteps/windows/win32-uwp/bootstrap-addons.bat new file mode 100644 index 0000000..0f67ddb --- /dev/null +++ b/tools/buildsteps/windows/win32-uwp/bootstrap-addons.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x86 store +IF ERRORLEVEL 1 ( + ECHO ERROR! bootstrap-addons.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL bootstrap-addons %* +POPD diff --git a/tools/buildsteps/windows/win32-uwp/download-dependencies.bat b/tools/buildsteps/windows/win32-uwp/download-dependencies.bat new file mode 100644 index 0000000..24ed2f1 --- /dev/null +++ b/tools/buildsteps/windows/win32-uwp/download-dependencies.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL download-dependencies.bat win10-win32 +POPD diff --git a/tools/buildsteps/windows/win32-uwp/download-msys2.bat b/tools/buildsteps/windows/win32-uwp/download-msys2.bat new file mode 100644 index 0000000..8c041ba --- /dev/null +++ b/tools/buildsteps/windows/win32-uwp/download-msys2.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL download-msys2.bat %* +POPD diff --git a/tools/buildsteps/windows/win32-uwp/make-addons.bat b/tools/buildsteps/windows/win32-uwp/make-addons.bat new file mode 100644 index 0000000..0893cee --- /dev/null +++ b/tools/buildsteps/windows/win32-uwp/make-addons.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x86 store +IF ERRORLEVEL 1 ( + ECHO ERROR! make-addons.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL make-addons.bat win10 %* +POPD diff --git a/tools/buildsteps/windows/win32-uwp/make-mingwlibs.bat b/tools/buildsteps/windows/win32-uwp/make-mingwlibs.bat new file mode 100644 index 0000000..f47434e --- /dev/null +++ b/tools/buildsteps/windows/win32-uwp/make-mingwlibs.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x86 store +IF ERRORLEVEL 1 ( + ECHO ERROR! make-mingwlibs.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL make-mingwlibs.bat win10 %* +POPD diff --git a/tools/buildsteps/windows/win32-uwp/prepare-env.bat b/tools/buildsteps/windows/win32-uwp/prepare-env.bat new file mode 100644 index 0000000..354a5cf --- /dev/null +++ b/tools/buildsteps/windows/win32-uwp/prepare-env.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL prepare-env.bat +POPD diff --git a/tools/buildsteps/windows/win32/BuildSetup.bat b/tools/buildsteps/windows/win32/BuildSetup.bat new file mode 100644 index 0000000..0c10f43 --- /dev/null +++ b/tools/buildsteps/windows/win32/BuildSetup.bat @@ -0,0 +1,18 @@ +@ECHO OFF + +PUSHD %~dp0\.. + +CALL vswhere.bat x86 +IF ERRORLEVEL 1 ( + ECHO ERROR! BuildSetup.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) + +SET cmakeGenerator=Visual Studio %vsver% +SET cmakeArch=Win32 +SET TARGET_ARCHITECTURE=x86 +SET TARGET_PLATFORM=%TARGET_ARCHITECTURE% + +CALL BuildSetup.bat %* +POPD diff --git a/tools/buildsteps/windows/win32/bootstrap-addons.bat b/tools/buildsteps/windows/win32/bootstrap-addons.bat new file mode 100644 index 0000000..5918ad9 --- /dev/null +++ b/tools/buildsteps/windows/win32/bootstrap-addons.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x86 +IF ERRORLEVEL 1 ( + ECHO ERROR! bootstrap-addons.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL bootstrap-addons %* +POPD diff --git a/tools/buildsteps/windows/win32/download-dependencies.bat b/tools/buildsteps/windows/win32/download-dependencies.bat new file mode 100644 index 0000000..ecb5897 --- /dev/null +++ b/tools/buildsteps/windows/win32/download-dependencies.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL download-dependencies.bat win32 +POPD diff --git a/tools/buildsteps/windows/win32/download-msys2.bat b/tools/buildsteps/windows/win32/download-msys2.bat new file mode 100644 index 0000000..8c041ba --- /dev/null +++ b/tools/buildsteps/windows/win32/download-msys2.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL download-msys2.bat %* +POPD diff --git a/tools/buildsteps/windows/win32/make-addons.bat b/tools/buildsteps/windows/win32/make-addons.bat new file mode 100644 index 0000000..7efc4ca --- /dev/null +++ b/tools/buildsteps/windows/win32/make-addons.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x86 +IF ERRORLEVEL 1 ( + ECHO ERROR! make-addons.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL make-addons.bat %* +POPD diff --git a/tools/buildsteps/windows/win32/make-mingwlibs.bat b/tools/buildsteps/windows/win32/make-mingwlibs.bat new file mode 100644 index 0000000..889b27e --- /dev/null +++ b/tools/buildsteps/windows/win32/make-mingwlibs.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x86 +IF ERRORLEVEL 1 ( + ECHO ERROR! make-mingwlibs.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL make-mingwlibs.bat %* +POPD diff --git a/tools/buildsteps/windows/win32/prepare-env.bat b/tools/buildsteps/windows/win32/prepare-env.bat new file mode 100644 index 0000000..354a5cf --- /dev/null +++ b/tools/buildsteps/windows/win32/prepare-env.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL prepare-env.bat +POPD diff --git a/tools/buildsteps/windows/win32/run-tests.bat b/tools/buildsteps/windows/win32/run-tests.bat new file mode 100644 index 0000000..1c07563 --- /dev/null +++ b/tools/buildsteps/windows/win32/run-tests.bat @@ -0,0 +1,13 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x86 +IF ERRORLEVEL 1 ( + ECHO ERROR! run-tests.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +SET TARGET_PLATFORM=x86 + +CALL run-tests.bat +POPD diff --git a/tools/buildsteps/windows/x64-uwp/BuildSetup.bat b/tools/buildsteps/windows/x64-uwp/BuildSetup.bat new file mode 100644 index 0000000..8144248 --- /dev/null +++ b/tools/buildsteps/windows/x64-uwp/BuildSetup.bat @@ -0,0 +1,18 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x64 store +IF ERRORLEVEL 1 ( + ECHO ERROR! BuildSetup.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) + +SET cmakeGenerator=Visual Studio %vsver% +SET cmakeArch=x64 +SET TARGET_ARCHITECTURE=x64 +SET TARGET_PLATFORM=%TARGET_ARCHITECTURE%-uwp +SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion% + +CALL BuildSetup.bat %* +POPD diff --git a/tools/buildsteps/windows/x64-uwp/bootstrap-addons.bat b/tools/buildsteps/windows/x64-uwp/bootstrap-addons.bat new file mode 100644 index 0000000..83eed23 --- /dev/null +++ b/tools/buildsteps/windows/x64-uwp/bootstrap-addons.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x64 store +IF ERRORLEVEL 1 ( + ECHO ERROR! bootstrap-addons.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL bootstrap-addons %* +POPD diff --git a/tools/buildsteps/windows/x64-uwp/download-dependencies.bat b/tools/buildsteps/windows/x64-uwp/download-dependencies.bat new file mode 100644 index 0000000..4af0164 --- /dev/null +++ b/tools/buildsteps/windows/x64-uwp/download-dependencies.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL download-dependencies.bat win10-x64 +POPD diff --git a/tools/buildsteps/windows/x64-uwp/download-msys2.bat b/tools/buildsteps/windows/x64-uwp/download-msys2.bat new file mode 100644 index 0000000..8c041ba --- /dev/null +++ b/tools/buildsteps/windows/x64-uwp/download-msys2.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL download-msys2.bat %* +POPD diff --git a/tools/buildsteps/windows/x64-uwp/make-addons.bat b/tools/buildsteps/windows/x64-uwp/make-addons.bat new file mode 100644 index 0000000..82bd1af --- /dev/null +++ b/tools/buildsteps/windows/x64-uwp/make-addons.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x64 store +IF ERRORLEVEL 1 ( + ECHO ERROR! make-addons.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL make-addons.bat win10 %* +POPD diff --git a/tools/buildsteps/windows/x64-uwp/make-mingwlibs.bat b/tools/buildsteps/windows/x64-uwp/make-mingwlibs.bat new file mode 100644 index 0000000..9e1ef90 --- /dev/null +++ b/tools/buildsteps/windows/x64-uwp/make-mingwlibs.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x64 store +IF ERRORLEVEL 1 ( + ECHO ERROR! make-mingwlibs.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL make-mingwlibs.bat build64 win10 %* +POPD diff --git a/tools/buildsteps/windows/x64-uwp/prepare-env.bat b/tools/buildsteps/windows/x64-uwp/prepare-env.bat new file mode 100644 index 0000000..354a5cf --- /dev/null +++ b/tools/buildsteps/windows/x64-uwp/prepare-env.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL prepare-env.bat +POPD diff --git a/tools/buildsteps/windows/x64/BuildSetup.bat b/tools/buildsteps/windows/x64/BuildSetup.bat new file mode 100644 index 0000000..09acf3f --- /dev/null +++ b/tools/buildsteps/windows/x64/BuildSetup.bat @@ -0,0 +1,17 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x64 +IF ERRORLEVEL 1 ( + ECHO ERROR! BuildSetup.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) + +SET cmakeGenerator=Visual Studio %vsver% +SET cmakeArch=x64 +SET TARGET_ARCHITECTURE=x64 +SET TARGET_PLATFORM=%TARGET_ARCHITECTURE% + +CALL BuildSetup.bat %* +POPD diff --git a/tools/buildsteps/windows/x64/bootstrap-addons.bat b/tools/buildsteps/windows/x64/bootstrap-addons.bat new file mode 100644 index 0000000..45c5de6 --- /dev/null +++ b/tools/buildsteps/windows/x64/bootstrap-addons.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x64 +IF ERRORLEVEL 1 ( + ECHO ERROR! bootstrap-addons.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL bootstrap-addons %* +POPD diff --git a/tools/buildsteps/windows/x64/download-dependencies.bat b/tools/buildsteps/windows/x64/download-dependencies.bat new file mode 100644 index 0000000..a51c3d4 --- /dev/null +++ b/tools/buildsteps/windows/x64/download-dependencies.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL download-dependencies.bat x64 +POPD diff --git a/tools/buildsteps/windows/x64/download-msys2.bat b/tools/buildsteps/windows/x64/download-msys2.bat new file mode 100644 index 0000000..8c041ba --- /dev/null +++ b/tools/buildsteps/windows/x64/download-msys2.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL download-msys2.bat %* +POPD diff --git a/tools/buildsteps/windows/x64/make-addons.bat b/tools/buildsteps/windows/x64/make-addons.bat new file mode 100644 index 0000000..ec9803f --- /dev/null +++ b/tools/buildsteps/windows/x64/make-addons.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x64 +IF ERRORLEVEL 1 ( + ECHO ERROR! make-addons.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL make-addons.bat %* +POPD diff --git a/tools/buildsteps/windows/x64/make-mingwlibs.bat b/tools/buildsteps/windows/x64/make-mingwlibs.bat new file mode 100644 index 0000000..41471e5 --- /dev/null +++ b/tools/buildsteps/windows/x64/make-mingwlibs.bat @@ -0,0 +1,11 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x64 +IF ERRORLEVEL 1 ( + ECHO ERROR! make-mingwlibs.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +CALL make-mingwlibs.bat build64 %* +POPD diff --git a/tools/buildsteps/windows/x64/prepare-env.bat b/tools/buildsteps/windows/x64/prepare-env.bat new file mode 100644 index 0000000..354a5cf --- /dev/null +++ b/tools/buildsteps/windows/x64/prepare-env.bat @@ -0,0 +1,5 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL prepare-env.bat +POPD diff --git a/tools/buildsteps/windows/x64/run-tests.bat b/tools/buildsteps/windows/x64/run-tests.bat new file mode 100644 index 0000000..a21ea89 --- /dev/null +++ b/tools/buildsteps/windows/x64/run-tests.bat @@ -0,0 +1,13 @@ +@ECHO OFF + +PUSHD %~dp0\.. +CALL vswhere.bat x64 +IF ERRORLEVEL 1 ( + ECHO ERROR! run-tests.bat: Something went wrong when calling vswhere.bat + POPD + EXIT /B 1 +) +SET TARGET_PLATFORM=x64 + +CALL run-tests.bat +POPD |