Skip to content

Commit 8bc2848

Browse files
committed
You can now build the igraph library with distribute.sh.
1 parent d930da6 commit 8bc2848

File tree

8 files changed

+77
-20
lines changed

8 files changed

+77
-20
lines changed

recipes/c_igraph/Makefile.am.patch

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
68,72d67
2+
< f2c/arith.h: f2c/arithchk.c
3+
< $(CC) $(CFLAGS) -DNO_FPINIT f2c/arithchk.c -lm -o f2c/arith || \
4+
< $(CC) -DNO_LONG_LONG $(CFLAGS) -DNO_FPINIT f2c/arithchk.c \
5+
< $(WARNING_CFLAGS) -lm -o f2c/arith
6+
< f2c/arith > f2c/arith.h

recipes/c_igraph/arith.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#define IEEE_8087
2+
#define Arith_Kind_ASL 1
3+
#define Double_Align
4+
#define NANCHECK
5+
#define QNaN0 0x0
6+
#define QNaN1 0x7ff80000

recipes/c_igraph/makefile.u.patch

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
16d15
2+
< CC = cc
3+
18c17,19
4+
< CFLAGS = -O
5+
---
6+
> CC = $(ANDROIDNDK)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
7+
> LD = $(ANDROIDNDK)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld
8+
> CFLAGS = -DNO_ISATTY -DANDROID -mandroid -I$(ANDROIDNDK)/platforms/android-14/arch-arm/usr/include -L$(ANDROIDNDK)/platforms/android-14/arch-arm/usr/lib -O -fomit-frame-pointer --sysroot $(ANDROIDNDK)/platforms/android-14/arch-arm
9+
23c24
10+
< ld -r -x -o $*.xxx $*.o
11+
---
12+
> $(LD) -E -r -o $*.xxx $*.o

recipes/c_igraph/recipe.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,30 @@ function prebuild_c_igraph() {
2222
true
2323
}
2424

25+
function shouldbuild_c_igraph() {
26+
if [ -e $BUILD_c_igraph/.built ]; then
27+
export DO_BUILD=0;
28+
fi
29+
}
30+
2531
function build_c_igraph() {
2632
cd $BUILD_c_igraph
2733

2834
push_arm
29-
30-
export CPPFLAGS="-I$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include"
31-
try ./configure --prefix="$BUILD_PATH/python-install" --libdir="$BUILD_PATH/libs" --host=arm-gnueabi --with-sysroot="$ANDROIDNDK/sources/cxx-stl/stlport/" --with-external-f2c
35+
try patch $BUILD_c_igraph/src/Makefile.am $RECIPE_c_igraph/Makefile.am.patch
36+
export OLD_CPPFLAGS="$CPPFLAGS"
37+
export CPPFLAGS="$CPPFLAGS -I$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include -I$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include -L$ANDROIDNDK/platforms/android-$ANDROIDAPI/arch-arm/usr/lib"
38+
try ./configure --prefix="$BUILD_PATH/python-install" --build=i686-pc-linux-gnu --host=arm-linux-eabi
39+
export CPPFLAGS="$OLD_CPPFLAGS"
40+
try cp -f $RECIPE_c_igraph/arith.h $BUILD_c_igraph/src/f2c/arith.h
41+
try patch $BUILD_c_igraph/src/f2c/sysdep1.h $RECIPE_c_igraph/sysdep1.h.patch
42+
try patch $BUILD_c_igraph/src/f2c/uninit.c $RECIPE_c_igraph/uninit.c.patch
3243
try patch $BUILD_c_igraph/config.h $RECIPE_c_igraph/config.h.patch
3344
try $MAKE
3445
try $MAKE install
3546

36-
3747
pop_arm
48+
touch .built
3849
}
3950

