ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/mod_perl2.spec
Revision: 1.5
Committed: Thu Feb 28 14:29:37 2008 UTC (17 years, 2 months ago) by egeland
Branch: MAIN
Changes since 1.4: +28 -0 lines
Log Message:
add dependencies-setup.sh

File Contents

# User Rev Content
1 egeland 1.1 ### RPM external mod_perl2 2.0.3
2     ## INITENV +PATH PERL5LIB %i/lib/site_perl/%perlversion
3    
4 egeland 1.2 %define perlversion %(perl -e 'printf "%%vd", $^V')
5     %define perlarch %(perl -MConfig -e 'print $Config{archname}')
6    
7 egeland 1.1 # See http://perl.apache.org/docs/2.0/user/install/install.html
8    
9     Source0: http://perl.apache.org/dist/mod_perl-%realversion.tar.gz
10    
11     # Only require apache2 since perl is seeded from the system.
12     Requires: apache2
13    
14     # Doesn't actually provide these, but supposedly not needed for
15     # non-developers of mod_perl
16     Provides: perl(Apache2::FunctionTable)
17     Provides: perl(Apache2::StructureTable)
18     Provides: perl(Apache::TestConfigParse)
19     Provides: perl(Apache::TestConfigPerl)
20     Provides: perl(BSD::Resource)
21     Provides: perl(Data::Flow)
22     Provides: perl(Module::Build)
23    
24    
25     %prep
26     %setup -n mod_perl-%realversion
27    
28     %build
29     perl Makefile.PL PREFIX=%i LIB=%i/lib/site_perl/%perlversion MP_APXS=$APACHE2_ROOT/bin/apxs MP_AP_DESTDIR=%i
30     make
31    
32     %install
33     make install
34    
35 egeland 1.3 mkdir -p %i/conf
36     cat << \EOF > %i/conf/mod_perl2.conf
37 egeland 1.4 LoadModule perl_module %i/modules/mod_perl.so
38 egeland 1.3 # Additional configuration bits go here.
39     EOF
40    
41 egeland 1.1 # By default mod_perl.so and include/ directory is moved to the
42     # $APACHE2_ROOT/modules and $APACHE2_ROOT/include, respectively, which
43     # is bad for us handling multiple versions in a rpm. With
44     # MP_AP_DESTDIR=%i this changes to %i/$APACHE2_ROOT, which will be a
45     # long directory path hardcoded at build time. Therefore, we have to
46     # move these resources back to a sane location and clean up.
47     mv %i/$APACHE2_ROOT/* %i
48     rm -r %i/$(echo $APACHE2_ROOT | sed 's|^/||' | cut -d/ -f1)
49 egeland 1.3
50 egeland 1.5 # Generates the dependencies-setup.{sh,csh} files so that
51     # sourcing init.{sh,csh} picks up also the environment of
52     # dependencies.
53    
54     rm -rf %i/etc/profile.d
55     mkdir -p %i/etc/profile.d
56     echo '#!/bin/sh' > %{i}/etc/profile.d/dependencies-setup.sh
57     echo '#!/bin/tcsh' > %{i}/etc/profile.d/dependencies-setup.csh
58     echo requiredtools `echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'`
59     for tool in `echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'`
60     do
61     case X$tool in
62     Xdistcc|Xccache )
63     ;;
64     * )
65     toolcap=`echo $tool | tr a-z- A-Z_`
66     eval echo ". $`echo ${toolcap}_ROOT`/etc/profile.d/init.sh" >> %{i}/etc/profile.d/dependencies-setup.sh
67     eval echo "source $`echo ${toolcap}_ROOT`/etc/profile.d/init.csh" >> %{i}/etc/profile.d/dependencies-setup.csh
68     ;;
69     esac
70     done
71    
72     perl -p -i -e 's|\. /etc/profile\.d/init\.sh||' %{i}/etc/profile.d/dependencies-setup.sh
73     perl -p -i -e 's|source /etc/profile\.d/init\.csh||' %{i}/etc/profile.d/dependencies-setup.csh
74    
75    
76 egeland 1.3 %post
77     %{relocateConfig}conf/mod_perl2.conf
78 egeland 1.5 %{relocateConfig}etc/profile.d/dependencies-setup.sh
79     %{relocateConfig}etc/profile.d/dependencies-setup.csh