diff --git a/.gitattributes b/.gitattributes index 6e0910f66f..88be7301a5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1910,6 +1910,7 @@ tools/find_non_cvs_files.pl -text svneol=native#application/x-perl tools/getallmofiles.sh -text svneol=native#application/x-sh tools/getallpofiles.sh -text svneol=native#application/x-sh tools/install/build_fpc_rpm.sh -text svneol=native#application/x-sh +tools/install/build_fpc_snaphot_rpm.sh svneol=native#text/plain tools/install/build_fpcsrc_rpm.sh -text svneol=native#application/x-sh tools/install/create_clean_fpcsrc_directory.sh -text svneol=native#application/x-sh tools/install/create_clean_lazarus_directory.sh -text svneol=native#application/x-sh @@ -1919,6 +1920,7 @@ tools/install/create_fpc_tgz_from_local_dir.sh -text svneol=native#application/x tools/install/create_lazarus_deb.sh -text svneol=native#application/x-sh tools/install/create_lazarus_export_tgz.sh -text svneol=native#application/x-sh tools/install/create_lazarus_rpm.sh -text svneol=native#application/x-sh +tools/install/create_lazarus_snapshot_rpm.sh svneol=native#text/plain tools/install/create_lazarus_tgz_from_local_dir.sh -text svneol=native#application/x-sh tools/install/cvsexportlocal.pas svneol=native#text/pascal tools/install/do_nothing.sh -text svneol=native#application/x-sh diff --git a/tools/install/build_fpc_snaphot_rpm.sh b/tools/install/build_fpc_snaphot_rpm.sh new file mode 100755 index 0000000000..26265ce45b --- /dev/null +++ b/tools/install/build_fpc_snaphot_rpm.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +set -x +set -e + +#------------------------------------------------------------------------------ +# parse parameters +#------------------------------------------------------------------------------ +Usage="Usage: $0 [nodocs] [deb] " + +WithDOCS=yes +if [ "x$1" = "xnodocs" ]; then + WithDOCS=no + shift +fi + +PkgType=rpm +if [ "x$1" = "xdeb" ]; then + PkgType=deb + shift +fi + +FPCSrcDir=$1 +shift +if [ "x$FPCSrcDir" = "x" ]; then + echo $Usage + exit -1 +fi + +LazRelease=`date +%Y%m%d` + +if [ ! -d $FPCSrcDir/compiler ]; then + echo "The directory $FPCSrcDir does not look like a fpc source directory (fpc)" + exit -1 +fi + +if [ ! -d $FPCSrcDir/.svn ]; then + echo "The directory $FPCSrcDir does not look like a svn working directory" + exit -1 +fi + +#------------------------------------------------------------------------------ +# patching +#------------------------------------------------------------------------------ + +# create a temporary copy of the fpc sources to patch it +TmpDir=/tmp/fpc +rm -rf $TmpDir + +echo "extracting FPC from local svn ..." +svn export $FPCSrcDir $TmpDir + +# retrieve the version information +VersionFile="$TmpDir/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'` +CompilerVersionStr="$CompilerVersion.$CompilerRelease.$CompilerPatch" +LazVersion="$CompilerVersion.$CompilerRelease" +if [ "$CompilerPatch" != "0" ]; then + LazVersion="$LazVersion.$CompilerPatch" +fi + +# set version numbers in all Makefiles +perl replace_in_files.pl -sR -f '=\d.\d.\d' -r =$CompilerVersionStr -m 'Makefile(.fpc)?' $TmpDir/* + +# create a source tar.gz +cd /tmp +tar -czf ~/rpmbuild/SOURCES/fpc-2.1.1-$LazRelease.source.tar.gz fpc + +# remove the tempdir +cd - +rm -rf $TmpDir + +SpecFileTemplate=rpm/fpc.spec.template +SpecFile=~/rpmbuild/SPECS/fpc.spec + +# change spec file +cat $SpecFileTemplate | \ + sed -e 's/^Version: .*/Version: '"$LazVersion/" \ + -e 's/^Release: .*/Release: '"$LazRelease/" \ + > $SpecFile +# -e 's/\(%define builddocdir.*\)/%define __strip smart_strip.sh\n\n\1/' \ +# -e 's/^\%{fpcdir}\/samplecfg .*/%{fpcdir}\/samplecfg %{_libdir}\/fpc\/\\\$version/' \ + +rpmbuild -ba $SpecFile + diff --git a/tools/install/create_lazarus_snapshot_rpm.sh b/tools/install/create_lazarus_snapshot_rpm.sh new file mode 100755 index 0000000000..d041a74800 --- /dev/null +++ b/tools/install/create_lazarus_snapshot_rpm.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +set -x +set -e + +#------------------------------------------------------------------------------ +# parse parameters +#------------------------------------------------------------------------------ +Usage="Usage: $0 " + +LazSrcDir=$1 +shift +if [ "x$LazSrcDir" = "x" ]; then + echo $Usage + exit -1 +fi + +if [ ! -d $LazSrcDir/lcl ]; then + echo "The directory $LazSrcDir does not look like a lazarus source directory" + exit -1 +fi + +if [ ! -d $LazSrcDir/.svn ]; then + echo "The directory $LazSrcDir does not look like a svn working directory" + exit -1 +fi + + + +Date=`date +%Y%m%d` +# get fpc snapshot rpm +FPCRPM=~/rpmbuild/RPMS/i586/fpc-2.1.1-$Date.i586.rpm +if [ ! -f $FPCRPM ]; then + echo ERROR: fpc rpm $FPCRPM not available + exit +fi + +TmpFPCDir=~/tmp/fpc +if [ -e $TmpFPCDir ]; then + rm -rf $TmpFPCDir +fi +mkdir -p $TmpFPCDir +cd $TmpFPCDir +rpm2cpio $FPCRPM | cpio -id +FPCVersion=`usr/bin/fpc -iV` +usr/lib/fpc/$FPCVersion/samplecfg $TmpFPCDir/usr/lib/fpc/$FPCVersion . +FPCCfg=$TmpFPCDir/fpc.cfg +export FPCCfg +FPC=$TmpFPCDir/usr/bin/fpc +export FPC +cd - + +# create a temporary copy of the lazarus sources for packaging +LazVersion=0.9.9 +LazRelease=`echo $FPCRPM | sed -e 's/-/_/g'` +TmpDir=/tmp/lazarus + +rm -rf $TmpDir +echo "extracting Lazarus source from local svn ..." +svn export $LazSrcDir $TmpDir + +# create a source tar.gz +cd $TmpDir/.. +tar -czf ~/rpmbuild/SOURCES/lazarus-$LazVersion-$Date.source.tar.gz lazarus + +# remove the tempdir +cd - +rm -rf $TmpDir + +# create spec file +SpecFile=~/rpmbuild/SPECS/lazarus-$LazVersion-$Date.spec +cat rpm/lazarus.spec.template | \ + sed -e "s/LAZVERSION/$LazVersion/g" \ + -e "s/LAZRELEASE/$Date/g" \ + -e "s/FPCVERSION/$FPCVersion/g" \ + > $SpecFile +# -e "s/FPCSRCVERSION/$FPCRPMVersion/" \ + +# build rpm +rpmbuild -ba $SpecFile + +rm -rf $TmpFpcDir + +# end. +