@@ -63,6 +63,8 @@ export BIGLINK="$ROOT_PATH/src/tools/biglink"
6363export PIP=$PIP_NAME
6464export VIRTUALENV=$VIRTUALENV_NAME
6565
66+ export COPYLIBS=0
67+
6668MD5SUM=$( which md5sum)
6769if [ " X$MD5SUM " == " X" ]; then
6870 MD5SUM=$( which md5)
@@ -217,6 +219,7 @@ function push_arm() {
217219 export LD=" $TOOLCHAIN_PREFIX -ld"
218220 export STRIP=" $TOOLCHAIN_PREFIX -strip --strip-unneeded"
219221 export MAKE=" make -j5"
222+ export READELF=" $TOOLCHAIN_PREFIX -readelf"
220223
221224 # Use ccache ?
222225 which ccache & > /dev/null
@@ -253,6 +256,10 @@ function usage() {
253256 echo " -f Restart from scratch (remove the current build)"
254257 echo " -x display expanded values (execute 'set -x')"
255258 echo
259+ echo " Advanced:"
260+ echo " -C Copy libraries instead of using biglink"
261+ echo " (may not work before Android 4.3)"
262+ echo
256263 echo " For developers:"
257264 echo " -u 'mod1 mod2' Modules to update (if already compiled)"
258265 echo
@@ -345,6 +352,15 @@ function run_prepare() {
345352 fi
346353 done
347354
355+ if [ " $COPYLIBS " == " 1" ]; then
356+ info " Library files will be copied to the distribution (no biglink)"
357+ error " NOTICE: This option is still beta!"
358+ error " \tIf you encounter an error 'Failed to locate needed libraries!' and"
359+ error " \tthe libraries listed are not supposed to be provided by your app or"
360+ error " \tits dependencies, please submit a bug report at"
361+ error " \thttps://github.com/kivy/python-for-android/issues"
362+ fi
363+
348364 info " Distribution will be located at $DIST_PATH "
349365 if [ -e " $DIST_PATH " ]; then
350366 error " The distribution $DIST_PATH already exist"
@@ -763,7 +779,14 @@ function run_distribute() {
763779 debug " Fill private directory"
764780 try cp -a python-install/lib private/
765781 try mkdir -p private/include/python2.7
766- try mv libs/$ARCH /libpymodules.so private/
782+
783+ if [ " $COPYLIBS " == " 1" ]; then
784+ if [ -s " libs/$ARCH /copylibs" ]; then
785+ try sh -c " cat libs/$ARCH /copylibs | xargs -d'\n' cp -t private/"
786+ fi
787+ else
788+ try mv libs/$ARCH /libpymodules.so private/
789+ fi
767790 try cp python-install/include/python2.7/pyconfig.h private/include/python2.7/
768791
769792 debug " Reduce private directory from unwanted files"
@@ -790,7 +813,11 @@ function run_distribute() {
790813
791814function run_biglink() {
792815 push_arm
793- try $BIGLINK $LIBS_PATH /libpymodules.so $LIBLINK_PATH
816+ if [ " $COPYLIBS " == " 0" ]; then
817+ try $BIGLINK $LIBS_PATH /libpymodules.so $LIBLINK_PATH
818+ else
819+ try $BIGLINK $LIBS_PATH /copylibs $LIBLINK_PATH
820+ fi
794821 pop_arm
795822}
796823
@@ -832,11 +859,16 @@ function arm_deduplicate() {
832859
833860
834861# Do the build
835- while getopts " :hvlfxm :u:d:s" opt; do
862+ while getopts " :hCvlfxm :u:d:s" opt; do
836863 case $opt in
837864 h)
838865 usage
839866 ;;
867+ C)
868+ COPYLIBS=1
869+ LIBLINK=${LIBLINK} -jb
870+ BIGLINK=${BIGLINK} -jb
871+ ;;
840872 l)
841873 list_modules
842874 ;;
0 commit comments