diff --git a/makefile b/makefile index e3370dc..a63b121 100644 --- a/makefile +++ b/makefile @@ -8,10 +8,10 @@ # wsltty release -ver=3.0.0 +ver=3.0.0.2 # wsltty appx release - must have 4 parts! -verx=3.0.0.0 +verx=3.0.0.2 # Windows SDK version for appx WINSDKKEY=/HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Microsoft/.NET Framework Platform/Setup/Multi-Targeting Pack @@ -121,20 +121,21 @@ wslbridge-package: wslbridge-source: wslbridge-$(wslbridge-commit).zip unzip -o wslbridge-$(wslbridge-commit).zip + cd wslbridge-$(wslbridge-commit)/backend; patch -p1 < ../../wslbridge-backend-static.patch tr -d '\015' < wslbridge-$(wslbridge-commit)/LICENSE.txt > LICENSE.wslbridge wslbridge-$(wslbridge-commit).zip: $(wgeto) https://github.com/rprichard/wslbridge/archive/$(wslbridge-commit).zip -o wslbridge-$(wslbridge-commit).zip wslbridge-frontend: wslbridge-source + echo ------------- Compiling wslbridge frontend cd wslbridge-$(wslbridge-commit)/frontend; make strip wslbridge-$(wslbridge-commit)/out/wslbridge.exe mkdir -p bin cp wslbridge-$(wslbridge-commit)/out/wslbridge.exe bin/ -wslbridge-backend: wslbridge-source bin/wslbridge-backend - -bin/wslbridge-backend: +wslbridge-backend: wslbridge-source + echo ------------- Compiling wslbridge backend cd wslbridge-$(wslbridge-commit)/backend; if uname -m | grep x86_64; then cmd /C wsl make; else wslbridge make; fi mkdir -p bin cp wslbridge-$(wslbridge-commit)/out/wslbridge-backend bin/ diff --git a/wslbridge-backend-static.patch b/wslbridge-backend-static.patch new file mode 100644 index 0000000..79a55ca --- /dev/null +++ b/wslbridge-backend-static.patch @@ -0,0 +1,61 @@ +diff -rup orig/Makefile new/Makefile +--- orig/Makefile 2018-05-06 01:12:36.000000000 +0200 ++++ new/Makefile 2019-05-01 08:16:53.647051200 +0200 +@@ -5,7 +5,7 @@ all : ../out/wslbridge-backend + ../out/wslbridge-backend : wslbridge-backend.cc ../common/SocketIo.cc ../common/SocketIo.h ../VERSION.txt Makefile + mkdir -p ../out + $(CXX) -std=c++11 -fno-exceptions \ +- -static-libgcc -static-libstdc++ \ ++ -static -static-libgcc -static-libstdc++ \ + -D_GNU_SOURCE \ + -DWSLBRIDGE_VERSION=$(shell cat ../VERSION.txt) \ + -Wall -O2 $< ../common/SocketIo.cc -o $@ -lutil -pthread +diff -rup orig/wslbridge-backend.cc new/wslbridge-backend.cc +--- orig/wslbridge-backend.cc 2018-05-06 01:12:36.000000000 +0200 ++++ new/wslbridge-backend.cc 2019-05-01 08:19:12.799688500 +0200 +@@ -494,6 +494,45 @@ static void frontendVersionCheck(const c + + } // namespace + ++#define getpwuid _getpwuid ++ ++struct passwd * getpwuid(int uid) ++{ ++ FILE * pwd = fopen("/etc/passwd", "r"); ++ if (pwd) { ++ char pwbuf[222]; ++ static struct passwd pw; ++ pw.pw_shell = 0; ++ while (fgets(pwbuf, sizeof pwbuf, pwd)) { ++ char * sep = strchr(pwbuf, ':'); ++ if (!sep) continue; ++ sep = strchr(++sep, ':'); ++ if (!sep) continue; ++ int pwuid; ++ if (sscanf(sep, ":%d:", &pwuid) == 1 && pwuid == uid) { ++ // pw_name:pw_passwd:pw_uid:pw_gid:pw_gecos:pw_dir:pw_shell ++ // ^ ++ sep = strchr(++sep, ':'); ++ if (!sep) continue; ++ sep = strchr(++sep, ':'); ++ if (!sep) continue; ++ sep = strchr(++sep, ':'); ++ if (!sep) continue; ++ sep = strchr(++sep, ':'); ++ if (!sep) continue; ++ pw.pw_shell = ++sep; ++ sep = strchr(++sep, '\n'); ++ if (sep) ++ *sep = 0; ++ break; ++ } ++ } ++ fclose(pwd); ++ return &pw; ++ } ++ return 0; ++} ++ + int main(int argc, char *argv[]) { + + // If the backend crashes, it prints a message to its stderr, which is a