Use perl for portability

FS-4303 --resolve
This commit is contained in:
Travis Cross 2012-06-12 17:32:34 +00:00
parent 9470c079dd
commit f8be71ac6d
1 changed files with 2 additions and 3 deletions

View File

@ -418,14 +418,13 @@ $(switch_builddir)/quiet_libtool: $(switch_builddir)/libtool
src/include/switch_version.h: src/include/switch_version.h.in Makefile $(libfreeswitch_la_SOURCES) $(library_include_HEADERS) src/include/switch_version.h: src/include/switch_version.h.in Makefile $(libfreeswitch_la_SOURCES) $(library_include_HEADERS)
@cat $< > $@; \ @cat $< > $@; \
if [ -d .git ]; then \ if [ -d .git ]; then \
xdate="$$(date -d "$$(git log -n1 --format='%ci' HEAD)" -u '+%Y%m%dT%H%M%SZ')"; \ xdate="$$(perl -e 'use POSIX; print strftime("%Y%m%dT%H%M%SZ",gmtime($$ARGV[0]))' "$$(git log -n1 --format='%ct' HEAD)")"; \
xcommit="$$(git rev-list -n1 --abbrev=10 --abbrev-commit HEAD)"; \ xcommit="$$(git rev-list -n1 --abbrev=10 --abbrev-commit HEAD)"; \
xver="+git~$$xdate~$$xcommit"; \ xver="+git~$$xdate~$$xcommit"; \
if ! git diff-index --quiet HEAD; then \ if ! git diff-index --quiet HEAD; then \
xver="$$xver+unclean~$$(date -u +%Y%m%dT%H%M%SZ)"; \ xver="$$xver+unclean~$$(date -u +%Y%m%dT%H%M%SZ)"; \
fi; \ fi; \
sed \ perl -ple "if (/#define *SWITCH_VERSION_REVISION/) {s/\"(.*)\"/\"\1$$xver\"/}" \
-e "/#define *SWITCH_VERSION_REVISION/{s/\"\([^\"]*\)\"/\"\1$$xver\"/; :l n; b l}" \
$< > $@; \ $< > $@; \
fi; fi;