Summary: The Open Motif runtime components.
Name: openMotif
Version: 2.3.0
Release: 1%{?_dist_release}
BuildRoot: %{_tmppath}/%{name}-%{version}-root
License: The Open Group Public License
Group: System Environment/Libraries
Source0: ftp://ftp.ics.com/openmotif/2.3/%{version}/openmotif-%{version}.tar.gz
Source1: xmbind
# license at http://www.opengroup.org/openmotif/license/
Source2: OPEN_GROUP_PUBLIC_LICENSE.html
## not build and install demos (modified for cvs20061112)
Patch0: openmotif-2.3.0-20061112-no_demos.patch
## Patch1 is for CVE-2005-3964
Patch1: openMotif-2.2.3-uil_lib.patch
## Patch2 is for xorg7
Patch2: openMotif-2.3.0-rgbtxt.patch
## change mwvrc dir (modified for cvs20061112)
Patch3: openmotif-2.3.0-20061112-mwmrc_dir.patch
## #Patch4 is for xorg7 (modified for cvs20061112)
Patch4: openmotif-2.3.0-20061112-bindings.patch
Patch5: openMotif-2.3.0-no_X11R6.patch
Patch6: openmotif-sentinel.diff
Patch7: openmotif-unaligned.diff

URL: http://www.motifzone.org/
BuildPrereq: xorg-x11-devel xorg-x11-xbitmaps
BuildPrereq: flex byacc automake14
Obsoletes: %{name}-devel < 2.2.2-0vl5
Obsoletes: %{name}-demos
Conflicts: lesstif-clients lesstif-mwm

%description
The base package for the industry standard
user interface toolkit for the X Window
System as enhanced by ICS and others for
better integration with GNOME and KDE desktop
environments.  The base package consists of
the Open Motif runtime components --
shared libraries and mwm (Motif Window Manager).

%package clients
Summary: Open Motif clients
Group: User Interface/X
Obsoletes: lesstif-clients

%description clients
Uil and xmbind.

%package devel
Summary: The Open Motif development libraries and tools.
Group: Development/Libraries
PreReq: %{name} = %{version}-%{release}
Conflicts: lesstif lesstif-devel lesstif-static

%description devel
The development package includes all of the
Open Motif header files, archive libraries,
the UIL (User Interface Language) compiler,
examples and ICS enhancements for greater
integration with GNOME and KDE desktop
environments.

%prep
%setup -q -n openmotif-%{version}
cp -f %{SOURCE2} .
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p0
%patch7 -p0

%build
unset LANG || :
libtoolize --force --automake
aclocal-1.4 -I .
autoconf
autoheader
automake-1.4 --foreign --include-deps --add-missing

%configure  --enable-static

perl -pi -e 's|hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=\"-L\\\$libdir\"|g;' libtool
export LD_LIBRARY_PATH=`pwd`/lib/Mrm/.libs:`pwd`/lib/Xm/.libs
make clean

LANG=C make

%install
rm -rf $RPM_BUILD_ROOT

export LD_LIBRARY_PATH=`pwd`/lib/Mrm/.libs:`pwd`/lib/Xm/.libs
make DESTDIR=$RPM_BUILD_ROOT prefix=%{_prefix} install

mkdir -p $RPM_BUILD_ROOT/etc/X11/xinit/xinitrc.d
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/X11/xinit/xinitrc.d/xmbind.sh

rm -f $RPM_BUILD_ROOT%{_bindir}/mwm
rm -f $RPM_BUILD_ROOT%{_libdir}/X11/system.mwmrc
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/mwm.1*
rm -f $RPM_BUILD_ROOT%{_mandir}/man4/mwmrc.4*
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/X11/mwm/system.mwmrc

