Commit d94ece75 authored by Stuart Popejoy's avatar Stuart Popejoy Committed by Edward Z. Yang
Browse files

Implement CURRENT_PACKAGE_VERSION macro

parent ca00c82e
......@@ -75,7 +75,8 @@ generate pkg_descr lbi clbi =
generatePackageVersionMacros
(package pkg_descr : map snd (componentPackageDeps clbi)) ++
generateToolVersionMacros (configuredPrograms . withPrograms $ lbi) ++
generateComponentIdMacro lbi clbi
generateComponentIdMacro lbi clbi ++
generateCurrentPackageVersion pkg_descr
-- | Helper function that generates just the @VERSION_pkg@ and @MIN_VERSION_pkg@
-- macros for a list of package ids (usually used with the specific deps of
......@@ -134,6 +135,12 @@ generateComponentIdMacro _lbi clbi =
,ifndefDefineStr "CURRENT_COMPONENT_ID" (display (componentComponentId clbi))
]
-- | Generate the @CURRENT_PACKAGE_VERSION@ definition for the declared version
-- of the current package.
generateCurrentPackageVersion :: PackageDescription -> String
generateCurrentPackageVersion pd =
ifndefDefineStr "CURRENT_PACKAGE_VERSION" (display (pkgVersion (package pd)))
fixchar :: Char -> Char
fixchar '-' = '_'
fixchar c = c
-*-change-log-*-
1.25.x.x (current development version)
* Add CURRENT_PACKAGE_VERSION to cabal_macros.h (#4319)
* Dropped support for versions of GHC earlier than 6.12 (#3111).
* GHC compatibility window for the Cabal library has been extended
to five years (#3838).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment