improved fpc_crosswin32 rpm to not require root for building

git-svn-id: trunk@7722 -
This commit is contained in:
mattias 2005-09-16 23:22:52 +00:00
parent d59c8ecd28
commit 4f8e170185
7 changed files with 133 additions and 46 deletions

1
.gitattributes vendored
View File

@ -1974,6 +1974,7 @@ tools/install/file_filter.sh -text svneol=native#application/x-sh
tools/install/get_lazarus_version.sh -text svneol=native#application/x-sh
tools/install/macosx/fpc_installer_info.zip -text svneol=unset#application/zip
tools/install/replace_in_files.pl -text svneol=native#application/x-perl
tools/install/rpm/create_nonroot_rpmmacros.sh svneol=native#text/plain
tools/install/rpm/fpc.spec.template svneol=native#text/plain
tools/install/rpm/fpc_crosswin32.spec.template svneol=native#text/plain
tools/install/rpm/lazarus.spec.template svneol=native#text/plain

View File

@ -10,23 +10,21 @@ TGZ
Creating the fpcsrc tgz:
There are two ways to do it and so there are two scripts. The first downloads
the fpc cvs and packs it. The second uses an existing fpc cvs directory,
the fpc svn and packs it. The second uses an existing fpc svn directory,
copies it, remove unnecessary files and packs it. The second script is
therefore much faster, but it may miss removing every old, unnecessary files.
The download and pack script:
The script create_fpc_export_tgz.sh makes a cvs export of the fpc.
For 1.0.11: ./create_fpc_export_tgz.sh stable 05/20/04
The script create_fpc_export_tgz.sh makes a svn export of the fpc.
For 1.9: ./create_fpc_export_tgz.sh devel 05/20/04
For 2.1.x: ./create_fpc_export_tgz.sh devel 05/20/04
The 05/20/04 means may 20th 2004.
The copy and pack script:
The script create_fpc_tgz_from_local_dir.sh needs as parameter the fpc cvs
directory and compresses it to a tgz. For example
./create_fpc_tgz_from_local_dir.sh ~/pascal/fpc fpc-1.0.10.tgz
./create_fpc_tgz_from_local_dir.sh ~/pascal/fpc fpc-2.0.1.tgz
Creating the lazarus tgz:
@ -51,27 +49,29 @@ RPM:
Creating the fpc and the fpcsrc rpm:
There are two versions of the compiler: the old 1.0.11 and the new (but not
yet released) developer version 1.9. To build them, you must install fpc
first. Install the stable fpc release (1.0.10). Note: The 1.0.11 can not be
built with a 1.9 compiler and the recommended startup compiler for the 1.9.x
is the released fpc 1.0.10.
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.
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 040501
The 040501 stands for: 2004 may 1st
cd <lazarus_directory>/tools/install
./build_fpc_rpm.sh nodocs /path/to/your/fpc/sources/fpc 050601
The 050601 stands for: 2005 june 1st
Then build the fpcsrc rpm. Become root and do:
cd <lazarus_directory>/tools/install
./build_fpcsrc_rpm.sh /path/to/your/fpc/sources/fpc 040501
./build_fpcsrc_rpm.sh /path/to/your/fpc/sources/fpc 050601
The create_fpc_rpm.sh works nearly automatically. Become root and execute it.
For 1.0.11: ./create_fpc_rpm.sh stable
For 1.9: ./create_fpc_rpm.sh devel
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
@ -93,7 +93,7 @@ Creating the lazarus rpm:
Creating other system specific rpms:
rpm --rebuild lazarus-0.9.1-1.src.rpm
rpm --rebuild lazarus-0.9.10.src.rpm
--------------------------------------------------------------------------------
@ -102,13 +102,13 @@ Debian:
Creating the debian fpc and fpcsrc packages:
There are two versions of the compiler: the stable 1.0.11 and the unstable
developer version 1.9. To build them, you must install fpc first. Install the
stable fpc release (1.0.10). Note: The 1.0.11 can not be built with a 1.9
There are two versions of the compiler: the stable 2.0.x and the unstable
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.
The create_fpc_deb.sh works nearly automatically. Become root and execute it.
For 1.0.11: ./create_fpc_deb.sh stable
For 1.9: ./create_fpc_deb.sh devel
For 2.0.x: ./create_fpc_deb.sh stable
For 2.1.x: ./create_fpc_deb.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
@ -145,12 +145,12 @@ Creating the DMG packages for FPC and Lazarus:
5. cd compiler
sudo make installsymlink INSTALL_PREFIX=~/fpcinst/usr/local
Fix sym link:
sudo ln -sf /usr/local/lib/fpc/1.9.5/ppcppc ~/fpcinst/usr/local/bin/ppcppc
sudo ln -sf /usr/local/lib/fpc/2.1.1/ppcppc ~/fpcinst/usr/local/bin/ppcppc
6. unzip the <lazarus>/tools/install/macosx/fpc_installer_info.zip somewhere,
open "fpc 1.9.5.pmsp" (it will open in PackageMaker) change the "resources"
open "fpc 2.1.1.pmsp" (it will open in PackageMaker) change the "resources"
path so it points to the unzipped fpc_resources directory and the "files"
path so it points to ~/fpcinst and then choose File->Create Package
7. Put the package in a directory called "Free Pascal Compiler 1.9.5",
7. Put the package in a directory called "Free Pascal Compiler 2.1.1",
add in the "Introduction.txt" and "ReadMe.txt" files from the dmg you
already downloaded and create a (compressed or not doesn't really
matter, the package is already compressed) disk image from the folder

