[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gprolog install-links Makefile rule

From: Keri Harris
Subject: gprolog install-links Makefile rule
Date: Sat, 10 Jul 2021 13:53:39 +0200
User-agent: Evolution 3.36.5-0ubuntu1


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.



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

Attachment: gprolog-1.5.0-links.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]