# $Id: Portfile,v 1.18 2006/04/11 19:10:17 jmpp Exp $

PortSystem 		1.0

name			DarwinPorts
version			1.2.1

categories		sysutils
platforms		darwin freebsd
maintainers		portmgr@opendarwin.org

description		The DarwinPorts Infrastructure
long_description	DarwinPorts provides the infrastructure that allows easy installation and management \
			of freely available software on Mac OS X 10.3 (Darwin 7) or newer systems.

homepage		http://www.darwinports.org
master_sites		${homepage}/downloads
use_bzip2		yes
checksums		rmd160 ad3bfebf9d6cf8aad841181123ed3215c8f44c7a

#depends_run		port:PortAuthority

destroot.keepdirs ${destroot}${prefix}/include\
	${destroot}${prefix}/lib ${destroot}${prefix}/libexec\
	${destroot}${prefix}/sbin\
	${destroot}${prefix}/share/info\
	${destroot}${prefix}/share/man/cat1 ${destroot}${prefix}/share/man/cat2 ${destroot}${prefix}/share/man/cat3\
	${destroot}${prefix}/share/man/cat4 ${destroot}${prefix}/share/man/cat5 ${destroot}${prefix}/share/man/cat6\
	${destroot}${prefix}/share/man/cat7 ${destroot}${prefix}/share/man/cat8 ${destroot}${prefix}/share/man/cat9\
	${destroot}${prefix}/share/man/catl ${destroot}${prefix}/share/man/catn \
	${destroot}${prefix}/share/man/man1 ${destroot}${prefix}/share/man/man2 ${destroot}${prefix}/share/man/man3\
	${destroot}${prefix}/share/man/man4 ${destroot}${prefix}/share/man/man5 ${destroot}${prefix}/share/man/man6\
	${destroot}${prefix}/share/man/man7 ${destroot}${prefix}/share/man/man8 ${destroot}${prefix}/share/man/man9\
	${destroot}${prefix}/share/man/manl ${destroot}${prefix}/share/man/mann \
	${destroot}${prefix}/share/nls/C ${destroot}${prefix}/share/nls/skel\
	${destroot}${prefix}/share/nls/af_ZA.ISO8859-1\
	${destroot}${prefix}/share/nls/af_ZA.ISO8859-15\
	${destroot}${prefix}/share/nls/bg_BG.CP1251\
	${destroot}${prefix}/share/nls/cs_CZ.ISO8859-2\
	${destroot}${prefix}/share/nls/da_DK.ISO8859-1\
	${destroot}${prefix}/share/nls/da_DK.ISO8859-15\
	${destroot}${prefix}/share/nls/de_AT.ISO8859-1\
	${destroot}${prefix}/share/nls/de_AT.ISO8859-15\
	${destroot}${prefix}/share/nls/de_CH.ISO8859-1\
	${destroot}${prefix}/share/nls/de_CH.ISO8859-15\
	${destroot}${prefix}/share/nls/de_DE.ISO8859-1\
	${destroot}${prefix}/share/nls/de_DE.ISO8859-15\
	${destroot}${prefix}/share/nls/el_GR.ISO8859-7\
	${destroot}${prefix}/share/nls/en_AU.ISO8859-1\
	${destroot}${prefix}/share/nls/en_AU.ISO8859-15\
	${destroot}${prefix}/share/nls/en_AU.US-ASCII\
	${destroot}${prefix}/share/nls/en_CA.ISO8859-1\
	${destroot}${prefix}/share/nls/en_CA.ISO8859-15\
	${destroot}${prefix}/share/nls/en_CA.US-ASCII\
	${destroot}${prefix}/share/nls/en_GB.ISO8859-1\
	${destroot}${prefix}/share/nls/en_GB.ISO8859-15\
	${destroot}${prefix}/share/nls/en_GB.US-ASCII\
	${destroot}${prefix}/share/nls/en_NZ.ISO8859-1\
	${destroot}${prefix}/share/nls/en_NZ.ISO8859-15\
	${destroot}${prefix}/share/nls/en_NZ.US-ASCII\
	${destroot}${prefix}/share/nls/en_US.ISO8859-1\
	${destroot}${prefix}/share/nls/en_US.ISO8859-15\
	${destroot}${prefix}/share/nls/es_ES.ISO8859-1\
	${destroot}${prefix}/share/nls/es_ES.ISO8859-15\
	${destroot}${prefix}/share/nls/et_EE.ISO8859-15\
	${destroot}${prefix}/share/nls/fi_FI.ISO8859-1\
	${destroot}${prefix}/share/nls/fi_FI.ISO8859-15\
	${destroot}${prefix}/share/nls/fr_BE.ISO8859-1\
	${destroot}${prefix}/share/nls/fr_BE.ISO8859-15\
	${destroot}${prefix}/share/nls/fr_CA.ISO8859-1\
	${destroot}${prefix}/share/nls/fr_CA.ISO8859-15\
	${destroot}${prefix}/share/nls/fr_CH.ISO8859-1\
	${destroot}${prefix}/share/nls/fr_CH.ISO8859-15\
	${destroot}${prefix}/share/nls/fr_FR.ISO8859-1\
	${destroot}${prefix}/share/nls/fr_FR.ISO8859-15\
	${destroot}${prefix}/share/nls/hi_IN.ISCII-DEV\
	${destroot}${prefix}/share/nls/hr_HR.ISO8859-2\
	${destroot}${prefix}/share/nls/hu_HU.ISO8859-2\
	${destroot}${prefix}/share/nls/is_IS.ISO8859-1\
	${destroot}${prefix}/share/nls/is_IS.ISO8859-15\
	${destroot}${prefix}/share/nls/it_CH.ISO8859-1\
	${destroot}${prefix}/share/nls/it_CH.ISO8859-15\
	${destroot}${prefix}/share/nls/it_IT.ISO8859-1\
	${destroot}${prefix}/share/nls/it_IT.ISO8859-15\
	${destroot}${prefix}/share/nls/ja_JP.SJIS\
	${destroot}${prefix}/share/nls/ja_JP.eucJP\
	${destroot}${prefix}/share/nls/ko_KR.eucKR\
	${destroot}${prefix}/share/nls/la_LN.ISO8859-1\
	${destroot}${prefix}/share/nls/la_LN.ISO8859-15\
	${destroot}${prefix}/share/nls/la_LN.ISO8859-2\
	${destroot}${prefix}/share/nls/la_LN.ISO8859-4\
	${destroot}${prefix}/share/nls/la_LN.US-ASCII\
	${destroot}${prefix}/share/nls/lt_LT.ISO8859-4\
	${destroot}${prefix}/share/nls/nl_BE.ISO8859-1\
	${destroot}${prefix}/share/nls/nl_BE.ISO8859-15\
	${destroot}${prefix}/share/nls/nl_NL.ISO8859-1\
	${destroot}${prefix}/share/nls/nl_NL.ISO8859-15\
	${destroot}${prefix}/share/nls/no_NO.ISO8859-1\
	${destroot}${prefix}/share/nls/no_NO.ISO8859-15\
	${destroot}${prefix}/share/nls/pl_PL.ISO8859-2\
	${destroot}${prefix}/share/nls/pt_BR.ISO8859-1\
	${destroot}${prefix}/share/nls/pt_PT.ISO8859-1\
	${destroot}${prefix}/share/nls/pt_PT.ISO8859-15\
	${destroot}${prefix}/share/nls/ro_RO.ISO8859-2\
	${destroot}${prefix}/share/nls/ru_RU.CP866\
	${destroot}${prefix}/share/nls/ru_RU.ISO8859-5\
	${destroot}${prefix}/share/nls/ru_RU.KOI8-R\
	${destroot}${prefix}/share/nls/sk_SK.ISO8859-2\
	${destroot}${prefix}/share/nls/sl_SI.ISO8859-2\
	${destroot}${prefix}/share/nls/sv_SE.ISO8859-1\
	${destroot}${prefix}/share/nls/sv_SE.ISO8859-15\
	${destroot}${prefix}/share/nls/tr_TR.ISO8859-9\
	${destroot}${prefix}/share/nls/uk_UA.ISO8859-5\
	${destroot}${prefix}/share/nls/uk_UA.KOI8-U\
	${destroot}${prefix}/share/nls/zh_CN.eucCN\
	${destroot}${prefix}/share/nls/zh_TW.Big5\
	${destroot}${prefix}/var/db/dports/distfiles ${destroot}${prefix}/var/db/dports/receipts


