------------------------------------------------------------------------------- |-- Module : Distribution.Simple.BuildPaths-- Copyright : Isaac Jones 2003-2004,-- Duncan Coutts 2008---- Maintainer : cabal-devel@haskell.org-- Portability : portable---- A bunch of dirs, paths and file names used for intermediate build steps.--{- All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Isaac Jones nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}moduleDistribution.Simple.BuildPaths(defaultDistPref,srcPref,hscolourPref,haddockPref,autogenModulesDir,autogenModuleName,cppHeaderName,haddockName,mkLibName,mkProfLibName,mkSharedLibName,exeExtension,objExtension,dllExtension,)whereimportSystem.FilePath((</>),(<.>))importDistribution.Package(PackageIdentifier,packageName)importDistribution.ModuleName(ModuleName)importqualifiedDistribution.ModuleNameasModuleNameimportDistribution.Compiler(CompilerId(..))importDistribution.PackageDescription(PackageDescription)importDistribution.Simple.LocalBuildInfo(LocalBuildInfo(buildDir))importDistribution.Simple.Setup(defaultDistPref)importDistribution.Text(display)importDistribution.System(OS(..),buildOS)-- ----------------------------------------------------------------------------- Build directories and filessrcPref::FilePath->FilePathsrcPrefdistPref=distPref</>"src"hscolourPref::FilePath->PackageDescription->FilePathhscolourPref=haddockPrefhaddockPref::FilePath->PackageDescription->FilePathhaddockPrefdistPrefpkg_descr=distPref</>"doc"</>"html"</>display(packageNamepkg_descr)-- |The directory in which we put auto-generated modulesautogenModulesDir::LocalBuildInfo->StringautogenModulesDirlbi=buildDirlbi</>"autogen"cppHeaderName::StringcppHeaderName="cabal_macros.h"-- |The name of the auto-generated module associated with a packageautogenModuleName::PackageDescription->ModuleNameautogenModuleNamepkg_descr=ModuleName.fromString$"Paths_"++mapfixchar(display(packageNamepkg_descr))wherefixchar'-'='_'fixcharc=chaddockName::PackageDescription->FilePathhaddockNamepkg_descr=display(packageNamepkg_descr)<.>"haddock"-- ----------------------------------------------------------------------------- Library file namesmkLibName::PackageIdentifier->StringmkLibNamelib="libHS"++displaylib<.>"a"mkProfLibName::PackageIdentifier->StringmkProfLibNamelib="libHS"++displaylib++"_p"<.>"a"-- Implement proper name mangling for dynamical shared objects-- libHS<packagename>-<compilerFlavour><compilerVersion>-- e.g. libHSbase-2.1-ghc6.6.1.somkSharedLibName::PackageIdentifier->CompilerId->StringmkSharedLibNamelib(CompilerIdcompilerFlavorcompilerVersion)="libHS"++displaylib++"-"++comp<.>dllExtensionwherecomp=displaycompilerFlavor++displaycompilerVersion-- -------------------------------------------------------------- * Platform file extensions-- -------------------------------------------------------------- ToDo: This should be determined via autoconf (AC_EXEEXT)-- | Extension for executable files-- (typically @\"\"@ on Unix and @\"exe\"@ on Windows or OS\/2)exeExtension::StringexeExtension=casebuildOSofWindows->"exe"_->""-- ToDo: This should be determined via autoconf (AC_OBJEXT)-- | Extension for object files. For GHC and NHC the extension is @\"o\"@.-- Hugs uses either @\"o\"@ or @\"obj\"@ depending on the used C compiler.objExtension::StringobjExtension="o"-- | Extension for dynamically linked (or shared) libraries-- (typically @\"so\"@ on Unix and @\"dll\"@ on Windows)dllExtension::StringdllExtension=casebuildOSofWindows->"dll"OSX->"dylib"_->"so"