Blame common/win32.mak

Packit Service 963350
# various tests to make sure we dist the win32 stuff (for MSVC builds) right
Packit Service 963350
Packit Service 963350
# the MANIFEST contains all win32 related files that should be disted
Packit Service 963350
win32 = $(shell cat $(top_srcdir)/win32/MANIFEST)
Packit Service 963350
Packit Service 963350
# wildcard is apparently not portable to other makes, hence the use of find
Packit Service 963350
# these are library .def files with the symbols to export
Packit Service 963350
win32defs = $(shell find $(top_srcdir)/win32/common -name '*.def')
Packit Service 963350
Packit Service 963350
# wildcard is apparently not portable to other makes, hence the use of find
Packit Service 963350
# these are files that need to be disted with CRLF line endings:
Packit Service 963350
win32crlf = $(shell find $(top_srcdir)/win32 -name '*.dsw' -o -name '*.dsp')
Packit Service 963350
Packit Service 963350
win32-debug:
Packit Service 963350
	@echo; \
Packit Service 963350
	echo win32     = $(win32); \
Packit Service 963350
	echo; \
Packit Service 963350
	echo win32defs = $(win32defs); \
Packit Service 963350
	echo; \
Packit Service 963350
	echo win32crlf = $(win32crlf); \
Packit Service 963350
	echo
Packit Service 963350
Packit Service 963350
win32-check-crlf:
Packit Service 963350
	@echo Checking win32 files for CR LF line endings ...; \
Packit Service 963350
	fail=0 ; \
Packit Service 963350
	for each in $(win32crlf) ; do \
Packit Service 963350
	  result=`perl -e 'print grep(/\r\n/,<>)' "$$each" | wc -l`; \
Packit Service 963350
	  if test "$$result" = 0 ; then \
Packit Service 963350
	    echo $$each must be fixed to have CRLF line endings ; \
Packit Service 963350
	    fail=1; \
Packit Service 963350
	  fi ; \
Packit Service 963350
	done ; \
Packit Service 963350
	exit $$fail
Packit Service 963350
Packit Service 963350
# make sure all symbols we export on linux are defined in the win32 .def too
Packit Service 963350
# (don't care about other unixes for now, it's enough if it works on one of
Packit Service 963350
# the linux build bots; we assume .so )
Packit Service 963350
check-exports:
Packit Service 963350
	@fail=0 ; \
Packit Service 963350
	for l in $(win32defs); do \
Packit Service 963350
	  libbase=`basename "$$l" ".def"`; \
Packit Service 963350
	  libso=`find "$(top_builddir)" -name "$$libbase-@GST_API_VERSION@.so" | grep -v /_build/ | head -n1`; \
Packit Service 963350
	  libdef="$(top_srcdir)/win32/common/$$libbase.def"; \
Packit Service 963350
	  if test "x$$libso" != "x"; then \
Packit Service 963350
	    echo Checking symbols in $$libso; \
Packit Service 963350
	    if ! ($(top_srcdir)/common/check-exports $$libdef $$libso) ; then \
Packit Service 963350
	      echo "$$libdef"; \
Packit Service 963350
	      if test "$$libbase" != "libgstgl"; then \
Packit Service 963350
	        fail=1; \
Packit Service 963350
	      fi; \
Packit Service 963350
	    fi; \
Packit Service 963350
	  fi; \
Packit Service 963350
	done ; \
Packit Service 963350
	if test $$fail != 0; then \
Packit Service 963350
	  echo '-----------------------------------------------------------'; \
Packit Service 963350
	  echo 'Run this to update the .def files:'; \
Packit Service 963350
	  echo 'make update-exports'; \
Packit Service 963350
	  echo '-----------------------------------------------------------'; \
Packit Service 963350
	fi; \
Packit Service 963350
	exit $$fail
Packit Service 963350
Packit Service 963350
update-exports:
Packit Service 963350
	make check-exports 2>&1 | patch -p1
Packit Service 963350
	if test -f "$(top_srcdir)/win32/common/libgstgl.def"; then \
Packit Service 963350
	  git checkout "$(top_srcdir)/win32/common/libgstgl.def";  \
Packit Service 963350
	fi
Packit Service 963350
	git add $(top_srcdir)/win32/common/lib*.def
Packit Service 963350
	git diff --cached -- $(top_srcdir)/win32/common/
Packit Service 963350
	echo '^^^--- updated and staged changes above'
Packit Service 963350
Packit Service 963350
# complain about nonportable printf format strings (%lld, %llu, %zu etc.)
Packit Service 963350
check-nonportable-print-format:
Packit Service 963350
	@fail=0 ; \
Packit Service 963350
	loc=`find "$(top_srcdir)" -name '*.c' | xargs grep -n -e '%[0-9]*ll[udx]' -e '%[0-9]*z[udx]'`; \
Packit Service 963350
	if test "x$$loc" != "x"; then \
Packit Service 963350
	  echo "Please fix the following print format strings:" ; \
Packit Service 963350
	  find "$(top_srcdir)" -name '*.c' | xargs grep -n -e '%[0-9]*ll[udx]' -e '%[0-9]*z[udx]'; \
Packit Service 963350
	  fail=1; \
Packit Service 963350
	fi; \
Packit Service 963350
	exit $$fail
Packit Service 963350
Packit Service 963350
dist-hook: check-exports win32-check-crlf
Packit Service 963350
Packit Service 963350