Current File : /home/inlingua/public_html/decay_sym/root/var/softaculous/apps/perl/build/build/make.sh
#!/bin/bash
source /var/softaculous/apps/build/common.sh

perl=perl-5.20.3
PATH_PERL=$AMPPS_PATH/perl
perldbi=DBI-1.634
perldbd=DBD-mysql-4.033
fastcgi=FCGI-0.74
fastcgiproc=FCGI-ProcManager-0.19
lwp=libwww-perl-6.13
mod_ruid2=mod_ruid2-0.9.7
PATH_APACHE=$AMPPS_PATH/apache
PATH_APACHE2=$AMPPS_PATH/apache2

mod_ruid2(){
	
	is_file $PATH_APACHE"/modules/mod_ruid2.so"
	if [ $? == 0 ]
	then
	
		# Libraries
		getpatchelf
		libcap
		
		banner "Installing modruid2"
		remove_dir $mod_ruid2
		cd $MAIN_SRC
		tar -jxf $mod_ruid2.tar.bz2
		cd $mod_ruid2
		# Installing mod_ruid2
		$PATH_APACHE/bin/apxs -a -i -L $AMPPS_PATH/lib -I $AMPPS_PATH/include -l cap -c mod_ruid2.c >> $LOG 2>&1
	fi
	is_file $PATH_APACHE"/modules/mod_ruid2.so"
	if [ $? == 0 ]
	then
		banner 'mod_ruid2 could not be installed due to some reason'
		exit 1
	fi
	patchelf --set-rpath $AMPPS_PATH/lib $PATH_APACHE/modules/mod_ruid2.so
	
	mkdir -p $PATH_PERL/apache/modules/
	mv $PATH_APACHE"/modules/mod_ruid2.so" $PATH_PERL/apache/modules/
}

mod_ruid2_2(){
	
	is_file $PATH_APACHE2"/modules/mod_ruid2.so"
	if [ $? == 0 ]
	then
	
		# Libraries
		getpatchelf
		libcap
		
		banner "Installing modruid2_2"
		remove_dir $mod_ruid2
		cd $MAIN_SRC
		tar -jxf $mod_ruid2.tar.bz2
		cd $mod_ruid2
		# Installing mod_ruid2
		$PATH_APACHE2/bin/apxs -a -i -L $AMPPS_PATH/lib -I $AMPPS_PATH/include -l cap -c mod_ruid2.c >> $LOG 2>&1
	fi
	is_file $PATH_APACHE2"/modules/mod_ruid2.so"
	if [ $? == 0 ]
	then
		banner 'mod_ruid2_2 could not be installed due to some reason'
		exit 1
	fi
	patchelf --set-rpath $AMPPS_PATH/lib $PATH_APACHE2/modules/mod_ruid2.so

	mkdir -p $PATH_PERL/apache2/modules/
	mv $PATH_APACHE2"/modules/mod_ruid2.so" $PATH_PERL/apache2/modules/
}

perldbi(){
	
	remove_dir $perldbi
	is_file $PATH_PERL"/lib/site_perl/$perl_v/`uname -m`-linux/auto/DBI/DBI.so"
	if [ $? == 0 ]
	then
		banner "Installing PERL DBI"
		cd $MAIN_SRC
		tar -zxf $perldbi.tar.gz
		cd $perldbi		
		$PATH_PERL/bin/perl Makefile.PL && make && make install	>> $LOG 2>&1	
	fi
	is_file $PATH_PERL"/lib/site_perl/$perl_v/`uname -m`-linux/auto/DBI/DBI.so"
	if [ $? == 0 ]
	then
		banner 'PERL DBI could not be installed due to some reason'
		exit 1
	fi	
}

perldbd(){

	#mysql
	remove_dir $perldbd
	is_file $PATH_PERL"/lib/site_perl/$perl_v/`uname -m`-linux/auto/DBD/mysql/mysql.so"
	if [ $? == 0 ]
	then
		banner "Installing PERL DBD Mysql"
		cd $MAIN_SRC
		tar -zxf $perldbd.tar.gz
		cd $perldbd
		
		$PATH_PERL/bin/perl Makefile.PL  --with-mysql=$PATH_MYSQL --mysql_config=$PATH_MYSQL/bin/mysql_config && make && make install >> $LOG 2>&1
	fi
	is_file $PATH_PERL"/lib/site_perl/$perl_v/`uname -m`-linux/auto/DBD/mysql/mysql.so"
	if [ $? == 0 ]
	then
		banner 'PERL DBD Mysql could not be installed due to some reason'
		exit 1
	fi
}

fastcgi(){
	
	remove_dir $fastcgi
	is_file $PATH_PERL"/lib/site_perl/$perl_v/`uname -m`-linux/auto/FCGI/FCGI.so"
	if [ $? == 0 ]
	then
		banner "Installing PERL FCGI"
		cd $MAIN_SRC
		tar -zxf $fastcgi.tar.gz
		cd $fastcgi		
		$PATH_PERL/bin/perl Makefile.PL && make && make install	>> $LOG 2>&1
	fi
	is_file $PATH_PERL"/lib/site_perl/$perl_v/`uname -m`-linux/auto/FCGI/FCGI.so"
	if [ $? == 0 ]
	then
		banner 'PERL FCGI could not be installed due to some reason'
		exit 1
	fi
	
}

fastcgiproc(){
	
	remove_dir $fastcgiproc
	banner "Installing PERL FastCGI"
	cd $MAIN_SRC
	tar -zxf $fastcgiproc.tar.gz
	cd $fastcgiproc		
	$PATH_PERL/bin/perl Makefile.PL && make && make install >> $LOG 2>&1
}

lwp(){
	
	remove_dir $lwp
	banner "Installing PERL LWP"
	cd $MAIN_SRC
	tar -zxf $lwp.tar.gz
	cd $lwp
	$PATH_PERL/bin/perl Makefile.PL && make && make install >> $LOG 2>&1
}

perl() {

	remove_dir $perl
	is_file $PATH_PERL"/bin/perl"
	if [ $? == 0 ]
	then
		banner "Installing PERL"
		cd $MAIN_SRC
		tar -zxf $perl.tar.gz
		cd $perl
		./configure.gnu --prefix=$PATH_PERL && make && make install >> $LOG 2>&1
	fi
	is_file $PATH_PERL"/bin/perl"
	if [ $? == 0 ]
	then
		banner 'PERL could not be installed due to some reason'
		exit 1
	fi
	
	##############
	# MOD RUID2
	##############
	
	mod_ruid2
	
	##############
	# MOD RUID2_2
	##############
	
	mod_ruid2_2
	
	##############
	# DBI
	##############
	
	perldbi
	
	##############
	# DBD
	##############
	
	perldbd
	
	##############
	# FCGI
	##############
	
	fastcgi
	
	##############
	# FCGI-PROc
	##############
	
	fastcgiproc
	
	##############
	# LWP
	##############
	
	lwp
	
	#For wrapper class .ph file
	cd /usr/include/
	$PATH_PERL/bin/h2ph *.h */*.h
	cp /var/softaculous/apps/perl/build/bin/fastcgi-wrapper.pl $PATH_PERL/bin
	chmod 0755  $PATH_PERL/bin/fastcgi-wrapper.pl
	chmod 0755  $PATH_PERL/bin/fastcgi-wrapper.pl
	cp /var/softaculous/apps/perl/build/bin/perl-fcgi $PATH_PERL/bin
	chmod 0755  $PATH_PERL/bin/perl-fcgi
	chmod 0755  $PATH_PERL/bin/perl-fcgi

}

perl