Updated to 1.2

This commit is contained in:
Denis Silakov 2014-06-10 16:20:52 +04:00
parent 7f4d2b489a
commit c9ddb73eef
4 changed files with 41 additions and 434 deletions

View file

@ -1,2 +1,3 @@
sources:
lazarus-1.0.14-0.tar.gz: 2a0f9fa4daac6c304684a28d76a42c53b535108d
lazarus-1.2-0.tar.gz: 4f02fc29f3773073198f620014d51e0598f67849

33
Makefile_patch.diff Normal file
View file

@ -0,0 +1,33 @@
Index: lazarus/Makefile.fpc
===================================================================
--- lazarus/Makefile.fpc (version 0.9.26)
+++ lazarus/Makefile.fpc (working copy)
@@ -21,7 +21,7 @@
[install]
fpcpackage=n
-basedir=share/lazarus
+basedir=lib/lazarus
[dist]
destdir=$(BASEDIR)/dist
@@ -29,7 +29,7 @@
[prerules]
RCPP?=$(strip $(firstword cpp$(SRCEXEEXT)))
#
-LAZARUS_INSTALL_DIR=$(INSTALL_PREFIX)/share/lazarus
+LAZARUS_INSTALL_DIR=$(INSTALL_PREFIX)/$(_LIB)/lazarus
INSTALL_MAN_DIR=$(INSTALL_PREFIX)/share/man
ifneq ($(findstring $(OS_TARGET),win32 win64),)
LAZARUS_INSTALL_DIR=C:\lazarus
@@ -115,8 +115,8 @@
ifneq ($(findstring $(OS_TARGET),win32 win64),)
else
- $(MKDIR) $(INSTALL_PREFIX)/share
- $(MKDIR) $(INSTALL_PREFIX)/share/lazarus
+ $(MKDIR) $(INSTALL_PREFIX)/$(_LIB)
+ $(MKDIR) $(INSTALL_PREFIX)/$(_LIB)/lazarus
$(MKDIR) $(INSTALL_BINDIR)
$(MKDIR) $(INSTALL_MAN_DIR)
$(MKDIR) $(INSTALL_MAN_DIR)/man1

View file

@ -1,6 +1,6 @@
Summary: Lazarus Component Library and IDE for Freepascal
Name: lazarus
Version: 1.0.14
Version: 1.2
Release: 1
# GNU Classpath style exception, see COPYING.modifiedLGPL
License: GPLv2+ and MPLv1.1 and LGPLv2+ with exceptions
@ -9,9 +9,8 @@ Url: http://www.lazarus.freepascal.org/
Source0: http://sourceforge.net/projects/%{name}/files/Lazarus%20Zip%20_%20GZip/Lazarus%20%{version}/%{name}-%{version}-0.tar.gz
Source1: lazarus-miscellaneousoptions
Source10: lazarus.rpmlintrc
Patch0: Makefile_patch.diff
Patch1: Desktop_patch.diff
# Patch2 is not needed for lazarus 1.1
Patch2: lazbuild_1_1.patch
Patch3: add_gdb_settings.patch
BuildRequires: desktop-file-utils
BuildRequires: fpc >= 2.6.0
@ -35,27 +34,17 @@ component library - LCL, which is also included in this package.
%prep
%setup -q -c
%patch0 -p0
%patch1 -p0
%patch2 -p0
%patch3 -p0
%build
cd lazarus
# Remove the files for building debian-repositories
rm -rf debian
rm -rf tools/install/cross_unix/debian_crosswin32
rm tools/install/cross_unix/create_linux_cross_win32_deb.sh
rm tools/install/cross_unix/HowToCreate_fpc_crosswin32_deb.txt
# Remove scripts vulnerable to symlink-attacks (bug 460642)
#rm tools/convert_po_file_to_utf-8.sh
rm tools/install/build_fpc_snaphot_rpm.sh
rm tools/install/check_fpc_dependencies.sh
rm tools/install/create_fpc_deb.sh
rm tools/install/create_fpc_export_tgz.sh
rm tools/install/create_fpc_rpm.sh
rm tools/install/create_fpc-src_rpm.sh
rm tools/install/create_fpc_tgz_from_local_dir.sh
rm tools/install/create_lazarus_export_tgz.sh
pushd tools
find install -depth -type d ! \( -path "install/linux/*" -o -path "install/linux" -o -path "install" \) -exec rm -rf '{}' \;
popd
export FPCDIR=%{_datadir}/fpcsrc/
fpcmake -Tall
@ -68,7 +57,7 @@ make lazbuild OPT="$MAKEOPTS"
# Add the ability to create gtk2-applications
export LCL_PLATFORM=gtk2
make packager/registration lazutils lcl ideintf codetools bigidecomponents OPT='-gl -gw'
make packager/registration lazutils lcl codetools bigidecomponents OPT='-gl -gw'
export LCL_PLATFORM=
strip lazarus
strip startlazarus
@ -114,9 +103,6 @@ popd
install -m 755 %{SOURCE1} %{buildroot}%{_bindir}/
%post
%{_libdir}/%{name}/tools/install/rpm/create_gtk1_links.sh
%postun
if [ $1 = 0 ]
then

