1
1
#! /usr/bin/env bash
2
2
3
- OPTIMIZATION_FLAGS=" -O3 -funroll-loops -fomit-frame-pointer"
4
- # Work around a bug in gcc 4.6.0: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48774
5
- if [ " ` testcc.sh $CC ` " = GCC ] ; then
6
- if $CC -dumpversion 2> /dev/null | grep > /dev/null ' ^4\.6\.[01]' ; then
7
- echo " Warning: Working around bug in gcc 4.6.0"
8
- OPTIMIZATION_FLAGS=" $OPTIMIZATION_FLAGS -fno-ivopts"
9
- fi
10
- fi
11
-
12
- CFLAGS=" $CFLAGS ` testcflags.sh -g $OPTIMIZATION_FLAGS -fPIC -KPIC -Wall` "
13
- CPPFLAGS=" $CPPFLAGS -I$SAGE_LOCAL /include"
14
-
15
- # Compile for 64-bit if SAGE64 is set to 'yes'.
16
- # On 64-bit hardware, we don't need to set this variable to true. A
17
- # 64-bit cliquer library would be built on such platform.
18
- if [ " $SAGE64 " = yes ]; then
19
- echo " Building a 64-bit version of cliquer"
20
- CFLAGS=" $CFLAGS -m64 "
21
- LDFLAGS=" $LDFLAGS -m64 "
22
- fi
23
-
24
- # Flags for building a dynamically linked shared object.
25
- if [ " $UNAME " = " Darwin" ]; then
26
- SAGESOFLAGS=" -dynamiclib -single_module -flat_namespace -undefined dynamic_lookup"
27
- elif [ " $UNAME " = " SunOS" ]; then
28
- SAGESOFLAGS=" -shared -Wl,-h,libcliquer.so -Wl,-ztext"
29
- else
30
- SAGESOFLAGS=" -shared -Wl,-soname,libcliquer.so"
3
+ if [ -z " $SAGE_LOCAL " ]; then
4
+ echo >&2 " SAGE_LOCAL undefined - exiting..."
5
+ echo >&2 " Maybe run 'sage -sh'?"
6
+ exit 1
31
7
fi
32
8
33
- # Export everything
34
- export CFLAGS
35
- export CPPFLAGS
36
- export LDFLAGS
37
- export SAGESOFLAGS
38
-
39
9
cd src
40
10
11
+ echo " Applying patches..."
41
12
# Apply all patches
42
13
for patch in ../patches/* .patch; do
43
14
[ -r " $patch " ] || continue # Skip non-existing or non-readable patches
@@ -49,22 +20,16 @@ for patch in ../patches/*.patch; do
49
20
fi
50
21
done
51
22
52
- $MAKE
23
+ echo " Configuring..."
24
+ ./configure --prefix=" $SAGE_LOCAL " --disable-static --libdir=" $SAGE_LOCAL /lib"
53
25
if [ $? -ne 0 ]; then
54
- echo >&2 " Failed to compile cliquer"
55
- exit 1
26
+ echo >&2 " Error configuring cliquer"
27
+ exit 1
56
28
fi
57
29
58
- rm -rf " $SAGE_LOCAL /include/cliquer/"
59
- mkdir -p " $SAGE_LOCAL /include/cliquer/"
60
- cp * .h " $SAGE_LOCAL /include/cliquer/"
61
-
62
- if [ " $UNAME " = " Darwin" ]; then
63
- cp -f libcliquer.so " $SAGE_LOCAL /lib/libcliquer.dylib"
64
- install_name_tool -id " ${SAGE_LOCAL} " /lib/libcliquer.dylib " ${SAGE_LOCAL} " /lib/libcliquer.dylib
65
- elif [ " $UNAME " = " CYGWIN" ]; then
66
- cp -f libcliquer.so " $SAGE_LOCAL /lib/libcliquer.dll"
30
+ echo " Building and installing ..."
31
+ $MAKE install
32
+ if [ $? -ne 0 ]; then
33
+ echo >&2 " Error installing cliquer"
34
+ exit 1
67
35
fi
68
-
69
- # Copy this in all cases, in any case it doesn't hurt.
70
- cp -f libcliquer.so " $SAGE_LOCAL /lib/libcliquer.so"
0 commit comments