The Motif package contains a user interface component toolkit and multiple accompanying tools.
Required patchset: https://dev.gentoo.org/~ulm/distfiles/motif-2.3.8-patches-5.tar.xz
byacc-20260126, libjpeg-turbo, libpng, libXp-1.0.4, xbitmaps, and Xorg Libraries
At first, unpack the patch tarball:
tar -xvf ../motif-2.3.8-patches-5.tar.xz
Now, apply the various patches from the tarball:
patch -Np1 -i patch/01_all_solaris.patch && patch -Np1 -i patch/02_all_sanitise-paths.patch && patch -Np1 -i patch/03_all_solaris-11.patch && patch -Np1 -i patch/04_all_parallel-make.patch && patch -Np1 -i patch/05_all_install-dirs.patch && patch -Np1 -i patch/06_all_cflags.patch && patch -Np1 -i patch/07_all_no-demos.patch && patch -Np1 -i patch/08_all_xmbind-xorg.patch && patch -Np1 -i patch/09_all_slibtool.patch && patch -Np1 -i patch/10_all_string_h.patch && patch -Np1 -i patch/11_all_acinclude.patch && patch -Np1 -i patch/12_all_noreturn.patch && patch -Np1 -i patch/13_all_xpm-comments.patch && patch -Np1 -i patch/14_all_xpm-width-0.patch
Then, remove stray autogenerated files to ensure a successful build:
rm -rvf tools/wml/{wmllex,wmluiltok}.c
Now, regenerate the configure scripts:
touch AUTHORS NEWS && autoreconf -fiv -I.
Set multiple environment variables to ensure a working build:
export OLDLANG=$LANG && export LANG=C && export LEX=flex && export YACC=byacc
Now, install Motif by running the following commands:
sed -i '1 i\%option main' tools/wml/wmluiltok.l &&
CFLAGS+=" -std=gnu17" \
CXXFLAGS+=" -std=gnu17" \
./configure --prefix=/usr \
--with-x \
--disable-static \
--enable-utf8 \
--enable-xft \
--enable-jpeg \
--enable-png \
--enable-motif22-compatibility &&
make
Now, as the root user:
make install && make -C demos install-data
Still as the root user, move the
demos into the correct location:
rm -rvf /usr/share/doc/motif-2.3.8/demos && install -vdm755 /usr/share/doc/motif-2.3.8/demos && mv -v /usr/share/Xm/* /usr/share/doc/motif-2.3.8/demos && rmdir -v /usr/share/Xm
Still as the root user, install
some auxiliary files:
install -vDm644 /dev/stdin /usr/share/X11/app-defaults/Mwm << "EOF"Mwm*fontList: variable Mwm*iconClick: False Mwm*iconPlacement: top left Mwm*moveOpaque: True Mwm*rootButtonClick: True Mwm*foreground: #000000 Mwm*background: #B8B8C0 Mwm*enableThinThickness: True Mwm*enableEtchedInMenu: True Mwm*menu*fontList: -adobe-helvetica-medium-r-*--*-120-*-*-*-*-*-* Mwm*client*title*fontList: -adobe-helvetica-bold-r-*--*-100-*-*-*-*-*-* Mwm*icon*fontList: -adobe-helvetica-bold-r-*--*-80-*-*-*-*-*-* Mwm*feedback*fontList: -adobe-helvetica-bold-r-*--*-100-*-*-*-*-*-* Mwm*multiClickTime: 300 Mwm*useIconBox: TrueEOF install -vDm644 /dev/stdin /usr/share/xsessions/mwm.desktop << "EOF"[Desktop Entry] Name=MWM Comment=The Motif Window Manager Exec=/usr/bin/mwm TryExec=/usr/bin/mwm Type=ApplicationEOF
The above install
command(s) need some explanation. Typically in the books when
configuration files get created, cat is used. It uses a Bash
feature called “heredoc” which takes optionally multiple
lines of input until a given term, and forwards it to something.
In the cat command,
heredoc is used to feed into /dev/stdin, and cat writes from /dev/stdin to the specified file.
As for install, its
use is more in-depth and has a lot more going on. In premise, it
is doing the same thing as the cat commands. It heredocs to
/dev/stdin and is forwarded to a
file; install does
the writing. In a more straightforward way, it copies
/dev/stdin to the specified file,
which was filled by the heredoc. It has been used over
cat so that the
permissions can be set and the directory the file needs to be in
will be created in the process.
Finally, unset the environment variables previously set:
export LANG=$OLDLANG && unset OLDLANG && unset LEX && unset YACC
C{,XX}FLAGS='std=gnu17': These variables
ensure this package properly builds as C23 is now the default in
GCC-15.x.x.