forked from kivy/python-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix build for case-insensitive FS and add CI test for OSX (kivy#1951)
* [python] Fix build for case-insensitive FS 🍎 It turns out that the generated python binary for some builds are named `python.exe` instead of `python`. This depends on the File System where the build happens. It will be named `python.exe` when the FS is case-insensitive (Mac OSX and Cygwin), but it will be named `python` when the FS is case-sensitive (most GNU Linux distributions). The proposed solution consists in make a copy of the generated python binary with a given name (python3 or python2) so this way To achieve this goal we refactor a little our `HostPythonRecipe`: - add private property `HostPythonRecipe._exe_name` (the name of the python executable based on major version) - add public property `HostPythonRecipe.python_exe` (the full path of the python executable) - implement `HostPythonRecipe.should_build` And also it's affected the `GuestPythonRecipe`, because we need to use the generated python executable by `HostPythonRecipe`: - add private property `GuestPythonRecipe._libpython` (python's library name with extension...hardcoded for now...) - implement `GuestPythonRecipe.should_build`... to check the library instead of the executable so we avoid conflicts with case-insensitive FS We also need: - fix `PythonRecipe.real_hostpython_location` because the name of our host python executable will depend on major version - fix python2 interpreter (fix-interpreter-version.patch) Note: the variation of the name of the python's executable is mentioned at python's build docs (https://github.com/python/cpython/blob/3.7/README.rst#build-instructions) Note: @TheSin- , ¡¡¡thanks for your debugging sessions!!! * [ci] Add Mac OSX CI's test & refactor android's NDK/SDK installation To do so we: - create a makefile to install the necessary dependencies for Mac OS X: `ci/makefiles/osx.mk` - create a makefile to install android's SDK/NDK: `ci/makefiles/android.mk` - refactor docker files: make use of android's makefile - change OS, from `linux` to `osx`, for CI test `Python 3 armeabi-v7a`, so we don't increase the overall build time and jobs - rename the `Python 2` test to `Python 2 armeabi-v7a (with numpy)` to reflect the build arch and numpy's build.
- Loading branch information
1 parent
b3215a6
commit df77774
Showing
9 changed files
with
221 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Downloads and installs the Android SDK depending on supplied platform: darwin or linux | ||
|
||
# We must provide a platform (darwin or linux) and we need JAVA_HOME defined | ||
ifndef target_os | ||
$(error target_os is not set...aborted!) | ||
endif | ||
|
||
# Those android NDK/SDK variables can be override when running the file | ||
ANDROID_NDK_VERSION ?= 17c | ||
ANDROID_SDK_TOOLS_VERSION ?= 4333796 | ||
ANDROID_SDK_BUILD_TOOLS_VERSION ?= 28.0.2 | ||
ANDROID_HOME ?= $(HOME)/.android | ||
ANDROID_API_LEVEL ?= 27 | ||
|
||
ANDROID_SDK_HOME=$(ANDROID_HOME)/android-sdk | ||
ANDROID_SDK_TOOLS_ARCHIVE=sdk-tools-$(target_os)-$(ANDROID_SDK_TOOLS_VERSION).zip | ||
ANDROID_SDK_TOOLS_DL_URL=https://dl.google.com/android/repository/$(ANDROID_SDK_TOOLS_ARCHIVE) | ||
|
||
ANDROID_NDK_HOME=$(ANDROID_HOME)/android-ndk | ||
ANDROID_NDK_FOLDER=$(ANDROID_HOME)/android-ndk-r$(ANDROID_NDK_VERSION) | ||
ANDROID_NDK_ARCHIVE=android-ndk-r$(ANDROID_NDK_VERSION)-$(target_os)-x86_64.zip | ||
ANDROID_NDK_DL_URL=https://dl.google.com/android/repository/$(ANDROID_NDK_ARCHIVE) | ||
|
||
$(info Target install OS is : $(target_os)) | ||
$(info Android SDK home is : $(ANDROID_SDK_HOME)) | ||
$(info Android NDK home is : $(ANDROID_NDK_HOME)) | ||
$(info Android SDK download url is : $(ANDROID_SDK_TOOLS_DL_URL)) | ||
$(info Android NDK download url is : $(ANDROID_NDK_DL_URL)) | ||
$(info Android API level is : $(ANDROID_API_LEVEL)) | ||
$(info Android NDK version is : $(ANDROID_NDK_VERSION)) | ||
$(info JAVA_HOME is : $(JAVA_HOME)) | ||
|
||
all: install_sdk install_ndk | ||
|
||
install_sdk: download_android_sdk extract_android_sdk update_android_sdk | ||
|
||
install_ndk: download_android_ndk extract_android_ndk | ||
|
||
download_android_sdk: | ||
curl --location --progress-bar --continue-at - \ | ||
$(ANDROID_SDK_TOOLS_DL_URL) --output $(ANDROID_SDK_TOOLS_ARCHIVE) | ||
|
||
download_android_ndk: | ||
curl --location --progress-bar --continue-at - \ | ||
$(ANDROID_NDK_DL_URL) --output $(ANDROID_NDK_ARCHIVE) | ||
|
||
# Extract android SDK and remove the compressed file | ||
extract_android_sdk: | ||
mkdir -p $(ANDROID_SDK_HOME) \ | ||
&& unzip -q $(ANDROID_SDK_TOOLS_ARCHIVE) -d $(ANDROID_SDK_HOME) \ | ||
&& rm -f $(ANDROID_SDK_TOOLS_ARCHIVE) | ||
|
||
|
||
# Extract android NDK and remove the compressed file | ||
extract_android_ndk: | ||
mkdir -p $(ANDROID_NDK_FOLDER) \ | ||
&& unzip -q $(ANDROID_NDK_ARCHIVE) -d $(ANDROID_HOME) \ | ||
&& ln -sfn $(ANDROID_NDK_FOLDER) $(ANDROID_NDK_HOME) \ | ||
&& rm -f $(ANDROID_NDK_ARCHIVE) | ||
|
||
# updates Android SDK, install Android API, Build Tools and accept licenses | ||
update_android_sdk: | ||
touch $(ANDROID_HOME)/repositories.cfg | ||
yes | $(ANDROID_SDK_HOME)/tools/bin/sdkmanager --licenses > /dev/null | ||
$(ANDROID_SDK_HOME)/tools/bin/sdkmanager "build-tools;$(ANDROID_SDK_BUILD_TOOLS_VERSION)" > /dev/null | ||
$(ANDROID_SDK_HOME)/tools/bin/sdkmanager "platforms;android-$(ANDROID_API_LEVEL)" > /dev/null | ||
# Set avdmanager permissions (executable) | ||
chmod +x $(ANDROID_SDK_HOME)/tools/bin/avdmanager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# installs java 1.8, android's SDK/NDK, cython and p4a | ||
|
||
# The following variable/s can be override when running the file | ||
ANDROID_HOME ?= $(HOME)/.android | ||
|
||
all: install_java upgrade_cython install_android_ndk_sdk install_p4a | ||
|
||
install_java: | ||
brew tap adoptopenjdk/openjdk | ||
brew cask install adoptopenjdk8 | ||
/usr/libexec/java_home -V | ||
|
||
upgrade_cython: | ||
pip3 install --upgrade Cython==0.28.6 | ||
|
||
install_android_ndk_sdk: | ||
mkdir -p $(ANDROID_HOME) | ||
make -f ci/makefiles/android.mk target_os=darwin JAVA_HOME=`/usr/libexec/java_home -v 1.8` | ||
|
||
install_p4a: | ||
# check python version and install p4a | ||
python3 --version | ||
pip3 install -e . |
Oops, something went wrong.