Commit 79cf2e3d authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Detect the right patch command and use it when building gmp.

See #158.
parent f7927894
# This file is processed by the configure script
# See 'Settings/User.hs' for user-defined settings
#=================================================
# See 'src/Settings/User.hs' for user-defined settings
#=====================================================
# Paths to builders:
#===================
......@@ -40,6 +40,7 @@ nm = @NmCmd@
objdump = @ObjdumpCmd@
ranlib = @REAL_RANLIB_CMD@
tar = @TarCmd@
patch = @PatchCmd@
perl = @PerlCmd@
# Information about builders:
......
......@@ -40,6 +40,7 @@ data Builder = Alex
| Ld
| Nm
| Objdump
| Patch
| Perl
| Ranlib
| Tar
......@@ -82,6 +83,7 @@ builderKey builder = case builder of
Ld -> "ld"
Nm -> "nm"
Objdump -> "objdump"
Patch -> "patch"
Perl -> "perl"
Ranlib -> "ranlib"
Tar -> "tar"
......
{-# LANGUAGE RecordWildCards #-}
module Rules.Actions (
build, buildWithResources, copyFile, createDirectory, removeDirectory, moveDirectory,
fixFile, runConfigure, runMake, runBuilder, makeExecutable
fixFile, runConfigure, runMake, applyPatch, runBuilder, makeExecutable
) where
import qualified System.Directory as IO
......@@ -108,6 +108,15 @@ runMake dir args = do
putBuild $ "| Run make" ++ note ++ " in " ++ dir ++ "..."
quietly $ cmd Shell (EchoStdout False) makeCommand ["-C", dir] args
applyPatch :: FilePath -> FilePath -> Action ()
applyPatch dir patch = do
let file = dir -/- patch
need [file]
needBuilder False Patch
path <- builderPath Patch
putBuild $ "| Apply patch " ++ file
quietly $ cmd Shell (EchoStdout False) [Cwd dir] [path, "-p0 <", patch]
runBuilder :: Builder -> [String] -> Action ()
runBuilder builder args = do
needBuilder laxDependencies builder
......
......@@ -73,7 +73,6 @@ gmpRules = do
gmpLibraryH %> \_ -> do
when trackBuildSystem $ need [sourcePath -/- "Rules/Gmp.hs"]
-- Do we need this step?
liftIO $ removeFiles gmpBuildPath ["//*"]
-- Note: We use a tarball like gmp-4.2.4-nodoc.tar.bz2, which is
......@@ -86,17 +85,14 @@ gmpRules = do
++ "(found: " ++ show tarballs ++ ")."
need tarballs
createDirectory gmpBuildPath
build $ fullTarget gmpTarget Tar tarballs [gmpBuildPath]
-- TODO: replace "patch" with PATCH_CMD
forM_ gmpPatches $ \src -> do
let patch = takeFileName src
patchPath = gmpBuildPath -/- patch
copyFile src patchPath
putBuild $ "| Apply " ++ patchPath
unit . quietly $ cmd Shell (EchoStdout False) [Cwd gmpBuildPath] "patch -p0 <" [patch]
applyPatch gmpBuildPath patch
-- TODO: What's `chmod +x libraries/integer-gmp/gmp/ln` for?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment