diff --git a/Cabal.cabal b/Cabal.cabal
--- a/Cabal.cabal
+++ b/Cabal.cabal
@@ -1,5 +1,5 @@
 name: Cabal
-version: 1.22.3.0
+version: 1.22.4.0
 copyright: 2003-2006, Isaac Jones
            2005-2011, Duncan Coutts
 license: BSD3
diff --git a/Distribution/PackageDescription/Check.hs b/Distribution/PackageDescription/Check.hs
--- a/Distribution/PackageDescription/Check.hs
+++ b/Distribution/PackageDescription/Check.hs
@@ -589,7 +589,7 @@
   catMaybes [
 
     check has_WerrorWall $
-      PackageDistInexcusable $
+      PackageDistSuspicious $
            "'ghc-options: -Wall -Werror' makes the package very easy to "
         ++ "break with future GHC versions because new GHC versions often "
         ++ "add new warnings. Use just 'ghc-options: -Wall' instead."
diff --git a/Distribution/Simple/InstallDirs.hs b/Distribution/Simple/InstallDirs.hs
--- a/Distribution/Simple/InstallDirs.hs
+++ b/Distribution/Simple/InstallDirs.hs
@@ -56,7 +56,7 @@
 import System.FilePath (dropDrive)
 
 import Distribution.Package
-         ( PackageIdentifier, PackageKey, packageName, packageVersion )
+         ( PackageIdentifier, PackageKey, packageName, packageVersion, packageKeyLibraryName )
 import Distribution.System
          ( OS(..), buildOS, Platform(..) )
 import Distribution.Compiler
@@ -182,7 +182,7 @@
 -- users to be able to configure @--libdir=\/usr\/lib64@ for example but
 -- because by default we want to support installing multiple versions of
 -- packages and building the same package for multiple compilers we append the
--- libsubdir to get: @\/usr\/lib64\/$pkgkey\/$compiler@.
+-- libsubdir to get: @\/usr\/lib64\/$libname\/$compiler@.
 --
 -- An additional complication is the need to support relocatable packages on
 -- systems which support such things, like Windows.
@@ -215,10 +215,10 @@
            JHC    -> "$compiler"
            LHC    -> "$compiler"
            UHC    -> "$pkgid"
-           _other -> "$abi" </> "$pkgkey",
+           _other -> "$abi" </> "$libname",
       dynlibdir    = "$libdir",
       libexecdir   = case buildOS of
-        Windows   -> "$prefix" </> "$pkgkey"
+        Windows   -> "$prefix" </> "$libname"
         _other    -> "$prefix" </> "libexec",
       includedir   = "$libdir" </> "$libsubdir" </> "include",
       datadir      = case buildOS of
@@ -372,6 +372,7 @@
      | PkgVerVar     -- ^ The @$version@ package version path variable
      | PkgIdVar      -- ^ The @$pkgid@ package Id path variable, eg @foo-1.0@
      | PkgKeyVar     -- ^ The @$pkgkey@ package key path variable
+     | LibNameVar    -- ^ The @$libname@ expanded package key path variable
      | CompilerVar   -- ^ The compiler name and version, eg @ghc-6.6.1@
      | OSVar         -- ^ The operating system name, eg @windows@ or @linux@
      | ArchVar       -- ^ The CPU architecture name, eg @i386@ or @x86_64@
@@ -429,6 +430,7 @@
   [(PkgNameVar,  PathTemplate [Ordinary $ display (packageName pkgId)])
   ,(PkgVerVar,   PathTemplate [Ordinary $ display (packageVersion pkgId)])
   ,(PkgKeyVar,   PathTemplate [Ordinary $ display pkg_key])
+  ,(LibNameVar,  PathTemplate [Ordinary $ packageKeyLibraryName pkgId pkg_key])
   ,(PkgIdVar,    PathTemplate [Ordinary $ display pkgId])
   ]
 
@@ -478,6 +480,7 @@
 instance Show PathTemplateVariable where
   show PrefixVar     = "prefix"
   show PkgKeyVar     = "pkgkey"
+  show LibNameVar     = "libname"
   show BindirVar     = "bindir"
   show LibdirVar     = "libdir"
   show LibsubdirVar  = "libsubdir"
@@ -515,6 +518,7 @@
                  ,("htmldir",    HtmldirVar)
                  ,("pkgid",      PkgIdVar)
                  ,("pkgkey",     PkgKeyVar)
+                 ,("libname",    LibNameVar)
                  ,("pkg",        PkgNameVar)
                  ,("version",    PkgVerVar)
                  ,("compiler",   CompilerVar)
diff --git a/Distribution/Simple/Program/Ar.hs b/Distribution/Simple/Program/Ar.hs
--- a/Distribution/Simple/Program/Ar.hs
+++ b/Distribution/Simple/Program/Ar.hs
@@ -48,7 +48,7 @@
   (ar, _) <- requireProgram verbosity arProgram progConf
 
   let (targetDir, targetName) = splitFileName targetPath
-  withTempDirectory verbosity targetDir targetName $ \ tmpDir -> do
+  withTempDirectory verbosity targetDir "objs" $ \ tmpDir -> do
   let tmpPath = tmpDir </> targetName
 
   -- The args to use with "ar" are actually rather subtle and system-dependent.
diff --git a/changelog b/changelog
--- a/changelog
+++ b/changelog
@@ -1,4 +1,9 @@
 -*-change-log-*-
+1.22.4.0 Ryan Thomas <ryan@ryant.org> June 2015
+	* Add libname install-dirs variable, use it by default. Fixes #2437. (Edward Z. Yang)
+	* Reduce temporary directory name length, fixes #2502. (Edward Z. Yang)
+	* Workaround for #2527. (Mikhail Glushenkov)
+
 1.22.3.0 Ryan Thomas <ryan@ryant.org> April 2015
 	* Fix for the ghcjs-pkg version number handling (Luite Stegeman)
 	* filterConfigureFlags: filter more flags (Mikhail Glushenkov)
