Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gklib] Update, fix android #37877

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ports/gklib/android.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/GKlibSystem.cmake b/GKlibSystem.cmake
index 31a1cf1..848fd05 100644
--- a/GKlibSystem.cmake
+++ b/GKlibSystem.cmake
@@ -113,7 +113,9 @@ endif(GKRAND)


# Check for features.
+if(NOT ANDROID OR ANDROID_NATIVE_API_LEVEL GREATER 32)
check_include_file(execinfo.h HAVE_EXECINFO_H)
+endif()
if(HAVE_EXECINFO_H)
set(GKlib_COPTIONS "${GKlib_COPTIONS} -DHAVE_EXECINFO_H")
endif(HAVE_EXECINFO_H)
95 changes: 49 additions & 46 deletions ports/gklib/build-fixes.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9cd1b4b..a6b629e 100644
index 9cd1b4b..3912b26 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
Expand All @@ -8,80 +8,83 @@ index 9cd1b4b..a6b629e 100644
project(GKlib C)

option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" OFF)
@@ -22,10 +22,12 @@ if(UNIX)
@@ -22,10 +22,11 @@ if(UNIX)
target_link_libraries(GKlib m)
endif(UNIX)

-include_directories("test")
-add_subdirectory("test")
-
-install(TARGETS GKlib
install(TARGETS GKlib
- ARCHIVE DESTINATION lib/${LINSTALL_PATH}
- LIBRARY DESTINATION lib/${LINSTALL_PATH})
-install(FILES ${GKlib_includes} DESTINATION include/${HINSTALL_PATH})
+install(TARGETS GKlib EXPORT GKlibTargets
+ EXPORT GKlibTargets
+ INCLUDES DESTINATION "include/GKlib"
+ )
+install(FILES ${GKlib_includes} DESTINATION "include/GKlib")
+install(FILES "win32/adapt.h" DESTINATION "include/GKlib/win32")
+install(EXPORT GKlibTargets FILE "GKlibTargets.cmake" DESTINATION "share/gklib")
+file(WRITE "${CMAKE_INSTALL_PREFIX}/share/gklib/GKlibConfig.cmake" [=[
+include("${CMAKE_CURRENT_LIST_DIR}/GKlibTargets.cmake")
+]=])
+)
+install(EXPORT GKlibTargets FILE "GKlibConfig.cmake" DESTINATION "share/gklib")
+install(FILES "win32/adapt.h" DESTINATION "include/${HINSTALL_PATH}/win32")
install(FILES ${GKlib_includes} DESTINATION include/${HINSTALL_PATH})
diff --git a/GKlibSystem.cmake b/GKlibSystem.cmake
index d83b208..8019067 100644
index 31a1cf1..172a386 100644
--- a/GKlibSystem.cmake
+++ b/GKlibSystem.cmake
@@ -16,7 +16,6 @@ option(GKRAND "enable GKRAND support" OFF)
@@ -18,7 +18,6 @@ option(NO_X86 "enable NO_X86 support" OFF)

