home

about

license

support

K/Base

Indy
HomeContactsSite Map


Indy RPM

Recently, I have made some progress in making a RPM (RPM Package Manager) that installs Indy into FreePascal. I know that this seems to be odd since we have nott yet established how well Indy will work in Linux under FreePascal (putting the cart before the horse).  However, I have a big reason for choosing to do this now.

On my system, I have FreePascal snapshot builds including RTL units installed in the system hierarchies so I can easily use them from any user account. Since binary unit files can only work against the exact same version of the unit they were compiled against, it's easy to break units. So if you change one set, you have to recompile the others. But only root can update the units in the system hierarchy and you don't want to run a compiler as root because you risk damaging your software (remember that root can do everything). You usually want compile the new units in a user account and then install them as root.

On a RPM-based Linux distribution such as Mandravia or Fedora, the RPM database is used to track software packages, the files they contain, and package dependencies.  This facilitates the easy installation and removal of software. That includes preventing you from removing a package if another package depended on it and preventing you from installing a package that depends upon something that you do not have installed. In other words, if you remove the FreePascal compiler and RTL units, you have to remove Indy units first. I admit that it is annoying but it is far less annoying than having mismatched units. Some programs such as Yum (Yellowdog Updater, Modified) and URPMI make this even easier by handling the dependencies automatically by removing packages that depend upon what you are removing and by automatically installing anything the package you want depends on.  Many Linux distributions even have point and click GUI programs that make all of this intuitive.

I am NOT going to distribute any binary Indy unit RPM's at all.  There are simply too many versions of FreePascal (including RTL versions) in both the development and stable branches.  There are also too many architectures that FreePascal supports and each architectures has to have it's own set of units and system libraries.

Anyone may make RPM's for their particular distribution and make those available to others.  I would appreciate any improvements that they make to the RPM .spec file I have provided.   The .spec file is included in the FreePascal Indy distribution and I have attached one version below for review:

Summary:   Indy.Sockets
Name:      indy
Version:   10.2.0.1
Release:   2
Source0:   http://www.indyproject.org/sockets/fpc/%{name}-%{version}.tar.gz
BuildRequires:  binutils, fpc
Requires:  fpc
License:   BSD style or MPL
BuildRoot: %{_tmppath}/%{name}-%{version}
Group:     Development/Libraries
URL:       http://www.indyproject.org
%description
Indy.Sockets is an open source socket library that supports clients, servers,
TCP, UDP, raw sockets, as well as over 100 higher level protocols such as 
SMTP, POP3, NNTP, HTTP, and many more. Indy.Sockets is available for C#, C++,
Delphi, Visual Basic.NET, any .NET language, and Kylix. This version is for 
FreePascal.

#These two things are an ugly hack.  The idea is to get the version from the fpc compiler.
#But this macro does not seem to work in the %files section and may not work in a few other
#places.  This is necessary because I want this to work with both the stable and development
#branch and those units are placed in different places (/usr/lib/fpc/2.0.2 or /usr/lib/fpc/2.1.1/)
%define _VerCmd %{_bindir}/fpc -iV
%define _FPCVersion `%{_VerCmd}`
%define _FPCLibPrefix %{_libdir}/fpc/%{_FPCVersion}
%define _FPCUnitDir %{_FPCLibPrefix}/units
%define _FPCUnitArcDir %{_FPCUnitDir}/%{_arch}-%{_os}
%define _IndyLibPrefix %{_FPCLibPrefix}/units/%{_arch}-%{_os}/%{name}

#I did try a standard placement using the FPC documentation placement but that did not work.
%define _IndyDocsDir %{_defaultdocdir}/%{name}-%{version}
%define _IndyExamplesDir %{_IndyDocsDir}/examples

%define _Build_LibDir %{buildroot}%{_libdir}
%define _Build_LibDebugDir %{_Build_LibDir}/debug
%define _Build_BinDir %{buildroot}%{_bindir}
%define _Build_FPCLibPrefix %{buildroot}%{_FPCLibPrefix}
%define _Build_IndyLibPrefix %{buildroot}%{_IndyLibPrefix}
%define _Build_IndyDocsDir %{buildroot}%{_IndyDocsDir}
%define _Build_IndyExamplesDir %{buildroot}%{_IndyExamplesDir}

# disable the debuginfo package
%define debug_package %{nil}
%define __spec_install_post /usr/lib/rpm/brp-compress

%prep
%setup -q -c

%build
cd %{name}-%{version}/fpc
make all

%install
rm -rf %{buildroot}
cd %{name}-%{version}
mkdir -p %{_Build_BinDir}
mkdir -p %{_Build_LibDir}
mkdir -p %{_Build_LibDebugDir}
mkdir -p %{_Build_FPCLibPrefix}
mkdir -p %{_Build_IndyLibPrefix}
mkdir -p %{_Build_IndyDocsDir}
#mkdir -p #{_Build_IndyExamplesDir)
install -D -m 644 README %{_Build_IndyDocsDir}/README
install -D -m 644 COPYING %{_Build_IndyDocsDir}/COPYING
install -D -m 644 COPYING.modifiedBSD %{_Build_IndyDocsDir}/COPYING.modifiedBSD
install -D -m 644 COPYING.MPL %{_Build_IndyDocsDir}/COPYING.MPL
cd fpc
INSTALLOPTS="INSTALL_PREFIX=%{_Build_FPCLibPrefix} \
                INSTALL_LIBDIR=%{_Build_LibDir} \
                INSTALL_BASEDIR=%{_Build_FPCLibPrefix} \
                INSTALL_DOCDIR=%{_Build_IndyDocsDir} \
                INSTASLL_BINDIR=%{_Build_BinDir} \
                INSTALL_EXAMPLEDIR=%{_Build_IndyExamplesDir}"
make install ${INSTALLOPTS}

%files
%defattr(-,root,root)
#We can not use the _FPCVersion macro here.
/usr/lib/*
%doc %{_IndyDocsDir}/README 
%doc %{_IndyDocsDir}/COPYING 
%doc %{_IndyDocsDir}/COPYING.modifiedBSD 
%doc %{_IndyDocsDir}/COPYING.MPL

%changelog
* Mon Mar 15 2006 J. Peter Mugaas  10.2.0.1-2
- now uses a URL for source
- tarrball names now include a "version" number
- changelog to keep rpmlint happy
- spec file clean ups.
* Wed Mar 8 2006 J. Peter Mugaas  10.2.0.1-1 
- initial spec file 
  

One day, I will definitely have to consider making an Indy Debian package (deb), pkgsrc, or maybe a Sun Solaris pkg format package..


Corporate Sponsors

Atozed







home

about

license

support

K/Base

site map

links

Copyright © 1993 - 2008 Chad Z. Hower (Kudzu) and the Indy Pit Crew.          Website design by RuInternet.ru