-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy pathextrasettings.pas
1527 lines (1298 loc) · 42.9 KB
/
extrasettings.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit extrasettings;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, StdCtrls, Buttons, ExtCtrls,
Dialogs, CheckLst, IniPropStorage, ComCtrls, m_crossinstaller;
type
TString = class(TObject)
private
fStr: String;
public
constructor Create(const AStr: String) ;
property Str: String read FStr write FStr;
end;
{ TForm2 }
TForm2 = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
btnListCustomOptions: TButton;
btnSelectLibDir: TButton;
btnSelectBinDir: TButton;
btnAddFPCPatch: TButton;
btnRemFPCPatch: TButton;
btnAddLazPatch: TButton;
btnRemLazPatch: TButton;
btnSelectCompiler: TButton;
chkFPCDebug: TCheckBox;
chkLazarusDebug: TCheckBox;
ComboBoxCPU: TComboBox;
ComboBoxOS: TComboBox;
IniPropStorageSettings: TIniPropStorage;
LabelCPU: TLabel;
LabelOS: TLabel;
MiscellaneousCheckListBox: TCheckListBox;
EditCrossBuildOptions: TEdit;
EditFPCBranch: TEdit;
EditFPCOptions: TEdit;
EditFPCRevision: TEdit;
EditLazarusBranch: TEdit;
EditLazarusOptions: TEdit;
EditLazarusRevision: TEdit;
EditLibLocation: TEdit;
EditBinLocation: TEdit;
EditCompilerOverride: TEdit;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
ScrollBox1: TScrollBox;
EditHTTPProxyHost: TEdit;
EditHTTPProxyPort: TEdit;
EditHTTPProxyUser: TEdit;
EditHTTPProxyPassword: TEdit;
GroupBoxCompileOptions: TGroupBox;
GroupBoxFPCLazBranchRevision: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
LabelCrossBuildOptions: TLabel;
LabelCompilerOverride: TLabel;
LabelFPCbranch: TLabel;
LabelFPCOptions: TLabel;
LabelFPCRevision: TLabel;
LabelLazarusbranch: TLabel;
LabelLazarusOptions: TLabel;
LabelLazarusRevision: TLabel;
ListBoxFPCPatch: TListBox;
ListBoxLazPatch: TListBox;
OpenDialog1: TOpenDialog;
ButtonPanel: TPanel;
PageControl1: TPageControl;
rgrpSearchOptions: TRadioGroup;
rgrpSubarch: TRadioGroup;
RadioGroupARMArch: TRadioGroup;
SelectDirectoryDialog1: TSelectDirectoryDialog;
tsCPUOS: TTabSheet;
tsSUBARCH: TTabSheet;
procedure btnAddPatchClick(Sender: TObject);
procedure btnRemPatchClick(Sender: TObject);
procedure btnSelectFile(Sender: TObject);
procedure btnListCustomOptionsClick({%H-}Sender: TObject);
procedure ComboBoxCPUOSChange({%H-}Sender: TObject);
procedure EditCrossBuildOptionsEditingDone(Sender: TObject);
procedure EditDblClickDelete(Sender: TObject);
procedure FormClose({%H-}Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure FormCreate({%H-}Sender: TObject);
procedure FormDestroy({%H-}Sender: TObject);
procedure IniPropStorageSettingsRestoringProperties({%H-}Sender: TObject);
procedure IniPropStorageSettingsSavingProperties({%H-}Sender: TObject);
procedure OnDirectorySelect(Sender: TObject);
procedure rgrpSearchOptionsSelectionChanged(Sender: TObject);
procedure RadioGroupARMArchSelectionChanged(Sender: TObject);
procedure rgrpSubarchSelectionChanged(Sender: TObject);
private
FInstallPath:string;
LocalCPU:TCPU;
LocalOS:TOS;
LocalSUBARCH:TSUBARCH;
function GetCheckIndex(aCaption:string):integer;
function GetCheckState(aCaption:string):boolean;
procedure SetCheckState(aCaption:string;aState:boolean);
procedure SetCheckEnabled(aCaption:string;aState:boolean);
function GetPatches(const Lazarus:boolean=false):string;
procedure SetPatches(value:string;const Lazarus:boolean=false);
function GetRepo:boolean;
procedure SetRepo(value:boolean);
function GetPackageRepo:boolean;
procedure SetPackageRepo(value:boolean);
function GetUpdateOnly:boolean;
procedure SetUpdateOnly(value:boolean);
function GetSystemFPC:boolean;
procedure SetSystemFPC(value:boolean);
function GetIncludeLCL:boolean;
procedure SetIncludeLCL(value:boolean);
function GetIncludeHelp:boolean;
procedure SetIncludeHelp(value:boolean);
function GetSplitFPC:boolean;
procedure SetSplitFPC(value:boolean);
function GetSplitLazarus:boolean;
procedure SetSplitLazarus(value:boolean);
function GetUseWget:boolean;
procedure SetUseWget(value:boolean);
function GetMakeJobs:boolean;
procedure SetMakeJobs(value:boolean);
function GetExtraVerbose:boolean;
procedure SetExtraVerbose(value:boolean);
function GetAutoSwitchURL:boolean;
procedure SetAutoSwitchURL(value:boolean);
function GetSendInfo:boolean;
procedure SetSendInfo(value:boolean);
function GetFpcupBootstrappersOnly:boolean;
procedure SetFpcupBootstrappersOnly(value:boolean);
function GetForceLocalRepoClient:boolean;
procedure SetForceLocalRepoClient(value:boolean);
function GetCheckUpdates:boolean;
procedure SetCheckUpdates(value:boolean);
function GetUseSoftFloat:boolean;
procedure SetUseSoftFloat(value:boolean);
function GetAllowOnlinePatching:boolean;
procedure SetAllowOnlinePatching(value:boolean);
function GetAddContext:boolean;
procedure SetAddContext(value:boolean);
function GetHTTPProxyHost:string;
function GetHTTPProxyPort:integer;
function GetHTTPProxyUser:string;
function GetHTTPProxyPass:string;
function GetFPCOptions:string;
procedure SetFPCOptions(value:string);
function GetLazarusOptions:string;
procedure SetLazarusOptions(value:string);
function GetFPCDebug:boolean;
procedure SetFPCDebug(value:boolean);
function GetLazarusDebug:boolean;
procedure SetLazarusDebug(value:boolean);
function GetFPCRevision:string;
procedure SetFPCRevision(value:string);
procedure ForceSetFPCRevision(value:string);
function GetLazarusRevision:string;
procedure SetLazarusRevision(value:string);
procedure ForceSetLazarusRevision(value:string);
function GetFPCBranch:string;
procedure SetFPCBranch(value:string);
function GetLazarusBranch:string;
procedure SetLazarusBranch(value:string);
function GetFPCPatches:string;
procedure SetFPCPatches(value:string);
function GetLazPatches:string;
procedure SetLazPatches(value:string);
{
function GetCPUFromComboBox:TCPU;
function GetOSFromComboBox:TOS;
property CPUFromComboBox:TCPU read GetCPUFromComboBox;
property OSFromComboBox:TOS read GetOSFromComboBox;
}
public
procedure SetInstallDir(const aInstallDir:string='');
procedure SetCrossTarget(aSender:TObject;aCPU:TCPU;aOS:TOS);
function GetLibraryDirectory(aCPU:TCPU;aOS:TOS;aSubarch:TSUBARCH):string;
function GetToolsDirectory(aCPU:TCPU;aOS:TOS;aSubarch:TSUBARCH):string;
function GetCrossBuildOptions(aCPU:TCPU;aOS:TOS;aSubarch:TSUBARCH):string;
function GetCrossARMArch(aCPU:TCPU;aOS:TOS;aSubarch:TSUBARCH):TARMARCH;
function GetCrossARMFPCStr(aCPU:TCPU;aOS:TOS;aSubarch:TSUBARCH): string;
function GetCompiler(aCPU:TCPU;aOS:TOS;aSubarch:TSUBARCH): string;
function GetCrossAvailable(aCPU:TCPU;aOS:TOS;aSubarch:TSUBARCH): boolean;
procedure SetCrossAvailable(aCPU:TCPU;aOS:TOS;aSubarch:TSUBARCH;aValue:boolean);
property Repo:boolean read GetRepo write SetRepo;
property PackageRepo:boolean read GetPackageRepo write SetPackageRepo;
property UpdateOnly:boolean read GetUpdateOnly write SetUpdateOnly;
property SystemFPC:boolean read GetSystemFPC write SetSystemFPC;
property IncludeLCL:boolean read GetIncludeLCL write SetIncludeLCL;
property IncludeHelp:boolean read GetIncludeHelp write SetIncludeHelp;
property SplitFPC:boolean read GetSplitFPC write SetSplitFPC;
property SplitLazarus:boolean read GetSplitLazarus write SetSplitLazarus;
property UseWget:boolean read GetUseWget write SetUseWget;
property MakeJobs:boolean read GetMakeJobs write SetMakeJobs;
property ExtraVerbose:boolean read GetExtraVerbose write SetExtraVerbose;
property AutoSwitchURL:boolean read GetAutoSwitchURL write SetAutoSwitchURL;
property SendInfo:boolean read GetSendInfo write SetSendInfo;
property FpcupBootstrappersOnly:boolean read GetFpcupBootstrappersOnly write SetFpcupBootstrappersOnly;
property ForceLocalRepoClient:boolean read GetForceLocalRepoClient write SetForceLocalRepoClient;
property GetUpdates:boolean read GetCheckUpdates write SetCheckUpdates;
property UseSoftFloat:boolean read GetUseSoftFloat write SetUseSoftFloat;
property OnlinePatching:boolean read GetAllowOnlinePatching write SetAllowOnlinePatching;
property AddContext:boolean read GetAddContext write SetAddContext;
property HTTPProxyHost:string read GetHTTPProxyHost;
property HTTPProxyPort:integer read GetHTTPProxyPort;
property HTTPProxyUser:string read GetHTTPProxyUser;
property HTTPProxyPass:string read GetHTTPProxyPass;
property FPCOptions:string read GetFPCOptions write SetFPCOptions;
property LazarusOptions:string read GetLazarusOptions write SetLazarusOptions;
property FPCDebug:boolean read GetFPCDebug write SetFPCDebug;
property LazarusDebug:boolean read GetLazarusDebug write SetLazarusDebug;
property FPCRevision:string read GetFPCRevision write SetFPCRevision;
property LazarusRevision:string read GetLazarusRevision write SetLazarusRevision;
property ForceFPCRevision:string write ForceSetFPCRevision;
property ForceLazarusRevision:string write ForceSetLazarusRevision;
property FPCBranch:string read GetFPCBranch write SetFPCBranch;
property LazarusBranch:string read GetLazarusBranch write SetLazarusBranch;
property FPCPatches:string read GetFPCPatches write SetFPCPatches;
property LazPatches:string read GetLazPatches write SetLazPatches;
end;
resourcestring
HintCheckRepo = 'Download whole repository, or only latest files';
CaptionCheckRepo = 'Get FPC/Laz repositories (default=yes)';
HintCheckPackageRepo = '';
CaptionCheckPackageRepo = 'Get package repositories (default=no)';
HintCheckIncludeLCL = '';
CaptionCheckIncludeLCL = 'Include LCL with cross-compiler (default=no)';
HintCheckUpdateOnly = '';
CaptionCheckUpdateOnly = 'FPC/Laz rebuild only (default=no)';
HintCheckSystemFPC = 'Use the system wide install of FPC to build Lazarus.';
CaptionCheckSystemFPC = 'Use system FPC for Lazarus (default=no)';
HintCheckIncludeHelp = '';
CaptionCheckIncludeHelp = 'Include Help (default=no)';
HintCheckSplitFPC = '';
CaptionCheckSplitFPC = 'Split FPC source and bins (default=yes)';
HintCheckSplitLazarus = '';
CaptionCheckSplitLazarus = 'Split Lazarus source and bins (default=no)';
HintCheckUseWget = '';
CaptionCheckUseWget = 'Use wget/libcurl as downloader (default=no)';
HintCheckUseMakeJobs = '';
CaptionCheckUseMakeJobs = 'Use jobs for GNU make (default=yes)';
HintCheckExtraVerbose = '';
CaptionCheckExtraVerbose = 'Be extra verbose (default=no)';
HintCheckAutoSwitchURL = '';
CaptionCheckAutoSwitchURL = 'Auto-switch repo URL (default=no)';
HintCheckSendInfo = 'Location and install info will be send to public central fpcupdeluxe server.';
CaptionCheckSendInfo = 'Send location and install info (default=no)';
HintCheckFpcupBootstrappersOnly = '';
CaptionCheckFpcupBootstrappersOnly = 'Only use fpcup bootstrappers (default=no)';
HintCheckForceLocalRepoClient = 'Use the repo-client by fpcupdeluxe.';
CaptionCheckForceLocalRepoClient = 'Use local repo-client (default=no)';
HintCheckGetUpdates = 'Check for updates of fpcupdeluxe binaries.';
CaptionCheckGetUpdates = 'Check for fpcupdeluxe updates (default=no)';
HintUseSoftFloat80bit = 'Enable software emulation of 80 bit floats.';
CaptionUseSoftFloat80bit = 'Enable software emulation of 80 bit floats.';
HintCheckEnableOnlinePatching = 'Fpcupdeluxe can patch the sources automagically by using online patches.';
CaptionCheckEnableOnlinePatching = 'Allow patching of sources by online patches.';
HintCheckAddContext = 'Double clicking on FPC and Lazarus files will open Lazarus.';
CaptionCheckAddContext = 'Add context for FPC and Lazarus files.';
var
Form2: TForm2;
implementation
{$R *.lfm}
uses
infounit,
DCPDES,
//DCPrc4,
DCPsha256,
fpcuputil,
installerUniversal,
IniFiles;
{ TForm2 }
constructor TString.Create(const AStr: String) ;
begin
inherited Create;
FStr := AStr;
end;
procedure TForm2.OnDirectorySelect(Sender: TObject);
begin
if Sender=btnSelectLibDir then SelectDirectoryDialog1.InitialDir:=EditLibLocation.Text;
if Sender=btnSelectBinDir then SelectDirectoryDialog1.InitialDir:=EditBinLocation.Text;
if SelectDirectoryDialog1.Execute then
begin
if Sender=btnSelectLibDir then EditLibLocation.Text:=SelectDirectoryDialog1.FileName;
if Sender=btnSelectBinDir then EditBinLocation.Text:=SelectDirectoryDialog1.FileName;
end;
if ((LocalCPU<>TCPU.cpuNone) AND (LocalOS<>TOS.osNone)) then
begin
if Sender=btnSelectLibDir then
CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].LibDir:=SelectDirectoryDialog1.FileName;
if Sender=btnSelectBinDir then
CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].BinDir:=SelectDirectoryDialog1.FileName;
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
var
CPU :TCPU;
OS :TOS;
ARMArch :TARMARCH;
s :string;
SortedList:TStringList;
//Cipher : TDCP_rc4;
Cipher :TDCP_DES;
begin
IniPropStorageSettings.IniFileName:=IncludeTrailingPathDelimiter(SafeGetApplicationPath)+installerUniversal.DELUXEFILENAME;
SortedList:=TStringList.Create;
try
// Fill ComboBoxOS
SortedList.Clear;
SortedList.Sorted:=False;
for OS := Low(TOS) to High(TOS) do
begin
if OS=TOS.osNone then continue;
SortedList.Add(GetOS(OS));
end;
SortedList.Sort;
for s in SortedList do
ComboBoxOS.Items.Add(s);
// Fill ComboBoxCPU
SortedList.Clear;
SortedList.Sorted:=False;
for CPU := Low(TCPU) to High(TCPU) do
begin
if CPU=TCPU.cpuNone then continue;
SortedList.Add(GetCPU(CPU));
end;
SortedList.Sort;
for s in SortedList do
ComboBoxCPU.Items.Add(s);
finally
SortedList.Free;
end;
// Fill ARM Arch radiogroup
for ARMArch := Low(TARMARCH) to High(TARMARCH) do
RadioGroupARMArch.Items.Add(GetEnumNameSimple(TypeInfo(TARMARCH),Ord(ARMArch)));
RadioGroupARMArch.ItemIndex:=0;
with MiscellaneousCheckListBox.Items do
begin
Append(CaptionCheckRepo);
Append(CaptionCheckPackageRepo);
Append(CaptionCheckIncludeLCL);
Append(CaptionCheckUpdateOnly);
Append(CaptionCheckSystemFPC);
Append(CaptionCheckIncludeHelp);
Append(CaptionCheckSplitFPC);
Append(CaptionCheckSplitLazarus);
Append(CaptionCheckUseWget);
Append(CaptionCheckUseMakeJobs);
Append(CaptionCheckExtraVerbose);
Append(CaptionCheckAutoSwitchURL);
Append(CaptionCheckSendInfo);
Append(CaptionCheckFpcupBootstrappersOnly);
Append(CaptionCheckForceLocalRepoClient);
Append(CaptionCheckGetUpdates);
Append(CaptionUseSoftFloat80bit);
Append(CaptionCheckEnableOnlinePatching);
Append(CaptionCheckAddContext);
end;
with TIniFile.Create(SafeGetApplicationPath+installerUniversal.DELUXEFILENAME) do
try
Repo:=ReadBool('General','GetRepo',True);
PackageRepo:=ReadBool('General','GetPackageRepo',False);
IncludeHelp:=ReadBool('General','IncludeHelp',False);
IncludeLCL:=ReadBool('Cross','IncludeLCL',False);
{$ifdef RemoteLog}
SendInfo:=ReadBool('General','SendInfo',False);
{$endif}
EditHTTPProxyHost.Text:=ReadString('ProxySettings','HTTPProxyURL','');
EditHTTPProxyPort.Text:=InttoStr(ReadInteger('ProxySettings','HTTPProxyPort',8080));
EditHTTPProxyUser.Text:=ReadString('ProxySettings','HTTPProxyUser','');
// add some security into the password storage ... ;-)
s:=ReadString('ProxySettings','HTTPProxyPass','');
if Length(s)>0 then
begin
//Cipher:= TDCP_rc4.Create(nil);
Cipher := TDCP_DES.Create(nil);
try
{$ifdef SECRETDELUXEKEY}
Cipher.InitStr(VERYSECRETDELUXEKEY,TDCP_sha256);
{$else}
Cipher.InitStr(DELUXEKEY,TDCP_sha256);
{$endif}
s:=Cipher.DecryptString(s);
finally
Cipher.Burn;
Cipher.Free;
end;
end;
EditHTTPProxyPassword.Text:=s;
finally
Free;
end;
//defaults
LocalCPU:=TCPU.cpuNone;
LocalOS:=TOS.osNone;
LocalSUBARCH:=TSUBARCH.saNone;
SplitFPC:=true;
MakeJobs:=true;
Self.LazarusDebug:=true;
{$ifdef win64}
MakeJobs:=False;
{$endif}
SetInstallDir;// for backwards compatibility
//{$IF (defined(MSWINDOWS)) OR (defined(Darwin)) OR (defined(OpenBSD))}
{$IF (defined(BSD)) AND (NOT defined(FreeBSD))}
// there are default setings for the downloader, so disable user access
UseWget:=False;
{$endif}
{$ifndef RemoteLog}
SendInfo:=False;
SetCheckEnabled(CaptionCheckSendInfo,False);
{$endif}
{$ifndef Windows}
ForceLocalRepoClient:=False;
SetCheckEnabled(CaptionCheckForceLocalRepoClient,False);
{$endif}
{$ifdef Windows}
AddContext:=False;
SetCheckEnabled(CaptionCheckAddContext,False);
{$endif}
UseSoftFloat:=true;
//Disable split lazarus by default ... still testing
SplitLazarus:=False;
SetCheckEnabled(CaptionCheckSplitLazarus,False);
{$IF defined(CPUAARCH64) OR defined(CPUARM) OR defined(Haiku)}
// disable some features
UseSoftFloat:=false;
SetCheckEnabled(CaptionUseSoftFloat80bit,False);
{$endif}
//Disable OnlinePatching by default starting with 1.6.8p
OnlinePatching:=false;
end;
procedure TForm2.SetInstallDir(const aInstallDir:string='');
var
CPU:TCPU;
OS:TOS;
SUBARCH:TSUBARCH;
Subarchs:TSUBARCHS;
s1,s2:string;
begin
if (Length(aInstallDir)>0)
then FInstallPath:=IncludeTrailingPathDelimiter(aInstallDir)
else FInstallPath:=SafeGetApplicationPath;
with TMemIniFile.Create(FInstallPath+installerUniversal.DELUXEFILENAME) do
try
for OS := Low(TOS) to High(TOS) do
begin
if OS=osNone then continue;
for CPU := Low(TCPU) to High(TCPU) do
begin
if CPU=cpuNone then continue;
s1:=GetCPU(CPU)+'-'+GetOS(OS);
Subarchs:=GetSubarchs(CPU,OS);
for SUBARCH in Subarchs do
begin
if (SUBARCH<>saNone) then
s2:=s1+'-'+GetSubarch(SUBARCH)
else
s2:=s1;
with CrossUtils[CPU,OS,SUBARCH] do
begin
Ord(Setting):=ReadInteger(s2,'Setting',Ord(Setting));
LibDir:=ReadString(s2,'LibPath',LibDir);
BinDir:=ReadString(s2,'BinPath',BinDir);
CrossBuildOptions:=ReadString(s2,'CrossBuildOptions',CrossBuildOptions);
if CPU=arm then
CrossARMArch:=GetTARMArch(ReadString(s2,'CrossARMArch',GetARMArch(CrossARMArch)));
Compiler:=ReadString(s2,'Compiler',Compiler);
end;
end;
end;
end;
finally
Free;
end;
end;
procedure TForm2.SetCrossTarget(aSender:TObject;aCPU:TCPU;aOS:TOS);
var
Subarch:TSUBARCH;
Subarchs:TSUBARCHS;
aIndex:integer;
e:boolean;
SystemChange:boolean;
begin
SystemChange:=( (LocalCPU<>aCPU) OR (LocalOS<>aOS) );
LocalCPU:=aCPU;
LocalOS:=aOS;
LocalSUBARCH:=GetSelectedSubArch(LocalCPU,LocalOS);
if SystemChange then
begin
if LocalCPU=TCPU.cpuNone then
ComboBoxCPU.ItemIndex:=-1
else
begin
aIndex:=ComboBoxCPU.Items.IndexOf(GetCPU(LocalCPU));
ComboBoxCPU.ItemIndex:=aIndex;
end;
if LocalOS=TOS.osNone then
ComboBoxOS.ItemIndex:=-1
else
begin
aIndex:=ComboBoxOS.Items.IndexOf(GetOS(LocalOS));
ComboBoxOS.ItemIndex:=aIndex;
end;
end;
e:=((LocalCPU<>TCPU.cpuNone) AND (LocalOS<>TOS.osNone));
rgrpSearchOptions.Enabled:=e;
EditCrossBuildOptions.Enabled:=e;
EditCompilerOverride.Enabled:=e;
btnSelectCompiler.Enabled:=e;
RadioGroupARMArch.Enabled:=(e AND (LocalCPU=TCPU.arm));
EditLibLocation.Text:=CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].LibDir;
EditBinLocation.Text:=CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].BinDir;
EditCrossBuildOptions.Text:=CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].CrossBuildOptions;
rgrpSearchOptions.ItemIndex:=Ord(CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].Setting);
RadioGroupARMArch.ItemIndex:=Ord(CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].CrossARMArch);
EditCompilerOverride.Text:=CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].Compiler;
if e then e:=CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].Setting=TSearchSetting.ssCustom;
EditLibLocation.Enabled:=e;
EditBinLocation.Enabled:=e;
btnSelectLibDir.Enabled:=e;
btnSelectBinDir.Enabled:=e;
if aSender<>rgrpSubarch then
begin
e:=((LocalCPU<>TCPU.cpuNone) AND (LocalOS<>TOS.osNone) AND (LocalOS in SUBARCH_OS) AND (LocalCPU in SUBARCH_CPU));
tsSUBARCH.Enabled:=e;
if SystemChange then
begin
rgrpSubarch.BeginUpdateBounds;
try
rgrpSubarch.Items.Clear;
Subarchs:=[TSUBARCH.saNone];
if (e) then
Subarchs:=GetSubarchs(LocalCPU,LocalOS);
for Subarch in Subarchs do
begin
if (Subarch<>TSUBARCH.saNone) then
begin
rgrpSubarch.Items.Append(GetSubarch(Subarch));
if Subarch=LocalSUBARCH then rgrpSubarch.ItemIndex:=Pred(rgrpSubarch.Items.Count);
end;
end;
if rgrpSubarch.Items.Count=1 then rgrpSubarch.ItemIndex:=0;
finally
rgrpSubarch.EndUpdateBounds;
end;
end
else
begin
aIndex:=rgrpSubarch.Items.IndexOf(GetSubarch(LocalSUBARCH));
rgrpSubarch.ItemIndex:=aIndex;
end;
end;
end;
procedure TForm2.ComboBoxCPUOSChange(Sender: TObject);
var
aCPU:TCPU;
aOS:TOS;
begin
aCPU:=TCPU.cpuNone;
aOS:=TOS.osNone;
if (ComboBoxCPU.ItemIndex<>-1) then aCPU:=GetTCPU(ComboBoxCPU.Items[ComboBoxCPU.ItemIndex]);
if (ComboBoxOS.ItemIndex<>-1) then aOS:=GetTOS(ComboBoxOS.Items[ComboBoxOS.ItemIndex]);
SetCrossTarget(Sender,aCPU,aOS);
end;
procedure TForm2.EditCrossBuildOptionsEditingDone(Sender: TObject);
begin
if ((LocalCPU<>TCPU.cpuNone) AND (LocalOS<>TOS.osNone)) then
begin
CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].CrossBuildOptions:=TEdit(Sender).Text;
end;
end;
procedure TForm2.EditDblClickDelete(Sender: TObject);
begin
TEdit(Sender).Text:='';
if ((LocalCPU<>TCPU.cpuNone) AND (LocalOS<>TOS.osNone)) then
begin
if Sender=EditCompilerOverride then CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].Compiler:='';
if Sender=EditLibLocation then CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].LibDir:='';
if Sender=EditBinLocation then CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].BinDir:='';
if Sender=EditCrossBuildOptions then CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].CrossBuildOptions:='';
end;
end;
procedure TForm2.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
SetSelectedSubArch(LocalCPU,LocalOS,LocalSUBARCH);
LocalCPU:=TCPU.cpuNone;
LocalOS:=TOS.osNone;
PageControl1.PageIndex:=0;
EditFPCRevision.Color:=clDefault;
EditLazarusRevision.Color:=clDefault;
end;
procedure TForm2.btnAddPatchClick(Sender: TObject);
var
PatchName: string;
FullPatchPath: string;
aListBox:TListBox;
begin
OpenDialog1.FilterIndex:=1;
if OpenDialog1.Execute then
begin
FullPatchPath := OpenDialog1.FileName;
PatchName := ExtractFileName(FullPatchPath);
if Sender=btnAddFPCPatch then aListBox:=ListBoxFPCPatch;
if Sender=btnAddLazPatch then aListBox:=ListBoxLazPatch;
if aListBox.Items.IndexOf(PatchName)=-1 then
begin
aListBox.Items.AddObject(PatchName, TString.Create(FullPatchPath));
end;
end;
end;
procedure TForm2.btnRemPatchClick(Sender: TObject);
var
i:integer;
aListBox:TListBox;
begin
if Sender=btnRemFPCPatch then aListBox:=ListBoxFPCPatch;
if Sender=btnRemLazPatch then aListBox:=ListBoxLazPatch;
if aListBox.SelCount>0 then
begin
for i:=aListBox.Count-1 downto 0 do
begin
if aListBox.Selected[i] then
begin
TString(aListBox.Items.Objects[i]).Free;
aListBox.Items.Objects[i]:=nil;
aListBox.Items.Delete(i);
end;
end;
end;
end;
procedure TForm2.btnSelectFile(Sender: TObject);
begin
if Sender=btnSelectCompiler then
begin
OpenDialog1.InitialDir:=EditCompilerOverride.Text;
OpenDialog1.FilterIndex:=3;
end;
if OpenDialog1.Execute then
begin
if Sender=btnSelectCompiler then EditCompilerOverride.Text:=OpenDialog1.FileName;
end;
if ((LocalCPU<>TCPU.cpuNone) AND (LocalOS<>TOS.osNone)) then
begin
if Sender=btnSelectCompiler then
CrossUtils[LocalCPU,LocalOS,LocalSUBARCH].Compiler:=OpenDialog1.FileName;
end;
end;
procedure TForm2.btnListCustomOptionsClick(Sender: TObject);
var
CPU:TCPU;
OS:TOS;
SUBARCH:TSUBARCH;
Subarchs:TSUBARCHS;
s1,s2:string;
x:integer;
begin
InfoForm:= TInfoForm.Create(Self);
try
for OS := Low(TOS) to High(TOS) do
begin
if OS=TOS.osNone then continue;
for CPU := Low(TCPU) to High(TCPU) do
begin
if CPU=TCPU.cpuNone then continue;
s1:=GetCPU(CPU)+'-'+GetOS(OS);
Subarchs:=GetSubarchs(CPU,OS);
for SUBARCH in Subarchs do
begin
if (SUBARCH<>TSUBARCH.saNone) then
s2:=s1+'-'+GetSubarch(SUBARCH)
else
s2:=s1;
x:=InfoForm.Memo1.Lines.Count;
with CrossUtils[CPU,OS,SUBARCH] do
begin
if Setting=TSearchSetting.ssAuto then
begin
InfoForm.Memo1.Lines.Append(s2+': full auto search tools and libraries.');
end
else
if Setting=TSearchSetting.ssCustom then
begin
InfoForm.Memo1.Lines.Append(s2+' (manual settings):');
InfoForm.Memo1.Lines.Append(' libs : '+LibDir);
InfoForm.Memo1.Lines.Append(' bins : '+BinDir);
end;
if Length(CrossBuildOptions)>0 then
begin
if x=InfoForm.Memo1.Lines.Count then InfoForm.Memo1.Lines.Append(s2);
InfoForm.Memo1.Lines.Append(' options : '+CrossBuildOptions);
end;
if CPU=arm then
begin
if (CrossARMArch<>TARMARCH.none) then
begin
if x=InfoForm.Memo1.Lines.Count then InfoForm.Memo1.Lines.Append(s2);
InfoForm.Memo1.Lines.Append(' ARM Arch : '+GetARMArch(CrossARMArch));
end;
end;
if Length(Compiler)>0 then
begin
if x=InfoForm.Memo1.Lines.Count then InfoForm.Memo1.Lines.Append(s2);
InfoForm.Memo1.Lines.Append(' compiler : '+Compiler);
end;
if x<>InfoForm.Memo1.Lines.Count then InfoForm.Memo1.Lines.Append('');
end;
end;
end;
end;
InfoForm.ShowModal;
finally
InfoForm.Free;
end;
end;
procedure TForm2.FormDestroy(Sender: TObject);
var
CPU:TCPU;
OS:TOS;
SUBARCH:TSUBARCH;
Subarchs:TSUBARCHS;
s1,s2:string;
i:integer;
//Cipher: TDCP_rc4;
Cipher: TDCP_DES;
begin
with TMemIniFile.Create(SafeGetApplicationPath+installerUniversal.DELUXEFILENAME) do
try
WriteBool('General','GetRepo',Repo);
WriteBool('General','GetPackageRepo',PackageRepo);
WriteBool('General','IncludeHelp',IncludeHelp);
WriteBool('Cross','IncludeLCL',IncludeLCL);
{$ifdef RemoteLog}
WriteBool('General','SendInfo',SendInfo);
{$endif}
WriteString('ProxySettings','HTTPProxyURL',EditHTTPProxyHost.Text);
if TryStrToInt(EditHTTPProxyPort.Text,i) then WriteInteger('ProxySettings','HTTPProxyPort',i);
WriteString('ProxySettings','HTTPProxyUser',EditHTTPProxyUser.Text);
// add some security into the password storage ... ;-)
s1:=EditHTTPProxyPassword.Text;
s2:=s1;
if Length(s1)>0 then
begin
//Cipher:= TDCP_rc4.Create(nil);
Cipher := TDCP_DES.Create(nil);
try
{$ifdef SECRETDELUXEKEY}
Cipher.InitStr(VERYSECRETDELUXEKEY,TDCP_sha256);
{$else}
Cipher.InitStr(DELUXEKEY,TDCP_sha256);
{$endif}
s2:=Cipher.EncryptString(s1);
finally
Cipher.Burn;
Cipher.Free;
end;
end;
WriteString('ProxySettings','HTTPProxyPass',s2);
UpdateFile;
finally
Free;
end;
with TMemIniFile.Create(FInstallPath+installerUniversal.DELUXEFILENAME) do
try
for OS := Low(TOS) to High(TOS) do
begin
if OS=osNone then continue;
for CPU := Low(TCPU) to High(TCPU) do
begin
if CPU=cpuNone then continue;
// skip non-combi's to reduce size of ini-file
if ((OS=amiga) AND (CPU<>m68k)) then continue;
if ((OS=morphos) AND (CPU<>powerpc)) then continue;
if ((OS=java) AND (CPU<>jvm)) OR ((CPU=jvm) AND (OS<>java) AND (OS<>android)) then continue;
if (OS=ultibo) AND ((CPU<>arm) AND (CPU<>aarch64)) then continue;
if (OS=android) AND ((CPU<>arm) AND (CPU<>aarch64) AND (CPU<>jvm) AND (CPU<>mipsel)) then continue;
if (OS=iphonesim) AND ((CPU<>i386) AND (CPU<>x86_64)) then continue;
if (OS=wince) AND (CPU<>arm) then continue;
if (OS=win32) AND ((CPU<>i386) AND (CPU<>x86_64)) then continue;
if (OS=win64) AND ((CPU<>i386) AND (CPU<>x86_64) AND (CPU<>aarch64)) then continue;
if (OS=haiku) AND ((CPU<>i386) AND (CPU<>x86_64) {AND (CPU<>arm)}) then continue;
if (OS=solaris) AND ((CPU<>x86_64) AND (CPU<>sparc)) then continue;
if (OS=ios) AND ((CPU<>arm) AND (CPU<>aarch64)) then continue;
if ((OS=wasi) AND (CPU<>wasm32)) then continue;
if (CPU=xtensa) AND ((OS<>linux) AND (OS<>freertos)) then continue;
if (CPU=powerpc) AND ((OS<>aix) AND (OS<>linux) AND (OS<>darwin)) then continue;
if (CPU=powerpc64) AND ((OS<>aix) AND (OS<>linux) AND (OS<>darwin)) then continue;
if (CPU=mips) AND (OS<>linux) then continue;
if (CPU=mipsel) AND ((OS<>linux) AND (OS<>android) AND (OS<>embedded)) then continue;
if (CPU=avr) AND (OS<>embedded) then continue;
if (CPU=sparc64) AND (OS<>linux) then continue;
if ((CPU=riscv32) OR (CPU=riscv64)) AND ((OS<>linux) AND (OS<>embedded)) then continue;
if (CPU=wasm32) AND ((OS<>wasi) AND (OS<>embedded)) then continue;
s1:=GetCPU(CPU)+'-'+GetOS(OS);
Subarchs:=GetSubarchs(CPU,OS);
for SUBARCH in Subarchs do
begin
if (SUBARCH<>saNone) then
s2:=s1+'-'+GetSubarch(SUBARCH)
else
s2:=s1;
with CrossUtils[CPU,OS,SUBARCH] do
begin
WriteInteger(s2,'Setting',Ord(Setting));
WriteString(s2,'LibPath',LibDir);
WriteString(s2,'BinPath',BinDir);
WriteString(s2,'CrossBuildOptions',CrossBuildOptions);
if CPU=arm then
WriteString(s2,'CrossARMArch',GetARMArch(CrossARMArch));
WriteString(s2,'Compiler',Compiler);
end;
end;
end;
end;
UpdateFile;
finally
Free;
end;
if (ListBoxFPCPatch.Items.Count>0) then
begin
for i := 0 to ListBoxFPCPatch.Items.Count - 1 do
begin
TString(ListBoxFPCPatch.Items.Objects[i]).Free;
ListBoxFPCPatch.Items.Objects[i] := nil;
end;
end;
if (ListBoxLazPatch.Items.Count>0) then
begin
for i := 0 to ListBoxLazPatch.Items.Count - 1 do
begin
TString(ListBoxLazPatch.Items.Objects[i]).Free;
ListBoxLazPatch.Items.Objects[i] := nil;
end;
end;
end;
procedure TForm2.IniPropStorageSettingsRestoringProperties(Sender: TObject);