|
| 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 | +} |
0 commit comments