I attached the portmaker patch with the following fixes:
* lib/mingwPORT.functions: win32path() - use cygpath if pwd -W fails, which is the case on cygwin
* src/portmaker.sh: corrected escaping
* template/mingwPORT.afterquestion: added brackets for proper grouping; the $ARCHIVE.log file was not created in previous version
* template/mingwPORT.configure: call win32path() which woks on msys and cygwin instead pwd -W which is msys specific
* template/mingwPORT.exports: export $CC and $CXX if they are not defined: as "gcc" and "g++" in case of mingw GCC compiler or "gcc -mno-cygwin" and "g++ -mno-cygwin" in case of cygwin GCC compiler
The patched version works on mingw + msys and on cygwin.