Skip to content

Commit

Permalink
addpkg(main): dotnet9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
truboxl committed Jan 22, 2025
1 parent 7772613 commit 6a9d9f5
Show file tree
Hide file tree
Showing 27 changed files with 843 additions and 8 deletions.
7 changes: 3 additions & 4 deletions packages/dotnet-host/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://dotnet.microsoft.com/en-us/
TERMUX_PKG_DESCRIPTION="A metapackage for .NET Host"
TERMUX_PKG_LICENSE="Public Domain"
TERMUX_PKG_MAINTAINER="@truboxl"
TERMUX_PKG_VERSION="8.0"
TERMUX_PKG_REVISION=1
TERMUX_PKG_DEPENDS="dotnet-host-8.0"
TERMUX_PKG_ANTI_BUILD_DEPENDS="dotnet-host-8.0"
TERMUX_PKG_VERSION="9.0"
TERMUX_PKG_DEPENDS="dotnet-host-9.0 | dotnet-host-8.0"
TERMUX_PKG_ANTI_BUILD_DEPENDS="dotnet-host-9.0, dotnet-host-8.0"
TERMUX_PKG_AUTO_UPDATE=false
TERMUX_PKG_METAPACKAGE=true
TERMUX_PKG_PLATFORM_INDEPENDENT=true
Expand Down
17 changes: 17 additions & 0 deletions packages/dotnet9.0/0001-build-all-libs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- a/src/runtime/src/native/libs/CMakeLists.txt
+++ b/src/runtime/src/native/libs/CMakeLists.txt
@@ -150,13 +150,10 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
#add_subdirectory(System.Net.Security.Native) # no gssapi on tvOS, see https://developer.apple.com/documentation/gss
# System.Security.Cryptography.Native is intentionally disabled on tvOS
# it is only used for interacting with OpenSSL which isn't useful there
- elseif (CLR_CMAKE_TARGET_ANDROID AND NOT FORCE_ANDROID_OPENSSL)
- add_subdirectory(System.Security.Cryptography.Native.Android)
- elseif (FORCE_ANDROID_OPENSSL)
- add_subdirectory(System.Security.Cryptography.Native)
else ()
add_subdirectory(System.Net.Security.Native)
add_subdirectory(System.Security.Cryptography.Native)
+ add_subdirectory(System.Security.Cryptography.Native.Android)
endif ()

if (CLR_CMAKE_TARGET_APPLE)
11 changes: 11 additions & 0 deletions packages/dotnet9.0/0002-define-memfd_create.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/src/runtime/src/coreclr/minipal/Unix/doublemapping.cpp
+++ b/src/runtime/src/coreclr/minipal/Unix/doublemapping.cpp
@@ -14,7 +14,7 @@
#include <assert.h>
#include <limits.h>
#include <errno.h>
-#if defined(TARGET_LINUX) && !defined(MFD_CLOEXEC)
+#if (defined(TARGET_LINUX) && !defined(MFD_CLOEXEC)) || defined(TARGET_ANDROID)
#include <linux/memfd.h>
#include <sys/syscall.h> // __NR_memfd_create
#define memfd_create(...) syscall(__NR_memfd_create, __VA_ARGS__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--- a/src/runtime/src/native/libs/System.IO.Compression.Native/CMakeLists.txt
+++ b/src/runtime/src/native/libs/System.IO.Compression.Native/CMakeLists.txt
@@ -60,7 +60,7 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
${NATIVE_LIBS_EXTRA}
)

- if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_USE_SYSTEM_BROTLI)
+ if (NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_USE_SYSTEM_BROTLI)
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/System.IO.Compression.Native_unixexports.src)
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/System.IO.Compression.Native.exports)
generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE})
@@ -114,7 +114,7 @@ else ()
endif()
endif ()

- if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI)
+ if (NOT GEN_SHARED_LIB AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI)
set(NATIVECOMPRESSION_SOURCES ${NATIVECOMPRESSION_SOURCES} entrypoints.c)
endif ()

--- a/src/runtime/src/native/libs/System.IO.Compression.Native/extra_libs.cmake
+++ b/src/runtime/src/native/libs/System.IO.Compression.Native/extra_libs.cmake
@@ -16,7 +16,7 @@ macro(append_extra_compression_libs NativeLibsExtra)
# 'zlib' represents our in-tree zlib, and is used in all other platforms
# that don't meet any of the previous special requirements, like most
# regular Unix and Windows builds.
- list(APPEND ZLIB_LIBRARIES $<IF:$<BOOL:${CLR_CMAKE_USE_SYSTEM_ZLIB}>,z,zlib>)
+ list(APPEND ZLIB_LIBRARIES $<IF:$<BOOL:${CLR_CMAKE_USE_SYSTEM_ZLIB}>,z,zlib> m)
endif ()
list(APPEND ${NativeLibsExtra} ${ZLIB_LIBRARIES})

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- a/src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.c
+++ b/src/runtime/src/native/libs/System.Security.Cryptography.Native/opensslshim.c
@@ -77,14 +77,6 @@ static void OpenLibraryOnce(void)
DlOpen(soName);
}

