Hi

I ran into a couple of issues when installing gprolog-1.5.0:

1. the wildcard character ("*") is not expanded when linking binaries.

Links in $(INSTALL_DIR)/bin are created as:

    $(LN_S) $(INSTALL_DIR)/bin/* .

make won't expand *. (See the pitfalls of using wildcards in make [1]).
For example, installing gprolog on Gentoo Linux via a controlled
sandbox:

   (cd /var/tmp/portage/dev-lang/gprolog-1.5.0/image//usr/bin ; ln -s
-f /var/tmp/portage/dev-lang/gprolog-1.5.0/image//usr/lib64/gprolog-
1.5.0/bin/* .);
   ...
   * QA Notice: Symbolic link /usr/bin/* points to /usr/lib64/gprolog-
1.5.0/bin/* which does not exist
   >>> /usr/bin/* -> /usr/lib64/gprolog-1.5.0/bin/*


Instead the "wildcard" make function can be used for this purpose:

    $(LN_S) $(wildcard $(INSTALL_DIR)/bin/*) .

Another alternative is to use:

    for i in $(BIN_FILES); do $(LN_S) $(INSTALL_DIR)/bin/$$i .; done

2. the install-links rule may run too early

The rule refers to $(INSTALL_DIR)/bin/*. During a parallel make
install-links may run at the same time as install-system, leading to
$(wildcard $(INSTALL_DIR)/bin/*) being partially expanded or even
expanded to nothing. For example:

    (cd /var/tmp/portage/dev-lang/gprolog-1.5.0/image//usr/bin ; ln -s
-f  .);
    ...
    ln: ./.: cannot overwrite directory
    make: *** [Makefile:88: install-links] Error 1

I've attached the patch I'm using on Gentoo Linux.


Thanks

Keri

[1] 
https://www.gnu.org/software/make/manual/html_node/Wildcard-Pitfall.html#Wildcard-Pitfall

--- gprolog-1.5.0.orig/src/Makefile.in	2021-07-07 16:06:16.000000000 -0000
+++ gprolog-1.5.0/src/Makefile.in	2021-07-10 11:30:29.130370996 -0000
@@ -84,10 +84,10 @@
 
 # --- Links --- #
 
-install-links: uninstall-links
+install-links: install-system uninstall-links
 	if test $(LINKS_DIR) != none; then \
 	   ./mkinstalldirs $(LINKS_DIR); \
-	   (cd $(LINKS_DIR) ; $(LN_S) $(INSTALL_DIR)/bin/* .); \
+	   (cd $(LINKS_DIR) ; $(LN_S) $(wildcard $(INSTALL_DIR)/bin/*) .); \
 	fi
 
 uninstall-links:

Reply via email to