# This is a proposed solution that would allow us to enhance the pkg without needing a
# post-pkg hook. There's a patch to integrate this functionality into base/, credit to drernie@
#package.resources ${filespath}/ReadMe.rtf ${filespath}/License.html ${filespath}/postflight

# But for the moment we use this workaround:
post-pkg {
	set resources ${workpath}/${name}-${version}.pkg/Contents/Resources/
	file copy -force -- ${filespath}/ReadMe.rtf ${resources}
	file copy -force -- ${filespath}/License.html ${resources}
	file copy -force -- ${filespath}/postflight ${resources}
}

platform darwin 7 {
	 post-pkg {
		  set resources ${workpath}/${name}-${version}.pkg/Contents/Resources/
		  reinplace "s|__XVERS__|10.3|" ${resources}/ReadMe.rtf
		  reinplace "s|__DVERS__|7|" ${resources}/ReadMe.rtf
		  reinplace "/^The \"Port Authority\"/,/\\\\/d" ${resources}/ReadMe.rtf
		  reinplace "/^\* DISCLAIMER/,/\\\\/d" ${resources}/ReadMe.rtf
		  reinplace "s|or newer ||" ${resources}/Welcome.html
	 }
}

platform darwin 8 {
	 post-pkg {
		  set resources ${workpath}/${name}-${version}.pkg/Contents/Resources/
		  reinplace "s|is built|contains a Universal binary|" ${resources}/ReadMe.rtf
		  reinplace "s|__XVERS__|10.4|" ${resources}/ReadMe.rtf
		  reinplace "s|__DVERS__|8|" ${resources}/ReadMe.rtf
		  reinplace "s|3|4|" ${resources}/Welcome.html
		  reinplace "s|7|8|" ${resources}/Welcome.html
		  reinplace "s|or newer ||" ${resources}/Welcome.html
	 }
}

platform darwin 8 i386 {
	# Supply architecture flags to build darwinports as fat on an Intel Mac
	configure.args-append "CFLAGS='-arch ppc -arch i386' SHLIB_LDFLAGS='-arch ppc -arch i386'"
}
