common/makefiles/MakeBase.gmk
changeset 16580 6acb502beafa
parent 16419 50dd98738641
child 16583 f29d60d73e42
--- 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