%define compatlib 0

Summary:	A version of the MIT Athena widget set for X.
Summary(ja):	X 用 MIT Athena widget の 3D 風バージョン
Name:		Xaw3d
Version:	1.5E
Release:	6%{?_dist_release}
Group:		System Environment/Libraries
Source:		ftp://ftp.visi.com/users/hawkeyd/X/Xaw3d-%{version}.tar.gz
Source1:	ftp://ftp.x.org/contrib/widgets/Xaw3d/R6/Xaw3d-1.3.tar.gz
Source2:	Imakefile
URL:		ftp://ftp.visi.com/users/hawkeyd/X/

# patch for compat libraries
Patch0:		Xaw3d-1.1-shlib.patch
Patch1:		Xaw3d-1.3-glibc.patch
Patch2:		Xaw3d-1.3-X11R6.3.patch
Patch3:		xaw3d.patch
Patch4:		Xaw3d-1.3-static.patch
Patch5:		Xaw3d-ia64.patch
Patch6:		Xaw3d-1.5-i18n.patch
Patch7:		Xaw3d-1.5-color.patch
Patch8:		Xaw3d-1.5-troughColor.patch
Patch9:		Xaw3d-1.3-misc.patch
Patch10:	Xaw3d-1.5-scrollbar2.patch

# patch for current libraries
Patch50:	Xaw3d-1.5E-xorg-imake.patch

License:	MIT
Prereq:		fileutils
BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires: libXmu-devel
BuildRequires: libXt-devel
BuildRequires: libSM-devel
BuildRequires: libXext-devel
BuildRequires: libX11-devel
BuildRequires: libXpm-devel
BuildRequires: imake
BuildRequires: bison
BuildRequires: flex
BuildRequires: ed

Vendor:		Project Vine
Distribution:	Vine Linux

%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

%description
Xaw3d is an enhanced version of the MIT Athena Widget set for
the X Window System.  Xaw3d adds a three-dimensional look to applications
with minimal or no source code changes.

You should install Xaw3d if you are using applications which incorporate
the MIT Athena widget set and you'd like to incorporate a 3D look into
those applications.

%description -l ja
Xaw3d は X ウィンドウシステム用 MIT Athena ウィジェットセットの
拡張バージョンです．Xaw3d はソースコードに殆ど，あるいは全く変更を
加えることなく，アプリケーションに 3D ルックを追加することが出来ます．

MIT Athena ウィジェットセットを使ったアプリケーションを利用していて，
これらで 3D ルックを使いたい場合は，Xaw3d をインストールして下さい．

%package -n compat32-%{name}
Summary:	A version of the MIT Athena widget set for X.
Summary(ja):	X 用 MIT Athena widget の 3D 風バージョン
Group:		System Environment/Libraries
Requires:	%{name} = %{version}-%{release}

%description -n compat32-%{name}
Xaw3d is an enhanced version of the MIT Athena Widget set for
the X Window System.  Xaw3d adds a three-dimensional look to applications
with minimal or no source code changes.

You should install Xaw3d if you are using applications which incorporate
the MIT Athena widget set and you'd like to incorporate a 3D look into
those applications.

%description -n compat32-%{name} -l ja
Xaw3d は X ウィンドウシステム用 MIT Athena ウィジェットセットの
拡張バージョンです．Xaw3d はソースコードに殆ど，あるいは全く変更を
加えることなく，アプリケーションに 3D ルックを追加することが出来ます．

MIT Athena ウィジェットセットを使ったアプリケーションを利用していて，
これらで 3D ルックを使いたい場合は，Xaw3d をインストールして下さい．

%package devel
Summary:	Header files and static libraries for development using Xaw3d.
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}
Requires: libXmu-devel
Requires: libXt-devel
Requires: libSM-devel
Requires: libXext-devel
Requires: libX11-devel
Requires: libXpm-devel

%description devel
Xaw3d is an enhanced version of the MIT Athena widget set for
the X Window System.  Xaw3d adds a three-dimensional look to those
applications with minimal or no source code changes. Xaw3d-devel includes
the header files and static libraries for developing programs that take
full advantage of Xaw3d's features.

You should install Xaw3d-devel if you are going to develop applications
using the Xaw3d widget set.  You'll also need to install the Xaw3d
package.

