From 55eb75ad86d01af7840b8f9080670d34eb884749 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Tue, 12 May 2015 11:30:57 +0900 Subject: [PATCH] Evas GL common: Skip shaders generation if there is no change Based on a quick git diff we check that the glsl code has not changed. This should fix out-of-tree builds and avoid all source modification unless required. When compiling from a tarball there should be no git tree (err 129), or if there's one the files should not be checked in (ie. no diff). If you changed the glsl files in a tarball... too bad for you. If this is still not enough to fix the build, then go ahead and disable the script from Makefile_Evas.am I would like to note that the auto-generation during make is extremely useful when working on the shaders, which is why I'd rather keep it enabled. @fix --- src/modules/evas/engines/gl_common/shader/evas_gl_enum.x | 3 +-- src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x | 3 +-- src/modules/evas/engines/gl_common/shader/gen_shaders.sh | 12 ++++++++++-- .../evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x | 3 +-- .../evas/engines/gl_common/shader_3d/gen_shaders_3d.sh | 10 +++++++++- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x b/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x index 4f3cb12..e30184e 100644 --- a/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x +++ b/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x @@ -1,5 +1,4 @@ -/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED - * See: ./modules/evas/engines/gl_common/shader/gen_shaders.sh */ +/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED */ typedef enum { SHADER_RECT, diff --git a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x index a14c527..d1a3cc6 100644 --- a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x +++ b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x @@ -1,5 +1,4 @@ -/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED - * See: ./modules/evas/engines/gl_common/shader/gen_shaders.sh */ +/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED */ #include "../evas_gl_private.h" diff --git a/src/modules/evas/engines/gl_common/shader/gen_shaders.sh b/src/modules/evas/engines/gl_common/shader/gen_shaders.sh index 677aaab..7b0f741 100755 --- a/src/modules/evas/engines/gl_common/shader/gen_shaders.sh +++ b/src/modules/evas/engines/gl_common/shader/gen_shaders.sh @@ -35,6 +35,14 @@ precision mediump float; #endif " +# Skip generation if there is no diff (or no git) +if ! git rev-parse 2>> /dev/null >> /dev/null ; then exit 0 ; fi +if git diff --quiet --exit-code -- "$DIR" +then + touch "${OUTPUT}" "${OUTPUT_ENUM}" + exit 0 +fi + function upper() { echo $@ |tr '[:lower:]' '[:upper:]' } @@ -50,7 +58,7 @@ IFS=$'\n' SHADERS=(`cat ${DIR}/shaders.txt`) IFS=$OIFS # Write header -printf "/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED\n * See: $0 */\n\n" > ${OUTPUT} +printf "/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED */\n\n" > ${OUTPUT} # Including private for hilights and stuff :) printf "#include \"../evas_gl_private.h\"\n\n" >> ${OUTPUT} @@ -164,7 +172,7 @@ static const struct { printf "${shaders_source}};\n\n" >> ${OUTPUT} -printf "/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED\n * See: $0 */ +printf "/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED */ typedef enum { ${shaders_enum} SHADER_LAST diff --git a/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x b/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x index 75cbec2..88a794a 100644 --- a/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x +++ b/src/modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x @@ -1,5 +1,4 @@ -/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED - * See: modules/evas/engines/gl_common/shader_3d/gen_shaders_3d.sh */ +/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED */ static const char vertex_color_vert_glsl[] = "#ifdef GL_ES\n" diff --git a/src/modules/evas/engines/gl_common/shader_3d/gen_shaders_3d.sh b/src/modules/evas/engines/gl_common/shader_3d/gen_shaders_3d.sh index 01aea2a..6637dd9 100755 --- a/src/modules/evas/engines/gl_common/shader_3d/gen_shaders_3d.sh +++ b/src/modules/evas/engines/gl_common/shader_3d/gen_shaders_3d.sh @@ -6,6 +6,14 @@ DIR=`dirname $0` OUTPUT=${DIR}/evas_gl_3d_shaders.x +# Skip generation if there is no diff (or no git) +if ! git rev-parse 2>> /dev/null >> /dev/null ; then exit 0 ; fi +if git diff --quiet --exit-code -- "$DIR" +then + touch "${OUTPUT}" + exit 0 +fi + exec 1<&- exec 1>${OUTPUT} @@ -14,7 +22,7 @@ vert_shaders_source="" frag_shaders_source="" # Write header -printf "/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED\n * See: $0 */\n\n" +printf "/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED */\n\n" for shd in ${SHADERS} ; do lname=`basename ${shd} .shd` -- 2.7.4