From ae1515f19426daf13b55089e1c7da5f49f62b7eb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 25 Oct 2017 14:45:23 -0400 Subject: build for windows with forked win32 package that has terminateProcessId Get ugly reversion out of CHANGELOG. Also, relocated the windows stack.yaml to top, and updated windows build instructions. This commit was sponsored by Henrik Riomar on Patreon. --- Assistant/Restart.hs | 4 ++-- Assistant/TransferSlots.hs | 4 ++-- CHANGELOG | 3 --- Utility/Daemon.hs | 4 ++-- Utility/WinProcess.hs | 15 --------------- doc/install/Windows.mdwn | 15 ++++++++------- git-annex.cabal | 1 - stack-windows.yaml | 29 +++++++++++++++++++++++++++++ standalone/windows/build.sh | 11 +++++------ standalone/windows/stack.yaml | 26 -------------------------- 10 files changed, 48 insertions(+), 64 deletions(-) delete mode 100644 Utility/WinProcess.hs create mode 100644 stack-windows.yaml delete mode 100644 standalone/windows/stack.yaml diff --git a/Assistant/Restart.hs b/Assistant/Restart.hs index be1b21392..ce180b370 100644 --- a/Assistant/Restart.hs +++ b/Assistant/Restart.hs @@ -27,7 +27,7 @@ import Control.Concurrent #ifndef mingw32_HOST_OS import System.Posix (signalProcess, sigTERM) #else -import Utility.WinProcess +import System.Win32.Process (terminateProcessId) #endif import Network.URI @@ -59,7 +59,7 @@ terminateSelf = #ifndef mingw32_HOST_OS signalProcess sigTERM =<< getPID #else - terminatePID =<< getPID + terminateProcessId =<< getPID #endif runRestart :: Assistant URLString diff --git a/Assistant/TransferSlots.hs b/Assistant/TransferSlots.hs index c80cf880a..74453004d 100644 --- a/Assistant/TransferSlots.hs +++ b/Assistant/TransferSlots.hs @@ -41,7 +41,7 @@ import qualified Control.Concurrent.MSemN as MSemN import System.Posix.Process (getProcessGroupIDOf) import System.Posix.Signals (signalProcessGroup, sigTERM, sigKILL) #else -import Utility.WinProcess +import System.Win32.Process (terminateProcessId) #endif type TransferGenerator = Assistant (Maybe (Transfer, TransferInfo, Transferrer -> Assistant ())) @@ -270,7 +270,7 @@ cancelTransfer pause t = do threadDelay 50000 -- 0.05 second grace period signal sigKILL #else - terminatePID pid + terminateProcessId pid #endif {- Start or resume a transfer. -} diff --git a/CHANGELOG b/CHANGELOG index e9803b14f..6af753837 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,9 +2,6 @@ git-annex (6.20171019) UNRELEASED; urgency=medium * Windows build fixed, and changed to use stack for more relaiable build environment. - * Code for terminating processes on Windows is not linking anymore; - made a warning be displayed instead. This breaks restarting the - assistant and git annex assistant --stop. * Windows: Remove wget from bundle; it needs libraries that are not included, and git for windows includes curl which git-annex will use instead. diff --git a/Utility/Daemon.hs b/Utility/Daemon.hs index 5c0ea4169..2cb0864d2 100644 --- a/Utility/Daemon.hs +++ b/Utility/Daemon.hs @@ -14,7 +14,7 @@ import Utility.PID #ifndef mingw32_HOST_OS import Utility.LogFile #else -import Utility.WinProcess +import System.Win32.Process (terminateProcessId) import Utility.LockFile #endif @@ -162,7 +162,7 @@ stopDaemon pidfile = go =<< checkDaemon pidfile #ifndef mingw32_HOST_OS signalProcess sigTERM pid #else - terminatePID pid + terminateProcessId pid #endif {- Windows locks a lock file that corresponds with the pid of the process. diff --git a/Utility/WinProcess.hs b/Utility/WinProcess.hs deleted file mode 100644 index cb9029874..000000000 --- a/Utility/WinProcess.hs +++ /dev/null @@ -1,15 +0,0 @@ -{- Windows processes - - - - Copyright 2014 Joey Hess - - - - License: BSD-2-clause - -} - -module Utility.WinProcess where - -import Utility.PID -import System.IO - -terminatePID :: PID -> IO () -terminatePID p = hPutStrLn stderr "terminating processes on windows is not currently working" - diff --git a/doc/install/Windows.mdwn b/doc/install/Windows.mdwn index 1d9599ac8..af68e8028 100644 --- a/doc/install/Windows.mdwn +++ b/doc/install/Windows.mdwn @@ -32,15 +32,16 @@ To build git-annex from source on Windows, you need to install [Git for Windows](http://git-scm.com/downloads), and [Stack](http://haskellstack.org/). -You also need to install rsync and wget for windows. -They need to be linked with the same MINGW32 libraries that come with Git -for Windows. One way is to download them from +You also need to install rsync for windows. +It needs to be linked with the same MINGW32 libraries that come with Git +for Windows. One way is to download it from . -Put them somewhere in PATH. +Put it somewhere in PATH. -Then open Git Bash, [[clone git-annex|download]], and in -git-annex's source tree, run "stack build" to download and build -all dependencies and git-annex. "stack install" will install git-annex. +Then open Git Bash, [[clone git-annex|download]], and in git-annex's source +tree, run "stack build --stack-yaml stack-windows.yaml" to download and +build all dependencies and git-annex. "stack install --stack-yaml +stack-windows.yaml" will install git-annex. (To build the git-annex installer, you also need to install the NullSoft installer system. The script `standalone/windows/build.sh` is diff --git a/git-annex.cabal b/git-annex.cabal index 4115b5ba6..14142eea6 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -1061,7 +1061,6 @@ Executable git-annex Other-Modules: Utility.LockFile.Windows Utility.LockPool.Windows - Utility.WinProcess else Other-Modules: Utility.LockFile.Posix diff --git a/stack-windows.yaml b/stack-windows.yaml new file mode 100644 index 000000000..cdf4b3870 --- /dev/null +++ b/stack-windows.yaml @@ -0,0 +1,29 @@ +flags: + git-annex: + concurrentoutput: true + production: true + assistant: true + pairing: true + network-uri: true + s3: true + testsuite: true + webdav: true + torrentparser: true + webapp: true + magicmime: false + dbus: false + android: false + androidsplice: false +packages: +- '../..' +- location: + git: https://github.com/joeyh/win32 + commit: f41d9e1cc60f225bc4ef4bbd7ec0bac43b61b982 +extra-deps: +- aws-0.17.1 +- bloomfilter-2.0.1.0 +- torrent-10000.1.1 +- yesod-default-1.2.0 +explicit-setup-deps: + git-annex: true +resolver: lts-9.10 diff --git a/standalone/windows/build.sh b/standalone/windows/build.sh index 481d2be7d..5240e6be3 100755 --- a/standalone/windows/build.sh +++ b/standalone/windows/build.sh @@ -59,21 +59,20 @@ getextra rsync.exe 85cb7a4d16d274fcf8069b39042965ad26abd6aa # Deps are not built with cygwin environment, because we don't want # configure scripts for haskell libraries to link them with the cygwin # libraries. -stack setup --stack-yaml standalone/windows/stack.yaml -stack build -j 1 --stack-yaml standalone/windows/stack.yaml --no-haddock --dependencies-only +stack setup --stack-yaml stack-windows.yaml +stack build -j 1 --stack-yaml stack-windows.yaml --no-haddock --dependencies-only # Build git-annex -withcyg stack build --stack-yaml standalone/windows/stack.yaml +withcyg stack build --stack-yaml stack-windows.yaml # Build the installer -withcygpreferred stack ghc --stack-yaml standalone/windows/stack.yaml --no-haddock \ +withcygpreferred stack ghc --stack-yaml stack-windows.yaml --no-haddock \ --package nsis Build/NullSoftInstaller.hs ./Build/NullSoftInstaller rm -f dist/build-version mkdir -p dist -stack ghc --stack-yaml standalone/windows/stack.yaml --no-haddock \ - Build/BuildVersion.hs +stack ghc --stack-yaml stack-windows.yaml --no-haddock Build/BuildVersion.hs ./Build/BuildVersion > dist/build-version # Test git-annex diff --git a/standalone/windows/stack.yaml b/standalone/windows/stack.yaml deleted file mode 100644 index 54b8fe920..000000000 --- a/standalone/windows/stack.yaml +++ /dev/null @@ -1,26 +0,0 @@ -flags: - git-annex: - concurrentoutput: true - production: true - assistant: true - pairing: true - network-uri: true - s3: true - testsuite: true - webdav: true - torrentparser: true - webapp: true - magicmime: false - dbus: false - android: false - androidsplice: false -packages: -- '../..' -extra-deps: -- aws-0.17.1 -- bloomfilter-2.0.1.0 -- torrent-10000.1.1 -- yesod-default-1.2.0 -explicit-setup-deps: - git-annex: true -resolver: lts-9.10 -- cgit v1.2.3