Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
build/make/Makefile.in: Install script packages using sage-spkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jul 21, 2022
1 parent 1b1401d commit d850e60
Showing 1 changed file with 2 additions and 96 deletions.
98 changes: 2 additions & 96 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -574,107 +574,13 @@ $(foreach pkgname,$(PIP_PACKAGES),\
endif

# ============================= script packages ==============================
# Generate build rules for 'script' packages; this template is used to generate
# three rules in the form:
#
# $(INST)/<pkgname>-<pkgvers>: <dependencies>
# $(AM_V_at)cd '$SAGE_ROOT' && \\
# . '$SAGE_ROOT/src/bin/sage-env-config' && \\
# . '$SAGE_ROOT/src/bin/sage-env' && \\
# . '$SAGE_ROOT/build/bin/sage-build-env-config' && \\
# . '$SAGE_ROOT/build/bin/sage-build-env' && \\
# sage-logger -p '$SAGE_ROOT/build/pkgs/<pkgname>/spkg-install' '$(SAGE_LOGS)/<pkgname>.log'
#
# <pkgname>: $(INST)/<pkgname>-<pkgvers>
#
# <pkgname>-clean:
# -$(AM_V_at)cd '$SAGE_ROOT' && \\
# . '$SAGE_ROOT/src/bin/sage-env-config' && \\
# . '$SAGE_ROOT/src/bin/sage-env' && \\
# . '$SAGE_ROOT/build/bin/sage-build-env-config' && \\
# . '$SAGE_ROOT/build/bin/sage-build-env' && \\
# '$SAGE_ROOT/build/pkgs/$PKG_NAME/spkg-uninstall'

# Positional arguments:
# $(1): package name
# $(2): package version
# $(3): package dependencies
# $(4): package tree variable

define SCRIPT_PACKAGE_templ
$(1)-build-deps: $(3)

$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2): $(3)
+$(MAKE_REC) $(1)-$(4)-no-deps

$(1): $$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)

$(1)-$(4)-no-deps:
$(PLUS)@if [ -z '$$($(4))' ]; then \
echo "Error: The installation tree $(4) has been disabled" 2>&1; \
echo "$$($(4)_DISABLED_MESSAGE)" 2>&1; \
exit 1; \
elif [ -x '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install' ]; then \
cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \
. '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \
. '$$(SAGE_ROOT)/src/bin/sage-env-config' && \
. '$$(SAGE_ROOT)/src/bin/sage-env' && \
. '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \
. '$$(SAGE_ROOT)/build/bin/sage-build-env' && \
SAGE_SPKG_WHEELS=$$($(4))/var/lib/sage/wheels \
SAGE_INST_LOCAL=$$($(4)) \
sage-logger -p '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install' '$$(SAGE_LOGS)/$(1)-$(2).log' && \
touch "$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)"; \
else \
echo; \
echo "Error: $(1) is a dummy script package that the Sage distribution uses"; \
echo "to provide information about equivalent system packages."; \
echo "It cannot be installed using the Sage distribution."; \
echo "Please install it manually, for example using the system packages"; \
echo "recommended at the end of a run of './configure'"; \
echo "See below for package-specific information."; \
echo; \
$$(SAGE_ROOT)/build/bin/sage-spkg-info $(1); \
exit 1; \
fi

$(1)-no-deps: $(1)-$(4)-no-deps

$(1)-$(4)-uninstall:
-$(AM_V_at)cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \
. '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \
. '$$(SAGE_ROOT)/src/bin/sage-env-config' && \
. '$$(SAGE_ROOT)/src/bin/sage-env' && \
. '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \
. '$$(SAGE_ROOT)/build/bin/sage-build-env' && \
'$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-uninstall'
-rm -f "$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)"

$(1)-uninstall: $(1)-$(4)-uninstall

$(1)-clean: $(1)-uninstall

# Recursive tox invocation (note - we do not set the environment here).
# Setting SAGE_SPKG_WHEELS is for the benefit of sagelib's tox.ini
$(1)-tox-%: FORCE
$(AM_V_at)cd '$$(SAGE_ROOT)/build/pkgs/$(1)/src' && \
export PATH="$$(SAGE_ORIG_PATH)" && \
SAGE_SPKG_WHEELS=$$(SAGE_LOCAL)/var/lib/sage/wheels \
tox -v -v -v -e $$*

.PHONY: $(1) $(1)-uninstall $(1)-build-deps $(1)-no-deps $(1)-clean

endef

$(foreach pkgname,$(SCRIPT_PACKAGES),\
$(foreach tree, $(trees_$(pkgname)), \
$(eval $(call SCRIPT_PACKAGE_templ,$(pkgname),$(vers_$(pkgname)),$(call pkg_deps,$(pkgname)),$(tree)))))
$(eval $(call NORMAL_PACKAGE_templ,$(pkgname),$(vers_$(pkgname)),$(call pkg_deps,$(pkgname)))))

ifdef DEBUG_RULES
$(info # Rules for script packages)
$(foreach pkgname,$(SCRIPT_PACKAGES),\
$(foreach tree, $(trees_$(pkgname)), \
$(info $(call SCRIPT_PACKAGE_templ,$(pkgname),$(vers_$(pkgname)),$(call pkg_deps,$(pkgname)),$(tree)))))
$(info $(call NORMAL_PACKAGE_templ,$(pkgname),$(vers_$(pkgname)),$(call pkg_deps,$(pkgname)))))
endif

# sagelib depends on this so that its install script is always executed
Expand Down

0 comments on commit d850e60

Please sign in to comment.