# $Id: Portfile 84732 2011-09-30 11:35:58Z jmr@macports.org $

PortSystem 1.0

name		windowmaker
version		0.92.0
revision        5
license		GPL-2+
maintainers	nomaintainer
categories	x11 x11-wm
platforms	darwin freebsd
homepage	http://www.windowmaker.info/
description	Window Maker is a X11 window manager supporting GNUstep
long_description \
    Window Maker is an X11 window manager originally designed to provide \
    integration support for the GNUstep Desktop Environment. \
    In every way possible, it reproduces the elegant look and feel \
    of the NEXTSTEP\[tm\] user interface. \
    It is fast, feature rich, easy to configure, and easy to use. \
    It is also free software, with contributions being made \
    by programmers from around the world.

master_sites \
    ftp://ftp.windowmaker.info/pub/source/release/ \
 	ftp://ftp.goldweb.com.au/pub/WindowMaker/source/release/ \
 	ftp://ftp.kddlabs.co.jp/X11/window_managers/windowmaker/source/release/ \
 	ftp://ftp.ameth.org/pub/mirrors/ftp.windowmaker.org/source/release/ \
 	ftp://ftp.minet.net/pub/windowmaker/source/release/ \
 	ftp://gd.tuwien.ac.at/hci/windowmaker/source/release/ \
 	ftp://ftp.dti.ad.jp/pub/X/WindowMaker/source/release/ \
 	ftp://ftp.chg.ru/pub/X11/windowmanagers/windowmaker/source/release/

distname    WindowMaker-${version}
checksums	md5 aaac5421b686ed2d3e6ab65229c98097
use_bzip2 	yes
universal_variant no
destroot.violate_mtree yes

depends_build \
	port:pkgconfig
depends_lib \
	port:xorg-libsm \
	port:xorg-libXext \
	port:Xft2 \
	port:xpm \
	port:libpng \
	port:gettext \
	path:include/gif_lib.h:giflib \
	port:tiff

post-patch {
	set fl [glob -directory ${worksrcpath} WindowMaker/*menu*]
	lappend fl ${worksrcpath}/WindowMaker/Defaults/WindowMaker.in \
	               ${worksrcpath}/WPrefs.app/Menu.c ${worksrcpath}/WPrefs.app/Paths.c
	foreach i $fl {
		reinplace "s|/usr/X11R6/share|${prefix}/share|g" $i
		reinplace "s|/usr/share|${prefix}/share|g" $i
		reinplace "s|/usr/local/share|${prefix}/share|g" $i
		reinplace "s|/opt/share|${prefix}/share|g" $i
		reinplace "s|/opt/kde2/share|${prefix}/share|g" $i
	}
}

configure.env   LINGUAS="bg cs da de el es et fi fr gl hr hu it ja \
                ko ms nl no pl pt ro ru sk sv tr zh_CN" \
                LIBS="-L${prefix}/lib -lintl -lX11"
configure.args  --disable-debug --enable-gnome \
                --mandir=${prefix}/share/man \
                --with-nlsdir=${prefix}/share/locale \
                --with-gnustepdir=${prefix}/GNUstep/Local

variant candy description "Enable various eye-candy options" {
    post-configure {
        reinplace "s|undef OPTIMIZE_SHAPE|define OPTIMIZE_SHAPE|" \
            ${worksrcpath}/src/wconfig.h
        reinplace "s|undef ICON_KABOOM_EXTRA|define ICON_KABOOM_EXTRA|" \
            ${worksrcpath}/src/wconfig.h
        reinplace "s|undef WINDOW_BIRTH_ZOOM2|define WINDOW_BIRTH_ZOOM2|" \
            ${worksrcpath}/src/wconfig.h
    }
}

platform darwin i386 {
    post-patch {
        reinplace "s|#define ASM_X86 1||g" ${worksrcpath}/configure
        reinplace "s|#define ASM_X86_MMX 1||g" ${worksrcpath}/configure
        reinplace "s|asm_support=yes|asm_support=no|g" ${worksrcpath}/configure
        reinplace "s|mmx_support=yes|mmx_support=no|g" ${worksrcpath}/configure
    }
}
