summaryrefslogtreecommitdiff
path: root/tests/prepare.sh
blob: 58fc64694fb8902732fc31394a5e0a834b1ed0c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
#
# do not run this script.
# Create a local copy of the directory with the extension for run without installation
#


EXTDLOC=ext_dir
SO=extfortest.so

if [ $1 ]
then
    SO=$1
fi

EXTDIR=$(php-config --extension-dir)

#echo $EXTDIR

mkdir -p "./$EXTDLOC"
for LIBFILE in `find $EXTDIR -type f -or -type l -name "*.so"`; do

    BN=$(basename $LIBFILE)
    PWD=$(pwd)
    NF="$PWD/$EXTDLOC/$BN"
    
    # if still no exist
    if [ ! -L $NF ];
    then
        if [ -L $LIBFILE ];
        then
            #echo "cp $LIBFILE $NF"
            cp --no-dereference $LIBFILE $NF
        else
            ln -s $LIBFILE $NF
        fi
    else
        :
    fi;
done

# current extention
if [ ! -L "$PWD/$EXTDLOC/$SO" ];
then
    ln -s "$PWD/cpp/$SO" "$PWD/$EXTDLOC/$SO"
fi