Added Python3. (Still testing integration)
This commit is contained in:
@@ -11,7 +11,9 @@ ICU := $(foreach ARCH, $(ARCHES32), $(foreach NAME, $(ICU_LIBS), icuuc/lib/$(ARC
|
||||
|
||||
OPENSSL := $(foreach ARCH, $(ARCHES32) $(ARCHES64), openssl/lib-$(ARCH)/libcrypto.so.sdl.1.so openssl/lib-$(ARCH)/libssl.so.sdl.1.so)
|
||||
|
||||
LIBS := $(ICONV) $(ICU) $(OPENSSL)
|
||||
PYTHON3 := $(foreach ARCH, $(ARCHES32) $(ARCHES64), python3/lib-$(ARCH)/libcrypto.so.sdl.1.so python3/lib-$(ARCH)/libssl.so.sdl.1.so)
|
||||
|
||||
LIBS := $(ICONV) $(ICU) $(OPENSSL) $(PYTHON3)
|
||||
|
||||
prebuilt-libraries: $(LIBS)
|
||||
|
||||
@@ -32,3 +34,6 @@ $(ICONV) $(ICU):
|
||||
|
||||
$(OPENSSL):
|
||||
cd openssl && ./compile.sh
|
||||
|
||||
$(PYTHON3):
|
||||
cd python3 && ./compile.sh
|
||||
|
||||
@@ -7,10 +7,10 @@ AppName="Commander Genius"
|
||||
AppFullName=net.sourceforge.clonekeenplus
|
||||
|
||||
# Application version code (integer)
|
||||
AppVersionCode=195300
|
||||
AppVersionCode=195600
|
||||
|
||||
# Application user-visible version name (string)
|
||||
AppVersionName="1.9.5.3 Beta"
|
||||
AppVersionName="1.9.6.0 Beta"
|
||||
|
||||
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
|
||||
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
|
||||
@@ -208,8 +208,8 @@ AppMinimumRAM=64
|
||||
|
||||
# Optional shared libraries to compile - removing some of them will save space
|
||||
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
|
||||
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
|
||||
CompiledLibraries="sdl_image boost_system crypto ssl curl vorbis ogg"
|
||||
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python python3 boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
|
||||
CompiledLibraries="sdl_image boost_system crypto ssl curl vorbis ogg python3"
|
||||
|
||||
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
|
||||
CustomBuildScript=n
|
||||
@@ -221,7 +221,7 @@ AppCflags='-frtti -fexceptions -finline-functions -DOGG=1 -DDOWNLOADER=1 -DANDRO
|
||||
# Additional LDFLAGS for application
|
||||
#AppLdflags='-ltremor'
|
||||
#AppLdflags='-lvorbis -logg -lcrypto -lssl -lcurl'
|
||||
AppLdflags='-lz -lvorbis -logg'
|
||||
AppLdflags='-lz -lvorbis -logg -lpython3'
|
||||
|
||||
# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable
|
||||
AppOverlapsSystemHeaders=
|
||||
|
||||
Submodule project/jni/application/commandergenius/commandergenius updated: d4dfb21891...cff9a59183
Submodule project/jni/application/vice/vice updated: 9f2803c7ab...0b817c357e
Submodule project/jni/boost/src updated: bc9ea9d303...5824acb451
23
project/jni/python3/Android.mk
Normal file
23
project/jni/python3/Android.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
LOCAL_PATH:=$(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := $(notdir $(LOCAL_PATH))
|
||||
LOCAL_MODULE_FILENAME := lib$(notdir $(LOCAL_PATH)).so.sdl.1 # It clashes with system libcrypto and libssl in Android 4.3 and older
|
||||
|
||||
|
||||
ifneq (python3,$(LOCAL_MODULE))
|
||||
ifneq ($(filter arm mips x86 arm64, $(TARGET_ARCH)),)
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_SRC_FILES := lib-$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so.sdl.1.so
|
||||
LOCAL_BUILT_MODULE := # This fixes a bug in NDK r10d
|
||||
|
||||
# NDK is buggy meh
|
||||
obj/local/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so.sdl.0.so: $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
|
||||
cp -f $< $@
|
||||
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
endif
|
||||
endif
|
||||
98
project/jni/python3/Makefile
Normal file
98
project/jni/python3/Makefile
Normal file
@@ -0,0 +1,98 @@
|
||||
## Setup.
|
||||
|
||||
all: build
|
||||
|
||||
# Get configuration.
|
||||
mk/env.mk: env
|
||||
@bash --noprofile --norc -c 'source ./env; set -o posix; set' | egrep '^(ANDROID|SDK|NDK|BUILD|TEST|PYTHON)_' > $@
|
||||
-include mk/env.mk
|
||||
|
||||
# A formula.
|
||||
define formula
|
||||
$1: $1-$2
|
||||
|
||||
#$1-$2: ndk $3
|
||||
$1-$2: $3
|
||||
$$(info Checking $1 $2 sources...)
|
||||
@wget -N -P "src/" -i "mk/$1/$2/sources.txt"
|
||||
ifeq ("$$(wildcard build/.built-$(BUILD_IDENTIFIER)/$1-$2)","")
|
||||
$$(info Building $1 $2...)
|
||||
@bash --noprofile --norc mk/build_single.sh $1 $2
|
||||
@mkdir -p build/.built-$(BUILD_IDENTIFIER)
|
||||
@touch build/.built-$(BUILD_IDENTIFIER)/$1-$2
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
## Building.
|
||||
|
||||
build: python_modules python
|
||||
|
||||
# Main Python.
|
||||
$(eval $(call formula,python,3.4.3))
|
||||
|
||||
# Optional Python modules.
|
||||
python_modules: $(foreach mod,$(subst ',,$(PYTHON_OPTIONAL_MODULES)),python_$(mod))
|
||||
|
||||
# Python lzma support.
|
||||
$(eval $(call formula,xz,5.2.1))
|
||||
python_lzma: xz
|
||||
|
||||
# Python bzip2 support.
|
||||
$(eval $(call formula,bzip2,1.0.6))
|
||||
python_bz2: bzip2
|
||||
|
||||
# Python readline support.
|
||||
$(eval $(call formula,readline,6.3))
|
||||
python_readline: readline
|
||||
|
||||
# Python SSL support.
|
||||
$(eval $(call formula,openssl,1.0.2d))
|
||||
python_ssl: openssl
|
||||
|
||||
# Python curses support.
|
||||
$(eval $(call formula,ncurses,5.9))
|
||||
python_curses: ncurses
|
||||
|
||||
# Python SQLite support.
|
||||
$(eval $(call formula,sqlite,3.8.10.2))
|
||||
python_sqlite3: sqlite
|
||||
|
||||
# Python (g)dbm support.
|
||||
$(eval $(call formula,gdbm,1.11))
|
||||
python_gdbm: gdbm
|
||||
|
||||
|
||||
# Android NDK.
|
||||
#ndk:
|
||||
# $(info Checking NDK sources...)
|
||||
# @wget -N -P "sdk/" $(shell bash mk/ndk_source.sh)
|
||||
#ifeq ("$(wildcard build/.built-ndk-$(BUILD_IDENTIFIER))","")
|
||||
# $(info Preparing NDK toolchain...)
|
||||
# @bash --noprofile --norc mk/build_ndk.sh
|
||||
# @touch build/.built-ndk-$(BUILD_IDENTIFIER)
|
||||
#endif
|
||||
|
||||
|
||||
## Cleaning.
|
||||
|
||||
clean: clean_generated clean_builds
|
||||
@rm -rf "$(ANDROID_TEST_PREFIX)"
|
||||
@rm -rf "$(ANDROID_TOOL_PREFIX)"
|
||||
|
||||
clean_generated:
|
||||
@find ./src -mindepth 1 -maxdepth 1 -type d -exec rm -rf "{}" \;
|
||||
|
||||
clean_builds:
|
||||
@rm -rf "$(ANDROID_PREFIX)"
|
||||
|
||||
|
||||
## Testing.
|
||||
|
||||
test: test_setup
|
||||
@bash --noprofile --norc mk/test.sh
|
||||
|
||||
test_setup:
|
||||
ifeq ("$(wildcard build-vm/$(TEST_IDENTIFIER))","")
|
||||
@bash --noprofile --norc mk/test_setup.sh
|
||||
endif
|
||||
60
project/jni/python3/compile.sh
Executable file
60
project/jni/python3/compile.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
|
||||
#ARCH_LIST="arm64-v8a x86 mips armeabi-v7a armeabi"
|
||||
|
||||
ARCH_LIST="armeabi"
|
||||
|
||||
mkdir -p build
|
||||
|
||||
build() {
|
||||
ARCH=$1
|
||||
case $ARCH in
|
||||
armeabi-v7a)
|
||||
CONFIGURE_ARCH=android-armv7;;
|
||||
armeabi)
|
||||
CONFIGURE_ARCH=android;;
|
||||
arm64-v8a)
|
||||
CONFIGURE_ARCH=android;;
|
||||
*)
|
||||
CONFIGURE_ARCH=android-$ARCH;;
|
||||
esac
|
||||
|
||||
# rm -rf build/$ARCH
|
||||
# mkdir -p build/$ARCH
|
||||
# cd build/$ARCH
|
||||
|
||||
# echo ac_cv_file__dev_ptmx=no > ./config.site
|
||||
# echo ac_cv_file__dev_ptc=no >> ./config.site
|
||||
# export CONFIG_SITE=config.site
|
||||
|
||||
# tar -x -v -J -f ../../Python-3.5.2.tar.xz --strip=1
|
||||
#sed -i.old 's/-Wl,-soname=[$][$]SHLIB[$][$]SHLIB_SOVER[$][$]SHLIB_SUFFIX//g' Makefile.shared
|
||||
# ../../setCrossEnvironment-$ARCH.sh ./configure --prefix=`pwd`/dist --host=arm-linux-androideabi --build=x64-unknown-linux --disable-ipv6 CFLAGS="-DANDROID -DPY_FORMAT_LONG_LONG" || exit 1
|
||||
|
||||
# --host=$CONFIGURE_ARCH
|
||||
|
||||
#CONFIG_SITE=config.site ./configure --build=x86-unknown-linux-gnu --host=$CROSS_COMPILE --disable-ipv6 LDFLAGS="-Wl,--allow-shlib-undefined -L$SYSROOT/usr/lib" CFLAGS="-mandroid -fomit-frame-pointer --sysroot $SYSROOT"
|
||||
|
||||
# ../../setCrossEnvironment-$ARCH.sh make CALC_VERSIONS='SHLIB_COMPAT=; SHLIB_SOVER=.sdl.1.so'
|
||||
|
||||
# cd ../..
|
||||
|
||||
# rm -rf lib-$ARCH
|
||||
# mkdir -p lib-$ARCH
|
||||
# cp build/$ARCH/libcrypto.so.sdl.1.so lib-${ARCH}/libcrypto.so.sdl.1.so || exit 1
|
||||
./setCrossEnvironment-$ARCH.sh make
|
||||
}
|
||||
|
||||
PIDS=""
|
||||
for ARCH in $ARCH_LIST; do
|
||||
build $ARCH &
|
||||
PIDS="$PIDS $!"
|
||||
done
|
||||
|
||||
for PID in $PIDS; do
|
||||
wait $PID || exit 1
|
||||
done
|
||||
|
||||
# Provide includes for the to be built apps
|
||||
rm -rf include
|
||||
cp -r -L build/armeabi-v7a/include ./ || exit 1
|
||||
65
project/jni/python3/env
Normal file
65
project/jni/python3/env
Normal file
@@ -0,0 +1,65 @@
|
||||
export BASE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Directories.
|
||||
export NDK_PATH=~/apps/android-dev/android-ndk-r13b
|
||||
export ANDROID_PREFIX="${NDK_PATH}/build"
|
||||
export ANDROID_TOOL_PREFIX="${NDK_PATH}/build-tools"
|
||||
export ANDROID_TEST_PREFIX="${NDK_PATH}/build-vm"
|
||||
|
||||
|
||||
# SDKs and target platforms.
|
||||
export NDK_REL=android-ndk-r13b
|
||||
export SDK_REL=android-sdk-r24.0.2
|
||||
export NDK_REV=13b
|
||||
export SDK_REV=24.0.2
|
||||
export ANDROID_API_LEVEL=21
|
||||
export ANDROID_PLATFORM=arm
|
||||
export ANDROID_COMPILER=4.9
|
||||
export ANDROID_HOST=x86_64-pc-linux-gnu
|
||||
export ANDROID_AGREE_LICENSE_TERMS=n
|
||||
|
||||
# Testing.
|
||||
export ANDROID_VM_NAME=PythonTesting
|
||||
export ANDROID_EMULATOR_TESTDIR="/data/py3"
|
||||
export ANDROID_EMULATOR_OPTIONS=""
|
||||
#-no-window -no-skin -no-boot-anim"
|
||||
|
||||
# Compile flags.
|
||||
export CFLAGS_EXTRA=""
|
||||
export CPPFLAGS_EXTRA=""
|
||||
export CXXFLAGS_EXTRA=""
|
||||
export LDFLAGS_EXTRA=""
|
||||
export MAKEOPTS_EXTRA=""
|
||||
|
||||
# Python optional modules.
|
||||
# Available:
|
||||
# bz2 - enable the bz2 module and the bzip2 codec (builds bzip2).
|
||||
# lzma - enable the lzma module and the lzma codec (builds xz).
|
||||
# ssl - enable the ssl module and SSL/TLS support for sockets (builds OpenSSL).
|
||||
# readline - enable the readline module and command history/the like in the REPL (builds Readline).
|
||||
# curses - enable the curses module (builds ncursesw).
|
||||
# sqlite3 - enable the sqlite3 module (builds SQLite).
|
||||
# gdbm - enable the dbm/gdbm modules (builds GDBM).
|
||||
export PYTHON_OPTIONAL_MODULES="bz2 lzma ssl"
|
||||
|
||||
# Do no touch unless you know what you are doing.
|
||||
case "${ANDROID_PLATFORM}" in
|
||||
arm)
|
||||
export ANDROID_TARGET=arm-linux-androideabi
|
||||
export ANDROID_TOOLCHAIN="arm-linux-androideabi-${ANDROID_COMPILER}"
|
||||
;;
|
||||
mips)
|
||||
export ANDROID_TARGET=mipsel-linux-android
|
||||
export ANDROID_TOOLCHAIN="mipsel-linu-android-${ANDROID_COMPILER}"
|
||||
;;
|
||||
x86)
|
||||
export ANDROID_TARGET=i686-linux-android
|
||||
export ANDROID_TOOLCHAIN="x86-${ANDROID_COMPILER}"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown Android platform: ${ANDROID_PLATFORM}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
export BUILD_IDENTIFIER="${NDK_REV}-${ANDROID_API_LEVEL}-${ANDROID_TOOLCHAIN}"
|
||||
export TEST_IDENTIFIER="${SDK_REV}-${ANDROID_API_LEVEL}-${ANDROID_PLATFORM}"
|
||||
54
project/jni/python3/mk/build_ndk.sh
Executable file
54
project/jni/python3/mk/build_ndk.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
source ./env
|
||||
|
||||
# Stolen from https://github.com/rust-lang/rust/blob/2e2f53fad/configure#L345.
|
||||
case $(uname -m) in
|
||||
i386 | i486 | i686 | i786 | x86)
|
||||
NDK_ARCH="x86"
|
||||
;;
|
||||
x86-64 | x86_64 | x64 | amd64)
|
||||
NDK_ARCH="x86_64"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown architecture: $(uname -m)."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
[[ ! -d "${ANDROID_PREFIX}/.built-${BUILD_IDENTIFIER}" ]] && (mkdir -p "${ANDROID_PREFIX}/.built-${BUILD_IDENTIFIER}" || exit 1)
|
||||
[[ ! -d "${ANDROID_TOOL_PREFIX}/${BUILD_IDENTIFIER}" ]] && (mkdir -p "${ANDROID_TOOL_PREFIX}/${BUILD_IDENTIFIER}" || exit 1)
|
||||
|
||||
|
||||
case "${NDK_REV}" in
|
||||
10*)
|
||||
NDK_ARCHIVE="${BASE}/sdk/android-ndk-r${NDK_REV}-$(uname -s | tr '[A-Z]' '[a-z]')-${NDK_ARCH}.bin"
|
||||
if [[ ! -d "${BASE}/sdk/${NDK_REL}" ]]; then
|
||||
chmod +x "${NDK_ARCHIVE}" || exit 1
|
||||
pushd "${BASE}/sdk"
|
||||
# Self-extracting binary.
|
||||
"${NDK_ARCHIVE}" || exit 1
|
||||
popd
|
||||
fi
|
||||
;;
|
||||
13*)
|
||||
NDK_ARCHIVE="$BASE/sdk/android-ndk-r${NDK_REV}-$(uname -s | tr '[A-Z]' '[a-z]')-${NDK_ARCH}.zip"
|
||||
if [[ ! -d "${BASE}/sdk/${NDK_REL}" ]]; then
|
||||
# Zip archive.
|
||||
pushd "${BASE}/sdk"
|
||||
unzip "${NDK_ARCHIVE}" || exit 1
|
||||
popd
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
NDK_ARCHIVE="$BASE/sdk/android-ndk-r${NDK_REV}-$(uname -s | tr '[A-Z]' '[a-z]')-${NDK_ARCH}.tar.bz2"
|
||||
if [[ ! -d "${BASE}/sdk/${NDK_REL}" ]]; then
|
||||
# Tar archive.
|
||||
tar -xf "${NDK_ARCHIVE}" -C "${BASE}/sdk" || exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ! -f "${ANDROID_PREFIX}/.built-ndk-${BUILD_IDENTIFIER}" ]]; then
|
||||
("${BASE}/sdk/${NDK_REL}/build/tools/make-standalone-toolchain.sh" --force --platform="android-${ANDROID_API_LEVEL}" --install-dir="${ANDROID_TOOL_PREFIX}/${BUILD_IDENTIFIER}" --toolchain="${ANDROID_TOOLCHAIN}" &&\
|
||||
touch "${ANDROID_PREFIX}/.built-ndk-${BUILD_IDENTIFIER}") || exit 1
|
||||
fi
|
||||
44
project/jni/python3/mk/build_single.sh
Executable file
44
project/jni/python3/mk/build_single.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
source ./env
|
||||
[[ ! -d "${ANDROID_PREFIX}/${BUILD_IDENTIFIER}" ]] && (mkdir -p "${ANDROID_PREFIX}/${BUILD_IDENTIFIER}" || exit 1)
|
||||
[[ ! -d "${ANDROID_PREFIX}/${BUILD_IDENTIFIER}/include" ]] && (mkdir "${ANDROID_PREFIX}/${BUILD_IDENTIFIER}/include" || exit 1)
|
||||
|
||||
export PATH="${ANDROID_TOOL_PREFIX}/${BUILD_IDENTIFIER}/bin:${PATH}"
|
||||
export PREFIX="${ANDROID_PREFIX}/${BUILD_IDENTIFIER}"
|
||||
export TOOL_PREFIX="${ANDROID_TOOL_PREFIX}/${BUILD_IDENTIFIER}"
|
||||
export HOST="${ANDROID_HOST}"
|
||||
export TARGET="${ANDROID_TARGET}"
|
||||
|
||||
export NDK_ROOT="${BASE}/sdk/${NDK_REL}"
|
||||
export SDK_ROOT="${BASE}/sdk/${SDK_REL}"
|
||||
export NDK_PLATFORM="android-${NDK_REV}"
|
||||
export SDK_PLATFORM="android-${SDK_REV}"
|
||||
export cross="${ANDROID_TARGET}-"
|
||||
|
||||
export PLATFORMVER="android-24"
|
||||
export PREFIX="$NDK_PATH/platforms/$PLATFORMVER/arch-arm/usr"
|
||||
|
||||
export CFLAGS="--sysroot ${TOOL_PREFIX}/sysroot -I${PREFIX}/include -I${TOOL_PREFIX}/include -DANDROID -mandroid ${CFLAGS_EXTRA}"
|
||||
export CPPFLAGS="${CFLAGS} ${CPPFLAGS_EXTRA}"
|
||||
export CXXFLAGS="${CFLAGS} ${CXXFLAGS_EXTRA}"
|
||||
export LDFLAGS="--sysroot ${TOOL_PREFIX}/sysroot -L${PREFIX}/lib -L${TOOL_PREFIX}/lib ${LDFLAGS_EXTRA}"
|
||||
|
||||
export CC="${ANDROID_TARGET}-gcc"
|
||||
export CXX="${ANDROID_TARGET}-g++"
|
||||
export CPP="${ANDROID_TARGET}-cpp"
|
||||
export AR="${ANDROID_TARGET}-ar"
|
||||
export AS="${ANDROID_TARGET}-ls"
|
||||
export LD="${ANDROID_TARGET}-ld"
|
||||
export OBJCOPY="${ANDROID_TARGET}-objcopy"
|
||||
export OBJDUMP="${ANDROID_TARGET}-objdump"
|
||||
export RANLIB="${ANDROID_TARGET}-ranlib"
|
||||
export STRIP="${ANDROID_TARGET}-strip"
|
||||
|
||||
export NAME="$1"
|
||||
export VERSION="$2"
|
||||
export PACKAGE="${NAME}-${VERSION}"
|
||||
export FILESDIR="${BASE}/mk/${NAME}/${VERSION}"
|
||||
|
||||
pushd "${BASE}" > /dev/null
|
||||
. "${FILESDIR}/build.sh" || exit 1
|
||||
popd > /dev/null
|
||||
13
project/jni/python3/mk/bzip2/1.0.6/build.sh
Normal file
13
project/jni/python3/mk/bzip2/1.0.6/build.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
pushd src >/dev/null
|
||||
|
||||
rm -rf "${PACKAGE}"
|
||||
tar -xf "${PACKAGE}.tar.gz" || exit 1
|
||||
pushd "${PACKAGE}" >/dev/null
|
||||
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-makefile-env.patch" || exit 1
|
||||
make clean || exit 1
|
||||
make libbz2.a || exit 1
|
||||
make install_libbz2.a || exit 1
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
@@ -0,0 +1,66 @@
|
||||
diff -ru bzip2-1.0.6/Makefile bzip2-1.0.6-p/Makefile
|
||||
--- bzip2-1.0.6/Makefile 2010-09-10 22:46:02.000000000 +0000
|
||||
+++ bzip2-1.0.6-p/Makefile 2014-01-20 01:35:53.252736910 +0000
|
||||
@@ -15,16 +15,16 @@
|
||||
SHELL=/bin/sh
|
||||
|
||||
# To assist in cross-compiling
|
||||
-CC=gcc
|
||||
-AR=ar
|
||||
-RANLIB=ranlib
|
||||
+CC?=gcc
|
||||
+AR?=ar
|
||||
+RANLIB?=ranlib
|
||||
LDFLAGS=
|
||||
|
||||
BIGFILES=-D_FILE_OFFSET_BITS=64
|
||||
-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
|
||||
+CFLAGS+=-Wall -Winline -O2 -g $(BIGFILES)
|
||||
|
||||
# Where you want it installed when you do 'make install'
|
||||
-PREFIX=/usr/local
|
||||
+PREFIX?=/usr/local
|
||||
|
||||
|
||||
OBJS= blocksort.o \
|
||||
@@ -69,12 +69,10 @@
|
||||
cmp sample3.tst sample3.ref
|
||||
@cat words3
|
||||
|
||||
-install: bzip2 bzip2recover
|
||||
+install: bzip2 bzip2recover install_libz2.a
|
||||
if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi
|
||||
- if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
|
||||
if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi
|
||||
if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi
|
||||
- if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
|
||||
cp -f bzip2 $(PREFIX)/bin/bzip2
|
||||
cp -f bzip2 $(PREFIX)/bin/bunzip2
|
||||
cp -f bzip2 $(PREFIX)/bin/bzcat
|
||||
@@ -85,10 +83,6 @@
|
||||
chmod a+x $(PREFIX)/bin/bzip2recover
|
||||
cp -f bzip2.1 $(PREFIX)/man/man1
|
||||
chmod a+r $(PREFIX)/man/man1/bzip2.1
|
||||
- cp -f bzlib.h $(PREFIX)/include
|
||||
- chmod a+r $(PREFIX)/include/bzlib.h
|
||||
- cp -f libbz2.a $(PREFIX)/lib
|
||||
- chmod a+r $(PREFIX)/lib/libbz2.a
|
||||
cp -f bzgrep $(PREFIX)/bin/bzgrep
|
||||
ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
|
||||
ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
|
||||
@@ -108,6 +102,14 @@
|
||||
echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1
|
||||
echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1
|
||||
|
||||
+install_libbz2.a: libbz2.a
|
||||
+ if ( test ! -d $(PREFIX)/inclue ) ; then mkdir -p $(PREFIX)/include ; fi
|
||||
+ if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
|
||||
+ cp -f bzlib.h $(PREFIX)/include
|
||||
+ chmod a+r $(PREFIX)/include/bzlib.h
|
||||
+ cp -f libbz2.a $(PREFIX)/lib
|
||||
+ chmod a+r $(PREFIX)/lib/libbz2.a
|
||||
+
|
||||
clean:
|
||||
rm -f *.o libbz2.a bzip2 bzip2recover \
|
||||
sample1.rb2 sample2.rb2 sample3.rb2 \
|
||||
|
||||
1
project/jni/python3/mk/bzip2/1.0.6/sources.txt
Normal file
1
project/jni/python3/mk/bzip2/1.0.6/sources.txt
Normal file
@@ -0,0 +1 @@
|
||||
http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
|
||||
22
project/jni/python3/mk/env.mk
Normal file
22
project/jni/python3/mk/env.mk
Normal file
@@ -0,0 +1,22 @@
|
||||
ANDROID_AGREE_LICENSE_TERMS=n
|
||||
ANDROID_API_LEVEL=21
|
||||
ANDROID_COMPILER=4.9
|
||||
ANDROID_DEV=/home/gerstrong/apps/android-dev/android-ndk-r13b/platforms/android-14/arch-arm/usr
|
||||
ANDROID_EMULATOR_OPTIONS=
|
||||
ANDROID_EMULATOR_TESTDIR=/data/py3
|
||||
ANDROID_HOST=x86_64-pc-linux-gnu
|
||||
ANDROID_PLATFORM=arm
|
||||
ANDROID_PREFIX=/home/gerstrong/apps/android-dev/android-ndk-r13b/build
|
||||
ANDROID_TARGET=arm-linux-androideabi
|
||||
ANDROID_TEST_PREFIX=/home/gerstrong/apps/android-dev/android-ndk-r13b/build-vm
|
||||
ANDROID_TOOLCHAIN=arm-linux-androideabi-4.9
|
||||
ANDROID_TOOL_PREFIX=/home/gerstrong/apps/android-dev/android-ndk-r13b/build-tools
|
||||
ANDROID_VM_NAME=PythonTesting
|
||||
BUILD_IDENTIFIER=13b-21-arm-linux-androideabi-4.9
|
||||
NDK_PATH=/home/gerstrong/apps/android-dev/android-ndk-r13b
|
||||
NDK_REL=android-ndk-r13b
|
||||
NDK_REV=13b
|
||||
PYTHON_OPTIONAL_MODULES='bz2 lzma ssl'
|
||||
SDK_REL=android-sdk-r24.0.2
|
||||
SDK_REV=24.0.2
|
||||
TEST_IDENTIFIER=24.0.2-21-arm
|
||||
13
project/jni/python3/mk/gdbm/1.11/build.sh
Normal file
13
project/jni/python3/mk/gdbm/1.11/build.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
pushd src >/dev/null
|
||||
|
||||
rm -rf "${PACKAGE}"
|
||||
tar -xf "${PACKAGE}.tar.gz" || exit 1
|
||||
pushd "${PACKAGE}" >/dev/null
|
||||
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-android-winsize.patch"
|
||||
./configure --prefix="${PREFIX}" --host="${TARGET}" --build="${HOST}" --enable-libgdbm-compat || exit 1
|
||||
make || exit 1
|
||||
make install || exit 1
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -ru gdbm-1.11/src/gdbmtool.c gdbm-1.11-android/src/gdbmtool.c
|
||||
--- gdbm-1.11/src/gdbmtool.c 2013-05-21 21:48:31.000000000 +0200
|
||||
+++ gdbm-1.11-android/src/gdbmtool.c 2014-08-05 15:35:51.000000000 +0200
|
||||
@@ -302,7 +302,7 @@
|
||||
int
|
||||
get_screen_lines ()
|
||||
{
|
||||
-#ifdef TIOCGWINSZ
|
||||
+#if defined(TIOCGWINSZ) && !__ANDROID__
|
||||
if (isatty (1))
|
||||
{
|
||||
struct winsize ws;
|
||||
1
project/jni/python3/mk/gdbm/1.11/sources.txt
Normal file
1
project/jni/python3/mk/gdbm/1.11/sources.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://ftp.gnu.org/gnu/gdbm/gdbm-1.11.tar.gz
|
||||
16
project/jni/python3/mk/ncurses/5.9/build.sh
Normal file
16
project/jni/python3/mk/ncurses/5.9/build.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
pushd src >/dev/null
|
||||
|
||||
rm -rf "${PACKAGE}"
|
||||
tar -xf "${PACKAGE}.tar.gz" || exit 1
|
||||
pushd "${PACKAGE}" >/dev/null
|
||||
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-android-locale-fixes.patch"
|
||||
./configure --prefix="${PREFIX}" --host="${TARGET}" --build="${HOST}" --without-ada --without-manpages --without-progs --without-tests --with-termlib --enable-termcap --enable-widec --disable-database --disable-home-terminfo || exit 1
|
||||
make || exit 1
|
||||
make install || exit 1
|
||||
# Fix symlinks for Python _curses and _curses_panel extensions.
|
||||
ln -s ncursesw/curses.h "${PREFIX}/include/curses.h" || exit 1
|
||||
ln -s ncursesw/panel.h "${PREFIX}/include/panel.h" || exit 1
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -ru ncurses-5.9/form/fty_num.c ncurses-5.9-android/form/fty_num.c
|
||||
--- ncurses-5.9/form/fty_num.c 2010-01-23 22:14:36.000000000 +0100
|
||||
+++ ncurses-5.9-android/form/fty_num.c 2014-08-04 23:04:23.000000000 +0200
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
-#if HAVE_LOCALE_H
|
||||
+#if HAVE_LOCALE_H && !__ANDROID__
|
||||
#define isDecimalPoint(c) ((c) == ((L && L->decimal_point) ? *(L->decimal_point) : '.'))
|
||||
#else
|
||||
#define isDecimalPoint(c) ((c) == '.')
|
||||
1
project/jni/python3/mk/ncurses/5.9/sources.txt
Normal file
1
project/jni/python3/mk/ncurses/5.9/sources.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
|
||||
17
project/jni/python3/mk/openssl/1.0.2d/build.sh
Normal file
17
project/jni/python3/mk/openssl/1.0.2d/build.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
pushd src >/dev/null
|
||||
|
||||
rm -rf "${PACKAGE}"
|
||||
tar -xf "${PACKAGE}.tar.gz" || exit 1
|
||||
pushd "${PACKAGE}" >/dev/null
|
||||
|
||||
[[ ! -d "${PREFIX}/share" ]] && (mkdir "${PREFIX}/share" || exit 1)
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-android-ndk-target.patch" || exit 1
|
||||
./Configure android-ndk --prefix="${PREFIX}" --openssldir="${PREFIX}/share" || exit 1
|
||||
make || exit 1
|
||||
make install_sw || exit 1
|
||||
|
||||
# Remove binaries from premises.
|
||||
rm -f "${PREFIX}/bin/"{openssl,c_rehash} || exit 1
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
@@ -0,0 +1,12 @@
|
||||
diff -ru openssl-1.0.2/Configure openssl-1.0.2-android/Configure
|
||||
--- openssl-1.0.2/Configure 2015-01-22 15:58:32.000000000 +0100
|
||||
+++ openssl-1.0.2-android/Configure 2015-03-02 11:23:58.000000000 +0100
|
||||
@@ -445,6 +445,7 @@
|
||||
|
||||
# Android: linux-* but without -DTERMIO and pointers to headers and libs.
|
||||
"android","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
+"android-ndk","gcc:-O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so",
|
||||
"android-x86","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:".eval{my $asm=${x86_elf_asm};$asm=~s/:elf/:android/;$asm}.":dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"android-mips","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
|
||||
1
project/jni/python3/mk/openssl/1.0.2d/sources.txt
Normal file
1
project/jni/python3/mk/openssl/1.0.2d/sources.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://openssl.org/source/openssl-1.0.2d.tar.gz
|
||||
30
project/jni/python3/mk/python/3.4.3/build.sh
Normal file
30
project/jni/python3/mk/python/3.4.3/build.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
pushd src >/dev/null
|
||||
|
||||
rm -rf "Python-${VERSION}"
|
||||
tar -xf "Python-${VERSION}.tar.xz" || exit 1
|
||||
pushd "Python-${VERSION}" >/dev/null
|
||||
|
||||
# Build host components.
|
||||
AR=ar AS=as CC=gcc CFLAGS= CPP=cpp CPPFLAGS= CXX=g++ CXXFLAGS= LD=ld LDFLAGS= RANLIB=ranlib ./configure || exit 1
|
||||
AR=ar AS=as CC=gcc CFLAGS= CPP=cpp CPPFLAGS= CXX=g++ CXXFLAGS= LD=ld LDFLAGS= RANLIB=ranlib make BUILDPYTHON=hostpython hostpython PGEN=Parser/hostpgen Parser/hostpgen || exit 1
|
||||
make distclean || exit 1
|
||||
|
||||
# Apply patches and build target Python.
|
||||
cat > config.site <<-SITE
|
||||
ac_cv_file__dev_ptmx=no
|
||||
ac_cv_file__dev_ptc=no
|
||||
SITE
|
||||
ln -sf "${TOOL_PREFIX}/sysroot/usr/include/"{linux,sys}"/soundcard.h"
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-cross-compile.patch" || exit 1
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-python-misc.patch" || exit 1
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-android-locale.patch" || exit 1
|
||||
patch -Ep1 < "${FILESDIR}/${PACKAGE}-android-libmpdec.patch" || exit 1
|
||||
[[ "${NDK_REV}" != 10* ]] && (patch -p1 < "${FILESDIR}/${PACKAGE}-android-missing-getdents64-definition.patch" || exit 1)
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-android-misc.patch" || exit 1
|
||||
|
||||
./configure CROSS_COMPILE_TARGET=yes HOSTPYTHON="$(pwd)/hostpython" CONFIG_SITE=config.site --prefix="${PREFIX}" --host="${TARGET}" --build="${HOST}" --disable-ipv6 --enable-shared --without-ensurepip || exit 1
|
||||
make CROSS_COMPILE_TARGET=yes HOSTPYTHON="$(pwd)/hostpython" HOSTPGEN="$(pwd)/Parser/hostpgen" || exit 1
|
||||
make CROSS_COMPILE_TARGET=yes HOSTPYTHON="$(pwd)/hostpython" HOSTPGEN="$(pwd)/Parser/hostpgen" install || exit 1
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
@@ -0,0 +1,158 @@
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/basearith.c Python-3.3.5-android/Modules/_decimal/libmpdec/basearith.c
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/basearith.c 2014-03-09 09:40:25.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/basearith.c 2014-08-05 16:11:29.000000000 +0200
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "constants.h"
|
||||
-#include "memory.h"
|
||||
+#include "mpmemory.h"
|
||||
#include "typearith.h"
|
||||
#include "basearith.h"
|
||||
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/io.c Python-3.3.5-android/Modules/_decimal/libmpdec/io.c
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/io.c 2014-08-05 16:05:22.000000000 +0200
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/io.c 2014-08-05 16:11:42.000000000 +0200
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <locale.h>
|
||||
#include "bits.h"
|
||||
#include "constants.h"
|
||||
-#include "memory.h"
|
||||
+#include "mpmemory.h"
|
||||
#include "typearith.h"
|
||||
#include "io.h"
|
||||
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/memory.c Python-3.3.5-android/Modules/_decimal/libmpdec/memory.c
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/memory.c 2014-03-09 09:40:25.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/memory.c 2014-08-05 16:11:52.000000000 +0200
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "typearith.h"
|
||||
-#include "memory.h"
|
||||
+#include "mpmemory.h"
|
||||
|
||||
|
||||
/* Guaranteed minimum allocation for a coefficient. May be changed once
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/memory.h Python-3.3.5-android/Modules/_decimal/libmpdec/memory.h
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/memory.h 2014-03-09 09:40:25.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/memory.h 1970-01-01 01:00:00.000000000 +0100
|
||||
@@ -1,51 +0,0 @@
|
||||
-/*
|
||||
- * Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
|
||||
- *
|
||||
- * Redistribution and use in source and binary forms, with or without
|
||||
- * modification, are permitted provided that the following conditions
|
||||
- * are met:
|
||||
- *
|
||||
- * 1. Redistributions of source code must retain the above copyright
|
||||
- * notice, this list of conditions and the following disclaimer.
|
||||
- *
|
||||
- * 2. Redistributions in binary form must reproduce the above copyright
|
||||
- * notice, this list of conditions and the following disclaimer in the
|
||||
- * documentation and/or other materials provided with the distribution.
|
||||
- *
|
||||
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
|
||||
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
- * SUCH DAMAGE.
|
||||
- */
|
||||
-
|
||||
-
|
||||
-#ifndef MEMORY_H
|
||||
-#define MEMORY_H
|
||||
-
|
||||
-
|
||||
-#include "mpdecimal.h"
|
||||
-
|
||||
-
|
||||
-/* Internal header file: all symbols have local scope in the DSO */
|
||||
-MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
|
||||
-
|
||||
-
|
||||
-int mpd_switch_to_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
-int mpd_switch_to_dyn_zero(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
-int mpd_realloc_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
-
|
||||
-
|
||||
-MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
|
||||
-
|
||||
-
|
||||
-#endif
|
||||
-
|
||||
-
|
||||
-
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/mpdecimal.c Python-3.3.5-android/Modules/_decimal/libmpdec/mpdecimal.c
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/mpdecimal.c 2014-03-09 09:40:25.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/mpdecimal.c 2014-08-05 16:12:06.000000000 +0200
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "bits.h"
|
||||
#include "convolute.h"
|
||||
#include "crt.h"
|
||||
-#include "memory.h"
|
||||
+#include "mpmemory.h"
|
||||
#include "typearith.h"
|
||||
#include "umodarith.h"
|
||||
|
||||
diff -Nru Python-3.3.5/Modules/_decimal/libmpdec/mpmemory.h Python-3.3.5-android/Modules/_decimal/libmpdec/mpmemory.h
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/mpmemory.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/mpmemory.h 2014-08-05 16:10:00.000000000 +0200
|
||||
@@ -0,0 +1,51 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ *
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ *
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
|
||||
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
+ * SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+#ifndef MEMORY_H
|
||||
+#define MEMORY_H
|
||||
+
|
||||
+
|
||||
+#include "mpdecimal.h"
|
||||
+
|
||||
+
|
||||
+/* Internal header file: all symbols have local scope in the DSO */
|
||||
+MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
|
||||
+
|
||||
+
|
||||
+int mpd_switch_to_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
+int mpd_switch_to_dyn_zero(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
+int mpd_realloc_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
|
||||
+
|
||||
+
|
||||
+MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
|
||||
+
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+
|
||||
@@ -0,0 +1,255 @@
|
||||
diff -ru Python-3.3.5/Modules/Setup.dist Python-3.3.5-android/Modules/Setup.dist
|
||||
--- Python-3.3.5/Modules/Setup.dist 2014-03-09 09:40:23.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/Setup.dist 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -118,7 +118,7 @@
|
||||
itertools itertoolsmodule.c # Functions creating iterators for efficient looping
|
||||
|
||||
# access to ISO C locale support
|
||||
-_locale _localemodule.c # -lintl
|
||||
+#_locale _localemodule.c # -lintl
|
||||
|
||||
# Standard I/O baseline
|
||||
_io -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c
|
||||
diff -ru Python-3.3.5/Modules/_decimal/libmpdec/io.c Python-3.3.5-android/Modules/_decimal/libmpdec/io.c
|
||||
--- Python-3.3.5/Modules/_decimal/libmpdec/io.c 2014-03-09 09:40:25.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_decimal/libmpdec/io.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -868,10 +868,17 @@
|
||||
}
|
||||
spec->type = *cp++;
|
||||
spec->type = (spec->type == 'N') ? 'G' : 'g';
|
||||
+#ifdef __ANDROID__
|
||||
+ spec->dot = ".";
|
||||
+ spec->sep = ",";
|
||||
+ spec->grouping = "\3";
|
||||
+#else
|
||||
lc = localeconv();
|
||||
spec->dot = lc->decimal_point;
|
||||
spec->sep = lc->thousands_sep;
|
||||
spec->grouping = lc->grouping;
|
||||
+#endif
|
||||
+
|
||||
if (mpd_validate_lconv(spec) < 0) {
|
||||
return 0; /* GCOV_NOT_REACHED */
|
||||
}
|
||||
diff -ru Python-3.3.5/Modules/_localemodule.c Python-3.3.5-android/Modules/_localemodule.c
|
||||
--- Python-3.3.5/Modules/_localemodule.c 2014-03-09 09:40:26.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_localemodule.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -38,6 +38,13 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
+#if __ANDROID__
|
||||
+/* Android's locale support is pretty much unusable, it's better to have the
|
||||
+ higher-level module fall back to C locale emulation. */
|
||||
+#error "Android's locale support is too incomplete to create a usable module."
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
PyDoc_STRVAR(locale__doc__, "Support for POSIX locales.");
|
||||
|
||||
static PyObject *Error;
|
||||
@@ -141,6 +148,11 @@
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
+#ifdef __ANDROID__
|
||||
+ /* Don't even try on Android's broken locale.h. */
|
||||
+ goto failed;
|
||||
+#else
|
||||
+
|
||||
/* if LC_NUMERIC is different in the C library, use saved value */
|
||||
l = localeconv();
|
||||
|
||||
@@ -189,6 +201,7 @@
|
||||
RESULT_INT(p_sign_posn);
|
||||
RESULT_INT(n_sign_posn);
|
||||
return result;
|
||||
+#endif // __ANDROID__
|
||||
|
||||
failed:
|
||||
Py_XDECREF(result);
|
||||
diff -ru Python-3.3.5/Modules/main.c Python-3.3.5-android/Modules/main.c
|
||||
--- Python-3.3.5/Modules/main.c 2014-03-09 09:40:27.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/main.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -522,7 +522,7 @@
|
||||
oldloc = strdup(setlocale(LC_ALL, NULL));
|
||||
setlocale(LC_ALL, "");
|
||||
for (p = strtok(buf, ","); p != NULL; p = strtok(NULL, ",")) {
|
||||
-#ifdef __APPLE__
|
||||
+#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
/* Use utf-8 on Mac OS X */
|
||||
unicode = PyUnicode_FromString(p);
|
||||
#else
|
||||
diff -ru Python-3.3.5/Objects/unicodeobject.c Python-3.3.5-android/Objects/unicodeobject.c
|
||||
--- Python-3.3.5/Objects/unicodeobject.c 2014-03-09 09:40:30.000000000 +0100
|
||||
+++ Python-3.3.5-android/Objects/unicodeobject.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -3295,13 +3295,22 @@
|
||||
static int
|
||||
locale_error_handler(const char *errors, int *surrogateescape)
|
||||
{
|
||||
+
|
||||
if (errors == NULL) {
|
||||
+#ifdef __ANDROID__
|
||||
+ *surrogateescape = 1;
|
||||
+#else
|
||||
*surrogateescape = 0;
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(errors, "strict") == 0) {
|
||||
+#ifdef __ANDROID__
|
||||
+ *surrogateescape = 1;
|
||||
+#else
|
||||
*surrogateescape = 0;
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
if (strcmp(errors, "surrogateescape") == 0) {
|
||||
@@ -3429,7 +3438,7 @@
|
||||
{
|
||||
#ifdef HAVE_MBCS
|
||||
return PyUnicode_EncodeCodePage(CP_ACP, unicode, NULL);
|
||||
-#elif defined(__APPLE__)
|
||||
+#elif defined(__APPLE__) || defined(__ANDROID__)
|
||||
return _PyUnicode_AsUTF8String(unicode, "surrogateescape");
|
||||
#else
|
||||
PyInterpreterState *interp = PyThreadState_GET()->interp;
|
||||
@@ -3709,7 +3718,7 @@
|
||||
{
|
||||
#ifdef HAVE_MBCS
|
||||
return PyUnicode_DecodeMBCS(s, size, NULL);
|
||||
-#elif defined(__APPLE__)
|
||||
+#elif defined(__APPLE__) || defined(__ANDROID__)
|
||||
return PyUnicode_DecodeUTF8Stateful(s, size, "surrogateescape", NULL);
|
||||
#else
|
||||
PyInterpreterState *interp = PyThreadState_GET()->interp;
|
||||
@@ -4835,7 +4844,7 @@
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-#ifdef __APPLE__
|
||||
+#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
|
||||
/* Simplified UTF-8 decoder using surrogateescape error handler,
|
||||
used to decode the command line arguments on Mac OS X.
|
||||
diff -ru Python-3.3.5/Python/bltinmodule.c Python-3.3.5-android/Python/bltinmodule.c
|
||||
--- Python-3.3.5/Python/bltinmodule.c 2014-03-09 09:40:32.000000000 +0100
|
||||
+++ Python-3.3.5-android/Python/bltinmodule.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -24,7 +24,7 @@
|
||||
#ifdef HAVE_MBCS
|
||||
const char *Py_FileSystemDefaultEncoding = "mbcs";
|
||||
int Py_HasFileSystemDefaultEncoding = 1;
|
||||
-#elif defined(__APPLE__)
|
||||
+#elif defined(__APPLE__) || defined(__ANDROID__)
|
||||
const char *Py_FileSystemDefaultEncoding = "utf-8";
|
||||
int Py_HasFileSystemDefaultEncoding = 1;
|
||||
#else
|
||||
diff -ru Python-3.3.5/Python/fileutils.c Python-3.3.5-android/Python/fileutils.c
|
||||
--- Python-3.3.5/Python/fileutils.c 2014-03-09 09:40:32.000000000 +0100
|
||||
+++ Python-3.3.5-android/Python/fileutils.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
-#ifdef __APPLE__
|
||||
+#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size);
|
||||
#endif
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
-#if !defined(__APPLE__) && !defined(MS_WINDOWS)
|
||||
+#if !defined(__APPLE__) && !defined(__ANDROID__) && !defined(MS_WINDOWS)
|
||||
extern int _Py_normalize_encoding(const char *, char *, size_t);
|
||||
|
||||
/* Workaround FreeBSD and OpenIndiana locale encoding issue with the C locale.
|
||||
@@ -194,7 +194,7 @@
|
||||
}
|
||||
#endif /* !defined(__APPLE__) && !defined(MS_WINDOWS) */
|
||||
|
||||
-#if !defined(__APPLE__) && (!defined(MS_WINDOWS) || !defined(HAVE_MBRTOWC))
|
||||
+#if !defined(__APPLE__) && !defined(__ANDROID__) && (!defined(MS_WINDOWS) || !defined(HAVE_MBRTOWC))
|
||||
static wchar_t*
|
||||
decode_ascii_surrogateescape(const char *arg, size_t *size)
|
||||
{
|
||||
@@ -241,7 +241,7 @@
|
||||
wchar_t*
|
||||
_Py_char2wchar(const char* arg, size_t *size)
|
||||
{
|
||||
-#ifdef __APPLE__
|
||||
+#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
wchar_t *wstr;
|
||||
wstr = _Py_DecodeUTF8_surrogateescape(arg, strlen(arg));
|
||||
if (size != NULL) {
|
||||
@@ -384,7 +384,7 @@
|
||||
char*
|
||||
_Py_wchar2char(const wchar_t *text, size_t *error_pos)
|
||||
{
|
||||
-#ifdef __APPLE__
|
||||
+#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
Py_ssize_t len;
|
||||
PyObject *unicode, *bytes = NULL;
|
||||
char *cpath;
|
||||
diff -ru Python-3.3.5/Python/formatter_unicode.c Python-3.3.5-android/Python/formatter_unicode.c
|
||||
--- Python-3.3.5/Python/formatter_unicode.c 2014-03-09 09:40:32.000000000 +0100
|
||||
+++ Python-3.3.5-android/Python/formatter_unicode.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -665,6 +665,7 @@
|
||||
{
|
||||
switch (type) {
|
||||
case LT_CURRENT_LOCALE: {
|
||||
+#ifndef __ANDROID__
|
||||
struct lconv *locale_data = localeconv();
|
||||
locale_info->decimal_point = PyUnicode_DecodeLocale(
|
||||
locale_data->decimal_point,
|
||||
@@ -680,6 +681,7 @@
|
||||
}
|
||||
locale_info->grouping = locale_data->grouping;
|
||||
break;
|
||||
+#endif // __ANDROID__
|
||||
}
|
||||
case LT_DEFAULT_LOCALE:
|
||||
locale_info->decimal_point = PyUnicode_FromOrdinal('.');
|
||||
diff -ru Python-3.3.5/Python/pystrtod.c Python-3.3.5-android/Python/pystrtod.c
|
||||
--- Python-3.3.5/Python/pystrtod.c 2014-03-09 09:40:33.000000000 +0100
|
||||
+++ Python-3.3.5-android/Python/pystrtod.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -177,8 +177,12 @@
|
||||
|
||||
fail_pos = NULL;
|
||||
|
||||
+#ifdef __ANDROID__
|
||||
+ decimal_point = ".";
|
||||
+#else
|
||||
locale_data = localeconv();
|
||||
decimal_point = locale_data->decimal_point;
|
||||
+#endif
|
||||
decimal_point_len = strlen(decimal_point);
|
||||
|
||||
assert(decimal_point_len != 0);
|
||||
@@ -378,8 +382,12 @@
|
||||
Py_LOCAL_INLINE(void)
|
||||
change_decimal_from_locale_to_dot(char* buffer)
|
||||
{
|
||||
+#ifdef __ANDROID__
|
||||
+ const char *decimal_point = ".";
|
||||
+#else
|
||||
struct lconv *locale_data = localeconv();
|
||||
const char *decimal_point = locale_data->decimal_point;
|
||||
+#endif
|
||||
|
||||
if (decimal_point[0] != '.' || decimal_point[1] != 0) {
|
||||
size_t decimal_point_len = strlen(decimal_point);
|
||||
diff -ru Python-3.3.5/Python/pythonrun.c Python-3.3.5-android/Python/pythonrun.c
|
||||
--- Python-3.3.5/Python/pythonrun.c 2014-03-09 09:40:33.000000000 +0100
|
||||
+++ Python-3.3.5-android/Python/pythonrun.c 2014-08-04 22:16:29.000000000 +0200
|
||||
@@ -188,6 +188,8 @@
|
||||
return NULL;
|
||||
}
|
||||
return get_codec_name(codeset);
|
||||
+#elif __ANDROID__
|
||||
+ return get_codec_name("UTF-8");
|
||||
#else
|
||||
PyErr_SetNone(PyExc_NotImplementedError);
|
||||
return NULL;
|
||||
@@ -0,0 +1,326 @@
|
||||
diff -ru Python-3.3.5/Lib/platform.py Python-3.3.5-android/Lib/platform.py
|
||||
--- Python-3.3.5/Lib/platform.py 2014-03-09 09:40:13.000000000 +0100
|
||||
+++ Python-3.3.5-android/Lib/platform.py 2014-08-04 22:19:36.000000000 +0200
|
||||
@@ -368,6 +368,76 @@
|
||||
supported_dists=supported_dists,
|
||||
full_distribution_name=0)
|
||||
|
||||
+_android_environment_vars = (
|
||||
+ 'ANDROID_ROOT', 'ANDROID_ASSETS', 'ANDROID_STORAGE', 'ANDROID_DATA',
|
||||
+ 'ANDROID_PROPERTY_WORKSPACE', 'ANDROID_BOOTLOGO')
|
||||
+_android_version_property = 'ro.build.version.release'
|
||||
+_android_buildstr_property = 'ro.build.version.full'
|
||||
+
|
||||
+def android_version(version='', buildstr=''):
|
||||
+ """ Attempt to get the Android version number and build string.
|
||||
+
|
||||
+ The function checks for the getprop binary to retrieve build info,
|
||||
+ and falls back to manually reading /system/build.prop if available.
|
||||
+
|
||||
+ Returns a (version, buildstr) tuple which defaults to the args given
|
||||
+ as parameters.
|
||||
+ """
|
||||
+ if not any(os.getenv(e) for e in _android_environment_vars):
|
||||
+ # Probably not on Android...
|
||||
+ return version, buildstr
|
||||
+
|
||||
+ version_obtained = False
|
||||
+ buildstr_obtained = False
|
||||
+
|
||||
+ # Try the 'official' API tool first, since /system/build.prop might
|
||||
+ # not be the only source for properties.
|
||||
+ if os.access('/system/bin/getprop', os.X_OK):
|
||||
+ def _getprop(prop):
|
||||
+ android_property_fd = _get_android_property_fd()
|
||||
+ pass_fds = (android_property_fd,) if android_property_fd else ()
|
||||
+ try:
|
||||
+ result = subprocess.check_output(['/system/bin/getprop', prop],
|
||||
+ pass_fds=pass_fds)
|
||||
+ return result.decode('utf-8').strip()
|
||||
+ except (subprocess.CalledProcessError, UnicodeDecodeError):
|
||||
+ raise RuntimeError('getprop failed')
|
||||
+
|
||||
+ try:
|
||||
+ version = _getprop(_android_version_property)
|
||||
+ version_obtained = True
|
||||
+ except RuntimeError:
|
||||
+ pass
|
||||
+
|
||||
+ try:
|
||||
+ buildstr = _getprop(_android_buildstr_property)
|
||||
+ buildstr_obtained = True
|
||||
+ except RuntimeError:
|
||||
+ pass
|
||||
+ done = version_obtained and buildstr_obtained
|
||||
+
|
||||
+ # Fall back to parsing /system/build.prop manually.
|
||||
+ if not done and os.path.isfile('/system/build.prop'):
|
||||
+ for line in open('/system/build.prop', 'rb'):
|
||||
+ if b'=' not in line:
|
||||
+ continue
|
||||
+ key, val = line.split(b'=', maxsplit=1)
|
||||
+ key = key.strip().decode('utf-8')
|
||||
+
|
||||
+ if not version_obtained and key == _android_version_property:
|
||||
+ version = val.strip().decode('utf-8')
|
||||
+ if not buildstr_obtained and key == _android_buildstr_property:
|
||||
+ buildstr = val.strip().decode('utf-8')
|
||||
+
|
||||
+ return version, buildstr
|
||||
+
|
||||
+def _get_android_property_fd():
|
||||
+ android_property_workspace = os.getenv('ANDROID_PROPERTY_WORKSPACE')
|
||||
+ if android_property_workspace:
|
||||
+ property_fd_str = android_property_workspace.split(',')[0]
|
||||
+ if property_fd_str.isdigit():
|
||||
+ return int(property_fd_str)
|
||||
+
|
||||
def popen(cmd, mode='r', bufsize=-1):
|
||||
|
||||
""" Portable popen() interface.
|
||||
diff -ru Python-3.3.5/Lib/subprocess.py Python-3.3.5-android/Lib/subprocess.py
|
||||
--- Python-3.3.5/Lib/subprocess.py 2014-03-09 09:40:13.000000000 +0100
|
||||
+++ Python-3.3.5-android/Lib/subprocess.py 2014-08-04 22:19:36.000000000 +0200
|
||||
@@ -1343,9 +1343,18 @@
|
||||
args = list(args)
|
||||
|
||||
if shell:
|
||||
- args = ["/bin/sh", "-c"] + args
|
||||
if executable:
|
||||
- args[0] = executable
|
||||
+ main = executable
|
||||
+ elif os.path.isfile('/bin/sh'):
|
||||
+ main = '/bin/sh'
|
||||
+ else:
|
||||
+ import platform
|
||||
+ if platform.android_version()[0]:
|
||||
+ main = '/system/bin/sh'
|
||||
+ else:
|
||||
+ raise RuntimeError('Could not find system shell')
|
||||
+
|
||||
+ args = [main, "-c"] + args
|
||||
|
||||
if executable is None:
|
||||
executable = args[0]
|
||||
diff -ru Python-3.3.5/Lib/test/test_subprocess.py Python-3.3.5-android/Lib/test/test_subprocess.py
|
||||
--- Python-3.3.5/Lib/test/test_subprocess.py 2014-03-09 09:40:19.000000000 +0100
|
||||
+++ Python-3.3.5-android/Lib/test/test_subprocess.py 2014-08-04 22:19:36.000000000 +0200
|
||||
@@ -17,6 +17,7 @@
|
||||
import shutil
|
||||
import gc
|
||||
import textwrap
|
||||
+import platform
|
||||
|
||||
try:
|
||||
import resource
|
||||
@@ -1356,7 +1357,10 @@
|
||||
fd, fname = mkstemp()
|
||||
# reopen in text mode
|
||||
with open(fd, "w", errors="surrogateescape") as fobj:
|
||||
- fobj.write("#!/bin/sh\n")
|
||||
+ if platform.android_version()[0]:
|
||||
+ fobj.write('#!/system/bin/sh\n')
|
||||
+ else:
|
||||
+ fobj.write("#!/bin/sh\n")
|
||||
fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
|
||||
sys.executable)
|
||||
os.chmod(fname, 0o700)
|
||||
@@ -1401,7 +1405,10 @@
|
||||
fd, fname = mkstemp()
|
||||
# reopen in text mode
|
||||
with open(fd, "w", errors="surrogateescape") as fobj:
|
||||
- fobj.write("#!/bin/sh\n")
|
||||
+ if platform.android_version()[0]:
|
||||
+ fobj.write('#!/system/bin/sh\n')
|
||||
+ else:
|
||||
+ fobj.write("#!/bin/sh\n")
|
||||
fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
|
||||
sys.executable)
|
||||
os.chmod(fname, 0o700)
|
||||
diff -ru Python-3.4.2/Modules/pwdmodule.c Python-3.4.2-android/Modules/pwdmodule.c
|
||||
--- Python-3.4.2/Modules/pwdmodule.c 2015-02-24 23:06:31.000000000 +0100
|
||||
+++ Python-3.4.2-android/Modules/pwdmodule.c 2015-02-24 23:09:14.000000000 +0100
|
||||
@@ -72,7 +72,11 @@
|
||||
SETS(setIndex++, p->pw_passwd);
|
||||
PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromUid(p->pw_uid));
|
||||
PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromGid(p->pw_gid));
|
||||
+#if !defined(__ANDROID__)
|
||||
SETS(setIndex++, p->pw_gecos);
|
||||
+#else
|
||||
+ SETS(setIndex++, "");
|
||||
+#endif
|
||||
SETS(setIndex++, p->pw_dir);
|
||||
SETS(setIndex++, p->pw_shell);
|
||||
|
||||
diff -ru Python-3.3.5/Modules/socketmodule.c Python-3.3.5-android/Modules/socketmodule.c
|
||||
--- Python-3.3.5/Modules/socketmodule.c 2014-03-09 09:40:28.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/socketmodule.c 2014-08-04 22:19:36.000000000 +0200
|
||||
@@ -150,7 +150,7 @@
|
||||
On the other hand, not all Linux versions agree, so there the settings
|
||||
computed by the configure script are needed! */
|
||||
|
||||
-#ifndef linux
|
||||
+#if !defined(linux) || __ANDROID__
|
||||
# undef HAVE_GETHOSTBYNAME_R_3_ARG
|
||||
# undef HAVE_GETHOSTBYNAME_R_5_ARG
|
||||
# undef HAVE_GETHOSTBYNAME_R_6_ARG
|
||||
@@ -169,7 +169,7 @@
|
||||
# define HAVE_GETHOSTBYNAME_R_3_ARG
|
||||
# elif defined(__sun) || defined(__sgi)
|
||||
# define HAVE_GETHOSTBYNAME_R_5_ARG
|
||||
-# elif defined(linux)
|
||||
+# elif defined(linux) && !__ANDROID__
|
||||
/* Rely on the configure script */
|
||||
# else
|
||||
# undef HAVE_GETHOSTBYNAME_R
|
||||
diff -ru Python-3.3.5/Modules/posixmodule.c Python-3.3.5-android/Modules/posixmodule.c
|
||||
--- Python-3.3.5/Modules/posixmodule.c 2014-03-09 08:40:28.000000000 +0000
|
||||
+++ Python-3.3.5-android/Modules/posixmodule.c 2015-02-24 19:57:05.368843433 +0000
|
||||
@@ -403,6 +403,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+/* Android doesn't expose AT_EACCESS - manually define it. */
|
||||
+#if !defined(AT_EACCESS) && defined(__ANDROID__)
|
||||
+#define AT_EACCESS 0x200
|
||||
+#endif
|
||||
+
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
static int
|
||||
diff -ru Python-3.3.5/Python/pytime.c Python-3.3.5-android/Python/pytime.c
|
||||
--- Python-3.3.5/Python/pytime.c 2015-02-23 11:54:25.000000000 -0500
|
||||
+++ Python-3.3.5-android/Python/pytime.c 2015-02-23 11:55:19.000000000 -0500
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
-#if defined(__APPLE__) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME)
|
||||
+#if (defined(__APPLE__) || defined(__ANDROID__)) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME)
|
||||
/*
|
||||
* _PyTime_gettimeofday falls back to ftime when getttimeofday fails because the latter
|
||||
* might fail on some platforms. This fallback is unwanted on MacOSX because
|
||||
diff -ru Python-3.4.2/configure Python-3.4.2-android/configure
|
||||
--- Python-3.4.2/configure 2015-02-24 23:18:31.000000000 +0100
|
||||
+++ Python-3.4.2-android/configure 2015-03-01 20:15:02.000000000 +0100
|
||||
@@ -5406,6 +5406,34 @@
|
||||
MULTIARCH=$($CC --print-multiarch 2>/dev/null)
|
||||
|
||||
|
||||
+# Test if we're running on Android.
|
||||
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if target is Android-based" >&5
|
||||
+$as_echo_n "checking if target is Android-based... " >&6; }
|
||||
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+#if __ANDROID__
|
||||
+yes
|
||||
+#endif
|
||||
+
|
||||
+_ACEOF
|
||||
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
+ $EGREP "yes" >/dev/null 2>&1; then :
|
||||
+
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
+$as_echo "yes" >&6; }
|
||||
+ with_android=yes
|
||||
+
|
||||
+else
|
||||
+
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
+$as_echo "no" >&6; }
|
||||
+ with_android=no
|
||||
+
|
||||
+
|
||||
+fi
|
||||
+rm -f conftest*
|
||||
+
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBRARY" >&5
|
||||
@@ -5650,7 +5678,14 @@
|
||||
SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
|
||||
;;
|
||||
esac
|
||||
- INSTSONAME="$LDLIBRARY".$SOVERSION
|
||||
+
|
||||
+ if test "$with_android" != yes
|
||||
+ then
|
||||
+ INSTSONAME="$LDLIBRARY".$SOVERSION
|
||||
+ else
|
||||
+ INSTSONAME="$LDLIBRARY"
|
||||
+ fi
|
||||
+
|
||||
if test "$with_pydebug" != yes
|
||||
then
|
||||
PY3LIBRARY=libpython3.so
|
||||
diff -ru Python-3.4.2/configure.ac Python-3.4.2-android/configure.ac
|
||||
--- Python-3.4.2/configure.ac 2015-02-24 23:18:31.000000000 +0100
|
||||
+++ Python-3.4.2-android/configure.ac 2015-03-01 20:14:54.000000000 +0100
|
||||
@@ -796,6 +796,21 @@
|
||||
MULTIARCH=$($CC --print-multiarch 2>/dev/null)
|
||||
AC_SUBST(MULTIARCH)
|
||||
|
||||
+# Test if we're running on Android.
|
||||
+AC_MSG_CHECKING(if target is Android-based)
|
||||
+AC_EGREP_CPP(yes,
|
||||
+[
|
||||
+#if __ANDROID__
|
||||
+yes
|
||||
+#endif
|
||||
+], [
|
||||
+ AC_MSG_RESULT(yes)
|
||||
+ with_android=yes
|
||||
+ ], [
|
||||
+ AC_MSG_RESULT(no)
|
||||
+ with_android=no
|
||||
+ ]
|
||||
+)
|
||||
|
||||
AC_SUBST(LIBRARY)
|
||||
AC_MSG_CHECKING(LIBRARY)
|
||||
@@ -970,7 +985,14 @@
|
||||
SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
|
||||
;;
|
||||
esac
|
||||
- INSTSONAME="$LDLIBRARY".$SOVERSION
|
||||
+
|
||||
+ if test "$with_android" != yes
|
||||
+ then
|
||||
+ INSTSONAME="$LDLIBRARY".$SOVERSION
|
||||
+ else
|
||||
+ INSTSONAME="$LDLIBRARY"
|
||||
+ fi
|
||||
+
|
||||
if test "$with_pydebug" != yes
|
||||
then
|
||||
PY3LIBRARY=libpython3.so
|
||||
|
||||
diff -ru Python-3.4.2/Makefile.pre.in Python-3.4.2-android/Makefile.pre.in
|
||||
--- Python-3.4.2/Makefile.pre.in 2015-03-04 16:25:36.000000000 +0100
|
||||
+++ Python-3.4.2-android/Makefile.pre.in 2015-03-04 16:27:27.000000000 +0100
|
||||
@@ -568,7 +568,7 @@
|
||||
*\ -s*|s*) quiet="-q";; \
|
||||
*) quiet="";; \
|
||||
esac; \
|
||||
- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
|
||||
+ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED) -lpython$(LDVERSION)' OPT='$(OPT)' \
|
||||
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
|
||||
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
|
||||
|
||||
diff -Nru Python-3.4.2/Makefile.pre.in Python-3.4.2-android/Makefile.pre.in
|
||||
--- Python-3.4.2/Makefile.pre.in 2015-06-27 17:04:23.885777456 +0000
|
||||
+++ Python-3.4.2-android/Makefile.pre.in 2015-06-27 17:05:27.709777315 +0000
|
||||
@@ -585,11 +585,9 @@
|
||||
$(RANLIB) $@
|
||||
|
||||
libpython$(LDVERSION).so: $(LIBRARY_OBJS)
|
||||
+ $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
||||
if test $(INSTSONAME) != $(LDLIBRARY); then \
|
||||
- $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
||||
$(LN) -f $(INSTSONAME) $@; \
|
||||
- else \
|
||||
- $(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
|
||||
fi
|
||||
|
||||
libpython3.so: libpython$(LDVERSION).so
|
||||
@@ -0,0 +1,17 @@
|
||||
diff -ru Python-3.3.5/Modules/_posixsubprocess.c Python-3.3.5-android/Modules/_posixsubprocess.c
|
||||
--- Python-3.3.5/Modules/_posixsubprocess.c 2014-03-09 09:40:26.000000000 +0100
|
||||
+++ Python-3.3.5-android/Modules/_posixsubprocess.c 2014-08-04 22:19:36.000000000 +0200
|
||||
@@ -18,6 +18,12 @@
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
+#if defined(__ANDROID__)
|
||||
+/* Android doesn't expose syscalls. Let's add the definition manually. */
|
||||
+# include <sys/linux-syscalls.h>
|
||||
+# define SYS_getdents64 __NR_getdents64
|
||||
+#endif
|
||||
+
|
||||
#if defined(sun)
|
||||
/* readdir64 is used to work around Solaris 9 bug 6395699. */
|
||||
# define readdir readdir64
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
diff -ru Python-3.3.5/Makefile.pre.in Python-3.3.5-android/Makefile.pre.in
|
||||
--- Python-3.3.5/Makefile.pre.in 2014-03-09 09:40:23.000000000 +0100
|
||||
+++ Python-3.3.5-android/Makefile.pre.in 2014-08-04 22:13:00.000000000 +0200
|
||||
@@ -674,7 +674,7 @@
|
||||
$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
|
||||
@$(MKDIR_P) Include
|
||||
$(MAKE) $(PGEN)
|
||||
- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
||||
+ $(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
|
||||
$(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
|
||||
$(MAKE) $(GRAMMAR_H)
|
||||
touch $(GRAMMAR_C)
|
||||
@@ -1243,6 +1243,7 @@
|
||||
# Install the dynamically loadable modules
|
||||
# This goes into $(exec_prefix)
|
||||
sharedinstall: sharedmods
|
||||
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' CROSS_COMPILE='$(CROSS_COMPILE)' \
|
||||
$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
|
||||
--prefix=$(prefix) \
|
||||
--install-scripts=$(BINDIR) \
|
||||
diff -ru Python-3.3.5/configure Python-3.3.5-android/configure
|
||||
--- Python-3.3.5/configure 2014-03-09 09:40:34.000000000 +0100
|
||||
+++ Python-3.3.5-android/configure 2014-08-04 22:13:00.000000000 +0200
|
||||
@@ -2943,13 +2943,18 @@
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5
|
||||
$as_echo_n "checking for python interpreter for cross build... " >&6; }
|
||||
if test -z "$PYTHON_FOR_BUILD"; then
|
||||
- for interp in python$PACKAGE_VERSION python3 python; do
|
||||
- which $interp >/dev/null 2>&1 || continue
|
||||
- if $interp -c 'import sys;sys.exit(not sys.version_info[:2] >= (3,3))'; then
|
||||
- break
|
||||
- fi
|
||||
- interp=
|
||||
- done
|
||||
+ if test ! -z "$HOSTPYTHON" && PYTHONPATH="$ac_abs_confdir/Lib" "$HOSTPYTHON" -S -c 'import sys;sys.exit(not sys.version_info[:2] >= (3,3))'; then
|
||||
+ interp="$HOSTPYTHON"
|
||||
+ else
|
||||
+ for interp in python$PACKAGE_VERSION python3 python; do
|
||||
+ which $interp >/dev/null 2>&1 || continue
|
||||
+ if $interp -c 'import sys;sys.exit(not sys.version_info[:2] >= (3,3))'; then
|
||||
+ break
|
||||
+ fi
|
||||
+ interp=
|
||||
+ done
|
||||
+ fi
|
||||
+
|
||||
if test x$interp = x; then
|
||||
as_fn_error $? "python$PACKAGE_VERSION interpreter not found" "$LINENO" 5
|
||||
fi
|
||||
diff -ru Python-3.3.5/configure.ac Python-3.3.5-android/configure.ac
|
||||
--- Python-3.3.5/configure.ac 2014-03-09 09:40:34.000000000 +0100
|
||||
+++ Python-3.3.5-android/configure.ac 2014-08-04 22:13:00.000000000 +0200
|
||||
@@ -56,13 +56,18 @@
|
||||
if test "$cross_compiling" = yes; then
|
||||
AC_MSG_CHECKING([for python interpreter for cross build])
|
||||
if test -z "$PYTHON_FOR_BUILD"; then
|
||||
- for interp in python$PACKAGE_VERSION python3 python; do
|
||||
- which $interp >/dev/null 2>&1 || continue
|
||||
- if $interp -c 'import sys;sys.exit(not sys.version_info@<:@:2@:>@ >= (3,3))'; then
|
||||
- break
|
||||
- fi
|
||||
- interp=
|
||||
- done
|
||||
+ if test ! -z "$HOSTPYTHON" && PYTHONPATH="$ac_abs_confdir/Lib" "$HOSTPYTHON" -S -c 'import sys;sys.exit(not sys.version_info@<:@:2@:>@ >= (3,3))'; then
|
||||
+ interp="$HOSTPYTHON"
|
||||
+ else
|
||||
+ for interp in python$PACKAGE_VERSION python3 python; do
|
||||
+ which $interp >/dev/null 2>&1 || continue
|
||||
+ if $interp -c 'import sys;sys.exit(not sys.version_info@<:@:2@:>@ >= (3,3))'; then
|
||||
+ break
|
||||
+ fi
|
||||
+ interp=
|
||||
+ done
|
||||
+ fi
|
||||
+
|
||||
if test x$interp = x; then
|
||||
AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
|
||||
fi
|
||||
@@ -0,0 +1,96 @@
|
||||
diff -ru Python-3.3.5/Lib/test/test_pwd.py Python-3.3.5-android/Lib/test/test_pwd.py
|
||||
--- Python-3.3.5/Lib/test/test_pwd.py 2014-03-09 09:40:19.000000000 +0100
|
||||
+++ Python-3.3.5-android/Lib/test/test_pwd.py 2014-08-04 22:14:36.000000000 +0200
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
class PwdTest(unittest.TestCase):
|
||||
|
||||
+ @unittest.skipUnless(hasattr(pwd, 'getpwall'), 'pwd module does not expose getpwall()')
|
||||
def test_values(self):
|
||||
entries = pwd.getpwall()
|
||||
|
||||
@@ -52,6 +53,7 @@
|
||||
self.assertIn(pwd.getpwnam(e.pw_name), entriesbyname[e.pw_name])
|
||||
self.assertIn(pwd.getpwuid(e.pw_uid), entriesbyuid[e.pw_uid])
|
||||
|
||||
+ @unittest.skipUnless(hasattr(pwd, 'getpwall'), 'pwd module does not expose getpwall()')
|
||||
def test_errors(self):
|
||||
self.assertRaises(TypeError, pwd.getpwuid)
|
||||
self.assertRaises(TypeError, pwd.getpwuid, 3.14)
|
||||
diff -ru Python-3.4.2/Modules/python.c Python-3.4.2-android/Modules/python.c
|
||||
--- Python-3.4.2/Modules/python.c 2015-02-24 22:42:37.000000000 +0100
|
||||
+++ Python-3.4.2-android/Modules/python.c 2015-02-24 23:04:27.000000000 +0100
|
||||
@@ -44,10 +44,13 @@
|
||||
fpsetmask(m & ~FP_X_OFL);
|
||||
#endif
|
||||
|
||||
- oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
|
||||
- if (!oldloc) {
|
||||
- fprintf(stderr, "out of memory\n");
|
||||
- return 1;
|
||||
+ oldloc = setlocale(LC_ALL, NULL);
|
||||
+ if (oldloc) {
|
||||
+ oldloc = _PyMem_RawStrdup(oldloc);
|
||||
+ if (!oldloc) {
|
||||
+ fprintf(stderr, "out of memory\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
}
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
@@ -64,8 +67,11 @@
|
||||
}
|
||||
argv_copy2[argc] = argv_copy[argc] = NULL;
|
||||
|
||||
- setlocale(LC_ALL, oldloc);
|
||||
- PyMem_RawFree(oldloc);
|
||||
+ if (oldloc) {
|
||||
+ setlocale(LC_ALL, oldloc);
|
||||
+ PyMem_RawFree(oldloc);
|
||||
+ }
|
||||
+
|
||||
res = Py_Main(argc, argv_copy);
|
||||
for (i = 0; i < argc; i++) {
|
||||
PyMem_RawFree(argv_copy2[i]);
|
||||
diff -ru Python-3.3.5/setup.py Python-3.3.5-android/setup.py
|
||||
--- Python-3.3.5/setup.py 2014-03-09 09:40:35.000000000 +0100
|
||||
+++ Python-3.3.5-android/setup.py 2014-08-04 22:14:36.000000000 +0200
|
||||
@@ -562,7 +562,7 @@
|
||||
libraries=math_libs) )
|
||||
|
||||
# time libraries: librt may be needed for clock_gettime()
|
||||
- time_libs = []
|
||||
+ time_libs = ['m']
|
||||
lib = sysconfig.get_config_var('TIMEMODULE_LIB')
|
||||
if lib:
|
||||
time_libs.append(lib)
|
||||
@@ -631,7 +631,8 @@
|
||||
missing.append('spwd')
|
||||
|
||||
# select(2); not on ancient System V
|
||||
- exts.append( Extension('select', ['selectmodule.c']) )
|
||||
+ exts.append( Extension('select', ['selectmodule.c'],
|
||||
+ libraries=['m']) )
|
||||
|
||||
# Fred Drake's interface to the Python parser
|
||||
exts.append( Extension('parser', ['parsermodule.c']) )
|
||||
@@ -639,7 +639,8 @@
|
||||
# Operations on audio samples
|
||||
# According to #993173, this one should actually work fine on
|
||||
# 64-bit platforms.
|
||||
- exts.append( Extension('audioop', ['audioop.c']) )
|
||||
+ exts.append( Extension('audioop', ['audioop.c'],
|
||||
+ libraries=['m']) )
|
||||
|
||||
# readline
|
||||
do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
|
||||
@@ -1904,7 +1905,8 @@
|
||||
sources=sources,
|
||||
depends=depends)
|
||||
ext_test = Extension('_ctypes_test',
|
||||
- sources=['_ctypes/_ctypes_test.c'])
|
||||
+ sources=['_ctypes/_ctypes_test.c'],
|
||||
+ libraries=['m'])
|
||||
self.extensions.extend([ext, ext_test])
|
||||
|
||||
if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
|
||||
1
project/jni/python3/mk/python/3.4.3/sources.txt
Normal file
1
project/jni/python3/mk/python/3.4.3/sources.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz
|
||||
13
project/jni/python3/mk/readline/6.3/build.sh
Normal file
13
project/jni/python3/mk/readline/6.3/build.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
pushd src >/dev/null
|
||||
|
||||
rm -rf "${PACKAGE}"
|
||||
tar -xf "${PACKAGE}.tar.gz" || exit 1
|
||||
pushd "${PACKAGE}" >/dev/null
|
||||
|
||||
autoreconf -i
|
||||
./configure --prefix="${PREFIX}" --host="${TARGET}" --build="${HOST}" --disable-shared || exit 1
|
||||
make || exit 1
|
||||
make install || exit 1
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
1
project/jni/python3/mk/readline/6.3/sources.txt
Normal file
1
project/jni/python3/mk/readline/6.3/sources.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://ftp.gnu.org/gnu/readline/readline-6.3.tar.gz
|
||||
15
project/jni/python3/mk/sqlite/3.8.10.2/build.sh
Normal file
15
project/jni/python3/mk/sqlite/3.8.10.2/build.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
pushd src >/dev/null
|
||||
|
||||
rm -rf "${NAME}-autoconf-3081002"
|
||||
tar -xf "${NAME}-autoconf-3081002.tar.gz" || exit 1
|
||||
pushd "${NAME}-autoconf-3081002" >/dev/null
|
||||
|
||||
./configure --prefix="${PREFIX}" --host="${TARGET}" --build="${HOST}" --disable-shared || exit 1
|
||||
make || exit 1
|
||||
make install || exit 1
|
||||
|
||||
# Remove binary from premises.
|
||||
rm -f "${PREFIX}/bin/sqlite3" || exit 1
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
1
project/jni/python3/mk/sqlite/3.8.10.2/sources.txt
Normal file
1
project/jni/python3/mk/sqlite/3.8.10.2/sources.txt
Normal file
@@ -0,0 +1 @@
|
||||
https://www.sqlite.org/2015/sqlite-autoconf-3081002.tar.gz
|
||||
24
project/jni/python3/mk/test.sh
Executable file
24
project/jni/python3/mk/test.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
source ./env
|
||||
|
||||
pushd "$BASE/sdk/android-sdk-r${SDK_REV}" > /dev/null
|
||||
|
||||
# TODO: Figure out an appropriate port number.
|
||||
PORT=5554
|
||||
|
||||
# Boot the emulator, wait for it.
|
||||
./tools/emulator -avd "${ANDROID_VM_NAME}-${TEST_IDENTIFIER}" -port "${PORT}" -no-snapshot-save ${ANDROID_EMULATOR_OPTIONS} &
|
||||
./platform-tools/adb -s "emulator-${PORT}" wait-for-device
|
||||
|
||||
# Copy the files over.
|
||||
./platform-tools/adb -s "emulator-${PORT}" push "${ANDROID_PREFIX}/${BUILD_IDENTIFIER}" "${ANDROID_EMULATOR_TESTDIR}"
|
||||
# Run the tests!
|
||||
./platform-tools/adb -s "emulator-${PORT}" shell <<-EOF
|
||||
cd "${ANDROID_EMULATOR_TESTDIR}"
|
||||
bin/python3.3 -m test
|
||||
exit
|
||||
EOF
|
||||
# Stop the emulator.
|
||||
./platform-tools/adb -s "emulator-${PORT}" emu kill
|
||||
|
||||
popd > /dev/null
|
||||
87
project/jni/python3/mk/test_setup.sh
Executable file
87
project/jni/python3/mk/test_setup.sh
Executable file
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env bash
|
||||
source ./env
|
||||
|
||||
# Force license terms.
|
||||
if [[ "$ANDROID_AGREE_LICENSE_TERMS" != y ]]; then
|
||||
echo "You didn't agree to the Android SDK license terms! Read them and then set ANDROID_AGREE_LICENSE_TERMS=y in env."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install the SDK manager.
|
||||
if [[ ! -d "$BASE/sdk/android-sdk-r${SDK_REV}" ]]; then
|
||||
case $(uname -s) in
|
||||
Darwin)
|
||||
[[ ! -f "$BASE/sdk/android-sdk-r${SDK_REV}.zip" ]] && (wget http://dl.google.com/android/android-sdk_r${SDK_REV}-macosx.zip -O "$BASE/sdk/android-sdk-r${SDK_REV}.zip" || exit 1)
|
||||
unzip -q "$BASE/sdk/android-sdk-r${SDK_REV}.zip" -d "$BASE/sdk" || exit 1
|
||||
mv "$BASE/sdk/android-sdk-macosx" "$BASE/sdk/android-sdk-r${SDK_REV}" || exit 1
|
||||
;;
|
||||
Linux)
|
||||
[[ ! -f "$BASE/sdk/android-sdk-r4{SDK_REV}.zip" ]] && (wget http://dl.google.com/android/android-sdk_r${SDK_REV}-linux.tgz -O "$BASE/sdk/android-sdk-r${SDK_REV}.tgz" || exit 1)
|
||||
tar -xf "$BASE/sdk/android-sdk-r${SDK_REV}.tgz" -C "$BASE/sdk" || exit 1
|
||||
mv "$BASE/sdk/android-sdk-linux" "$BASE/sdk/android-sdk-r${SDK_REV}" || exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
pushd "$BASE/sdk/android-sdk-r${SDK_REV}" > /dev/null
|
||||
|
||||
# Find SDK platform ID to use.
|
||||
SDK_ID=$(./tools/android -s list sdk -a |\
|
||||
grep -F 'SDK Platform Android' |\
|
||||
grep -Fm1 "API ${ANDROID_API_LEVEL}" |\
|
||||
awk '{print $1}' | tr -d '-')
|
||||
if [[ -z "${SDK_ID}" ]]; then
|
||||
echo "Could not find SDK package for API level ${ANDROID_API_LEVEL}, make sure it's available using:"
|
||||
echo " $BASE/sdk/android-sdk-r${SDK_REV}/tools/android list sdk"
|
||||
echo "and check if it's in there."
|
||||
exit 1
|
||||
fi
|
||||
# Install base SDKs.
|
||||
echo "${ANDROID_AGREE_LICENSE_TERMS}" | ./tools/android -s update sdk --no-ui -a --filter "${SDK_ID},tool,platform-tool" || exit 1
|
||||
|
||||
# Get SDK system image ID.
|
||||
case "${ANDROID_PLATFORM}" in
|
||||
arm)
|
||||
ABI_SEARCH_TERM="ARM EABI"
|
||||
ABI_OPT="armeabi-v7a"
|
||||
;;
|
||||
mips)
|
||||
echo "Unsupported Android test platform: ${ANDROID_PLATFORM}"
|
||||
echo "This platform has no system images available to test with."
|
||||
exit 1
|
||||
;;
|
||||
x86)
|
||||
ABI_SEARCH_TERM="Intel x86"
|
||||
ABI_OPT="x86"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown Android platform: ${ANDROID_PLATFORM}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
ABI_IMG_ID=$(./tools/android -s list sdk -a |\
|
||||
grep -F 'System Image' |\
|
||||
grep -F "${ABI_SEARCH_TERM}" |\
|
||||
grep -Fm1 "API ${ANDROID_API_LEVEL}" |\
|
||||
awk '{print $1}' | tr -d '-')
|
||||
if [[ -z "${ABI_IMG_ID}" ]]; then
|
||||
echo "Could not find ${ABI_SEARCH_TERM} system image for API level ${ANDROID_API_LEVEL}, make sure it's available using:"
|
||||
echo " $BASE/sdk/android-sdk-r${SDK_REV}/tools/android list sdk"
|
||||
echo "and check if it's in there."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install SDK system image
|
||||
echo "${ANDROID_AGREE_LICENSE_TERMS}" | ./tools/android -s update sdk --no-ui -a --filter "${ABI_IMG_ID}" || exit 1
|
||||
|
||||
# Make a VM.
|
||||
[[ ! -d "${ANDROID_TEST_PREFIX}" ]] && (mkdir "${ANDROID_TEST_PREFIX}" || exit 1)
|
||||
echo n | ./tools/android -s create avd -f \
|
||||
-t "android-${ANDROID_API_LEVEL}" \
|
||||
-n "${ANDROID_VM_NAME}-${TEST_IDENTIFIER}" \
|
||||
-p "${ANDROID_TEST_PREFIX}/${TEST_IDENTIFIER}" \
|
||||
-b "${ABI_OPT}" \
|
||||
|| exit 1
|
||||
|
||||
# We're done here.
|
||||
popd > /dev/null
|
||||
15
project/jni/python3/mk/xz/5.2.1/build.sh
Normal file
15
project/jni/python3/mk/xz/5.2.1/build.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
pushd src >/dev/null
|
||||
|
||||
rm -rf "${PACKAGE}"
|
||||
tar -xf "${PACKAGE}.tar.xz" || exit 1
|
||||
pushd "${PACKAGE}" >/dev/null
|
||||
|
||||
patch -p1 < "${FILESDIR}/${PACKAGE}-disable-so-versioning.patch" || exit 1
|
||||
./configure --prefix="${PREFIX}" --host="${TARGET}" --build="${HOST}" --disable-shared --disable-xz --disable-xzdec --disable-lzmadec --disable-lzmainfo --disable-lzma-links --disable-scripts || exit 1
|
||||
make || exit 1
|
||||
make install || exit 1
|
||||
# Remove documentation.
|
||||
rm -rf "${PREFIX}/share/doc"
|
||||
|
||||
popd >/dev/null
|
||||
popd >/dev/null
|
||||
1
project/jni/python3/mk/xz/5.2.1/sources.txt
Normal file
1
project/jni/python3/mk/xz/5.2.1/sources.txt
Normal file
@@ -0,0 +1 @@
|
||||
http://tukaani.org/xz/xz-5.2.1.tar.xz
|
||||
@@ -0,0 +1,25 @@
|
||||
diff -Nru xz-5.2.1-old/src/liblzma/Makefile.am xz-5.2.1/src/liblzma/Makefile.am
|
||||
--- xz-5.2.1-old/src/liblzma/Makefile.am 2015-07-21 14:35:24.124356586 +0000
|
||||
+++ xz-5.2.1/src/liblzma/Makefile.am 2015-07-21 14:36:25.768356450 +0000
|
||||
@@ -24,7 +24,7 @@
|
||||
-I$(top_srcdir)/src/liblzma/simple \
|
||||
-I$(top_srcdir)/src/common \
|
||||
-DTUKLIB_SYMBOL_PREFIX=lzma_
|
||||
-liblzma_la_LDFLAGS = -no-undefined -version-info 7:1:2
|
||||
+liblzma_la_LDFLAGS = -no-undefined -version-info 7:1:2 -avoid-version
|
||||
|
||||
EXTRA_DIST += liblzma.map validate_map.sh
|
||||
if COND_SYMVERS
|
||||
diff -Nru xz-5.2.1-old/src/liblzma/Makefile.in xz-5.2.1/src/liblzma/Makefile.in
|
||||
--- xz-5.2.1-old/src/liblzma/Makefile.in 2015-07-21 14:35:24.124356586 +0000
|
||||
+++ xz-5.2.1/src/liblzma/Makefile.in 2015-07-21 14:37:15.412356340 +0000
|
||||
@@ -747,7 +747,7 @@
|
||||
-I$(top_srcdir)/src/common \
|
||||
-DTUKLIB_SYMBOL_PREFIX=lzma_
|
||||
|
||||
-liblzma_la_LDFLAGS = -no-undefined -version-info 7:1:2 $(am__append_1) \
|
||||
+liblzma_la_LDFLAGS = -no-undefined -version-info 7:1:2 -avoid-version $(am__append_1) \
|
||||
$(am__append_41)
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = liblzma.pc
|
||||
|
||||
81
project/jni/python3/setCrossEnvironment-arm64-v8a.sh
Executable file
81
project/jni/python3/setCrossEnvironment-arm64-v8a.sh
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/bin/sh
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
MYARCH=linux-x86_64
|
||||
if uname -s | grep -i "linux" > /dev/null ; then
|
||||
MYARCH=linux-x86_64
|
||||
fi
|
||||
if uname -s | grep -i "darwin" > /dev/null ; then
|
||||
MYARCH=darwin-x86_64
|
||||
fi
|
||||
if uname -s | grep -i "windows" > /dev/null ; then
|
||||
MYARCH=windows-x86_64
|
||||
fi
|
||||
|
||||
NDK=`which ndk-build`
|
||||
NDK=`dirname $NDK`
|
||||
NDK=`readlink -f $NDK`
|
||||
|
||||
[ -z "$NDK" ] && { echo "You need Andorid NDK r8 or newer installed to run this script" ; exit 1 ; }
|
||||
GCCPREFIX=aarch64-linux-android
|
||||
GCCVER=${GCCVER:-4.9}
|
||||
PLATFORMVER=${PLATFORMVER:-android-21}
|
||||
LOCAL_PATH=`dirname $0`
|
||||
if which realpath > /dev/null ; then
|
||||
LOCAL_PATH=`realpath $LOCAL_PATH`
|
||||
else
|
||||
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
|
||||
fi
|
||||
ARCH=arm64-v8a
|
||||
|
||||
CFLAGS="\
|
||||
-fpic -ffunction-sections -funwind-tables -fstack-protector-strong \
|
||||
-no-canonical-prefixes \
|
||||
-O2 -g -DNDEBUG \
|
||||
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=300 \
|
||||
-DANDROID -Wall -Wno-unused -Wa,--noexecstack -Wformat -Werror=format-security \
|
||||
-isystem$NDK/platforms/$PLATFORMVER/arch-arm64/usr/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH/include \
|
||||
$CFLAGS"
|
||||
|
||||
UNRESOLVED="-Wl,--no-undefined"
|
||||
SHARED="-Wl,--gc-sections -Wl,-z,nocopyreloc"
|
||||
if [ -n "$BUILD_LIBRARY" ]; then
|
||||
[ -z "$SHARED_LIBRARY_NAME" ] && SHARED_LIBRARY_NAME=libapplication.so
|
||||
SHARED="-shared -Wl,-soname,$SHARED_LIBRARY_NAME"
|
||||
fi
|
||||
if [ -n "$ALLOW_UNRESOLVED_SYMBOLS" ]; then
|
||||
UNRESOLVED=
|
||||
fi
|
||||
|
||||
LDFLAGS="\
|
||||
$SHARED \
|
||||
--sysroot=$NDK/platforms/$PLATFORMVER/arch-arm64 \
|
||||
-L$NDK/platforms/$PLATFORMVER/arch-arm64/usr/lib \
|
||||
-lc -lm -ldl -lz \
|
||||
-L$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH \
|
||||
-lgnustl_static \
|
||||
-no-canonical-prefixes $UNRESOLVED -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now \
|
||||
-Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings \
|
||||
-lsupc++ \
|
||||
$LDFLAGS"
|
||||
|
||||
env PATH=$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \
|
||||
ANDROID_DEV=$NDK/platforms/$PLATFORMVER/arch-arm64/usr \
|
||||
CFLAGS="$CFLAGS" \
|
||||
CXXFLAGS="$CXXFLAGS $CFLAGS" \
|
||||
LDFLAGS="$LDFLAGS" \
|
||||
CC="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-gcc" \
|
||||
CXX="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-g++" \
|
||||
RANLIB="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \
|
||||
LD="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ld" \
|
||||
AR="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \
|
||||
CPP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-cpp $CFLAGS" \
|
||||
CXXCPP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-cpp -x c++ $CFLAGS" \
|
||||
NM="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \
|
||||
AS="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \
|
||||
STRIP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \
|
||||
"$@"
|
||||
80
project/jni/python3/setCrossEnvironment-armeabi-v7a.sh
Executable file
80
project/jni/python3/setCrossEnvironment-armeabi-v7a.sh
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/sh
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
MYARCH=linux-x86_64
|
||||
if uname -s | grep -i "linux" > /dev/null ; then
|
||||
MYARCH=linux-x86_64
|
||||
fi
|
||||
if uname -s | grep -i "darwin" > /dev/null ; then
|
||||
MYARCH=darwin-x86_64
|
||||
fi
|
||||
if uname -s | grep -i "windows" > /dev/null ; then
|
||||
MYARCH=windows-x86_64
|
||||
fi
|
||||
|
||||
NDK=`which ndk-build`
|
||||
NDK=`dirname $NDK`
|
||||
NDK=`readlink -f $NDK`
|
||||
|
||||
[ -z "$NDK" ] && { echo "You need Andorid NDK r8 or newer installed to run this script" ; exit 1 ; }
|
||||
GCCPREFIX=arm-linux-androideabi
|
||||
GCCVER=${GCCVER:-4.9}
|
||||
PLATFORMVER=${PLATFORMVER:-android-14}
|
||||
LOCAL_PATH=`dirname $0`
|
||||
if which realpath > /dev/null ; then
|
||||
LOCAL_PATH=`realpath $LOCAL_PATH`
|
||||
else
|
||||
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
|
||||
fi
|
||||
ARCH=armeabi-v7a
|
||||
|
||||
CFLAGS="\
|
||||
-fpic -ffunction-sections -funwind-tables -fstack-protector \
|
||||
-no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb \
|
||||
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -marm -fno-omit-frame-pointer \
|
||||
-DANDROID -DNDEBUG -O2 -g -finline-functions -Wa,--noexecstack -Wformat -Werror=format-security \
|
||||
-isystem$NDK/platforms/$PLATFORMVER/arch-arm/usr/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH/include \
|
||||
$CFLAGS"
|
||||
|
||||
UNRESOLVED="-Wl,--no-undefined"
|
||||
SHARED="-Wl,--gc-sections -Wl,-z,nocopyreloc"
|
||||
if [ -n "$BUILD_LIBRARY" ]; then
|
||||
[ -z "$SHARED_LIBRARY_NAME" ] && SHARED_LIBRARY_NAME=libapplication.so
|
||||
SHARED="-shared -Wl,-soname,$SHARED_LIBRARY_NAME"
|
||||
fi
|
||||
if [ -n "$ALLOW_UNRESOLVED_SYMBOLS" ]; then
|
||||
UNRESOLVED=
|
||||
fi
|
||||
|
||||
LDFLAGS="\
|
||||
$SHARED \
|
||||
--sysroot=$NDK/platforms/$PLATFORMVER/arch-arm \
|
||||
-L$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib \
|
||||
-lc -lm -ldl -lz \
|
||||
-L$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH \
|
||||
-lgnustl_static \
|
||||
-march=armv7-a -Wl,--fix-cortex-a8 \
|
||||
-no-canonical-prefixes $UNRESOLVED -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now \
|
||||
-lsupc++ \
|
||||
$LDFLAGS"
|
||||
|
||||
env PATH=$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \
|
||||
ANDROID_DEV=$NDK/platforms/$PLATFORMVER/arch-arm/usr \
|
||||
CFLAGS="$CFLAGS" \
|
||||
CXXFLAGS="$CXXFLAGS $CFLAGS" \
|
||||
LDFLAGS="$LDFLAGS" \
|
||||
CC="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-gcc" \
|
||||
CXX="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-g++" \
|
||||
RANLIB="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \
|
||||
LD="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ld" \
|
||||
AR="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \
|
||||
CPP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-cpp $CFLAGS" \
|
||||
CXXCPP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-cpp -x c++ $CFLAGS" \
|
||||
NM="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \
|
||||
AS="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \
|
||||
STRIP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \
|
||||
"$@"
|
||||
80
project/jni/python3/setCrossEnvironment-armeabi.sh
Executable file
80
project/jni/python3/setCrossEnvironment-armeabi.sh
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/sh
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
MYARCH=linux-x86_64
|
||||
if uname -s | grep -i "linux" > /dev/null ; then
|
||||
MYARCH=linux-x86_64
|
||||
fi
|
||||
if uname -s | grep -i "darwin" > /dev/null ; then
|
||||
MYARCH=darwin-x86_64
|
||||
fi
|
||||
if uname -s | grep -i "windows" > /dev/null ; then
|
||||
MYARCH=windows-x86_64
|
||||
fi
|
||||
|
||||
NDK=`which ndk-build`
|
||||
NDK=`dirname $NDK`
|
||||
NDK=`readlink -f $NDK`
|
||||
|
||||
[ -z "$NDK" ] && { echo "You need Andorid NDK r8 or newer installed to run this script" ; exit 1 ; }
|
||||
GCCPREFIX=arm-linux-androideabi
|
||||
GCCVER=${GCCVER:-4.9}
|
||||
PLATFORMVER=${PLATFORMVER:-android-14}
|
||||
LOCAL_PATH=`dirname $0`
|
||||
if which realpath > /dev/null ; then
|
||||
LOCAL_PATH=`realpath $LOCAL_PATH`
|
||||
else
|
||||
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
|
||||
fi
|
||||
ARCH=armeabi
|
||||
#ARCH=armeabi-v7a
|
||||
|
||||
CFLAGS="\
|
||||
-fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \
|
||||
-no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -mthumb \
|
||||
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \
|
||||
-DANDROID -DNDEBUG -O2 -g -finline-functions -Wa,--noexecstack \
|
||||
-isystem$NDK/platforms/$PLATFORMVER/arch-arm/usr/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH/include \
|
||||
$CFLAGS"
|
||||
|
||||
UNRESOLVED="-Wl,--no-undefined"
|
||||
SHARED="-Wl,--gc-sections -Wl,-z,nocopyreloc"
|
||||
if [ -n "$BUILD_LIBRARY" ]; then
|
||||
[ -z "$SHARED_LIBRARY_NAME" ] && SHARED_LIBRARY_NAME=libapplication.so
|
||||
SHARED="-shared -Wl,-soname,$SHARED_LIBRARY_NAME"
|
||||
fi
|
||||
if [ -n "$ALLOW_UNRESOLVED_SYMBOLS" ]; then
|
||||
UNRESOLVED=
|
||||
fi
|
||||
|
||||
LDFLAGS="\
|
||||
$SHARED \
|
||||
--sysroot=$NDK/platforms/$PLATFORMVER/arch-arm \
|
||||
-L$NDK/platforms/$PLATFORMVER/arch-arm/usr/lib \
|
||||
-lc -lm -ldl -lz \
|
||||
-L$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH \
|
||||
-lgnustl_static \
|
||||
-no-canonical-prefixes $UNRESOLVED -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now \
|
||||
-lsupc++ \
|
||||
$LDFLAGS"
|
||||
|
||||
env PATH=$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \
|
||||
ANDROID_DEV=$NDK/platforms/$PLATFORMVER/arch-arm/usr \
|
||||
CFLAGS="$CFLAGS" \
|
||||
CXXFLAGS="$CXXFLAGS $CFLAGS" \
|
||||
LDFLAGS="$LDFLAGS" \
|
||||
CC="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-gcc" \
|
||||
CXX="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-g++" \
|
||||
RANLIB="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \
|
||||
LD="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ld" \
|
||||
AR="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \
|
||||
CPP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-cpp $CFLAGS" \
|
||||
CXXCPP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-cpp -x c++ $CFLAGS" \
|
||||
NM="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \
|
||||
AS="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \
|
||||
STRIP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \
|
||||
"$@"
|
||||
82
project/jni/python3/setCrossEnvironment-mips.sh
Executable file
82
project/jni/python3/setCrossEnvironment-mips.sh
Executable file
@@ -0,0 +1,82 @@
|
||||
#!/bin/sh
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
MYARCH=linux-x86_64
|
||||
if uname -s | grep -i "linux" > /dev/null ; then
|
||||
MYARCH=linux-x86_64
|
||||
fi
|
||||
if uname -s | grep -i "darwin" > /dev/null ; then
|
||||
MYARCH=darwin-x86_64
|
||||
fi
|
||||
if uname -s | grep -i "windows" > /dev/null ; then
|
||||
MYARCH=windows-x86_64
|
||||
fi
|
||||
|
||||
NDK=`which ndk-build`
|
||||
NDK=`dirname $NDK`
|
||||
NDK=`readlink -f $NDK`
|
||||
|
||||
[ -z "$NDK" ] && { echo "You need Andorid NDK r8 or newer installed to run this script" ; exit 1 ; }
|
||||
GCCPREFIX=mipsel-linux-android
|
||||
GCCVER=${GCCVER:-4.9}
|
||||
PLATFORMVER=${PLATFORMVER:-android-14}
|
||||
LOCAL_PATH=`dirname $0`
|
||||
if which realpath > /dev/null ; then
|
||||
LOCAL_PATH=`realpath $LOCAL_PATH`
|
||||
else
|
||||
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
|
||||
fi
|
||||
ARCH=mips
|
||||
|
||||
CFLAGS="\
|
||||
-fpic -fno-strict-aliasing -finline-functions -ffunction-sections \
|
||||
-funwind-tables -fmessage-length=0 -fno-inline-functions-called-once \
|
||||
-fgcse-after-reload -frerun-cse-after-loop -frename-registers \
|
||||
-no-canonical-prefixes -O2 -g -DNDEBUG -fomit-frame-pointer \
|
||||
-funswitch-loops -finline-limit=300 \
|
||||
-DANDROID -Wall -Wno-unused -Wa,--noexecstack -Wformat -Werror=format-security \
|
||||
-isystem$NDK/platforms/$PLATFORMVER/arch-mips/usr/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH/include \
|
||||
$CFLAGS"
|
||||
|
||||
|
||||
UNRESOLVED="-Wl,--no-undefined"
|
||||
SHARED="-Wl,--gc-sections -Wl,-z,nocopyreloc"
|
||||
if [ -n "$BUILD_LIBRARY" ]; then
|
||||
[ -z "$SHARED_LIBRARY_NAME" ] && SHARED_LIBRARY_NAME=libapplication.so
|
||||
SHARED="-shared -Wl,-soname,$SHARED_LIBRARY_NAME"
|
||||
fi
|
||||
if [ -n "$ALLOW_UNRESOLVED_SYMBOLS" ]; then
|
||||
UNRESOLVED=
|
||||
fi
|
||||
|
||||
LDFLAGS="\
|
||||
$SHARED \
|
||||
--sysroot=$NDK/platforms/$PLATFORMVER/arch-mips \
|
||||
-L$NDK/platforms/$PLATFORMVER/arch-mips/usr/lib \
|
||||
-lc -lm -ldl -lz \
|
||||
-L$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH \
|
||||
-lgnustl_static \
|
||||
-no-canonical-prefixes $UNRESOLVED -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now \
|
||||
-lsupc++ \
|
||||
$LDFLAGS"
|
||||
|
||||
env PATH=$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \
|
||||
ANDROID_DEV=$NDK/platforms/$PLATFORMVER/arch-mips/usr \
|
||||
CFLAGS="$CFLAGS" \
|
||||
CXXFLAGS="$CXXFLAGS $CFLAGS" \
|
||||
LDFLAGS="$LDFLAGS" \
|
||||
CC="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-gcc" \
|
||||
CXX="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-g++" \
|
||||
RANLIB="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \
|
||||
LD="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ld" \
|
||||
AR="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \
|
||||
CPP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-cpp $CFLAGS" \
|
||||
CXXCPP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-cpp -x c++ $CFLAGS" \
|
||||
NM="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \
|
||||
AS="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \
|
||||
STRIP="$NDK/toolchains/$GCCPREFIX-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \
|
||||
"$@"
|
||||
80
project/jni/python3/setCrossEnvironment-x86.sh
Executable file
80
project/jni/python3/setCrossEnvironment-x86.sh
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/sh
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
MYARCH=linux-x86_64
|
||||
if uname -s | grep -i "linux" > /dev/null ; then
|
||||
MYARCH=linux-x86_64
|
||||
fi
|
||||
if uname -s | grep -i "darwin" > /dev/null ; then
|
||||
MYARCH=darwin-x86_64
|
||||
fi
|
||||
if uname -s | grep -i "windows" > /dev/null ; then
|
||||
MYARCH=windows-x86_64
|
||||
fi
|
||||
|
||||
NDK=`which ndk-build`
|
||||
NDK=`dirname $NDK`
|
||||
NDK=`readlink -f $NDK`
|
||||
|
||||
[ -z "$NDK" ] && { echo "You need Andorid NDK r8 or newer installed to run this script" ; exit 1 ; }
|
||||
GCCPREFIX=i686-linux-android
|
||||
GCCVER=${GCCVER:-4.9}
|
||||
PLATFORMVER=${PLATFORMVER:-android-14}
|
||||
LOCAL_PATH=`dirname $0`
|
||||
if which realpath > /dev/null ; then
|
||||
LOCAL_PATH=`realpath $LOCAL_PATH`
|
||||
else
|
||||
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
|
||||
fi
|
||||
ARCH=x86
|
||||
|
||||
CFLAGS="\
|
||||
-fpic -ffunction-sections -funwind-tables -no-canonical-prefixes \
|
||||
-fstack-protector -O2 -g -DNDEBUG \
|
||||
-fomit-frame-pointer -fstrict-aliasing -funswitch-loops \
|
||||
-finline-limit=300 \
|
||||
-DANDROID -Wall -Wno-unused -Wa,--noexecstack -Wformat -Werror=format-security \
|
||||
-isystem$NDK/platforms/$PLATFORMVER/arch-x86/usr/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/include \
|
||||
-isystem$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH/include \
|
||||
$CFLAGS"
|
||||
|
||||
UNRESOLVED="-Wl,--no-undefined"
|
||||
SHARED="-Wl,--gc-sections -Wl,-z,nocopyreloc"
|
||||
if [ -n "$BUILD_LIBRARY" ]; then
|
||||
[ -z "$SHARED_LIBRARY_NAME" ] && SHARED_LIBRARY_NAME=libapplication.so
|
||||
SHARED="-shared -Wl,-soname,$SHARED_LIBRARY_NAME"
|
||||
fi
|
||||
if [ -n "$ALLOW_UNRESOLVED_SYMBOLS" ]; then
|
||||
UNRESOLVED=
|
||||
fi
|
||||
|
||||
LDFLAGS="\
|
||||
$SHARED \
|
||||
--sysroot=$NDK/platforms/$PLATFORMVER/arch-x86 \
|
||||
-L$NDK/platforms/$PLATFORMVER/arch-x86/usr/lib \
|
||||
-lc -lm -ldl -lz \
|
||||
-L$NDK/sources/cxx-stl/gnu-libstdc++/$GCCVER/libs/$ARCH \
|
||||
-lgnustl_static \
|
||||
-no-canonical-prefixes $UNRESOLVED -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now \
|
||||
-lsupc++ \
|
||||
$LDFLAGS"
|
||||
|
||||
env PATH=$NDK/toolchains/$ARCH-$GCCVER/prebuilt/$MYARCH/bin:$LOCAL_PATH:$PATH \
|
||||
ANDROID_DEV=$NDK/platforms/$PLATFORMVER/arch-x86/usr \
|
||||
CFLAGS="$CFLAGS" \
|
||||
CXXFLAGS="$CXXFLAGS $CFLAGS" \
|
||||
LDFLAGS="$LDFLAGS" \
|
||||
CC="$NDK/toolchains/$ARCH-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-gcc" \
|
||||
CXX="$NDK/toolchains/$ARCH-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-g++" \
|
||||
RANLIB="$NDK/toolchains/$ARCH-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ranlib" \
|
||||
LD="$NDK/toolchains/$ARCH-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ld" \
|
||||
AR="$NDK/toolchains/$ARCH-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-ar" \
|
||||
CPP="$NDK/toolchains/$ARCH-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-cpp $CFLAGS" \
|
||||
CXXCPP="$NDK/toolchains/$ARCH-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-cpp -x c++ $CFLAGS" \
|
||||
NM="$NDK/toolchains/$ARCH-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-nm" \
|
||||
AS="$NDK/toolchains/$ARCH-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-as" \
|
||||
STRIP="$NDK/toolchains/$ARCH-$GCCVER/prebuilt/$MYARCH/bin/$GCCPREFIX-strip" \
|
||||
"$@"
|
||||
Submodule project/jni/shmem updated: f6b49516cf...c2a28f528d
Reference in New Issue
Block a user