forked from phalcon/cphalcon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgo-install
executable file
·64 lines (56 loc) · 1.99 KB
/
pgo-install
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Phalcon Framework
#
# Copyright (c) 2011-2013 Phalcon Team (http://www.phalconphp.com)
#
# This source file is subject to the New BSD License that is bundled
# with this package in the file docs/LICENSE.txt.
#
# If you did not receive a copy of the license and are unable to
# obtain it through the world-wide-web, please send an email
# to [email protected] so we can send you a copy immediately.
#
# Authors: Andres Gutierrez <[email protected]>
# Eduar Carvajal <[email protected]>
export GCC_GENERATE_TEST_COVERAGE_FILES="YES"
export GCC_INSTRUMENT_PROGRAM_FLOW_ARCS="YES"
export CC="gcc"
export CFLAGS="-march=native -mtune=native -O2 -fno-delete-null-pointer-checks -finline-functions -fno-builtin-memcmp -fprofile-generate -lgcov -pg"
echo "int main() {}" > t.c
gcc $CFLAGS t.c -o t 2> t.t
if [ $? != 0 ]; then
chmod +x gcccpuopt
BFLAGS=`./gcccpuopt`
export CFLAGS="-O2 --coverage -fno-delete-null-pointer-checks -finline-functions $BFLAGS -fno-builtin-memcmp -fprofile-generate -lgcov -pg"
gcc $CFLAGS t.c -o t 2> t.t
if [ $? != 0 ]; then
export CFLAGS="-O2 -fno-delete-null-pointer-checks"
fi
fi
if [ $(gcc -dumpversion | cut -f1 -d.) -ge 4 ]; then
gcc $CFLAGS -fvisibility=hidden t.c -o t 2> t.t && export CFLAGS="$CFLAGS -fvisibility=hidden"
fi
#gcc $CFLAGS -flto t.c -o t 2> t.t && { export CFLAGS="$CFLAGS -flto"; export LDFLAGS="$LDFLAGS $CFLAGS"; }
rm -f t.t t.c t
#Check processor architecture
if [ -z $1 ]; then
DIR="32bits"
gcc gccarch.c -o gccarch
if [ -f gccarch ]; then
P64BITS=`./gccarch`
if [ "$P64BITS" == "1" ]; then
DIR="64bits"
fi
fi
else
DIR=$1
fi
#Move to specified architecture
cd $DIR
#Clean current compilation
if [ -f Makefile ]; then
make clean
phpize --clean
fi
#Perform the compilation
phpize && ./configure --enable-phalcon && make && make install && echo -e "\nThanks for compiling Phalcon!\nBuild succeed: Please restart your web server to complete the installation"