Index: devel/ice-python/Portfile
===================================================================
--- devel/ice-python/Portfile	(revision 67852)
+++ devel/ice-python/Portfile	(working copy)
@@ -41,25 +41,26 @@
 depends_lib     port:python24 \
                 port:ice-cpp
 
+build.dir       ${worksrcpath}/py
+
 post-patch {
         # Remove this reinplace when 3.4.1 is released.
         reinplace "s/nodarwing/nodarwin/" \
-                ${workpath}/Ice-${version}/scripts/TestUtil.py
+                ${worksrcpath}/scripts/TestUtil.py
 
         reinplace "s/-O2/-g -O2/" \
-                ${workpath}/Ice-${version}/py/config/Make.rules.Darwin
+                ${build.dir}/config/Make.rules.Darwin
 
         # Prevent name conflicts between libICE.* from xorg-libice and
         # libIce.* from this port by renaming libIce.* to libZeroCIce.*.
         reinplace "s/-lIce /-lZeroCIce /" \
-                ${workpath}/Ice-${version}/py/config/Make.rules
+                ${build.dir}/config/Make.rules
         reinplace "s/-lIce /-lZeroCIce /" \
-                ${workpath}/Ice-${version}/py/config/Make.rules.Darwin
+                ${build.dir}/config/Make.rules.Darwin
 }
 
 use_configure   no
 
-build.dir       ${worksrcpath}/py
 build.target    prefix="${prefix}" \
                 CC="${configure.cc}" \
                 CXX="${configure.cxx}" \
@@ -70,12 +71,10 @@
                 all
 
 test.run        yes
-test.dir        ${worksrcpath}/py
 test.env        ICE_HOME=${prefix}
 test.cmd        ${prefix}/bin/python2.4
 test.target     allTests.py
 
-destroot.dir    ${worksrcpath}/py
 destroot.target prefix="${destroot}${prefix}" \
                 CC="${configure.cc}" \
                 CXX="${configure.cxx}" \
@@ -113,10 +112,10 @@
         foreach f {CHANGES RELEASE_NOTES} {
                 file copy ${worksrcpath}/${f} ${docdir}
         }
-        file copy ${worksrcpath}/py/INSTALL ${docdir}
+        file copy ${build.dir}/INSTALL ${docdir}
 
         if {[variant_isset demo_source_code]} {
-                file copy ${worksrcpath}/py/demo ${docdir}
+                file copy ${build.dir}/demo ${docdir}
         }
 }
 
Index: devel/ice-cpp/Portfile
===================================================================
--- devel/ice-cpp/Portfile	(revision 67852)
+++ devel/ice-cpp/Portfile	(working copy)
@@ -52,23 +52,25 @@
                 port:readline \
                 port:mcpp
 
