diff --git a/build-tools/windows/build.cmd b/build-tools/windows/build.cmd index 0e636a61aa..830136f6b9 100644 --- a/build-tools/windows/build.cmd +++ b/build-tools/windows/build.cmd @@ -566,7 +566,7 @@ if not "%ARG_KRITA_BUILD_DIR%" == "" ( set "KRITA_BUILD_DIR=%ARG_KRITA_BUILD_DIR%" ) if "%KRITA_BUILD_DIR%" == "" ( - set KRITA_BUILD_DIR=%CD%\b\ + set "KRITA_BUILD_DIR=%CD%\b\" echo Using default Krita build dir: !KRITA_BUILD_DIR! if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this ok? [y/n] " @@ -586,7 +586,7 @@ if not "%ARG_KRITA_INSTALL_DIR%" == "" ( set "KRITA_INSTALL_DIR=%ARG_KRITA_INSTALL_DIR%" ) if "%KRITA_INSTALL_DIR%" == "" ( - set KRITA_INSTALL_DIR=%CD%\i\ + set "KRITA_INSTALL_DIR=%CD%\i\" echo Using default Krita install dir: !KRITA_INSTALL_DIR! if not "%ARG_NO_INTERACTIVE%" == "1" ( choice /c ny /n /m "Is this ok? [y/n] " @@ -617,26 +617,26 @@ if not "%ARG_NO_INTERACTIVE%" == "1" ( ) :: Initialize clean PATH -set PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ -set PATH=%MINGW_BIN_DIR%;%PYTHON_BIN_DIR%;%PATH% +set "PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\" +set "PATH=%MINGW_BIN_DIR%;%PYTHON_BIN_DIR%;%PATH%" echo Creating dirs... if NOT "%ARG_SKIP_DEPS%" == "1" ( - mkdir %DEPS_DOWNLOAD_DIR% + mkdir "%DEPS_DOWNLOAD_DIR%" if errorlevel 1 ( if not exist "%DEPS_DOWNLOAD_DIR%\" ( echo ERROR: Cannot create deps download dir! 1>&2 exit /b 103 ) ) - mkdir %DEPS_BUILD_DIR% + mkdir "%DEPS_BUILD_DIR%" if errorlevel 1 ( if not exist "%DEPS_BUILD_DIR%\" ( echo ERROR: Cannot create deps build dir! 1>&2 exit /b 103 ) ) - mkdir %DEPS_INSTALL_DIR% + mkdir "%DEPS_INSTALL_DIR%" if errorlevel 1 ( if not exist "%DEPS_INSTALL_DIR%\" ( echo ERROR: Cannot create deps install dir! 1>&2 @@ -645,14 +645,14 @@ if NOT "%ARG_SKIP_DEPS%" == "1" ( ) ) if NOT "%ARG_SKIP_KRITA%" == "1" ( - mkdir %KRITA_BUILD_DIR% + mkdir "%KRITA_BUILD_DIR%" if errorlevel 1 ( if not exist "%KRITA_BUILD_DIR%\" ( echo ERROR: Cannot create Krita build dir! 1>&2 exit /b 103 ) ) - mkdir %KRITA_INSTALL_DIR% + mkdir "%KRITA_INSTALL_DIR%" if errorlevel 1 ( if not exist "%KRITA_INSTALL_DIR%\" ( echo ERROR: Cannot create Krita install dir! 1>&2 @@ -669,21 +669,21 @@ set QT_ENABLE_DEBUG_INFO=OFF :: Paths for CMake set "BUILDDIR_DOWNLOAD_CMAKE=%DEPS_DOWNLOAD_DIR:\=/%" -set "BUILDDIR_DOWNLOAD_CMAKE=%BUILDDIR_DOWNLOAD_CMAKE: =\ %" +::set "BUILDDIR_DOWNLOAD_CMAKE=%BUILDDIR_DOWNLOAD_CMAKE: =\ %" set "BUILDDIR_DEPS_INSTALL_CMAKE=%DEPS_INSTALL_DIR:\=/%" -set "BUILDDIR_DEPS_INSTALL_CMAKE=%BUILDDIR_DEPS_INSTALL_CMAKE: =\ %" +::set "BUILDDIR_DEPS_INSTALL_CMAKE=%BUILDDIR_DEPS_INSTALL_CMAKE: =\ %" set "BUILDDIR_KRITA_INSTALL_CMAKE=%KRITA_INSTALL_DIR:\=/%" -set "BUILDDIR_KRITA_INSTALL_CMAKE=%BUILDDIR_KRITA_INSTALL_CMAKE: =\ %" +::set "BUILDDIR_KRITA_INSTALL_CMAKE=%BUILDDIR_KRITA_INSTALL_CMAKE: =\ %" -set PATH=%DEPS_INSTALL_DIR%\bin;%PATH% +set "PATH=%DEPS_INSTALL_DIR%\bin;%PATH%" if not "%GETTEXT_SEARCH_PATH%" == "" ( - set PATH=%PATH%;%GETTEXT_SEARCH_PATH% + set "PATH=%PATH%;%GETTEXT_SEARCH_PATH%" ) if "%ARG_SKIP_DEPS%" == "1" goto skip_build_deps -pushd %DEPS_BUILD_DIR% +pushd "%DEPS_BUILD_DIR%" if errorlevel 1 ( echo ERROR: Cannot enter deps build dir! 1>&2 exit /b 104 @@ -694,8 +694,8 @@ echo Running CMake for deps... -DSUBMAKE_JOBS=%PARALLEL_JOBS% ^ -DQT_ENABLE_DEBUG_INFO=%QT_ENABLE_DEBUG_INFO% ^ -DQT_ENABLE_DYNAMIC_OPENGL=%QT_ENABLE_DYNAMIC_OPENGL% ^ - -DEXTERNALS_DOWNLOAD_DIR=%BUILDDIR_DOWNLOAD_CMAKE% ^ - -DINSTALL_ROOT=%BUILDDIR_DEPS_INSTALL_CMAKE% ^ + -DEXTERNALS_DOWNLOAD_DIR="%BUILDDIR_DOWNLOAD_CMAKE%" ^ + -DINSTALL_ROOT="%BUILDDIR_DEPS_INSTALL_CMAKE%" ^ -G "MinGW Makefiles" ^ -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% if errorlevel 1 ( @@ -735,11 +735,11 @@ if errorlevel 1 ( echo Running CMake for Krita... "%CMAKE_EXE%" "%KRITA_SRC_DIR%\." ^ -DBoost_DEBUG=OFF ^ - -DBOOST_INCLUDEDIR=%BUILDDIR_DEPS_INSTALL_CMAKE%/include ^ - -DBOOST_ROOT=%BUILDDIR_DEPS_INSTALL_CMAKE% ^ - -DBOOST_LIBRARYDIR=%BUILDDIR_DEPS_INSTALL_CMAKE%/lib ^ - -DCMAKE_PREFIX_PATH=%BUILDDIR_DEPS_INSTALL_CMAKE% ^ - -DCMAKE_INSTALL_PREFIX=%BUILDDIR_KRITA_INSTALL_CMAKE% ^ + -DBOOST_INCLUDEDIR="%BUILDDIR_DEPS_INSTALL_CMAKE%/include" ^ + -DBOOST_ROOT="%BUILDDIR_DEPS_INSTALL_CMAKE%" ^ + -DBOOST_LIBRARYDIR="%BUILDDIR_DEPS_INSTALL_CMAKE%/lib" ^ + -DCMAKE_PREFIX_PATH="%BUILDDIR_DEPS_INSTALL_CMAKE%" ^ + -DCMAKE_INSTALL_PREFIX="%BUILDDIR_KRITA_INSTALL_CMAKE%" ^ -DBUILD_TESTING=OFF ^ -DHAVE_MEMORY_LEAK_TRACKER=OFF ^ -Wno-dev ^ diff --git a/packaging/windows/package-complete.cmd b/packaging/windows/package-complete.cmd index 5c667e7473..472cf3db72 100644 --- a/packaging/windows/package-complete.cmd +++ b/packaging/windows/package-complete.cmd @@ -425,21 +425,21 @@ if not "%KRITA_INSTALL_DIR: =%" == "%KRITA_INSTALL_DIR%" ( exit /B 1 ) -set pkg_name=%ARG_PACKAGE_NAME% +set "pkg_name=%ARG_PACKAGE_NAME%" echo Package name is "%pkg_name%" -set pkg_root=%CD%\%pkg_name% +set "pkg_root=%CD%\%pkg_name%" echo Packaging dir is %pkg_root% echo. -if exist %pkg_root% ( +if exist "%pkg_root%" ( echo ERROR: Packaging dir already exists! Please remove or rename it first. exit /B 1 ) -if exist %pkg_root%.zip ( +if exist "%pkg_root%.zip" ( echo ERROR: Packaging zip already exists! Please remove or rename it first. exit /B 1 ) -if exist %pkg_root%-dbg.zip ( +if exist "%pkg_root%-dbg.zip" ( echo ERROR: Packaging debug zip already exists! Please remove or rename it first. exit /B 1 ) @@ -458,8 +458,8 @@ if not "%ARG_NO_INTERACTIVE%" == "1" ( :: Initialize clean PATH -set PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ -set PATH=%MINGW_BIN_DIR%;%DEPS_INSTALL_DIR%\bin;%PATH% +set "PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\" +set "PATH=%MINGW_BIN_DIR%;%DEPS_INSTALL_DIR%\bin;%PATH%" echo. @@ -514,10 +514,10 @@ if errorlevel 1 ( echo. echo Creating base directories... -mkdir %pkg_root% && ^ -mkdir %pkg_root%\bin && ^ -mkdir %pkg_root%\lib && ^ -mkdir %pkg_root%\share +mkdir "%pkg_root%" && ^ +mkdir "%pkg_root%\bin" && ^ +mkdir "%pkg_root%\lib" && ^ +mkdir "%pkg_root%\share" if errorlevel 1 ( echo ERROR: Cannot create packaging dir tree! %PAUSE% @@ -543,62 +543,62 @@ if x%IS_TDM% == x ( set "STDLIBS=gomp_64-1" ) ) -for %%L in (%STDLIBS%) do copy "%MINGW_BIN_DIR%\lib%%L.dll" %pkg_root%\bin +for %%L in (%STDLIBS%) do copy "%MINGW_BIN_DIR%\lib%%L.dll" "%pkg_root%\bin" echo. echo Copying files... :: krita.exe -copy %KRITA_INSTALL_DIR%\bin\krita.exe %pkg_root%\bin +copy "%KRITA_INSTALL_DIR%\bin\krita.exe" "%pkg_root%\bin" :: DLLs from bin/ echo INFO: Copying all DLLs except Qt5* from bin/ setlocal enableextensions enabledelayedexpansion for /f "delims=" %%F in ('dir /b "%KRITA_INSTALL_DIR%\bin\*.dll"') do ( set file=%%F set file=!file:~0,3! - if not x!file! == xQt5 copy %KRITA_INSTALL_DIR%\bin\%%F %pkg_root%\bin + if not x!file! == xQt5 copy "%KRITA_INSTALL_DIR%\bin\%%F" "%pkg_root%\bin" ) for /f "delims=" %%F in ('dir /b "%DEPS_INSTALL_DIR%\bin\*.dll"') do ( set file=%%F set file=!file:~0,3! - if not x!file! == xQt5 copy %DEPS_INSTALL_DIR%\bin\%%F %pkg_root%\bin + if not x!file! == xQt5 copy "%DEPS_INSTALL_DIR%\bin\%%F" "%pkg_root%\bin" ) endlocal :: symsrv.yes for Dr. Mingw -copy %DEPS_INSTALL_DIR%\bin\symsrv.yes %pkg_root%\bin +copy "%DEPS_INSTALL_DIR%\bin\symsrv.yes" "%pkg_root%\bin" :: DLLs from lib/ echo INFO: Copying all DLLs from lib/ (deps) -copy %DEPS_INSTALL_DIR%\lib\*.dll %pkg_root%\bin +copy "%DEPS_INSTALL_DIR%\lib\*.dll" "%pkg_root%\bin" :: Boost, there might be more than one leftover but we can't really do much -copy %DEPS_INSTALL_DIR%\bin\libboost_system-*.dll %pkg_root%\bin +copy "%DEPS_INSTALL_DIR%\bin\libboost_system-*.dll" "%pkg_root%\bin" :: KF5 plugins may be placed at different locations depending on how Qt is built -xcopy /S /Y /I %DEPS_INSTALL_DIR%\lib\plugins\imageformats %pkg_root%\bin\imageformats -xcopy /S /Y /I %DEPS_INSTALL_DIR%\plugins\imageformats %pkg_root%\bin\imageformats -xcopy /S /Y /I %DEPS_INSTALL_DIR%\lib\plugins\kf5 %pkg_root%\bin\kf5 -xcopy /S /Y /I %DEPS_INSTALL_DIR%\plugins\kf5 %pkg_root%\bin\kf5 +xcopy /S /Y /I "%DEPS_INSTALL_DIR%\lib\plugins\imageformats" "%pkg_root%\bin\imageformats" +xcopy /S /Y /I "%DEPS_INSTALL_DIR%\plugins\imageformats" "%pkg_root%\bin\imageformats" +xcopy /S /Y /I "%DEPS_INSTALL_DIR%\lib\plugins\kf5" "%pkg_root%\bin\kf5" +xcopy /S /Y /I "%DEPS_INSTALL_DIR%\plugins\kf5" "%pkg_root%\bin\kf5" :: Qt Translations :: it seems that windeployqt does these, but only *some* of these??? -mkdir %pkg_root%\bin\translations +mkdir "%pkg_root%\bin\translations" setlocal enableextensions enabledelayedexpansion for /f "delims=" %%F in ('dir /b "%DEPS_INSTALL_DIR%\translations\qt_*.qm"') do ( :: Exclude qt_help_*.qm set temp=%%F set temp2=!temp:_help=! - if x!temp2! == x!temp! copy %DEPS_INSTALL_DIR%\translations\!temp! %pkg_root%\bin\translations\!temp! + if x!temp2! == x!temp! copy "%DEPS_INSTALL_DIR%\translations\!temp!" "%pkg_root%\bin\translations\!temp!" ) endlocal :: Krita plugins -xcopy /Y %KRITA_INSTALL_DIR%\lib\kritaplugins\*.dll %pkg_root%\lib\kritaplugins\ +xcopy /Y "%KRITA_INSTALL_DIR%\lib\kritaplugins\*.dll" "%pkg_root%\lib\kritaplugins\" :: Share -xcopy /Y /S /I %KRITA_INSTALL_DIR%\share\color %pkg_root%\share\color -xcopy /Y /S /I %KRITA_INSTALL_DIR%\share\color-schemes %pkg_root%\share\color-schemes -xcopy /Y /S /I %KRITA_INSTALL_DIR%\share\icons %pkg_root%\share\icons -xcopy /Y /S /I %KRITA_INSTALL_DIR%\share\krita %pkg_root%\share\krita -xcopy /Y /S /I %KRITA_INSTALL_DIR%\share\kritaplugins %pkg_root%\share\kritaplugins -xcopy /Y /S /I %DEPS_INSTALL_DIR%\share\kf5 %pkg_root%\share\kf5 -xcopy /Y /S /I %DEPS_INSTALL_DIR%\share\mime %pkg_root%\share\mime +xcopy /Y /S /I "%KRITA_INSTALL_DIR%\share\color" "%pkg_root%\share\color" +xcopy /Y /S /I "%KRITA_INSTALL_DIR%\share\color-schemes" "%pkg_root%\share\color-schemes" +xcopy /Y /S /I "%KRITA_INSTALL_DIR%\share\icons" "%pkg_root%\share\icons" +xcopy /Y /S /I "%KRITA_INSTALL_DIR%\share\krita" "%pkg_root%\share\krita" +xcopy /Y /S /I "%KRITA_INSTALL_DIR%\share\kritaplugins" "%pkg_root%\share\kritaplugins" +xcopy /Y /S /I "%DEPS_INSTALL_DIR%\share\kf5" "%pkg_root%\share\kf5" +xcopy /Y /S /I "%DEPS_INSTALL_DIR%\share\mime" "%pkg_root%\share\mime" :: Python libs -xcopy /Y /S /I %DEPS_INSTALL_DIR%\share\krita\pykrita %pkg_root%\share\krita\pykrita +xcopy /Y /S /I "%DEPS_INSTALL_DIR%\share\krita\pykrita" "%pkg_root%\share\krita\pykrita" :: Not useful on Windows it seems rem xcopy /Y /S /I %KRITA_INSTALL_DIR%\share\appdata %pkg_root%\share\appdata rem xcopy /Y /S /I %KRITA_INSTALL_DIR%\share\applications %pkg_root%\share\applications @@ -608,26 +608,26 @@ rem xcopy /Y /S /I %DEPS_INSTALL_DIR%\share\man %pkg_root%\share\man rem xcopy /Y /S /I %DEPS_INSTALL_DIR%\share\ocio %pkg_root%\share\ocio :: Copy locale to bin -xcopy /Y /S /I %KRITA_INSTALL_DIR%\share\locale %pkg_root%\bin\locale -xcopy /Y /S /I %DEPS_INSTALL_DIR%\share\locale %pkg_root%\bin\locale +xcopy /Y /S /I "%KRITA_INSTALL_DIR%\share\locale" "%pkg_root%\bin\locale" +xcopy /Y /S /I "%DEPS_INSTALL_DIR%\share\locale" "%pkg_root%\bin\locale" :: Copy shortcut link from source (can't create it dynamically) -copy %KRITA_SRC_DIR%\packaging\windows\krita.lnk %pkg_root% +copy "%KRITA_SRC_DIR%\packaging\windows\krita.lnk" "%pkg_root%" -set "QMLDIR_ARGS=--qmldir %DEPS_INSTALL_DIR%\qml" +set "QMLDIR_ARGS=--qmldir "%DEPS_INSTALL_DIR%\qml"" if exist "%KRITA_INSTALL_DIR%\lib\qml" ( - xcopy /Y /S /I %KRITA_INSTALL_DIR%\lib\qml %pkg_root%\bin + xcopy /Y /S /I "%KRITA_INSTALL_DIR%\lib\qml" "%pkg_root%\bin" :: This doesn't really seem to do anything - set "QMLDIR_ARGS=%QMLDIR_ARGS% --qmldir %KRITA_INSTALL_DIR%\lib\qml" + set "QMLDIR_ARGS=%QMLDIR_ARGS% --qmldir "%KRITA_INSTALL_DIR%\lib\qml"" ) if EXIST "%DEPS_INSTALL_DIR%\bin\gmic_krita_qt.exe" ( - copy %DEPS_INSTALL_DIR%\bin\gmic_krita_qt.exe %pkg_root%\bin - set "WINDEPLOYQT_GMIC_ARGS=%pkg_root%\bin\gmic_krita_qt.exe" + copy "%DEPS_INSTALL_DIR%\bin\gmic_krita_qt.exe" "%pkg_root%\bin" + set "WINDEPLOYQT_GMIC_ARGS="%pkg_root%\bin\gmic_krita_qt.exe"" ) :: windeployqt -windeployqt.exe %QMLDIR_ARGS% --release -gui -core -concurrent -network -printsupport -svg -xml -multimedia -qml -quick -quickwidgets %pkg_root%\bin\krita.exe %WINDEPLOYQT_GMIC_ARGS% +windeployqt.exe %QMLDIR_ARGS% --release -gui -core -concurrent -network -printsupport -svg -xml -multimedia -qml -quick -quickwidgets "%pkg_root%\bin\krita.exe" %WINDEPLOYQT_GMIC_ARGS% if errorlevel 1 ( echo ERROR: WinDeployQt failed! 1>&2 exit /B 1 @@ -635,7 +635,7 @@ if errorlevel 1 ( :: Copy embedded Python -xcopy /Y /S /I %DEPS_INSTALL_DIR%\python %pkg_root%\python +xcopy /Y /S /I "%DEPS_INSTALL_DIR%\python" "%pkg_root%\python" :: For chopping relative path :: 512 should be enough @@ -690,19 +690,19 @@ if not "%ARG_PRE_ZIP_HOOK%" == "" ( echo. echo Packaging stripped binaries... -"%SEVENZIP_EXE%" a -tzip %pkg_name%.zip %pkg_root%\ "-xr^!.debug" +"%SEVENZIP_EXE%" a -tzip "%pkg_name%.zip" "%pkg_root%\" "-xr^!.debug" echo -------- echo. echo Packaging debug info... :: (note that the top-level package dir is not included) -"%SEVENZIP_EXE%" a -tzip %pkg_name%-dbg.zip -r %pkg_root%\*.debug +"%SEVENZIP_EXE%" a -tzip "%pkg_name%-dbg.zip" -r "%pkg_root%\*.debug" echo -------- echo. echo. echo Krita packaged as %pkg_name%.zip -if exist %pkg_name%-dbg.zip echo Debug info packaged as %pkg_name%-dbg.zip +if exist "%pkg_name%-dbg.zip" echo Debug info packaged as %pkg_name%-dbg.zip echo Packaging dir is %pkg_root% echo NOTE: Do not create installer with packaging dir. Extract from echo %pkg_name%.zip instead, @@ -717,24 +717,24 @@ exit /b :split-debug echo Splitting debug info of %2 -objcopy --only-keep-debug %~1 %~1.debug +objcopy --only-keep-debug "%~1" "%~1.debug" if ERRORLEVEL 1 exit /b %ERRORLEVEL% :: If the debug file is small enough then consider there being no debug info. :: Discard these files since they somehow make gdb crash. call :getfilesize %~1.debug if /i %getfilesize_retval% LEQ 2048 ( echo Discarding %2.debug - del %~1.debug + del "%~1.debug" exit /b 0 ) -if not exist %~dp1.debug mkdir %~dp1.debug -move %~1.debug %~dp1.debug\ > NUL -strip %~1 +if not exist "%~dp1.debug" mkdir "%~dp1.debug" +move "%~1.debug" "%~dp1.debug\" > NUL +strip "%~1" :: Add debuglink :: FIXME: There is a problem with gdb that cause it to output this warning :: FIXME: "warning: section .gnu_debuglink not found in xxx.debug" :: FIXME: I tried adding a link to itself but this kills drmingw :( -objcopy --add-gnu-debuglink="%~dp1.debug\%~nx1.debug" %~1 +objcopy --add-gnu-debuglink="%~dp1.debug\%~nx1.debug" "%~1" exit /b %ERRORLEVEL% :getfilesize @@ -748,10 +748,10 @@ goto :eof :relpath_dirpath_internal for /f "tokens=1* delims=\" %%a in ("%~2") do ( :: If part 2 is empty, it means part 1 is probably the file name - if x%%b==x ( - set relpath_dirpath_retval=%~1 + if "%%b" == "" ( + set "relpath_dirpath_retval=%~1" ) else ( - call :relpath_dirpath_internal "%~1%%a\" %%b + call :relpath_dirpath_internal "%~1%%a\" "%%b" ) ) goto :eof diff --git a/packaging/windows/sign-package.cmd b/packaging/windows/sign-package.cmd index 2b3222f941..cc58977d8c 100644 --- a/packaging/windows/sign-package.cmd +++ b/packaging/windows/sign-package.cmd @@ -1,7 +1,7 @@ @echo off setlocal enableextensions enabledelayedexpansion -set pkg_root=%~f1 +set "pkg_root=%~f1" if not "%SIGNTOOL%" == "" goto skip_find_signtool