Skip to content

Commit

Permalink
fix: unable to install with the combination of the installed make and…
Browse files Browse the repository at this point in the history
… target version
  • Loading branch information
yacchi committed Jul 9, 2021
1 parent eca7e1d commit 7075ad2
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
os:
- ubuntu-latest
- macos-latest
version:
- 3.82
- 4.2.1
- 4.3
runs-on: ${{ matrix.os }}
steps:
- name: Set output
Expand All @@ -26,3 +30,4 @@ jobs:
with:
command: make --version
gitref: ${{ steps.vars.outputs.short_ref }}
version: ${{ matrix.version }}
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
TEST_VERSIONS := $(shell bin/list-all)
TEST_PREFIX := test-
TEST_GOALS := $(addprefix $(TEST_PREFIX), $(TEST_VERSIONS))
TEST_CACHE_DIR := .test_cache

TEST_DOWNLOAD_DIR := downloads
TEST_INSTALL_DIR := installs
TEST_COMMAND := $(TEST_INSTALL_DIR)/bin/make --version

all:

$(TEST_GOALS):
$(eval TEST_VERSION := $(subst $(TEST_PREFIX),,$@))
$(eval TEST_DIR := $(PWD)/$(TEST_CACHE_DIR)/$(TEST_VERSION))
mkdir -p $(TEST_CACHE_DIR)/$(TEST_VERSION)

ASDF_INSTALL_VERSION=$(TEST_VERSION) \
ASDF_DOWNLOAD_PATH=$(TEST_DIR)/$(TEST_DOWNLOAD_DIR) \
bin/download

ASDF_INSTALL_VERSION=$(TEST_VERSION) \
ASDF_DOWNLOAD_PATH=$(TEST_DIR)/$(TEST_DOWNLOAD_DIR) \
ASDF_INSTALL_TYPE=version \
ASDF_INSTALL_PATH=$(TEST_DIR)/$(TEST_INSTALL_DIR) \
bin/install

$(TEST_DIR)/$(TEST_COMMAND)

test-all: $(TEST_GOALS)

clean: $(TEST_CACHE_DIR)
24 changes: 9 additions & 15 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ install_version() {
cd "$ASDF_DOWNLOAD_PATH"

echo "* Installing $TOOL_NAME release $version..."
# If the make command is not installed on system, may get an error like the following:
# If the make command is not installed on system old version, may get an error like the following:
#
# config.status: error: Something went wrong bootstrapping makefile fragments
# for automatic dependency tracking. Try re-running configure with the
Expand All @@ -85,22 +85,16 @@ install_version() {
# If try to make install in this state, the installation will fail because the
# Makefile of the po directory does not exist.
#
# So, if make is not installed on system, first run configure to generate build.sh.
# Will not use make, which is installed on the system, to ensure a reliable build.
# First run configure to generate build.sh.
# Then, configure to use the make generated by build.sh and run configure again.
# At this time, can speed up second time configure by enabling configure caching (-C).
if hash make; then
{
./configure --prefix="$install_path"
make && make install
} &>"$install_log"
else
{
./configure -C --prefix="$install_path"
./build.sh &&
PATH=$ASDF_DOWNLOAD_PATH:$PATH /configure -C --prefix="$install_path" &&
./make install
} &>"$install_log"
fi
{
./configure -C --prefix="$install_path"
./build.sh &&
PATH=$ASDF_DOWNLOAD_PATH:$PATH ./configure -C --prefix="$install_path" &&
./make install
} &>"$install_log"

local tool_cmd
tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)"
Expand Down

0 comments on commit 7075ad2

Please sign in to comment.