+build.dir       ${worksrcpath}/cpp
+
 post-patch {
         # Remove this reinplace when 3.4.1 is released.
         reinplace "s/nodarwing/nodarwin/" \
-                ${workpath}/Ice-${version}/scripts/TestUtil.py
+                ${worksrcpath}/scripts/TestUtil.py
 
         reinplace "s/-O2/-g -O2/" \
-                ${workpath}/Ice-${version}/cpp/config/Make.rules.Darwin
+                ${build.dir}/config/Make.rules.Darwin
 
         # To prevent a compilation failure by picking up header files
         # from an older installed version of Ice, put the $(CPPFLAGS)
         # before $(READLINE_FLAGS).
         reinplace "s|\$\(READLINE_FLAGS\) \$\(CPPFLAGS\)|\$\(CPPFLAGS\) \$\(READLINE_FLAGS\)|" \
-                ${workpath}/Ice-${version}/cpp/demo/Freeze/library/Makefile \
-                ${workpath}/Ice-${version}/cpp/demo/Freeze/phonebook/Makefile \
-                ${workpath}/Ice-${version}/cpp/demo/book/evictor_filesystem/Makefile \
-                ${workpath}/Ice-${version}/cpp/demo/book/lifecycle/Makefile \
-                ${workpath}/Ice-${version}/cpp/demo/book/map_filesystem/Makefile
+                ${build.dir}/demo/Freeze/library/Makefile \
+                ${build.dir}/demo/Freeze/phonebook/Makefile \
+                ${build.dir}/demo/book/evictor_filesystem/Makefile \
+                ${build.dir}/demo/book/lifecycle/Makefile \
+                ${build.dir}/demo/book/map_filesystem/Makefile
 
         # It appears that the 10.4 and 10.5 installed versions of
         # ${prefix}/include/iconv.h have different definitions of
@@ -80,7 +82,7 @@
         close $fl
         foreach line [split $data \n] {
                 if {[string match "extern size_t iconv*const*" $line]} {
-                        reinplace "s/_LIBICONV_VERSION < 0x010B/1/" ${workpath}/Ice-${version}/cpp/include/Ice/IconvStringConverter.h
+                        reinplace "s/_LIBICONV_VERSION < 0x010B/1/" ${build.dir}/include/Ice/IconvStringConverter.h
                         break
                 }
         }
@@ -88,10 +90,10 @@
         # Prevent name conflicts between libICE.* from xorg-libice and
         # libIce.* from this port by renaming libIce.* to libZeroCIce.*.
         reinplace "s/,Ice/,ZeroCIce/" \
-                ${workpath}/Ice-${version}/cpp/src/Ice/Makefile
+                ${build.dir}/src/Ice/Makefile
         reinplace "s/-lIce /-lZeroCIce /" \
-                ${workpath}/Ice-${version}/cpp/config/Make.rules.Darwin
-        foreach {f} [exec find ${workpath}/Ice-${version}/cpp -name Makefile] {
+                ${build.dir}/config/Make.rules.Darwin
+        foreach {f} [exec find ${build.dir} -name Makefile] {
                 reinplace "s/-lIce /-lZeroCIce /" ${f}
         }
 }
@@ -99,16 +101,14 @@
 use_configure   no
 
 build {
-        set cmd "cd ${workpath}/Ice-${version}/cpp && make prefix='${prefix}' embedded_runpath_prefix='${prefix}' CC='${configure.cc}' CXX='${configure.cxx}' OPTIMIZE='yes' BZIP2_HOME='${prefix}' DB_HOME='${prefix}' EXPAT_HOME='${prefix}' OPENSSL_HOME='${prefix}' READLINE_HOME='${prefix}' USE_READLINE=yes MCPP_HOME='${prefix}' LDPLATFORMFLAGS= all && cd doc && make"
+        set cmd "cd ${build.dir} && make prefix='${prefix}' embedded_runpath_prefix='${prefix}' CC='${configure.cc}' CXX='${configure.cxx}' OPTIMIZE='yes' BZIP2_HOME='${prefix}' DB_HOME='${prefix}' EXPAT_HOME='${prefix}' OPENSSL_HOME='${prefix}' READLINE_HOME='${prefix}' USE_READLINE=yes MCPP_HOME='${prefix}' LDPLATFORMFLAGS= all && cd doc && make"
         ui_debug ${cmd}
         system ${cmd}
 }
 
-test.dir        ${worksrcpath}/cpp
 test.run        yes
 test.target     test
 
-destroot.dir    ${worksrcpath}/cpp
 destroot.target prefix="${destroot}${prefix}" \
                 embedded_runpath_prefix="${prefix}" \
                 OPTIMIZE="yes" \
@@ -122,7 +122,6 @@
                 install
 
 post-destroot {
-        set cppdir ${workpath}/Ice-${version}/cpp
         set sharedir ${destroot}${prefix}/share
         set docdir ${sharedir}/doc/${name}
 
@@ -133,15 +132,15 @@
         xinstall -m 755 -d ${docdir}
         file rename ${destroot}${prefix}/ICE_LICENSE ${docdir}
         file rename ${destroot}${prefix}/LICENSE ${docdir}
-        file copy ${cppdir}/doc/reference ${docdir}
+        file copy ${build.dir}/doc/reference ${docdir}
 
         foreach f {CHANGES RELEASE_NOTES} {
-                file copy ${workpath}/Ice-${version}/${f} ${docdir}
+                file copy ${worksrcpath}/${f} ${docdir}
         }
 
         if {[variant_isset demo_source_code]} {
-                system "cd ${cppdir}/demo && make clean"
-                file copy ${cppdir}/demo $docdir
+                system "cd ${build.dir}/demo && make clean"
+                file copy ${build.dir}/demo $docdir
         }
 }
 
Index: devel/ice-java/Portfile
===================================================================
--- devel/ice-java/Portfile	(revision 67852)
+++ devel/ice-java/Portfile	(working copy)
@@ -47,29 +47,28 @@
                 port:jgoodies-looks \
                 port:proguard
 
+build.dir       ${worksrcpath}/java
+
 post-patch {
         # Remove this reinplace when 3.4.1 is released.
         reinplace "s/nodarwing/nodarwin/" \
-                ${workpath}/Ice-${version}/scripts/TestUtil.py
+                ${worksrcpath}/scripts/TestUtil.py
 }
 
 use_configure        no
 
 set classpath ${prefix}/lib/db46/db.jar:${prefix}/share/java/forms.jar:${prefix}/share/java/looks.jar:${prefix}/share/java/proguard.jar
 
-build.dir       ${worksrcpath}/java
 build.env       JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home CLASSPATH=${classpath} ANT_OPTS=-Xmx512m ICE_HOME=${prefix}
 build.cmd       ant
 build.target    clean all
 
 test.run        yes
-test.dir        ${worksrcpath}/java
 test.env        JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home CLASSPATH=${classpath} ANT_OPTS=-Xmx512m ICE_HOME=${prefix} DYLD_LIBRARY_PATH=${prefix}/lib/db46
 test.cmd        python
 test.target     allTests.py
 
 destroot {
-        set ice-java ${workpath}/Ice-${version}/java
         set javadir ${destroot}${prefix}/share/java
         set docdir ${destroot}${prefix}/share/doc/${name}
 
@@ -77,17 +76,17 @@
         xinstall -d -m 755 ${docdir}
 
         foreach f {ant-ice.jar Ice.jar IceGridGUI.jar} {
-                file copy ${ice-java}/lib/${f} ${javadir}/
+                file copy ${build.dir}/lib/${f} ${javadir}/
         }
-        file copy ${ice-java}/resources/IceGridAdmin ${docdir}/
+        file copy ${build.dir}/resources/IceGridAdmin ${docdir}/
 
         foreach f {CHANGES ICE_LICENSE LICENSE RELEASE_NOTES} {
                 file copy ${worksrcpath}/${f} ${docdir}
         }
-        file copy ${worksrcpath}/java/INSTALL ${docdir}
+        file copy ${build.dir}/INSTALL ${docdir}
 
         if {[variant_isset demo_source_code]} {
-                file copy ${ice-java}/demo ${docdir}/
+                file copy ${build.dir}/demo ${docdir}/
         }
 }
 
Index: devel/ice-python25/Portfile
===================================================================
--- devel/ice-python25/Portfile	(revision 67852)
+++ devel/ice-python25/Portfile	(working copy)
@@ -41,25 +41,26 @@
 depends_lib     port:python25 \
                 port:ice-cpp
 
+build.dir       ${worksrcpath}/py
+
 post-patch {
         # Remove this reinplace when 3.4.1 is released.
         reinplace "s/nodarwing/nodarwin/" \
-                ${workpath}/Ice-${version}/scripts/TestUtil.py
+                ${worksrcpath}/scripts/TestUtil.py
 
         reinplace "s/-O2/-g -O2/" \
-                ${workpath}/Ice-${version}/py/config/Make.rules.Darwin
+                ${build.dir}/config/Make.rules.Darwin
 
         # Prevent name conflicts between libICE.* from xorg-libice and
         # libIce.* from this port by renaming libIce.* to libZeroCIce.*.
         reinplace "s/-lIce /-lZeroCIce /" \
-                ${workpath}/Ice-${version}/py/config/Make.rules
+                ${build.dir}/config/Make.rules
         reinplace "s/-lIce /-lZeroCIce /" \
-                ${workpath}/Ice-${version}/py/config/Make.rules.Darwin
+                ${build.dir}/config/Make.rules.Darwin
 }
 
 use_configure   no
 
-build.dir       ${worksrcpath}/py
 build.target    prefix="${prefix}" \
                 CC="${configure.cc}" \
                 CXX="${configure.cxx}" \
@@ -70,12 +71,10 @@
                 all
 
 test.run        yes
-test.dir        ${worksrcpath}/py
 test.env        ICE_HOME=${prefix}
 test.cmd        ${prefix}/bin/python2.5
 test.target     allTests.py
 
-destroot.dir    ${worksrcpath}/py
 destroot.target prefix="${destroot}${prefix}" \
                 CC="${configure.cc}" \
                 CXX="${configure.cxx}" \
@@ -113,10 +112,10 @@
         foreach f {CHANGES RELEASE_NOTES} {
                 file copy ${worksrcpath}/${f} ${docdir}
         }
-        file copy ${worksrcpath}/py/INSTALL ${docdir}
+        file copy ${build.dir}/INSTALL ${docdir}
 
         if {[variant_isset demo_source_code]} {
-                file copy ${worksrcpath}/py/demo ${docdir}
+                file copy ${build.dir}/demo ${docdir}
         }
 }
 
