# $Id: Portfile,v 1.23 2006/04/22 19:41:49 yves Exp $
PortSystem 1.0
name		windowmaker
version		0.92.0
revision    1
maintainers	yves@opendarwin.org
categories	x11-wm x11
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

depends_lib	    lib:libX11.6:XFree86 \
                port:Xft2 port:gettext \
                port:libpng port:libungif port:tiff

post-patch {
	cd ${worksrcpath}
	set fl [glob WindowMaker/*menu*]
	lappend fl WindowMaker/Defaults/WindowMaker.in \
	               WPrefs.app/Menu.c 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 -L/usr/X11R6/lib -lX11"
configure.args  --disable-debug --enable-gnome \
                --mandir=${prefix}/share/man \
                --with-nlsdir=${prefix}/share/locale \
                --with-gnustepdir=${prefix}/GNUstep

# Various eye-candy options
variant candy {
    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
    }
}