rm $RPM_BUILD_ROOT%{_libdir}/*.la

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-, root, root)
%doc BUGREPORT COPYRIGHT.MOTIF LICENSE README RELEASE RELNOTES
%doc OPEN_GROUP_PUBLIC_LICENSE.html
%{_includedir}/X11/bitmaps/*
%{_libdir}/lib*.so.*

%files clients
%defattr(-,root,root)
%doc LICENSE OPEN_GROUP_PUBLIC_LICENSE.html
%{_bindir}/uil
%{_bindir}/xmbind
%{_datadir}/X11/bindings
%{_mandir}/man1/uil.*
%{_mandir}/man1/xmbind.*
%{_sysconfdir}/X11/xinit/xinitrc.d/xmbind.sh

%files devel
%defattr(-, root, root)
%{_includedir}/Mrm
%{_includedir}/Xm
%{_includedir}/uil
%{_libdir}/*.a
%{_libdir}/*.so
%{_mandir}/man3/*
%{_mandir}/man5/*

%changelog
* Tue May 27 2008 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.3.0-1
- new upstream release
- revised patches (from momonga)
- build with xorg-x11-7.3
- update BuildPrereq
- change prefix to /usr
- change mandir to %%{_mandir}
- drop demos

* Wed Aug 23 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.2.3-0vl6
- added Patch2 and 3 for security fix based on RHEL4
  * Wed Mar 29 2006 Thomas Woerner <twoerner@redhat.com> 2.2.3-10.RHEL4.1
  - fixed CVE-2005-3964: libUil buffer overflows (#174814)

* Wed Aug 23 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 2.2.3-0vl5
- fix library path on x86_64
  - add --libdir=%%{prefix}/%%{_lib} to %%configure
  - use %%{prefix}/%%{_lib} instead of %%{prefix}/lib
-
* Thu Mar 17 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 2.2.3-0vl4
- rebuilt

* Sat Dec  4 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.2.3-0vl3
- rebuild for VineSeed

* Fri Dec  3 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.2.3-0vl2
- add patch0 from Fedora Core (CAN-2004-0687-0688)
- add patch1 from Fedora Core (CAN-2004-0914)
- add BuildPrereq: autoconf213 automake14 for patch1

* Thu Jun  3 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.2.3-0vl1
- source upgrade
- add BuildPrereq: flex byacc
- add %%postun -p /sbin/ldconfig
- change configure option
- use %%{prefix} for files section
- sprit example code and demo programs to demos package
- move %%{prefix}/lib/X11/bindings to main package
- make symlink /usr/include/Mrm for %%{prefix}/include/Mrm
- make symlink /usr/include/uil for %%{prefix}/include/uil
- remove %%post devel and %%preun devel

* Wed Apr 14 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.2.2-0vl5
- rebuild with XOrg
- clean up changelog to use (double-percent) everywhere 
- add BuildPrereq: build-essential XOrg-devel
- make symlink /usr/include/Xm for %%{prefix}/include/Xm in %%install
  (not %%post devel section)
- add Obsoletes: %%{name}-devel < 2.2.2-0vl5
- add PreReq: %%{name} = %%{version} to openMotif-devel package

* Sat Jan  4 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.2.2-0vl4
- delete Obsoletes: lines
- add Conflicts: lesstif-clients lesstif-mwm to openMotif package
- add Conflicts: lesstif(-devel, static) to openMotif-devel package

* Fri Jan  3 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.2.2-0vl3
- rebuild without lesstif package installed

* Fri Jan  3 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.2.2-0vl2
- add %%defattr(-, root, root) in %%files section

* Wed Jan  1 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.2.2-0vl1
- build for VineSeed
- cleanup spec
- Obsoletes: lesstif <= 0.91.0-0vl2

* Wed Jan 23 2002 ICS <info@ics.om>
- Switched build system to AutoConf and updated for new openMotif 2.2
- widgets.  

* Wed Aug 30 2000 ICS <info@ics.com> 2.1.30-3_ICS
- Update for the Rev 3 release

* Fri May 19 2000 ICS <info@ics.com> 2.1.bz2.3.bz20-2_ICS
- Significant overhaul for SRPM distribution