View file

@ -1,413 +0,0 @@
--- lazarus/ide/lazbuild.lpr.orig 2012-07-26 21:45:14.000000000 +0000
+++ lazarus/ide/lazbuild.lpr 2012-10-03 21:51:51.000000000 +0000
@@ -28,13 +28,10 @@
{$IFDEF unix}
cthreads,
{$ENDIF}
- {$IFDEF darwin}
- cwstring,
- {$ENDIF}
Classes, SysUtils, CustApp, LCLProc, Dialogs, Forms, Controls, FileUtil,
Interfaces, InterfaceBase, UTF8Process, LConvEncoding,
// codetools
- CodeCache, CodeToolManager, DefineTemplates, Laz2_XMLCfg,
+ CodeCache, CodeToolManager, DefineTemplates, Laz2_XMLCfg, LazUTF8,
// IDEIntf
MacroIntf, PackageIntf, IDEDialogs, ProjectIntf, IDEExternToolIntf,
CompOptsIntf, LazIDEIntf,
@@ -51,6 +48,7 @@
TLazBuildApplication = class(TCustomApplication)
private
+ FAddPackage: boolean;
FBuildAll: boolean;
FBuildIDE: boolean;
FBuildIDEOptions: string;
@@ -84,9 +82,9 @@
out Description: string);
procedure GetDependencyOwnerDirectory(Dependency: TPkgDependency;
out Directory: string);
- // package graph
+ // Event procedure that adds every package added to the package graph to the (user) package links
procedure PackageGraphAddPackage(Pkg: TLazPackage);
-
+
// project
procedure OnProjectChangeInfoFile(TheProject: TProject);
procedure OnProjectGetTestDirectory({%H-}TheProject: TProject; out
@@ -100,10 +98,14 @@
{%H-}DlgType: TMsgDlgType; {%H-}Buttons: array of const;
const {%H-}HelpKeyword: string): Integer;
protected
+ // Builds project or package, depending on extension.
+ // Packages can also be specified by package name if they are known to the IDE.
function BuildFile(Filename: string): boolean;
// packages
+ // Build a package identified by filename and return build result
function BuildPackage(const AFilename: string): boolean;
+ // Load package file into loaded packages (package graph), overwriting any package with the same name
function LoadPackage(const AFilename: string): TLazPackage;
procedure CompilePackage(APackage: TLazPackage; Flags: TPkgCompileFlags);
procedure DoCreateMakefile(APackage: TLazPackage);
@@ -115,6 +117,10 @@
function LoadProject(const AFilename: string): TProject;
procedure CloseProject(var AProject: TProject);
+ // Adding packages to list of to-be-installed packages in the IDE.
+ // The packages can then be installed by recompiling the IDE (because we're using static packages)
+ function AddPackagesToInstallList(const PackageNamesOrFiles: TStringList): boolean;
+
// IDE
function BuildLazarusIDE: boolean;
function CompileAutoInstallPackages(Clean: boolean): boolean;
@@ -131,6 +137,7 @@
function RepairedCheckOptions(Const ShortOptions : String;
Const Longopts : TStrings; Opts,NonOpts : TStrings) : String;
public
+ // Files (or package names) passed by the user to Lazbuild:
Files: TStringList;
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
@@ -141,12 +148,13 @@
procedure Error(ErrorCode: Byte; const ErrorMsg: string);
function OnRunExternalTool(Tool: TIDEExternalToolOptions): TModalResult;
+ property AddPackage: boolean read FAddPackage write FAddPackage; // add package to installed pacakge in IDE (UserIDE)
property BuildAll: boolean read FBuildAll write FBuildAll;// build all files of project/package
property BuildRecursive: boolean read FBuildRecursive // apply BuildAll flag to dependencies
write FBuildRecursive;
property SkipDependencies: boolean read FSkipDependencies
write FSkipDependencies;
- property BuildIDE: boolean read FBuildIDE write FBuildIDE;
+ property BuildIDE: boolean read FBuildIDE write FBuildIDE; // build IDE (as opposed to a project/package etc)
property BuildIDEOptions: string read FBuildIDEOptions write FBuildIDEOptions;
property CreateMakefile: boolean read FCreateMakefile write FCreateMakefile;
property WidgetSetOverride: String read fWidgetsetOverride
@@ -307,26 +315,62 @@
end;
function TLazBuildApplication.BuildFile(Filename: string): boolean;
+var
+ OriginalFilename: string;
+ Package: TPackageLink;
begin
Result:=false;
+ OriginalFilename:=FileName;
Filename:=CleanAndExpandFilename(Filename);
- if not FileExists(Filename) then begin
- Error(ErrorFileNotFound, 'File not found: '+Filename);
- Exit;
+ if not FileExistsUTF8(Filename) then
+ begin
+ // Check for packages if the specified name is a valid identifier
+ if IsValidIdent(OriginalFileName) then begin
+ // Initialize package graph with base packages etc:
+ if not Init then exit;
+ // Apparently not found, could be a known but not installed package
+ // so try and get package filename from all other known packages
+ Package:=PkgLinks.FindLinkWithPkgName(OriginalFileName);
+ if Package=nil then begin
+ // Not found after everything we tried
+ Error(ErrorFileNotFound,'package not found: '+OriginalFilename);
+ end
+ else begin
+ // We found a package link
+ if AddPackage then begin
+ // this is handled in AddPackagesToInstallList
+ Result:=true;
+ end
+ else
+ Result:=BuildPackage(Package.Filename)
+ end;
+ end
+ else begin
+ // File is not an identifier and doesn't exist.
+ Error(ErrorFileNotFound, 'package not found: '+OriginalFilename);
+ Exit;
+ end;
+ end
+ else begin
+ // File exists:
+ if CompareFileExt(Filename,'.lpk')=0 then
+ if AddPackage then begin
+ // this is handled in AddPackagesToInstallList
+ Result:=true;
+ end
+ else
+ Result:=BuildPackage(Filename)
+ else if CompareFileExt(Filename,'.lpi')=0 then
+ Result:=BuildProject(Filename)
+ else if CompareFileExt(Filename,'.lpr')=0 then begin
+ Filename:=ChangeFileExt(Filename,'.lpi');
+ if FileExists(Filename) then
+ Result:=BuildProject(Filename)
+ else
+ Error(ErrorFileNotFound,'file not found: '+Filename);
+ end else
+ Error(ErrorBuildFailed,'don''t know how to build: '+Filename);
end;
-
- if CompareFileExt(Filename,'.lpk')=0 then
- Result:=BuildPackage(Filename)
- else if CompareFileExt(Filename,'.lpi')=0 then
- Result:=BuildProject(Filename)
- else if CompareFileExt(Filename,'.lpr')=0 then begin
- Filename:=ChangeFileExt(Filename,'.lpi');
- if FileExists(Filename) then
- Result:=BuildProject(Filename)
- else
- Error(ErrorFileNotFound,'file not found: '+Filename);
- end else
- Error(ErrorBuildFailed,'don''t know how to build: '+Filename);
end;
function TLazBuildApplication.BuildPackage(const AFilename: string): boolean;
@@ -373,6 +417,9 @@
// check if package is already loaded
Result:=PackageGraph.FindPackageWithFilename(AFilename);
if (Result<>nil) then exit;
+ if not FileExistsUTF8(AFilename) then
+ Error(ErrorLoadPackageFailed,'Package file not found "'+AFilename+'"');
+
Result:=TLazPackage.Create;
// load the package file
XMLConfig:=TXMLConfig.Create(AFilename);
@@ -853,6 +900,72 @@
FreeThenNil(AProject);
end;
+function TLazBuildApplication.AddPackagesToInstallList(
+ const PackageNamesOrFiles: TStringList): boolean;
+var
+ i: integer;
+ Package: TLazPackage;
+ PackageLink: TPackageLink;
+ PackageName:string;
+ PkgFilename: String;
+ ErrorMsg: String;
+ ErrCode: Byte;
+begin
+ Result:=false;
+ if not Init then exit;
+
+ LoadMiscellaneousOptions;
+
+ ErrorMsg:='';
+ ErrCode:=ErrorPackageNameInvalid;
+ for i:=0 to PackageNamesOrFiles.Count -1 do
+ begin
+ // Look for package name in all known packages
+ PackageName:='';
+ PkgFilename:='';
+ if CompareFileExt(PackageNamesOrFiles[i],'.lpk')=0 then
+ PkgFilename:=PackageNamesOrFiles[i]
+ else if IsValidIdent(PackageNamesOrFiles[i]) then begin
+ PackageLink:=PkgLinks.FindLinkWithPkgName(PackageNamesOrFiles[i]);
+ if PackageLink=nil then
+ begin
+ ErrorMsg+='Can not find package '+PackageNamesOrFiles[i]+', so it is not marked for installation.'+LineEnding;
+ continue;
+ end;
+ PkgFilename:=PackageLink.Filename;
+ end else begin
+ ErrorMsg+=PackageNamesOrFiles[i]+' is not a package, so it is not marked for installation.'+LineEnding;
+ continue;
+ end;
+ Package:=LoadPackage(PkgFilename);
+ if Package=nil then
+ begin
+ ErrorMsg+='Could not load '+PackageNamesOrFiles[i]+', so it is not marked for installation.'+LineEnding;
+ ErrCode:=ErrorLoadPackageFailed;
+ continue;
+ end;
+ if Package.PackageType in [lptRunTime,lptRunTimeOnly] then
+ begin
+ ErrorMsg+='Package '+PackageNamesOrFiles[i]+' is only for runtime.'+LineEnding;
+ continue;
+ end;
+ PackageName:=Package.Name;
+ // set it as (static) autoinstall: select for installation
+ debugln(['adding package "'+PkgFilename+'" to install list of IDE']);
+ if MiscellaneousOptions.BuildLazProfiles.StaticAutoInstallPackages.IndexOf(PackageName)<0 then
+ MiscellaneousOptions.BuildLazProfiles.StaticAutoInstallPackages.Add(PackageName);
+ end;
+ if ErrorMsg<>'' then begin
+ ErrorMsg:=UTF8Trim(ErrorMsg);
+ Error(ErrCode,ErrorMsg);
+ exit;
+ end;
+ // save list
+ MiscellaneousOptions.Save;
+
+ Result:=true;
+end;
+
function TLazBuildApplication.Init: boolean;
begin
if fInitialized then exit(fInitResult);
@@ -1108,7 +1221,7 @@
begin
// Required argument
NeedArg:=true;
- Writeln('P ',P,' J ',J,' ',O[J],' ',l,' Havearg ',HaveArg);
+ debugln(['P ',P,' J ',J,' ',O[J],' ',l,' Havearg ',HaveArg]);
If ((P+1)=Length(ShortOptions)) or (Shortoptions[P+2]<>':') Then
If (J<L) or not haveArg then // Must be last in multi-opt !!
Result:=Format(lisErrOptionNeeded,[I,O[J]]);
@@ -1171,17 +1284,28 @@
begin
if not ParseParameters then exit;
+ // Build all projects/packages specified by the user...
+ // except packages to be added the IDE install list.
for i:=0 to Files.Count-1 do begin
if not BuildFile(Files[i]) then begin
- writeln('Failed building ',Files[i]);
+ debugln('Failed building ',Files[i]);
ExitCode := ErrorBuildFailed;
exit;
end;
end;
-
+
+ // Add user-requested packages to IDE install list:
+ if AddPackage then begin
+ if not AddPackagesToInstallList(Files) then begin
+ debugln('Failed adding package(s) ',Files.Text);
+ ExitCode := ErrorBuildFailed;
+ exit;
+ end;
+ end;
+
if BuildIDE then begin
if not BuildLazarusIDE then begin
- writeln('Failed building Lazarus IDE');
+ debugln('Failed building Lazarus IDE');
ExitCode := ErrorBuildFailed;
exit;
end;
@@ -1222,6 +1346,7 @@
LongOptions.Add('secondary-config-path:');
LongOptions.Add('scp:');
LongOptions.Add('language:');
+ LongOptions.Add('add-package');
LongOptions.Add('build-all');
LongOptions.Add('build-ide:');
LongOptions.Add('recursive');
@@ -1249,6 +1374,9 @@
BuildIDEOptions:=GetOptionValue('build-ide');
end;
+ // Add package to list of to be installed packages)
+ AddPackage:=HasOption('add-package');
+
// files
Files.Assign(NonOptions);
if (Files.Count=0) and (not BuildIDE) then begin
@@ -1308,7 +1436,11 @@
LazarusDirOverride := GetOptionValue('lazarusdir');
if HasOption('create-makefile') then
+ begin
CreateMakefile := true;
+ if AddPackage then
+ Error(ErrorPackageNameInvalid,'Can you combine --create-makefile and --add-package');
+ end;
finally
Options.Free;
NonOptions.Free;
@@ -1320,10 +1452,15 @@
procedure TLazBuildApplication.WriteUsage;
const
space = ' ';
+
+ function LongToConsole(s: string): string;
+ begin
+ Result:=UTF8ToConsole(BreakString(s,75, length(space)))
+ end;
begin
TranslateResourceStrings(ProgramDirectory(true),'');
writeln('');
- writeln('lazbuild [options] <project or package-filename>');
+ writeln('lazbuild [options] <project/package filename or package name>');
writeln('');
writeln(UTF8ToConsole(lisEdtExtToolParameters));
writeln('');
@@ -1335,56 +1472,52 @@
writeln('--build-ide=<options> ', UTF8ToConsole(lisBuildIDEWithPackages));
writeln('-v or --version ', UTF8ToConsole(lisShowVersionAndExit));
writeln('');
+
+ writeln('--add-package');
+ writeln(LongToConsole(space+'add package(s) to list of installed packages (combine with --build-ide to rebuild IDE).'));
+ writeln('--create-makefile');
+ writeln(LongToConsole(space+lisInsteadOfCompilePackageCreateASimpleMakefile));
+ writeln('');
+
writeln(PrimaryConfPathOptLong,'<path>');
writeln('or ',PrimaryConfPathOptShort,'<path>');
- writeln(UTF8ToConsole(BreakString(space+lisprimaryConfigDirectoryWhereLazarusStoresItsConfig,
- 75, 22)), LazConf.GetPrimaryConfigPath);
+ writeln(LongToConsole(space+lisprimaryConfigDirectoryWhereLazarusStoresItsConfig+LazConf.GetPrimaryConfigPath));
writeln('');
writeln(SecondaryConfPathOptLong,'<path>');
writeln('or ',SecondaryConfPathOptShort,'<path>');
- writeln(UTF8ToConsole(BreakString(space+lissecondaryConfigDirectoryWhereLazarusSearchesFor,
- 75, 22)), LazConf.GetSecondaryConfigPath);
+ writeln(LongToConsole(space+lissecondaryConfigDirectoryWhereLazarusSearchesFor+LazConf.GetSecondaryConfigPath));
writeln('');
writeln('--operating-system=<operating-system>');
writeln('or --os=<operating-system>');
- writeln(UTF8ToConsole(BreakString(Format(
+ writeln(LongToConsole(Format(
lisOverrideTheProjectOperatingSystemEGWin32LinuxDefau, [space,
- LazConf.GetDefaultTargetOS]),
- 75, 22)));
+ LazConf.GetDefaultTargetOS])));
writeln('');
writeln('--widgetset=<widgetset>');
writeln('or --ws=<widgetset>');
- writeln(UTF8ToConsole(BreakString(Format(
+ writeln(LongToConsole(Format(
lisOverrideTheProjectWidgetsetEGGtkGtk2QtWin32CarbonD, [space,
- LCLPlatformDirNames[LazConf.GetDefaultLCLWidgetType]]) ,
- 75, 22)));
+ LCLPlatformDirNames[LazConf.GetDefaultLCLWidgetType]])));
writeln('');
writeln('--cpu=<cpu>');
- writeln(UTF8ToConsole(BreakString(Format(
+ writeln(LongToConsole(Format(
lisOverrideTheProjectCpuEGI386X86_64PowerpcPowerpc_64, [space,
- LazConf.GetDefaultTargetCPU]),
- 75, 22)));
+ LazConf.GetDefaultTargetCPU])));
writeln('');
writeln('--build-mode=<project/ide build mode>');
writeln('or --bm=<project/ide build mode>');
- writeln(UTF8ToConsole(BreakString(Format(lisOverrideTheProjectBuildMode,
- [space]), 75, 22)));
+ writeln(LongToConsole(Format(lisOverrideTheProjectBuildMode,[space])));
writeln('');
writeln('--compiler=<ppcXXX>');
- writeln(UTF8ToConsole(BreakString(Format(
- lisOverrideTheDefaultCompilerEGPpc386Ppcx64PpcppcEtcD, [space]),
- 75, 22)));
+ writeln(LongToConsole(Format(
+ lisOverrideTheDefaultCompilerEGPpc386Ppcx64PpcppcEtcD, [space])));
writeln('');
writeln(LanguageOpt);
- writeln(UTF8ToConsole(BreakString(space+lisOverrideLanguage,75, 22)));
+ writeln(LongToConsole(space+lisOverrideLanguage));
writeln('');
writeln('--lazarusdir=<Lazarus directory>');
- writeln(UTF8ToConsole(BreakString(space+lisLazarusDirOverride, 75, 22)));
-
+ writeln(LongToConsole(space+lisLazarusDirOverride));
writeln('');
- writeln('--create-makefile');
- writeln(UTF8ToConsole(BreakString(space+
- lisInsteadOfCompilePackageCreateASimpleMakefile, 75, 22)));
end;
procedure TLazBuildApplication.Error(ErrorCode: Byte; const ErrorMsg: string);