libiio: fix pkgconfig paths
[feed/packages.git] / libs / openblas / Makefile
1 #
2 # Copyright (C) 2021 Alexandru Ardelean <ardeleanalex@gmail.com>
3 #
4
5 include $(TOPDIR)/rules.mk
6
7 PKG_NAME:=OpenBLAS
8 PKG_VERSION:=0.3.26
9 PKG_RELEASE:=2
10
11 PKG_SOURCE:=OpenBLAS-$(PKG_VERSION).tar.gz
12 PKG_SOURCE_URL:=https://github.com/xianyi/OpenBLAS/releases/download/v$(PKG_VERSION)/
13 PKG_HASH:=4e6e4f5cb14c209262e33e6816d70221a2fe49eb69eaf0a06f065598ac602c68
14 PKG_LICENSE:=BSD-3-Clause
15 PKG_CPE_ID:=cpe:/a:openblas_project:openblas
16 PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
17
18 PKG_BUILD_PARALLEL:=1
19 PKG_INSTALL:=1
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/openblas
24 SECTION:=libs
25 CATEGORY:=Libraries
26 TITLE:=An optimized library for BLAS (Basic Linear Algebra Subprograms)
27 URL:=https://www.openblas.net/
28 DEPENDS:= \
29 @!arc \
30 @!powerpc \
31 @!SOFT_FLOAT \
32 +INSTALL_GFORTRAN:libgfortran
33 endef
34
35 define Package/openblas/description
36 OpenBLAS is an optimized BLAS (Basic Linear Algebra Subprograms) library
37 based on GotoBLAS2 1.13 BSD version.
38 endef
39
40 define Package/openblas/config
41 menu "Configuration"
42 depends on PACKAGE_openblas
43
44 config OPENBLAS_TARGET_OVERRIDE
45 string
46 prompt "Manual CPU target override (from the OpenBLAS TargetList.txt file)"
47
48 endmenu
49 endef
50
51 OPENBLAS_TARGET=$(call qstrip,$(CONFIG_OPENBLAS_TARGET_OVERRIDE))
52
53 ifeq ($(OPENBLAS_TARGET),)
54 # initialize to GENERIC as default
55 OPENBLAS_TARGET:=GENERIC
56
57 ifneq ($(findstring cortex-a9,$(CONFIG_CPU_TYPE)),)
58 ifneq ($(findstring neon,$(CONFIG_CPU_TYPE)),)
59 # CORTEXA9 relies on NEON
60 OPENBLAS_TARGET:=CORTEXA9
61 else
62 # Fallback for CPUs without NEON
63 OPENBLAS_TARGET:=ARMV7
64 endif
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
83 endif
84 endif # ifeq ($(OPENBLAS_TARGET),)
85
86 ifeq ($(CONFIG_ARCH_64BIT),y)
87 OPENBLAS_BINARY:=64
88 else
89 OPENBLAS_BINARY:=32
90 endif
91
92 MAKE_FLAGS += \
93 CROSS=1 \
94 CC=$(TARGET_CC_NOCACHE) \
95 CXX=$(TARGET_CXX_NOCACHE) \
96 HOSTCC=$(HOSTCC_NOCACHE) \
97 CROSS_SUFFIX=$(TARGET_CROSS) \
98 BINARY=$(OPENBLAS_BINARY) \
99 MAKE_NB_JOBS=-1 \
100 NUM_THREADS=2 \
101 PREFIX=/usr \
102 COMMON_OPT="" \
103 TARGET=$(call qstrip,$(OPENBLAS_TARGET))
104
105 ifneq ($(CONFIG_INSTALL_GFORTRAN),y)
106 MAKE_FLAGS += NOFORTRAN=1
107 endif
108
109 define Build/InstallDev
110 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
111 $(INSTALL_DIR) $(1)/usr/include
112 $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
113 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
114 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig/
115 endef
116
117 define Package/openblas/install
118 $(INSTALL_DIR) $(1)/usr/lib
119 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenblas*.so* $(1)/usr/lib/
120 endef
121
122 $(eval $(call BuildPackage,openblas))