Skip to content

Commit

Permalink
Update install scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mauromascarenhas committed Aug 23, 2019
1 parent 165ab8e commit 77062c4
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/install_scripts/PIFC-0.9.06-x64.iss
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[Setup]
AppId={{03219D60-AD8F-4F8F-8AAC-A4BAA3DBC54C}
AppId={{BA22A35B-6830-4BB2-B516-EFABC57C60FA}
AppName=PIF Compiler
AppVersion=0.9.06
AppPublisher=PIF Project
AppContact=https://github.com/mauromascarenhas/PIF/issues
AppPublisherURL=https://github.com/mauromascarenhas/PIF/
AppSupportURL=https://github.com/mauromascarenhas/PIF/issues
AppUpdatesURL=https://github.com/mauromascarenhas/PIF/
AppCopyright=Copyright (C) 2019 PIF Project.
AppCopyright=Copyright (C) 2019 PIF Project
DefaultDirName={pf}\Projeto PIF\PIF
DisableDirPage=yes
DefaultGroupName=PIF
Expand Down Expand Up @@ -128,6 +128,7 @@ begin
end;
[Icons]
Name: "{group}\{cm:ProgramSources}"; Filename: "{app}\sources"
Name: "{group}\{cm:Licence}"; Filename: "{app}\licence\LGPL_V3.txt"
Name: "{group}\{cm:ProgramOnTheWeb,PIF}"; Filename: "https://github.com/mauromascarenhas/PIF/"
Name: "{group}\{cm:UninstallProgram,PIF Compiler}"; Filename: "{uninstallexe}"
Expand All @@ -138,11 +139,13 @@ CustomInstall=Custom installation
FullInstall=Full installation
Licence=LGPL_v3 Licence
ProgramFiles=Program Files
ProgramSources=PIF Compiler sources
SourceFiles=Source Files

brazilianportuguese.AddToPath=Adicionar PIFC à variável de ambiente PATH (recomendado)
brazilianportuguese.CustomInstall=Instalação personalizada
brazilianportuguese.FullInstall=Instalação completa
brazilianportuguese.Licence=Licença LGPL_v3
brazilianportuguese.ProgramFiles=Arquivos de programa
brazilianportuguese.ProgramSources=Código fonte do compilador PIF
brazilianportuguese.SourceFiles=Código fonte
150 changes: 150 additions & 0 deletions src/install_scripts/PIFC-0.9.06-x86.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
[Setup]
AppId={{A153F592-6FE6-479C-A73C-57C85A269CFC}
AppName=PIF Compiler
AppVersion=0.9.06
AppPublisher=PIF Project
AppContact=https://github.com/mauromascarenhas/PIF/issues
AppPublisherURL=https://github.com/mauromascarenhas/PIF/
AppSupportURL=https://github.com/mauromascarenhas/PIF/issues
AppUpdatesURL=https://github.com/mauromascarenhas/PIF/
AppCopyright=Copyright (C) 2019 PIF Project
DefaultDirName={pf}\Projeto PIF\PIF
DisableDirPage=yes
DefaultGroupName=PIF
AllowNoIcons=yes
OutputDir=C:\Users\Mauro\Desktop\PIF_Compiler
OutputBaseFilename=pif_compiler-0.9.06_x86
SetupIconFile=C:\Users\Mauro\Documents\GitHub\PIF\src\compiler\logo\pif_logo_x64.ico
LicenseFile=C:\Users\Mauro\Documents\Completo\pif_compiler\licence\LGPL_V3.txt
UsePreviousAppDir=yes
UsePreviousGroup=yes
UsePreviousLanguage=yes
UsePreviousSetupType=yes
UsePreviousTasks=yes
UsePreviousUserInfo=yes
BackColor=$090067
BackSolid=yes
ChangesAssociations=yes
UninstallDisplayName=PIF
UninstallDisplayIcon={app}\pifc.exe
Compression=lzma2/max
SolidCompression=yes
ChangesEnvironment=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"

[Types]
Name: "full"; Description: "{cm:FullInstall}"
Name: "custom"; Description: "{cm:CustomInstall}"; Flags: iscustom

[Components]
Name: "program"; Description: "{cm:ProgramFiles}"; Types: full custom; Flags: fixed
Name: "sources"; Description: "{cm:SourceFiles}"; Types: full;

[Tasks]
Name: "envPath"; Description: "{cm:AddToPath}"

[Files]
Source: "C:\Users\Mauro\Documents\Completo\Extra\vc_redist.x86.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall; AfterInstall: InstMSVSC
Source: "C:\Users\Mauro\Documents\Completo\pif_compiler\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: program
Source: "C:\Users\Mauro\Documents\GitHub\PIF\*"; DestDir: "{app}\sources"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: sources

[Code]
procedure ExitProcess(exitCode:integer);
external '[email protected] stdcall';
procedure InstMSVSC;
var
ResultCode: Integer;
begin
if not FileExists(ExpandConstant('{sys}\MSVCP140.DLL'))
then
if not Exec(ExpandConstant('{tmp}\vc_redist.x86.exe'), '', '', SW_SHOWNORMAL,
ewWaitUntilTerminated, ResultCode)
then
ExitProcess(1);
if not FileExists(ExpandConstant('{sys}\MSVCP140.DLL'))
then
ExitProcess(1);
end;
const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
procedure EnvAddPath(Path: string);
var
Paths: string;
begin
{ Retrieve current path (use empty string if entry not exists) }
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
then Paths := '';
{ Skip if string already found in path }
if Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';') > 0 then exit;
{ App string to the end of the path variable }
Paths := Paths + ';'+ Path +';'
{ Overwrite (or create if missing) path environment variable }
if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
then Log(Format('The [%s] added to PATH: [%s]', [Path, Paths]))
else Log(Format('Error while adding the [%s] to PATH: [%s]', [Path, Paths]));
end;
procedure EnvRemovePath(Path: string);
var
Paths: string;
P: Integer;
begin
{ Skip if registry entry not exists }
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then
exit;
{ Skip if string not found in path }
P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';');
if P = 0 then exit;
{ Update path variable }
Delete(Paths, P - 1, Length(Path) + 1);
{ Overwrite path environment variable }
if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
then Log(Format('The [%s] removed from PATH: [%s]', [Path, Paths]))
else Log(Format('Error while removing the [%s] from PATH: [%s]', [Path, Paths]));
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep = ssPostInstall) and IsTaskSelected('envPath')
then EnvAddPath(ExpandConstant('{app}') {+'\bin'});
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall
then EnvRemovePath(ExpandConstant('{app}') {+'\bin'});
end;
[Icons]
Name: "{group}\{cm:ProgramSources}"; Filename: "{app}\sources"
Name: "{group}\{cm:Licence}"; Filename: "{app}\licence\LGPL_V3.txt"
Name: "{group}\{cm:ProgramOnTheWeb,PIF}"; Filename: "https://github.com/mauromascarenhas/PIF/"
Name: "{group}\{cm:UninstallProgram,PIF Compiler}"; Filename: "{uninstallexe}"

[CustomMessages]
AddToPath=Add PIFC to PATH environment variable (recommended)
CustomInstall=Custom installation
FullInstall=Full installation
Licence=LGPL_v3 Licence
ProgramFiles=Program Files
ProgramSources=PIF Compiler sources
SourceFiles=Source Files

brazilianportuguese.AddToPath=Adicionar PIFC à variável de ambiente PATH (recomendado)
brazilianportuguese.CustomInstall=Instalação personalizada
brazilianportuguese.FullInstall=Instalação completa
brazilianportuguese.Licence=Licença LGPL_v3
brazilianportuguese.ProgramFiles=Arquivos de programa
brazilianportuguese.ProgramSources=Código fonte do compilador PIF
brazilianportuguese.SourceFiles=Código fonte

0 comments on commit 77062c4

Please sign in to comment.