forked from kevinlekiller/simple_php_yenc_decode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
arch.sh
executable file
·49 lines (38 loc) · 1.53 KB
/
arch.sh
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/sh
sudo pacman -S --needed gcc boost
gcc `php-config --includes` -fpic -c source/yenc_decode_wrap.cpp
if [ ! -e yenc_decode_wrap.o ]; then
echo "Error creating yenc_decode_wrap.o!"
exit 1
fi
gcc -fpic -c source/yenc_decode.cpp -lboost_regex
if [ ! -e yenc_decode.o ]; then
echo "Error creating yenc_decode.o!"
exit 2
fi
EXTENSIONS=`php-config --extension-dir`
if [ ! -e ${EXTENSIONS} ]; then
echo "Error locating extensions directory ${EXTENSIONS}!"
exit 3
fi
sudo gcc -shared *.o -o ${EXTENSIONS}/simple_php_yenc_decode.so -lboost_regex
rm yenc_decode.o
rm yenc_decode_wrap.o
if [ ! -e ${EXTENSIONS}/simple_php_yenc_decode.so ]; then
echo "Error creating ${EXTENSIONS}/simple_php_yenc_decode.so!"
exit 4
else
echo "The extension was compiled successfully."
fi
if [ -e /etc/php/conf.d/simple_php_yenc_decode.ini ]; then
echo "Error: This file (/etc/php/conf.d/simple_php_yenc_decode.ini) already exists, if the contents look like this (change it if not): extension=${EXTENSIONS}/simple_php_yenc_decode.so"
exit 5
else
sudo echo "extension=${EXTENSIONS}/simple_php_yenc_decode.so" > ./simple_php_yenc_decode.ini
sudo mv ./simple_php_yenc_decode.ini /etc/php/conf.d/simple_php_yenc_decode.ini
if [ ! -e /etc/php/conf.d/simple_php_yenc_decode.ini ]; then
echo "Error creating (/etc/php/conf.d/simple_php_yenc_decode.ini). You can manually make this file and put this content in it: extension=${EXTENSIONS}/simple_php_yenc_decode.so"
exit 6
fi
echo "Everything was successful, you should now be able to use the extension in PHP."
fi