-#ifdef TARGET_ANDROID
- if (libssl == NULL)
- {
- // Android OpenSSL has no soname
- DlOpen(LIBNAME);
- }
-#endif
-
if (libssl == NULL)
{
// Prefer OpenSSL 3.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
--- a/src/runtime/eng/common/cross/toolchain.cmake
+++ b/src/runtime/eng/common/cross/toolchain.cmake
@@ -36,6 +36,8 @@ if(TARGET_ARCH_NAME STREQUAL "arm")
set(TOOLCHAIN "armv7-alpine-linux-musleabihf")
elseif(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf)
set(TOOLCHAIN "armv6-alpine-linux-musleabihf")
+ elseif(EXISTS ${CROSS_ROOTFS}/usr/lib/arm-linux-androideabi)
+ set(TOOLCHAIN "armv7-linux-androideabi")
else()
set(TOOLCHAIN "arm-linux-gnueabihf")
endif()
@@ -46,6 +48,8 @@ elseif(TARGET_ARCH_NAME STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR aarch64)
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl)
set(TOOLCHAIN "aarch64-alpine-linux-musl")
+ elseif(EXISTS ${CROSS_ROOTFS}/usr/lib/aarch64-linux-android)
+ set(TOOLCHAIN "aarch64-linux-android")
elseif(LINUX)
set(TOOLCHAIN "aarch64-linux-gnu")
if(TIZEN)
@@ -78,6 +82,8 @@ elseif(TARGET_ARCH_NAME STREQUAL "riscv64")
set(CMAKE_SYSTEM_PROCESSOR riscv64)
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/riscv64-alpine-linux-musl)
set(TOOLCHAIN "riscv64-alpine-linux-musl")
+ elseif(EXISTS ${CROSS_ROOTFS}/usr/lib/riscv64-linux-android)
+ set(TOOLCHAIN "riscv64-linux-android")
else()
set(TOOLCHAIN "riscv64-linux-gnu")
endif()
@@ -92,6 +98,8 @@ elseif(TARGET_ARCH_NAME STREQUAL "x64")
set(CMAKE_SYSTEM_PROCESSOR x86_64)
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/x86_64-alpine-linux-musl)
set(TOOLCHAIN "x86_64-alpine-linux-musl")
+ elseif(EXISTS ${CROSS_ROOTFS}/usr/lib/x86_64-linux-android)
+ set(TOOLCHAIN "x86_64-linux-android")
elseif(LINUX)
set(TOOLCHAIN "x86_64-linux-gnu")
if(TIZEN)
@@ -108,6 +116,8 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86")
set(CMAKE_SYSTEM_PROCESSOR i686)
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/i586-alpine-linux-musl)
set(TOOLCHAIN "i586-alpine-linux-musl")
+ elseif(EXISTS ${CROSS_ROOTFS}/usr/lib/i686-linux-android)
+ set(TOOLCHAIN "i686-linux-android")
else()
set(TOOLCHAIN "i686-linux-gnu")
endif()
@@ -244,6 +254,7 @@ else()
set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr")
set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr")
set(CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr")
+ include(${CROSS_ROOTFS}/../build/cmake/android.toolchain.cmake)
endif()

# Specify link flags
11 changes: 11 additions & 0 deletions packages/dotnet9.0/0007-runtime-eng-DotNetBuild.props.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/src/runtime/eng/DotNetBuild.props
+++ b/src/runtime/eng/DotNetBuild.props
@@ -88,7 +88,7 @@

<!-- Handle system libraries -->
<UseSystemLibs Condition="'$(UseSystemLibs)' != ''">+$(UseSystemLibs)+</UseSystemLibs>
- <InnerBuildArgs Condition="'$(PortableBuild)' != 'true'">$(InnerBuildArgs) --cmakeargs -DCLR_CMAKE_USE_SYSTEM_BROTLI=true</InnerBuildArgs>
+ <InnerBuildArgs Condition="$(UseSystemLibs.Contains('+brotli+'))">$(InnerBuildArgs) --cmakeargs -DCLR_CMAKE_USE_SYSTEM_BROTLI=true</InnerBuildArgs>
<InnerBuildArgs Condition="$(UseSystemLibs.Contains('+libunwind+'))">$(InnerBuildArgs) --cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=true</InnerBuildArgs>
<!-- TODO: llvm-libunwind -->
<!-- TODO: LinuxTracepoints -->
12 changes: 12 additions & 0 deletions packages/dotnet9.0/0008-aspire_fix-gitinfo-target.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/src/aspire/Directory.Build.targets
+++ b/src/aspire/Directory.Build.targets
@@ -14,8 +14,7 @@
<None Include="$(PackageThirdPartyNoticesFile)" Pack="true" PackagePath="." />
</ItemGroup>

- <Import Condition="'$(SampleProject)' == 'true' or '$(CI)' != 'true' " Project="eng\Versions.dev.targets" />
- <Import Condition="'$(SampleProject)' != 'true' and '$(CI)' == 'true' " Project="eng\Versions.targets" />
+ <Import Project="eng\Versions.dev.targets" />

<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/src/runtime/src/coreclr/vm/threadstatics.cpp
+++ b/src/runtime/src/coreclr/vm/threadstatics.cpp
@@ -913,6 +913,10 @@ bool CanJITOptimizeTLSAccess()
// Optimization is disabled for linux/x86
#elif defined(TARGET_LINUX_MUSL) && defined(TARGET_ARM64)
// Optimization is disabled for linux musl arm64
+#elif defined(TARGET_LINUX_BIONIC) && defined(TARGET_ARM64)
+ // Optimization is disabled for linux bionic arm64
+#elif defined(TARGET_ANDROID) && defined(TARGET_ARM64)
+ // Optimization is disabled for Android arm64
#elif defined(TARGET_FREEBSD) && defined(TARGET_ARM64)
// Optimization is disabled for FreeBSD/arm64
#elif defined(FEATURE_INTERPRETER)
Loading

0 comments on commit 6a9d9f5

Please sign in to comment.