diff mbox

[i-g-t,4/4] build: Add an option to not use the git hash in version

Message ID 1435792903-11552-4-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien July 1, 2015, 11:21 p.m. UTC
When developing, it's quite annoying that the version changes every
commit, causing the library to be rebuild and everything single binary
re-linked.

Add a config option to skip that.

I remember Ville asking for this "feature" as well.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 configure.ac         | 7 +++++++
 lib/Makefile.sources | 5 +++++
 2 files changed, 12 insertions(+)

Comments

Ville Syrjälä July 2, 2015, 8:31 a.m. UTC | #1
On Thu, Jul 02, 2015 at 12:21:43AM +0100, Damien Lespiau wrote:
> When developing, it's quite annoying that the version changes every
> commit, causing the library to be rebuild and everything single binary
> re-linked.
> 
> Add a config option to skip that.
> 
> I remember Ville asking for this "feature" as well.

Thank you. This has indeed been annoying me for a while.

> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  configure.ac         | 7 +++++++
>  lib/Makefile.sources | 5 +++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 4208f00..caa3f50 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -212,6 +212,13 @@ if test "x$enable_debug" = xyes; then
>  	AC_SUBST([DEBUG_CFLAGS])
>  fi
>  
> +# prevent relinking the world on every commit for developpers
> +AC_ARG_ENABLE(skip-version,
> +	      AS_HELP_STRING([--enable-skip-version],
> +			     [Do not use git hash in version]),
> +	      [skip_version=$enableval], [skip_version=no])
> +AM_CONDITIONAL(SKIP_VERSION, [test "x$skip_version" = xyes])
> +
>  # -----------------------------------------------------------------------------
>  
>  # To build multithread code, gcc uses -pthread, Solaris Studio cc uses -mt
> diff --git a/lib/Makefile.sources b/lib/Makefile.sources
> index f8a1b92..2148684 100644
> --- a/lib/Makefile.sources
> +++ b/lib/Makefile.sources
> @@ -60,6 +60,10 @@ libintel_tools_la_SOURCES = 	\
>  
>  .PHONY: version.h.tmp
>  
> +if SKIP_VERSION
> +$(IGT_LIB_PATH)/version.h.tmp:
> +	@echo '#define IGT_GIT_SHA1 "SKIP"' >> $@
> +else
>  $(IGT_LIB_PATH)/version.h.tmp:
>  	@touch $@
>  	@if test -d $(GPU_TOOLS_PATH)/.git; then \
> @@ -73,6 +77,7 @@ $(IGT_LIB_PATH)/version.h.tmp:
>  	else \
>  		echo '#define IGT_GIT_SHA1 "NOT-GIT"' ; \
>  	fi >> $@
> +endif # SKIP_VERSION
>  
>  
>  $(IGT_LIB_PATH)/version.h: $(IGT_LIB_PATH)/version.h.tmp
> -- 
> 2.1.0
Chris Wilson July 2, 2015, 8:42 a.m. UTC | #2
On Thu, Jul 02, 2015 at 11:31:57AM +0300, Ville Syrjälä wrote:
> On Thu, Jul 02, 2015 at 12:21:43AM +0100, Damien Lespiau wrote:
> > When developing, it's quite annoying that the version changes every
> > commit, causing the library to be rebuild and everything single binary
> > re-linked.
> > 
> > Add a config option to skip that.
> > 
> > I remember Ville asking for this "feature" as well.
> 
> Thank you. This has indeed been annoying me for a while.

I hadn't noticed, I only build the lib/ if a test fails to link.
-Chris
Thomas Wood July 2, 2015, 9:33 a.m. UTC | #3
On 2 July 2015 at 00:21, Damien Lespiau <damien.lespiau@intel.com> wrote:
> When developing, it's quite annoying that the version changes every
> commit, causing the library to be rebuild and everything single binary

everything ? every

