Reviewers: lemzwerg,

https://codereview.appspot.com/335520043/diff/1/configure.ac
File configure.ac (right):

https://codereview.appspot.com/335520043/diff/1/configure.ac#newcode66
configure.ac:66: AC_MSG_CHECKING([how to replicate source files to build
files])
On 2018/02/09 07:59:04, lemzwerg wrote:
Any reason why you are using hard links instead of soft links?
And what about using AC_PROG_LN_S instead of this home-brewed macro?

The commands I replaced were hard link commands and I want to minimize
the probability of breaking someone else's build.

Description:
Fix building with a source directory on a different device
https://sourceforge.net/p/testlilyissues/issues/5267/

In configure, check whether hard links between files in the source and
build directories can be created.  If not, fall back on copying.  This
supports building with the source and build directories on different
devices.


Run git diff in the *source* directory.


Ignore .DS_Store files created by macOS Finder. (Not part of fixing
the build, but mighty convenient for me.)

Please review this at https://codereview.appspot.com/335520043/

Affected files (+25, -9 lines):
  M .gitignore
  M Documentation/css/GNUmakefile
  M Documentation/pictures/GNUmakefile
  M GNUmakefile.in
  M config.make.in
  M configure.ac


Index: .gitignore
diff --git a/.gitignore b/.gitignore
index 96f90af558da99f42dbeffda712fc7f2f95a7c74..9b4c796435a501e82b0c026fbca57d1deee9a2b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,6 +28,7 @@
 *~
 *~*
 .\#*
+.DS_Store
 .dotest
 .gdbinit
 .htaccess
Index: Documentation/css/GNUmakefile
diff --git a/Documentation/css/GNUmakefile b/Documentation/css/GNUmakefile
index 5f822237df993f752ff7c3643cf0bf1b0d3f63f7..db8d12e3e7ddfe9b95413f5d24b2d8c34e742966 100644
--- a/Documentation/css/GNUmakefile
+++ b/Documentation/css/GNUmakefile
@@ -20,5 +20,5 @@ endif
 #########
 ### Rules

-$(outdir)/%.css: %.css
-       ln -f $< $@
+$(outdir)/%.css: $(top-src-dir)/Documentation/css/%.css
+       $(LN_SRC_TO_BUILD) $< $@
Index: Documentation/pictures/GNUmakefile
diff --git a/Documentation/pictures/GNUmakefile b/Documentation/pictures/GNUmakefile index 8ae3e463bbe15e7aed5486ded25c7e5a2b2209bf..8f53363046bfa0ee0a161d9b2dfdfe8bdacd2120 100644
--- a/Documentation/pictures/GNUmakefile
+++ b/Documentation/pictures/GNUmakefile
@@ -31,11 +31,11 @@ $(outdir)/%-flat-gray.png: %-flat-gray.png
 $(outdir)/%-flat-bw.png: %-flat-bw.png
        convert -depth 8 -geometry 50x50% $< $@

-$(outdir)/%.png: %.png
-       ln -f $< $@
+$(outdir)/%.png: $(top-src-dir)/Documentation/pictures/%.png
+       $(LN_SRC_TO_BUILD) -f $< $@

-$(outdir)/%.jpg: %.jpg
-       ln -f $< $@
+$(outdir)/%.jpg: $(top-src-dir)/Documentation/pictures/%.jpg
+       $(LN_SRC_TO_BUILD) -f $< $@

 $(outdir)/%.png: %.eps
gs -dAutoRotatePages=/None -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=$@ -sDEVICE=png16m -dEPSCrop -dNOPAUSE -f $< -c quit
Index: GNUmakefile.in
diff --git a/GNUmakefile.in b/GNUmakefile.in
index 76f4515be93f6034c4fd0966788a8ff512afb9b3..da1f6f64e088756e07d20f8e1603ccc3a102053e 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -316,9 +316,13 @@ test:
        $(MAKE) -C input/regression/lilypond-book out=test local-test

 test-baseline:
-       @if test -d .git ; then \
- $(if $(shell git diff), echo "commit before base lining" && false,true) ; \
-       fi
+       @cd $(top-src-dir) && \
+               if test -d .git ; then \
+                       if ! git diff --exit-code > /dev/null ; then \
+                               echo "*** commit before base lining" 1>&2; \
+                               exit 1; \
+                       fi \
+               fi
        $(MAKE)
        $(MAKE) test
        $(MAKE) out=test -C input/regression local-test-baseline
Index: config.make.in
diff --git a/config.make.in b/config.make.in
index 3bf17671a029f0b3123277d98e0afb322fe415d9..420600ae8e5327a676be2940362e457ba6b6c3ce 100644
--- a/config.make.in
+++ b/config.make.in
@@ -128,6 +128,7 @@ LD = @LD@
 LINK_GXX_STATICALLY = @LINK_GXX_STATICALLY@
 LN = @LN@
 LN_S = @LN_S@
+LN_SRC_TO_BUILD = @LN_SRC_TO_BUILD@
 MAKEINFO_PROGRAM = @MAKEINFO@
 TEXI2HTML_PROGRAM = @TEXI2HTML@
 METAFONT = @METAFONT@ -progname=mf
Index: configure.ac
diff --git a/configure.ac b/configure.ac
index ead1814a885576919f1c7933a158617cb593bd5c..0aaa4412e303694fa5b8afd770e740dc24d793a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,16 @@ AC_ARG_ENABLE(static-gxx,
     [LINK_GXX_STATICALLY=$enableval])
 AC_SUBST(LINK_GXX_STATICALLY)

+AC_MSG_CHECKING([how to replicate source files to build files])
+if ln $srcdir/configure.ac dummy 2>/dev/null ; then
+    LN_SRC_TO_BUILD="ln"
+    rm -f dummy
+else
+    LN_SRC_TO_BUILD="cp -p"
+fi
+AC_MSG_RESULT($LN_SRC_TO_BUILD)
+AC_SUBST(LN_SRC_TO_BUILD)
+
 # must come before any header checks
 STEPMAKE_COMPILE




_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to