Add an script to create the windows installer automatically

This commit is contained in:
Luis Ángel San Martín 2019-08-18 15:07:25 +02:00
parent a3e20c58cd
commit 9a86fe9cf1
4 changed files with 232 additions and 1 deletions

View File

@ -64,6 +64,8 @@ jobs:
choco install innosetup
wget "https://sourceforge.net/projects/sevenzip/files/7-Zip/18.05/7z1805-src.7z" -P $(Build.SourcesDirectory)\compressed_archive
7z x $(Build.SourcesDirectory)\compressed_archive\7z1805-src.7z -o$(Build.SourcesDirectory)\compressed_archive\lib7zip
wget "https://go.microsoft.com/fwlink/?LinkId=746572" -O $(Build.SourcesDirectory)\vc_redist.x64.exe
# 32bit https://go.microsoft.com/fwlink/?LinkId=746571
displayName: 'Install dependencies'
- script: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
@ -72,7 +74,17 @@ jobs:
nmake
displayName: 'Build'
- script: |
iscc
cd $(Build.SourcesDirectory)\ci\win
.\create_installer.cmd x64 7z
displayName: 'Create installer'
- task: CopyFiles@2
inputs:
contents: $(Build.SourcesDirectory)\ci\win\Output\*.exe
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)
artifactName: Installer

163
ci/win/build_installer.iss Normal file
View File

