create_lazarus_rpm.sh can now build the rpm without being root

git-svn-id: trunk@7724 -
This commit is contained in:
mattias 2005-09-17 11:58:38 +00:00
parent 62c2006012
commit b9f7eda6de
10 changed files with 88 additions and 136 deletions

View File

@ -47,48 +47,49 @@ Creating the lazarus tgz:
RPM:
How to create RPM packages as normal user / non root:
You don't need to be root to built rpm packages.
You only need a ~/.rpmacros file overriding some values. The script
<lazarusdir>/tools/install/rpm/create_nonroot_macros.sh will setup one. Do:
[]$ cd <lazarusdir>/tools/install/rpm
[]$ ./create_nonroot_macros.sh
From now all new rpms will be built in ~/rpm/.
Creating the fpc and the fpcsrc rpm:
There are two versions of the compiler: the old 2..0.x and the new (but not
There are two versions of the compiler: the old 2.0.x and the new (but not
yet released) developer version 2.1.x. To build them, you must install fpc
first. Install the stable fpc release (2.0.x). Note: The 2.0.x can not be
built with a 2.1.x compiler and the recommended startup compiler for the 2.1.x
is the released fpc 2.0.x.
first. Install the stable fpc release (2.0.x).
Note: The 2.0.x can not be built with a 2.1.x compiler and the recommended
startup compiler for the 2.1.x is the released fpc 2.0.x.
If you have your own fpc sources you can build the fpc rpm with:
Become root and do:
cd <lazarus_directory>/tools/install
./build_fpc_rpm.sh nodocs /path/to/your/fpc/sources/fpc 050601
[]$ cd <lazarus_directory>/tools/install
[]$ ./build_fpc_rpm.sh nodocs /path/to/your/fpc/sources/fpc
The 050601 stands for: 2005 june 1st
Then build the fpcsrc rpm. Become root and do:
Then build the fpcsrc rpm:
cd <lazarus_directory>/tools/install
./build_fpcsrc_rpm.sh /path/to/your/fpc/sources/fpc 050601
[]$ ./build_fpcsrc_rpm.sh /path/to/your/fpc/sources/fpc
The create_fpc_rpm.sh works nearly automatically. Become root and execute it.
For 2.0.x: ./create_fpc_rpm.sh stable
For 2.1.x: ./create_fpc_rpm.sh devel
What it does: First it checks if the fpc source tgz is already created and
if not, it automatically downloads it. The script does not use the current
version, but the latest known to work with lazarus. Then it unpacks the
source, compiles it and builds the rpm. Normally you can find the rpms under
/usr/src/redhat/RPMS/i386/ and /usr/src/redhat/SRPMS/.
Normally you can find the rpms under /usr/src/redhat/RPMS/i386/
and /usr/src/redhat/SRPMS/.
Or if you have a ~/.rpmmacros file the new rpm will be in ~/rpm/RPMS/i386/
and ~/rpm/SRPMS/.
Creating the lazarus rpm:
Important:
If you have created a new fpc RPM, then you should install it, *before* you
If you have created a new fpc RPM, then you should install it *before* you
build the lazarus RPM. Otherwise the compiled lazarus RPM is not compatible
to the fpc RPM.
As root:
Execute create_lazarus_rpm.sh.
[]$ ./create_lazarus_rpm.sh.
Creating other system specific rpms:

View File

@ -6,7 +6,7 @@ set -e
#------------------------------------------------------------------------------
# parse parameters
#------------------------------------------------------------------------------
Usage="Usage: $0 [nodocs] [notemp] [deb] <FPCSrcDir> <release>"
Usage="Usage: $0 [nodocs] [notemp] [deb] <FPCSrcDir> [release]"
WithDOCS=yes
if [ "x$1" = "xnodocs" ]; then
@ -27,17 +27,17 @@ if [ "x$1" = "xdeb" ]; then
fi
FPCSrcDir=$1
shift
if [ "x$FPCSrcDir" = "x" ]; then
echo $Usage
exit -1
fi
shift
LazRelease=$1
shift
if [ "x$LazRelease" = "x" ]; then
echo $Usage
exit -1
LazRelease=$(date +%y%m%d)
else
shift
fi
if [ ! -d $FPCSrcDir/compiler ]; then
@ -52,7 +52,10 @@ fi
# create a temporary copy of the fpc sources to patch it
TmpDir=/tmp/fpc_patchdir
if [ "$WithTempDir" = "yes" ]; then
rm -rf $TmpDir
if [ -d $TmpDir ]; then
rm -rf $TmpDir/*
rm -r $TmpDir
fi
mkdir -p $TmpDir
#ppc386 -Fu../../lcl/units/i386/linux cvsexportlocal.pas
@ -65,6 +68,7 @@ else
fi
# retrieve the version information
echo -n "getting FPC version from local svn ..."
VersionFile="$TmpDir/fpc/compiler/version.pas"
CompilerVersion=`cat $VersionFile | grep ' *version_nr *=.*;' | sed -e 's/[^0-9]//g'`
CompilerRelease=`cat $VersionFile | grep ' *release_nr *=.*;' | sed -e 's/[^0-9]//g'`
@ -74,6 +78,7 @@ LazVersion="$CompilerVersion.$CompilerRelease"
if [ "$CompilerPatch" != "0" ]; then
LazVersion="$LazVersion.$CompilerPatch"
fi
echo " $CompilerVersionStr-$LazRelease"
@ -85,6 +90,7 @@ ReplaceScript=replace_in_files.pl
# set version numbers in all Makefiles
echo "set version numbers in all Makefiles ..."
perl replace_in_files.pl -sR -f '=\d.\d.\d' -r =$CompilerVersionStr -m 'Makefile(.fpc)?' $TmpDir/fpc/*
# update smart_strip.sh
@ -135,9 +141,9 @@ if [ "$PkgType" = "deb" ]; then
else
# build fpc rpm
echo "creating spec file ..."
SpecFileTemplate=rpm/fpc.spec.template
SpecFile=rpm/fpc.spec
SrcPatch=fpcsrc-patch
# change spec file
cat $SpecFileTemplate | \
@ -148,6 +154,7 @@ else
# -e 's/^\%{fpcdir}\/samplecfg .*/%{fpcdir}\/samplecfg %{_libdir}\/fpc\/\\\$version/' \
SrcTGZ=$(rpm/get_rpm_source_dir.sh)/SOURCES/fpc-$CompilerVersionStr-$LazRelease.source.tar.gz
echo "creating $SrcTGZ ..."
tar czf $SrcTGZ -C $TmpDir fpc
#----------------------------------------------------------------------------
@ -156,11 +163,9 @@ else
if [ "$WithDOCS" = "no" ]; then
export NODOCS=1
fi
cd $TmpDir
cd -
rpmbuild --nodeps -ba $SpecFile
echo "The new rpm can be found in $(../rpm/get_rpm_source_dir.sh)/RPMS/i386/fpc-$LazVersion-$LazRelease.i386.rpm"
echo "The new rpm can be found in $(./rpm/get_rpm_source_dir.sh)/RPMS/i386/fpc-$LazVersion-$LazRelease.i386.rpm"
fi
# end.

View File

@ -1,13 +1,13 @@
#!/bin/bash
set -x
#set -x
set -e
#------------------------------------------------------------------------------
# parse parameters
#------------------------------------------------------------------------------
Usage="Usage: $0 [deb] <FPCSrcDir> <release>"
Usage="Usage: $0 [deb] <FPCSrcDir> [release]"
PkgType=rpm
if [ "x$1" = "xdeb" ]; then
@ -16,17 +16,17 @@ if [ "x$1" = "xdeb" ]; then
fi
FPCSourceDir=$1
shift
if [ "x$FPCSourceDir" = "x" ]; then
echo $Usage
exit -1
fi
shift
LazRelease=$1
shift
if [ "x$LazRelease" = "x" ]; then
echo $Usage
exit -1
LazRelease=$(date +%y%m%d)
else
shift
fi
#------------------------------------------------------------------------------
@ -34,14 +34,16 @@ fi
#------------------------------------------------------------------------------
# retrieve the version information
echo -n "getting FPC version from local svn ..."
VersionFile="$FPCSourceDir/compiler/version.pas"
CompilerVersion=`cat $VersionFile | grep ' *version_nr *=.*;' | sed -e 's/[^0-9]//g'`
CompilerRelease=`cat $VersionFile | grep ' *release_nr *=.*;' | sed -e 's/[^0-9]//g'`
CompilerPatch=`cat $VersionFile | grep ' *patch_nr *=.*;' | sed -e 's/[^0-9]//g'`
LazVersion="$CompilerVersion.$CompilerRelease"
LazVersion="$LazVersion.$CompilerPatch"
CompilerVersionStr="$CompilerVersion.$CompilerRelease.$CompilerPatch"
LazVersion=$CompilerVersionStr
echo " $CompilerVersionStr-$LazRelease"
FPCTGZ=fpcsrc-$LazVersion-$LazRelease.tgz
FPCTGZ=$(rpm/get_rpm_source_dir.sh)/SOURCES/fpcsrc-$CompilerVersionStr-$LazRelease.source.tar.gz
CurDir=`pwd`
# pack the directory
@ -104,13 +106,10 @@ if [ "$PkgType" = "deb" ]; then
else
# build fpcsrc rpm
echo building fpcsrc rpm ...
# copy src tgz into rpm building directory
cp $FPCTGZ /usr/src/redhat/SOURCES/
echo "building fpcsrc rpm ..."
# create spec file
SpecFile=fpcsrc-$LazVersion-$LazRelease.spec
SpecFile=rpm/fpcsrc-$LazVersion-$LazRelease.spec
cat fpcsrc.spec | \
sed -e "s/LAZVERSION/$LazVersion/g" -e "s/LAZRELEASE/$LazRelease/" \
> $SpecFile
@ -124,6 +123,7 @@ else
# build rpm
rpmbuild -ba $SpecFile || rpm -ba $SpecFile
echo "The new rpm can be found in $(./rpm/get_rpm_source_dir.sh)/RPMS/i386/fpcsrc-$LazVersion-$LazRelease.i386.rpm"
fi
# end.

View File

@ -35,14 +35,18 @@ fi
TmpBaseDir=/tmp
TmpDir=$TmpBaseDir/fpc
rm -rf $TmpDir
if [ -d $FPCSrcDir/CVS ]; then
ppc386 -Fu../../lcl/units/i386/linux cvsexportlocal.pas
echo "extracting FPC from local cvs ..."
rm -rf $TmpDir
./cvsexportlocal $FPCSrcDir $TmpDir
else
rm -rf $TmpDir
cp -a $FPCSrcDir $TmpDir
if [ -d $FPCSrcDir/.svn ]; then
echo "extracting FPC from local svn ..."
svn export $FPCSrcDir $TmpDir
else
cp -a $FPCSrcDir $TmpDir
fi
fi
if [ $RenameSmart = "yes" ]; then

View File

@ -25,11 +25,9 @@ if [ "x$Download" = "xyes" ]; then
cd -
else
echo "extracting lazarus from local svn ..."
cd ../..
SourceDir=`pwd`
cd -
SourceDir=$(pwd | sed -e 's#lazarus/tools.*$#lazarus#')
rm -rf /tmp/lazarus
svn export file://$SourceDir lazarus
svn export $SourceDir /tmp/lazarus
fi
cd /tmp

View File

@ -4,44 +4,49 @@ set -x
set -e
# get date of day
Year=`date +%y`
Month=`date +%m`
Day=`date +%d`
Year=$(date +%y)
Month=$(date +%m)
Day=$(date +%d)
# get installed fpc version
FPCRPM=`rpm -qa | egrep '^fpc-'`
echo "getting installed fpc version ..."
FPCRPM=$(rpm -qa | egrep '^fpc-')
if [ "x$FPCRPM" = "x" ]; then
echo ERROR: fpc rpm not installed
exit
fi
FPCRPMVersion=`echo $FPCRPM | sed -e 's/fpc-//g'`
echo "installed fpc version: $FPCRPMVersion"
Date=$Year$Month$Day
LazVersion=0.9.8
LazRelease=`echo $FPCRPM | sed -e 's/-/_/g'`
SrcTGZ=lazarus-$Date.tgz
LazVersion=$(./get_lazarus_version.sh)
LazRelease=$(echo $FPCRPM | sed -e 's/-/_/g')
Src=lazarus-$LazVersion-$LazRelease.tar.gz
SrcTGZ=$(./rpm/get_rpm_source_dir.sh)/SOURCES/$Src
TmpDir=/tmp/lazarus$LazVersion
SpecFile=lazarus-$LazVersion-$LazRelease.spec
SpecFile=rpm/lazarus-$LazVersion-$LazRelease.spec
# download lazarus cvs if necessary
# download lazarus svn if necessary
echo "creating lazarus tgz ..."
if [ ! -f $SrcTGZ ]; then
sh create_lazarus_export_tgz.sh $SrcTGZ
fi
# put src tgz into rpm build directory
cp $SrcTGZ /usr/src/redhat/SOURCES/
# create spec file
cat lazarus.spec | \
echo "creating lazarus spec file ..."
cat rpm/lazarus.spec.template | \
sed -e "s/LAZVERSION/$LazVersion/g" \
-e "s/LAZRELEASE/$LazRelease/" \
-e "s/LAZSOURCE/$SrcTGZ/" \
-e "s/LAZRELEASE/$LazRelease/g" \
-e "s/LAZSOURCE/$Src/" \
-e "s/FPCBUILDVERSION/2.0.0/" \
-e "s/FPCSRCVERSION/$FPCRPMVersion/" \
> $SpecFile
# build rpm
echo "building rpm ..."
rpm -ba $SpecFile || rpmbuild -ba $SpecFile
echo "The new rpm can be found at $(./rpm/get_rpm_source_dir.sh)/RPMS/i386/lazarus-$LazVersion-$LazRelease.i386.rpm"
# end.

View File

@ -3,7 +3,7 @@ Version: LAZVERSION
Release: LAZRELEASE
Copyright: LGPL2
Group: Development/Languages
Source: %{name}-%{version}-%{release}.tgz
Source: %{name}-%{version}-%{release}.source.tar.gz
Summary: FreePascal sources
Packager: Mattias Gaertner (mattias@freepascal.org)
URL: http://www.freepascal.org/

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
grep 'lisLazarusVersionString = ' ../../lazarusidestrconsts.pas \
grep 'lisLazarusVersionString = ' ../../ide/lazarusidestrconsts.pas \
| sed -e 's/.*[^0-9\.]\([0-9\.]\+\)[^0-9\.].*/\1/'
# end.

View File

@ -1,60 +0,0 @@
Name: lazarus
Version: LAZVERSION
Release: LAZRELEASE
Copyright: LGPL2/GPL2
Group: Development/Tools
Source: LAZSOURCE
Summary: Lazarus Component Library and IDE
Packager: Mattias Gaertner (mattias@freepascal.org)
URL: http://www.lazarus.freepascal.org/
BuildRoot: %{_tmppath}/lazarus-build
BuildRequires: fpc >= FPCBUILDVERSION
Requires: fpcsrc >= FPCSRCVERSION, fpc >= FPCBUILDVERSION
Requires: gdk-pixbuf-devel >= 0.18.0
%define lazdir %{_datadir}/lazarus
%description
Lazarus is a free and opensource RAD tool for freepascal using the lazarus
component library - LCL, which is also included in this package.
The LCL is licensed under LGPL2, the IDE is licensed under GPL2.
%prep
%setup -c
%build
cd lazarus
make
strip lazarus
%install
if [ %{buildroot} != "/" ]; then
rm -rf %{buildroot}
fi
mkdir -p %{buildroot}%{_datadir}/lazarus
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/pixmaps
mkdir -p %{buildroot}%{_datadir}/gnome/apps/Development
mkdir -p %{buildroot}%{_datadir}/applications
cp -a lazarus/* %{buildroot}%{_datadir}/lazarus/
install -m 644 lazarus/images/ide_icon48x48.png %{buildroot}%{_datadir}/pixmaps/lazarus.png
install -m 644 lazarus/gnome.ide.desktop %{buildroot}%{_datadir}/gnome/apps/Development/lazarus.desktop
install -m 644 lazarus/gnome.ide.desktop %{buildroot}%{_datadir}/applications/lazarus.desktop
ln -sf %{lazdir}/lazarus %{buildroot}%{_bindir}/lazarus
%clean
if [ %{buildroot} != "/" ]; then
rm -rf %{buildroot}
fi
%files
%defattr(-,root,root)
%{_datadir}/lazarus
%{_bindir}/lazarus
%{_datadir}/pixmaps/lazarus.png
%{_datadir}/gnome/apps/Development/lazarus.desktop
%{_datadir}/applications/lazarus.desktop
%changelog

View File

@ -6,7 +6,7 @@ Summary: Lazarus Component Library and IDE
Group: Development/Languages
License: GPL and modified LGPL
URL: http://www.lazarus.freepascal.org/
Source0: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}-%{release}.source.tar.gz
Source0: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}-%{release}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
#BuildRequires:
@ -24,8 +24,7 @@ component library - LCL, which is also included in this package.
%build
cd lazarus
make OPT="-n @$FPCCfg"
# -Fl/opt/gnome/lib
make OPT="-Fl/opt/gnome/lib"
strip lazarus
strip startlazarus