Hi guys,

Currently during cross compilation of the wayland library the
wayland-scanner utility is built by cross-gcc and then used on the
developer machine which lead build error.

I suggest to build development version, for example,
$(top_builddir)/build-wayland-scanner and to use this utility during
cross-buildin the wayland package.

When build is done the user can copy this release of scanner utility into
his toolchain or into his SDK for example wit $(host-triplet) preffix

cp $(top_builddir)/build-wayland-scanner
SDK/bin/$(host_triplet)-wayland-scanner

Then the user can make use this cross-wayland-scanner in his SDK, for
example, like follow:

$ ../MesaLib-10.3.4/configure
WAILAND_SCANNER=$(SDK_DIR)/bin/$(target)-wayland-scanner

I have attached the patch for you. Please look at this patch and please
make decision related to cross building the wayland.

Of course after applying attached patch we have to reconfigure src package;

$ autoreconf -i


Best Regards,
Andrey K.
diff -b --unified -Nr wayland-1.10.0-orig/Makefile.am wayland-1.10.0/Makefile.am
--- wayland-1.10.0-orig/Makefile.am	2015-11-23 23:06:44.000000000 +0300
+++ wayland-1.10.0/Makefile.am	2016-05-18 15:15:08.399576274 +0300
@@ -2,6 +2,10 @@
 SUBDIRS = doc
 endif
 
+CC_FOR_BUILD = gcc
+LD_FOR_BUILD = $(CC_FOR_BUILD)
+COMPILE_FOR_BUILD = $(CC_FOR_BUILD)
+
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 
 AM_CPPFLAGS =					\
@@ -33,7 +37,7 @@
 if USE_HOST_SCANNER
 wayland_scanner = wayland-scanner
 else
-$(BUILT_SOURCES) : wayland-scanner
+$(BUILT_SOURCES) : wayland-scanner build-wayland-scanner
 wayland_scanner = $(top_builddir)/wayland-scanner
 endif
 
@@ -93,20 +97,44 @@
 
 pkgconfig_DATA += src/wayland-client.pc src/wayland-server.pc
 
+build-wayland-util.c: $(top_srcdir)/src/wayland-util.c
+	cp $< $@
+
+build-scanner.c: $(top_srcdir)/src/scanner.c
+	cp $< $@
+
+build-dtddata.S: $(top_srcdir)/src/dtddata.S
+	cp $< $@
+
+build_wayland_scanner = $(top_builddir)/build-wayland-scanner
+build_wayland_scanner_SOURCES = build-scanner.c build-wayland-util.c build-dtddata.S
+build_wayland_scanner_LDADD = -lexpat -lxml2
+build_wayland_scanner_LINK = $(LD_FOR_BUILD) -o $@
+
+build-%.o : build-%.c
+	$(AM_V_CC)$(COMPILE_FOR_BUILD) -I$(top_srcdir)/src -I/usr/include/libxml2 -MT $@ -MD -MP -MF $(DEPDIR)/build-$*.Tpo -c -o $@ $<
+	$(AM_V_at)$(am__mv) $(DEPDIR)/build-$*.Tpo $(DEPDIR)/build-$*.Po
+
+build-%.o : build-%.S
+	$(AM_V_CPPAS)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+	$(AM_V_CPPAS)$(COMPILE_FOR_BUILD) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+	$(am__mv) $$depbase.Tpo $$depbase.Po
+
+
 protocol/%-protocol.c : $(top_srcdir)/protocol/%.xml
-	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@
+	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(build_wayland_scanner) code < $< > $@
 
 protocol/%-server-protocol.h : $(top_srcdir)/protocol/%.xml
-	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header < $< > $@
+	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(build_wayland_scanner) server-header < $< > $@
 
 protocol/%-client-protocol.h : $(top_srcdir)/protocol/%.xml
-	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@
+	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(build_wayland_scanner) client-header < $< > $@
 
 protocol/%-server-protocol-core.h : $(top_srcdir)/protocol/%.xml
-	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header -c < $< > $@
+	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(build_wayland_scanner) server-header -c < $< > $@
 
 protocol/%-client-protocol-core.h : $(top_srcdir)/protocol/%.xml
-	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header -c < $< > $@
+	$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(build_wayland_scanner) client-header -c < $< > $@
 
 BUILT_SOURCES =					\
 	$(nodist_libwayland_server_la_SOURCES)	\
@@ -168,7 +196,7 @@
 	exec-fd-leak-checker
 
 noinst_PROGRAMS =				\
-	fixed-benchmark
+	fixed-benchmark build-wayland-scanner
 
 check_LTLIBRARIES = libtest-runner.la
 
_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to