mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 05:43:50 +03:00
lib: Add more configure flag helpers
Add with/without to match enable/disable, and add `--{enable,with}-key=value` versions of both.
This commit is contained in:
parent
188fdf5bd0
commit
9e9cdd7027
@ -51,11 +51,11 @@ let
|
|||||||
# back-compat aliases
|
# back-compat aliases
|
||||||
platforms = systems.forMeta;
|
platforms = systems.forMeta;
|
||||||
|
|
||||||
inherit (builtins) add addErrorContext attrNames
|
inherit (builtins) add addErrorContext attrNames concatLists
|
||||||
concatLists deepSeq elem elemAt filter genericClosure genList
|
deepSeq elem elemAt filter genericClosure genList getAttr
|
||||||
getAttr hasAttr head isAttrs isBool isInt isList
|
hasAttr head isAttrs isBool isInt isList isString length
|
||||||
isString length lessThan listToAttrs pathExists readFile
|
lessThan listToAttrs pathExists readFile replaceStrings seq
|
||||||
replaceStrings seq stringLength sub substring tail;
|
stringLength sub substring tail;
|
||||||
inherit (trivial) id const concat or and boolToString mergeAttrs
|
inherit (trivial) id const concat or and boolToString mergeAttrs
|
||||||
flip mapNullable inNixShell min max importJSON warn info
|
flip mapNullable inNixShell min max importJSON warn info
|
||||||
nixpkgsVersion version mod compare splitByAndCompare
|
nixpkgsVersion version mod compare splitByAndCompare
|
||||||
@ -74,30 +74,32 @@ let
|
|||||||
inherit (lists) singleton foldr fold foldl foldl' imap0 imap1
|
inherit (lists) singleton foldr fold foldl foldl' imap0 imap1
|
||||||
concatMap flatten remove findSingle findFirst any all count
|
concatMap flatten remove findSingle findFirst any all count
|
||||||
optional optionals toList range partition zipListsWith zipLists
|
optional optionals toList range partition zipListsWith zipLists
|
||||||
reverseList listDfs toposort sort naturalSort compareLists take drop sublist
|
reverseList listDfs toposort sort naturalSort compareLists take
|
||||||
last init crossLists unique intersectLists subtractLists
|
drop sublist last init crossLists unique intersectLists
|
||||||
mutuallyExclusive;
|
subtractLists mutuallyExclusive;
|
||||||
inherit (strings) concatStrings concatMapStrings concatImapStrings
|
inherit (strings) concatStrings concatMapStrings concatImapStrings
|
||||||
intersperse concatStringsSep concatMapStringsSep
|
intersperse concatStringsSep concatMapStringsSep
|
||||||
concatImapStringsSep makeSearchPath makeSearchPathOutput
|
concatImapStringsSep makeSearchPath makeSearchPathOutput
|
||||||
makeLibraryPath makeBinPath makePerlPath optionalString
|
makeLibraryPath makeBinPath makePerlPath optionalString
|
||||||
hasPrefix hasSuffix stringToCharacters stringAsChars escape
|
hasPrefix hasSuffix stringToCharacters stringAsChars escape
|
||||||
escapeShellArg escapeShellArgs replaceChars lowerChars upperChars
|
escapeShellArg escapeShellArgs replaceChars lowerChars
|
||||||
toLower toUpper addContextFrom splitString removePrefix
|
upperChars toLower toUpper addContextFrom splitString
|
||||||
removeSuffix versionOlder versionAtLeast getVersion nameFromURL
|
removePrefix removeSuffix versionOlder versionAtLeast getVersion
|
||||||
enableFeature fixedWidthString fixedWidthNumber isStorePath
|
nameFromURL enableFeature enableFeatureAs withFeature
|
||||||
|
withFeatureAs fixedWidthString fixedWidthNumber isStorePath
|
||||||
toInt readPathsFromFile fileContents;
|
toInt readPathsFromFile fileContents;
|
||||||
inherit (stringsWithDeps) textClosureList textClosureMap
|
inherit (stringsWithDeps) textClosureList textClosureMap
|
||||||
noDepEntry fullDepEntry packEntry stringAfter;
|
noDepEntry fullDepEntry packEntry stringAfter;
|
||||||
inherit (customisation) overrideDerivation makeOverridable
|
inherit (customisation) overrideDerivation makeOverridable
|
||||||
callPackageWith callPackagesWith extendDerivation
|
callPackageWith callPackagesWith extendDerivation hydraJob
|
||||||
hydraJob makeScope;
|
makeScope;
|
||||||
inherit (meta) addMetaAttrs dontDistribute setName updateName
|
inherit (meta) addMetaAttrs dontDistribute setName updateName
|
||||||
appendToName mapDerivationAttrset lowPrio lowPrioSet hiPrio
|
appendToName mapDerivationAttrset lowPrio lowPrioSet hiPrio
|
||||||
hiPrioSet;
|
hiPrioSet;
|
||||||
inherit (sources) pathType pathIsDirectory cleanSourceFilter
|
inherit (sources) pathType pathIsDirectory cleanSourceFilter
|
||||||
cleanSource sourceByRegex sourceFilesBySuffices
|
cleanSource sourceByRegex sourceFilesBySuffices
|
||||||
commitIdFromGitRepo cleanSourceWith pathHasContext canCleanSource;
|
commitIdFromGitRepo cleanSourceWith pathHasContext
|
||||||
|
canCleanSource;
|
||||||
inherit (modules) evalModules closeModules unifyModuleSyntax
|
inherit (modules) evalModules closeModules unifyModuleSyntax
|
||||||
applyIfFunction unpackSubmodule packSubmodule mergeModules
|
applyIfFunction unpackSubmodule packSubmodule mergeModules
|
||||||
mergeModules' mergeOptionDecls evalOptionValue mergeDefinitions
|
mergeModules' mergeOptionDecls evalOptionValue mergeDefinitions
|
||||||
@ -119,8 +121,7 @@ let
|
|||||||
traceXMLVal traceXMLValMarked traceSeq traceSeqN traceValSeq
|
traceXMLVal traceXMLValMarked traceSeq traceSeqN traceValSeq
|
||||||
traceValSeqFn traceValSeqN traceValSeqNFn traceShowVal
|
traceValSeqFn traceValSeqN traceValSeqNFn traceShowVal
|
||||||
traceShowValMarked showVal traceCall traceCall2 traceCall3
|
traceShowValMarked showVal traceCall traceCall2 traceCall3
|
||||||
traceValIfNot runTests testAllTrue traceCallXml
|
traceValIfNot runTests testAllTrue traceCallXml attrNamesToStr;
|
||||||
attrNamesToStr;
|
|
||||||
inherit (misc) maybeEnv defaultMergeArg defaultMerge foldArgs
|
inherit (misc) maybeEnv defaultMergeArg defaultMerge foldArgs
|
||||||
defaultOverridableDelayableArgs composedArgsAndFun
|
defaultOverridableDelayableArgs composedArgsAndFun
|
||||||
maybeAttrNullable maybeAttr ifEnable checkFlag getValue
|
maybeAttrNullable maybeAttr ifEnable checkFlag getValue
|
||||||
@ -129,7 +130,7 @@ let
|
|||||||
closePropagation mapAttrsFlatten nvs setAttr setAttrMerge
|
closePropagation mapAttrsFlatten nvs setAttr setAttrMerge
|
||||||
mergeAttrsWithFunc mergeAttrsConcatenateValues
|
mergeAttrsWithFunc mergeAttrsConcatenateValues
|
||||||
mergeAttrsNoOverride mergeAttrByFunc mergeAttrsByFuncDefaults
|
mergeAttrsNoOverride mergeAttrByFunc mergeAttrsByFuncDefaults
|
||||||
mergeAttrsByFuncDefaultsClean mergeAttrBy
|
mergeAttrsByFuncDefaultsClean mergeAttrBy prepareDerivationArgs
|
||||||
prepareDerivationArgs nixType imap overridableDelayableArgs;
|
nixType imap overridableDelayableArgs;
|
||||||
});
|
});
|
||||||
in lib
|
in lib
|
||||||
|
@ -414,6 +414,39 @@ rec {
|
|||||||
*/
|
*/
|
||||||
enableFeature = enable: feat: "--${if enable then "enable" else "disable"}-${feat}";
|
enableFeature = enable: feat: "--${if enable then "enable" else "disable"}-${feat}";
|
||||||
|
|
||||||
|
/* Create an --{enable-<feat>=<value>,disable-<feat>} string that can be passed to
|
||||||
|
standard GNU Autoconf scripts.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
enableFeature true "shared" "foo"
|
||||||
|
=> "--enable-shared=foo"
|
||||||
|
enableFeature false "shared" (throw "ignored")
|
||||||
|
=> "--disable-shared"
|
||||||
|
*/
|
||||||
|
enableFeatureAs = enable: feat: value: enableFeature enable feat + optionalString enable "=${value}";
|
||||||
|
|
||||||
|
/* Create an --{with,without}-<feat> string that can be passed to
|
||||||
|
standard GNU Autoconf scripts.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
withFeature true "shared"
|
||||||
|
=> "--with-shared"
|
||||||
|
withFeature false "shared"
|
||||||
|
=> "--without-shared"
|
||||||
|
*/
|
||||||
|
withFeature = with_: feat: "--${if with_ then "with" else "without"}-${feat}";
|
||||||
|
|
||||||
|
/* Create an --{with-<feat>=<value>,without-<feat>} string that can be passed to
|
||||||
|
standard GNU Autoconf scripts.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
with_Feature true "shared" "foo"
|
||||||
|
=> "--with-shared=foo"
|
||||||
|
with_Feature false "shared" (throw "ignored")
|
||||||
|
=> "--without-shared"
|
||||||
|
*/
|
||||||
|
withFeatureAs = with_: feat: value: withFeature with_ feat + optionalString with_ "=${value}";
|
||||||
|
|
||||||
/* Create a fixed width string with additional prefix to match
|
/* Create a fixed width string with additional prefix to match
|
||||||
required width.
|
required width.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user