Skip to content

Commit

Permalink
(#9836) - [android-ndk] add r24, provide r23b for Linux/Macos
Browse files Browse the repository at this point in the history
Signed-off-by: SSE4 <[email protected]>
  • Loading branch information
SSE4 authored Mar 28, 2022
1 parent 1cdaee9 commit 978fe35
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
22 changes: 22 additions & 0 deletions recipes/android-ndk/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ sources:
"x86_64":
url: "https://dl.google.com/android/repository/android-ndk-r23b-windows.zip"
sha256: "36270f8b2cfdd940f410bd8ffe6ce86ffaa8e87ff1c4fd4a8be5130268357778"
"Linux":
"x86_64":
url: "https://dl.google.com/android/repository/android-ndk-r23b-linux.zip"
sha256: "c6e97f9c8cfe5b7be0a9e6c15af8e7a179475b7ded23e2d1c1fa0945d6fb4382"
"Macos":
"x86_64":
url: "https://dl.google.com/android/repository/android-ndk-r23b-darwin.zip"
sha256: "e067b7402fdae85bfbe8af1822afd573b8e73dce443a8292fdaeb2e8dc3aeb86"
"r23":
url:
"Windows":
Expand Down Expand Up @@ -75,3 +83,17 @@ sources:
"x86_64":
url: "https://dl.google.com/android/repository/android-ndk-r21d-darwin-x86_64.zip"
sha256: "5851115c6fc4cce26bc320295b52da240665d7ff89bda2f5d5af1887582f5c48"
"r24":
url:
"Windows":
"x86_64":
url: "https://dl.google.com/android/repository/android-ndk-r24-windows.zip"
sha256: "b2a9fab1481c3c21df0b78608747dde0747b50890134a62a81c983a5250066d6"
"Linux":
"x86_64":
url: "https://dl.google.com/android/repository/android-ndk-r24-linux.zip"
sha256: "caac638f060347c9aae994e718ba00bb18413498d8e0ad4e12e1482964032997"
"Macos":
"x86_64":
url: "https://dl.google.com/android/repository/android-ndk-r24-darwin.zip"
sha256: "162a7000515be07489f2ed70d6d3a117d236150f83f3fcb601c163349429ba23"
17 changes: 16 additions & 1 deletion recipes/android-ndk/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def validate(self):
raise ConanInvalidConfiguration(f"os,arch={self.settings.os},{self.settings.arch} is not supported by {self.name} (no binaries are available)")

def build(self):
if self.version in ['r23', 'r23b']:
if self.version in ['r23', 'r23b', 'r24']:
data = self.conan_data["sources"][self.version]["url"][str(self.settings.os)][str(self.settings.arch)]
unzip_fix_symlinks(url=data["url"], target_folder=self._source_subfolder, sha256=data["sha256"])
else:
Expand All @@ -50,6 +50,7 @@ def package(self):
self.copy("*NOTICE.toolchain", src=self._source_subfolder, dst="licenses")
self.copy("cmake-wrapper.cmd")
self.copy("cmake-wrapper")
self._fix_broken_links()
self._fix_permissions()

# from here on, everything is assumed to run in 2 profile mode, using this android-ndk recipe as a build requirement
Expand Down Expand Up @@ -136,6 +137,20 @@ def _fix_permissions(self):
self.output.info(f"chmod on Mach-O file: '{filename}'")
self._chmod_plus_x(filename)

def _fix_broken_links(self):
# https://github.com/android/ndk/issues/1671
# https://github.com/android/ndk/issues/1569
if self.version == "r23b" and self.settings.os in ["Linux", "Macos"]:
platform = "darwin" if self.settings.os == "Macos" else "linux"
links = {f"toolchains/llvm/prebuilt/{platform}-x86_64/aarch64-linux-android/bin/as": "../../bin/aarch64-linux-android-as",
f"toolchains/llvm/prebuilt/{platform}-x86_64/arm-linux-androideabi/bin/as": "../../bin/arm-linux-androideabi-as",
f"toolchains/llvm/prebuilt/{platform}-x86_64/x86_64-linux-android/bin/as": "../../bin/x86_64-linux-android-as",
f"toolchains/llvm/prebuilt/{platform}-x86_64/i686-linux-android/bin/as": "../../bin/i686-linux-android-as"}
for path, target in links.items():
path = os.path.join(self.package_folder, path)
os.unlink(path)
os.symlink(target, path)

@property
def _host(self):
return f"{self._platform}-{self.settings.arch}"
Expand Down
2 changes: 2 additions & 0 deletions recipes/android-ndk/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ versions:
folder: all
"r21d":
folder: all
"r24":
folder: all

0 comments on commit 978fe35

Please sign in to comment.