File openmotif.spec of Package openmotif

#
# spec file for package openmotif (Version 2.3.2)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           openmotif
%{expand:%%global _prefix %(pkg-config --variable prefix x11 || echo /usr/X11R6)}
%if "%_prefix" == "/usr/X11R6"
%define _mandir %_prefix/man
%define _datadir %_prefix/lib
%endif
BuildRequires:  bison flex freetype2-devel libjpeg-devel libpng-devel lzma pkgconfig update-desktop-files xorg-x11-devel
Version:        2.3.2
Release:        1
License:        MOTIF LICENSE (http://www.opengroup.org/openmotif/license)
Group:          System/Libraries
AutoReqProv:    on
PreReq:         sed grep
Conflicts:      lestif2
Summary:        Open Motif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Url:            http://www.motifzone.net/
Source:         openmotif-%{version}.tar.lzma
Source1:        mwm.desktop
Source2:        baselibs.conf
Patch:          openmotif-%{version}.diff
Patch1:         warn.patch
Patch3:         strcmp.diff
Patch4:         openmotif-xpm.diff
Patch5:         sentinel.diff
Patch6:         openmotif-uil.diff
Patch7:         openmotif-unaligned.diff
Patch8:         mwm.diff
Patch9:         openmotif-editres.diff
Patch10:        openmotif-libpng14.diff

%description
This is the Open Motif runtime environment.  It includes the Motif
shared libraries.  Open Motif is a freely available version of the well
known Motif user interface toolkit for Open Source operating systems. 
This package was built with the Metro Link sources.



%package libs
License:        MOTIF LICENSE (http://www.opengroup.org/openmotif/license)
Summary:        Open Motif Runtime Libraries
Group:          System/Libraries
AutoReqProv:    on
# bug437293
%ifarch ppc64
Obsoletes:      openmotif-libs-64bit
%endif
#
Provides:       openmotif:/usr/X11R6/%_lib/libXm.so.3

%description libs
This is the Open Motif runtime environment.  It includes the Motif
shared libraries.  Open Motif is a freely available version of the well
known user interface toolkit Motif for Open Source operating systems. 
This package was built with the sources from Metro Link.



%package devel
License:        http://www.opengroup.org/openmotif/license/
Summary:        Include Files and Libraries mandatory for Development.
Group:          Development/Libraries/X11
AutoReqProv:    on
# bug437293
%ifarch ppc64
Obsoletes:      openmotif-devel-64bit
%endif
#
Requires:       openmotif-libs = %{version} xorg-x11-devel zlib-devel libjpeg-devel libpng-devel
Conflicts:      lesstifd lestif2d lesstif-devel
PreReq:         coreutils

%description devel
This is the Open Motif development environment.  It includes the Motif
header files and static libraries, plus the Motif UIL (User Interface
Language) compiler and the manual pages for the Motif widgets and
library functions.



%prep
%setup -q
%patch
%patch1
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9 -p1
%patch10 -p1

%build
autoreconf --force --install
%ifarch %arm
# miscompilation?
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -O1"
%endif
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" YACC=yacc
%configure --disable-static --with-pic
rm -f tools/wml/Uil.[ch] tools/wml/wmlparse.[ch]
# Not parallel safe
make rcdir=/etc/X11

%install
make install DESTDIR="$RPM_BUILD_ROOT" rcdir=/etc/X11
mkdir -p $RPM_BUILD_ROOT%{_datadir}/X11/config
cp config/cf/Motif.rules $RPM_BUILD_ROOT%{_datadir}/X11/config/Motif.rules.openmotif
cp config/cf/Motif.tmpl $RPM_BUILD_ROOT%{_datadir}/X11/config/Motif.tmpl.openmotif
# install kdm/gdm entry
install -m 0755 -d $RPM_BUILD_ROOT/usr/share/xsessions/
install -m 0644 %SOURCE1 $RPM_BUILD_ROOT/usr/share/xsessions/
%suse_update_desktop_file $RPM_BUILD_ROOT/usr/share/xsessions/mwm.desktop
%{__rm} -f %{buildroot}%{_libdir}/*.la

%triggerin devel -- xdevel
# Replace Motif.tmpl and Motif.rules with our versions
MOTIFTMPL="%{_datadir}/X11/config/Motif.tmpl"
[ ! -f $MOTIFTMPL ] || mv -f $MOTIFTMPL $MOTIFTMPL.orig
ln -sf $MOTIFTMPL.openmotif $MOTIFTMPL
MOTIFRULES="%{_datadir}/X11/config/Motif.rules"
[ ! -f $MOTIFRULES ] || mv -f $MOTIFRULES $MOTIFRULES.orig
ln -sf $MOTIFRULES.openmotif $MOTIFRULES
# Set TopLevelProject to Motif in site.def.
SITEDEF="%{_datadir}/X11/config/site.def"
if ! grep "^\#define TopLevelProject Motif" $SITEDEF > /dev/null 2>&1; then
	[ -f $SITEDEF.orig ] || mv -f $SITEDEF $SITEDEF.orig
	sed -e '/^\#ifdef BeforeVendorCF$/a\
\
\#define TopLevelProject Motif\
' < $SITEDEF.orig > $SITEDEF
	chmod a+r $SITEDEF
fi

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig

%postun devel
if [ "$1" = 0 ]; then
    # Restore original versions of Motif.tmpl, Motif.rules, and site.def
    MOTIFTMPL="%{_datadir}/X11/config/Motif.tmpl"
    rm -f $MOTIFTMPL
    [ ! -f $MOTIFTMPL.orig ] || mv -f $MOTIFTMPL.orig $MOTIFTMPL
    MOTIFRULES="%{_datadir}/X11/config/Motif.rules"
    rm -f $MOTIFRULES
    [ ! -f $MOTIFRULES.orig ] || mv -f $MOTIFRULES.orig $MOTIFRULES
    SITEDEF="%{_datadir}/X11/config/site.def"
    [ ! -f $SITEDEF.orig ] || mv -f $SITEDEF.orig $SITEDEF
fi

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-, root, root)
%dir %{_prefix}/include/X11/bitmaps
%{_prefix}/include/X11/bitmaps/xm_*
%{_datadir}/X11/bindings
%{_prefix}/bin/mwm
%{_prefix}/bin/xmbind
%config /etc/X11/system.mwmrc
%{_mandir}/man1/mwm.1.gz
%{_mandir}/man1/xmbind.1.gz
%{_mandir}/man4/*.gz
/usr/share/xsessions/*

%files libs
%defattr(-, root, root)
%{_libdir}/*.so.*

%files devel
%defattr(-, root, root)
%{_prefix}/bin/uil
%{_prefix}/include/Mrm
%{_prefix}/include/uil
%{_prefix}/include/Xm
%{_libdir}/*.so
%{_datadir}/X11/config/Motif.rules.openmotif
%{_datadir}/X11/config/Motif.tmpl.openmotif
%{_mandir}/man1/uil.1.gz
%{_mandir}/man3/*.gz
%{_mandir}/man5/*.gz

%changelog
* Thu Apr  8 2010 pgajdos@suse.cz
- fixed build with libpng14
* Sat Dec 19 2009 bernhard@bwalle.de
- Update to openmotif 2.3.2
  o When we set XmNvisibleItemCount resource available in
    XmComboBox, the widget displays the wrong number of items
  o Added missing 'O' character to UTF8_SUPPORTED macro
  o PanedWindow orientation error
  o paned widget does not work under Fedora Core 2 with openmotif
    2.2.3-4.1
  o XmDropSiteRetrieve frees XRectangles before caller can use them
  o Build system changes.
- Refresh mwm.diff.
* Sat Dec 19 2009 jengelh@medozas.de
- add baselibs.conf as a source
* Thu Apr 30 2009 mseben@suse.cz
- removed deprecated datadir.patch - we don't build demos ,
  added version dependency of openmotif-libs for openmotif-devel
* Wed Mar 18 2009 crrodriguez@suse.de
- fix build, deleting la files in wrong rpm spec section
* Tue Mar  3 2009 crrodriguez@suse.de
- remove static libraries
* Fri Jan  9 2009 schwab@suse.de
- Fix last change.
* Wed Jan  7 2009 olh@suse.de
- obsolete old -XXbit packages (bnc#437293)
* Mon Nov 10 2008 schwab@suse.de
- Remove obsolete changes.
* Thu Oct  9 2008 bwalle@suse.de
- Update to openMotif 2.3.1.
  * Bug fixes, see ftp://ftp.ics.com/openmotif/2.3/2.3.1/RELEASE.
- Drop openmotif-etched-in-menus: Included in release.
- Drop openmotif-insensitive-label.diff: Included in release.
* Tue Apr 22 2008 bwalle@suse.de
- Fix look of etched-in menus (patch from
  http://bugs.motifzone.net/show_bug.cgi?id=1395)
* Sat Apr 12 2008 schwab@suse.de
- Avoid libtool namespace clash.
* Thu Apr 10 2008 ro@suse.de
- added baselibs.conf file to build xxbit packages
  for multilib support
* Fri Nov 16 2007 bwalle@suse.de
- Fix configure warnings when checking for X11/Xmu/Editres.h.
- Fix problem that insensitive labels in buttons/menus are
  represented by a gray box (fix from upstream CVS).
* Tue Jul 24 2007 aj@suse.de
- Remove unneeded build require on xorg-x11.
* Mon Jul 23 2007 schwab@suse.de
- Fix location of system.mwmrc [#287207].
* Mon Jul 16 2007 schwab@suse.de
- Update to openMotif 2.3.0.
  * Client-side anti-aliased fonts support via XFT
  * UTF-8 and UTF8_STRING atom support
  * Ability to show text and pixmaps in Label, LabelGadget and all
    derived widgets
  * Support of PNG and JPEG image formats in the same way as XPM is supported
  * 26 bugs fixes
* Thu Apr  5 2007 schwab@suse.de
- Remove redundant compares.
* Tue Apr  3 2007 schwab@suse.de
- Add libpng-devel and libjpeg-devel to BuildRequires.
* Thu Mar 29 2007 rguenther@suse.de
- add flex BuildRequires.
* Sat Mar  3 2007 aj@suse.de
- /usr/share/xsessions is part of filesystems package now.
* Wed Jan 17 2007 schwab@suse.de
- Fix string compare.
* Fri Oct 13 2006 schwab@suse.de
- Fix XPM plausibility checks.
* Thu Aug 17 2006 schwab@suse.de
- Fix broken alignment.
* Wed Aug 16 2006 aj@suse.de
- Remove unneeded BuildRequire xorg-x11.
* Fri Aug  4 2006 schwab@suse.de
- Don't build demo programs.
* Mon Jul 24 2006 schwab@suse.de
- Fix building with Xorg 7.
* Wed Jun 14 2006 schwab@suse.de
- Set mandir.
* Wed Apr 12 2006 schwab@suse.de
- Fix build race.
* Mon Apr 10 2006 schwab@suse.de
- Update to openmotif 2.3.0 beta2.
* Fri Mar 31 2006 schwab@suse.de
- Fix fencepost error.
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Mon Dec  5 2005 schwab@suse.de
- Fix last change.
* Fri Dec  2 2005 schwab@suse.de
- Fix buffer overflows in uil [#136628].
* Tue Nov 29 2005 schwab@suse.de
- Fix missing sentinel.
* Tue Nov 29 2005 schwab@suse.de
- Remove useless buffer.
* Wed Nov 16 2005 uli@suse.de
- build with -O1 on ARM (prevents miscompilation that topples
  test suite)
* Wed Oct 19 2005 schwab@suse.de
- Update to openmotif 2.2.4.
* Sat Jul  9 2005 schwab@suse.de
- Fix warning.
* Tue May 17 2005 schwab@suse.de
- Completely rewrite XPM patch.
* Mon Feb 14 2005 schwab@suse.de
- Fix more sentinel warnings.
* Thu Feb 10 2005 adrian@suse.de
- install session desktop file
* Thu Jan 27 2005 schwab@suse.de
- Fix sentinel warnings.
* Wed Sep 29 2004 meissner@suse.de
- Fixed XPM security problem. #43240.
* Thu Sep  2 2004 schwab@suse.de
- Fix XmResizeHashTable [#44499].
* Tue Aug 17 2004 schwab@suse.de
- Fix dependencies.
* Tue Jun  1 2004 schwab@suse.de
- Fix use of datadir [#41476].
* Thu Apr 22 2004 schwab@suse.de
- Update to openMotif 2.2.3.
* Sat Apr 17 2004 schwab@suse.de
- Pacify autobuild.
* Wed Feb 11 2004 schwab@suse.de
- Fix some font problem [#32143].
* Sat Aug 16 2003 adrian@suse.de
- let openmotif-devel require only openmotif-libs
* Wed Aug 13 2003 schwab@suse.de
- Run ldconfig in %%post of libs [#28737].
* Wed Apr 30 2003 adrian@suse.de
- split libs into sub package
* Tue Apr  8 2003 schwab@suse.de
- Fix 64 bit bug in input method handling [#24075].
* Wed Dec 11 2002 schwab@suse.de
- Fix makefiles for automake.
* Mon Nov 18 2002 schwab@suse.de
- Fix duplicate file in AC_OUTPUT.
* Tue Aug 20 2002 mmj@suse.de
- Correct PreReq
* Sun May 26 2002 schwab@suse.de
- Fix invalid cast.
- Fix automake problem.
* Wed Apr 24 2002 schwab@suse.de
- Move /usr/X11R6/lib64/X11 back to /usr/X11R6/lib/X11.
* Wed Apr 24 2002 schwab@suse.de
- Fix for lib64.
* Thu Apr 18 2002 schwab@suse.de
- Fix permission of site.def after modifying.
* Thu Apr  4 2002 schwab@suse.de
- Remove dependency on libXmu to allow static linking.
* Thu Apr  4 2002 schwab@suse.de
- Update to openMotif 2.2.2.
- New subpackage openmotif-demo.
* Fri Jan  4 2002 adrian@suse.de
- fix build for mips
* Thu Nov 15 2001 schwab@suse.de
- Integrate JDK bug fix.
* Mon May  7 2001 mfabian@suse.de
- bzip2 sources
* Thu Feb 22 2001 schwab@suse.de
- Trigger on xdevel, not xf86.
* Fri Jan 19 2001 bk@suse.de
- Add support for s390.
* Fri Nov 17 2000 kukuk@suse.de
- Merge -binaries subpackage
* Wed Nov  8 2000 ro@suse.de
- changed %%post devel to %%triggerin devel -- xf86
* Tue Oct 24 2000 kukuk@suse.de
- Renamed from motif
- Split xmbind and mwm into extra "binary" package to avoid
  conflicts with lesstif
* Mon Sep 18 2000 schwab@suse.de
- Add support for ia64.
* Fri Jul 28 2000 kukuk@suse.de
- You cannot create an array with size NL_TEXTMAX == MAX_INT
- Add SPARC support to linux.cf
* Thu Jul 13 2000 schwab@suse.de
- Package created.