mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-05 10:59:31 +02:00
* Added a wizard to create fppkgs basic configuration files
git-svn-id: trunk@55127 -
This commit is contained in:
parent
48dbf5c56d
commit
618a14fb45
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1446,6 +1446,8 @@ components/fppkg/src/fppkg_aboutfrm.pas svneol=native#text/plain
|
|||||||
components/fppkg/src/fppkg_const.pas svneol=native#text/plain
|
components/fppkg/src/fppkg_const.pas svneol=native#text/plain
|
||||||
components/fppkg/src/fppkg_details.lfm svneol=native#text/plain
|
components/fppkg/src/fppkg_details.lfm svneol=native#text/plain
|
||||||
components/fppkg/src/fppkg_details.pas svneol=native#text/plain
|
components/fppkg/src/fppkg_details.pas svneol=native#text/plain
|
||||||
|
components/fppkg/src/fppkg_initializeoptionsfrm.lfm svneol=native#text/plain
|
||||||
|
components/fppkg/src/fppkg_initializeoptionsfrm.pas svneol=native#text/pascal
|
||||||
components/fppkg/src/fppkg_lpk.pas svneol=native#text/plain
|
components/fppkg/src/fppkg_lpk.pas svneol=native#text/plain
|
||||||
components/fppkg/src/fppkg_mainfrm.lfm svneol=native#text/plain
|
components/fppkg/src/fppkg_mainfrm.lfm svneol=native#text/plain
|
||||||
components/fppkg/src/fppkg_mainfrm.lrj svneol=native#text/plain
|
components/fppkg/src/fppkg_mainfrm.lrj svneol=native#text/plain
|
||||||
|
@ -200,3 +200,49 @@ msgstr ""
|
|||||||
msgid "Update packages list"
|
msgid "Update packages list"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.advancedcheckbox.caption
|
||||||
|
msgid "Advanced"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.buttonpanel.closebutton.caption
|
||||||
|
msgctxt "tinitializeoptionsform.buttonpanel.closebutton.caption"
|
||||||
|
msgid "&Close"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.buttonpanel.okbutton.caption
|
||||||
|
msgctxt "tinitializeoptionsform.buttonpanel.okbutton.caption"
|
||||||
|
msgid "&Write Fppkg configuration files"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.caption
|
||||||
|
msgid "Create configuration files"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.compilerlabel.caption
|
||||||
|
msgid "Compiler:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.edit1.text
|
||||||
|
msgid "Edit1"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.fpcdirectoryedit.texthint
|
||||||
|
msgid "This location normally contains the compiler-executable along with a 'units' and 'fpmkinst' directory."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.initializefppkglabel.caption
|
||||||
|
msgid "Create new configuration files for fppkg."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.label1.caption
|
||||||
|
msgid "Please give the location where FPC is installed."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.pathlabel.caption
|
||||||
|
msgid "Path:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.prefixlabel.caption
|
||||||
|
msgid "Prefix:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
@ -213,3 +213,49 @@ msgstr "Обновить"
|
|||||||
msgid "Update packages list"
|
msgid "Update packages list"
|
||||||
msgstr "Обновить список пакетов"
|
msgstr "Обновить список пакетов"
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.advancedcheckbox.caption
|
||||||
|
msgid "Advanced"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.buttonpanel.closebutton.caption
|
||||||
|
msgctxt "tinitializeoptionsform.buttonpanel.closebutton.caption"
|
||||||
|
msgid "&Close"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.buttonpanel.okbutton.caption
|
||||||
|
msgctxt "tinitializeoptionsform.buttonpanel.okbutton.caption"
|
||||||
|
msgid "&Write Fppkg configuration files"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.caption
|
||||||
|
msgid "Create configuration files"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.compilerlabel.caption
|
||||||
|
msgid "Compiler:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.edit1.text
|
||||||
|
msgid "Edit1"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.fpcdirectoryedit.texthint
|
||||||
|
msgid "This location normally contains the compiler-executable along with a 'units' and 'fpmkinst' directory."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.initializefppkglabel.caption
|
||||||
|
msgid "Create new configuration files for fppkg."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.label1.caption
|
||||||
|
msgid "Please give the location where FPC is installed."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.pathlabel.caption
|
||||||
|
msgid "Path:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: tinitializeoptionsform.prefixlabel.caption
|
||||||
|
msgid "Prefix:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
190
components/fppkg/src/fppkg_initializeoptionsfrm.lfm
Normal file
190
components/fppkg/src/fppkg_initializeoptionsfrm.lfm
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
object InitializeOptionsForm: TInitializeOptionsForm
|
||||||
|
Left = 2095
|
||||||
|
Height = 451
|
||||||
|
Top = 274
|
||||||
|
Width = 473
|
||||||
|
Caption = 'Create configuration files'
|
||||||
|
ClientHeight = 451
|
||||||
|
ClientWidth = 473
|
||||||
|
LCLVersion = '1.9.0.0'
|
||||||
|
object FppkgConfigPanel: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 451
|
||||||
|
Top = 0
|
||||||
|
Width = 473
|
||||||
|
Align = alClient
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 451
|
||||||
|
ClientWidth = 473
|
||||||
|
TabOrder = 0
|
||||||
|
Visible = False
|
||||||
|
object InitializeFppkgLabel: TLabel
|
||||||
|
Left = 5
|
||||||
|
Height = 20
|
||||||
|
Top = 5
|
||||||
|
Width = 463
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Around = 5
|
||||||
|
Caption = 'Create new configuration files for fppkg.'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object Label1: TLabel
|
||||||
|
Left = 30
|
||||||
|
Height = 20
|
||||||
|
Top = 40
|
||||||
|
Width = 438
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 25
|
||||||
|
BorderSpacing.Top = 10
|
||||||
|
BorderSpacing.Around = 5
|
||||||
|
Caption = 'Please give the location where FPC is installed.'
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object Edit1: TEdit
|
||||||
|
Left = -2368
|
||||||
|
Height = 37
|
||||||
|
Top = 119
|
||||||
|
Width = 80
|
||||||
|
TabOrder = 0
|
||||||
|
Text = 'Edit1'
|
||||||
|
end
|
||||||
|
object FPCDirectoryEdit: TDirectoryEdit
|
||||||
|
Left = 30
|
||||||
|
Height = 37
|
||||||
|
Top = 65
|
||||||
|
Width = 413
|
||||||
|
ShowHidden = False
|
||||||
|
ButtonWidth = 23
|
||||||
|
NumGlyphs = 1
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 25
|
||||||
|
BorderSpacing.Right = 25
|
||||||
|
BorderSpacing.Around = 5
|
||||||
|
BorderSpacing.CellAlignHorizontal = ccaCenter
|
||||||
|
MaxLength = 0
|
||||||
|
TabOrder = 1
|
||||||
|
OnChange = FPCDirectoryEditChange
|
||||||
|
TextHint = 'This location normally contains the compiler-executable along with a ''units'' and ''fpmkinst'' directory.'
|
||||||
|
end
|
||||||
|
object FPCDirValidationLabel: TLabel
|
||||||
|
Left = 30
|
||||||
|
Height = 20
|
||||||
|
Top = 107
|
||||||
|
Width = 438
|
||||||
|
Align = alTop
|
||||||
|
AutoSize = False
|
||||||
|
BorderSpacing.Left = 25
|
||||||
|
BorderSpacing.Around = 5
|
||||||
|
Font.Color = clMaroon
|
||||||
|
ParentColor = False
|
||||||
|
ParentFont = False
|
||||||
|
end
|
||||||
|
object ButtonPanel: TButtonPanel
|
||||||
|
Left = 6
|
||||||
|
Height = 46
|
||||||
|
Top = 399
|
||||||
|
Width = 461
|
||||||
|
OKButton.Name = 'OKButton'
|
||||||
|
OKButton.Caption = '&Write Fppkg configuration files'
|
||||||
|
OKButton.DefaultCaption = False
|
||||||
|
OKButton.Enabled = False
|
||||||
|
OKButton.OnClick = OKButtonClick
|
||||||
|
HelpButton.Name = 'HelpButton'
|
||||||
|
HelpButton.DefaultCaption = True
|
||||||
|
CloseButton.Name = 'CloseButton'
|
||||||
|
CloseButton.Caption = '&Close'
|
||||||
|
CloseButton.DefaultCaption = False
|
||||||
|
CloseButton.OnClick = CloseButtonClick
|
||||||
|
CancelButton.Name = 'CancelButton'
|
||||||
|
CancelButton.DefaultCaption = True
|
||||||
|
TabOrder = 2
|
||||||
|
ShowButtons = [pbOK, pbClose]
|
||||||
|
end
|
||||||
|
object AdvancedCheckbox: TCheckBox
|
||||||
|
Left = 5
|
||||||
|
Height = 24
|
||||||
|
Top = 132
|
||||||
|
Width = 463
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Around = 5
|
||||||
|
Caption = 'Advanced'
|
||||||
|
OnChange = AdvancedCheckboxChange
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
|
object PathLabel: TLabel
|
||||||
|
Left = 30
|
||||||
|
Height = 20
|
||||||
|
Top = 171
|
||||||
|
Width = 438
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 25
|
||||||
|
BorderSpacing.Top = 10
|
||||||
|
BorderSpacing.Around = 5
|
||||||
|
Caption = 'Path:'
|
||||||
|
Enabled = False
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object PathEdit: TEdit
|
||||||
|
Left = 30
|
||||||
|
Height = 37
|
||||||
|
Top = 196
|
||||||
|
Width = 413
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 25
|
||||||
|
BorderSpacing.Right = 25
|
||||||
|
BorderSpacing.Around = 5
|
||||||
|
Enabled = False
|
||||||
|
TabOrder = 4
|
||||||
|
end
|
||||||
|
object PrefixLabel: TLabel
|
||||||
|
Left = 30
|
||||||
|
Height = 20
|
||||||
|
Top = 248
|
||||||
|
Width = 438
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 25
|
||||||
|
BorderSpacing.Top = 10
|
||||||
|
BorderSpacing.Around = 5
|
||||||
|
Caption = 'Prefix:'
|
||||||
|
Enabled = False
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object PrefixEdit: TEdit
|
||||||
|
Left = 30
|
||||||
|
Height = 37
|
||||||
|
Top = 273
|
||||||
|
Width = 413
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 25
|
||||||
|
BorderSpacing.Right = 25
|
||||||
|
BorderSpacing.Around = 5
|
||||||
|
Enabled = False
|
||||||
|
TabOrder = 5
|
||||||
|
end
|
||||||
|
object CompilerLabel: TLabel
|
||||||
|
Left = 30
|
||||||
|
Height = 20
|
||||||
|
Top = 325
|
||||||
|
Width = 438
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 25
|
||||||
|
BorderSpacing.Top = 10
|
||||||
|
BorderSpacing.Around = 5
|
||||||
|
Caption = 'Compiler:'
|
||||||
|
Enabled = False
|
||||||
|
ParentColor = False
|
||||||
|
end
|
||||||
|
object CompilerEdit: TEdit
|
||||||
|
Left = 30
|
||||||
|
Height = 37
|
||||||
|
Top = 350
|
||||||
|
Width = 413
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Left = 25
|
||||||
|
BorderSpacing.Right = 25
|
||||||
|
BorderSpacing.Around = 5
|
||||||
|
Enabled = False
|
||||||
|
TabOrder = 6
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
206
components/fppkg/src/fppkg_initializeoptionsfrm.pas
Normal file
206
components/fppkg/src/fppkg_initializeoptionsfrm.pas
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
unit fppkg_initializeoptionsfrm;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, EditBtn,
|
||||||
|
ButtonPanel,
|
||||||
|
// fppkg
|
||||||
|
pkgglobals, pkgFppkg, pkgoptions;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TInitializeOptionsForm }
|
||||||
|
|
||||||
|
TInitializeOptionsForm = class(TForm)
|
||||||
|
ButtonPanel: TButtonPanel;
|
||||||
|
AdvancedCheckbox: TCheckBox;
|
||||||
|
CompilerEdit: TEdit;
|
||||||
|
PrefixLabel: TLabel;
|
||||||
|
PathEdit: TEdit;
|
||||||
|
FPCDirectoryEdit: TDirectoryEdit;
|
||||||
|
Edit1: TEdit;
|
||||||
|
FppkgConfigPanel: TPanel;
|
||||||
|
InitializeFppkgLabel: TLabel;
|
||||||
|
Label1: TLabel;
|
||||||
|
FPCDirValidationLabel: TLabel;
|
||||||
|
PathLabel: TLabel;
|
||||||
|
PrefixEdit: TEdit;
|
||||||
|
CompilerLabel: TLabel;
|
||||||
|
procedure AdvancedCheckboxChange(Sender: TObject);
|
||||||
|
procedure CloseButtonClick(Sender: TObject);
|
||||||
|
procedure FPCDirectoryEditChange(Sender: TObject);
|
||||||
|
procedure OKButtonClick(Sender: TObject);
|
||||||
|
private
|
||||||
|
function IsVersionStr(AString: string): Boolean;
|
||||||
|
public
|
||||||
|
class function CheckInitialConfiguration: Boolean;
|
||||||
|
class function RecreateFppkgConfiguration: Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
InitializeOptionsForm: TInitializeOptionsForm;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
{ TInitializeOptionsForm }
|
||||||
|
|
||||||
|
procedure TInitializeOptionsForm.FPCDirectoryEditChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
SR: TSearchRec;
|
||||||
|
Dir: string;
|
||||||
|
Prefix, s: RawByteString;
|
||||||
|
begin
|
||||||
|
Dir := IncludeTrailingPathDelimiter(FPCDirectoryEdit.Text);
|
||||||
|
if not DirectoryExists(Dir) then
|
||||||
|
FPCDirValidationLabel.Caption := 'Directory does not exist'
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if FindFirst(Dir+'ppc*'+ExeExt, faAnyFile-faDirectory, SR) = 0 then
|
||||||
|
begin
|
||||||
|
FindClose(SR);
|
||||||
|
if FileExists(Dir+'units') and FileExists(Dir+'fpmkinst') then
|
||||||
|
begin
|
||||||
|
FPCDirValidationLabel.Caption := '';
|
||||||
|
ButtonPanel.OKButton.Enabled := True;
|
||||||
|
|
||||||
|
s := ExtractFileName(ExcludeTrailingPathDelimiter(Dir));
|
||||||
|
Prefix := ExtractFilePath(ExcludeTrailingPathDelimiter(Dir));
|
||||||
|
|
||||||
|
if IsVersionStr(s) then
|
||||||
|
PathEdit.Text := Prefix + '{CompilerVersion}' + PathDelim
|
||||||
|
else
|
||||||
|
PathEdit.Text := Dir;
|
||||||
|
|
||||||
|
Prefix := ExtractFilePath(ExcludeTrailingPathDelimiter(Prefix));
|
||||||
|
Prefix := ExtractFilePath(ExcludeTrailingPathDelimiter(Prefix));
|
||||||
|
PrefixEdit.Text := Prefix;
|
||||||
|
|
||||||
|
s := ConcatPaths([Prefix, 'bin', 'fpc'+ExeExt]);
|
||||||
|
if FileExists(s) then
|
||||||
|
CompilerEdit.Text := s
|
||||||
|
else
|
||||||
|
CompilerEdit.Text := ExeSearch('fpc'+ExeExt,GetEnvironmentVariable('PATH'));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
FPCDirValidationLabel.Caption := 'This location does not seems to contain a valid fpc-installation'
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
FPCDirValidationLabel.Caption := 'Compiler not found at given location'
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TInitializeOptionsForm.CloseButtonClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ModalResult := mrClose;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TInitializeOptionsForm.AdvancedCheckboxChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
PathLabel.Enabled := AdvancedCheckbox.Checked;
|
||||||
|
PrefixLabel.Enabled := AdvancedCheckbox.Checked;
|
||||||
|
PathEdit.Enabled := AdvancedCheckbox.Checked;
|
||||||
|
PrefixEdit.Enabled := AdvancedCheckbox.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TInitializeOptionsForm.OKButtonClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
FPpkg: TpkgFPpkg;
|
||||||
|
FileName: string;
|
||||||
|
CurrentSection: TFppkgRepositoryOptionSection;
|
||||||
|
Dir: string;
|
||||||
|
begin
|
||||||
|
Dir := IncludeTrailingPathDelimiter(FPCDirectoryEdit.Text);
|
||||||
|
FPpkg := TpkgFPpkg.Create(Self);
|
||||||
|
try
|
||||||
|
CurrentSection := FPpkg.Options.AddRepositoryOptionSection(TFppkgRepositoryOptionSection);
|
||||||
|
CurrentSection.RepositoryName := 'fpc';
|
||||||
|
CurrentSection.Description := 'Packages which are installed along with the Free Pascal Compiler';
|
||||||
|
CurrentSection.Path := PathEdit.Text;
|
||||||
|
CurrentSection.Prefix := PrefixEdit.Text;
|
||||||
|
|
||||||
|
FPpkg.Options.AddIncludeFilesOptionSection('{LocalRepository}config/conf.d/*.conf');
|
||||||
|
|
||||||
|
CurrentSection := FPpkg.Options.AddRepositoryOptionSection(TFppkgRepositoryOptionSection);
|
||||||
|
CurrentSection.RepositoryName := 'user';
|
||||||
|
CurrentSection.Description := 'User-installed packages';
|
||||||
|
CurrentSection.Path := '{LocalRepository}lib/fpc/{CompilerVersion}/';
|
||||||
|
CurrentSection.Prefix := '{LocalRepository}';
|
||||||
|
|
||||||
|
FileName := GetFppkgConfigFile(False, False);
|
||||||
|
ForceDirectories(ExtractFilePath(FileName));
|
||||||
|
FPpkg.Options.SaveToFile(FileName);
|
||||||
|
|
||||||
|
// Load the just created configuration-file.
|
||||||
|
FPpkg.InitializeGlobalOptions(FileName);
|
||||||
|
FPpkg.CompilerOptions.Compiler := CompilerEdit.Text;
|
||||||
|
// Remove the default configuration-file, so a new one will be generated
|
||||||
|
FileName:=FPpkg.Options.GlobalSection.CompilerConfigDir+FPpkg.Options.CommandLineSection.CompilerConfig;
|
||||||
|
if FileExists(FileName) then
|
||||||
|
DeleteFile(FileName);
|
||||||
|
// This will create the compiler-configuration file
|
||||||
|
FPpkg.InitializeCompilerOptions;
|
||||||
|
finally
|
||||||
|
FPpkg.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TInitializeOptionsForm.IsVersionStr(AString: string): Boolean;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Result := length(AString) > 0;
|
||||||
|
for i := 1 to length(AString) do
|
||||||
|
begin
|
||||||
|
// only allow digits or a dot.
|
||||||
|
if AString[i] in ['0'..'9'] then
|
||||||
|
Continue
|
||||||
|
// allow dots, but not as first or last character
|
||||||
|
else if (AString[i] = '.') and (i > 1) and (i < length(AString)) then
|
||||||
|
begin
|
||||||
|
// do not allow two consecutive dots
|
||||||
|
if (i > 1) and (AString[i-1]='.') then
|
||||||
|
Result := False;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TInitializeOptionsForm.CheckInitialConfiguration: Boolean;
|
||||||
|
begin
|
||||||
|
Result := true;
|
||||||
|
if not FileExists(GetFppkgConfigFile(False, False)) and
|
||||||
|
not FileExists(GetFppkgConfigFile(True, False)) then
|
||||||
|
begin
|
||||||
|
Result := RecreateFppkgConfiguration;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TInitializeOptionsForm.RecreateFppkgConfiguration: Boolean;
|
||||||
|
var
|
||||||
|
Frm: TInitializeOptionsForm;
|
||||||
|
begin
|
||||||
|
Frm := TInitializeOptionsForm.Create(nil);
|
||||||
|
try
|
||||||
|
Frm.FppkgConfigPanel.Visible := True;
|
||||||
|
if Frm.ShowModal in [mrClose, mrCancel] then
|
||||||
|
Result := False
|
||||||
|
else
|
||||||
|
Result := True;
|
||||||
|
finally
|
||||||
|
Frm.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
@ -154,6 +154,7 @@ type
|
|||||||
procedure UpdatePackageListView;
|
procedure UpdatePackageListView;
|
||||||
procedure ListPackages;
|
procedure ListPackages;
|
||||||
|
|
||||||
|
procedure LoadFppkgConfiguration;
|
||||||
procedure RescanPackages;
|
procedure RescanPackages;
|
||||||
procedure SetupColumns;
|
procedure SetupColumns;
|
||||||
|
|
||||||
@ -172,7 +173,7 @@ implementation
|
|||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Masks, fppkg_aboutfrm;
|
Masks, fppkg_aboutfrm, fppkg_initializeoptionsfrm;
|
||||||
|
|
||||||
resourcestring
|
resourcestring
|
||||||
SErrActionFailed = 'Failed to %s: ' + sLineBreak + sLineBreak + '%s';
|
SErrActionFailed = 'Failed to %s: ' + sLineBreak + sLineBreak + '%s';
|
||||||
@ -333,8 +334,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFppkgForm.FormCreate(Sender: TObject);
|
procedure TFppkgForm.FormCreate(Sender: TObject);
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
//setup log callback function
|
//setup log callback function
|
||||||
|
|
||||||
@ -351,24 +350,15 @@ begin
|
|||||||
//setup error callback function
|
//setup error callback function
|
||||||
ErrorHandler := @LazError;
|
ErrorHandler := @LazError;
|
||||||
|
|
||||||
|
if not TInitializeOptionsForm.CheckInitialConfiguration then
|
||||||
|
begin
|
||||||
|
Application.Terminate;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
FFPpkg := TpkgFPpkg.Create(Self);
|
FFPpkg := TpkgFPpkg.Create(Self);
|
||||||
|
|
||||||
FFPpkg.InitializeGlobalOptions('');
|
LoadFppkgConfiguration;
|
||||||
|
|
||||||
FFPpkg.Options.GlobalSection.Downloader := 'FPC';
|
|
||||||
|
|
||||||
SetLength(FPMKUnitDeps,FPMKUnitDepDefaultCount);
|
|
||||||
for i := 0 to FPMKUnitDepDefaultCount-1 do
|
|
||||||
FPMKUnitDeps[i]:=FPMKUnitDepsDefaults[i];
|
|
||||||
|
|
||||||
FFPpkg.InitializeCompilerOptions;
|
|
||||||
|
|
||||||
FFPpkg.CompilerOptions.InitCompilerDefaults;
|
|
||||||
FFPpkg.FpmakeCompilerOptions.InitCompilerDefaults;
|
|
||||||
FFPpkg.CompilerOptions.CheckCompilerValues;
|
|
||||||
FFPpkg.FpmakeCompilerOptions.CheckCompilerValues;
|
|
||||||
|
|
||||||
FFPpkg.LoadLocalAvailableMirrors;
|
|
||||||
|
|
||||||
Caption := rsFreePascalPackageManagerForLazarus;
|
Caption := rsFreePascalPackageManagerForLazarus;
|
||||||
|
|
||||||
@ -834,6 +824,37 @@ begin
|
|||||||
CategoryCheckListBox.Checked[i] := True;
|
CategoryCheckListBox.Checked[i] := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFppkgForm.LoadFppkgConfiguration;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
FFPpkg.InitializeGlobalOptions('');
|
||||||
|
|
||||||
|
FFPpkg.Options.GlobalSection.Downloader := 'FPC';
|
||||||
|
|
||||||
|
SetLength(FPMKUnitDeps,FPMKUnitDepDefaultCount);
|
||||||
|
for i := 0 to FPMKUnitDepDefaultCount-1 do
|
||||||
|
FPMKUnitDeps[i]:=FPMKUnitDepsDefaults[i];
|
||||||
|
|
||||||
|
FFPpkg.InitializeCompilerOptions;
|
||||||
|
|
||||||
|
FFPpkg.CompilerOptions.CheckCompilerValues;
|
||||||
|
FFPpkg.FpmakeCompilerOptions.CheckCompilerValues;
|
||||||
|
|
||||||
|
FFPpkg.ScanPackages;
|
||||||
|
|
||||||
|
if not Assigned(FFPpkg.FindPackage('rtl', pkgpkInstalled)) then
|
||||||
|
begin
|
||||||
|
ShowMessage('Fppkg seems to be configured, but the RTL could not be found. Please fix the Fppkg-configuration with the wizard or manualy.');
|
||||||
|
if TInitializeOptionsForm.RecreateFppkgConfiguration then
|
||||||
|
begin
|
||||||
|
LoadFppkgConfiguration;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
FFPpkg.LoadLocalAvailableMirrors;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFppkgForm.RescanPackages;
|
procedure TFppkgForm.RescanPackages;
|
||||||
begin
|
begin
|
||||||
FFPpkg.ScanAvailablePackages;
|
FFPpkg.ScanAvailablePackages;
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item3>
|
</Item3>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="4">
|
<Units Count="5">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="lazarusfppkg.pas"/>
|
<Filename Value="lazarusfppkg.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
@ -67,6 +67,13 @@
|
|||||||
<Filename Value="..\src\fppkg_lpk.pas"/>
|
<Filename Value="..\src\fppkg_lpk.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit3>
|
</Unit3>
|
||||||
|
<Unit4>
|
||||||
|
<Filename Value="..\src\fppkg_initializeoptionsfrm.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="InitializeOptionsForm"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
</Unit4>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
@ -11,7 +11,8 @@ uses
|
|||||||
pkgDownload,
|
pkgDownload,
|
||||||
fppkg_lpk,
|
fppkg_lpk,
|
||||||
pkgfpmake,
|
pkgfpmake,
|
||||||
pkgfphttp;
|
pkgfphttp,
|
||||||
|
fppkg_initializeoptionsfrm;
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user