shader gen - make this use plain sh not bash for portability

this should fix T3793
This commit is contained in:
Carsten Haitzler 2016-06-15 14:04:28 +09:00
parent fe9a9d8759
commit fa19b37458
5 changed files with 55 additions and 52 deletions

View File

@ -776,7 +776,7 @@ EXTRA_DIST2 += $(EVAS_GL_SHADERS_GEN)
modules/evas/engines/gl_common/shader/evas_gl_shaders.x: $(EVAS_GL_SHADERS_GEN)
@echo " SHADERS $@"
@bash $(srcdir)/modules/evas/engines/gl_common/shader/gen_shaders.sh
@dash $(srcdir)/modules/evas/engines/gl_common/shader/gen_shaders.sh
# NOTE: order here should be equal with modes in file Evas_Eo.h
GL_SHADERS_3D_GEN = \
@ -806,7 +806,7 @@ $(GL_SHADERS_3D_GEN)
modules/evas/engines/gl_common/shader_3d/evas_gl_3d_shaders.x: modules/evas/engines/gl_common/shader_3d/gen_shaders_3d.sh $(GL_SHADERS_3D_GEN)
@echo " SHADERS $@"
@bash $^
@dash $^
GL_GENERIC_SOURCES = \

View File

@ -134,7 +134,7 @@ gl/shader/include.glsl
gl/shader/ector_gl_shaders.x: $(ECTOR_GL_SHADERS_GEN)
@echo " SHADERS $@"
@bash $(srcdir)/gl/shader/gen_shaders.sh
@dash $(srcdir)/gl/shader/gen_shaders.sh
libector_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-I$(top_builddir)/src/lib/ector \

View File

@ -1,38 +1,39 @@
#!/bin/bash
#!/bin/sh
# This script will generate a C file containing all the shaders used by Evas
DIR=`dirname $0`
OUTPUT=${DIR}/ector_gl_shaders.x
OUTPUT="$DIR/ector_gl_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}"
touch "$OUTPUT"
exit 0
fi
exec 1<&-
exec 1>${OUTPUT}
exec 1>"$OUTPUT"
# Write header
printf "/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED */\n"
printf "/* IF IT IS CHANGED PLEASE COMMIT THE CHANGES */\n\n"
for shd in fragment vertex ; do
m4 ${DIR}/include.glsl ${DIR}/${shd}.glsl > ${shd}.tmp
for SHD in fragment vertex ; do
m4 "$DIR/include.glsl" "$DIR/$SHD.glsl" > "$SHD.tmp"
OIFS=$IFS
IFS=$'\n'
printf "static const char ${shd}_glsl[] ="
for line in `cat ${shd}.tmp` ; do
printf "\n \"${line}\\\n\""
OIFS="$IFS"
IFS=`printf '\n+'`
IFS=${IFS%+}
printf "static const char "$SHD"_glsl[] ="
for LINE in `cat "$SHD.tmp"` ; do
printf "\n \"$LINE\\\n\""
done
printf ";\n\n"
IFS=${OIFS}
IFS="$OIFS"
rm ${shd}.tmp
rm "$SHD.tmp"
done

View File

@ -1,38 +1,39 @@
#!/bin/bash
#!/bin/sh
# This script will generate a C file containing all the shaders used by Evas
DIR=`dirname $0`
OUTPUT=${DIR}/evas_gl_shaders.x
OUTPUT="$DIR/evas_gl_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}"
touch "$OUTPUT"
exit 0
fi
exec 1<&-
exec 1>${OUTPUT}
exec 1>"$OUTPUT"
# Write header
printf "/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED */\n"
printf "/* IF IT IS CHANGED PLEASE COMMIT THE CHANGES */\n\n"
for shd in fragment vertex ; do
m4 ${DIR}/include.glsl ${DIR}/${shd}.glsl > ${shd}.tmp
for SHD in fragment vertex ; do
m4 "$DIR/include.glsl" "$DIR/$SHD.glsl" > "$SHD.tmp"
OIFS=$IFS
IFS=$'\n'
printf "static const char ${shd}_glsl[] ="
for line in `cat ${shd}.tmp` ; do
printf "\n \"${line}\\\n\""
OIFS="$IFS"
IFS=`printf '\n+'`
IFS=${IFS%+}
printf "static const char "$SHD"_glsl[] ="
for LINE in `cat "$SHD.tmp"` ; do
printf "\n \"$LINE\\\n\""
done
printf ";\n\n"
IFS=${OIFS}
IFS="$OIFS"
rm ${shd}.tmp
rm "$SHD.tmp"
done

View File

@ -1,60 +1,61 @@
#!/bin/bash
#!/bin/sh
# This script will generate a C file containing all the shaders used by Evas_3D
DIR=`dirname $0`
OUTPUT=${DIR}/evas_gl_3d_shaders.x
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}"
touch "$OUTPUT"
exit 0
fi
exec 1<&-
exec 1>${OUTPUT}
exec 1>"$OUTPUT"
SHADERS="$@"
vert_shaders_source=""
frag_shaders_source=""
SHADERS=$@
VERT_SHADERS_SOURCE=""
FRAG_SHADERS_SOURCE=""
# Write header
printf "/* DO NOT MODIFY THIS FILE AS IT IS AUTO-GENERATED */\n"
printf "/* IF IT IS CHANGED PLEASE COMMIT THE CHANGES */\n\n"
for shd in ${SHADERS} ; do
lname=`basename ${shd} .shd`
for SHD in $SHADERS ; do
LNAME=`basename "$SHD" .shd`
if echo ${lname} |grep _vert 2>&1 >> /dev/null ; then
vert_shaders_source="${vert_shaders_source} ${lname}_glsl,\n"
if echo "$LNAME" | grep _vert 2>&1 >> /dev/null ; then
VERT_SHADERS_SOURCE="$VERT_SHADERS_SOURCE "$LNAME"_glsl,\n"
fi
if echo ${lname} |grep _frag 2>&1 >> /dev/null ; then
frag_shaders_source="${frag_shaders_source} ${lname}_glsl,\n"
if echo "$LNAME" | grep _frag 2>&1 >> /dev/null ; then
FRAG_SHADERS_SOURCE="$FRAG_SHADERS_SOURCE "$LNAME"_glsl,\n"
fi
m4 ${DIR}/include.shd ${shd} > ${shd}.tmp
m4 "$DIR/include.shd" "$SHD" > "$SHD.tmp"
OIFS=$IFS
IFS=$'\n'
printf "static const char ${lname}_glsl[] ="
for line in `cat ${shd}.tmp` ; do
printf "\n \"${line}\\\n\""
OIFS="$IFS"
IFS=`printf '\n+'`
IFS=${IFS%+}
printf "static const char "$LNAME"_glsl[] ="
for LINE in `cat "$SHD.tmp"` ; do
printf "\n \"$LINE\\\n\""
done
printf ";\n\n"
IFS=${OIFS}
IFS="$OIFS"
rm ${shd}.tmp
rm "$SHD.tmp"
done
printf "static const char *vertex_shaders[] =
{\n"
printf "${vert_shaders_source}"
printf "$VERT_SHADERS_SOURCE"
printf "};\n\n"
printf "static const char *fragment_shaders[] =
{\n"
printf "${frag_shaders_source}"
printf "$FRAG_SHADERS_SOURCE"
printf "};\n"