Building and installing mod_perl as a complete package
Building and installing mod_perl as a complete package
am 24.11.2010 02:28:40 von mohitanchlia
I was able to build mod_perl.so . But I noticed that "make install"
copies whole bunch of perl modules under non-apache directories.
My question,
1. Is it possible to build it such that I don't have to run make
install on every web server? Is there a way to build mod_perl that
contains everything including perl modules? This will help in install
and keeping track of mod_perl in only one place.
2. Also, is it possible to Keep all the install modules and files
local to apache install directory instead of having to create perl
modules
3. Is it possible to deploy the modules that I create local to apache
install directory? Currently I found one of the paths from @INC and
created module there. But the problem is that we have too many
webservers and install is going to be a problem.
4. Is there a way to dynamically change perl module without having to
stop or start apache?
Re: Building and installing mod_perl as a complete package
am 24.11.2010 10:25:22 von torsten.foertsch
On Wednesday, November 24, 2010 02:28:40 Mohit Anchlia wrote:
> 1. Is it possible to build it such that I don't have to run make
> install on every web server? Is there a way to build mod_perl that
> contains everything including perl modules? This will help in install
> and keeping track of mod_perl in only one place.
How about using a package system like RPM?
Also, "make install" supports the "DESTDIR=3D..." option. For example
make DESTDIR=3D/tmp/buildroot install
That won't install anything under your normal root directory but instead=20
/tmp/buildroot will look like / with respect to the installed files.
So, after installing you can pack /tmp/buildroot into a tar file:
(cd /tmp/buildroot && tar cf - .) | gzip -9 >mp-install.tar.gz
Now, go to the destination machine and unpack the tar as:
zcat mp-install.tar.gz | (cd / && tar xf -)
Note the different cd commands in packing and unpacking.
> 2. Also, is it possible to Keep all the install modules and files
> local to apache install directory instead of having to create perl
> modules
That can be achieved by setting some variables similar to DESTDIR on the "m=
ake=20
install" command line. It can also be combined with DESTDIR. For example:
make DESTDIR=3D... \
INSTALLSITEARCH=3D... \
INSTALLSITELIB=3D... \
... \
install
I used to set DESTDIR, INSTALLSITEARCH, INSTALLSITELIB, INSTALLSITEBIN,=20
INSTALLSITESCRIPT, INSTALLBIN, INSTALLSCRIPT, INSTALLSITEMAN1DIR and=20
INSTALLSITEMAN3DIR in one of my SPEC files. See ExtUtils::MakeMaker for mor=
e=20
information.
But be aware that you will then have to let Perl know about the different=20
locations by setting @INC. That can be done for example by setting PERL5LIB=
=20
prior to starting apache or by using "PerlSwitches -I ..." or by issuing a=
=20
"use lib" or "BEGIN {@INC=3D(...)}" or something similar. Recent perl versi=
ons=20
can be compiled with -Dusesitecustomize which can also help here. See INSTA=
LL=20
in the root directory of you perl source package.
> 3. Is it possible to deploy the modules that I create local to apache
> install directory? Currently I found one of the paths from @INC and
> created module there. But the problem is that we have too many
> webservers and install is going to be a problem.
You have to install your own modules in a location where perl can find them=
,=20
see above.
> 4. Is there a way to dynamically change perl module without having to
> stop or start apache?
The best approximation is Apache::Reload. Due to the nature of perl it cann=
ot=20
catch all possible cases. But if you write your modules with a possible rel=
oad=20
in mind it can do a good job.
Torsten Förtsch
=2D-=20
Need professional modperl support? Hire me! (http://foertsch.name)
Like fantasy? http://kabatinte.net
Re: Building and installing mod_perl as a complete package
am 24.11.2010 13:57:43 von Vegard Vesterheim
On Tue, 23 Nov 2010 17:28:40 -0800 Mohit Anchlia wrote:
> I was able to build mod_perl.so . But I noticed that "make install"
> copies whole bunch of perl modules under non-apache directories.
>
> My question,
>
> 1. Is it possible to build it such that I don't have to run make
> install on every web server? Is there a way to build mod_perl that
> contains everything including perl modules? This will help in install
> and keeping track of mod_perl in only one place.
Take a look at CDE: automatic packaging of Code, Data, and Environment
http://www.stanford.edu/~pgbovine/cde.html
http://vimeo.com/16684443
I have not tried it myself, but the idea is intriguing.
- Vegard V -
Re: Building and installing mod_perl as a complete package
am 21.12.2010 01:07:06 von mohitanchlia
I created a rpm for the files in DESTDIR but when I tried to install I see:
rpm -ivh mod-perl-2.0.4-rpm.rpm
error: Failed dependencies:
perl(Apache2::FunctionTable) is needed by mod-perl-2.0.4-1.noarch
perl(Apache2: StructureTable) is needed by mod-perl-2.0.4-1.noarch
perl(Apache::TestConfigParse) is needed by mod-perl-2.0.4-1.noarch
perl(Apache::TestConfigPerl) is needed by mod-perl-2.0.4-1.noarch
perl(BSD::Resource) is needed by mod-perl-2.0.4-1.noarch
perl(Data::Flow) is needed by mod-perl-2.0.4-1.noarch
perl(Module::Build) >=3D 0.18 is needed by mod-perl-2.0.4-1.noarch
Then I looked inside the source directory and it looks like for eg
StructureTable is not in DESTDIR. And also when I installed with
--nodeps and tested my code it seems to work fine. I am confused if
the above are needed or not?
2010/12/14 Torsten Förtsch :
> On Tuesday, December 14, 2010 23:17:10 Mohit Anchlia wrote:
>> Thanks! So for eg: DESTDIR needs to be given in make install or with
>> make perl Makefile.PL?
>
> the former
>
> Torsten Förtsch
>
> --
> Need professional modperl support? Hire me! (http://foertsch.name)
>
> Like fantasy? http://kabatinte.net
>
Re: Building and installing mod_perl as a complete package
am 21.12.2010 12:46:57 von torsten.foertsch
--Boundary-00=_xOJENYOVvJ753+c
Content-Type: Text/Plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
On Tuesday, December 21, 2010 01:07:06 Mohit Anchlia wrote:
> I created a rpm for the files in DESTDIR but when I tried to install I se=
e:
>=20
> rpm -ivh mod-perl-2.0.4-rpm.rpm
> error: Failed dependencies:
> perl(Apache2::FunctionTable) is needed by mod-perl-2.0.4-1.noarch
> perl(Apache2: StructureTable) is needed by mod-perl-2.0.4-1.noarch
> perl(Apache::TestConfigParse) is needed by mod-perl-2.0.4-1.noarch
> perl(Apache::TestConfigPerl) is needed by mod-perl-2.0.4-1.noarch
> perl(BSD::Resource) is needed by mod-perl-2.0.4-1.noarch
> perl(Data::Flow) is needed by mod-perl-2.0.4-1.noarch
> perl(Module::Build) >=3D 0.18 is needed by mod-perl-2.0.4-1.noarch
>=20
> Then I looked inside the source directory and it looks like for eg
> StructureTable is not in DESTDIR. And also when I installed with
> --nodeps and tested my code it seems to work fine. I am confused if
> the above are needed or not?
Enclosed you'll find a SPEC file that works for me. It uses perl and apache=
in=20
/opt. Note that the install_vendor target works only if 2 conditions are me=
t.=20
=46irstly, modperl trunk is used and, secondly, perl is compiled with a ven=
dor=20
path. I build RPM packages for various opensuse/sles versions. For Redhat o=
r=20
Centos your mileage may vary.
As for the error message above, Apache2::{Function,Structure}Table are modu=
les=20
used only for building modperl. They are normally not installed.=20
Apache::Test... are part of Apache::Test and are needed if you want to test=
AT=20
based modules. They are normally installed together with modperl. So, perha=
ps=20
your %files entry is incomplete. There is an option in the RPM system that =
if=20
set makes rpmbuild fail if there are files DESTDIR that are not covered by=
=20
%files. On suse this (perhaps _unpackaged_files_terminate_build) is set by=
=20
default.
BSD::Resource is not needed. modperl uses it it its test suite. But the tes=
t=20
is simply skipped if it's not available. Module::Build is part of perl core=
=20
since 5.10.0. modperl does not use it, AFAIK. Data::Flow is not installed o=
n=20
any of my build machines. So, somehow your dependencies are wrong. Do you u=
se=20
"Autoreqprov"? If yes it does not work. Otherwise check your "Requires"=20
definitions.
See also: http://www.rpm.org/max-rpm/index.html
Torsten Förtsch
=2D-=20
Need professional modperl support? Hire me! (http://foertsch.name)
Like fantasy? http://kabatinte.net
--Boundary-00=_xOJENYOVvJ753+c
Content-Type: text/x-rpm-spec;
charset="UTF-8";
name="optperl-mod_perl.spec"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="optperl-mod_perl.spec"
Name: optperl-mod_perl
License: Apache
Group: Development/Libraries/Perl
Requires: opt-perl opt-apache-prefork
BuildRequires: opt-perl perl(Chatbot::Eliza) perl(BSD::Resource)
BuildRequires: opt-apache-prefork opt-apache-prefork-devel
Autoreqprov: on
Summary: modperl
Version: 2.0.5threading6
Release: 8
Source: mod_perl-%{version}.tar.gz
Patch0: AT.patch
BuildRoot: %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}
Vendor: Torsten Förtsch
# to be used with:
# mkfifo ~/FIFO && RPM_NAME_TO=3D~/FIFO rpmbuild --nobuild SPEC &
# read RPM_NAME <~/FIFO
%([ "$RPM_NAME_TO" ] &&
echo >"$RPM_NAME_TO" \
"%{_rpmdir}/%{_arch}/%{name}-%{version}-%{release}.%{_arch}. rpm")
%define perl /opt/perl/bin/perl
%define perllib %(%perl -MConfig -le 'print $Config{vendorlibexp}')
%define perlarch %(%perl -MConfig -le 'print $Config{vendorarchexp}')
%define perlarchlib %(%perl -MConfig -le 'print $Config{archlibexp}')
%define perlman1 %(%perl -MConfig -le 'print $Config{vendorman1direxp}')
%define perlman3 %(%perl -MConfig -le 'print $Config{vendorman3direxp}')
%define perlbin %(%perl -MConfig -le 'print $Config{vendorscriptexp}')
%define apxs /opt/apache-prefork/sbin/apxs
%define sysconfdir %(%apxs -q sysconfdir)
%define libexecdir %(%apxs -q libexecdir)
%description
modperl
%prep
%setup -q -n mod_perl-%{version}
cd Apache-Test
%patch0 -p0
cd ..
# ------------------------------------------------------------ -------------=
=2D-
%build
export APACHE_TEST_NO_STICKY_PREFERENCES=3D1
%perl Makefile.PL MP_APXS=3D%{apxs} MP_TRACE=3D0 MP_DEBUG=3D0
make %{?jobs:-j%jobs} && make test
# ------------------------------------------------------------ -------------=
=2D-
%install
[ "$RPM_BUILD_ROOT" !=3D "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUI=
LD_ROOT;
make DESTDIR=3D$RPM_BUILD_ROOT install_vendor
find $RPM_BUILD_ROOT%{perlman1} $RPM_BUILD_ROOT%{perlman3} -type f -print0 |
xargs -0i^ %{_gzipbin} -9 ^ || true
rm -rf $RPM_BUILD_ROOT%{perlarchlib}
%clean
[ "$RPM_BUILD_ROOT" !=3D "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUI=
LD_ROOT;
%files
%defattr(-, root, root)
%{perllib}
%{perlbin}
/opt/apache-prefork
%doc %{perlman3}
%post
if [ -f %{sysconfdir}/original/httpd.conf -a \
\! -f %{sysconfdir}/original/httpd-modperl.conf ]; then
ED=3D%{libexecdir} %perl -pe '
if( !$attn and /LoadModule/ ) {
$attn=3D1;
} elsif( $attn==1 and /^\s*$/ ) {
print "LoadModule perl_module $ENV{ED}/mod_perl.so\n";
$attn++;
}
' <%{sysconfdir}/original/httpd.conf \
>%{sysconfdir}/original/httpd-modperl.conf
fi
:
%preun
[ "$1" -eq 0 ] && rm %{sysconfdir}/original/httpd-modperl.conf 2>/dev/null =
|| :
--Boundary-00=_xOJENYOVvJ753+c--