Index: Portfile
===================================================================
--- Portfile	(revision 47257)
+++ Portfile	(working copy)
@@ -33,28 +33,31 @@
 
 depends_lib				port:gtk2
 
-build.env-append		LIBS="-lm -lXm -lXpm -lXp -lXmu -lXt -lX11"
-
 worksrcdir				${name}
-use_parallel_build		yes
-build.args				--jobs=${build.jobs}
 use_configure			no
+use_parallel_build		no
+build.dir				${worksrcpath}/gtk
+build.target			free42bin
 
-
 post-extract {
 	system "unzip -q ${distpath}/${skin} -d ${workpath}/skin"
 }
 
-build {
-	reinplace "s|CXXFLAGS := |CXXFLAGS := -DNO_SINCOS |g" ${workpath}/free42/gtk/Makefile
-	system "
-	cd ${workpath}/free42/gtk;
-	unset BCD_MATH
-	make
-	make clean
-	make -e BCD_MATH=1"
+platform darwin {
+	build.env-append	LIBS="-lm -lXm -lXpm -lXp -lXmu -lXt -lX11"
+	post-patch {
+		reinplace "s|CXXFLAGS := |CXXFLAGS := -DNO_SINCOS |g" ${build.dir}/Makefile
+	}
 }
 
+post-build {
+	# The build phase builds the binary version.
+	# Now build again to get the decimal version.
+	build.target		clean free42dec
+	build.env-append 	BCD_MATH=1
+	command_exec build
+}
+
 destroot {
 	xinstall -m 775 -d ${destroot}${prefix}/share/free42
 	xinstall -m 775 -d ${destroot}${applications_dir}
@@ -66,7 +69,7 @@
 		${destroot}${prefix}/share/free42
 
 	xinstall -m 775										\
-		-W ${workpath}/free42/gtk						\
+		-W ${build.dir}									\
 		free42bin										\
 		free42dec										\
 		${destroot}${prefix}/bin
