
Portfile.diffâ¾¦÷¾¦ùmBIN‚�ÌàIndex: Portfile
===================================================================
RCS file: /Volumes/src/cvs/od/proj/darwinports/dports/databases/unixODBC/Portfile,v
retrieving revision 1.7
diff -u -r1.7 Portfile
--- Portfile	19 Nov 2004 00:30:59 -0000	1.7
+++ Portfile	13 Jan 2005 22:32:27 -0000
@@ -2,13 +2,10 @@
 
 PortSystem 1.0
 name			unixODBC
-version			2.2.7
-revision		1
+version			2.2.10
 categories		databases
 platforms		darwin
-
 maintainers		simon@cotsworth.com
-
 description		Provides ODBC 3 connectivity for Unix
 
 long_description	The unixODBC project provides UNIX applications with the same ODBC 3.51 API \
@@ -27,97 +24,100 @@
 master_sites	${homepage} \
 				ftp://ftp.easysoft.com/pub/beta/unixODBC/
 
-checksums		md5 5006259f2044666c733651263722bbdd
-
-depends_lib		lib:libiconv.2:libiconv \
-				  lib:readline:readline
+checksums		md5 a2e9d440c70e12c22d2548aa452c43ef \
+				sha1 f76121187dbf53e86641748abb0b91b3ae3b368d
 
-platform darwin 6	{ depends_lib-append	lib:libdl:dlcompat }
+depends_lib		lib:libiconv.2:libiconv lib:readline:readline
 
-patchfiles		patch-configure \
-				  patch-ltmain.sh \
-				  patch-SQLManageDataSources.c
+patchfiles		patch-ltmain.sh
 
-set share_path	"${prefix}/share/${name}"
-set doc_dest	"${destroot}${prefix}/share/doc/${name}"
+configure.env	LDFLAGS=-L${prefix}/lib CPPFLAGS=-I${prefix}/include
 
-configure.env	LDFLAGS='-L${prefix}/lib' \
-				  CPPFLAGS='-I${prefix}/include'
+configure.args	--with-libiconv-prefix=${prefix} \
+				--disable-stats \
+				--enable-gui=no
 
