Skip to content

Commit

Permalink
fix and rename pkgconfig file
Browse files Browse the repository at this point in the history
  • Loading branch information
mattip committed Jan 21, 2024
1 parent 2893245 commit 580b9c8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
31 changes: 26 additions & 5 deletions patches/0001-create-a-single-shared-object.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
From 80863b52c024ed2d5fda80546e7b6a0160531b9a Mon Sep 17 00:00:00 2001
From e5f32d54b742caf4e59ef6e7ec0caa16b7f670d3 Mon Sep 17 00:00:00 2001
From: mattip <matti.picus@gmail.com>
Date: Sun, 21 Jan 2024 08:35:54 +0200
Date: Sun, 21 Jan 2024 22:34:48 +0200
Subject: [PATCH] create a single shared object

---
Makefile | 10 ----------
Makefile.install | 15 ---------------
Makefile.install | 16 +---------------
Makefile.system | 3 +++
exports/Makefile | 4 ++--
4 files changed, 5 insertions(+), 27 deletions(-)
openblas.pc.in | 2 +-
5 files changed, 7 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile
index 8621a8b3f..56a449306 100644
Expand Down Expand Up @@ -71,7 +72,7 @@ index 8621a8b3f..56a449306 100644
do if test -d $$d; then \
$(MAKE) -C $$d $(@F) || exit 1 ; \
diff --git a/Makefile.install b/Makefile.install
index 01899b970..105bc4271 100644
index 01899b970..958fb9957 100644
--- a/Makefile.install
+++ b/Makefile.install
@@ -90,30 +90,20 @@ endif
Expand Down Expand Up @@ -122,6 +123,14 @@ index 01899b970..105bc4271 100644
endif

endif
@@ -162,6 +147,7 @@ endif

@echo Generating $(LIBSONAMEBASE)$(SUFFIX64).pc in "$(DESTDIR)$(OPENBLAS_PKGCONFIG_DIR)"
@echo 'libdir='$(OPENBLAS_LIBRARY_DIR) > "$(PKGFILE)"
+ @echo 'libprefix='$(SYBOLPREFIX) > "$(PKGFILE)"
@echo 'libsuffix='$(SYMBOLSUFFIX) >> "$(PKGFILE)"
@echo 'includedir='$(OPENBLAS_INCLUDE_DIR) >> "$(PKGFILE)"
@echo 'openblas_config= USE_64BITINT='$(INTERFACE64) 'DYNAMIC_ARCH='$(DYNAMIC_ARCH) 'DYNAMIC_OLDER='$(DYNAMIC_OLDER) 'NO_CBLAS='$(NO_CBLAS) 'NO_LAPACK='$(NO_LAPACK) 'NO_LAPACKE='$(NO_LAPACKE) 'NO_AFFINITY='$(NO_AFFINITY) 'USE_OPENMP='$(USE_OPENMP) $(CORE) 'MAX_THREADS='$(NUM_THREADS)>> "$(PKGFILE)"
diff --git a/Makefile.system b/Makefile.system
index 30b0ddec2..b2c92b99a 100644
--- a/Makefile.system
Expand Down Expand Up @@ -158,6 +167,18 @@ index 7682f851d..632fa324b 100644
endif

ifeq (, $(SYMBOLPREFIX)$(SYMBOLSUFFIX))
diff --git a/openblas.pc.in b/openblas.pc.in
index 8ad6e8bee..33209293d 100644
--- a/openblas.pc.in
+++ b/openblas.pc.in
@@ -2,6 +2,6 @@ Name: openblas
Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version
Version: ${version}
URL: https://github.com/xianyi/OpenBLAS
-Libs: -L${libdir} -lopenblas${libsuffix}
+Libs: -L${libdir} -l${libprefix}openblas${libsuffix}
Libs.private: ${extralib}
Cflags: -I${includedir}
--
2.34.1

6 changes: 4 additions & 2 deletions tools/build_openblas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ cp -f "${static_libname}.renamed" "$openblas_root/$build_bits/lib/${DLL_BASENAME

cd $openblas_root
# Copy library link file for custom name
cd $build_bits/lib
pushd $build_bits/lib
cp ${our_wd}/OpenBLAS/exports/${DLL_BASENAME}.def ${DLL_BASENAME}.def
# At least for the mingwpy wheel, we have to use the VC tools to build the
# export library. Maybe fixed in later binutils by patch referred to in
Expand All @@ -135,7 +135,9 @@ dlltool --input-def ${DLL_BASENAME}.def \
--output-lib ${DLL_BASENAME}.lib
# Replace the DLL name with the generated name.
sed -i "s/ -lopenblas.*$/ -l${DLL_BASENAME:3}/g" pkgconfig/openblas*.pc
cd ../..
cd pkgconfig
for f in openblas*.pc; do mv $f scipy-$f; done
popd
# Build template site.cfg for using this build
cat > ${build_bits}/site.cfg.template << EOF
[openblas${SYMBOLSUFFIX}]
Expand Down
7 changes: 6 additions & 1 deletion tools/build_steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,17 @@ function do_build_lib {
cp -f "OpenBLAS/${renamed_libname}" "$BUILD_PREFIX/lib/${static_libname}"
# set +x
fi

pushd $BUILD_PREFIX/lib/pkgconfig
for f in openblas*; do mv $f scipy-$f; done
popd

local out_name="openblas${symbolsuffix}-${version}-${plat_tag}${suff}.tar.gz"
tar zcvf libs/$out_name \
$BUILD_PREFIX/include/*blas* \
$BUILD_PREFIX/include/*lapack* \
$BUILD_PREFIX/lib/libscipy_openblas* \
$BUILD_PREFIX/lib/pkgconfig/openblas* \
$BUILD_PREFIX/lib/pkgconfig/scipy-openblas* \
$BUILD_PREFIX/lib/cmake/openblas
}

Expand Down

0 comments on commit 580b9c8

Please sign in to comment.