6.6 Using X11

6.6.1 Variable definitions

Table 6-4. Variables for ports that use X

USE_X_PREFIX The port installs in X11BASE, not PREFIX.
USE_XLIB The port uses the X libraries.
USE_MOTIF The port uses the Motif toolkit. Implies USE_XPM.
USE_IMAKE The port uses imake. Implies USE_X_PREFIX.
XMKMF Set to the path of xmkmf if not in the PATH. Defaults to xmkmf -a.

Table 6-5. Variables for depending on individual parts of X11

X_IMAKE_PORT Port providing imake and several other utilities used to build X11.
X_LIBRARIES_PORT Port providing X11 libraries.
X_CLIENTS_PORT Port providing X clients.
X_SERVER_PORT Port providing X server.
X_FONTSERVER_PORT Port providing font server.
X_PRINTSERVER_PORT Port providing print server.
X_VFBSERVER_PORT Port providing virtual framebuffer server.
X_NESTSERVER_PORT Port providing a nested X server.
X_FONTS_ENCODINGS_PORT Port providing encodings for fonts.
X_FONTS_MISC_PORT Port providing miscellaneous bitmap fonts.
X_FONTS_100DPI_PORT Port providing 100dpi bitmap fonts.
X_FONTS_75DPI_PORT Port providing 75dpi bitmap fonts.
X_FONTS_CYRILLIC_PORT Port providing cyrillic bitmap fonts.
X_FONTS_TTF_PORT Port providing TrueType® fonts.
X_FONTS_TYPE1_PORT Port providing Type1 fonts.
X_MANUALS_PORT Port providing developer oriented manual pages

Example 6-1. Using X11 related variables in port

# Use X11 libraries and depend on
# font server as well as cyrillic fonts.
RUN_DEPENDS=   ${X11BASE}/bin/xfs:${X_FONTSERVER_PORT} \
               ${X11BASE}/lib/X11/fonts/cyrillic/crox1c.pcf.gz:${X_FONTS_CYRILLIC_PORT}

USE_XLIB=      yes

6.6.2 Ports that require Motif

If your port requires a Motif library, define USE_MOTIF in the Makefile. Default Motif implementation is x11-toolkits/open-motif. Users can choose x11-toolkits/lesstif instead by setting WANT_LESSTIF variable.

The MOTIFLIB variable will be set by bsd.port.mk to reference the appropriate Motif library. Please patch the source of your port to use ${MOTIFLIB} wherever the Motif library is referenced in the original Makefile or Imakefile.

There are two common cases:

Note that MOTIFLIB (usually) expands to -L/usr/X11R6/lib -lXm or /usr/X11R6/lib/libXm.a, so there is no need to add -L or -l in front.

6.6.3 X11 fonts

If your port installs fonts for the X Window System, put them in X11BASE/lib/X11/fonts/local.

6.6.4 Getting fake DISPLAY using Xvfb

Some applications require a working X11 display for compilation to succeed. This pose a problem for the FreeBSD package building cluster, which operates headless. When the following canonical hack is used, the package cluster will start the virtual framebuffer X server. The working DISPLAY is then passed to the build.

.if defined(PACKAGE_BUILDING)
BUILD_DEPENDS+= Xvfb:${X_VFBSERVER_PORT} \
                ${X11BASE}/lib/X11/fonts/misc/8x13O.pcf.gz:${X_FONTS_MISC_PORT}
.endif

6.6.5 Desktop entries

Desktop Entries (Freedesktop standard) can be easily created in your port using DESKTOP_ENTRIES variable. These entries do show up in application menus of compliant desktop environments like GNOME or KDE. The .desktop file will be created, installed, and added to the pkg-plist automatically. Syntax is:

DESKTOP_ENTRIES=  "NAME" "COMMENT" "ICON" "COMMAND" "CATEGORY" StartupNotify

List of possible categories is available on Freedesktop website. The StartupNotify indicates, if the application will clear the status in startup notification aware environment.

Example:

DESKTOP_ENTRIES=  "ToME" "Roguelike game based on JRR Tolkien's work" \
                  "${DATADIR}/xtra/graf/tome-128.png" \
                  "tome -v -g" "Application;Game;RolePlaying" \
                  false
For questions about the FreeBSD ports system, e-mail <[email protected]>.
For questions about this documentation, e-mail <[email protected]>.