git: 8bafc25ae4f4 - main - math/libdivide: Add NATIVE option

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Fri, 21 Jul 2023 08:03:15 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8bafc25ae4f48be3af984c4be1b9cd0d7a181350

commit 8bafc25ae4f48be3af984c4be1b9cd0d7a181350
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-07-21 07:56:35 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-07-21 08:03:10 +0000

    math/libdivide: Add NATIVE option
    
    PR:             272497
    Approved by:    thierry@ (maintainer)
---
 math/libdivide/Makefile                   | 5 +++++
 math/libdivide/files/patch-CMakeLists.txt | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/math/libdivide/Makefile b/math/libdivide/Makefile
index b2046853b51b..764f37805bd0 100644
--- a/math/libdivide/Makefile
+++ b/math/libdivide/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	libdivide
 DISTVERSION=	5.0
+PORTREVISION=	1
 CATEGORIES=	math
 
 MAINTAINER=	thierry@FreeBSD.org
@@ -24,6 +25,10 @@ PLIST_FILES=	include/libdivide.h	\
 		lib/cmake/libdivide/libdivideConfig.cmake	\
 		lib/cmake/libdivide/libdivideConfigVersion.cmake
 
+OPTIONS_DEFINE=		NATIVE
+
+NATIVE_CMAKE_BOOL=	FREEBSD_NATIVE
+
 do-test:
 	${CONFIGURE_WRKSRC}/tester
 
diff --git a/math/libdivide/files/patch-CMakeLists.txt b/math/libdivide/files/patch-CMakeLists.txt
index b89ebfba8f21..4cb7764bb3f4 100644
--- a/math/libdivide/files/patch-CMakeLists.txt
+++ b/math/libdivide/files/patch-CMakeLists.txt
@@ -13,7 +13,7 @@
  )
  
  # Build options ################################################
-@@ -93,7 +93,6 @@ if (BUILD_TESTS AND NOT CMAKE_CROSSCOMPILING)
+@@ -93,11 +93,10 @@ if (BUILD_TESTS AND NOT CMAKE_CROSSCOMPILING)
          CPU_ARM_NEON)
      if (CPU_X86 OR CPU_ARM_NEON)
          cmake_push_check_state()
@@ -21,3 +21,8 @@
          check_cxx_compiler_flag(-march=native MARCH_NATIVE)
          cmake_pop_check_state()
  
+-        if (MARCH_NATIVE)
++        if (MARCH_NATIVE AND FREEBSD_NATIVE)
+             list(APPEND LIBDIVIDE_FLAGS "-march=native")
+         endif()
+     endif()