%description devel -l ja
Xaw3d は X ウィンドウシステム用 MIT Athena ウィジェットセットの
拡張バージョンです．Xaw3d はソースコードに殆ど，あるいは全く変更を
加えることなく，アプリケーションに 3D ルックを追加することが出来ます．
Xaw3d-devel パッケージには，Xaw3d の機能を最大限に利用するプログラムの
開発に必要なヘッダファイルとスタティックライブラリが収められています．

Xaw3d ウィジェットセットを使ったアプリケーション開発を行う場合は
Xaw3d-devel パッケージをインストールして下さい．
同時に Xaw3d もインストールしておく必要があります．

%prep
%setup -q -c

# Xaw3d7
pushd xc/lib/Xaw3d
ln -s .. X11
%patch50 -p0 -b .config
popd

# Xaw3d6 (compat libs)
%if %{compatlib}
%ifnarch ia64
mkdir old
pushd old
tar xzf %{SOURCE1}
popd
mv old/xc/lib/Xaw3d xc/lib/Xaw3d6
rm -rf old
pushd xc/lib/Xaw3d6
%patch0 -p0
ln -s .. X11
%patch1 -p4
%patch2 -p3
%patch3 -p4
%patch4 -p0
%patch6 -p4
%patch7 -p3
#%patch8 -p3
%patch9 -p3
#%patch10 -p4
popd
%endif
%endif

%build

# Xaw3d7
pushd xc/lib/Xaw3d
#export PATH=/usr/X11R6/bin:$PATH
xmkmf
make CDEBUGFLAGS="${RPM_OPT_FLAGS} -DARROW_SCROLLBAR -DUSEGRAY"
popd

# Xaw3d6 (compat libs)
%if %{compatlib}
%ifnarch ia64
cp %{SOURCE2} xc/lib/Xaw3d6
pushd xc/lib/Xaw3d6
xmkmf
make CFLAGS="${RPM_OPT_FLAGS} -DARROW_SCROLLBAR -DUSEGRAY"
popd
%endif
%endif

%install
rm -rf $RPM_BUILD_ROOT

# Xaw3d7
pushd xc/lib/Xaw3d
make install DESTDIR=$RPM_BUILD_ROOT
popd

# Xaw3d6
%if %{compatlib}
%ifnarch ia64
%__mkdir_p $RPM_BUILD_ROOT/usr/%{_lib}
cp -aR xc/lib/Xaw3d6/libXaw*so.* $RPM_BUILD_ROOT/usr/%{_lib}/
%endif
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -n compat32-%{name} -p /sbin/ldconfig

%postun -n compat32-%{name} -p /sbin/ldconfig

