Please see these as examples only. The session creation is only a guess! It does work for me, but that does not mean it is correct. It could make your drink warm, make your pet look at you funny, or make your computer explode.
jwm.spec
%define name jwm
%define version 500
%define release %mkrel 1
Summary: JWM is a window manager for the X11 Window System.
Name: %{name}
Version: %{version}
Release: %{release}
Source: %{name}-%{version}.tar.bz2
License: GPL2
Group: Graphical desktop/JWM
URL: http://www.joewing.net/programs/jwm/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
# where is Xlib
# BuildRequires: Xlib
%description
JWM is a window manager for the X11 Window System.
JWM is written in C and uses only Xlib at a minimum.
The following libraries can also be used if available:
libfribidi for bi-directional text support.
libjpeg for JPEG icons and backgrounds.
libpng for PNG icons and backgrounds.
libXext for the shape extension.
libXext for the render extension.
libXmu for rounded corners.
libxft for antialiased and true type fonts.
libXinerama for multiple head support.
libXpm for XPM icons and backgrounds
%prep
%setup -q
# seems to be fixed as of version 500
# for version 498
#cd src
#perl -pi -e "s,# include <fribidi/fribidi_char_sets.h>,# include <fribidi/fribidi-char-sets.h>,g" jwm.h
#cd -
%build
%configure2_5x
%make
%install
[ "$RPM_BUILD_ROOT" != "$HOME" ] && rm -rf $RPM_BUILD_ROOT
# Install with leading dirs and must end with a filename.
install -D -m 644 example.jwmrc %{buildroot}%{_sysconfdir}/system.jwmrc
install -D -m 644 jwm.1 %{buildroot}%{_mandir}/man1/jwm.1
install -D src/jwm %{buildroot}%{_bindir}/jwm
install -D -m 644 src/x.xpm %{buildroot}%{_datadir}/icons/x.xpm
# wmsession support
mkdir -p $RPM_BUILD_ROOT/etc/X11/wmsession.d/
cat << EOF > $RPM_BUILD_ROOT/etc/X11/wmsession.d/18JWM
NAME=JWM
ICON=x.xpm
EXEC=/usr/bin/jwm
DESC=Jwm window manager
SCRIPT:
exec /usr/bin/jwm
EOF
%clean
[ "$RPM_BUILD_ROOT" != "$HOME" ] && rm -rf $RPM_BUILD_ROOT
%post
%{make_session}
%postun
%{make_session}
%files
%defattr(-,root,root)
%doc README
%config(noreplace) /etc/X11/wmsession.d/18JWM
%{_sysconfdir}/system.jwmrc
%{_bindir}/jwm
%{_mandir}/man1/jwm.1*
%{_datadir}/icons/x.xpm
%changelog
* Wed Feb 16 2011 My Name <myemail@example.com> 500-1
- latest
- fribidi patch seems fixed upstream