------------------------------------------------------------------------------- |-- Module : Distribution.Simple.Hugs-- Copyright : Isaac Jones 2003-2006-- Duncan Coutts 2009---- Maintainer : cabal-devel@haskell.org-- Portability : portable---- This module contains most of the NHC-specific code for configuring, building-- and installing packages.{- Copyright (c) 2003-2005, Isaac Jones
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.Hugs(configure,getInstalledPackages,buildLib,buildExe,install,registerPackage,)whereimportDistribution.Package(PackageName,PackageIdentifier(..),InstalledPackageId(..),packageName)importDistribution.InstalledPackageInfo(InstalledPackageInfo,emptyInstalledPackageInfo,InstalledPackageInfo_(InstalledPackageInfo,installedPackageId,sourcePackageId),parseInstalledPackageInfo,showInstalledPackageInfo)importDistribution.PackageDescription(PackageDescription(..),BuildInfo(..),hcOptions,allExtensions,Executable(..),withExe,Library(..),withLib,libModules)importDistribution.ModuleName(ModuleName)importqualifiedDistribution.ModuleNameasModuleNameimportDistribution.Simple.Compiler(CompilerFlavor(..),CompilerId(..),Compiler(..),Flag,languageToFlags,extensionsToFlags,PackageDB(..),PackageDBStack)importqualifiedDistribution.Simple.PackageIndexasPackageIndeximportDistribution.Simple.PackageIndex(PackageIndex)importDistribution.Simple.Program(Program(programFindVersion),ProgramConfiguration,userMaybeSpecifyPath,requireProgram,requireProgramVersion,rawSystemProgramConf,programPath,ffihugsProgram,hugsProgram)importDistribution.Version(Version(..),orLaterVersion)importDistribution.Simple.PreProcess(ppCpp,runSimplePreProcessor)importDistribution.Simple.PreProcess.Unlit(unlit)importDistribution.Simple.LocalBuildInfo(LocalBuildInfo(..),ComponentLocalBuildInfo(..),InstallDirs(..),absoluteInstallDirs)importDistribution.Simple.BuildPaths(autogenModuleName,autogenModulesDir,dllExtension)importDistribution.Simple.Setup(CopyDest(..))importDistribution.Simple.Utils(createDirectoryIfMissingVerbose,installOrdinaryFiles,withUTF8FileContents,writeFileAtomic,writeUTF8File,copyFileVerbose,findFile,findFileWithExtension,findModuleFiles,rawSystemStdInOut,die,info,notice)importLanguage.Haskell.Extension(Language(Haskell98),Extension(..))importSystem.FilePath((</>),takeExtension,(<.>),searchPathSeparator,normalise,takeDirectory)importDistribution.System(OS(..),buildOS)importDistribution.Text(display,simpleParse)importDistribution.ParseUtils(ParseResult(..))importDistribution.VerbosityimportData.Char(isSpace)importData.Maybe(mapMaybe,catMaybes)importData.Monoid(Monoid(..))importControl.Monad(unless,when,filterM)importData.List(nub,sort,isSuffixOf)importSystem.Directory(doesFileExist,doesDirectoryExist,getDirectoryContents,removeDirectoryRecursive,getHomeDirectory)importSystem.Exit(ExitCode(ExitSuccess))importDistribution.Compat.CopyFile(setFileExecutable)importDistribution.Compat.Exception-- ------------------------------------------------------------------------------- Configuringconfigure::Verbosity->MaybeFilePath->MaybeFilePath->ProgramConfiguration->IO(Compiler,ProgramConfiguration)configureverbosityhcPath_hcPkgPathconf=do(_ffihugsProg,conf')<-requireProgramverbosityffihugsProgram(userMaybeSpecifyPath"ffihugs"hcPathconf)(_hugsProg,version,conf'')<-requireProgramVersionverbosityhugsProgram'(orLaterVersion(Version[2006][]))conf'letcomp=Compiler{compilerId=CompilerIdHugsversion,compilerLanguages=hugsLanguages,compilerExtensions=hugsLanguageExtensions}return(comp,conf'')wherehugsProgram'=hugsProgram{programFindVersion=getVersion}getVersion::Verbosity->FilePath->IO(MaybeVersion)getVersionverbosityhugsPath=do(output,_err,exit)<-rawSystemStdInOutverbosityhugsPath[](Just(":quit",False))Falseifexit==ExitSuccessthenreturn$!findVersionoutputelsereturnNothingwherefindVersionoutput=do(monthStr,yearStr)<-selectWordsoutputyear<-convertYearyearStrmonth<-convertMonthmonthStrreturn(Version[year,month][])selectWordsoutput=case[(month,year)|[_,_,"Version:",month,year,_]<-mapwords(linesoutput)]of[(month,year)]->Just(month,year)_->NothingconvertYearyear=casereadsyearof[(y,[])]|y>=1999&&y<2020->Justy_->NothingconvertMonthmonth=lookupmonth(zipmonths[1..])months=["January","February","March","April","May","June","July","August","September","October","November","December"]hugsLanguages::[(Language,Flag)]hugsLanguages=[(Haskell98,"")]--default is 98 mode-- | The flags for the supported extensionshugsLanguageExtensions::[(Extension,Flag)]hugsLanguageExtensions=[(OverlappingInstances,"+o"),(IncoherentInstances,"+oO"),(HereDocuments,"+H"),(TypeSynonymInstances,"-98"),(RecursiveDo,"-98"),(ParallelListComp,"-98"),(MultiParamTypeClasses,"-98"),(FunctionalDependencies,"-98"),(Rank2Types,"-98"),(PolymorphicComponents,"-98"),(ExistentialQuantification,"-98"),(ScopedTypeVariables,"-98"),(ImplicitParams,"-98"),(ExtensibleRecords,"-98"),(RestrictedTypeSynonyms,"-98"),(FlexibleContexts,"-98"),(FlexibleInstances,"-98"),(ForeignFunctionInterface,""),(EmptyDataDecls,""),(CPP,"")]getInstalledPackages::Verbosity->PackageDBStack->ProgramConfiguration->IOPackageIndexgetInstalledPackagesverbositypackagedbsconf=dohomedir<-getHomeDirectory(hugsProg,_)<-requireProgramverbosityhugsProgramconflethugsbindir=takeDirectory(programPathhugsProg)hugslibdir=takeDirectoryhugsbindir</>"lib"</>"hugs"dbdirs=nub(concatMap(packageDbPathshomedirhugslibdir)packagedbs)indexes<-mapMgetIndividualDBPackagesdbdirsreturn$!mconcatindexeswheregetIndividualDBPackages::FilePath->IOPackageIndexgetIndividualDBPackagesdbdir=dopkgdirs<-getPackageDbDirsdbdirpkgs<-sequence[getInstalledPackagepkgnamepkgdir|(pkgname,pkgdir)<-pkgdirs]letpkgs'=mapsetInstalledPackageId(catMaybespkgs)return(PackageIndex.fromListpkgs')packageDbPaths::FilePath->FilePath->PackageDB->[FilePath]packageDbPathshomehugslibdirdb=casedbofGlobalPackageDB->[hugslibdir</>"packages","/usr/local/lib/hugs/packages"]UserPackageDB->[home</>"lib/hugs/packages"]SpecificPackageDBpath->[path]getPackageDbDirs::FilePath->IO[(PackageName,FilePath)]getPackageDbDirsdbdir=dodbexists<-doesDirectoryExistdbdirifnotdbexiststhenreturn[]elsedoentries<-getDirectoryContentsdbdirpkgdirs<-sequence[dopkgdirExists<-doesDirectoryExistpkgdirreturn(pkgname,pkgdir,pkgdirExists)|(entry,Justpkgname)<-[(entry,simpleParseentry)|entry<-entries],letpkgdir=dbdir</>entry]return[(pkgname,pkgdir)|(pkgname,pkgdir,True)<-pkgdirs]getInstalledPackage::PackageName->FilePath->IO(MaybeInstalledPackageInfo)getInstalledPackagepkgnamepkgdir=doletpkgconfFile=pkgdir</>"package.conf"pkgconfExists<-doesFileExistpkgconfFileletpathsModule=pkgdir</>("Paths_"++displaypkgname)<.>"hs"pathsModuleExists<-doesFileExistpathsModulecase()of_|pkgconfExists->getFullInstalledPackageInfopkgnamepkgconfFile|pathsModuleExists->getPhonyInstalledPackageInfopkgnamepathsModule|otherwise->returnNothinggetFullInstalledPackageInfo::PackageName->FilePath->IO(MaybeInstalledPackageInfo)getFullInstalledPackageInfopkgnamepkgconfFile=withUTF8FileContentspkgconfFile$\contents->caseparseInstalledPackageInfocontentsofParseOk_pkginfo|packageNamepkginfo==pkgname->return(Justpkginfo)_->returnNothing-- | This is a backup option for existing versions of Hugs which do not supply-- proper installed package info files for the bundled libs. Instead we look-- for the Paths_pkgname.hs file and extract the package version from that.-- We don't know any other details for such packages, in particular we pretend-- that they have no dependencies.--getPhonyInstalledPackageInfo::PackageName->FilePath->IO(MaybeInstalledPackageInfo)getPhonyInstalledPackageInfopkgnamepathsModule=docontent<-readFilepathsModulecaseextractVersioncontentofNothing->returnNothingJustversion->return(Justpkginfo)wherepkgid=PackageIdentifierpkgnameversionpkginfo=emptyInstalledPackageInfo{sourcePackageId=pkgid}where-- search through the Paths_pkgname.hs file, looking for a line like:---- > version = Version {versionBranch = [2,0], versionTags = []}---- and parse it using 'Read'. Yes we are that evil.--extractVersioncontent=case[version|("version":"=":rest)<-mapwords(linescontent),(version,[])<-reads(concatrest)]of[version]->Justversion_->Nothing-- Older installed package info files did not have the installedPackageId-- field, so if it is missing then we fill it as the source package ID.setInstalledPackageId::InstalledPackageInfo->InstalledPackageInfosetInstalledPackageIdpkginfo@InstalledPackageInfo{installedPackageId=InstalledPackageId"",sourcePackageId=pkgid}=pkginfo{--TODO use a proper named function for the conversion-- from source package id to installed package idinstalledPackageId=InstalledPackageId(displaypkgid)}setInstalledPackageIdpkginfo=pkginfo-- ------------------------------------------------------------------------------- Building-- |Building a package for Hugs.buildLib::Verbosity->PackageDescription->LocalBuildInfo->Library->ComponentLocalBuildInfo->IO()buildLibverbositypkg_descrlbilib_clbi=doletpref=scratchDirlbicreateDirectoryIfMissingVerboseverbosityTrueprefcopyFileVerboseverbosity(autogenModulesDirlbi</>paths_modulename)(pref</>paths_modulename)compileBuildInfoverbositypref[](libModuleslib)(libBuildInfolib)lbiwherepaths_modulename=ModuleName.toFilePath(autogenModuleNamepkg_descr)<.>".hs"--TODO: switch to using autogenModulesDir as a search dir, rather than-- always copying the file over.-- |Building an executable for Hugs.buildExe::Verbosity->PackageDescription->LocalBuildInfo->Executable->ComponentLocalBuildInfo->IO()buildExeverbositypkg_descrlbiexe@Executable{modulePath=mainPath,buildInfo=bi}_clbi=doletpref=scratchDirlbicreateDirectoryIfMissingVerboseverbosityTrueprefletdestDir=pref</>"programs"letexeMods=otherModulesbisrcMainFile<-findFile(hsSourceDirsbi)mainPathletexeDir=destDir</>exeNameexeletdestMainFile=exeDir</>hugsMainFilenameexecopyModuleverbosity(CPP`elem`allExtensionsbi)bilbisrcMainFiledestMainFileletdestPathsFile=exeDir</>paths_modulenamecopyFileVerboseverbosity(autogenModulesDirlbi</>paths_modulename)destPathsFilecompileBuildInfoverbosityexeDir(maybe[](hsSourceDirs.libBuildInfo)(librarypkg_descr))exeModsbilbicompileFilesverbositybilbiexeDir[destMainFile,destPathsFile]wherepaths_modulename=ModuleName.toFilePath(autogenModuleNamepkg_descr)<.>".hs"compileBuildInfo::Verbosity->FilePath-- ^output directory->[FilePath]-- ^library source dirs, if building exes->[ModuleName]-- ^Modules->BuildInfo->LocalBuildInfo->IO()--TODO: should not be using mLibSrcDirs at allcompileBuildInfoverbositydestDirmLibSrcDirsmodsbilbi=do-- Pass 1: copy or cpp files from build directory to scratch directoryletuseCpp=CPP`elem`allExtensionsbiletsrcDir=buildDirlbisrcDirs=nub$srcDir:hsSourceDirsbi++mLibSrcDirsinfoverbosity$"Source directories: "++showsrcDirsflipmapM_mods$\m->dofs<-findFileWithExtensionsuffixessrcDirs(ModuleName.toFilePathm)casefsofNothing->die("can't find source for module "++displaym)JustsrcFile->doletext=takeExtensionsrcFilecopyModuleverbosityuseCppbilbisrcFile(destDir</>ModuleName.toFilePathm<.>ext)-- Pass 2: compile foreign stubs in scratch directorystubsFileLists<-fmapcatMaybes$sequence[findFileWithExtensionsuffixes[destDir](ModuleName.toFilePathmodu)|modu<-mods]compileFilesverbositybilbidestDirstubsFileListssuffixes::[String]suffixes=["hs","lhs"]-- Copy or cpp a file from the source directory to the build directory.copyModule::Verbosity->Bool->BuildInfo->LocalBuildInfo->FilePath->FilePath->IO()copyModuleverbositycppAllbilbisrcFiledestFile=docreateDirectoryIfMissingVerboseverbosityTrue(takeDirectorydestFile)(exts,opts,_)<-getOptionsFromSourcesrcFileletghcOpts=[op|(GHC,ops)<-opts,op<-ops]ifcppAll||CPP`elem`exts||"-cpp"`elem`ghcOptsthendorunSimplePreProcessor(ppCppbilbi)srcFiledestFileverbosityreturn()elsecopyFileVerboseverbositysrcFiledestFilecompileFiles::Verbosity->BuildInfo->LocalBuildInfo->FilePath->[FilePath]->IO()compileFilesverbositybilbimodDirfileList=doffiFileList<-filterMtestFFIfileListunless(nullffiFileList)$donoticeverbosity"Compiling FFI stubs"mapM_(compileFFIverbositybilbimodDir)ffiFileList-- Only compile FFI stubs for a file if it contains some FFI stufftestFFI::FilePath->IOBooltestFFIfile=withHaskellFilefile$\inp->return$!"foreign"`elem`symbols(stripCommentsFalseinp)compileFFI::Verbosity->BuildInfo->LocalBuildInfo->FilePath->FilePath->IO()compileFFIverbositybilbimodDirfile=do(_,opts,file_incs)<-getOptionsFromSourcefileletghcOpts=[op|(GHC,ops)<-opts,op<-ops]letpkg_incs=["\""++inc++"\""|inc<-includesbi]letincs=nub(sort(file_incs++includeOptsghcOpts++pkg_incs))letpathFlag="-P"++modDir++[searchPathSeparator]lethugsArgs="-98":pathFlag:map("-i"++)incscfiles<-getCFilesfileletcArgs=["-I"++dir|dir<-includeDirsbi]++ccOptionsbi++cfiles++["-L"++dir|dir<-extraLibDirsbi]++ldOptionsbi++["-l"++lib|lib<-extraLibsbi]++concat[["-framework",f]|f<-frameworksbi]rawSystemProgramConfverbosityffihugsProgram(withProgramslbi)(hugsArgs++file:cArgs)includeOpts::[String]->[String]includeOpts[]=[]includeOpts("-#include":arg:opts)=arg:includeOptsoptsincludeOpts(_:opts)=includeOptsopts-- get C file names from CFILES pragmas throughout the source filegetCFiles::FilePath->IO[String]getCFilesfile=withHaskellFilefile$\inp->letcfiles=[normalisecfile|"{-#":"CFILES":rest<-mapwords$lines$stripCommentsTrueinp,lastrest=="#-}",cfile<-initrest]inseq(lengthcfiles)(returncfiles)-- List of terminal symbols in a source file.symbols::String->[String]symbolscs=caselexcsof(sym,cs'):_|not(nullsym)->sym:symbolscs'_->[]-- Get the non-literate source of a Haskell module.withHaskellFile::FilePath->(String->IOa)->IOawithHaskellFilefileaction=withUTF8FileContentsfile$\text->if".lhs"`isSuffixOf`filetheneitheractiondie(unlitfiletext)elseactiontext-- -------------------------------------------------------------- * options in source files-- -------------------------------------------------------------- |Read the initial part of a source file, before any Haskell code,-- and return the contents of any LANGUAGE, OPTIONS and INCLUDE pragmas.getOptionsFromSource::FilePath->IO([Extension],-- LANGUAGE pragma, if any[(CompilerFlavor,[String])],-- OPTIONS_FOO pragmas[String]-- INCLUDE pragmas)getOptionsFromSourcefile=withHaskellFilefile$(return$!).foldrappendOptions([],[],[]).mapgetOptions.takeWhileJust.mapgetPragma.filtertextLine.map(dropWhileisSpace).lines.stripCommentsTruewheretextLine[]=FalsetextLine('#':_)=FalsetextLine_=TruegetPragma::String->Maybe[String]getPragmaline=casewordslineof("{-#":rest)|lastrest=="#-}"->Just(initrest)_->NothinggetOptions("OPTIONS":opts)=([],[(GHC,opts)],[])getOptions("OPTIONS_GHC":opts)=([],[(GHC,opts)],[])getOptions("OPTIONS_NHC98":opts)=([],[(NHC,opts)],[])getOptions("OPTIONS_HUGS":opts)=([],[(Hugs,opts)],[])getOptions("LANGUAGE":ws)=(mapMaybereadExtensionws,[],[])wherereadExtension::String->MaybeExtensionreadExtensionw=casereadswof[(ext,"")]->Justext[(ext,",")]->Justext_->NothinggetOptions("INCLUDE":ws)=([],[],ws)getOptions_=([],[],[])appendOptions(exts,opts,incs)(exts',opts',incs')=(exts++exts',opts++opts',incs++incs')-- takeWhileJust f = map fromJust . takeWhile isJusttakeWhileJust::[Maybea]->[a]takeWhileJust(Justx:xs)=x:takeWhileJustxstakeWhileJust_=[]-- |Strip comments from Haskell source.stripComments::Bool-- ^ preserve pragmas?->String-- ^ input source text->StringstripCommentskeepPragmas=stripCommentsLevel0wherestripCommentsLevel::Int->String->StringstripCommentsLevel0('"':cs)='"':copyStringcsstripCommentsLevel0('-':'-':cs)=-- FIX: symbols like -->stripCommentsLevel0(dropWhile(/='\n')cs)stripCommentsLevel0('{':'-':'#':cs)|keepPragmas='{':'-':'#':copyPragmacsstripCommentsLeveln('{':'-':cs)=stripCommentsLevel(n+1)csstripCommentsLevel0(c:cs)=c:stripCommentsLevel0csstripCommentsLeveln('-':'}':cs)=stripCommentsLevel(n-1)csstripCommentsLeveln(_:cs)=stripCommentsLevelncsstripCommentsLevel_[]=[]copyString('\\':c:cs)='\\':c:copyStringcscopyString('"':cs)='"':stripCommentsLevel0cscopyString(c:cs)=c:copyStringcscopyString[]=[]copyPragma('#':'-':'}':cs)='#':'-':'}':stripCommentsLevel0cscopyPragma(c:cs)=c:copyPragmacscopyPragma[]=[]-- ------------------------------------------------------------------------------- |Install for Hugs.-- For install, copy-prefix = prefix, but for copy they're different.-- The library goes in \<copy-prefix>\/lib\/hugs\/packages\/\<pkgname>-- (i.e. \<prefix>\/lib\/hugs\/packages\/\<pkgname> on the target system).-- Each executable goes in \<copy-prefix>\/lib\/hugs\/programs\/\<exename>-- (i.e. \<prefix>\/lib\/hugs\/programs\/\<exename> on the target system)-- with a script \<copy-prefix>\/bin\/\<exename> pointing at-- \<prefix>\/lib\/hugs\/programs\/\<exename>.install::Verbosity-- ^verbosity->LocalBuildInfo->FilePath-- ^Library install location->FilePath-- ^Program install location->FilePath-- ^Executable install location->FilePath-- ^Program location on target system->FilePath-- ^Build location->(FilePath,FilePath)-- ^Executable (prefix,suffix)->PackageDescription->IO()--FIXME: this script should be generated at build time, just installed at this stageinstallverbositylbilibDirinstallProgDirbinDirtargetProgDirbuildPref(progprefix,progsuffix)pkg_descr=doremoveDirectoryRecursivelibDir`catchIO`\_->return()withLibpkg_descr$\lib->findModuleFiles[buildPref]hugsInstallSuffixes(libModuleslib)>>=installOrdinaryFilesverbositylibDirletbuildProgDir=buildPref</>"programs"when(any(buildable.buildInfo)(executablespkg_descr))$createDirectoryIfMissingVerboseverbosityTruebinDirwithExepkg_descr$\exe->doletbi=buildInfoexelettheBuildDir=buildProgDir</>exeNameexeletinstallDir=installProgDir</>exeNameexelettargetDir=targetProgDir</>exeNameexeremoveDirectoryRecursiveinstallDir`catchIO`\_->return()findModuleFiles[theBuildDir]hugsInstallSuffixes(ModuleName.main:autogenModuleNamepkg_descr:otherModules(buildInfoexe))>>=installOrdinaryFilesverbosityinstallDirlettargetName="\""++(targetDir</>hugsMainFilenameexe)++"\""lethugsOptions=hcOptionsHugs(buildInfoexe)++languageToFlags(compilerlbi)(defaultLanguagebi)++extensionsToFlags(compilerlbi)(allExtensionsbi)letbaseExeFile=progprefix++(exeNameexe)++progsuffixletexeFile=casebuildOSofWindows->binDir</>baseExeFile<.>".bat"_->binDir</>baseExeFileletscript=casebuildOSofWindows->letargs=hugsOptions++[targetName,"%*"]inunlines["@echo off",unwords("runhugs":args)]_->letargs=hugsOptions++[targetName,"\"$@\""]inunlines["#! /bin/sh",unwords("runhugs":args)]writeFileAtomicexeFilescriptsetFileExecutableexeFilehugsInstallSuffixes::[String]hugsInstallSuffixes=[".hs",".lhs",dllExtension]-- |Filename used by Hugs for the main module of an executable.-- This is a simple filename, so that Hugs will look for any auxiliary-- modules it uses relative to the directory it's in.hugsMainFilename::Executable->FilePathhugsMainFilenameexe="Main"<.>extwhereext=takeExtension(modulePathexe)-- ------------------------------------------------------------------------------- RegisteringregisterPackage::Verbosity->InstalledPackageInfo->PackageDescription->LocalBuildInfo->Bool->PackageDBStack->IO()registerPackageverbosityinstalledPkgInfopkglbiinplace_packageDbs=do--TODO: prefer to have it based on the packageDbs, but how do we know-- the package subdir based on the name? the user can set crazy libsubdirletinstallDirs=absoluteInstallDirspkglbiNoCopyDestpkgdir|inplace=buildDirlbi|otherwise=libdirinstallDirscreateDirectoryIfMissingVerboseverbosityTruepkgdirwriteUTF8File(pkgdir</>"package.conf")(showInstalledPackageInfoinstalledPkgInfo)