As I had to find out finally, the postflight script is also executed before the receipts are written. So my solution to this problem is now the following:
I add postinstall scripts to my packages that read the DSTROOT environment variable set by the Mac OS installer and write them to a file in the shared temp folder:
echo "${DSTROOT}" > "${SHARED_INSTALLER_TEMP}/my_install_location"
Then in my package, that needs these information, I read the old receipts via a postinstall script (in case the sub package is already installed and the user "reinstalls" leaving out some of the sub packages) and then the temp file from the other package.
So, if the package is already installed and not reinstalled it uses the current install location otherwise it uses the new install location via the temp files. If nothing is present the required package was not installed so I use default values and write them to the xcconfig file (that probably won't work):
pkgutil --pkg-info-plist my.package.bundle > "${SHARED_INSTALLER_TEMP}/tmp.plist"
if [ -e "${SHARED_INSTALLER_TEMP}/tmp.plist" ];
then
MY_PACKAGE_VOL=`/usr/libexec/PlistBuddy -c "Print :volume" "${SHARED_INSTALLER_TEMP}/tmp.plist"`
MY_PACKAGE_DIR=`/usr/libexec/PlistBuddy -c "Print :install-location" "${SHARED_INSTALLER_TEMP}/tmp.plist"`
MY_PACKAGE_DIR="${MY_PACKAGE_VOL}${MY_PACKAGE_DIR}"
fi
After reading the "old" install location, I check if I have a new install location using the previously written temp file from the other packages:
if [ -e "${SHARED_INSTALLER_TEMP}/my_install_location" ];
then
MY_PACKAGE_DIR=`cat "${SHARED_INSTALLER_TEMP}/my_install_location"`
fi
...
Write the xcconfig file...
...
If someone has a better solution let me know.