4051
function postbuild_c_igraph() {

recipes/c_igraph/sysdep1.h.patch

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
16a17
2+
> /*android doesn't like these
3+
18c19,20
4+
< #define OFF_T __off64_t
5+
---
6+
> #define OFF_T __off64_t*/
7+
> #define OFF_T long

recipes/c_igraph/uninit.c.patch

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
276c276,277
2+
< #include <fpu_control.h>
3+
---
4+
> //doesn't exist on Android
5+
> //#include <fpu_control.h>
6+
334a336
7+
> /*
8+
336c338
9+
< #define RQD_FPU_MASK (_FPU_MASK_OM+_FPU_MASK_IM+_FPU_MASK_ZM)
10+
---
11+
> #define RQD_FPU_MASK (_FPU_MASK_OM+_FPU_MASK_IM+_FPU_MASK_ZM)*/
12+
343a346
13+
> /*
14+
345c348
15+
< #define RQD_FPU_MASK (_FPU_MASK_OM+_FPU_MASK_IM+_FPU_MASK_ZM)
16+
---
17+
> #define RQD_FPU_MASK (_FPU_MASK_OM+_FPU_MASK_IM+_FPU_MASK_ZM)*/
18+
350a354
19+
> /*
20+
352c356
21+
< #define RQD_FPU_MASK (_FPU_MASK_O+_FPU_MASK_V+_FPU_MASK_Z)
22+
---
23+
> #define RQD_FPU_MASK (_FPU_MASK_O+_FPU_MASK_V+_FPU_MASK_Z)*/

recipes/igraph/recipe.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,23 @@ RECIPE_igraph=$RECIPES_PATH/igraph
1818

1919

2020
function prebuild_igraph() {
21-
true
21+
patch setup.py $RECIPE_igraph/setup.py.patch
2222
}
2323

2424
function shouldbuild_igraph() {
25-
true
25+
if [ -e $BUILD_igraph/.built ]; then
26+
export DO_BUILD=0;
27+
fi
2628
}
2729

2830
function build_igraph() {
2931
cd $BUILD_igraph
3032
push_arm
3133

32-
patch setup.py $RECIPE_igraph/setup.py.patch
33-
try $HOSTPYTHON setup.py build_ext -p arm-gnueabi -L "$BUILD_PATH/libs" -I "$BUILD_PATH/python-install/include/igraph/" install --root $BUILD_PATH/python-install --install-platlib $BUILD_PATH/python-install/lib/python2.7/lib-dynload
34+
try $HOSTPYTHON setup.py build_ext -I"$BUILD_PATH/python-install/include/igraph:$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi/include" -L"$BUILD_PATH/python-install/lib:$ANDROIDNDK/sources/cxx-stl/gnu-libstdc++/4.4.3/libs/armeabi" -l gnustl_static -p arm-gnueabi install
3435

3536
pop_arm
37+
touch .built
3638
}
3739

3840
function postbuild_igraph() {

src/build.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python2.7
22

3-
from os.path import basename, dirname, join, isfile, realpath, relpath, split
3+
from os.path import dirname, join, isfile, realpath, relpath, split
44
from zipfile import ZipFile
55
import sys
66
sys.path.insert(0, 'buildlib/jinja2.egg')
@@ -164,17 +164,7 @@ def select(fn):
164164
for sd in source_dirs:
165165
sd = realpath(sd)
166166
compile_dir(sd)
167-
for x in listdir(sd):
168-
if select(x):
169-
# symbolic links should go in the archive by the name of the link, not the name of what they point to
170-
try:
171-
realbase = os.readlink(x)
172-
linkbase = basename(x)
173-
realp = realpath(x).replace(realbase, linkbase)
174-
nufile = (x, relpath(realp, sd))
175-
except OSError:
176-
nufile = (x, relpath(realpath(x), sd))
177-
files.append(nufile)
167+
files += [(x, relpath(realpath(x), sd)) for x in listfiles(sd) if select(x)]
178168

179169
# create tar.gz of thoses files
180170
tf = tarfile.open(tfn, 'w:gz')

0 commit comments

Comments
 (0)