diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..e7863f0 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,45 @@ +image: Visual Studio 2015 + +environment: + ARCH: x86 + sf_secret: + secure: 8QOHSPQLI/lmjgOhyGOsMA5MxOdeSnlFWWKjntqEfBMfW/XCuiEk5tHNjZiiAw8N + sf_api: + secure: S4qrbAdLq3Hw5yozC7XAavTGzpPPh8MleX+r8kaueBtPZUeJGt+8EoqaPw0P1PzV + +clone_depth: 1 + +platform: + - x64 + +init: + - if /i %APPVEYOR_REPO_TAG% == true set WITH_TESSDATA=1 + +cache: + - installed -> scripts\win\prepare.bat + +install: + - cinst winscp + - nuget install secure-file -ExcludeVersion + - call "scripts\win\prepare.bat" + +build_script: + - call "scripts\win\build.bat" + +artifacts: + - path: 'screen-translator-*.exe' + name: installer + +deploy: + - provider: GitHub + description: "Version $(APPVEYOR_REPO_TAG_NAME)" + auth_token: + secure: NnyUV44yNAx8ea1L46dVhE4kQxUGd5M1O+yVk+9ncsNHWtw/9JoCnDqNybnxTccP + artifact: installer + force_update: true + on: + appveyor_repo_tag: true + +after_deploy: + - secure-file\tools\secure-file -decrypt scripts\win\sf_key.av -secret %sf_secret% -out scripts\win\sf_key + - call "scripts\win\deploy_sf.bat" diff --git a/README.md b/README.md index 1aa8631..1b74079 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ [![Build Status](https://travis-ci.org/OneMoreGres/ScreenTranslator.svg)](https://travis-ci.org/OneMoreGres/ScreenTranslator.svg) +[![appveyor](https://img.shields.io/appveyor/ci/OneMoreGres/ScreenTranslator.svg)](https://img.shields.io/appveyor/ci/OneMoreGres/ScreenTranslator.svg) + Screen Translator ================= diff --git a/scripts/win/build.bat b/scripts/win/build.bat new file mode 100644 index 0000000..bdec605 --- /dev/null +++ b/scripts/win/build.bat @@ -0,0 +1,59 @@ +@echo off + +set SELF_PATH=%~dp0 +call %SELF_PATH%\env.bat + + +::build +rmdir /q /s build +set ROOT=%SELF_PATH%\..\.. +lrelease %ROOT%\ScreenTranslator.pro +mkdir build +cd build +qmake INCLUDEPATH+=%cd%\..\installed\include LIBS+=-L%cd%\..\installed\bin LIBS+=-L%cd%\..\installed\lib %ROOT% +nmake +cd .. +if %errorlevel% neq 0 exit /b %errorlevel% + + +::pack +rmdir /q /s iss +mkdir iss +copy /Y %ROOT%\distr\iss\* iss +copy /Y %ROOT%\distr\Changelog_en.txt iss\ +copy /Y %ROOT%\distr\Changelog_ru.txt iss\ +copy /Y %ROOT%\LICENSE.md iss\LICENSE_en.md +copy /Y %ROOT%\images\icon.ico iss\icon.ico + +mkdir iss\content +copy /Y build\release\ScreenTranslator.exe iss\content\ScreenTranslator.exe +copy /Y installed\bin\*.dll iss\content +mkdir iss\content\translations +copy /Y %ROOT%\translations\*.qm iss\content\translations +mkdir iss\content\translators +copy /Y %ROOT%\translators\* iss\content\translators + +windeployqt --release iss\content\ScreenTranslator.exe + +for /f "delims=" %%i in ('findstr versionString %ROOT%\version.json') do set VERSION_LINE=%%i +set UNQUOTED=%VERSION_LINE:"='% +for /f "tokens=4 delims='" %%i in ("%UNQUOTED%") do set VERSION=%%i +echo #define MyAppVersion "%VERSION%" > iss\defines.iss + + + +cd iss +iscc.exe InnoSetup.iss +cd .. + + +if "%WITH_TESSDATA%" == "" goto end + +mkdir iss\tessdata +copy /Y download\tessdata\* iss\tessdata + +cd iss +iscc.exe InnoSetupWithTessdata.iss +cd .. + +:end \ No newline at end of file diff --git a/scripts/win/deploy_sf.bat b/scripts/win/deploy_sf.bat new file mode 100644 index 0000000..ac7b229 --- /dev/null +++ b/scripts/win/deploy_sf.bat @@ -0,0 +1,26 @@ +@echo off + +set PATH=c:\Program Files (x86)\WinSCP\;%PATH% + +set SELF_PATH=%~dp0 +set ROOT=%SELF_PATH%\..\.. + + +for /f "delims=" %%i in ('findstr versionString %ROOT%\version.json') do set VERSION_LINE=%%i +set UNQUOTED=%VERSION_LINE:"='% +for /f "tokens=4 delims='" %%i in ("%UNQUOTED%") do set VERSION=%%i + +for /f "delims=" %%i in ('dir /b screen-translator-online*.exe') do set online=%%i +for /f "delims=" %%i in ('dir /b screen-translator-offline*.exe') do set offline=%%i + + +winscp.com /keygen %SELF_PATH%\sf_key /output=key.ppk +set folder="/home/frs/project/screen-translator/bin/v%VERSION%" +winscp.com /command "open sftp://onemoregres@frs.sourceforge.net/ -privatekey=key.ppk -hostkey=*" "mkdir %folder%" "put %online% %folder%/%online%" "put %offline% %folder%/%offline%" "exit" + + +set url="https://sourceforge.net/projects/screen-translator/files/bin/v%VERSION%/%online%" +curl --insecure -H "Accept: application/json" -X PUT -d "default=windows" -d "api_key=%sf_api%" %url% + +set url="https://sourceforge.net/projects/screen-translator/files/bin/v%VERSION%/%offline%" +curl --insecure -H "Accept: application/json" -X PUT -d "default=windows" -d "api_key=%sf_api%" %url% diff --git a/scripts/win/env.bat b/scripts/win/env.bat new file mode 100644 index 0000000..61722ad --- /dev/null +++ b/scripts/win/env.bat @@ -0,0 +1,19 @@ +@echo off + +if "%ARCH%" == "" set ARCH=x86 + +if /i %ARCH% == x86 goto x86 +if /i %ARCH% == x64 goto x64 +goto end + +:x64 +call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 +set PATH=c:\Qt\5.5\msvc2013_64\bin\;c:\Program Files (x86)\NSIS\;C:\Program Files (x86)\Inno Setup 5;C:\Program Files\CMake\bin;%PATH% +goto end + +:x86 +call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 +set PATH=c:\Qt\5.5\msvc2013\bin\;c:\Program Files (x86)\NSIS\;C:\Program Files (x86)\Inno Setup 5;C:\Program Files\CMake\bin;%PATH% +goto end + +:end diff --git a/scripts/win/prepare.bat b/scripts/win/prepare.bat new file mode 100644 index 0000000..40b96b3 --- /dev/null +++ b/scripts/win/prepare.bat @@ -0,0 +1,111 @@ +@echo off + +set SELF_PATH=%~dp0 +call %SELF_PATH%\env.bat + +rem choco install curl cmake + +mkdir download + +if "%WITH_TESSDATA%" == "" goto libs +echo "Downloading tessdata" +mkdir download\tessdata +cd download\tessdata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.bigrams +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.fold +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.lm +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.params +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.size +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.cube.word-freq +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/ara.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/chi_sim.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/deu.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.bigrams +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.fold +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.lm +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.params +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.size +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.cube.word-freq +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.tesseract_cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/eng.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.bigrams +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.fold +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.lm +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.params +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.size +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.cube.word-freq +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.tesseract_cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/fra.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/frk.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/frm.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/jpn.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.fold +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.lm +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.params +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.size +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.cube.word-freq +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/rus.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.bigrams +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.fold +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.lm +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.nn +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.params +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.size +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.cube.word-freq +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa.traineddata +curl -fsSLk -O https://github.com/tesseract-Ocr/tessdata/raw/3.04.00/spa_old.traineddata +cd ..\.. +:libs + + +if "%CLEAR_CACHE%" == "" goto build-libs +echo "Clearing cache" +rmdir /s /q leptonica +rmdir /s /q leptonica-build +rmdir /s /q tesseract +rmdir /s /q leptonica-build +rmdir /s /q installed +:build-libs + + +if exist installed\bin\tesseract*.dll goto end + +echo "Downloading dependencies" +if not exist download\leptonica.zip ( + curl -fsSLk -o download\leptonica.zip https://github.com/DanBloomberg/leptonica/archive/1.74.4.zip +) +if not exist download\tesseract.zip ( + curl -fsSLk -o download\tesseract.zip https://github.com/tesseract-Ocr/tesseract/archive/3.05.01.zip +) + + +echo "Building dependencies" +unzip -qq download\leptonica.zip +move leptonica* leptonica +mkdir leptonica-build +cd leptonica-build +cmake -DCMAKE_BUILD_TYPE=Release -DTARGET_CPU=%ARCH% -DCMAKE_INSTALL_PREFIX=..\installed ..\leptonica +cmake --build . --config Release +cmake --build . --config Release --target install +cd .. +copy /y /b installed\lib\leptonica*.lib installed\lib\lept.lib +if %errorlevel% neq 0 exit /b %errorlevel% + + +unzip -qq download\tesseract.zip +move tesseract* tesseract +mkdir tesseract-build +cd tesseract-build +cmake -DCMAKE_BUILD_TYPE=Release -DTARGET_CPU=%ARCH% -DCMAKE_INSTALL_PREFIX=..\installed -DCMAKE_PREFIX_PATH=..\installed ..\tesseract +cmake --build . --config Release +cmake --build . --config Release --target install +cd .. +copy /y /b installed\lib\tesseract*.lib installed\lib\tesseract.lib +if %errorlevel% neq 0 exit /b %errorlevel% + +:end + diff --git a/scripts/win/sf_key.av b/scripts/win/sf_key.av new file mode 100644 index 0000000..dd40311 Binary files /dev/null and b/scripts/win/sf_key.av differ