Index: devel/ice-python26/Portfile
===================================================================
--- devel/ice-python26/Portfile	(revision 67852)
+++ devel/ice-python26/Portfile	(working copy)
@@ -41,25 +41,26 @@
 depends_lib     port:python26 \
                 port:ice-cpp
 
+build.dir       ${worksrcpath}/py
+
 post-patch {
         # Remove this reinplace when 3.4.1 is released.
         reinplace "s/nodarwing/nodarwin/" \
-                ${workpath}/Ice-${version}/scripts/TestUtil.py
+                ${worksrcpath}/scripts/TestUtil.py
 
         reinplace "s/-O2/-g -O2/" \
-                ${workpath}/Ice-${version}/py/config/Make.rules.Darwin
+                ${build.dir}/config/Make.rules.Darwin
 
         # Prevent name conflicts between libICE.* from xorg-libice and
         # libIce.* from this port by renaming libIce.* to libZeroCIce.*.
         reinplace "s/-lIce /-lZeroCIce /" \
-                ${workpath}/Ice-${version}/py/config/Make.rules
+                ${build.dir}/config/Make.rules
         reinplace "s/-lIce /-lZeroCIce /" \
-                ${workpath}/Ice-${version}/py/config/Make.rules.Darwin
+                ${build.dir}/config/Make.rules.Darwin
 }
 
 use_configure   no
 
-build.dir       ${worksrcpath}/py
 build.target    prefix="${prefix}" \
                 CC="${configure.cc}" \
                 CXX="${configure.cxx}" \
@@ -70,12 +71,10 @@
                 all
 
 test.run        yes
-test.dir        ${worksrcpath}/py
 test.env        ICE_HOME=${prefix}
 test.cmd        ${prefix}/bin/python2.6
 test.target     allTests.py
 
-destroot.dir    ${worksrcpath}/py
 destroot.target prefix="${destroot}${prefix}" \
                 CC="${configure.cc}" \
                 CXX="${configure.cxx}" \
@@ -117,10 +116,10 @@
         foreach f {CHANGES RELEASE_NOTES} {
                 file copy ${worksrcpath}/${f} ${docdir}
         }
-        file copy ${worksrcpath}/py/INSTALL ${docdir}
+        file copy ${build.dir}/INSTALL ${docdir}
 
         if {[variant_isset demo_source_code]} {
-                file copy ${worksrcpath}/py/demo ${docdir}
+                file copy ${build.dir}/demo ${docdir}
         }
 }
 
