0
0
mirror of https://github.com/termux-pacman/glibc-packages.git synced 2024-11-27 06:08:57 +00:00
glibc-packages/gpkg/box86/setdirs.patch
Ivan Max 1002e6f9c3
update pkgs (#254)
gpkg/box64
gpkg/box86
gpkg/git
gpkg/libdrm
gpkg/libedit
gpkg/liblzma
gpkg/mariadb
gpkg/ncurses
gpkg/cmake
gpkg/fakeroot
gpkg/fribidi
gpkg/libopus
gpkg/openssl
gpkg/pcre2
gpkg/vulkan-headers
gpkg/vulkan-icd-loader
gpkg/vulkan-tools
2024-06-08 19:15:50 +03:00

163 lines
8.1 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f093c18..eac861f 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,7 +75,6 @@ else()
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE} CACHE INTERNAL "The Python3 executable" FORCE)
endif()
-cmake_host_system_information(RESULT CMAKE_HOST_SYSTEM_PROCESSOR QUERY OS_PLATFORM)
string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "i686" _x86)
string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "x86_64" _x86_64)
string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "aarch64" _aarch64)
@@ -781,8 +780,8 @@ if(NOT _x86 AND NOT _x86_64)
if(NOT NO_CONF_INSTALL)
configure_file(system/box86.conf.cmake system/box86.conf)
if(NOT TERMUX)
- install(FILES ${CMAKE_BINARY_DIR}/system/box86.conf DESTINATION /etc/binfmt.d/)
- install(FILES ${CMAKE_SOURCE_DIR}/system/box86.box86rc DESTINATION /etc/)
+ install(FILES ${CMAKE_BINARY_DIR}/system/box86.conf DESTINATION @TERMUX_PREFIX@/etc/binfmt.d/)
+ install(FILES ${CMAKE_SOURCE_DIR}/system/box86.box86rc DESTINATION @TERMUX_PREFIX@/etc/)
else()
#install(FILES ${CMAKE_BINARY_DIR}/system/box86.conf DESTINATION ${TERMUX_PATH}/usr/etc/binfmt.d/)
install(FILES ${CMAKE_SOURCE_DIR}/system/box86.box86rc DESTINATION ${TERMUX_PATH}/usr/etc/)
@@ -790,11 +789,11 @@ if(NOT _x86 AND NOT _x86_64)
endif()
if(NOT NO_LIB_INSTALL)
if(NOT TERMUX)
- install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libstdc++.so.6 DESTINATION /usr/lib/i386-linux-gnu/)
- install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libstdc++.so.5 DESTINATION /usr/lib/i386-linux-gnu/)
- install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libgcc_s.so.1 DESTINATION /usr/lib/i386-linux-gnu/)
- install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libpng12.so.0 DESTINATION /usr/lib/i386-linux-gnu/)
- install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libunwind.so.8 DESTINATION /usr/lib/i386-linux-gnu/)
+ install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libstdc++.so.6 DESTINATION @TERMUX_PREFIX@/lib/i386-linux-gnu/)
+ install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libstdc++.so.5 DESTINATION @TERMUX_PREFIX@/lib/i386-linux-gnu/)
+ install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libgcc_s.so.1 DESTINATION @TERMUX_PREFIX@/lib/i386-linux-gnu/)
+ install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libpng12.so.0 DESTINATION @TERMUX_PREFIX@/lib/i386-linux-gnu/)
+ install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libunwind.so.8 DESTINATION @TERMUX_PREFIX@/lib/i386-linux-gnu/)
else()
install(FILES ${CMAKE_SOURCE_DIR}/x86lib/libstdc++.so.6 DESTINATION ${TERMUX_PATH}/usr/lib/i386-linux-gnu/)
diff --git a/src/main.c b/src/main.c
index 8009c47..66d9953 100644
--- a/src/main.c
+++ b/src/main.c
@@ -952,20 +952,14 @@ void LoadEnvVars(box86context_t *context)
//TODO: add relative path to box86 location
#endif
#ifndef TERMUX
- if(FileExist("/lib/box86", 0))
- AddPath("/lib/box86", &context->box86_ld_lib, 1);
- if(FileExist("/usr/lib/box86", 0))
- AddPath("/usr/lib/box86", &context->box86_ld_lib, 1);
- if(FileExist("/lib/i386-linux-gnu", 0))
- AddPath("/lib/i386-linux-gnu", &context->box86_ld_lib, 1);
- if(FileExist("/usr/lib/i386-linux-gnu", 0))
- AddPath("/usr/lib/i386-linux-gnu", &context->box86_ld_lib, 1);
- if(FileExist("/lib/i686-pc-linux-gnu", 0))
- AddPath("/lib/i686-pc-linux-gnu", &context->box86_ld_lib, 1);
- if(FileExist("/usr/lib/i686-pc-linux-gnu", 0))
- AddPath("/usr/lib/i686-pc-linux-gnu", &context->box86_ld_lib, 1);
- if(FileExist("/usr/lib32", 0))
- AddPath("/usr/lib32", &context->box86_ld_lib, 1);
+ if(FileExist("@TERMUX_PREFIX@/lib/box86", 0))
+ AddPath("@TERMUX_PREFIX@/lib/box86", &context->box86_ld_lib, 1);
+ if(FileExist("@TERMUX_PREFIX@/lib/i386-linux-gnu", 0))
+ AddPath("@TERMUX_PREFIX@/lib/i386-linux-gnu", &context->box86_ld_lib, 1);
+ if(FileExist("@TERMUX_PREFIX@/lib/i686-pc-linux-gnu", 0))
+ AddPath("@TERMUX_PREFIX@/lib/i686-pc-linux-gnu", &context->box86_ld_lib, 1);
+ if(FileExist("@TERMUX_PREFIX@/lib32", 0))
+ AddPath("@TERMUX_PREFIX@/lib32", &context->box86_ld_lib, 1);
#else
if(FileExist("/data/data/com.termux/files/usr/lib/i386-linux-gnu", 0))
AddPath("/data/data/com.termux/files/usr/lib/i386-linux-gnu", &context->box86_ld_lib, 1);
@@ -1208,8 +1202,8 @@ static void load_rcfiles()
LoadRCFile(rcpath);
#ifndef TERMUX
- else if(FileExist("/etc/box86.box86rc", IS_FILE))
- LoadRCFile("/etc/box86.box86rc");
+ else if(FileExist("@TERMUX_PREFIX@/etc/box86.box86rc", IS_FILE))
+ LoadRCFile("@TERMUX_PREFIX@/etc/box86.box86rc");
#else
else if(FileExist("/data/data/com.termux/files/usr/etc/box86.box86rc", IS_FILE))
LoadRCFile("/data/data/com.termux/files/usr/etc/box86.box86rc");
@@ -1290,7 +1284,7 @@ int main(int argc, const char **argv, char **env)
printf("See 'box86 --help' for more information.\n");
exit(0);
}
- if(argc>1 && !strcmp(argv[1], "/usr/bin/gdb"))
+ if(argc>1 && !strcmp(argv[1], "@TERMUX_PREFIX@/bin/gdb"))
exit(0);
// uname -m is redirected to box86 -m
if(argc==2 && (!strcmp(argv[1], "-m") || !strcmp(argv[1], "-p") || !strcmp(argv[1], "-i")))
diff --git a/src/tools/fileutils.c b/src/tools/fileutils.c
index ee7a1a2..562de78 100755
--- a/src/tools/fileutils.c
+++ b/src/tools/fileutils.c
@@ -17,9 +17,9 @@
static const char* x86lib = "\x7f" "ELF" "\x01" "\x01" "\x01" "\x03" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x02" "\x00" "\x03" "\x00";
static const char* x64lib = "\x7f" "ELF" "\x02" "\x01" "\x01" "\x03" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x02" "\x00" "\x3e" "\x00";
-static const char* bashsign= "#!/bin/bash";
-static const char* shsign = "#!/bin/sh";
-static const char* bashsign2="#!/usr/bin/env bash";
+static const char* bashsign= "#!@TERMUX_PREFIX@/bin/bash";
+static const char* shsign = "#!@TERMUX_PREFIX@/bin/sh";
+static const char* bashsign2="#!@TERMUX_PREFIX@/bin/env bash";
int FileExist(const char* filename, int flags)
{
@@ -126,11 +126,8 @@ const char* GetTmpDir() {
if ((tmpdir = getenv ("TMPDIR")) != NULL) return tmpdir;
if ((tmpdir = getenv ("TEMP")) != NULL) return tmpdir;
if ((tmpdir = getenv ("TMP")) != NULL) return tmpdir;
- if(FileExist("/tmp", 0)) return "/tmp";
- if(FileExist("/var/tmp", 0)) return "/var/tmp";
- if(FileExist("/usr/tmp", 0)) return "/usr/tmp";
- return "/tmp"; // meh...
+ return "@TERMUX_PREFIX_CLASSICAL@/tmp"; // meh...
}
char* LowerCase(const char* s) {
diff --git a/src/wrapped/wrappedd3dadapter9.c b/src/wrapped/wrappedd3dadapter9.c
index 7b13da1..0ed698f 100644
--- a/src/wrapped/wrappedd3dadapter9.c
+++ b/src/wrapped/wrappedd3dadapter9.c
@@ -98,7 +98,7 @@ static int my_GetDirect3D(x86emu_t* emu, void* This, void*** ppD3D9);
const char* d3dadapter9Name = "d3dadapter9.so.1";
#define LIBNAME d3dadapter9
-#define ALTNAME "/usr/lib/arm-linux-gnueabihf/d3d/d3dadapter9.so.1"
+#define ALTNAME "@TERMUX_PREFIX@/lib/arm-linux-gnueabihf/d3d/d3dadapter9.so.1"
typedef void* (*pFp_t)(void*);
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 4abb88f..f2b49c0 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -2634,7 +2634,7 @@ EXPORT void* my_getpwuid(x86emu_t* emu, uint32_t uid)
fakepwd.pw_gid = 0;
fakepwd.pw_gecos = strdup("root");
fakepwd.pw_dir = getenv("HOME");
- fakepwd.pw_shell = strdup("/bin/bash");
+ fakepwd.pw_shell = strdup("@TERMUX_PREFIX@/bin/bash");
}
return ret ? ret : (void*)&fakepwd;
diff --git a/src/wrapped/wrappedlibdl.c b/src/wrapped/wrappedlibdl.c
index 3e519bb..6c85caf 100755
--- a/src/wrapped/wrappedlibdl.c
+++ b/src/wrapped/wrappedlibdl.c
@@ -100,7 +100,7 @@ void* my_dlopen(x86emu_t* emu, void *filename, int flag)
if(sys)
return sys;
}
- if(!strcmp(rfilename, "/usr/lib/x86_64-linux-gnu/d3d")) {
+ if(!strcmp(rfilename, "@TERMUX_PREFIX@/lib/x86_64-linux-gnu/d3d")) {
void* sys = my_dlopen(emu, "d3dadapter9.so.1", flag);
if(sys)
return sys;