Skip to content

Commit db5a7bb

Browse files
author
Bill Janssen
committed
fix pycrypto recipe; add recipe for apsw
1 parent 2180e80 commit db5a7bb

File tree

3 files changed

+120
-3
lines changed

3 files changed

+120
-3
lines changed

recipes/apsw/recipe.sh

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/bin/bash
2+
3+
# version of your package
4+
VERSION_apsw=${VERSION_apsw:-3.8.4.1-r1}
5+
6+
# dependencies of this recipe
7+
DEPS_apsw=(python)
8+
9+
# url of the package
10+
URL_apsw=https://github.com/rogerbinns/apsw/releases/download/3.8.4.1-r1/apsw-3.8.4.1-r1.zip
11+
12+
# md5 of the package
13+
MD5_apsw=5ad3098489576929b90f4215eb5b2621
14+
15+
# default build path
16+
BUILD_apsw=$BUILD_PATH/apsw/$(get_directory $URL_apsw)
17+
18+
# default recipe path
19+
RECIPE_apsw=$RECIPES_PATH/apsw
20+
21+
# function called for preparing source code if needed
22+
# (you can apply patch etc here.)
23+
function prebuild_apsw() {
24+
25+
# fetch sqlite if necessary
26+
cd ${BUILD_apsw}
27+
if [ ! -d ${BUILD_apsw}/sqlite3 ]; then
28+
echo "fetching sqlite..."
29+
# using /usr/bin/python for this
30+
python setup.py fetch --sqlite --version=3.8.4.1 --missing-checksum-ok
31+
fi
32+
33+
# apsw insists on configuring sqlite, but it's for the host, not the target.
34+
# So, put in the correct values.
35+
36+
cat >sqlite3/sqlite3config.h <<EOF
37+
#define HAVE_SYS_TYPES_H 1
38+
#define HAVE_SYS_STAT_H 1
39+
#define HAVE_STDLIB_H 1
40+
#define HAVE_STRING_H 1
41+
#define HAVE_MEMORY_H 1
42+
#define HAVE_STRINGS_H 1
43+
#define HAVE_INTTYPES_H 1
44+
#define HAVE_STDINT_H 1
45+
#define HAVE_UNISTD_H 1
46+
#define HAVE_DLFCN_H 1
47+
#define HAVE_FDATASYNC 0
48+
#define HAVE_USLEEP 1
49+
#define HAVE_LOCALTIME_R 1
50+
#define HAVE_GMTIME_R 1
51+
#define HAVE_DECL_STRERROR_R 1
52+
#define HAVE_STRERROR_R 1
53+
#define HAVE_POSIX_FALLOCATE 0
54+
EOF
55+
56+
}
57+
58+
function shouldbuild_apsw() {
59+
if [ -d "$SITEPACKAGES_PATH/apsw" ]; then
60+
DO_BUILD=0
61+
fi
62+
}
63+
64+
# function called to build the source code
65+
function build_apsw() {
66+
67+
cd ${BUILD_apsw}
68+
69+
export NDK=$ANDROIDNDK
70+
push_arm
71+
72+
# HOSTPYTHON can't do zipfile or tarfile modules because of
73+
# buildozer bug (missing LD_LIBRARY_PATH is what it looks like),
74+
# but we don't need them at this stage
75+
cp setup.py setup.py.backup
76+
sed -e 's/import zipfile, tarfile/# import zipfile, tarfile/g' <setup.py.backup >setup.py
77+
78+
# build python extension
79+
export LDFLAGS="$LDFLAGS -L$LIBS_PATH"
80+
export LDSHARED="$LIBLINK"
81+
82+
echo "building apsw in `pwd`..."
83+
# now we can build; enable the FTS4 sqlite extension for full-text search
84+
try ${HOSTPYTHON} setup.py build --enable=fts4
85+
echo "installing apsw..."
86+
try ${HOSTPYTHON} setup.py install
87+
echo "done with apsw."
88+
89+
pop_arm
90+
}
91+
92+
# function called after all the compile have been done
93+
function postbuild_apsw() {
94+
echo "apsw built"
95+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- pycrypto-2.6.1/src/hash_SHA2_template.c.orig 2013-10-14 14:38:10.000000000 -0700
2+
+++ pycrypto-2.6.1/src/hash_SHA2_template.c 2014-05-19 10:15:51.000000000 -0700
3+
@@ -87,7 +87,7 @@
4+
* return 1 on success
5+
* return 0 if the length overflows
6+
*/
7+
-int add_length(hash_state *hs, sha2_word_t inc) {
8+
+static int add_length(hash_state *hs, sha2_word_t inc) {
9+
sha2_word_t overflow_detector;
10+
overflow_detector = hs->length_lower;
11+
hs->length_lower += inc;

recipes/pycrypto/recipe.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
#!/bin/bash
22

3-
VERSION_pycrypto=${VERSION_pycrypto:-2.5}
3+
VERSION_pycrypto=${VERSION_pycrypto:-2.6.1}
44
URL_pycrypto=http://pypi.python.org/packages/source/p/pycrypto/pycrypto-$VERSION_pycrypto.tar.gz
55
DEPS_pycrypto=(openssl python)
6-
MD5_pycrypto=783e45d4a1a309e03ab378b00f97b291
6+
MD5_pycrypto=55a61a054aa66812daf5161a0d5d7eda
77
BUILD_pycrypto=$BUILD_PATH/pycrypto/$(get_directory $URL_pycrypto)
88
RECIPE_pycrypto=$RECIPES_PATH/pycrypto
99

1010
function prebuild_pycrypto() {
11-
true
11+
cd $BUILD_pycrypto
12+
13+
# check marker in our source build
14+
if [ -f .patched ]; then
15+
# no patch needed
16+
return
17+
fi
18+
19+
try patch -p1 < $RECIPE_pycrypto/patches/add_length.patch
20+
21+
# everything done, touch the marker !
22+
touch .patched
1223
}
1324

1425
function shouldbuild_pycrypto() {

0 commit comments

Comments
 (0)