mirror of
https://github.com/RPCS3/AppImageKit-checkrt.git
synced 2026-07-01 20:05:06 -04:00
Compare commits
5 Commits
continuous
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| bf6971f951 | |||
| 6645ad73ba | |||
| d5f8c58661 | |||
| e4343b957f | |||
| c4bdb9879a |
@@ -1,3 +1,5 @@
|
||||
/AppRun.c
|
||||
/AppRun_patched*
|
||||
/AppRun-patched*
|
||||
*.so
|
||||
*.o
|
||||
|
||||
+47
-14
@@ -10,26 +10,59 @@
|
||||
|
||||
/* https://docs.python.org/2/using/cmdline.html#envvar-PYTHONHOME */
|
||||
SET_NEW_ENV(new_pythonhome, appdir_s, "PYTHONHOME=%s/usr/", appdir);
|
||||
@@ -171,8 +174,28 @@
|
||||
@@ -171,8 +174,61 @@
|
||||
old_env = getenv("PATH") ?: "";
|
||||
SET_NEW_ENV(new_path, appdir_s*5 + strlen(old_env), "PATH=%s/usr/bin/:%s/usr/sbin/:%s/usr/games/:%s/bin/:%s/sbin/:%s", appdir, appdir, appdir, appdir, appdir, old_env);
|
||||
|
||||
+ int doUseBuiltinSTDCPP = 0;
|
||||
+ FILE *fp = popen("/usr/bin/lsb_release -rcs 2>/dev/null", "r");
|
||||
+ int doUseBuiltinSTDCPP = true;
|
||||
+ // we don't want stdout, only stderr
|
||||
+ FILE *fp = popen("./optional/checker 2>&1 >/dev/null", "r");
|
||||
+ if (fp != NULL)
|
||||
+ {
|
||||
+ char version[1035];
|
||||
+ fgets(version, sizeof(version), fp);
|
||||
+ char codename[1035];
|
||||
+ fgets(codename, sizeof(codename), fp);
|
||||
+ if (strcmp(version, "14.04\n") == 0 && strcmp(codename, "trusty\n") == 0)
|
||||
+ doUseBuiltinSTDCPP = 1;
|
||||
+ else if (strcmp(version, "16.04\n") == 0 && strcmp(codename, "xenial\n") == 0)
|
||||
+ doUseBuiltinSTDCPP = 1;
|
||||
+ else if (strcmp(version, "18.3\n") == 0 && strcmp(codename, "sylvia\n") == 0)
|
||||
+ doUseBuiltinSTDCPP = 1;
|
||||
+ char errorStr[1035];
|
||||
+ fgets(errorStr, sizeof(errorStr), fp);
|
||||
+ const char* searchStr = "*libstdc++*version `*' not found (required by";
|
||||
+ int searchStrI = 0;
|
||||
+ int errorStrI = 0;
|
||||
+ int lastWildcard = 0;
|
||||
+ while (searchStrI < strlen(searchStr))
|
||||
+ {
|
||||
+ if (errorStrI >= strlen(errorStr))
|
||||
+ {
|
||||
+ doUseBuiltinSTDCPP = false;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (errorStr[errorStrI] == searchStr[searchStrI])
|
||||
+ {
|
||||
+ errorStrI++;
|
||||
+ searchStrI++;
|
||||
+ }
|
||||
+ else if (searchStr[searchStrI] == '*')
|
||||
+ {
|
||||
+ if (errorStr[errorStrI] == searchStr[searchStrI+1])
|
||||
+ {
|
||||
+ if (lastWildcard == 0)
|
||||
+ lastWildcard = searchStrI;
|
||||
+ searchStrI++;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ errorStrI++;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ searchStrI = lastWildcard;
|
||||
+ lastWildcard = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ doUseBuiltinSTDCPP = false;
|
||||
+ }
|
||||
+
|
||||
old_env = getenv("LD_LIBRARY_PATH") ?: "";
|
||||
SET_NEW_ENV(new_ld_library_path, appdir_s*10 + strlen(old_env), "LD_LIBRARY_PATH=%s/usr/lib/:%s/usr/lib/i386-linux-gnu/:%s/usr/lib/x86_64-linux-gnu/:%s/usr/lib32/:%s/usr/lib64/:%s/lib/:%s/lib/i386-linux-gnu/:%s/lib/x86_64-linux-gnu/:%s/lib32/:%s/lib64/:%s", appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, old_env);
|
||||
+ if (doUseBuiltinSTDCPP)
|
||||
@@ -39,7 +72,7 @@
|
||||
|
||||
old_env = getenv("PYTHONPATH") ?: "";
|
||||
SET_NEW_ENV(new_pythonpath, appdir_s + strlen(old_env), "PYTHONPATH=%s/usr/share/pyshared/:%s", appdir, old_env);
|
||||
@@ -201,6 +224,9 @@
|
||||
@@ -201,6 +257,9 @@
|
||||
if (ret == -1)
|
||||
die("Error executing '%s': %s\n", exe, strerror(error));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
CFLAGS ?= -O2 -Wall -Wextra
|
||||
LDFLAGS += -s
|
||||
BIN = AppRun_patched
|
||||
BIN = AppRun-patched-x86_64
|
||||
LIB = exec-x86_64.so
|
||||
EXEC_TEST = exec_test
|
||||
ENV_TEST = env_test
|
||||
@@ -12,14 +12,14 @@ test: $(EXEC_TEST) $(ENV_TEST)
|
||||
all: checkrt test
|
||||
|
||||
clean:
|
||||
-rm -f $(BIN) $(LIB) $(EXEC_TEST) $(ENV_TEST) *.o AppRun.c AppRun_patched.c
|
||||
-rm -f $(BIN) $(LIB) $(EXEC_TEST) $(ENV_TEST) *.o AppRun.c AppRun-patched-x86_64.c
|
||||
|
||||
$(BIN): AppRun_patched.o checkrt.o env.o
|
||||
$(BIN): AppRun-patched-x86_64.o checkrt.o env.o
|
||||
|
||||
$(LIB): exec.o env.o
|
||||
$(CC) -shared $(LDFLAGS) -o $@ $^ -ldl
|
||||
|
||||
AppRun_patched.o checkrt.o: CFLAGS += -include checkrt.h
|
||||
AppRun-patched-x86_64.o checkrt.o: CFLAGS += -include checkrt.h
|
||||
exec.o env.o: CFLAGS += -fPIC
|
||||
|
||||
$(EXEC_TEST): CFLAGS += -DEXEC_TEST
|
||||
@@ -34,10 +34,10 @@ run_tests: $(EXEC_TEST) $(ENV_TEST)
|
||||
./$(ENV_TEST)
|
||||
./$(EXEC_TEST)
|
||||
|
||||
AppRun_patched.c: AppRun.c
|
||||
AppRun-patched-x86_64.c: AppRun.c
|
||||
patch -p1 --output $@ < AppRun.c.patch
|
||||
|
||||
AppRun.c:
|
||||
wget -c "https://raw.githubusercontent.com/AppImage/AppImageKit/appimagetool/master/src/AppRun.c"
|
||||
wget -c "https://raw.githubusercontent.com/AppImage/AppImageKit/master/src/AppRun.c"
|
||||
|
||||
.PHONY: checkrt test run_tests all clean
|
||||
|
||||
Reference in New Issue
Block a user