-configure.args	--with-libiconv-prefix='${prefix}' \
-				  --disable-stats \
-				  --enable-gui=no
-
-variant gui {
-		depends_lib-append lib:libqt-mt.3:qt3 \
-		  lib:libX11.6:XFree86
-		configure.env-append QTDIR='${prefix}'
-		configure.args-delete --enable-gui=no
-		configure.args-append --enable-gui \
-		  --with-qt-dir='${prefix}' \
-		  --with-qt-includes='${prefix}/include/qt3' \
-		  --with-qt-libraries='${prefix}/lib' \
-		  --with-extra-includes='/usr/X11R6/include' \
-		  --with-extra-libs='/usr/X11R6/lib'
+platform darwin 6 { 
+	depends_lib-append	lib:libdl:dlcompat
 }
 
-post-destroot	{ 
-	file mkdir ${destroot}${share_path}
-	system "install -m 644 ${portpath}/${filesdir}/*.template \
-	  ${destroot}${share_path}"
-	reinplace "s|DarwinPortsDirectory|${prefix}|g" \
-	  "${destroot}${share_path}/postgresql.driver.template"
+variant darwin {
+	patchfiles-append	patch-configure patch-SQLManageDataSources.c
+	global _cc _ccr _psq1 _psq2 _nn _odbc _ex1 _ex2
+	set _cc		"/usr/bin/gcc -bundle -flat_namespace -undefined suppress -o"
+	set _ccr	libodbccr.1.0.0
+	set	_psq1	libodbcpsql.1.0.0
+	set	_psq2	libodbcpsql.2.0.0
+	set	_nn		libnn.1.0.0
+	set _odbc	libodbc.1.0.0
+}
 
-	# ODBCDataSources Directory & empty directory hack
-	destroot.keepdirs ${destroot}${prefix}/etc/ODBCDataSources
+variant stats {
+	configure.args-delete	--disable-stats
+	configure.args-append	--enable-stats
+}
 
-	# Install Documentation
-	file mkdir ${doc_dest}
-	system "cd ${worksrcpath}/doc && \
-	  tar -cf - * | tar -xf - -C ${doc_dest}"
-	system "find ${doc_dest} -name 'Makefile*' | xargs rm"
-	system "chown -R `id -u`:`id -g` ${doc_dest}"
-
-	# Create Mach-O bundles
-	#
-	# Cursor Lib - The cursor lib needs a manual stage build to create it as a OSX bundle
-	# it needs to be like that so the DM can load it at run time.
-	system "cd ${worksrcpath}/cur && \
-	  /usr/bin/cc -bundle -flat_namespace -undefined suppress -o libodbccr.1.0.0.so *.lo && \
-	  rm ${destroot}${prefix}/lib/libodbccr.1.0.0.so && \
-	  install -m 755 libodbccr.1.0.0.so ${destroot}${prefix}/lib"
-	#
-	# ODBC Lib
-	system "cd ${worksrcpath}/DriverManager && \
-	  /usr/bin/cc -bundle -flat_namespace -undefined suppress -o libodbc.1.0.0.so \
-	  .libs/libodbc.1.0.0.dylib && \
-	  install -m 755 libodbc.1.0.0.so ${destroot}${prefix}/lib && \
-	  cd ${destroot}${prefix}/lib && \
-	  ln -s libodbc.1.0.0.so libodbc.1.so && \
-	  ln -s libodbc.1.0.0.so libodbc.so"
-	#
-	# Postgre7.1 Lib
-	system "cd ${worksrcpath}/Drivers/Postgre7.1 && \
-	  /usr/bin/cc -bundle -flat_namespace -undefined suppress -o libodbcpsql.2.0.0.so *.lo && \
-	  rm ${destroot}${prefix}/lib/libodbcpsql.2.0.0.so && \
-	  install -m 755 libodbcpsql.2.0.0.so ${destroot}${prefix}/lib"
-	#
-	# PostgreSQL Lib
-	system "cd ${worksrcpath}/Drivers/PostgreSQL && \
-	  /usr/bin/cc -bundle -flat_namespace -undefined suppress -o libodbcpsql.1.0.0.so *.lo && \
-	  rm ${destroot}${prefix}/lib/libodbcpsql.1.0.0.so && \
-	  install -m 755 libodbcpsql.1.0.0.so ${destroot}${prefix}/lib"
-	#
-	# NNTP Lib
-	system "cd ${worksrcpath}/Drivers/nn && \
-	  /usr/bin/cc -bundle -flat_namespace -undefined suppress -o libnn.1.0.0.so *.lo && \
-	  rm ${destroot}${prefix}/lib/libnn.1.0.0.so && \
-	  install -m 755 libnn.1.0.0.so ${destroot}${prefix}/lib"
+variant gui {
+	depends_lib-append	lib:libqt-mt.3:qt3 lib:libX11.6:XFree86
+	configure.env-append	QTDIR=${prefix}
+	configure.args-delete	--enable-gui=no
+	configure.args-append	--enable-gui \
+	  --with-qt-dir=${prefix} \
+	  --with-qt-includes=${prefix}/include/qt3 \
+	  --with-qt-libraries=${prefix}/lib \
+	  --with-qt-bin=${prefix}/bin
+	  --with-extra-includes=/usr/X11R6/include \
+	  --with-extra-libs=/usr/X11R6/lib
 }
 
-post-install	{ 
-	system "${prefix}/bin/odbcinst -i -d -f \
-	  ${share_path}/postgresql.driver.template"
-	system "${prefix}/bin/odbcinst -i -s -f \
-	  ${share_path}/postgresql.data.template"
+post-destroot	{
+	# darwin Mach-O bundles
+	if { [variant_isset darwin] } {
+		system "cd ${worksrcpath}/DriverManager && \
+		  ${_cc} ${_odbc}.so .libs/libodbc.1.0.0.dylib && \
+		  ln -fs ${_odbc}.so ${destroot}${prefix}/lib/libodbc.1.so && \
+		  ln -fs ${_odbc}.so ${destroot}${prefix}/lib/libodbc.so"
+		system "cd ${worksrcpath}/cur && ${_cc} ${_ccr}.so *.o"
+		system "cd ${worksrcpath}/Drivers/PostgreSQL && ${_cc} ${_psq1}.so *.o"
+		system "cd ${worksrcpath}/Drivers/Postgre7.1 && ${_cc} ${_psq2}.so *.o"
+		system "cd ${worksrcpath}/Drivers/nn && ${_cc} ${_nn}.so *.o"
+		foreach lib [list ${_ccr} ${_psq1} ${_psq2} ${_nn}] {
+			system "mv ${destroot}${prefix}/lib/$lib.so ${destroot}${prefix}/lib/$lib.dylib"
+		}
+		foreach new [list cur/${_ccr} DriverManager/${_odbc} Drivers/PostgreSQL/${_psq1} Drivers/Postgre7.1/${_psq2} Drivers/nn/${_nn}] {
+			xinstall -m 0755 ${worksrcpath}/$new.so ${destroot}${prefix}/lib
+		}
+	}
+	# DOCS
+	xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
+	foreach doc [glob ${worksrcpath}/\[A-Z\]*\[A-Z\]\[A-Z\]\[A-Z\] ${worksrcpath}/doc/*.\[a-z\]\[a-z\]\[a-z\]*] {
+		if {[string match "*.html" $doc]} {
+			reinplace "s|${homepage}doc/||g" $doc
+		}
+		xinstall -m 0644 $doc ${destroot}${prefix}/share/doc/${name}
+	}
+	foreach dir [list AdministratorManual lst ProgrammerManual ProgrammerManual/Tutorial UserManual] {
+		xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}/$dir
+		foreach file [glob ${worksrcpath}/doc/$dir/*.\[a-z\]\[a-z\]\[a-z\]*] {
+			if {[string match "*.html" $file]} {
+				reinplace "s|${homepage}doc/||g" $file
+			}
+			xinstall -m 0644 $file ${destroot}${prefix}/share/doc/${name}/$dir
+		}
+	}
+
+	# TEMPLATES
+	xinstall -d -m 0755 ${destroot}${prefix}/share/${name}
+	foreach template [glob ${portpath}/${filesdir}/*.template] {
+		xinstall -m 0644 $template ${destroot}${prefix}/share/${name}
+	}
+	foreach driver [glob ${destroot}${prefix}/share/${name}/*.driver.*] {
+		reinplace "s|_DP_PREFIX|${prefix}|g" $driver
+	}
+
+	# CONFIG
+	foreach ini [glob ${destroot}${prefix}/etc/*.ini] {
+		system "mv $ini $ini.dist"
+	}
+	destroot.keepdirs ${destroot}${prefix}/etc/ODBCDataSources
 }
