description="An X11 window manager with a NEXTSTEP look and feel"
url="http://www.windowmaker.org/"


packager="Tnut <tnut@nutyx.org>"
contributors=""

makedepends=(xorg-libxinerama xorg-libxrandr xorg-libxmu
             libpng xorg-libxpm xorg-libxft libtiff giflib)

name=windowmaker
version=0.95.9
release=2

source=($url/pub/source/release/WindowMaker-$version.tar.gz)

prepare() {
  cd WindowMaker-$version
  
  autoreconf -fi
  
  # fix some paths FS#3080 - ckeck also Gentoo ebuild
  for file in WindowMaker/*menu* util/wmgenmenu.c; do
 	if [[ -r $file ]] ; then
 	sed -i -e "s:/usr/local/GNUstep/Applications/WPrefs.app:/usr/lib/GNUstep/Applications/WPrefs.app:g;" "$file"
 	sed -i -e "s:/usr/local/share/WindowMaker:/usr/share/WindowMaker:g;" "$file"
 	sed -i -e "s:/opt/share/WindowMaker:/usr/share/WindowMaker:g;" "$file"
 	fi;
  done;
}

build() {
  cd WindowMaker-$version
  export LINGUAS="da de es fi fr it pt ru tr"

  ./configure --prefix=/usr --sysconfdir=/etc --enable-xinerama \
    --localedir=/usr/share/locale --with-gnustepdir=/usr/lib/GNUstep \
    --enable-usermenu --enable-modelock --enable-randr
  make
}

package() {
  cd WindowMaker-$version
  
  make DESTDIR=$PKG install

  mkdir -p $PKG/usr/share/xsessions
  cat > $PKG/usr/share/xsessions/wmaker.desktop << "EOF"
[Desktop Entry]
Encoding=UTF-8
Name=windowmaker
Exec=/usr/bin/wmaker
Type=Application
EOF
chmod 644 $PKG/usr/share/xsessions/wmaker.desktop

}