# Add compiler flags.
if(MSVC)
- set(GKlib_COPTS "/Ox")
set(GKlib_COPTIONS "-DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE -DUSE_GKREGEX")
elseif(MINGW)
set(GKlib_COPTS "-DUSE_GKREGEX")
@@ -34,7 +33,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
set(GKlib_COPTIONS "${GKlib_COPTIONS} -fPIC")
@@ -33,6 +32,8 @@ if(CMAKE_COMPILER_IS_GNUCC)
set(GKlib_COPTIONS "${GKlib_COPTIONS} -std=c99 -fno-strict-aliasing")
if(VALGRIND)
set(GKlib_COPTIONS "${GK_COPTIONS} -march=x86-64 -mtune=generic")
+elseif(1)
+ # Use flags from toolchain and triplet
else()
# -march=native is not a valid flag on PPC:
if(CMAKE_SYSTEM_PROCESSOR MATCHES "power|ppc|powerpc|ppc64|powerpc64" OR (APPLE AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc|ppc64"))
@@ -46,6 +47,7 @@ endif(VALGRIND)
endif(NOT MINGW)
# GCC warnings.
- set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label")
+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label")
set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label")
+ string(REPLACE " -Werror " " " GKlib_COPTIONS "${GKlib_COPTIONS}")
elseif(${CMAKE_C_COMPILER_ID} MATCHES "Sun")
# Sun insists on -xc99.
set(GKlib_COPTIONS "${GKlib_COPTIONS} -xc99")
@@ -60,7 +59,7 @@ endif(OPENMP)
@@ -75,6 +77,8 @@ endif(NO_X86)
if(GDB)
set(GKlib_COPTS "${GKlib_COPTS} -g")
set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror")
-else()
+elseif(0)
+elseif(1)
+ # Use flags from toolchain and triplet
else()
set(GKlib_COPTS "-O3")
endif(GDB)
diff --git a/gk_ms_inttypes.h b/gk_ms_inttypes.h
index b89fc10..7247c38 100644
--- a/gk_ms_inttypes.h
+++ b/gk_ms_inttypes.h
@@ -35,6 +35,8 @@

diff --git a/gk_arch.h b/gk_arch.h
index 8c8ac50..122e087 100644
--- a/gk_arch.h
+++ b/gk_arch.h
@@ -31,9 +31,9 @@
#endif
#ifndef _MSC_INTTYPES_H_ // [
#define _MSC_INTTYPES_H_
+#include <inttypes.h>
+#elif 0

#if _MSC_VER > 1000
#pragma once
diff --git a/gk_ms_stdint.h b/gk_ms_stdint.h
index 7e200dc..1c51958 100644
--- a/gk_ms_stdint.h
+++ b/gk_ms_stdint.h
@@ -35,6 +35,8 @@

-#ifdef __MSC__
- #include "ms_stdint.h"
- #include "ms_inttypes.h"
+#ifdef __MSC__
+ #include <stdint.h>
+ #include <inttypes.h>
#include "ms_stat.h"
#include "win32/adapt.h"
#else
@@ -60,9 +60,4 @@ typedef ptrdiff_t ssize_t;
#define PTRDIFF_MAX INT64_MAX
#endif
#ifndef _MSC_STDINT_H_ // [
#define _MSC_STDINT_H_
+#include <stdint.h>
+#elif 0

-/* MSC does not have INFINITY defined */
-#ifndef INFINITY
-#define INFINITY FLT_MAX
-#endif
-
#endif
#if _MSC_VER > 1000
#pragma once
32 changes: 0 additions & 32 deletions ports/gklib/fix-mingw.patch

This file was deleted.

22 changes: 11 additions & 11 deletions ports/gklib/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KarypisLab/GKlib
REF b1cb3bd7f6bf4da641af901c8d455c0f858c816f
SHA512 e906c7af8b40ce1c4c4ea43cbfca3e3970e5595686333ac9ac80c6cbc558feb0e833f530f034161927030edac5272234c6ac9cad5287cb6edab0c0671ba3644c
REF 8bd6bad750b2b0d90800c632cf18e8ee93ad72d7
SHA512 128cd9a48047b18b8013288162556f0b0f1d81845f5445f7cc62590ab28c06ee0a6c602cc999ce268ab27237eca3e8295df6432d377e45071946b98558872997
PATCHES
android.patch
build-fixes.patch
fix-mingw.patch
)

# Delete files that are workarounds for very old copies of msvc.
file(REMOVE "${SOURCE_PATH}/ms_inttypes.h" "${SOURCE_PATH}/ms_stdint.h")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DHINSTALL_PATH=GKlib
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" [=[
gklib provides CMake targets:
find_package(GKlib CONFIG REQUIRED)
target_link_libraries(main PRIVATE GKlib)
]=])
3 changes: 1 addition & 2 deletions ports/gklib/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "gklib",
"version-date": "2022-07-27",
"port-version": 2,
"version-date": "2023-03-27",
"description": "General helper libraries for KarypisLab.",
"homepage": "https://github.com/KarypisLab/GKlib/",
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3021,8 +3021,8 @@
"port-version": 0
},
"gklib": {
"baseline": "2022-07-27",
"port-version": 2
"baseline": "2023-03-27",
"port-version": 0
},
"gl2ps": {
"baseline": "1.4.2",
Expand Down
5 changes: 5 additions & 0 deletions versions/g-/gklib.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "ad20fb84d82834d6de1f5bdf45851eeadd1c01e6",
"version-date": "2023-03-27",
"port-version": 0
},
{
"git-tree": "7f9c6f0e711860da19899fbe78e027d0a5e8cfc1",
"version-date": "2022-07-27",
Expand Down