Browse Source

Stop Using Static QEMU

pull/36/head
TheBrokenRail 1 month ago
parent
commit
e3a4cabf61
  1. 2
      debian/client-amd64
  2. 2
      debian/server-amd64
  3. 2
      docs/BUILDING.md
  4. 20
      launcher/src/bootstrap.c

2
debian/client-amd64

@ -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

@ -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

2
docs/BUILDING.md

@ -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

20
launcher/src/bootstrap.c

@ -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++) {

Loading…
Cancel
Save