2 # Copyright (C) 2021 Alexandru Ardelean <ardeleanalex@gmail.com>
5 include $(TOPDIR
)/rules.mk
11 PKG_SOURCE
:=OpenBLAS-
$(PKG_VERSION
).
tar.gz
12 PKG_SOURCE_URL
:=https
://github.com
/OpenMathLib
/OpenBLAS
/releases
/download
/v
$(PKG_VERSION
)/
13 PKG_HASH
:=f1003466ad074e9b0c8d421a204121100b0751c96fc6fcf3d1456bd12f8a00a1
14 PKG_LICENSE
:=BSD-3-Clause
15 PKG_CPE_ID
:=cpe
:/a
:openblas_project
:openblas
16 PKG_MAINTAINER
:=Alexandru Ardelean
<ardeleanalex@gmail.com
>
21 include $(INCLUDE_DIR
)/package.mk
23 define Package
/openblas
26 TITLE
:=An optimized library for BLAS
(Basic Linear Algebra Subprograms
)
27 URL
:=https
://www.openblas.net
/
32 +INSTALL_GFORTRAN
:libgfortran
35 define Package
/openblas
/description
36 OpenBLAS is an optimized BLAS
(Basic Linear Algebra Subprograms
) library
37 based on GotoBLAS2
1.13 BSD version.
40 define Package
/openblas
/config
42 depends on PACKAGE_openblas
44 config OPENBLAS_TARGET_OVERRIDE
46 prompt
"Manual CPU target override (from the OpenBLAS TargetList.txt file)"
51 OPENBLAS_TARGET
=$(call qstrip
,$(CONFIG_OPENBLAS_TARGET_OVERRIDE
))
53 ifeq ($(OPENBLAS_TARGET
),)
54 # initialize to GENERIC as default
55 OPENBLAS_TARGET
:=GENERIC
57 ifneq ($(findstring cortex-a9
,$(CONFIG_CPU_TYPE
)),)
58 ifneq ($(findstring neon
,$(CONFIG_CPU_TYPE
)),)
59 # CORTEXA9 relies on NEON
60 OPENBLAS_TARGET
:=CORTEXA9
62 # Fallback for CPUs without NEON
63 OPENBLAS_TARGET
:=ARMV7
65 else ifneq ($(findstring cortex-a15
,$(CONFIG_CPU_TYPE
)),)
66 OPENBLAS_TARGET
:=CORTEXA15
67 else ifneq ($(findstring cortex-a53
,$(CONFIG_CPU_TYPE
)),)
68 OPENBLAS_TARGET
:=CORTEXA53
69 else ifneq ($(findstring cortex-a72
,$(CONFIG_CPU_TYPE
)),)
70 OPENBLAS_TARGET
:=CORTEXA72
71 else ifeq ($(ARCH
),aarch64
)
72 OPENBLAS_TARGET
:=ARMV8
73 else ifeq ($(ARCH
),arm
)
74 OPENBLAS_TARGET
:=ARMV5
75 else ifeq ($(ARCH
),mips
)
76 OPENBLAS_TARGET
:=MIPS24K
77 else ifeq ($(ARCH
),mipsel
)
78 OPENBLAS_TARGET
:=MIPS24K
79 else ifeq ($(ARCH
),powerpc
)
80 OPENBLAS_TARGET
:=PPC440
81 else ifeq ($(ARCH
),riscv64
)
82 OPENBLAS_TARGET
:=RISCV64_GENERIC
84 endif # ifeq ($(OPENBLAS_TARGET),)
86 ifeq ($(CONFIG_ARCH_64BIT
),y
)
94 CC
=$(TARGET_CC_NOCACHE
) \
95 CXX
=$(TARGET_CXX_NOCACHE
) \
96 HOSTCC
=$(HOSTCC_NOCACHE
) \
97 CROSS_SUFFIX
=$(TARGET_CROSS
) \
98 BINARY
=$(OPENBLAS_BINARY
) \
104 TARGET
=$(call qstrip
,$(OPENBLAS_TARGET
))
106 ifneq ($(CONFIG_INSTALL_GFORTRAN
),y
)
107 MAKE_FLAGS
+= NOFORTRAN
=1
110 define Build
/InstallDev
111 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
112 $(INSTALL_DIR
) $(1)/usr
/include
113 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/* $(1)/usr
/lib
/
114 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
115 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/* $(1)/usr
/lib
/pkgconfig
/
116 $(SED
) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr
/lib
/pkgconfig
/openblas.
pc
117 $(SED
) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr
/lib
/pkgconfig
/openblas.
pc
120 define Package
/openblas
/install
121 $(INSTALL_DIR
) $(1)/usr
/lib
122 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libopenblas
*.so
* $(1)/usr
/lib
/
125 $(eval
$(call BuildPackage
,openblas
))