You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
2.6 KiB

  1. #
  2. # Copyright (C) 2021 Alexandru Ardelean <ardeleanalex@gmail.com>
  3. #
  4. include $(TOPDIR)/rules.mk
  5. PKG_NAME:=OpenBLAS
  6. PKG_VERSION:=0.3.18
  7. PKG_RELEASE:=$(AUTORELEASE)
  8. PKG_SOURCE:=OpenBLAS-$(PKG_VERSION).tar.gz
  9. PKG_SOURCE_URL:=https://github.com/xianyi/OpenBLAS/releases/download/v$(PKG_VERSION)/
  10. PKG_HASH:=1632c1e8cca62d8bed064b37747e331a1796fc46f688626337362bf0d16aeadb
  11. PKG_LICENSE:=BSD 3-Clause
  12. PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
  13. PKG_BUILD_PARALLEL:=1
  14. PKG_INSTALL:=1
  15. include $(INCLUDE_DIR)/package.mk
  16. define Package/openblas
  17. SECTION:=libs
  18. CATEGORY:=Libraries
  19. TITLE:=An optimized library for BLAS (Basic Linear Algebra Subprograms)
  20. URL:=https://www.openblas.net/
  21. DEPENDS:= \
  22. @!arc \
  23. @!powerpc \
  24. +INSTALL_GFORTRAN:libgfortran
  25. endef
  26. define Package/openblas/description
  27. OpenBLAS is an optimized BLAS (Basic Linear Algebra Subprograms) library
  28. based on GotoBLAS2 1.13 BSD version.
  29. endef
  30. define Package/openblas/config
  31. menu "Configuration"
  32. depends on PACKAGE_openblas
  33. config OPENBLAS_TARGET_OVERRIDE
  34. string
  35. prompt "Manual CPU target override (from the OpenBLAS TargetList.txt file)"
  36. endmenu
  37. endef
  38. OPENBLAS_TARGET=$(call qstrip,$(CONFIG_OPENBLAS_TARGET_OVERRIDE))
  39. CPU_TYPE=$(call qstrip,$(CONFIG_CPU_TYPE))
  40. ifeq ($(OPENBLAS_TARGET),)
  41. # initialize to GENERIC as default
  42. OPENBLAS_TARGET:=GENERIC
  43. ifeq ($(ARCH),aarch64)
  44. OPENBLAS_TARGET:=ARMV8
  45. else ifeq ($(ARCH),arm)
  46. OPENBLAS_TARGET:=ARMV5
  47. else ifeq ($(ARCH),mips)
  48. ifneq ($(filter 24k% 74k%,$(CPU_TYPE)),)
  49. OPENBLAS_TARGET:=MIPS24K
  50. endif # CPU_TYPE == 24k* or 74k*
  51. else ifeq ($(ARCH),mipsel)
  52. ifneq ($(filter 24k% 74k%,$(CPU_TYPE)),)
  53. OPENBLAS_TARGET:=MIPS24K
  54. endif # CPU_TYPE == 24k* or 74k*
  55. else ifeq ($(ARCH),powerpc)
  56. OPENBLAS_TARGET:=PPC440
  57. endif
  58. endif # ifeq ($(OPENBLAS_TARGET),)
  59. ifeq ($(CONFIG_ARCH_64BIT),y)
  60. OPENBLAS_BINARY:=64
  61. else
  62. OPENBLAS_BINARY:=32
  63. endif
  64. MAKE_FLAGS += \
  65. CROSS=1 \
  66. HOSTCC=$(HOSTCC_NOCACHE) \
  67. CROSS_SUFFIX=$(TARGET_CROSS) \
  68. BINARY=$(OPENBLAS_BINARY) \
  69. MAKE_NB_JOBS=-1 \
  70. NUM_THREADS=2 \
  71. PREFIX=/usr \
  72. COMMON_OPT="" \
  73. TARGET=$(call qstrip,$(OPENBLAS_TARGET))
  74. ifneq ($(CONFIG_INSTALL_GFORTRAN),y)
  75. MAKE_FLAGS += NOFORTRAN=1
  76. endif
  77. define Build/InstallDev
  78. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  79. $(INSTALL_DIR) $(1)/usr/include
  80. $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
  81. $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
  82. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig/
  83. endef
  84. define Package/openblas/install
  85. $(INSTALL_DIR) $(1)/usr/lib
  86. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenblas*.so* $(1)/usr/lib/
  87. endef
  88. $(eval $(call BuildPackage,openblas))