# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 91181 2012-03-25 08:15:09Z jeremyhu@macports.org $

PortSystem 1.0

name		gtk1
version		1.2.10
set branch	[join [lrange [split ${version} .] 0 1] .]
revision	10
categories	x11
license		LGPL
maintainers	nomaintainer
description	Gimp ToolKit version 1
homepage	http://www.gtk.org/
platforms	darwin freebsd sunos

long_description GTK+, the Gimp ToolKit, is a library for creating graphical \
		 user interfaces for the X Window System.

master_sites	gnome:sources/gtk+/${branch}/ \
				ftp://ftp.gtk.org/pub/gtk/v${branch}/ \
		macports:lt:lt

distname	gtk+-${version}
set source_distfile	[suffix ${distname}]
distfiles	${source_distfile} ltconfig13:lt ltmain13:lt
checksums	${source_distfile} md5 4d5cb2fc7fb7830e4af9747a36bfce20 \
		ltconfig13 md5 ea53f42a550c9f9e653758a8ed91574e \
		ltmain13 md5 e094ae92724c4015dbab97de151c2525
extract.only	${source_distfile}

depends_lib	port:glib1 port:xorg-libXext port:xorg-libXt

patchfiles	patch-config.guess patch-config.sub \
			patch-gtk.m4.diff

post-patch {
	   copy -force ${distpath}/ltconfig13 ${worksrcpath}/ltconfig
	   copy -force ${distpath}/ltmain13 ${worksrcpath}/ltmain.sh
       # fix ltmain.sh to handle universal library creation.
       system "cd ${worksrcpath} && \
               patch -p0 < ${filespath}/patch-ltmain.sh.diff"
}

configure.ccache    no
configure.ldflags-delete "-L${prefix}/lib"
configure.cppflags-delete "-I${prefix}/include"
configure.args	--disable-nls --disable-shm --with-locale \
                --mandir=${prefix}/share/man \
                --infodir=${prefix}/share/info \
                --x-includes=${prefix}/include \
                --x-libraries=${prefix}/lib

post-destroot {
	      ln -sf libgdk-1.2.0.9.1.dylib ${destroot}${prefix}/lib/libgdk.1.dylib
	      ln -sf libgtk-1.2.0.9.1.dylib ${destroot}${prefix}/lib/libgtk.1.dylib
}

platform sunos {
	configure.args-delete	--disable-shm --with-locale
	configure.args-append	--disable-nls
}

livecheck.type  regex
livecheck.url   ftp://ftp.gtk.org/pub/gtk/v1.2/
livecheck.regex "gtk\\+-(\\d+(?:\\.\\d+)*)${extract.suffix}"
