%define name		WindowMaker
%define version		0.65.1
%define release		2
%define group		User Interface/Desktops

%define prefix          %{_prefix}
%define exec_prefix     %{_prefix}
%define libdir		%{_prefix}/lib

# ==============================================================================

Name:		%{name}
Version:	%{version}
Release:	%{release}
Summary:	A window manager for the X Window System.
Group:		%{group}
Copyright:	GPL
URL:		http://www.windowmaker.org/
Source:		http://www.windowmaker.org/pub/source/release/WindowMaker-%{version}.tar.gz
Patch0:		%{name}-0.65.0-aix.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-buildroot

%description
Window Maker is an X11 window manager which emulates the look
and feel of the NeXTSTEP (TM) graphical user interface. It is
relatively fast, feature rich and easy to configure and use.
Window Maker is part of the official GNU project, which means that
Window Maker can interoperate with other GNU projects, such as
GNOME.

Window Maker allows users to switch themes 'on the fly,' to place
favorite applications on either an application dock, similar to
AfterStep Wharf or on a workspace dock, a 'clip' which extends
the application dock's usefulness.

You should install the WindowMaker package if you use Window
Maker as your window manager or if you'd like to try using it.


%ifarch ia64
  %define stdlib lib/ia64l32
  %define stdlib64 lib/ia64l64
  %define liblink ../../..
  %define PKG64 %{name}-%{version}-ia64l64
  %define DIRS . %{_builddir}/%{PKG64}/%{name}-%{version}
  %define DEFCCIA cc
  %define DEFCC %{DEFCCIA}
%else
  %define stdlib lib
  %define liblink ../..
  %define DIRS .
  %define DEFCC cc
%endif


%prep
%setup -q
%patch0 -p2 -b .aix


%build
# Use the default compiler for this platform - gcc otherwise
if [[ -z "$CC" ]]
then
    if test "X`type %{DEFCC} 2>/dev/null`" != 'X'; then
       export CC=%{DEFCC}
    else 
       export CC=gcc
    fi
fi
if [[ "$CC" != "gcc" ]]
then
%ifarch ia64
       export CC64="$CC -q64"
%endif
       RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's:-fsigned-char::'`
       RPM_OPT_FLAGS="$RPM_OPT_FLAGS -qcpluscmt"

fi
export CFLAGS=$RPM_OPT_FLAGS

libtoolize --force
aclocal
autoconf
CXXFLAGS="$RPM_OPT_FLAGS" ./configure \
  --prefix=%{prefix} --exec-prefix=%{exec_prefix} \
  --with-libs-from="-L%{prefix}/lib" --with-incs-from="-I%{prefix}/include"
make


%install
make install \
  prefix=$RPM_BUILD_ROOT%{prefix} \
  exec_prefix=$RPM_BUILD_ROOT%{exec_prefix} \
  libdir=$RPM_BUILD_ROOT%{libdir}

( cd $RPM_BUILD_ROOT

 /usr/bin/strip .%{prefix}/bin/* || :

 for dir in bin include share
 do
    mkdir -p usr/$dir
    cd usr/$dir
    ln -sf ../..%{prefix}/$dir/* .
    cd -
 done

 mkdir -p usr/%{stdlib}
 cd usr/%{stdlib}
 ln -sf %{liblink}%{prefix}/lib/* .
 #We just created a link to /usr/lib/locale.  We don't want that
 # to get installed; remove it so %files doesn't pick it up.
 rm locale
 cd -

 mkdir -p etc
 cd etc
 ln -sf ..%{prefix}/etc/* .
 cd -
)


%files
%{libdir}/*
%{prefix}/GNUstep/*
%{prefix}/bin/*
%{prefix}/etc/WindowMaker/*
%{prefix}/include/WINGs/*
%{prefix}/include/WMaker.h
%{prefix}/include/wraster.h
%{prefix}/man/man1/*
%{prefix}/share/WINGs/*
%{prefix}/share/WindowMaker/*
/usr/lib/*
/usr/bin/*
/usr/include/*
/usr/share/*
/etc/*


%clean
rm -rf $RPM_BUILD_ROOT


%post
   echo
   echo Note :
   echo You can now run the script wmaker.inst to install WindowMaker
   echo as the default desktop environment
   echo


%changelog
* Wed Oct 24 2001 David Clissold <cliss@austin.ibm.com>
- Ack! Ships a .a file as a symlink to a .so file.  A fresh local run of
- aclocal and autoconf takes care of it.  (Rev 0.65.1-2).

* Mon Aug 27 2001 Kevin Monroe <monroek@us.ibm.com>
- Add patch to fix application menu
- Add post instructions

* Sat Jul 28 2001 David Clissold <cliss@austin.ibm.com>
- Use IBM VAC compiler; add links into /usr

* Thu Jul 19 2001 Kevin Monroe <monroek@us.ibm.com>
- Initial Release