> re-linked.
>
> Add a config option to skip that.
>
> I remember Ville asking for this "feature" as well.
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
> ---
>  configure.ac         | 7 +++++++
>  lib/Makefile.sources | 5 +++++
>  2 files changed, 12 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index 4208f00..caa3f50 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -212,6 +212,13 @@ if test "x$enable_debug" = xyes; then
>         AC_SUBST([DEBUG_CFLAGS])
>  fi
>
> +# prevent relinking the world on every commit for developpers

"developers"


> +AC_ARG_ENABLE(skip-version,

I wonder whether "git-hash" would be more obvious here, so
"--disable-git-hash" would turn off the git hash in version output.


> +             AS_HELP_STRING([--enable-skip-version],
> +                            [Do not use git hash in version]),
> +             [skip_version=$enableval], [skip_version=no])
> +AM_CONDITIONAL(SKIP_VERSION, [test "x$skip_version" = xyes])
> +
>  # -----------------------------------------------------------------------------
>
>  # To build multithread code, gcc uses -pthread, Solaris Studio cc uses -mt
> diff --git a/lib/Makefile.sources b/lib/Makefile.sources
> index f8a1b92..2148684 100644
> --- a/lib/Makefile.sources
> +++ b/lib/Makefile.sources
> @@ -60,6 +60,10 @@ libintel_tools_la_SOURCES =  \
>
>  .PHONY: version.h.tmp
>
> +if SKIP_VERSION
> +$(IGT_LIB_PATH)/version.h.tmp:
> +       @echo '#define IGT_GIT_SHA1 "SKIP"' >> $@

Perhaps just "git", so the version output appears as (for example)
"1.11-git", rather than "1.11-SKIP".


> +else
>  $(IGT_LIB_PATH)/version.h.tmp:
>         @touch $@
>         @if test -d $(GPU_TOOLS_PATH)/.git; then \
> @@ -73,6 +77,7 @@ $(IGT_LIB_PATH)/version.h.tmp:
>         else \
>                 echo '#define IGT_GIT_SHA1 "NOT-GIT"' ; \
>         fi >> $@
> +endif # SKIP_VERSION
>
>
>  $(IGT_LIB_PATH)/version.h: $(IGT_LIB_PATH)/version.h.tmp
> --
> 2.1.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/configure.ac b/configure.ac
index 4208f00..caa3f50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -212,6 +212,13 @@  if test "x$enable_debug" = xyes; then
 	AC_SUBST([DEBUG_CFLAGS])
 fi
 
+# prevent relinking the world on every commit for developpers
+AC_ARG_ENABLE(skip-version,
+	      AS_HELP_STRING([--enable-skip-version],
+			     [Do not use git hash in version]),
+	      [skip_version=$enableval], [skip_version=no])
+AM_CONDITIONAL(SKIP_VERSION, [test "x$skip_version" = xyes])
+
 # -----------------------------------------------------------------------------
 
 # To build multithread code, gcc uses -pthread, Solaris Studio cc uses -mt
diff --git a/lib/Makefile.sources b/lib/Makefile.sources
index f8a1b92..2148684 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -60,6 +60,10 @@  libintel_tools_la_SOURCES = 	\
 
 .PHONY: version.h.tmp
 
+if SKIP_VERSION
+$(IGT_LIB_PATH)/version.h.tmp:
+	@echo '#define IGT_GIT_SHA1 "SKIP"' >> $@
+else
 $(IGT_LIB_PATH)/version.h.tmp:
 	@touch $@
 	@if test -d $(GPU_TOOLS_PATH)/.git; then \
@@ -73,6 +77,7 @@  $(IGT_LIB_PATH)/version.h.tmp:
 	else \
 		echo '#define IGT_GIT_SHA1 "NOT-GIT"' ; \
 	fi >> $@
+endif # SKIP_VERSION
 
 
 $(IGT_LIB_PATH)/version.h: $(IGT_LIB_PATH)/version.h.tmp