@ -0,0 +1,163 @@
[Setup]
DefaultGroupName=YACReader
LanguageDetectionMethod=locale
AppName=YACReader
AppVerName=YACReader v{#VERSION}
DefaultDirName={pf}\YACReader
OutputBaseFilename=YACReader-v{#VERSION}-win{#PLATFORM}-{#COMPRESSED_ARCHIVE_BACKEND}
LicenseFile=COPYING.txt
AlwaysUsePersonalGroup=true
OutputDir=..\Output
ChangesAssociations=true
SetupIconFile=setup.ico
UninstallDisplayIcon=uninstall.ico
;//TODO avoid setting ArchitecturesInstallIn64BitMode in 32bit installer
ArchitecturesInstallIn64BitMode={#PLATFORM}
[Registry]
Root: HKCR; SubKey: .cbz; ValueType: string; ValueData: Comic Book (zip); Flags: uninsdeletekey; Tasks: File_association
Root: HKCR; SubKey: Comic Book (zip); ValueType: string; ValueData: Comic Book file; Flags: uninsdeletekey; Tasks: File_association
Root: HKCR; SubKey: Comic Book (zip)\Shell\Open\Command; ValueType: string; ValueData: """{app}\YACReader.exe"" ""%1"""; Flags: uninsdeletevalue; Tasks: File_association
Root: HKCR; Subkey: Comic Book (zip)\DefaultIcon; ValueType: string; ValueData: {app}\YACReader.exe,0; Flags: uninsdeletevalue; Tasks: File_association
Root: HKCR; SubKey: .cbr; ValueType: string; ValueData: Comic Book (rar); Flags: uninsdeletekey; Tasks: File_association
Root: HKCR; SubKey: Comic Book (rar); ValueType: string; ValueData: Comic Book file; Flags: uninsdeletekey; Tasks: File_association
Root: HKCR; SubKey: Comic Book (rar)\Shell\Open\Command; ValueType: string; ValueData: """{app}\YACReader.exe"" ""%1"""; Flags: uninsdeletevalue; Tasks: File_association
Root: HKCR; Subkey: Comic Book (rar)\DefaultIcon; ValueType: string; ValueData: {app}\YACReader.exe,0; Flags: uninsdeletevalue; Tasks: File_association
Root: HKCR; Subkey: .clc; ValueType: string; ValueData: Compressed Library Covers (clc); Flags: uninsdeletekey
Root: HKCR; SubKey: Compressed Library Covers (clc); ValueType: string; ValueData: Compressed Library Covers; Flags: uninsdeletekey
Root: HKCR; Subkey: Compressed Library Covers (clc)\DefaultIcon; ValueType: string; ValueData: {app}\YACReaderLibrary.exe,1; Flags: uninsdeletevalue
Root: HKCR; Subkey: .ydb; ValueType: string; ValueData: Compressed Library Covers (clc); Flags: uninsdeletekey
Root: HKCR; SubKey: YACReader Data Base (ydb); ValueType: string; ValueData: Compressed Library Covers; Flags: uninsdeletekey
Root: HKCR; Subkey: YACReader Data Base (ydb)\DefaultIcon; ValueType: string; ValueData: {app}\YACReaderLibrary.exe,1; Flags: uninsdeletevalue
[Files]
;Qt Frameworks
Source: Qt5Core.dll; DestDir: {app}
Source: Qt5Gui.dll; DestDir: {app}
Source: Qt5Multimedia.dll; DestDir: {app}
Source: Qt5Network.dll; DestDir: {app}
Source: Qt5Qml.dll; DestDir: {app}
Source: Qt5Quick.dll; DestDir: {app}
Source: Qt5Script.dll; DestDir: {app}
Source: Qt5Sql.dll; DestDir: {app}
Source: Qt5Svg.dll; DestDir: {app}
Source: Qt5Widgets.dll; DestDir: {app}
;Qt Angle
Source: D3Dcompiler_47.dll; DestDir: {app}
Source: libEGL.dll; DestDir: {app}
Source: libGLESV2.dll; DestDir: {app}
Source: opengl32sw.dll; DestDir: {app}
;Qt QML
Source: QtQml\*; DestDir: {app}\QtQml\; Flags: recursesubdirs
Source: QtQuick\*; DestDir: {app}\QtQuick\; Flags: recursesubdirs
Source: QtQuick.2\*; DestDir: {app}\QtQuick.2\; Flags: recursesubdirs
Source: QtGraphicalEffects\*; DestDir: {app}\QtGraphicalEffects\; Flags: recursesubdirs
;Qt PlugIns
Source:audio\*; DestDir: {app}\audio\
Source:bearer\*; DestDir: {app}\bearer\
Source:iconengines\*; DestDir: {app}\iconengines\
Source:imageformats\*; DestDir: {app}\imageformats\
Source:mediaservice\*; DestDir: {app}\mediaservice\
Source:platforms\*; DestDir: {app}\platforms\
Source:playlistformats\*; DestDir: {app}\playlistformats\
Source:qmltooling\*; DestDir: {app}\qmltooling\
Source:scenegraph\*; DestDir: {app}\scenegraph\
Source:sqldrivers\qsqlite.dll; DestDir: {app}\sqldrivers\
Source:translations\*; DestDir: {app}\translations\
;Libs
Source: pdfium.dll; DestDir: {app}
Source: qrencode.dll; DestDir: {app}
Source: libeay32.dll; DestDir: {app}
Source: ssleay32.dll; DestDir: {app}
;vcredist
Source: "vc_redist.{#PLATFORM}.exe"; DestDir: {tmp}; Flags: deleteafterinstall
;Utils
;Source: utils\7zip.exe; DestDir: {app}\utils\
Source: utils\7z.dll; DestDir: {app}\utils\
;Bin
Source: YACReader.exe; DestDir: {app}; Permissions: everyone-full
Source: YACReaderLibrary.exe; DestDir: {app}; Permissions: everyone-full; Tasks:
Source: YACReaderLibraryServer.exe; DestDir: {app}; Permissions: everyone-full; Tasks:
;License
Source: README.md; DestDir: {app}; Flags: isreadme
Source: COPYING.txt; DestDir: {app}
;Languages
Source: languages\*; DestDir: {app}\languages\; Flags: recursesubdirs
;Server
Source: server\*; DestDir: {app}\server\; Flags: recursesubdirs
[Dirs]
Name: {app}; Permissions: everyone-full
[CustomMessages]
App=YACReader
AppLibrary=YACReaderLibrary
LaunchYACReaderLibrary=Start YACreaderLibrary after finishing installation
LaunchYACReader=Start YACreader after finishing installation
[Run]
Filename: {tmp}\vc_redist.{#PLATFORM}.exe; \
Parameters: "/q /passive /norestart /Q:a /c:""msiexec /q /i vcredist.msi"""; \
StatusMsg: "Installing VC++ Redistributables..."
Filename: {app}\{cm:AppLibrary}.exe; Description: {cm:LaunchYACReaderLibrary,{cm:AppLibrary}}; Flags: nowait postinstall skipifsilent
Filename: {app}\{cm:App}.exe; Description: {cm:LaunchYACReader,{cm:App}}; Flags: nowait postinstall skipifsilent
[Icons]
Name: {group}\YACReader; Filename: {app}\YACReader.exe; WorkingDir: {app}; IconIndex: 0
Name: {group}\YACReader Library; Filename: {app}\YACReaderLibrary.exe; WorkingDir: {app}; IconIndex: 0
;Name: {group}\YACReader Library Package; Filename: {app}\YACReaderLibrary.exe; WorkingDir: {app}; IconIndex: 0
[Tasks]
Name: File_association; Description: Associate .cbz and .cbr files with YACReader
;Name: StartYACReaderAfterInstall; Description: Run YACReader after install
;Name: StartYACReaderLibraryAfterInstall; Description: Run YACReaderLibrary after install
[ThirdPartySettings]
CompileLogMethod=append
[Code]
var donationPage: TOutputMsgWizardPage;
var URLLabel: TNewStaticText;
procedure URLLabelOnClick(Sender: TObject);
var ErrorCode: Integer;
begin
ShellExec('open', 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5TAMNQCDDMVP8&item_name=YACReader&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
procedure InitializeWizard();
begin
URLLabel := TNewStaticText.Create(WizardForm);
URLLabel.Caption:='Make a DONATION/Haz una DONACIÓN';
URLLabel.Cursor:=crHand;
URLLabel.OnClick:=@URLLabelOnClick;
URLLabel.Parent:=WizardForm;
// Alter Font
URLLabel.Font.Style:=URLLabel.Font.Style + [fsUnderline];
URLLabel.Font.Color:=clBlue;
URLLabel.Top:=250;
URLLabel.Left:=35;
donationPage := CreateOutputMsgPage(wpWelcome,
'Iformation', 'Please read the following information before continuing.',
'YACReader is FREE software. If you like it, please, consider to make a DONATION'#13#13 +
'YACReader es software libre y GRATUITO. Si te gusta, por favor, considera realizar una DONACIÓN'#13#13)
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID=donationPage.ID then URLLabel.Visible:=true else URLLabel.Visible:=false;
end;

View File

@ -0,0 +1,56 @@
@echo off
SET src_path=..\..\..
IF "%1"=="x64" (
SET exe_path=%src_path%\release64
) ELSE (
SET exe_path=%src_path%\release
)
rmdir /S /Q installer_contents
mkdir installer_contents
copy * installer_contents
cd installer_contents
copy %src_path%\COPYING.txt .
copy %src_path%\README.md .
copy %exe_path%\YACReader.exe .
copy %exe_path%\YACReaderLibrary.exe .
copy %exe_path%\YACReaderLibraryServer.exe .
windeployqt --release YACReader.exe
windeployqt --release --qmldir %src_path%\YACReaderLibrary\qml YACReaderLibrary.exe
windeployqt YACReaderLibraryServer.exe
mkdir utils
IF "%2"=="7z" (
copy %src_path%\dependencies\7zip\win\%1\7z.dll .\utils\7z.dll
) ELSE (
copy %src_path%\dependencies\unarr\win\%1\unarr.dll .
)
copy %src_path%\dependencies\qrencode\win\%1\qrencode.dll .
copy %src_path%\dependencies\pdfium\win\%1\pdfium.dll .
copy %src_path%\dependencies\openssl\win\%1\libeay32.dll .
copy %src_path%\dependencies\openssl\win\%1\ssleay32.dll .
xcopy %src_path%\release\server .\server /i /e
xcopy %src_path%\release\languages .\languages /i /e
copy %src_path%\vc_redist.%1.exe .
type %src_path%\common\yacreader_global.h | findstr /R /C:"#define VERSION " > tmp
set /p VERSION= < tmp
set VERSION=%VERSION:#define VERSION "=%
set VERSION=%VERSION:"=%
echo %VERSION%
iscc /DVERSION=%VERSION% /DPLATFORM=%1 /DCOMPRESSED_ARCHIVE_BACKEND=%2 build_installer.iss
cd ..

BIN
ci/win/setup.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB