Skip to content

Commit 85aaf8e

Browse files
committed
[libfyaml] new port
Needed for appstream port
1 parent 80f9bcf commit 85aaf8e

5 files changed

Lines changed: 117 additions & 0 deletions

File tree

ports/libfyaml/portfile.cmake

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Don't change to vcpkg_from_github! This points to a release and not an archive
2+
vcpkg_download_distfile(ARCHIVE
3+
URLS "https://github.com/pantoniou/libfyaml/releases/download/v${VERSION}/libfyaml-${VERSION}.tar.gz"
4+
FILENAME "libfyaml-${VERSION}.tar.gz"
5+
SHA512 71f01fdbfa8a3675bdd6697929bb8ee85672befa5ed815ef30813987c2f75f8ef0959e70d1b17d02ccadabc967f1dfd5b7f46a10a83fca7b1a9ed7455c52e344
6+
)
7+
8+
vcpkg_extract_source_archive(
9+
SOURCE_PATH
10+
ARCHIVE "${ARCHIVE}"
11+
PATCHES
12+
"pthread.diff"
13+
)
14+
15+
vcpkg_cmake_configure(
16+
SOURCE_PATH "${SOURCE_PATH}"
17+
OPTIONS
18+
-DBUILD_TESTING=OFF
19+
)
20+
21+
vcpkg_cmake_install()
22+
23+
vcpkg_fixup_pkgconfig()
24+
vcpkg_copy_pdbs()
25+
26+
vcpkg_copy_tools(TOOL_NAMES fy-tool AUTO_CLEAN)
27+
28+
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/${PORT}")
29+
30+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
31+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
32+
33+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

ports/libfyaml/pthread.diff

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index ef0c3ae..b845d6f 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -168,14 +168,16 @@ if(CROSS_COMPILING AND CMAKE_SYSTEM_NAME STREQUAL "Windows")
6+
endif()
7+
8+
# Check for required dependencies
9+
-if(NOT WIN32)
10+
+set(FYAML_LIBS "-L\${libdir} -lfyaml")
11+
+if(NOT WIN32 AND NOT ANDROID)
12+
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
13+
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
14+
find_package(Threads REQUIRED)
15+
if(NOT CMAKE_USE_PTHREADS_INIT)
16+
message(FATAL_ERROR "Missing required pthread support")
17+
endif()
18+
-else()
19+
+ set(FYAML_LIBS "${FYAML_LIBS} -lpthread")
20+
+elif(WIN32)
21+
# Windows uses native threading APIs
22+
set(CMAKE_USE_WIN32_THREADS_INIT TRUE)
23+
endif()
24+
diff --git a/cmake/libfyaml-config.cmake.in b/cmake/libfyaml-config.cmake.in
25+
index d67173a..9bae080 100644
26+
--- a/cmake/libfyaml-config.cmake.in
27+
+++ b/cmake/libfyaml-config.cmake.in
28+
@@ -16,9 +16,11 @@ set(libfyaml_HAS_LIBCLANG "@HAVE_LIBCLANG@")
29+
set(libfyaml_HAS_LIBYAML "@HAVE_LIBYAML@")
30+
31+
# Required dependency: Threads
32+
-set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
33+
-set(THREADS_PREFER_PTHREAD_FLAG TRUE)
34+
-find_dependency(Threads REQUIRED)
35+
+if(NOT WIN32 AND NOT ANDROID)
36+
+ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
37+
+ set(THREADS_PREFER_PTHREAD_FLAG TRUE)
38+
+ find_dependency(Threads REQUIRED)
39+
+endif()
40+
41+
# Optional dependency: libclang (only if libfyaml was built with reflection support)
42+
if(libfyaml_HAS_LIBCLANG)
43+
diff --git a/cmake/libfyaml.pc.in b/cmake/libfyaml.pc.in
44+
index e57044c..f7faafc 100644
45+
--- a/cmake/libfyaml.pc.in
46+
+++ b/cmake/libfyaml.pc.in
47+
@@ -6,5 +6,5 @@ includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@
48+
Name: libfyaml
49+
Description: Fancy YAML 1.3 parser library
50+
Version: @PROJECT_VERSION@
51+
-Libs: -L${libdir} -lfyaml -lpthread
52+
+Libs: @FYAML_LIBS@
53+
Cflags: -I${includedir}

ports/libfyaml/vcpkg.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "libfyaml",
3+
"version": "0.9.6",
4+
"description": "High-performance YAML parser and emitter library",
5+
"homepage": "https://github.com/pantoniou/libfyaml",
6+
"license": "MIT",
7+
"supports": "!(arm64 & windows)",
8+
"dependencies": [
9+
{
10+
"name": "vcpkg-cmake",
11+
"host": true
12+
},
13+
{
14+
"name": "vcpkg-cmake-config",
15+
"host": true
16+
}
17+
]
18+
}

versions/baseline.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4992,6 +4992,10 @@
49924992
"baseline": "3.17.3",
49934993
"port-version": 0
49944994
},
4995+
"libfyaml": {
4996+
"baseline": "0.9.6",
4997+
"port-version": 0
4998+
},
49954999
"libgcrypt": {
49965000
"baseline": "1.12.1",
49975001
"port-version": 0

versions/l-/libfyaml.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"versions": [
3+
{
4+
"git-tree": "01e195893e1226d66d441c0a331cea71377ed96a",
5+
"version": "0.9.6",
6+
"port-version": 0
7+
}
8+
]
9+
}

0 commit comments

Comments
 (0)