PersistentPerl

 view release on metacpan or  search on metacpan

util/build_package  view on Meta::CPAN

file_dest() {
    echo $* | awk '{
	for (i = 1; i <= NF; ++i) {
	    split($i, a, ":");
	    printf("%s%s", spc, a[2]);
	    spc = " ";
	}
    }'
}

# Copy files from source to dest under a temporary directory.
# If passed 1, then remove the prefix from the dest
copy_pkgfiles() {
    destdir=$1;		shift

    for f in $*; do
	src=`file_source $f`
        dest="${destdir}`file_dest $f`"
	mkdir -p `dirname $dest` 2>/dev/null
	cp -p $src $dest
    done
}

# Remove the install prefix from a full path name
remove_prefix() {
    sed -e "s|^${PREFIX}||" -e 's|^/||'
}

apache_update_file() {
    cat <<-'END'
    	apache_update_file() {
	    cmp $1 $2 >/dev/null 2>&1
	    if test $? -ne 0 -a -s $2; then
		mv -f $1 "$1.$3"
		mv -f $2 $1
		echo $1 was updated - please restart httpd
	    else
		rm -f $2
	    fi
	}
	END
}

# Create script to do apache install after package is installed
apache_install_script() {
    basedir=$1;		shift
    savesuffix=$1;	shift

    cat <<-END
	PREFIX=$PREFIX
	MODULE_DST=$MODULE_DST
	HTTPD_CONF=$HTTPD_CONF
	BASEDIR=$basedir
	SAVESUFFIX=$savesuffix
	APACHE_VERSION=$APACHE_VERSION
	END

    apache_update_file

    cat <<-'END'
	# Get relocated module
	MODULE_DST=`echo $MODULE_DST | sed "s|^${PREFIX}|${BASEDIR}|"`
	if test -w ${HTTPD_CONF}; then
	    (
		grep -v '^[^#].*Module.*mod_persistentperl.*' ${HTTPD_CONF}
		echo "LoadModule persistentperl_module $MODULE_DST"
		if test $APACHE_VERSION -lt 2; then
		    echo "AddModule mod_persistentperl.c"
		fi
	    ) >${HTTPD_CONF}.$$
	    apache_update_file ${HTTPD_CONF} ${HTTPD_CONF}.$$ $SAVESUFFIX
	else
	    echo ${HTTPD_CONF} could not be edited.  Please update it manually.
	fi
	END
}

# Create script to do apache install after package is installed
apache_uninstall_script() {
    cat <<-END
	HTTPD_CONF=${HTTPD_CONF}
	END

    apache_update_file

    cat <<-'END'
	if test -w ${HTTPD_CONF}; then
	    sed -e '/^LoadModule.*mod_persistentperl.so/d' \
		-e '/^AddModule.*mod_persistentperl/d' \
		${HTTPD_CONF} >${HTTPD_CONF}.$$
	    apache_update_file ${HTTPD_CONF} ${HTTPD_CONF}.$$ old
	fi
	END
}

# Put a description entry into the output directory for builing and index later
add_desc() {
    out=$1;		shift
    is_apache=$1;	shift
    os=$1;		shift
    arch=$1;		shift
    (
	echo OS=$os
	echo ARCH=$arch
	echo IS_APACHE=$is_apache
	for d in "$@"; do
	    echo DEPEND=$d
	done
    ) >${out}.desc
}

want_apache_package() {
    test -f $MOD_PERSISTENTPERL_DIR/mod_persistentperl.so
}

# Call the script specific to this system to create the package
case "`uname -a`" in
*BSD*|*bsd*)
    . ./util/build_bsdpkg ;;
*SunOS*)
    . ./util/build_solpkg ;;



( run in 2.220 seconds using v1.01-cache-2.11-cpan-71847e10f99 )