# $Id: Portfile 115019 2013-12-22 09:29:46Z ryandesign@macports.org $

PortSystem 1.0

name		windowmaker
version		0.95.3
revision        2
license		GPL-2+
maintainers	nomaintainer
categories	x11 x11-wm
platforms	darwin freebsd
homepage	http://windowmaker.org/
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 \
    http://windowmaker.org/pub/source/release/

distname    WindowMaker-${version}
checksums	rmd160 320f29bb930b046ebdb796dc0d8b2dfdfa551c1b \
            sha256 b5eb88eccbf9a196a617594717797aa38f5c38d13d2ee40e914e153d09c9975a
universal_variant no
destroot.violate_mtree yes

depends_build \
	port:pkgconfig
depends_lib \
	port:xorg-libXmu \
	port:Xft2 \
	port:xpm \
	port:libpng \
	port:gettext \
	port: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  --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
    }
}
