changeset 2262:731f4c50030c

Hardlink to files in the source directory from the build directory, if possible. 2010-06-14 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: (SRC_DIR_LINK): Use reflink only if hard linking is not possible. (generated.stamp): Replace $(REFLINK) with $(SRC_DIR_LINK). (liveconnect-dist.stamp): Likewise. (netx-dist.stamp): Likewise. * acinclude.m4: (IT_CAN_HARDLINK_TO_SOURCE_TREE): Check if hardlinking to files in the source directory from the build directory is possible. * configure.ac: Invoke IT_CAN_HARDLINK_TO_SOURCE_TREE.
author Andrew John Hughes <ahughes@redhat.com>
date Mon, 14 Jun 2010 17:17:14 +0100
parents 7dd1a3ba46d2
children bee59676264f
files ChangeLog Makefile.am acinclude.m4 configure.ac
diffstat 4 files changed, 41 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jun 14 16:27:40 2010 +0100
+++ b/ChangeLog	Mon Jun 14 17:17:14 2010 +0100
@@ -1,9 +1,27 @@
+2010-06-14  Andrew John Hughes  <ahughes@redhat.com>
+
+	* Makefile.am:
+	(SRC_DIR_LINK): Use reflink only if hard
+	linking is not possible.
+	(generated.stamp): Replace $(REFLINK) with
+	$(SRC_DIR_LINK).
+	(liveconnect-dist.stamp): Likewise.
+	(netx-dist.stamp): Likewise.
+	* acinclude.m4:
+	(IT_CAN_HARDLINK_TO_SOURCE_TREE): Check if hardlinking
+	to files in the source directory from the build directory
+	is possible.
+	* configure.ac:
+	Invoke IT_CAN_HARDLINK_TO_SOURCE_TREE.
+
 2010-06-14  Andrew John Hughes  <ahughes@redhat.com>
 
 	* Makefile.am:
 	(REFLINK): Remove unneeded quotation.
 	(OPENJDK_SRC_DIR_LINK): Use reflink only
 	if hard linking is not possible.
+	(extract-openjdk.stamp): Replace $(REFLINK)
+	with $(OPENJDK_SRC_DIR_LINK).
 	* acinclude.m4:
 	(IT_CP_SUPPORTS_REFLINK): Define once only.
 	(WITH_OPENJDK_SRC_DIR): Define once only.
--- a/Makefile.am	Mon Jun 14 16:27:40 2010 +0100
+++ b/Makefile.am	Mon Jun 14 17:17:14 2010 +0100
@@ -246,6 +246,12 @@
   OPENJDK_SRC_DIR_LINK = $(REFLINK)
 endif
 
+if SRC_DIR_HARDLINKABLE
+  SRC_DIR_LINK = -l
+else
+  SRC_DIR_LINK = $(REFLINK)
+endif
+
 # Target to ensure a patched OpenJDK tree containing Zero & Shark
 # and any overlays is available in $(abs_top_builddir)/openjdk
 OPENJDK_TREE = stamps/overlay.stamp
@@ -1428,7 +1434,7 @@
 stamps/generated.stamp: stamps/ports.stamp
 	set -e ; \
 	if [ ! -e $(abs_top_builddir)/generated ]; then \
-	  cp -pPR $(REFLINK) $(abs_top_srcdir)/generated $(abs_top_builddir); \
+	  cp -pPR $(SRC_DIR_LINK) $(abs_top_srcdir)/generated $(abs_top_builddir); \
 	  find $(abs_top_builddir)/generated -type f -exec chmod 640 '{}' ';' \
 	    -o -type d -exec chmod 750 '{}' ';'; \
 	fi
@@ -2080,7 +2086,7 @@
 	  (cd $(LIVECONNECT_CLASSES) ; \
 	   mkdir -p lib ; \
 	   $(ICEDTEA_BOOT_DIR)/bin/jar cf $(LIVECONNECT_JAR) $(LIVECONNECT_DIR) ; \
-	   cp -pPR $(REFLINK) $(PLUGIN_SRCDIR)/java src; \
+	   cp -pPR $(SRC_DIR_LINK) $(PLUGIN_SRCDIR)/java src; \
 	   find src -type f -exec chmod 640 '{}' ';' -o -type d -exec chmod 750 '{}' ';'; \
 	   cd src ; \
 	   $(ZIP) -qr $(LIVECONNECT_SRC) ${LIVECONNECT_DIR} ) ; \
@@ -2117,7 +2123,7 @@
 	(cd $(NETX_CLASSES) ; \
 	 mkdir -p lib ; \
 	 $(ICEDTEA_BOOT_DIR)/bin/jar cf $(NETX_JAR) javax/jnlp net ; \
-	 cp -pPR $(REFLINK) $(NETX_SRCDIR) src; \
+	 cp -pPR $(SRC_DIR_LINK) $(NETX_SRCDIR) src; \
 	 find src -type f -exec chmod 640 '{}' ';' -o -type d -exec chmod 750 '{}' ';'; \
 	 cd src ; \
 	 $(ICEDTEA_BOOT_DIR)/bin/jar uf $(NETX_JAR) \
--- a/acinclude.m4	Mon Jun 14 16:27:40 2010 +0100
+++ b/acinclude.m4	Mon Jun 14 17:17:14 2010 +0100
@@ -289,6 +289,19 @@
   AM_CONDITIONAL(OPENJDK_SRC_DIR_HARDLINKABLE, test "x${openjdk_src_dir_hardlinkable}" = "xyes")
 ])
 
+AC_DEFUN_ONCE([IT_CAN_HARDLINK_TO_SOURCE_TREE],
+[
+  AC_CACHE_CHECK([if we can hard link rather than copy from ${abs_top_srcdir}], it_cv_hardlink_src, [
+    if cp -l ${abs_top_srcdir}/README tmp.$$ >&AS_MESSAGE_LOG_FD 2>&1; then
+      it_cv_hardlink_src=yes;
+    else
+      it_cv_hardlink_src=no;
+    fi
+    rm -f tmp.$$
+  ])
+  AM_CONDITIONAL([SRC_DIR_HARDLINKABLE], test x"${it_cv_hardlink_src}" = "xyes")
+])
+
 AC_DEFUN([FIND_ECJ_JAR],
 [
   AC_MSG_CHECKING([for an ecj JAR file])
--- a/configure.ac	Mon Jun 14 16:27:40 2010 +0100
+++ b/configure.ac	Mon Jun 14 17:17:14 2010 +0100
@@ -49,6 +49,7 @@
 AC_CHECK_GCC_VERSION
 IT_FIND_NUMBER_OF_PROCESSORS
 IT_CP_SUPPORTS_REFLINK
+IT_CAN_HARDLINK_TO_SOURCE_TREE
 
 AC_MSG_CHECKING([for a NetBeans installation])
 AC_ARG_WITH([netbeans-home],