File 0001-cmake-Don-t-build-the-interpreter-on-ARM.patch of Package hashlink

From 5f294de79b17e9131f9c5fac583ba6c0273f072c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?=
 <jaime.marquinez.ferrandiz@fastmail.net>
Date: Fri, 20 May 2022 18:28:05 +0200
Subject: [PATCH] cmake: Don't build the interpreter on ARM
Upstream: submitted
References: gh#HaxeFoundation/hashlink#521

---
 CMakeLists.txt | 51 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 31 insertions(+), 20 deletions(-)

Index: hashlink-1.14/CMakeLists.txt
===================================================================
--- hashlink-1.14.orig/CMakeLists.txt
+++ hashlink-1.14/CMakeLists.txt
@@ -34,6 +34,11 @@ else()
     set(CMAKE_C_STANDARD_REQUIRED ON)
 endif()
 
+set(INTERPRETER_ENABLED TRUE)
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|aarch64")
+    set(INTERPRETER_ENABLED FALSE)
+endif()
+
 # put output in "bin"
 
 set(OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin)
@@ -165,24 +170,28 @@ set_target_properties(libhl
     COMPILE_DEFINITIONS "_USRDLL;LIBHL_EXPORTS;HAVE_CONFIG_H;PCRE2_CODE_UNIT_WIDTH=16"
 )
 
-add_executable(hl
-    src/code.c
-    src/jit.c
-    src/main.c
-    src/module.c
-    src/debugger.c
-    src/profile.c
-)
+if(INTERPRETER_ENABLED)
+    add_executable(hl
+        src/code.c
+        src/jit.c
+        src/main.c
+        src/module.c
+        src/debugger.c
+        src/profile.c
+    )
 
-if (UNIX AND NOT APPLE)
-    set_target_properties(hl PROPERTIES INSTALL_RPATH "$ORIGIN;${CMAKE_INSTALL_PREFIX}/lib")
-endif()
+    if (UNIX AND NOT APPLE)
+        set_target_properties(hl PROPERTIES INSTALL_RPATH "$ORIGIN;${CMAKE_INSTALL_PREFIX}/lib")
+    endif()
 
-target_link_libraries(hl libhl)
+    target_link_libraries(hl libhl)
+endif()
 
 if(WIN32)
     target_link_libraries(libhl ws2_32 user32)
-    target_link_libraries(hl user32)
+    if(INTERPRETER_ENABLED)
+        target_link_libraries(hl user32)
+    endif()
 else()
     target_link_libraries(libhl m dl pthread)
 endif()
@@ -194,12 +203,7 @@ if(BUILD_TESTING)
         haxe
     )
 
-    set(JIT_TEST_ENABLED TRUE)
-    if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|aarch64")
-        set(JIT_TEST_ENABLED FALSE)
-    endif()
-
-    if(JIT_TEST_ENABLED)
+    if(INTERPRETER_ENABLED)
         #####################
         # hello.hl
 
@@ -235,7 +239,7 @@ if(BUILD_TESTING)
         add_custom_target(uvsample.hl ALL
             DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/uvsample.hl
         )
-    ENDIF(JIT_TEST_ENABLED)
+    ENDIF(INTERPRETER_ENABLED)
 
     #####################
     # hello.c
@@ -307,7 +311,7 @@ if(BUILD_TESTING)
     #####################
     # Tests
 
-    IF(JIT_TEST_ENABLED)
+    IF(INTERPRETER_ENABLED)
         add_test(NAME hello.hl
             COMMAND hl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/hello.hl
         )
@@ -317,7 +321,7 @@ if(BUILD_TESTING)
         add_test(NAME uvsample.hl
             COMMAND hl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test/uvsample.hl 6001
         )
-    ENDIF(JIT_TEST_ENABLED)
+    ENDIF(INTERPRETER_ENABLED)
     add_test(NAME hello
         COMMAND hello
     )
@@ -360,10 +364,15 @@ set(HDLL_DESTINATION
     ${CMAKE_INSTALL_LIBDIR}
 )
 
+
+if(INTERPRETER_ENABLED)
+    set(INSTALL_TARGETS hl libhl)
+else()
+    set(INSTALL_TARGETS libhl)
+endif()
+
 install(
-    TARGETS
-        hl
-        libhl
+    TARGETS ${INSTALL_TARGETS}
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
openSUSE Build Service is sponsored by