Bug 90328

Summary: util-errors: out of tree builds do not work
Product: XCB Reporter: Daphne Pfister <daphnediane>
Component: UtilsAssignee: xcb mailing list dummy <xcb>
Status: RESOLVED FIXED QA Contact: xcb mailing list dummy <xcb>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Daphne Pfister 2015-05-05 21:44:09 UTC
Attempting to build util-errors using an out of tree build process fails as it tries to run src/extensions.py from the build directory instead of the source directory.

I assume it should be something like:

index 746cde3..08bcf7b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,5 +36,5 @@ tests_test_LDADD = libxcb-errors.la $(XCB_LIBS)
 CLEANFILES = src/extensions.c

 src/extensions.c: src/extensions.py
-       $(AM_V_GEN)src/extensions.py $@.tmp ${XCBPROTO_XCBINCLUDEDIR}/*.xml && \
+       $(AM_V_GEN)$(srcdir)/src/extensions.py $@.tmp ${XCBPROTO_XCBINCLUDEDIR}/*.xml && \
        mv $@.tmp $@

Or better yet it configure search for python similar to how libxcb does and then run something like:
$(AM_V_GEN)$(PYTHON) $(srcdir)/src/extensions.py
Comment 1 Uli Schlachter 2015-05-06 06:19:00 UTC
commit 5d660ebe872cadcdc85de9d6f9afe05de629c030
Author: Uli Schlachter <psychon@znc.in>
Date:   Wed May 6 08:10:53 2015 +0200

    Do not distribute extensions.c and fix out-of-tree builds
    
    It all started with src/extensions.c being distributed. Thanks to this, tarballs
    shipped with this generated file and actually building this file was skipped.
    Fix this by using the nodist_ variant of the SOURCES variable.
    
    Due to this oversight (sorry!), the out-of-tree build wasn't actually tested.
    The rule that generates src/extensions.c was missing $(srcdir) in front of the
    path to extensions.py. This rule is now fixed and, as suggested by Daphne
    Pfister, also changed to explicitly call the python interpreter. Configure is
    changed to look for it.
    
    Finally, extensions.c couldn't include errors.h. This worked before, because the
    C compiler automatically looks for headers in the same directory as the source
    file. However, for out-of-tree builds, the source directory and build directory
    are different. Paper over this problem by explicitly making it look in the right
    directory.
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=90328
    Signed-off-by: Uli Schlachter <psychon@znc.in>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.