[cairo] 回覆: [PATCH] Fix Windows build with cmd.exe as shell
Fan, Chun-wei
fanc999 at yahoo.com.tw
Wed Apr 22 20:04:10 PDT 2015
Hi Bryce,
(Sorry, I accidentally hit send while replying, sorry for the noise.)
Cairo's current build system either requires MSYS+mingw or Mozilla build msys+msvc to work.
I think what Simon is doing is to remove the build-time dependency on Mozilla build msys when building Cairo on Windows with msvc. I think I will check on his patch asap for this.
With blessings.
----- 原始郵件 -----
寄件者: "Bryce Harrington" <bryce at osg.samsung.com>
寄件日期: 2015/4/23 08:11
收件者: "Simon Richter" <Simon.Richter at hogyros.de>
副本: "cairo at cairographics.org" <cairo at cairographics.org>
主旨: Re: [cairo] [PATCH] Fix Windows build with cmd.exe as shell
On Wed, Apr 22, 2015 at 11:05:41AM +0200, Simon Richter wrote:
> cmd.exe has unsubtly different behaviour from POSIX sh in a lot of places.
> This determines whether the current default shell for make is cmd.exe, and
> avoids "mkdir -p", "rm" and quotes around the argument to echo in this
> case.
What exactly is the breakage that this fixes? IOW, why has the current
code worked up 'til now on windows?
> ---
> build/Makefile.win32.common | 22 ++++++---
> build/Makefile.win32.features-h | 98 ++++++++++++++++++++---------------------
> build/Makefile.win32.inform | 14 +++---
> build/configure.ac.features | 12 ++---
> src/Makefile.win32 | 21 +++++----
> 5 files changed, 92 insertions(+), 75 deletions(-)
>
> diff --git a/build/Makefile.win32.common b/build/Makefile.win32.common
> index 7d7e973..3e4024d 100644
> --- a/build/Makefile.win32.common
> +++ b/build/Makefile.win32.common
> @@ -1,5 +1,17 @@
> default: all
>
> +ifeq ($(shell echo ""),)
> +# POSIX style shell
> +mkdir_p = mkdir -p $1
> +rm = $(RM) $1
> +echo = echo "$1"
> +else
> +# DOS/Windows style shell
> +mkdir_p = if not exist $(subst /,\,$1) md $(subst /,\,$1)
> +echo = $(if $1,echo $1,echo.)
> +rm = del $(subst /,\,$1)
> +endif
If you use := instead of = for these command definitions, would it
eliminate the need for the calls in the rest of the patch?
Also, the makefile style seems to be to use uppercase letters when
using variables rather than system commands, so you should be specifying
MKDIR_P, ECHO, and RM.
> #
> # Edit build/Makefile.win32.features to enable features to build
> #
> @@ -63,12 +75,12 @@ CAIRO_ARFLAGS = $(DEFAULT_ARFLAGS) $(LDFLAGS)
> # Some generic rules
>
> $(CFG)/%.obj: %.c $(top_srcdir)/src/cairo-features.h
> - @mkdir -p $(CFG)/`dirname $<`
> - @$(CC) $(CAIRO_CFLAGS) -c -Fo"$@" $<
> + $(call mkdir_p,$(@D))
> + $(CC) $(CAIRO_CFLAGS) -c -Fo"$@" $<
>
> $(CFG)/%-static.obj: %.c $(top_srcdir)/src/cairo-features.h
> - @mkdir -p $(CFG)/`dirname $<`
> - @$(CC) $(CAIRO_CFLAGS) -c -DCAIRO_WIN32_STATIC_BUILD=1 -Fo"$@" $<
> + $(call mkdir_p,$(@D))
> + $(CC) $(CAIRO_CFLAGS) -c -DCAIRO_WIN32_STATIC_BUILD=1 -Fo"$@" $<
>
> clean:
> - @rm -f $(CFG)/*.obj $(CFG)/*.dll $(CFG)/*.lib $(CFG)/*.pdb $(CFG)/*.ilk || exit 0
> + -$(call rm,$(CFG)/*.obj $(CFG)/*.dll $(CFG)/*.lib $(CFG)/*.pdb $(CFG)/*.ilk)
> diff --git a/build/Makefile.win32.features-h b/build/Makefile.win32.features-h
> index 13904cf..f3dd420 100644
> --- a/build/Makefile.win32.features-h
> +++ b/build/Makefile.win32.features-h
> @@ -1,130 +1,130 @@
> # Generated by configure. Do not edit.
>
> $(top_srcdir)/src/cairo-features.h: $(top_srcdir)/build/Makefile.win32.features
> - @echo "Generating src/cairo-features.h"
> - @echo "/* Generated by Makefile.win32.features-h. Do not edit. */" > $(top_srcdir)/src/cairo-features.h
> - @echo "#ifndef CAIRO_FEATURES_H" >> $(top_srcdir)/src/cairo-features.h
> - @echo "#define CAIRO_FEATURES_H 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,Generating src/cairo-features.h)
> + @$(call echo,/* Generated by Makefile.win32.features-h. Do not edit. */) > $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#ifndef CAIRO_FEATURES_H) >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_FEATURES_H 1) >> $(top_srcdir)/src/cairo-features.h
> ifeq ($(CAIRO_HAS_XLIB_SURFACE),1)
> - @echo "#define CAIRO_HAS_XLIB_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_XLIB_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_XLIB_XRENDER_SURFACE),1)
> - @echo "#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_XCB_SURFACE),1)
> - @echo "#define CAIRO_HAS_XCB_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_XCB_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_XLIB_XCB_FUNCTIONS),1)
> - @echo "#define CAIRO_HAS_XLIB_XCB_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_XLIB_XCB_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_XCB_SHM_FUNCTIONS),1)
> - @echo "#define CAIRO_HAS_XCB_SHM_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_XCB_SHM_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_QT_SURFACE),1)
> - @echo "#define CAIRO_HAS_QT_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_QT_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_QUARTZ_SURFACE),1)
> - @echo "#define CAIRO_HAS_QUARTZ_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_QUARTZ_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_QUARTZ_FONT),1)
> - @echo "#define CAIRO_HAS_QUARTZ_FONT 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_QUARTZ_FONT 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_QUARTZ_IMAGE_SURFACE),1)
> - @echo "#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_WIN32_SURFACE),1)
> - @echo "#define CAIRO_HAS_WIN32_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_WIN32_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_WIN32_FONT),1)
> - @echo "#define CAIRO_HAS_WIN32_FONT 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_WIN32_FONT 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_SKIA_SURFACE),1)
> - @echo "#define CAIRO_HAS_SKIA_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_SKIA_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_OS2_SURFACE),1)
> - @echo "#define CAIRO_HAS_OS2_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_OS2_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_BEOS_SURFACE),1)
> - @echo "#define CAIRO_HAS_BEOS_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_BEOS_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_DRM_SURFACE),1)
> - @echo "#define CAIRO_HAS_DRM_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_DRM_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_GALLIUM_SURFACE),1)
> - @echo "#define CAIRO_HAS_GALLIUM_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_GALLIUM_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_PNG_FUNCTIONS),1)
> - @echo "#define CAIRO_HAS_PNG_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_PNG_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_GL_SURFACE),1)
> - @echo "#define CAIRO_HAS_GL_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_GL_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_GLESV2_SURFACE),1)
> - @echo "#define CAIRO_HAS_GLESV2_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_GLESV2_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_COGL_SURFACE),1)
> - @echo "#define CAIRO_HAS_COGL_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_COGL_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_DIRECTFB_SURFACE),1)
> - @echo "#define CAIRO_HAS_DIRECTFB_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_DIRECTFB_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_VG_SURFACE),1)
> - @echo "#define CAIRO_HAS_VG_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_VG_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_EGL_FUNCTIONS),1)
> - @echo "#define CAIRO_HAS_EGL_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_EGL_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_GLX_FUNCTIONS),1)
> - @echo "#define CAIRO_HAS_GLX_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_GLX_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_WGL_FUNCTIONS),1)
> - @echo "#define CAIRO_HAS_WGL_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_WGL_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_SCRIPT_SURFACE),1)
> - @echo "#define CAIRO_HAS_SCRIPT_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_SCRIPT_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_FT_FONT),1)
> - @echo "#define CAIRO_HAS_FT_FONT 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_FT_FONT 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_FC_FONT),1)
> - @echo "#define CAIRO_HAS_FC_FONT 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_FC_FONT 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_PS_SURFACE),1)
> - @echo "#define CAIRO_HAS_PS_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_PS_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_PDF_SURFACE),1)
> - @echo "#define CAIRO_HAS_PDF_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_PDF_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_SVG_SURFACE),1)
> - @echo "#define CAIRO_HAS_SVG_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_SVG_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_TEST_SURFACES),1)
> - @echo "#define CAIRO_HAS_TEST_SURFACES 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_TEST_SURFACES 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> - @echo "#define CAIRO_HAS_IMAGE_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> - @echo "#define CAIRO_HAS_MIME_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> - @echo "#define CAIRO_HAS_RECORDING_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> - @echo "#define CAIRO_HAS_OBSERVER_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_IMAGE_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_MIME_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_RECORDING_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_OBSERVER_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> ifeq ($(CAIRO_HAS_TEE_SURFACE),1)
> - @echo "#define CAIRO_HAS_TEE_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_TEE_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_XML_SURFACE),1)
> - @echo "#define CAIRO_HAS_XML_SURFACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_XML_SURFACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> - @echo "#define CAIRO_HAS_USER_FONT 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_USER_FONT 1) >> $(top_srcdir)/src/cairo-features.h
> ifeq ($(CAIRO_HAS_PTHREAD),1)
> - @echo "#define CAIRO_HAS_PTHREAD 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_PTHREAD 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_GOBJECT_FUNCTIONS),1)
> - @echo "#define CAIRO_HAS_GOBJECT_FUNCTIONS 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_GOBJECT_FUNCTIONS 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_TRACE),1)
> - @echo "#define CAIRO_HAS_TRACE 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_TRACE 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_INTERPRETER),1)
> - @echo "#define CAIRO_HAS_INTERPRETER 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_INTERPRETER 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> ifeq ($(CAIRO_HAS_SYMBOL_LOOKUP),1)
> - @echo "#define CAIRO_HAS_SYMBOL_LOOKUP 1" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#define CAIRO_HAS_SYMBOL_LOOKUP 1) >> $(top_srcdir)/src/cairo-features.h
> endif
> - @echo "#endif" >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,#endif) >> $(top_srcdir)/src/cairo-features.h
> diff --git a/build/Makefile.win32.inform b/build/Makefile.win32.inform
> index ba11165..99a438c 100644
> --- a/build/Makefile.win32.inform
> +++ b/build/Makefile.win32.inform
> @@ -1,13 +1,13 @@
> inform:
> - @echo
> + @$(call echo)
> ifneq ($(CFG),release)
> ifneq ($(CFG),debug)
> - @echo "Invalid configuration "$(CFG)" specified."
> - @echo -n "You must specify a configuration when "
> - @echo "running make, e.g. make CFG=debug"
> - @echo
> - @echo -n "Possible choices for configuration are "
> - @echo "'release' and 'debug'"
> + @$(call echo,Invalid configuration "$(CFG)" specified.)
> + @$(call echo,You must specify a configuration when)
> + @$(call echo,running make, e.g. make CFG=debug)
> + @$(call echo)
> + @$(call echo,Possible choices for configuration are)
> + @$(call echo,'release' and 'debug')
> @exit 1
> endif
> endif
> diff --git a/build/configure.ac.features b/build/configure.ac.features
> index e4a2aaf..af378c2 100644
> --- a/build/configure.ac.features
> +++ b/build/configure.ac.features
> @@ -296,17 +296,17 @@ CAIRO_CONFIG_MAKEFILE_PRIVATE_WIN32([win32_features_h],[build],[features-h])
> dnl
> CAIRO_MAKEFILE_ACCUMULATE([win32_features_h],
> [$(top_srcdir)/src/cairo-features.h: $(top_srcdir)/build/Makefile.win32.features
> - @echo "Generating src/cairo-features.h"
> - @echo "/* Generated by Makefile.win32.features-h. Do not edit. */" > $(top_srcdir)/src/cairo-features.h
> - @echo "[#]ifndef CAIRO_FEATURES_H" >> $(top_srcdir)/src/cairo-features.h
> - @echo "[#]define CAIRO_FEATURES_H 1" >> $(top_srcdir)/src/cairo-features.h]dnl
> + @$(call echo,Generating src/cairo-features.h)
> + @$(call echo,/* Generated by Makefile.win32.features-h. Do not edit. */) > $(top_srcdir)/src/cairo-features.h
> + @$(call echo,[#]ifndef CAIRO_FEATURES_H) >> $(top_srcdir)/src/cairo-features.h
> + @$(call echo,[#]define CAIRO_FEATURES_H 1) >> $(top_srcdir)/src/cairo-features.h]dnl
> )
> AC_CONFIG_COMMANDS_PRE(
> [dnl
> - CAIRO_MAKEFILE_ACCUMULATE([win32_features_h], [ @echo "[#]endif" >> $(top_srcdir)/src/cairo-features
[未包括完整原始郵件。]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20150423/51b16b7e/attachment-0001.html>
More information about the cairo
mailing list