LOG New version 1.0.14, sync spec and patches with Russain Mageia Community

This commit is contained in:
Andrey Bondrov 2014-02-03 16:03:34 +11:00
parent 5000654feb
commit 75858f18f4
6 changed files with 587 additions and 116 deletions

View file

@ -1,2 +1,2 @@
sources:
lazarus-1.0.12-0.tar.gz: bea67fc0c8a6ba5636a016418a72aa07eba34b03
lazarus-1.0.14-0.tar.gz: 2a0f9fa4daac6c304684a28d76a42c53b535108d

18
add_gdb_settings.patch Normal file
View file

@ -0,0 +1,18 @@
--- ./lazarus/tools/install/linux/environmentoptions.xml.orig 2012-08-28 17:38:35.000000000 +0000
+++ ./lazarus/tools/install/linux/environmentoptions.xml 2012-10-12 12:33:19.000000000 +0000
@@ -31,5 +31,15 @@
<Item2 Value="/var/tmp/"/>
</History>
</TestBuildDirectory>
+ <DebuggerFilename Value="/usr/bin/gdb">
+ <History Count="3">
+ <Item1 Value="/usr/bin/gdb"/>
+ <Item2 Value="/usr/local/bin/gdb"/>
+ <Item3 Value="/opt/fpc/gdb"/>
+ </History>
+ </DebuggerFilename>
+ <Debugger Class="TGDBMIDebugger" EventLogLineLimit="100">
+ <WatchesDlg ColumnNameWidth="-1" ColumnValueWidth="-1"/>
+ </Debugger>
</EnvironmentOptions>
</CONFIG>

View file

@ -0,0 +1,109 @@
#!/bin/bash
#
# This script is distributed under terms of GPLv3 or later
# Copyright (C) AlexL <loginov.alex.valer@gmail.com>, 2013
#
# This is a simple script, which creates /etc/lazarus/miscellaneousoptions.xml
# Config /etc/lazarus/miscellaneousoptions.xml is neaded for rebuild lazarus under root/user
# and after rebuild to save all additional components, which were installed before.
if [ ! -f "/usr/bin/lazarus-ide" ]
then
echo "You have no /usr/bin/lazarus-ide, please install lazarus"
exit 0
fi
if [ -d "/usr/lib64/lazarus" ]
then
ARCH=lib64
else
ARCH=lib
fi
# determine type for compiled IDE
#IDETYPE=`strings $LazarusDir/lazarus|grep qtwidgets`
IDETYPE=`ldd /usr/bin/lazarus-ide|grep libQt4Pas`
if [ "$IDETYPE" = "" ]
then
IDETYPE=gtk2
echo IDETYPE: $IDETYPE
else
IDETYPE=qt4
echo IDETYPE: $IDETYPE
fi
if [ ! -f "/etc/lazarus/extra_lpk_$IDETYPE.conf" ]
then
echo "There is no /etc/lazarus/extra_lpk_$IDETYPE.conf, you don't need to run script lazarus-miscellaneousoptions"
exit 0
fi
if [ ! "$USER" = "root" ]
then
echo "You must be root for lazarus-miscellaneousoptions"
exit 0
fi
echo "Starting script lazarus-miscellaneousoptions"
if [ -f "/etc/lazarus/miscellaneousoptions.xml" ]
then
echo "Current file /etc/lazarus/miscellaneousoptions.xml:"
cat /etc/lazarus/miscellaneousoptions.xml
else
echo "There is no /etc/lazarus/miscellaneousoptions.xml, will be created."
fi
echo '<?xml version="1.0"?>' > /etc/lazarus/miscellaneousoptions.xml
echo '<CONFIG>' >> /etc/lazarus/miscellaneousoptions.xml
echo ' <MiscellaneousOptions>' >> /etc/lazarus/miscellaneousoptions.xml
echo ' <Version Value="2"/>' >> /etc/lazarus/miscellaneousoptions.xml
echo ' <BuildLazarusOptions>' >> /etc/lazarus/miscellaneousoptions.xml
echo ' <StaticAutoInstallPackages Count="ў">' >> /etc/lazarus/miscellaneousoptions.xml
i=0
if [ "$ARCH" = "lib" ]
then
for a in `cat /etc/lazarus/extra_lpk_$IDETYPE.conf|sed 's|$(LazarusDir)|/usr/lib/lazarus|g'`
do
echo "File: $a"
if [ -f "$a" ]
then
b=`cat $a |grep "<Name Value"|cut -d '"' --fields=2`
echo "Package name: $b"
i=$(($i+1))
echo " <Item$i Value=\"$b\"/>" >> /etc/lazarus/miscellaneousoptions.xml
else
echo "Error: there is no file $a"
fi
done
fi
if [ "$ARCH" = "lib64" ]
then
for a in `cat /etc/lazarus/extra_lpk_$IDETYPE.conf|sed 's|$(LazarusDir)|/usr/lib64/lazarus|g'`
do
echo "File: $a"
if [ -f "$a" ]
then
b=`cat $a |grep "<Name Value"|cut -d '"' --fields=2`
echo "Package name: $b"
i=$(($i+1))
echo " <Item$i Value=\"$b\"/>" >> /etc/lazarus/miscellaneousoptions.xml
else
echo "Error: there is no file $a"
fi
done
fi
echo ' </StaticAutoInstallPackages>' >> /etc/lazarus/miscellaneousoptions.xml
echo ' </BuildLazarusOptions>' >> /etc/lazarus/miscellaneousoptions.xml
echo ' </MiscellaneousOptions>' >> /etc/lazarus/miscellaneousoptions.xml
echo '</CONFIG>' >> /etc/lazarus/miscellaneousoptions.xml
sed -i -e "s|ў|$i|g" /etc/lazarus/miscellaneousoptions.xml
echo "File /etc/lazarus/miscellaneousoptions.xml was updated."
echo "Current file /etc/lazarus/miscellaneousoptions.xml:"
cat /etc/lazarus/miscellaneousoptions.xml
echo "Script lazarus-miscellaneousoptions was finished."

