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.
This commit is contained in:
Joey Hess 2017-10-25 14:45:23 -04:00
parent 9f2b7dfc3e
commit 833b3f06cd
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 22 additions and 38 deletions

View file

@ -27,7 +27,7 @@ import Control.Concurrent
#ifndef mingw32_HOST_OS #ifndef mingw32_HOST_OS
import System.Posix (signalProcess, sigTERM) import System.Posix (signalProcess, sigTERM)
#else #else
import Utility.WinProcess import System.Win32.Process (terminateProcessId)
#endif #endif
import Network.URI import Network.URI
@ -59,7 +59,7 @@ terminateSelf =
#ifndef mingw32_HOST_OS #ifndef mingw32_HOST_OS
signalProcess sigTERM =<< getPID signalProcess sigTERM =<< getPID
#else #else
terminatePID =<< getPID terminateProcessId =<< getPID
#endif #endif
runRestart :: Assistant URLString runRestart :: Assistant URLString

View file

@ -41,7 +41,7 @@ import qualified Control.Concurrent.MSemN as MSemN
import System.Posix.Process (getProcessGroupIDOf) import System.Posix.Process (getProcessGroupIDOf)
import System.Posix.Signals (signalProcessGroup, sigTERM, sigKILL) import System.Posix.Signals (signalProcessGroup, sigTERM, sigKILL)
#else #else
import Utility.WinProcess import System.Win32.Process (terminateProcessId)
#endif #endif
type TransferGenerator = Assistant (Maybe (Transfer, TransferInfo, Transferrer -> Assistant ())) type TransferGenerator = Assistant (Maybe (Transfer, TransferInfo, Transferrer -> Assistant ()))
@ -270,7 +270,7 @@ cancelTransfer pause t = do
threadDelay 50000 -- 0.05 second grace period threadDelay 50000 -- 0.05 second grace period
signal sigKILL signal sigKILL
#else #else
terminatePID pid terminateProcessId pid
#endif #endif
{- Start or resume a transfer. -} {- Start or resume a transfer. -}

View file

@ -2,9 +2,6 @@ git-annex (6.20171019) UNRELEASED; urgency=medium
* Windows build fixed, and changed to use stack for more relaiable build * Windows build fixed, and changed to use stack for more relaiable build
environment. 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 * Windows: Remove wget from bundle; it needs libraries that are not
included, and git for windows includes curl which git-annex will use included, and git for windows includes curl which git-annex will use
instead. instead.

View file

@ -14,7 +14,7 @@ import Utility.PID
#ifndef mingw32_HOST_OS #ifndef mingw32_HOST_OS
import Utility.LogFile import Utility.LogFile
#else #else
import Utility.WinProcess import System.Win32.Process (terminateProcessId)
import Utility.LockFile import Utility.LockFile
#endif #endif
@ -162,7 +162,7 @@ stopDaemon pidfile = go =<< checkDaemon pidfile
#ifndef mingw32_HOST_OS #ifndef mingw32_HOST_OS
signalProcess sigTERM pid signalProcess sigTERM pid
#else #else
terminatePID pid terminateProcessId pid
#endif #endif
{- Windows locks a lock file that corresponds with the pid of the process. {- Windows locks a lock file that corresponds with the pid of the process.

View file

@ -1,15 +0,0 @@
{- Windows processes
-
- Copyright 2014 Joey Hess <id@joeyh.name>
-
- 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"

View file

@ -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 [Git for Windows](http://git-scm.com/downloads), and
[Stack](http://haskellstack.org/). [Stack](http://haskellstack.org/).
You also need to install rsync and wget for windows. You also need to install rsync for windows.
They need to be linked with the same MINGW32 libraries that come with Git It needs to be linked with the same MINGW32 libraries that come with Git
for Windows. One way is to download them from for Windows. One way is to download it from
<https://downloads.kitenet.net/git-annex/windows/assets/>. <https://downloads.kitenet.net/git-annex/windows/assets/>.
Put them somewhere in PATH. Put it somewhere in PATH.
Then open Git Bash, [[clone git-annex|download]], and in Then open Git Bash, [[clone git-annex|download]], and in git-annex's source
git-annex's source tree, run "stack build" to download and build tree, run "stack build --stack-yaml stack-windows.yaml" to download and
all dependencies and git-annex. "stack install" will install git-annex. 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 (To build the git-annex installer, you also need to install the NullSoft
installer system. The script `standalone/windows/build.sh` is installer system. The script `standalone/windows/build.sh` is

View file

@ -1061,7 +1061,6 @@ Executable git-annex
Other-Modules: Other-Modules:
Utility.LockFile.Windows Utility.LockFile.Windows
Utility.LockPool.Windows Utility.LockPool.Windows
Utility.WinProcess
else else
Other-Modules: Other-Modules:
Utility.LockFile.Posix Utility.LockFile.Posix

View file

@ -16,6 +16,9 @@ flags:
androidsplice: false androidsplice: false
packages: packages:
- '../..' - '../..'
- location:
git: https://github.com/joeyh/win32
commit: f41d9e1cc60f225bc4ef4bbd7ec0bac43b61b982
extra-deps: extra-deps:
- aws-0.17.1 - aws-0.17.1
- bloomfilter-2.0.1.0 - bloomfilter-2.0.1.0

View file

@ -59,21 +59,20 @@ getextra rsync.exe 85cb7a4d16d274fcf8069b39042965ad26abd6aa
# Deps are not built with cygwin environment, because we don't want # Deps are not built with cygwin environment, because we don't want
# configure scripts for haskell libraries to link them with the cygwin # configure scripts for haskell libraries to link them with the cygwin
# libraries. # libraries.
stack setup --stack-yaml standalone/windows/stack.yaml stack setup --stack-yaml stack-windows.yaml
stack build -j 1 --stack-yaml standalone/windows/stack.yaml --no-haddock --dependencies-only stack build -j 1 --stack-yaml stack-windows.yaml --no-haddock --dependencies-only
# Build git-annex # Build git-annex
withcyg stack build --stack-yaml standalone/windows/stack.yaml withcyg stack build --stack-yaml stack-windows.yaml
# Build the installer # 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 --package nsis Build/NullSoftInstaller.hs
./Build/NullSoftInstaller ./Build/NullSoftInstaller
rm -f dist/build-version rm -f dist/build-version
mkdir -p dist mkdir -p dist
stack ghc --stack-yaml standalone/windows/stack.yaml --no-haddock \ stack ghc --stack-yaml stack-windows.yaml --no-haddock Build/BuildVersion.hs
Build/BuildVersion.hs
./Build/BuildVersion > dist/build-version ./Build/BuildVersion > dist/build-version
# Test git-annex # Test git-annex