1 # Manually Building X and Beyond
3 The following are notes on manually building latest git-hosted X.org on development DragonFly BSD.
5 We try something **ill-advised**, we build a separate version of X.org in another directory, say */opt/xbeta*,
6 on the same machine where we have installed the latext pkgsrc. We build a newer, separate, X.org so that
7 we can test newer graphics hardware such as a Radeon HD4550 (r600), but we keep the older pkgsrc X.org
8 because we like to use our faster test machine both for development and as our day-to-day workstation.
10 The risk is that it is very easy to link into the new test libraries the wrong libraries from pkgsrc.
14 The following notes describe alterations to one's system that may leave the graphical user interface based
15 on X.org unusable. Use at one's own risk, and we certainly provide no warranty and make no guarantee of
16 fitness. Because the risk of damaging one's system is so great and because there are other sites such
17 as <http://www.x.org/wiki/ModularDevelopersGuide> that do provide build scripts, we do not provide
20 Despite the above warnings, the purpose of building a separate X.org in a separate directory is
21 to hopefully limit possible damage.
23 ## Notes on pkgsrc and interactions with DragonFly BSD
25 ### GNU m4 1.4.14 and bison 2.4.2
27 Some packages have a bug where POSIX spawn definitions are incorrectly redefined for
28 DragonFly BSD, so that forking subprocesses is broken.
30 Patch both *devel/m4* and *devel/bison* using the patch idea from:
31 <http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=43098>
33 Unfortunately the problems are in the *work* directories so that one needs the knowledge from
34 <http://www.netbsd.org/docs/pkgsrc/components.html>
35 to even get the patches to be applied.
37 Install *pkgtools/pkgdiff* for easier development of patches to pkgsrc work directories.
39 ### gstreamer 0.10 and a 128-bit division bug on gcc 4.1.2 for x86_64
41 The combination of gcc 4.1.2 on DragonFlyBSD for x86_64 (amd64) appears to have
42 a bug where 128-bit integer division is mistakenly optimized to internal
43 functions that do not exist, causing link errors. The current workaround is
44 to either specify the alternate base gcc 4.4 compiler using
46 or to manually patch the offending source code to ignore autoconf checks for
47 types such as *uint128_t* or *__uint128_t*.
49 As of 2010-05-09, we find it necessary on x86_64 to use the following patch for
50 pkgsrc gstreamer0.10, an eventual dependency of the full xfce desktop:
52 --- pkgsrc/multimedia/gstreamer0.10/Makefile.orig 2010-03-29 16:04:23 -0700
53 +++ pkgsrc/multimedia/gstreamer0.10/Makefile 2010-03-29 16:09:04 -0700
56 .include "../../mk/bsd.prefs.mk"
58 +# __udivti3 error otherwise
59 +.if ${OPSYS} == "DragonFly" && ${MACHINE_ARCH} == "x86_64"
60 +MAKEFLAGS+= CCVER=gcc44
63 .if ${OPSYS} == "NetBSD"
64 # We must have a glib2 compiled with the RTLD_GLOBAL fix; if not, plugins
67 See for example the following bug report for more details:
68 <http://mail-index.netbsd.org/pkgsrc-bugs/2010/03/30/msg037304.html>
70 ## Manually building new X.org
74 We start with installing into */opt/xbeta* [expat 2.0.1](http://sourceforge.net/projects/expat/)
75 and [gettext 0.17](http://www.gnu.org/software/gettext/).
77 ### Git repository for most of X.org
79 We use the following listing:
81 [freedesktop.org git repository browser](http://cgit.freedesktop.org/)
83 One can easily script getting, updating, and building the projects listed on that page.
85 ### Example of using ldd
89 libc.so.7 => /usr/lib/libc.so.7 (0x800640000)
92 libc.so.7 => /usr/lib/libc.so.7 (0x800640000)
94 ### libxcb problem with Python 2.6 cElementTree
96 Library *xcb/libxcb* unfortunately needs to be built early and there is a catch for
97 using pkgsrc Python 2.6. Unfortunately at the current time not all of
98 *cElementTree* appears to be functional; therefore, one needs a patch similar to
100 diff --git a/src/c_client.py b/src/c_client.py
101 index d86d05e..36a7039 100755
102 --- a/src/c_client.py
103 +++ b/src/c_client.py
105 #!/usr/bin/env python
106 -from xml.etree.cElementTree import *
107 +from xml.etree.ElementTree import *
108 from os.path import basename
112 As of May 20, 2010, the situation for libxcb seems to be more complicated. The latest *xcb/proto* needs
113 to be installed. If one does not wish to install on top of one's current Python modules,
116 export PYTHONPATH=${PREFIX}/lib/python2.6/site-packages
118 and apply a patch similar to below to change from using Python 2.6's *cElementTree* to *ElementTree*
120 diff --git a/xcbgen/matcher.py b/xcbgen/matcher.py
121 index e7958fa..16e8273 100644
122 --- a/xcbgen/matcher.py
123 +++ b/xcbgen/matcher.py
124 @@ -7,7 +7,7 @@ we do not create a new type object, we just record the existing one under a new
127 from os.path import join
128 -from xml.etree.cElementTree import parse
129 +from xml.etree.ElementTree import parse
133 diff --git a/xcbgen/state.py b/xcbgen/state.py
134 index 51efc94..e72dc3e 100644
135 --- a/xcbgen/state.py
136 +++ b/xcbgen/state.py
138 This module contains the namespace class and the singleton module class.
140 from os.path import dirname, basename
141 -from xml.etree.cElementTree import parse
142 +from xml.etree.ElementTree import parse
150 /usr/libexec/binutils217/elf/ld: .libs/extutil.o: relocation R_X86_64_PC32 against `xgeExtRegister' can not be used when making a shared object; recompile with -fPIC
151 /usr/libexec/binutils217/elf/ld: final link failed: Bad value
153 Use the following patch from <http://lists.x.org/archives/xorg-devel/2009-November/003724.html>
155 diff --git a/src/Xge.c b/src/Xge.c
156 index 7a583e5..2ea5d27 100644
159 @@ -294,7 +294,7 @@ _xgeEventToWire(Display* dpy, XEvent* re, xEvent* event)
161 * Extensions need to register callbacks for their events.
165 xgeExtRegister(Display* dpy, int offset, XExtensionHooks* callbacks)
171 We install [FreeType 2.3.12](http://www.freetype.org/). It appears that *GNUMAKE=gmake* is required.
172 Most of the X.org projects use *autogen.sh*, but here we use a standard call to *configure* somewhat
175 export ACLOCAL="aclocal -I ${PREFIX}/share/aclocal"
176 export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
177 GNUMAKE=gmake ./configure --prefix=${PREFIX} CPPFLAGS="-I${PREFIX}/include -I${PREFIX}/X11/include" LDFLAGS="-L${PREFIX}/lib -Wl,-rpath -Wl,${PREFIX}/lib -L${PREFIX}/X11/lib -Wl,-rpath -Wl,${PREFIX}/lib/X11"
179 where *$PREFIX* is where we install X.org, say */opt/xbeta*,
180 the first two exports of *ACLOCAL* and *PKG_CONFIG_PATH* occur for most X.org projects,
181 *CPPFLAGS* and *LDFLAGS* ensure that the *$PREFIX* include directories and library paths
182 are used, and *-Wl,-rpath ...* is an incantation that ensures that previous built
183 *libtool* libraries can be used.
187 *autogen.sh* script seems to build easier with
193 As of 2010-05-09, known problem with GNU m4 pkgsrc on DragonFly
195 /usr/pkg/bin/gm4: m4_esyscmd subprocess failed: Operation not permitted
196 /usr/pkg/bin/gm4:configure.ac:8: cannot run command `${MAKE-make} -s -f bin/version.mk version | tr -d '\n'': Operation not permitted
197 configure.ac:8: error: Failed to get the Mesa version from `make -f bin/version.mk version`
199 At one time we patched mesa configure to substitute in the version; however,
200 we now believe it is better to patch pkgsrc GNU m4 as described above.
202 #### C99 fpclassify()
204 At one time a patch similar to below was required, but now it appears to have
205 been patched in the upstream source. *fpclassify()* is a function introduced
206 in C99. Detecting reliably which features of C99 are supported is always an
207 adventure because few OSes if any implement all of this standard.
209 diff --git a/src/mesa/main/querymatrix.c b/src/mesa/main/querymatrix.c
210 index ca292aa..a0969f6 100644
211 --- a/src/mesa/main/querymatrix.c
212 +++ b/src/mesa/main/querymatrix.c
213 @@ -71,7 +71,7 @@ fpclassify(double x)
216 #elif defined(__APPLE__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \
217 - (defined(__sun) && defined(__C99FEATURES__))
218 + defined(__DragonFly__) || (defined(__sun) && defined(__C99FEATURES__))
220 /* fpclassify is available. */
224 If one uses the patches alluded to in the pkgsrc section, one can avoid the following build error:
227 bison: m4 subprocess failed: Operation not permitted
228 gmake[3]: *** [parser.c] Error 1
230 Developer documentation appears to now be enabled by default; therefore, if one is bootstrapping
231 a new tree, one might want to use the option to *autogen.sh* to not build developer documentation:
233 I experienced the following build error:
236 No way to convert HTML to text found.
238 Corrected using the *autogen.sh* flag:
244 diff --git a/xinit.c b/xinit.c
245 index 313806e..0d31637 100644
248 @@ -48,6 +48,12 @@ in this Software without prior written authorization from The Open Group.
252 +/* For PRIO_PROCESS and setpriority() */
253 +#ifdef __DragonFly__
254 +#include <sys/time.h>
255 +#include <sys/resource.h>
256 +#endif /* __DragonFly__ */
262 ## Building a Separate Version of GNOME
266 See the bug report at <https://bugzilla.gnome.org/show_bug.cgi?id=618754> for an error similar to
268 /usr/libexec/binutils217/elf/ld: .libs/gthread.o: relocation R_X86_64_PC32
269 against `_g_mem_thread_init_noprivate_nomessage' can not be used when making a
270 shared object; recompile with -fPIC
271 /usr/libexec/binutils217/elf/ld: final link failed: Bad value
273 This bug is especially a problem because it may be related to some interaction with gcc 4.1.2 only on DragonFly.
275 The following patch is a complete hack:
277 diff --git a/configure.in b/configure.in
278 index 38288c3..51a1c07 100644
281 @@ -3033,7 +3033,7 @@ _______EOF
282 #define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
283 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
284 #define G_GNUC_INTERNAL __hidden
285 -#elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY)
286 +#elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY) && !defined(__DragonFly__)
287 #define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
289 #define G_GNUC_INTERNAL
291 ### Graphics Image Formats
293 *libpng* <http://www.libpng.org/pub/png/libpng.html> version *1.4.2*
294 can be installed using *autogen.sh* and then *configure*, in contrast to
295 the X.org projects that pass parameters from *autogen.sh* to run *configure* automatically.
297 Independent JPEG Group's library <http://www.ijg.org/> version *8b* can be installed
298 using *configure* alone (there is no autogen.sh).
300 LibTIFF <http://www.remotesensing.org/libtiff/> has a recommended dependency on jpeg.
301 LibTIFF version 3.9.2 can be installed using *autogen.sh* and then *configure*.
305 after building any of the above three projects appears to produce passes tests.
311 *autogen.sh* calls *configure*
313 11 tests fail after *gmake check*
319 export LDFLAGS="-L${PREFIX}/lib -Wl,-rpath -Wl,${PREFIX}/lib -L${PREFIX}/lib/X11 -Wl,-rpath -Wl,${PREFIX}/lib/X11"
320 export CPPFLAGS="-I${PREFIX}/include -I${PREFIX}/X11/include"
322 When using gcc 4.1.2, *gmake check* gives:
325 ./.libs/libcairo.so: undefined reference to `__umodti3'
326 ./.libs/libcairo.so: undefined reference to `__udivti3'
328 When using *CCVER=gcc44* to force gcc 4.4, one obtains the worse:
331 cc1: error: unrecognized command line option "-Wlogical-op"
332 CHECK cairo-deprecated.h
333 cc1: error: unrecognized command line option "-Wlogical-op"
336 The problem is 128-bit division using gcc 4.1.2 as discussed earlier. One can examine
337 *src/cairo-wideint.c* and see the telltale code enclosed in an if test for *HAVE_UINT128_T*
338 with 128-bit division if defined.
342 Install *gnome-common* first, required.
344 If Cairo is not built with *CCVER=gcc44*, obtain build error similar to
347 /opt/xcatch/lib/libcairo.so: undefined reference to `__umodti3'
348 /opt/xcatch/lib/libcairo.so: undefined reference to `__udivti3'
349 gmake[3]: *** [pango-view] Error 1
351 Following patch corrects an API change not propagated to the test for *gmake check*
352 <https://bugzilla.gnome.org/show_bug.cgi?id=619456>
354 Not including patch itself because there are tabs. But edit file *pango/pangoft2.def*
356 pango_fc_font_create_metrics_for_context
358 pango_fc_font_create_base_metrics_for_context
360 ### GObject Introspection
362 *cElementTree* is changed to *ElementTree* in files
363 *giscanner/girparser.py*, *giscanner/glibtransformer.py*, and *giscanner/scannermain.py*.
365 Using *pkg_alternatives* for a python wrapper fails as a script is generated with
367 #! /usr/pkg/bin/python
372 A shell script cannot use another shell script as its interpreter.
373 What works for now is to manually create */usr/pkg/bin/python* as a symlink to */usr/pkg/bin/python2.6*.
377 *gobject-introspection* is listed as a dependency but can be avoided.
378 Use option *--disable-introspection* to avoid an error
380 checking for gobject-introspection... yes
381 ./configure: ${INTROSPECTION_GIRDIR/...}: Bad substitution