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
This commit is contained in:
Jean-Philippe Andre 2015-05-12 11:30:57 +09:00
parent 9f29974292
commit 55eb75ad86
5 changed files with 22 additions and 9 deletions

View File

@ -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,

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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`