%files
%defattr(-,root,root)
/usr/%{_lib}/*.so.*

%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
/usr/%{_lib}/*.so.*
%endif

%files devel
%defattr(-,root,root)
#/usr/X11R6/%{_lib}/*.a
/usr/%{_lib}/*.so
%{_includedir}/X11/Xaw3d
#ghost /usr/X11R6/include/Xaw3d

%changelog
* Sun Jul 12 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.5E-6
- update Requires of -devel

* Sat Jun  7 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.5E-5
- rebuilt with xorg-x11-7.3
- updated BuildRequires
- spec in UTF-8

* Sun Mar 11 2007 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.5E-4vl1
- update to 1.5E
- sync with fedora core's 1.5E-4
  - import patches:
    - misc.patch (patch9)
    - scrollbar2.patch (patch10)
    - xorg-imake.patch (patch50)

  * Thu Jan 20 2005 Than Ngo <than@redhat.com> 1.5E-2
  - enable ARROW_SCROLLBARS, MULTIPLANE_PIXMAPS

  * Tue Nov 30 2004 Than Ngo <than@redhat.com> 1.5E-1
  - update to 1.5E, #130310
  - fix compiler warning #110766

  * Tue Nov 23 2004 Than Ngo <than@redhat.com> 1.5-24
  - add patch to fix build problem with xorg-x11, #140475

  * Wed Nov 26 2003 Than Ngo <than@redhat.com> 1.5-20
  - added missing Buildprereq: XFree86-devel (bug #110601, #109692, #110735)
  - fixed arguments in scrollbar (bug #110766)

- fix description devel -l ja
- update URLs
- add Vendor/Distribution tag

* Sat Sep 09 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.5-17vl4
- add BuildRequires: XOrg-devel, bison, flex
- add Requires: XOrg-devel (Xaw3d-devel)
- mkdir $RPM_BUILD_ROOT/usr/X11R6/%%{_lib} before copy libraries

* Sun May 21 2006 NAKAMURA Kenta <kenta@vinelinux.org> 1.5-17vl3
- added compat32-Xaw3d package for x86_64 architecture support

* Mon Apr  7 2003 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 1.5-17vl2
- rebuild

* Tue Dec 10 2002 Daisuke SUZUKI <daisuke@linux.or.jp> 1.5-17vl1
- add patch7 to use grayscale color.
- merged with rawhide release
    * Thu Nov  7 2002 han Ngo <than@redhat.com> 1.5-17
    - fix some building problems
    * Thu Sep  5 2002 Preston Brown <pbrown@redhat.com> 1.5-16
    - -DARROW_SCROLLBAR for rms
    * Thu Aug  8 2002 Than Ngo <than@redhat.com> 1.5-15
    - Added patch file to fix i18n issue, ynakai@redhat.com

* Fri Jul 13 2001 <sagami@vinelinux.org>
- 1.5-9vl3: use %%{ix86} for _arch instead of i386 :-)

* Wed May 23 2001 Tomoya TAKA <tomoya@olive.plala.or.jp>
- 1.5-9vl2
- add i386 and alpha to libXaw*so.*'s link in %%install

* Wed May 16 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 1.5-9vl1
- rebuilt for Vine Linux
- added Japanese summary and description
- added sparc, sparc64 to libXaw*so.*'s link in %%install
  (this is taken from 1.5-8vl1 from VineSeed/TestPkg by Machino-san)

* Wed Feb 28 2001 Than Ngo <than@redhat.com>
- add requires Xaw3d = %%{version}
- add prereq /sbin/ldconfig

* Tue Oct 10 2000 Than Ngo <than@redhat.com>
- fix link which causes faulty update (Bug #17895)

* Mon Jul 24 2000 Bill Nottingham <notting@redhat.com>
- ia64 tweaks

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Mon Jul 10 2000 Bernhard Rosenkraenzer <bero@redhat.de>
- Restore Xaw3d 1.5 - the addition of the backward compatibility library
  killed the current one.
- get rid of the CDEBUGFLAGS="" hack, the current gcc fixes it

* Mon Jul 03 2000 Than Ngo <than@redhat.de>
- fix Imakefile to static Xawd3d

* Sat Jun 17 2000 Than Ngo <than@redhat.de>
- add backward compatibility libXaw3d.so.6 (Bug# 12261)

* Mon May 15 2000 Bill Nottingham <notting@redhat.com>
- fix unaligned traps on ia64

* Mon May  8 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 1.5

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 21)

* Wed Feb 24 1999 Preston Brown <pbrown@redhat.com>
- Injected new description and group.

* Fri Dec 18 1998 Preston Brown <pbrown@redhat.com>
- bumped spec number for initial rh 6.0 build

* Fri Nov 06 1998 Preston Brown <pbrown@redhat.com>
- added security/update patch from debian (the X11R6.3 patch). Thanks guys. :)

* Wed Oct 14 1998 Cristian Gafton <gafton@redhat.com>
- handle the symlink with triggers instead of getting rid of it

* Mon Oct  5 1998 Jeff Johnson <jbj@redhat.com>
- remove backward compatible symlink.

* Wed May 06 1998 Cristian Gafton <gafton@redhat.com>
- fixed the bad symlink
- BuildRoot

* Mon Apr 27 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Tue Nov 04 1997 Erik Troan <ewt@redhat.com>
- don't lave an improper return code from %pre

* Mon Nov 03 1997 Cristian Gafton <gafton@redhat.com>
- take care of the old location of the Xaw3d includes in case that one exist
- updated Prereq: field

* Mon Oct 26 1997 Cristian Gafton <gafton@redhat.com
- fixed the -devel package for the right include files path

* Mon Oct 13 1997 Donnie Barnes <djb@redhat.com>
- minor spec file cleanups

* Wed Oct 01 1997 Erik Troan <ewt@redhat.com>
- i18n widec.h patch needs to be applied on all systems

* Sun Sep 14 1997 Erik Troan <ewt@redhat.com>
- changed axp check to alpha

* Mon Jun 16 1997 Erik Troan <ewt@redhat.com>
- built against glibc
