From 2aefc8ae136f545f010e81d3556c32297ec6e23c Mon Sep 17 00:00:00 2001 From: Thomas Wolff Date: Mon, 25 Nov 2019 00:00:00 +0100 Subject: [PATCH] 3.1.0; support 32-bit build; propagate proxy to backend for package download --- VERSION | 2 +- config-distros.sh | 6 +-- makefile | 24 +++++++---- makewinx.cfg | 2 +- wslbridge-backend-static.patch | 76 ---------------------------------- 5 files changed, 20 insertions(+), 90 deletions(-) delete mode 100644 wslbridge-backend-static.patch diff --git a/VERSION b/VERSION index 818bd47..fd2a018 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.6 +3.1.0 diff --git a/config-distros.sh b/config-distros.sh index a9c8ffc..899a44f 100755 --- a/config-distros.sh +++ b/config-distros.sh @@ -196,9 +196,9 @@ config () { psh_cmd='([xml]$(Get-Content '"\"$manifest\""')).Package.Applications.Application.Executable' executable=`appex "$manifest"` if [ -r "$ProgramW6432/WindowsApps/$instdir/$executable" ] - then icon="%PROGRAMFILES%/WindowsApps/$instdir/$executable" + then icon="%ProgramW6432%/WindowsApps/$instdir/$executable" elif [ -r "$ProgramW6432/WindowsApps/$instdir/images/icon.ico" ] - then icon="%PROGRAMFILES%/WindowsApps/$instdir/images/icon.ico" + then icon="%ProgramW6432%/WindowsApps/$instdir/images/icon.ico" else icon="$installdir"'\wsl.ico' fi root="$basepath/rootfs" @@ -244,7 +244,7 @@ config () { if $ok && [ -n "$distro" ] then # fix #163: backend missing +x with certain mount options echo Setting +x wslbridge2 backends for distro "'$distro'" - (cd "$INSTDIR"; cd bin; wsl.exe -d "$distro" chmod +x wslbridge2-backend) + (cd "$INSTDIR"; cd bin; PATH="${WINDIR}/Sysnative:${PATH}" wsl.exe -d "$distro" chmod +x wslbridge2-backend) # (cd "$LOCALAPPDATA/wsltty/bin"; wsl.exe -d "$distro" chmod +x wslbridge2-backend) # (cd ... ; "$SYSTEMROOT/System32/bash.exe" "$guid" -c chmod +x wslbridge2-backend) fi diff --git a/makefile b/makefile index ba266b6..a51cf4f 100644 --- a/makefile +++ b/makefile @@ -8,13 +8,13 @@ # wsltty release -ver=3.0.7 +ver=3.1.0 # wsltty appx release - must have 4 parts! -verx=3.0.7.0 +verx=3.1.0.0 # mintty release version -minttyver=3.0.7 +minttyver=3.1.0 # wslbridge2 release version wslbridgever=0.5 @@ -66,14 +66,20 @@ wgeto=curl -R -L --connect-timeout 55 # - ensure the path name drag-and-drop adaptation works (-> Cygwin, not MSYS) # - 64 Bit (x86_64) for more stable invocation (avoid fork issues) -check: +arch:=$(shell uname -m) + +check: # checkarch + echo Building for: + echo $(arch) | grep . # checking suitable host environment; run `make pkg` to bypass # check cygwin (vs msys) for proper drag-and-drop paths: uname | grep CYGWIN + +checkarch: # check 32 bit to ensure 32-Bit Windows support, just in case: #uname -m | grep i686 # check 64 bit to provide 64-Bit stability support: - uname -m | grep x86_64 + #uname -m | grep x86_64 ############################################################################# # patch version information for appx package configuration @@ -113,12 +119,12 @@ BuildDistr=Alpine wslbridge-backend: wslbridge-source echo ------------- Compiling wslbridge2 backend - uname -m | grep x86_64 + #uname -m | grep x86_64 mkdir -p bin # provide dependencies for backend build - cmd /C wsl -d $(BuildDistr) apk add make g++ linux-headers + PATH="${WINDIR}/Sysnative:${PATH}" cmd /C wsl.exe -u root -d $(BuildDistr) $(shell env | grep http_proxy=) apk add make g++ linux-headers # invoke backend build - cd wslbridge2-$(wslbridgever)/src; cmd /C wsl -d $(BuildDistr) make -f Makefile.backend RELEASE=1 < /dev/null + cd wslbridge2-$(wslbridgever)/src; PATH="${WINDIR}/Sysnative:${PATH}" cmd /C wsl.exe -d $(BuildDistr) make -f Makefile.backend RELEASE=1 < /dev/null # extract binaries cp wslbridge2-$(wslbridgever)/bin/wslbridge2-backend bin/ @@ -195,7 +201,7 @@ appx-bin: cop: ver mkdir -p rel rm -fr rel/wsltty-$(ver)-install.exe - sed -e "s,%version%,$(ver)," makewinx.cfg > rel/wsltty.SED + sed -e "s,%version%,$(ver)," -e "s,%arch%,$(arch)," makewinx.cfg > rel/wsltty.SED cp bin/cygwin1.dll rel/ cp bin/cygwin-console-helper.exe rel/ cp bin/dash.exe rel/ diff --git a/makewinx.cfg b/makewinx.cfg index 007ff85..ef7245f 100644 --- a/makewinx.cfg +++ b/makewinx.cfg @@ -26,7 +26,7 @@ SourceFiles=SourceFiles InstallPrompt=Install Mintty terminal for WSL (Windows Subsystem for Linux)? DisplayLicense= FinishMessage=Mintty for WSL installed - for documentation and configuration see https://github.com/mintty/wsltty -TargetName=wsltty-%version%-install.exe +TargetName=wsltty-%version%-install-%arch%.exe FriendlyName=wsltty AppLaunched=cmd.exe /c install.bat PostInstallCmd= diff --git a/wslbridge-backend-static.patch b/wslbridge-backend-static.patch deleted file mode 100644 index 01e0145..0000000 --- a/wslbridge-backend-static.patch +++ /dev/null @@ -1,76 +0,0 @@ -diff -rup old/Makefile new/Makefile ---- old/Makefile 2018-05-06 01:12:36.000000000 +0200 -+++ new/Makefile 2019-07-24 22:29:12.874257700 +0200 -@@ -8,7 +8,9 @@ all : ../out/wslbridge-backend - -static-libgcc -static-libstdc++ \ - -D_GNU_SOURCE \ - -DWSLBRIDGE_VERSION=$(shell cat ../VERSION.txt) \ -- -Wall -O2 $< ../common/SocketIo.cc -o $@ -lutil -pthread -+ -Wall -O2 $< ../common/SocketIo.cc -o $@ \ -+ -ldl -lutil -static -pthread \ -+ -Wl,--whole-archive -lpthread -Wl,--no-whole-archive - $(STRIP) $@ - - clean: -diff -rup old/wslbridge-backend.cc new/wslbridge-backend.cc ---- old/wslbridge-backend.cc 2018-05-06 01:12:36.000000000 +0200 -+++ new/wslbridge-backend.cc 2019-07-24 22:55:25.324307400 +0200 -@@ -494,6 +494,58 @@ static void frontendVersionCheck(const c - - } // namespace - -+#define getpwuid _getpwuid -+ -+#include -+typedef struct passwd * (*__getpwuid_t)(int uid); -+ -+struct passwd * getpwuid(int uid) -+{ -+ void * dl = dlopen(0, 0); -+printf("dlopen %p\n", dl); -+ if (dl) { -+ struct passwd * (*__getpwuid)(int uid) = -+ (__getpwuid_t)dlsym(dl, "getpwuid"); -+printf("dlsym %p\n", __getpwuid); -+ if (__getpwuid) -+ return __getpwuid(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