Files
haikuports/dev-embedded/stlink/patches/stlink-1.6.1.patchset
Jerome Duval 9b9346f6c2 stlink: remove dependency on libssp
__stack_chk_fail is provided by libroot
2021-10-14 20:22:10 +02:00

81 lines
2.7 KiB
Plaintext

From e55d31a95f0515bdcb138d27c29581df3b42e6ad Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Thu, 1 Oct 2020 21:37:16 +1000
Subject: Fix for Haiku
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8628277..dec48d4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -178,6 +178,8 @@ if (APPLE) # ... with Apple macOS libraries
target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} ${SSP_LIB} ${ObjC} ${CoreFoundation} ${IOKit})
elseif (WIN32) # ... with Windows libraries
target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} ${SSP_LIB} wsock32 ws2_32)
+elseif (HAIKU)
+ target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} ${SSP_LIB} network bsd)
else ()
target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} ${SSP_LIB})
endif ()
@@ -213,6 +215,8 @@ if (APPLE) # ... with Apple macOS libraries
target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY} ${SSP_LIB} ${ObjC} ${CoreFoundation} ${IOKit})
elseif (WIN32) # ... with Windows libraries
target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY} ${SSP_LIB} wsock32 ws2_32)
+elseif (HAIKU)
+ target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY} ${SSP_LIB} network bsd)
else ()
target_link_libraries(${STLINK_LIB_STATIC} ${LIBUSB_LIBRARY} ${SSP_LIB})
endif ()
diff --git a/src/libusb_settings.h b/src/libusb_settings.h
index c2e2df9..65d8982 100644
--- a/src/libusb_settings.h
+++ b/src/libusb_settings.h
@@ -33,6 +33,8 @@
#define MINIMAL_API_VERSION 0x01000102 // v1.0.16
#elif defined (__linux__)
#define MINIMAL_API_VERSION 0x01000104 // v1.0.20
+#elif defined (__HAIKU__)
+ #define MINIMAL_API_VERSION 0x01000107 // v1.0.23
#elif defined (__APPLE__)
#define MINIMAL_API_VERSION 0x01000104 // v1.0.20
#elif defined (_WIN32)
--
2.30.2
From 469c5d5fdbebd58b4310b86c29b1963366fc2958 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 14 Oct 2021 17:31:10 +0200
Subject: __stack_chk_fail can be provided by libc
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dec48d4..8800a30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,13 +67,16 @@ if (STLINK_HAVE_UNISTD_H)
add_definitions(-DSTLINK_HAVE_UNISTD_H)
endif ()
+include(CheckFunctionExists)
include(CheckLibraryExists)
-CHECK_LIBRARY_EXISTS(ssp __stack_chk_fail "" _stack_chk_fail_exists)
-if (_stack_chk_fail_exists)
- set(SSP_LIB -static ssp)
-else ()
- set(SSP_LIB "")
+set(SSP_LIB "")
+CHECK_FUNCTION_EXISTS(__stack_chk_fail HAVE_STACK_CHK_FAIL)
+if (NOT HAVE_STACK_CHK_FAIL)
+ CHECK_LIBRARY_EXISTS(ssp __stack_chk_fail "" _stack_chk_fail_exists)
+ if (_stack_chk_fail_exists)
+ set(SSP_LIB -static ssp)
+ endif ()
endif ()
--
2.30.2