[Spice-devel] [PATCH win-agent] build-sys: statically build agent

Marc-André Lureau marcandre.lureau at gmail.com
Fri Jun 8 04:14:02 PDT 2012


Fix build by default when using mingw (when more compiler are
supported we could do case by case)

Since we are statically building, strip resulting binary (we
also use lto, whole-program but that doesn't seem to change
much..)
---
 Makefile.am  |    9 ++++++---
 configure.ac |    1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 5f0c9dc..f954a8c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,15 +6,18 @@ INCLUDES =				\
 	-I$(top_srcdir)/spice-protocol	\
 	$(NULL)
 
-AM_CPPFLAGS = -DUNICODE -D_UNICODE
+AM_CXXFLAGS = -flto -fwhole-program
+AM_CPPFLAGS = -DUNICODE -D_UNICODE -DOLDMSVCRT
+AM_LDFLAGS = -static -s
+
 # -lversion is needed for the GetFileVersion* API which is used by vdlog.cpp
 LIBS = -lversion
 
 bin_PROGRAMS = vdagent vdservice
 
 vdagent_LDADD = $(CXIMAGE_LIBS) vdagent_rc.$(OBJEXT)
-vdagent_CXXFLAGS = $(CXIMAGE_CFLAGS)
-vdagent_LDFLAGS = -Wl,--subsystem,windows
+vdagent_CXXFLAGS = $(AM_CXXFLAGS) $(CXIMAGE_CFLAGS)
+vdagent_LDFLAGS = $(AM_LDFLAGS) -Wl,--subsystem,windows
 vdagent_SOURCES =			\
 	common/vdcommon.h		\
 	common/vdlog.cpp		\
diff --git a/configure.ac b/configure.ac
index 597e724..0b5f498 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,7 @@ dnl - Check library dependencies
 dnl ---------------------------------------------------------------------------
 
 PKG_CHECK_MODULES(CXIMAGE, [cximage])
+CXIMAGE_LIBS=`$PKG_CONFIG --static --libs cximage`
 
 dnl ---------------------------------------------------------------------------
 dnl - Makefiles, etc.
-- 
1.7.10.2



More information about the Spice-devel mailing list