sync:Fix generation of pkg-config file with absolute includedir/libdir.
Signed-off-by: zhangzhangxin <zhangxin1@xfusion.com>
This commit is contained in:
parent
dac9c20a22
commit
6772438f78
@ -0,0 +1,99 @@
|
||||
From 85f6fdf884f45b08317b8d05ecf10fbf45563ea7 Mon Sep 17 00:00:00 2001
|
||||
From: zhangzhangxin <zhangxin1@xfusion.com>
|
||||
Date: Fri, 28 Apr 2023 16:06:48 +0800
|
||||
Subject: [PATCH] sync:Fix generation of pkg-config file with absolute
|
||||
includedir/libdir
|
||||
|
||||
Signed-off-by: zhangzhangxin <zhangxin1@xfusion.com>
|
||||
---
|
||||
.gitignore | 1 -
|
||||
CMakeLists.txt | 7 +++++++
|
||||
cmake/JoinPaths.cmake | 23 +++++++++++++++++++++++
|
||||
pkg-config/jsoncpp.pc.in | 4 ++--
|
||||
4 files changed, 32 insertions(+), 3 deletions(-)
|
||||
create mode 100644 cmake/JoinPaths.cmake
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index 91121c2..68f40b0 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
# CMake-generated files:
|
||||
CMakeFiles/
|
||||
-*.cmake
|
||||
/pkg-config/jsoncpp.pc
|
||||
jsoncpp_lib_static.dir/
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 01b8c9d..7e64bec 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -49,6 +49,8 @@ if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES)
|
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage.")
|
||||
endif()
|
||||
|
||||
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
+
|
||||
# ---------------------------------------------------------------------------
|
||||
# use ccache if found, has to be done before project()
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -146,6 +148,11 @@ if(JSONCPP_WITH_WARNING_AS_ERROR)
|
||||
endif()
|
||||
|
||||
if(JSONCPP_WITH_PKGCONFIG_SUPPORT)
|
||||
+ include(JoinPaths)
|
||||
+
|
||||
+ join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
|
||||
+ join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
+
|
||||
configure_file(
|
||||
"pkg-config/jsoncpp.pc.in"
|
||||
"pkg-config/jsoncpp.pc"
|
||||
diff --git a/cmake/JoinPaths.cmake b/cmake/JoinPaths.cmake
|
||||
new file mode 100644
|
||||
index 0000000..148f5b6
|
||||
--- /dev/null
|
||||
+++ b/cmake/JoinPaths.cmake
|
||||
@@ -0,0 +1,23 @@
|
||||
+# This module provides a function for joining paths
|
||||
+# known from most languages
|
||||
+#
|
||||
+# SPDX-License-Identifier: (MIT OR CC0-1.0)
|
||||
+# Copyright 2020 Jan Tojnar
|
||||
+# https://github.com/jtojnar/cmake-snips
|
||||
+#
|
||||
+# Modelled after Python’s os.path.join
|
||||
+# https://docs.python.org/3.7/library/os.path.html#os.path.join
|
||||
+# Windows not supported
|
||||
+function(join_paths joined_path first_path_segment)
|
||||
+ set(temp_path "${first_path_segment}")
|
||||
+ foreach(current_segment IN LISTS ARGN)
|
||||
+ if(NOT ("${current_segment}" STREQUAL ""))
|
||||
+ if(IS_ABSOLUTE "${current_segment}")
|
||||
+ set(temp_path "${current_segment}")
|
||||
+ else()
|
||||
+ set(temp_path "${temp_path}/${current_segment}")
|
||||
+ endif()
|
||||
+ endif()
|
||||
+ endforeach()
|
||||
+ set(${joined_path} "${temp_path}" PARENT_SCOPE)
|
||||
+endfunction()
|
||||
\ No newline at end of file
|
||||
diff --git a/pkg-config/jsoncpp.pc.in b/pkg-config/jsoncpp.pc.in
|
||||
index d4fa9ef..632a377 100644
|
||||
--- a/pkg-config/jsoncpp.pc.in
|
||||
+++ b/pkg-config/jsoncpp.pc.in
|
||||
@@ -1,7 +1,7 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
||||
-libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
+libdir=@libdir_for_pc_file@
|
||||
+includedir=@includedir_for_pc_file@
|
||||
|
||||
Name: jsoncpp
|
||||
Description: A C++ library for interacting with JSON
|
||||
--
|
||||
2.40.0.windows.1
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: jsoncpp
|
||||
Version: 1.9.3
|
||||
Release: 5
|
||||
Release: 6
|
||||
Summary: JSON C++ library
|
||||
License: Public Domain or MIT
|
||||
URL: https://github.com/open-source-parsers/jsoncpp
|
||||
@ -9,6 +9,7 @@ BuildRequires: gcc-c++ cmake >= 3.1 python3-devel
|
||||
Patch0: 0001-sync-Issue-1182-Fix-fuzzing-bug.patch
|
||||
Patch1: 0002-sync-avoid-isprint-because-it-is-locale-specific.patch
|
||||
Patch2: 0003-sync-Add-nullptr-Json-Value-constructor.patch
|
||||
Patch3: 0004-sync-Fix-generation-of-pkg-config-file-with-absolute.patch
|
||||
|
||||
%description
|
||||
JsonCpp is a C++ library that allows manipulating JSON values,
|
||||
@ -90,6 +91,9 @@ hardlink -cfv %{buildroot}%{_docdir}/%{name}
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Apr 28 2023 zhangxin <zhangxin1@xfusion.com> - 1.9.3-6
|
||||
- Fix generation of pkg-config file with absolute includedir/libdir.
|
||||
|
||||
* Fri Apr 28 2023 zhangxin <zhangxin1@xfusion.com> - 1.9.3-5
|
||||
- Add nullptr Json::Value constructor
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user