52 lines
1.5 KiB
Bash
Executable File
52 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
BUILD_DIR=`dirname $0`
|
|
# Get coregrade_api root directory
|
|
cd ..
|
|
WORK_DIR=`pwd`
|
|
MAILSEND="$WORK_DIR/src/mailsend"
|
|
LIBCONFIG="$WORK_DIR/src/libconfig-1.3.1"
|
|
# Checking user
|
|
if [ "$USER" = "toor" ]
|
|
then
|
|
# This is legacy reference, we are using system 1.5 now
|
|
echo "Configuring as root"
|
|
LIBCONFIG_PREFIX="/usr"
|
|
# echo "Building $LIBCONFIG ..."
|
|
# cd $LIBCONFIG
|
|
# #echo `pwd` $LIBCONFIG_PREFIX
|
|
# CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --prefix=$LIBCONFIG_PREFIX
|
|
# make
|
|
# make install
|
|
fi
|
|
mkdir $WORK_DIR/logs
|
|
chmod a+w $WORK_DIR/logs
|
|
mkdir $WORK_DIR/src/modules
|
|
# Building mailsend
|
|
cd $MAILSEND
|
|
make
|
|
cp mailsend ../modules/
|
|
# Configure extension
|
|
cd $WORK_DIR/src/
|
|
|
|
# Patch files
|
|
LUSER=$(id -u -n)
|
|
UUSER=$(id -u -n | awk '{print toupper($0)}')
|
|
cat ../build/config.m4 | sed s/coregrade_api/coregrade_api_$LUSER/g | sed s/COREGRADE_API/COREGRADE_API_$UUSER/g > config.m4
|
|
cat ../build/php_coregrade_api_ns.h | sed s/COREGRADE_API/COREGRADE_API_$UUSER/g | sed s/coregrade_api/coregrade_api_$LUSER/g > include/php_coregrade_api_ns.h
|
|
cat ../build/php_coregrade_api.h | sed s/coregrade_api/coregrade_api_$LUSER/g | sed s/COREGRADE_API/COREGRADE_API_$UUSER/g > include/php_coregrade_api.h
|
|
cat ../build/coregrade_api.cc | sed s/tcoregradeapit/coregrade_api_$LUSER/g | sed s/COREGRADE_API/COREGRADE_API_$UUSER/g > core/coregrade_api.cc
|
|
|
|
# Generate extension
|
|
phpize
|
|
./configure
|
|
# --enable-coregrade_api_$LUSER
|
|
#_`id -u -n`
|
|
echo "done."
|
|
cd $BUILD_DIR
|
|
echo $BUILD_DIR
|
|
echo $WORK_DIR
|
|
echo $USER
|
|
|
|
|