debian swirl logo

Back to the packages list openblas

#!/usr/bin/make -f
# Sylvestre Ledru 

include /usr/share/cdbs/1/rules/debhelper.mk

DEB_DH_MAKESHLIBS_ARGS_libopenblas-base = -V "libblas3 | libblas.so.3"

COMMON_MAKE_OPTIONS = NO_LAPACK=1 NO_AFFINITY=1 NO_WARMUP=1
ENABLE_DYNAMIC_ARCHS := amd64 i386 kfreebsd-amd64 kfreebsd-i386
ifneq (,$(findstring $(DEB_HOST_ARCH),$(ENABLE_DYNAMIC_ARCHS)))
	DYNAMIC_ARCH_ARG= "DYNAMIC_ARCH=1"
	TARGET_GENERIC_ARG= "TARGET=GENERIC"
endif

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	DEBUG_ARG= "DEBUG=1"
endif

build: build-arch

build-arch: build-stamp

build-stamp:
	if test "$(TARGET)" = ""; then 		\
				echo "Support multiple architectures"; \
				$(MAKE) $(COMMON_MAKE_OPTIONS) $(DYNAMIC_ARCH_ARG) $(TARGET_GENERIC_ARG) $(DEBUG_ARG) NUM_THREADS=64;		\
		fi

	if test "$(TARGET)" = "custom"; then 		\
				echo "Leave the detection to GotoBLAS / OpenBLAS"; \
				$(MAKE) $(COMMON_MAKE_OPTIONS) $(DEBUG_ARG); 								\
		fi

	if test "$(TARGET)" != "" -a "$(TARGET)" != "custom"; then 		\
				echo "Use the value '$(TARGET)' provided by the user";	\
				$(MAKE) $(COMMON_MAKE_OPTIONS) TARGET=$(TARGET) $(DEBUG_ARG);									\
		fi;

		rm libopenblas.so
		mv libopenblas*-*.so libopenblas.so.0
		ln -s libopenblas.so.0 libopenblas.so
		mv libopenblas*-*.a libopenblas.a
		touch $@

custom: custom-stamp
	dch --local= '+custom'  "custom build on: `uname -a`"
	LANG= C debian/rules TARGET=custom build binary

clean::
		$(MAKE) clean
		rm -f libopenblas.so.0 libblas.so.3

# We want packages linked with -lblas to depend on any BLAS alternative, and we
# want packages linked with -lopenblas to depend specifically on
# libopenblas-base.
#
# Such a setting is not supported by dh_makeshlibs, so we ship a hand-crafted
# shlibs file.
binary-predeb/libopenblas-base::
		cp debian/libopenblas-base.shlibs debian/libopenblas-base/DEBIAN/shlibs

# Build a custom package optimized for the current arch
custom-stamp:

get-orig-source:
		-uscan --upstream-version 0

Builds:

libopenblas-base
optimized blas (linear algebra) library based on gotoblas2
libopenblas-dev
optimized blas (linear algebra) library based on gotoblas2