Stop Using Static QEMU
minecraft-pi-reborn/pipeline/head There was a failure building this commit Details

This commit is contained in:
TheBrokenRail 2021-12-17 21:04:05 -05:00
parent 4c3fefae89
commit e3a4cabf61
4 changed files with 21 additions and 5 deletions

2
debian/client-amd64 vendored
View File

@ -4,4 +4,4 @@ Maintainer: TheBrokenRail <connor24nolan@live.com>
Description: Fun with Blocks
Homepage: https://www.minecraft.net/en-us/edition/pi
Architecture: amd64
Depends: libc6, libstdc++6, libc6-armhf-cross, libstdc++6-armhf-cross, zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3, libopenal1, qemu-user-static
Depends: libc6, libstdc++6, libc6-armhf-cross, libstdc++6-armhf-cross, zenity, libgles1, libegl1, libglfw3 | libglfw3-wayland, libfreeimage3, libopenal1, qemu-user

2
debian/server-amd64 vendored
View File

@ -4,4 +4,4 @@ Maintainer: TheBrokenRail <connor24nolan@live.com>
Description: Fun with Blocks
Homepage: https://www.minecraft.net/en-us/edition/pi
Architecture: amd64
Depends: libc6, libstdc++6, libc6-armhf-cross, libstdc++6-armhf-cross, qemu-user-static
Depends: libc6, libstdc++6, libc6-armhf-cross, libstdc++6-armhf-cross, qemu-user

View File

@ -28,7 +28,7 @@
## Runtime Dependencies
* Non-ARM Host Architectures
* QEMU User-Mode Static
* QEMU User-Mode
* Host Architecture Dependencies
* CLient Mode Only
* OpenGL ES 1.1

View File

@ -42,6 +42,19 @@ static void set_and_print_env(const char *name, char *value) {
// Set The Value
setenv(name, value, 1);
}
#ifndef __ARM_ARCH
#define PASS_ENVIRONMENTAL_VARIABLE_TO_QEMU(name) \
{ \
char *old_value = getenv("QEMU_SET_ENV"); \
char *new_value = NULL; \
/* Pass Variable */ \
safe_asprintf(&new_value, "%s%s%s=%s", old_value == NULL ? "" : old_value, old_value == NULL ? "" : ",", name, getenv(name)); \
setenv("QEMU_SET_ENV", new_value, 1); \
free(new_value); \
/* Reset Variable */ \
RESET_ENVIRONMENTAL_VARIABLE(name); \
}
#endif
// Get Environmental Variable
static char *get_env_safe(const char *name) {
@ -202,8 +215,11 @@ void bootstrap(int argc, char *argv[]) {
// Run
safe_execvpe(full_path, argv, environ);
#else
// Use Static QEMU So It Isn't Affected By LD_* Variables
#define EXE_INTERPRETER "qemu-arm-static"
// Prevent QEMU From Being Modded
PASS_ENVIRONMENTAL_VARIABLE_TO_QEMU("LD_LIBRARY_PATH");
PASS_ENVIRONMENTAL_VARIABLE_TO_QEMU("LD_PRELOAD");
// Use QEMU
#define EXE_INTERPRETER "qemu-arm"
// Create Arguments List
char *new_argv[argc + 2];
for (int i = 1; i <= argc; i++) {