Index: portactivate.tcl
===================================================================
RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portactivate.tcl,v
retrieving revision 1.3
diff -u -u -r1.3 portactivate.tcl
--- portactivate.tcl	13 Sep 2004 05:44:44 -0000	1.3
+++ portactivate.tcl	5 Nov 2004 18:13:38 -0000
@@ -41,8 +41,39 @@
 target_requires ${com.apple.activate} main fetch extract checksum patch configure build destroot install
 target_prerun ${com.apple.activate} activate_start
 
+# define options
+options activate.copy_defaults
+default activate.copy_defaults ""
+
 set_ui_prefix
 
+proc copy_default_file { src dst } {
+	# Only copy file if it doesn't already exist
+	if { [file exists $dst] } {
+		ui_debug [format "Default file %s already exists" $dst]
+	} else {
+		# Make sure the src file is readable
+		if { ![file readable $src] } {
+			return -code error [msgcat::mc [format "Default file %s does not exist or is not readable" $src]]
+		}
+		
+		ui_debug [format "Installing default file %s" $dst]
+		file copy $src $dst
+	}
+}
+
+proc copy_default_files {files} {
+	# args is a list of pairs of file paths. Number of args must be even
+	if { [llength $files] % 2 != 0 } {
+	    return -code error [msgcat::mc "activate.copy_defaults must have an even number of parameters"]
+	}
+	
+	# copy each src/dst pair of files. src is copied to dst iff dst doesn't exist.
+	foreach { src dst } $files {
+		copy_default_file $src $dst
+	}
+}
+
 proc activate_start {args} {
 	global UI_PREFIX portname portversion portrevision variations portvariants
     
@@ -62,6 +93,12 @@
 
 proc activate_main {args} {
 	global portname portversion portrevision portvariants
+	
+	# activate the port
 	registry_activate $portname ${portversion}_${portrevision}${portvariants}
+	
+	# copy any default files that don't yet exist
+	copy_default_files [option activate.copy_defaults]
+	
     return 0
 }

