diff options
author | Johannes Obermayr <johannesobermayr@gmx.de> | 2015-09-16 22:19:57 +0200 |
---|---|---|
committer | Johannes Obermayr <johannesobermayr@gmx.de> | 2015-09-16 23:24:17 +0200 |
commit | 0fab4e8055fd2c7fad94bde91a886c8e7f20f932 (patch) | |
tree | 3d6affefe08589694c5856557846e7dc7bda3f3c /build/features.py | |
parent | b0b7892bd977a7e7771d5b88ed2faf624dd5cc54 (diff) |
Add option to disable build time.
Some Linux distribution avoid __DATE__ and __TIME__ to avoid not needed rebuilds of packages.
(e. g. https://github.com/openSUSE/rpmlint-checks/blob/master/CheckBuildDate.py)
So add an option to disable it.
Diffstat (limited to 'build/features.py')
-rw-r--r-- | build/features.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/build/features.py b/build/features.py index 4eebe10497..c8f22e40ec 100644 --- a/build/features.py +++ b/build/features.py @@ -601,6 +601,32 @@ class AsmLib(Feature): build.env.Prepend(LIBS='libacof%so' % build.bitwidth) +class BuildTime(Feature): + def description(self): + return "Use __DATE__ and __TIME__" + + def enabled(self, build): + build.flags['buildtime'] = util.get_flags(build.env, 'buildtime', 1) + if int(build.flags['buildtime']): + return True + return False + + def add_options(self, build, vars): + vars.Add( + 'buildtime', 'Set to 0 to disable build time (__DATE__ and __TIME__) usage.', 1) + + def configure(self, build, conf): + # Distributions like openSUSE use tools (e. g. build-compare) to detect + # whether a built binary differs from a former build to avoid unneeded + # publishing of packages. + # If __DATE__ and __TIME__ are used the built binary differs always but + # the tools cannot detect the root and publish a new package although + # the only change is caused by __DATE__ and __TIME__. + # So let distributions disable __DATE__ and __TIME__ via buildtime=0. + if not self.enabled(build): + build.env.Append(CPPDEFINES='DISABLE_BUILDTIME') + + class QDebug(Feature): def description(self): return "Debugging message output" |