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

Commit

Permalink
Move all BLAS PC file installation logic to new script package sage_s…
Browse files Browse the repository at this point in the history
…age_system_blas_facade
  • Loading branch information
Matthias Koeppe committed Mar 20, 2020
1 parent 0919086 commit 6781790
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 22 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ ssl: all

misc-clean:
@echo "Deleting build artifacts generated by autoconf, automake, make ..."
-$(MAKE) sage_system_blas_facade-distclean
rm -rf logs
rm -rf dist
rm -rf tmp
Expand Down
13 changes: 8 additions & 5 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ PYTHON = python@SAGE_PYTHON_VERSION@
MP_LIBRARY = @SAGE_MP_LIBRARY@
BLAS = @SAGE_BLAS@

# Because some .pc files are generated at configure time we can't write their
# names explicitly the Makefile, so we use the wildcard function here at make
# runtime
PCFILES = $(subst $(SAGE_SRC),$(SAGE_LOCAL),$(wildcard $(SAGE_SRC)/lib/pkgconfig/*.pc))

# Files to track installation of packages
BUILT_PACKAGES = @SAGE_BUILT_PACKAGES@
DUMMY_PACKAGES = @SAGE_DUMMY_PACKAGES@
Expand Down Expand Up @@ -276,6 +271,14 @@ $$(INST)/$(1)-$(2): $(3)

$(1): $$(INST)/$(1)-$(2)

.PHONY: $(1)-distclean
$(1)-distclean:
-$(AM_V_at)cd '$$(SAGE_ROOT)' && \
source '$$(SAGE_ROOT)/src/bin/sage-env' && \
'$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-distclean'

# The following should actually be $(1)-uninstall,
# see https://trac.sagemath.org/ticket/29097
$(1)-clean:
-$(AM_V_at)cd '$$(SAGE_ROOT)' && \
source '$$(SAGE_ROOT)/src/bin/sage-env' && source '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \
Expand Down
12 changes: 3 additions & 9 deletions build/make/deps
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ download-for-sdist:

# TOOLCHAIN consists of dependencies determined by configure.
# These are built after the "base" target but before anything else.
toolchain: $(foreach pkgname,$(TOOLCHAIN),$(inst_$(pkgname))) $(PCFILES)
toolchain: $(foreach pkgname,$(TOOLCHAIN),$(inst_$(pkgname)))

# Build all packages that GCC links against serially, otherwise this
# leads to race conditions where some library which is used by GCC gets
Expand Down Expand Up @@ -175,9 +175,8 @@ sagelib: \
$(inst_singular) \
$(inst_six) \
$(inst_symmetrica) \
$(inst_zn_poly) \
$(PCFILES)
$(AM_V_at)if [ -z "$$SAGE_INSTALL_FETCH_ONLY" ]; then \
$(inst_zn_poly)
$(AM_V_at)if [ -z "$$SAGE_INSTALL_FETCH_ONLY" ]; then \
cd $(SAGE_SRC) && source bin/sage-env && source $(SAGE_ROOT)/build/bin/sage-build-env-config && \
sage-logger -p 'time $(MAKE) sage' '$(SAGE_LOGS)/sagelib-$(SAGE_VERSION).log'; \
fi
Expand All @@ -191,11 +190,6 @@ sagelib: \
$(SAGE_LOCAL)/bin/%: $(SAGE_SRC)/bin/%
$(AM_V_at)cp $< $@

# Install sage-specific generated .pc files
$(SAGE_PKGCONFIG)/%.pc: $(SAGE_SRC)/lib/pkgconfig/%.pc
@mkdir -p "$(@D)"
$(AM_V_at)cp -P $< $@

###############################################################################
# Building the documentation
###############################################################################
Expand Down
1 change: 0 additions & 1 deletion build/make/install
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ if [ $? -ne 0 ]; then
fi

export SAGE_SHARE="$SAGE_LOCAL/share"
export SAGE_PKGCONFIG="$SAGE_LOCAL/lib/pkgconfig"
export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
. "$SAGE_SRC"/bin/sage-version.sh
Expand Down
3 changes: 2 additions & 1 deletion build/pkgs/gsl/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ SAGE_SPKG_CONFIGURE([gsl], [
AC_CONFIG_COMMANDS([GSLPCPROCESS], [
$SED -e 's/\${GSL_CBLAS_LIB}\ //' \
-e 's/GSL_CBLAS_LIB.*/Requires: cblas/' $GSL_PC \
> "$SAGE_SRC"/lib/pkgconfig/gsl.pc
> build/pkgs/sage_system_blas_facade/src/gsl.pc
AS_VAR_APPEND([SAGE_SYSTEM_BLAS_FACADE_PC_FILES], [gsl.pc])
], [
SED=$ac_cv_path_SED
GSL_PC="$GSLPCDIR"/gsl.pc
Expand Down
14 changes: 8 additions & 6 deletions build/pkgs/openblas/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
SAGE_SPKG_CONFIGURE([openblas], [
SAGE_SPKG_CONFIGURE([openblas], [dnl CHECK
SAGE_SPKG_DEPCHECK([gfortran], [
PKG_CHECK_MODULES([OPENBLAS], [openblas >= 0.2.20], [
PKG_CHECK_VAR([OPENBLASPCDIR], [openblas], [pcfiledir], [
sage_install_blas_pc=yes
AC_SEARCH_LIBS([cblas_dgemm], [openblas], [dnl openblas works as cblas
sage_install_cblas_pc=yes
], [
dnl openblas does not work as cblas; try to use system's cblas as is
dnl openblas does not work as cblas; try to use system cblas as is
PKG_CHECK_MODULES([CBLAS], [cblas], [], [sage_spkg_install_openblas=yes])
])
AC_FC_FREEFORM([AC_FC_FUNC([dgeqrf])])
AC_SEARCH_LIBS([$dgeqrf], [openblas], [dnl openblas works as lapack
sage_install_lapack_pc=yes
], [
dnl openblas does not work as lapack; try to use system's lapack as is
dnl openblas does not work as lapack; try to use system lapack as is
PKG_CHECK_MODULES([LAPACK], [lapack], [], [sage_spkg_install_openblas=yes])
])
], [
Expand All @@ -24,15 +24,17 @@ SAGE_SPKG_CONFIGURE([openblas], [
AS_IF([test x$sage_spkg_install_openblas != xyes], [
m4_foreach([blaslibnam], [blas, cblas, lapack], [
AS_IF([test x$sage_install_]blaslibnam[_pc = xyes], [
AC_CONFIG_LINKS([$SAGE_SRC/lib/pkgconfig/]blaslibnam[.pc:$OPENBLASPCDIR/openblas.pc])])
AC_CONFIG_LINKS([build/pkgs/sage_system_blas_facade/src/]blaslibnam[.pc:$OPENBLASPCDIR/openblas.pc])
AS_VAR_APPEND([SAGE_SYSTEM_BLAS_FACADE_PC_FILES], blaslibnam[.pc])])
AC_SUBST([SAGE_BLAS], [sage_system_blas_facade])
])
])
])
], [
], [dnl REQUIRED-CHECK
AS_IF([test "x$with_blas" = xopenblas], [
sage_require_openblas=yes
sage_require_atlas=no])
], [
], [dnl PRE
AC_MSG_CHECKING([BLAS library])
AC_ARG_WITH([blas],
[AS_HELP_STRING([--with-blas=openblas],
Expand Down
1 change: 1 addition & 0 deletions build/pkgs/sage_system_blas_facade/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/spkg-install
4 changes: 4 additions & 0 deletions build/pkgs/sage_system_blas_facade/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SAGE_SPKG_CONFIGURE([sage_system_blas_facade], [
AC_SUBST([SAGE_SYSTEM_BLAS_FACADE_PC_FILES])
AC_CONFIG_FILES([build/pkgs/sage_system_blas_facade/spkg-install], [chmod +x build/pkgs/sage_system_blas_facade/spkg-install])
])
2 changes: 2 additions & 0 deletions build/pkgs/sage_system_blas_facade/spkg-distclean
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#! /usr/bin/env bash
rm -f build/pkgs/sage_system_blas_facade/src/*.pc
7 changes: 7 additions & 0 deletions build/pkgs/sage_system_blas_facade/spkg-install.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /usr/bin/env bash
PCFILES="@SAGE_SYSTEM_BLAS_FACADE_PC_FILES@"
SAGE_PKGCONFIG="$SAGE_LOCAL/lib/pkgconfig"
mkdir -p "$SAGE_PKGCONFIG"
if [ -n "$PCFILES" ]; then
cd build/pkgs/sage_system_blas_facade/src && cp -P $PCFILES "$SAGE_PKGCONFIG"
fi
File renamed without changes.
1 change: 1 addition & 0 deletions build/pkgs/sage_system_blas_facade/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
script

0 comments on commit 6781790

Please sign in to comment.