#!/bin/sh # Build script for motif / OpenMotif 2.3.8 (autotools, Template A). # Older codebase - config.sub/libtool/__EXTENSIONS__ gotchas expected. # CORRECTION (2026-07-23): motif's own configure.ac only references its # in-tree bitmaps/Makefile, but lib/Xm/I18List.c has a *hardcoded* # `#include ` - a real X.Org bitmap from the standalone # xbitmaps package, NOT one of motif's own bitmaps/. Needs base/xbitmaps # built+installed to $PREFIX/include first (see zports base/xbitmaps). set -e # Resolve the port dir (holds patches/) BEFORE cd'ing into the extracted source. PORTDIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) cd "$SRCDIR" # MANDATORY libtool fix - see Template A (confirmed 4 kopensolaris hits # in this configure). if [ -f configure ]; then sed -i -E 's/(kopensolaris\*-gnu)([^)]*\))/\1 | hammerhead*\2/' configure fi # GOTCHA: lib/Xm/Xmfuncs.h #defines bcopy/bzero/bcmp as function-like # macros (for pre-ANSI systems) BEFORE illumos's X11/Xos.h later does its # own (normally-safe, guarded) `#include `. Since strings.h # hasn't been seen yet at that point, its `extern int bcmp(const void *, # ...)` etc. prototypes get macro-substituted into invalid syntax # ("expected declaration specifiers ... before '(' token"). Fixed by # patching Xmfuncs.h to pull in itself before defining the # macros, so strings.h's own include guard makes Xos.h's later include a # no-op. See patches/0001-xmfuncs-strings-h-macro-mangling.patch. for p in "$PORTDIR"/patches/*.patch; do [ -f "$p" ] || continue echo "==> Applying patch: $(basename "$p")" patch -p1 < "$p" done # GOTCHA: ResEncod.c casts its iconv() 2nd arg to (char **) - matching # illumos's non-POSIX-conformant iconv(3C) prototype, which /usr/include/ # iconv.h only exposes when _XPG6 is defined (otherwise it exposes the # `const char **` prototype instead, and the explicit (char **) cast in the # old motif source becomes an incompatible-pointer-type error under GCC 14's # now-stricter default). Define _XPG6 to select the signature the existing # cast already expects, rather than patching upstream source. export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH" export CFLAGS="${CFLAGS} -I$PREFIX/include -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS -D_XPG6 -fpermissive -fcommon" export LDFLAGS="${LDFLAGS} -L$PREFIX/lib -R$PREFIX/lib" # GOTCHA: ac_find_xft.m4's Xrender probe does # `XRENDER_LIBS="-L$x_libraries -lXft -lXrender"` unconditionally once # $have_x=yes, with NO fallback if $x_libraries came back empty (which it # does here since AC_PATH_XTRA never needed to search - X11 is already on # the default $PREFIX/lib path) - producing a malformed literal "-L -lXft" # that trips libtool ("require no space between '-L' and '-lXft'"). # Force --x-libraries/--x-includes explicitly so $x_libraries is non-empty. ./configure \ --prefix="$PREFIX" \ --build="$BUILD_TRIPLE" \ --host="$BUILD_TRIPLE" \ --sysconfdir="$SYSCONFDIR" \ --disable-static \ --enable-xft \ --disable-printing \ --x-includes="$PREFIX/include" \ --x-libraries="$PREFIX/lib" gmake -j${JOBS:-1} gmake install DESTDIR="$PKGDIR" # motif (OpenMotif) - X11 widget toolkit, backs the XNEdit editor # https://sourceforge.net/projects/motif/ [package] name = "motif" version = "2.3.8" release = 1 description = "OpenMotif X11 widget toolkit" url = "https://sourceforge.net/projects/motif/" license = "LGPL-2.1-or-later" maintainer = "Chris Tusa " arch = "x86_64" [dependencies] runtime = ["libX11", "libXext", "libXt", "libXft", "libXpm", "freetype"] build = ["libX11", "libXext", "libXt", "libXft", "libXpm", "freetype", "xbitmaps"] [[source]] file = "motif-2.3.8.tar.gz" urls = ["https://downloads.sourceforge.net/project/motif/Motif%202.3.8%20Source%20Code/motif-2.3.8.tar.gz"] checksum = "859b723666eeac7df018209d66045c9853b50b4218cecadb794e2359619ebce7" [build] parallel = true --- a/lib/Xm/Xmfuncs.h +++ b/lib/Xm/Xmfuncs.h @@ -41,6 +41,16 @@ #else #if (__STDC__ && !defined(X_NOT_STDC_ENV) && !defined(sun) && !defined(macII) && !defined(apollo)) || defined(SVR4) || defined(hpux) || defined(_IBMR2) || defined(_SEQUENT_) #include +/* HAMMERHEAD: pull in here, BEFORE bcopy/bzero/bcmp become + * function-like macros below. Otherwise X11/Xos.h's later (guarded, so + * normally a no-op) `#include ` is the FIRST time these + * prototypes are seen, and the macro substitution mangles the illumos + * `extern int bcmp(const void *, const void *, size_t);` declarations + * into invalid syntax ("expected declaration specifiers ... before '(' + * token"). Pre-including here means strings.h's own guard (_STRINGS_H) + * makes X11/Xos.h's later include a safe no-op. + */ +#include #define _XFUNCS_H_INCLUDED_STRING_H #define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len)) #define bzero(b,len) memset(b, 0, (size_t)(len))