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

dev-libs/json-c: add patch for static-libs support, live ebuild and add new maintainers #15586

Closed
wants to merge 3 commits into from
Closed
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
56 changes: 56 additions & 0 deletions dev-libs/json-c/files/json-c-0.14_cmake-static-libs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba692ff..fc2edff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,6 +65,7 @@ include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

option(BUILD_SHARED_LIBS "Default to building shared libraries" ON)
+option(BUILD_STATIC_LIBS "Default to building static libraries" OFF)

# Generate a release merge and test it to verify the correctness of republishing the package.
ADD_CUSTOM_TARGET(distcheck
@@ -383,7 +384,7 @@ add_library(${PROJECT_NAME}
set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION 5.0.0
SOVERSION 5)
-
+list(APPEND CMAKE_TARGETS ${PROJECT_NAME})
# If json-c is used as subroject it set to target correct interface -I flags and allow
# to build external target without extra include_directories(...)
target_include_directories(${PROJECT_NAME}
@@ -392,7 +393,33 @@ target_include_directories(${PROJECT_NAME}
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
)

-install(TARGETS ${PROJECT_NAME}
+# Allow to build static and shared libraries at the same time
+if (BUILD_STATIC_LIBS)
+ set(STATIC_LIB ${PROJECT_NAME}-static)
+ add_library(${STATIC_LIB} STATIC
+ ${JSON_C_SOURCES}
+ ${JSON_C_HEADERS}
+ )
+
+ # rename the static library
+ set_target_properties(${STATIC_LIB} PROPERTIES
+ OUTPUT_NAME ${PROJECT_NAME}
+ )
+ list(APPEND CMAKE_TARGETS ${STATIC_LIB})
+endif ()
+
+# Always create new install dirs with 0755 permissions, regardless of umask
+set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
+ OWNER_READ
+ OWNER_WRITE
+ OWNER_EXECUTE
+ GROUP_READ
+ GROUP_EXECUTE
+ WORLD_READ
+ WORLD_EXECUTE
+ )
+
+install(TARGETS ${CMAKE_TARGETS}
EXPORT ${PROJECT_NAME}-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ SLOT="0/5"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
IUSE="doc static-libs threads"

PATCHES=(
"${FILESDIR}/${P}_cmake-static-libs.patch"
)

MULTILIB_WRAPPED_HEADERS=(
/usr/include/json-c/config.h
)
Expand All @@ -26,6 +30,7 @@ src_prepare() {
multilib_src_configure() {
local mycmakeargs=(
-DBUILD_DOCUMENTATION=$(multilib_native_usex doc)
-DBUILD_STATIC_LIBS=$(usex static-libs)
-DDISABLE_WERROR=ON
-DENABLE_THREADING=$(usex threads)
)
Expand Down
47 changes: 47 additions & 0 deletions dev-libs/json-c/json-c-9999.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="7"

CMAKE_ECLASS=cmake
inherit cmake-multilib git-r3

DESCRIPTION="A JSON implementation in C"
HOMEPAGE="https://github.com/json-c/json-c/wiki"
EGIT_REPO_URI="https://github.com/json-c/json-c.git"

LICENSE="MIT"
SLOT="0/5"
IUSE="doc static-libs threads"

MULTILIB_WRAPPED_HEADERS=(
/usr/include/json-c/config.h
)

src_prepare() {
cmake_src_prepare
}

multilib_src_configure() {
local mycmakeargs=(
-DBUILD_DOCUMENTATION=$(multilib_native_usex doc)
-DDISABLE_WERROR=ON
-DENABLE_THREADING=$(usex threads)
-DBUILD_STATIC_LIBS=$(usex static-libs)
)

cmake_src_configure
}

multilib_src_compile() {
cmake_src_compile
}

multilib_src_test() {
multilib_is_native_abi && cmake_src_test
}

multilib_src_install_all() {
use doc && HTML_DOCS=( "${S}"/doc/html/. )
einstalldocs
}
13 changes: 12 additions & 1 deletion dev-libs/json-c/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<!-- maintainer-needed -->
<maintainer type="person">
<email>jakov.smolic@sartura.hr</email>
<name>Jakov Smolic</name>
</maintainer>
<maintainer type="person">
<email>luka.perkov@sartura.hr</email>
<name>Luka Perkov</name>
</maintainer>
<maintainer type="project">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<longdescription lang="en">
"A JSON implementation in C" is probably the better description, and then
"JSON-C implements a reference counting object model that allows you to
Expand Down