View file

@ -1,2 +1,4 @@
# We really don't need to strip some stuff
addFilter("E: unstripped-binary-or-object")
# Keep examples
addFilter("E: devel-file-in-non-devel-package")

View file

@ -1,50 +1,32 @@
%define ver 1.0.12
#%define snapshot 38517
#%define reldate 20120905
%define reldate 0
Name: lazarus
%if %{reldate}
Version: %{ver}.%{reldate}
%else
Version: %{ver}
%endif
Release: 1
Summary: Lazarus Component Library and IDE for Freepascal
Group: Development/Other
Name: lazarus
Version: 1.0.14
Release: 1
# GNU Classpath style exception, see COPYING.modifiedLGPL
License: GPLv2+ and MPLv1.1 and LGPLv2+ with exceptions
URL: http://www.lazarus.freepascal.org/
%if %{reldate}
Source0: http://www.hu.freepascal.org/%{name}/%{name}-%{ver}-%{snapshot}-%{reldate}-src.tar.bz2
%else
Source0: http://www.hu.freepascal.org/%{name}/%{name}-%{ver}-0.tar.gz
%endif
Source1: %{name}.rpmlintrc
Group: Development/Other
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
Patch1: Desktop_patch.diff
BuildRequires: fpc-src >= 2.6.0
BuildRequires: fpc >= 2.6.0
BuildRequires: gdk-pixbuf
BuildRequires: gtk+
BuildRequires: glibc
BuildRequires: gdb
BuildRequires: glib-devel
BuildRequires: gdk-pixbuf-devel
BuildRequires: gtk2-devel
# Patch2 is not needed for lazarus 1.1
Patch2: lazbuild_1_1.patch
Patch3: add_gdb_settings.patch
BuildRequires: desktop-file-utils
Requires: fpc-src >= 2.6.0
Requires: fpc >= 2.6.0
Requires: gdk-pixbuf
Requires: gtk+
Requires: glibc
Requires: gdb
Requires: glib-devel
Requires: gdk-pixbuf-devel
BuildRequires: fpc >= 2.6.0
BuildRequires: fpc-src >= 2.6.0
BuildRequires: gdb
BuildRequires: pkgconfig(gdk-pixbuf-2.0)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gtk+-2.0)
Requires: binutils
Requires: gtk2-devel
Requires: fpc >= 2.6.0
Requires: fpc-src >= 2.6.0
Requires: gdb
Requires: pkgconfig(gdk-pixbuf-2.0)
Requires: pkgconfig(glib-2.0)
Requires: pkgconfig(gtk+-2.0)
Requires: glibc-devel
Requires: jpeg-devel
%description
Lazarus is a free and opensource RAD tool for freepascal using the lazarus
@ -53,6 +35,8 @@ component library - LCL, which is also included in this package.
%prep
%setup -q -c
%patch1 -p0
%patch2 -p0
%patch3 -p0
%build
cd lazarus
@ -81,14 +65,6 @@ make bigide OPT="$MAKEOPTS"
make tools OPT="$MAKEOPTS"
make lazbuild OPT="$MAKEOPTS"
# build Qt4 interface
pushd lcl/interfaces/qt
%__make all \
LCL_PLATFORM=qt \
OPT="-dUSE_QT_45 \
-dQT_NATIVE_DIALOGS"
popd
# Add the ability to create gtk2-applications
export LCL_PLATFORM=gtk2
make packager/registration lazutils lcl ideintf codetools bigidecomponents OPT='-gl -gw'
@ -98,8 +74,8 @@ strip startlazarus
strip lazbuild
%install
rm -rf %{buildroot}
LAZARUSDIR=%{_libdir}/%{name}
FPCDIR=%{_datadir}/fpcsrc/
mkdir -p %{buildroot}$LAZARUSDIR
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/pixmaps
@ -108,46 +84,51 @@ mkdir -p %{buildroot}%{_datadir}/mime/packages
mkdir -p %{buildroot}%{_mandir}/man1
mkdir -p %{buildroot}%{_sysconfdir}/lazarus
cp -a lazarus/* %{buildroot}$LAZARUSDIR/
install -m 644 lazarus/images/ide_icon48x48.png %{buildroot}%{_datadir}/pixmaps/lazarus.png
install -m 644 lazarus/install/lazarus.desktop %{buildroot}%{_datadir}/applications/lazarus.desktop
install -m 644 lazarus/install/lazarus-mime.xml $LazBuildDir%{buildroot}%{_datadir}/mime/packages/lazarus.xml
install -m 0644 lazarus/images/ide_icon48x48.png %{buildroot}%{_datadir}/pixmaps/lazarus.png
install -m 0644 lazarus/install/lazarus.desktop %{buildroot}%{_datadir}/applications/lazarus.desktop
install -m 0644 lazarus/install/lazarus-mime.xml $LazBuildDir%{buildroot}%{_datadir}/mime/packages/lazarus.xml
ln -sf $LAZARUSDIR/lazarus %{buildroot}%{_bindir}/lazarus-ide
ln -sf $LAZARUSDIR/startlazarus %{buildroot}%{_bindir}/startlazarus
ln -sf $LAZARUSDIR/lazbuild %{buildroot}%{_bindir}/lazbuild
cat lazarus/install/man/man1/lazbuild.1 | gzip > %{buildroot}%{_mandir}/man1/lazbuild.1.gz
cat lazarus/install/man/man1/lazarus-ide.1 | gzip > %{buildroot}%{_mandir}/man1/lazarus-ide.1.gz
cat lazarus/install/man/man1/startlazarus.1 | gzip > %{buildroot}%{_mandir}/man1/startlazarus.1.gz
install lazarus/tools/install/linux/editoroptions.xml %{buildroot}%{_sysconfdir}/lazarus/editoroptions.xml
# fix fpc and lazarus path
install lazarus/tools/install/linux/editoroptions.xml %{buildroot}%{_sysconfdir}/lazarus/editoroptions.xml
# fix fpc and lazarus path
install lazarus/tools/install/linux/environmentoptions.xml %{buildroot}%{_sysconfdir}/lazarus/environmentoptions.xml
sed -i 's/\$(FPCVER)\///g' %{buildroot}%{_sysconfdir}/lazarus/environmentoptions.xml
sed -i 's/%LazarusVersion%//g' %{buildroot}%{_sysconfdir}/lazarus/environmentoptions.xml
#Fix config path (akdengi)
sed -i 's#__LAZARUSDIR__#'$LAZARUSDIR'#g' %{buildroot}%{_sysconfdir}/lazarus/environmentoptions.xml
sed -i 's#__LAZARUSDIR__#'$LAZARUSDIR/'#g' %{buildroot}%{_sysconfdir}/lazarus/environmentoptions.xml
sed -i 's#__FPCSRCDIR__#'$FPCDIR'#g' %{buildroot}%{_sysconfdir}/lazarus/environmentoptions.xml
chmod 755 %{buildroot}%{_libdir}/%{name}/components/lazreport/tools/localize.sh
# remove gzipped man pages (uncompressed version being also in the directory, it generates a conflict with the compress_files spec-helper)
#rm -f %{buildroot}%{_mandir}/man1/*.gz
pushd %{buildroot}%{_libdir}/%{name}
rm -f *.txt
rm -rf install
popd
# clean %{_libdir}/%{name}
#pushd %{buildroot}%{_libdir}/%{name}
#rm -f Makefile* *.txt
#rm -rf install
#popd
install -m 755 %{SOURCE1} %{buildroot}%{_bindir}/
%post
%{_libdir}/%{name}/tools/install/rpm/create_gtk1_links.sh
%postun
if [ $1 = 0 ]
then
rm -rf %{_libdir}/%{name}
fi
%files
%defattr(-,root,root,-)
%doc lazarus/COPYING* lazarus/README.txt
%{_libdir}/%{name}
%{_bindir}/%{name}-ide
%{_bindir}/startlazarus
%{_bindir}/lazbuild
%{_bindir}/%{name}-miscellaneousoptions
%{_datadir}/pixmaps/lazarus.png
%{_datadir}/applications/%{name}.desktop
%{_datadir}/mime/packages/lazarus.xml
@ -156,55 +137,3 @@ chmod 755 %{buildroot}%{_libdir}/%{name}/components/lazreport/tools/localize.sh
%config(noreplace) %{_sysconfdir}/lazarus/environmentoptions.xml
%{_mandir}/*/*
%changelog
* Sun Aug 28 2011 Александр Казанцев <kazancas@mandriva.org> 0.9.30.1.32070-1mdv2011.0
+ Revision: 697267
- fix bug from non-correct path to fpcsrc and update to new bugfix snapshot
* Tue May 24 2011 Александр Казанцев <kazancas@mandriva.org> 0.9.30.1.30881-1
+ Revision: 678181
- svn fix version for new fpc 2.4.4
* Mon Mar 28 2011 Александр Казанцев <kazancas@mandriva.org> 0.9.30.1.30041-1
+ Revision: 648700
- new release 0.9.30 (fix snapshot)
* Wed Jan 26 2011 Александр Казанцев <kazancas@mandriva.org> 0.9.29.29190-1
+ Revision: 633048
-update to 0.9.29-29190 fix snapshot
* Mon Dec 27 2010 Александр Казанцев <kazancas@mandriva.org> 0.9.29.27705-1mdv2011.0
+ Revision: 625490
+ rebuild (emptylog)
* Mon Dec 06 2010 Oden Eriksson <oeriksson@mandriva.com> 0.9.28.2-5mdv2011.0
+ Revision: 612703
- the mass rebuild of 2010.1 packages
* Fri Jan 29 2010 Jérôme Brenier <incubusss@mandriva.org> 0.9.28.2-4mdv2010.1
+ Revision: 497877
- Requires: make
* Thu Dec 03 2009 Jérôme Brenier <incubusss@mandriva.org> 0.9.28.2-3mdv2010.1
+ Revision: 472753
- bump release
- fix both environmentoptions.xml files
* Wed Dec 02 2009 Jérôme Brenier <incubusss@mandriva.org> 0.9.28.2-2mdv2010.1
+ Revision: 472717
- fix environmentoptions.xml
* Wed Dec 02 2009 Jérôme Brenier <incubusss@mandriva.org> 0.9.28.2-1mdv2010.1
+ Revision: 472695
- version 0.9.8.2
- fix BuildRequires / Requires
- fix desktop file
- remove some duplicates and useless files
- fix %%files section
+ Funda Wang <fwang@mandriva.org>
- sync with fedora's patckage
- import lazarus

413
lazbuild_1_1.patch Normal file
View file

@ -0,0 +1,413 @@
--- 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);