View File

@ -1,6 +1,6 @@
#!/bin/bash
set -x
#set -x
set -e
#------------------------------------------------------------------------------
@ -149,7 +149,8 @@ else
# -e 's/\(%define builddocdir.*\)/%define __strip smart_strip.sh\n\n\1/' \
# -e 's/^\%{fpcdir}\/samplecfg .*/%{fpcdir}\/samplecfg %{_libdir}\/fpc\/\\\$version/' \
tar czf /usr/src/redhat/SOURCES/fpc-$CompilerVersionStr-$LazRelease.source.tar.gz -C $TmpDir fpc
SrcTGZ=$(rpm/get_rpm_source_dir.sh)/SOURCES/fpc-$CompilerVersionStr-$LazRelease.source.tar.gz
tar czf $SrcTGZ -C $TmpDir fpc
#----------------------------------------------------------------------------
# compile
@ -161,7 +162,7 @@ else
cd -
rpmbuild --nodeps -ba $SpecFile
echo "The new rpm can be found in /usr/src/redhat/RPMS/i386/"
echo "The new rpm can be found in $(../rpm/get_rpm_source_dir.sh)/RPMS/i386/"
fi
# end.

View File

@ -4,7 +4,7 @@
# Abstract: Download, compile binutils and FPC
set -e
set -x
#set -x
# This is the root for all download and building directories
BuildRoot=~/freepascal
@ -58,6 +58,7 @@ done
# expand paths
BuildRoot=$(echo $BuildRoot | sed -e 's#//#/#g' -e 's#/$##')
Targets='i386-win32'
#===============================================================================
# download and build binutils and fpc
@ -85,6 +86,8 @@ fi
#===============================================================================
# build fpc_crosswin32 rpm
if [ $BuildCrossWin32RPM = "yes" ]; then
#----------------------------------------------------------------------------
# retrieve the version information
#----------------------------------------------------------------------------
@ -97,30 +100,73 @@ if [ $BuildCrossWin32RPM = "yes" ]; then
Release=$(date +%y%m%d)
#----------------------------------------------------------------------------
# create source directory
# create temporary directories
#----------------------------------------------------------------------------
TmpDir=/tmp/fpc_patchdir
rm -rf $TmpDir
mkdir -p $TmpDir
TmpSrcDir=/tmp/fpc_crosswin32
rm -rf $TmpSrcDir
mkdir -p $TmpSrcDir
#----------------------------------------------------------------------------
# collect binutils
#----------------------------------------------------------------------------
BinDir=$TmpSrcDir/usr/bin/
mkdir -p $BinDir
MyIntel=i686
for Target in $Targets; do
TargetCPU=$(echo $Target | sed -e 's#^\(.*\)-.*$#\1#')
TargetOS=$(echo $Target | sed -e 's#^.*-\(.*\)$#\1#')
BinUtilsCPU=$TargetCPU
BinUtilsOS=$TargetOS
if [ $TargetOS = "win32" ]; then
BinUtilsOS="mingw32"
BinUtilsCPU=$MyIntel
fi
BinUtilsDir=$BuildRoot/binutils/cross/bin/
BinUtilsPrefix="$BinUtilsCPU-$BinUtilsOS-"
cd ${BinUtilsDir}
for binutility in $(ls -B ${BinUtilsPrefix}*); do
NewName=$(echo $binutility | sed -e "s#$BinUtilsPrefix#fpc-${TargetCPU}-${TargetOS}-#")
cp ${BinUtilsDir}${binutility} ${BinDir}${NewName}
done
cd -
done
#----------------------------------------------------------------------------
# collect fpc libs (e.g. .ppu/.o)
#----------------------------------------------------------------------------
for Target in $Targets; do
FPCLibDir=lib/fpc/$CompilerVersionStr/units # !!! no / at end
mkdir -p $TmpSrcDir/$FPCLibDir
cp -a $BuildRoot/binutils/cross/destination/$FPCLibDir/$Target $TmpSrcDir/$FPCLibDir/
done
#----------------------------------------------------------------------------
# create tgz
#----------------------------------------------------------------------------
SrcTGZ=$(../rpm/get_rpm_source_dir.sh)/SOURCES/fpc_crosswin32-$CompilerVersionStr-$Release.tar.gz
cd $TmpSrcDir
tar czf $SrcTGZ .
cd -
#----------------------------------------------------------------------------
# change spec file
#----------------------------------------------------------------------------
SpecFileTemplate=../rpm/fpc_crosswin32.spec.template
SpecFile=../rpm/fpc_crosswin32.spec
SpecFile=fpc_crosswin32.spec
cat $SpecFileTemplate | \
sed -e 's/FPCVERSION/'"$CompilerVersionStr/" \
-e 's/FPCRELEASE/'"$Release/" \
> $SpecFile
#----------------------------------------------------------------------------
# compile
#----------------------------------------------------------------------------
rpmbuild --nodeps -ba $SpecFile
echo "The new rpm can be found in /usr/src/redhat/RPMS/i386/"
echo "The new rpm can be found in $(../rpm/get_rpm_source_dir.sh)/RPMS/i386/"
fi
# end.

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
mkdir -p ~/rpm/tmp
for fulldir in /usr/src/redhat/*
do
dir=$(basename "$fulldir")
mkdir -p ~/rpm/"$dir"
done
cat > ~/.rpmmacros << EOT
%_topdir $(echo ${HOME}/rpm)
%_tmppath $(echo ${HOME}/rpm/tmp)
EOT

View File

@ -6,15 +6,21 @@ Summary: Free Pascal Compiler cross binaries for win32
Group: Development/Languages
License: GPL and modified LGPL
URL: http://www.freepascal.org/
Source0: ftp://ftp.freepascal.org/pub/fpc/dist/source-%{version}/%{name}-%{version}-%{release}.source.tar.gz
Source0: ftp://ftp.freepascal.org/pub/fpc/dist/source-%{version}/%{name}-%{version}-%{release}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: glibc, binutils, fpc=FPCVERSION
Requires: glibc, binutils, fpc
BuildRequires: binutils, glibc-devel
# rpm should not even try to strip
%define __strip /bin/true
%description
Units and binutils needed by Freepascal to cross compile to target win32.
This rpm was built from sources built by the scripts of the lazarus project.
See http://www.lazarus.freepascal.org.
Download the lazarus sources and see <lazarusdir>/tools/install/cross_unix/
%prep
%setup -c
@ -22,7 +28,28 @@ Units and binutils needed by Freepascal to cross compile to target win32.
%build
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_libdir}/%{name}
[ %{buildroot} != "/" ] && ( rm -rf %{buildroot} )
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}/fpc/%{version}/units/
cp -a usr/bin/* %{buildroot}%{_bindir}/
cp -a lib/fpc/%{version}/units/* %{buildroot}%{_libdir}/fpc/%{version}/units/
%clean
[ %{buildroot} != "/" ] && ( rm -rf %{buildroot} )
%post
# add -FD and -XP entry for cross compiling
echo "# set binutils paths for crosscompiling # fpc_crosswin32" >> /etc/fpc.cfg
echo "#IFDEF FPC_CROSSCOMPILING # fpc_crosswin32" >> /etc/fpc.cfg
echo ' -XPfpc-i386-win32- # fpc_crosswin32' >> /etc/fpc.cfg
echo "#ENDIF # fpc_crosswin32" >> /etc/fpc.cfg
%postun
cat /etc/fpc.cfg | grep - v '# fpc_crosswin32' > /etc/fpc.cfg.rpmtemp
mv /etc/fpc.cfg.rpmtemp /etc/fpc.cfg
%files
%defattr(-,root,root,-)
%{_libdir}/fpc
%{_bindir}/*

View File

@ -30,7 +30,7 @@ strip lazarus
strip startlazarus
%install
rm -rf %{buildroot}
[ %{buildroot} != "/" ] && ( rm -rf %{buildroot} )
mkdir -p %{buildroot}%{_libdir}/%{name}
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/pixmaps
@ -43,7 +43,7 @@ cp -a lazarus/* %{buildroot}%{_libdir}/%{name}/
ln -sf ../%{_lib}/%{name}/%{name} %{buildroot}%{_bindir}/%{name}
%clean
rm -rf %{buildroot}
[ %{buildroot} != "/" ] && ( rm -rf %{buildroot} )
#%post
#update-desktop-database &> /dev/null ||: