# Manually Building X and Beyond
+The following are notes on manually building latest git-hosted X.org on development DragonFly BSD.
+
We try something **ill-advised**, we build a separate version of X.org in another directory, say */opt/xbeta*,
-on the same machine where we have installed the latext pkgsrc. We do this because we have no choice but to
-use the graphics hardware on this machine, but the risk is that it is very easy to link the wrong libraries
-from pkgsrc.
+on the same machine where we have installed the latext pkgsrc. We build a newer, separate, X.org so that
+we can test newer graphics hardware such as a Radeon HD4550 (r600), but we keep the older pkgsrc X.org
+because we like to use our faster test machine both for development and as our day-to-day workstation.
+
+The risk is that it is very easy to link into the new test libraries the wrong libraries from pkgsrc.
## Disclaimer
The following notes describe alterations to one's system that may leave the graphical user interface based
-on X.org unusable. Use at one's own risk. Because the risk of damaging one's system is so great, I refuse
-to provide ready-to-run scripts.
+on X.org unusable. Use at one's own risk, and we certainly provide no warranty and make no guarantee of
+fitness. Because the risk of damaging one's system is so great and because there are other sites such
+as <http://www.x.org/wiki/ModularDevelopersGuide> that do provide build scripts, we do not provide
+ready-to-run scripts.
+
+Despite the above warnings, the purpose of building a separate X.org in a separate directory is
+to hopefully limit possible damage.
-## Installing from pkgsrc
+## Notes on pkgsrc and interactions with DragonFly BSD
### GNU m4 1.4.14 and bison 2.4.2
+Some packages have a bug where POSIX spawn definitions are incorrectly redefined for
+DragonFly BSD, so that forking subprocesses is broken.
+
Patch both *devel/m4* and *devel/bison* using the patch idea from:
<http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=43098>
<http://www.netbsd.org/docs/pkgsrc/components.html>
to even get the patches to be applied.
-Install *pkgtools/pkgdiff*.
+Install *pkgtools/pkgdiff* for easier development of patches to pkgsrc work directories.
+
+### gstreamer 0.10 and a 128-bit division bug on gcc 4.1.2 for x86_64
-### gstreamer 0.10
+The combination of gcc 4.1.2 on DragonFlyBSD for x86_64 (amd64) appears to have
+a bug where 128-bit integer division is mistakenly optimized to internal
+functions that do not exist, causing link errors. The current workaround is
+to either specify the alternate base gcc 4.4 compiler using
+ CCVER=gcc44
+or to manually patch the offending source code to ignore autoconf checks for
+types such as *uint128_t* or *__uint128_t*.
-As of 2010-05-09, I find it necessary on x86_64 to use the following patch for
+As of 2010-05-09, we find it necessary on x86_64 to use the following patch for
pkgsrc gstreamer0.10, an eventual dependency of the full xfce desktop:
--- pkgsrc/multimedia/gstreamer0.10/Makefile.orig 2010-03-29 16:04:23 -0700
See for example the following bug report for more details:
<http://mail-index.netbsd.org/pkgsrc-bugs/2010/03/30/msg037304.html>
+## Manually building new X.org
+
### expat and gettext
We start with installing into */opt/xbeta* [expat 2.0.1](http://sourceforge.net/projects/expat/)
/usr/pkg/bin/gm4:configure.ac:8: cannot run command `${MAKE-make} -s -f bin/version.mk version | tr -d '\n'': Operation not permitted
configure.ac:8: error: Failed to get the Mesa version from `make -f bin/version.mk version`
-For now just manually run command
- $ make -f bin/version.mk version
- 7.9.0
-and substitute it using a patch similar to
-
- diff --git a/configure.ac b/configure.ac
- index c40c842..224a858 100644
- --- a/configure.ac
- +++ b/configure.ac
- @@ -4,7 +4,7 @@ AC_PREREQ([2.59])
-
- dnl Versioning - scrape the version from configs/default
- m4_define([mesa_version],
- - [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n'])])
- + [7.9.0])])
- m4_ifval(mesa_version,,
- [m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])])
+At one time we patched mesa configure to substitute in the version; however,
+we now believe it is better to patch pkgsrc GNU m4 as described above.
#### C99 fpclassify()
+At one time a patch similar to below was required, but now it appears to have
+been patched in the upstream source. *fpclassify()* is a function introduced
+in C99. Detecting reliably which features of C99 are supported is always an
+adventure because few OSes if any implement all of this standard.
+
diff --git a/src/mesa/main/querymatrix.c b/src/mesa/main/querymatrix.c
index ca292aa..a0969f6 100644
--- a/src/mesa/main/querymatrix.c