diff common/makefiles/MakeBase.gmk @ 668:3b8ffb80db0f

8008373: JFR JTReg tests fail with CompilationError on MacOSX; missing '._sunec.jar' Reviewed-by: tbell
author erikj
date Fri, 05 Apr 2013 09:38:54 +0200
parents 19a59a13b3ef
children 2ef28c12d649
line wrap: on
line diff
--- a/common/makefiles/MakeBase.gmk	Thu Apr 04 09:25:58 2013 +0200
+++ b/common/makefiles/MakeBase.gmk	Fri Apr 05 09:38:54 2013 +0200
@@ -374,15 +374,24 @@
 
 ifeq ($(OPENJDK_TARGET_OS),solaris)
 # On Solaris, if the target is a symlink and exists, cp won't overwrite.
+# Cp has to operate in recursive mode to allow for -P flag, to preserve soft links. If the
+# name of the target file differs from the source file, rename after copy.
 define install-file
 	$(MKDIR) -p $(@D)
 	$(RM) '$@'
 	$(CP) -f -r -P '$<' '$(@D)'
+	if [ "$(@F)" != "$(<F)" ]; then $(MV) '$(@D)/$(<F)' '$@'; fi
 endef
 else ifeq ($(OPENJDK_TARGET_OS),macosx)
+# On mac, extended attributes sometimes creep into the source files, which may later 
+# cause the creation of ._* files which confuses testing. Clear these with xattr if
+# set. Some files get their write permissions removed after being copied to the 
+# output dir. When these are copied again to images, xattr would fail. By only clearing
+# attributes when they are present, failing on this is avoided.
 define install-file
 	$(MKDIR) -p $(@D)
-	$(CP) -fpRP '$<' '$@'
+	$(CP) -fRP '$<' '$@'
+	if [ -n "`$(XATTR) -l '$@'`" ]; then $(XATTR) -c '$@'; fi
 endef
 else
 define install-file