- defaultMainWithHooksArgs hooks (["copy", "--builddir", distDir]
- ++ (if null myDestDir then []
- else ["--destdir", myDestDir])
- ++ args)
- defaultMainWithHooksArgs hooks ("register" : "--builddir" : distDir : args)
- where
- hooks = userHooks {
- copyHook = noGhcPrimHook (modHook (copyHook userHooks)),
- regHook = modHook (regHook userHooks)
- }
+ relocatableBuild <- case relocatableBuildStr of
+ "YES" -> return True
+ "NO" -> return False
+ _ -> die ["Bad relocatableBuildStr: " ++
+ show relocatableBuildStr]
+ let copyArgs = ["copy", "--builddir", distDir]
+ ++ (if null myDestDir
+ then []
+ else ["--destdir", myDestDir])
+ ++ args
+ regArgs = "register" : "--builddir" : distDir : args
+ copyHooks = userHooks {
+ copyHook = noGhcPrimHook
+ $ modHook False
+ $ copyHook userHooks
+ }
+ regHooks = userHooks {
+ regHook = modHook relocatableBuild
+ $ regHook userHooks
+ }