about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorLily <egzozu.be.bas@gmail.com>2023-11-27 18:26:36 +0300
committerGitHub <noreply@github.com>2023-11-27 16:26:36 +0100
commit436de1c4f55119f1b921e56f00aaada49b9f8c18 (patch)
tree69b41cf49e3df33e35a154db9b84ad719d6e3e26
parent737d4a5506b56ae9d1b5f54595ac60f8dacea515 (diff)
downloadbox64-436de1c4f55119f1b921e56f00aaada49b9f8c18.tar.gz
box64-436de1c4f55119f1b921e56f00aaada49b9f8c18.zip
[ANDROID] Fix Compiling (#1091)
* [ANDROID] Added missing wrappedandroidshmem def headers

* [ANDROID] Fix Compiling

* [CMAKE] Typo

* [CMAKE] TERMUX Define
-rw-r--r--CMakeLists.txt8
-rw-r--r--src/elfs/elfload_dump.c4
-rw-r--r--src/librarian/library.c5
-rw-r--r--src/wrapped/generated/functions_list.txt1
-rw-r--r--src/wrapped/generated/wrappedandroidshmemtypes.h17
5 files changed, 34 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52bee538..a2badefe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,7 @@ option(PPC64LE "Set to ON if targeting an PowerPC 64 LE based device" ${PPC64LE}
 option(LX2160A "Set to ON if targeting an LX2160A based device" ${LX2160A})
 option(ARM64 "Set to ON if targeting a generic ARM64 based device" ${ARM64})
 option(ANDROID "Set to ON if targeting an Android device" ${ANDROID})
+option(TERMUX "Set to ON if targeting an Android device with Termux" ${TERMUX})
 option(USE_CCACHE "Set to ON to use ccache if present in the system" ${USE_CCACHE})
 option(HAVE_TRACE "Set to ON to have Trace ability (needs ZydisInfo library)" ${HAVE_TRACE})
 option(SAVE_MEM "Set to ON to build dynarec with some slower memory saving optimisations" ${SAVE_MEM})
@@ -34,6 +35,9 @@ option(SW64 "Set ON if targeting an SW64 based device" ${SW64})
 option(CI "Set to ON if running in CI" ${CI})
 option(WITH_MOLD "Set to ON to use with mold" ${WITH_MOLD})
 
+if(TERMUX)
+    set(ANDROID ON CACHE BOOL "")
+endif()
 if(LARCH64)
     set(LD80BITS OFF CACHE BOOL "")
     set(NOALIGN OFF CACHE BOOL "")
@@ -793,7 +797,11 @@ if(STATICBUILD)
     set_target_properties(${BOX64} PROPERTIES LINK_FLAGS "-static -Wl,--no-as-needed -Wl,--whole-archive -Wl,--allow-multiple-definition -lm -ldl -lrt -lpthread -lresolv -lc -Wl,-defsym,_DYNAMIC=0 -pthread")
 else()
     if(ANDROID)
+        if(TERMUX)
+        target_link_libraries(${BOX64} c m dl android-sysv-semaphore)
+        else()
         target_link_libraries(${BOX64} c m dl)
+        endif()
     else()
         set_target_properties(${BOX64} PROPERTIES LINK_FLAGS "-Wl,--no-as-needed -lc -lm -ldl -lrt -lpthread -lresolv -Wl,--as-needed -pthread")
     endif()
diff --git a/src/elfs/elfload_dump.c b/src/elfs/elfload_dump.c
index d7d11e47..593e450d 100644
--- a/src/elfs/elfload_dump.c
+++ b/src/elfs/elfload_dump.c
@@ -45,7 +45,9 @@ const char* DumpSection(Elf64_Shdr *s, char* SST) {
         GO(SHT_GNU_ATTRIBUTES);
         GO(SHT_GNU_HASH);
         GO(SHT_GNU_LIBLIST);
-        GO(SHT_CHECKSUM);
+        #ifndef ANDROID
+          GO(SHT_CHECKSUM);
+        #endif
         GO(SHT_LOSUNW);
         //GO(SHT_SUNW_move);
         GO(SHT_SUNW_COMDAT);
diff --git a/src/librarian/library.c b/src/librarian/library.c
index 896c6d0d..407ad50b 100644
--- a/src/librarian/library.c
+++ b/src/librarian/library.c
@@ -571,6 +571,11 @@ char* GetNameLib(library_t* lib)
 {
     return lib->name;
 }
+
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
 int IsSameLib(library_t* lib, const char* path)
 {
     int ret = 0;
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 8ae130f1..3862a940 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -2977,6 +2977,7 @@
 #() iFEpuvvppp -> iFEpuppp
 wrappedalure:
 wrappedalut:
+wrappedandroidshmem:
 wrappedatk:
 - vFp:
   - atk_focus_tracker_init
diff --git a/src/wrapped/generated/wrappedandroidshmemtypes.h b/src/wrapped/generated/wrappedandroidshmemtypes.h
new file mode 100644
index 00000000..6effd835
--- /dev/null
+++ b/src/wrapped/generated/wrappedandroidshmemtypes.h
@@ -0,0 +1,17 @@
+/*******************************************************************
+ * File automatically generated by rebuild_wrappers.py (v2.2.0.18) *
+ *******************************************************************/
+#ifndef __wrappedandroidshmemTYPES_H_
+#define __wrappedandroidshmemTYPES_H_
+
+#ifndef LIBNAME
+#error You should only #include this file inside a wrapped*.c file
+#endif
+#ifndef ADDED_FUNCTIONS
+#define ADDED_FUNCTIONS() 
+#endif
+
+
+#define SUPER() ADDED_FUNCTIONS()
+
+#endif // __wrappedandroidshmemTYPES_H_