On Wed, December 12, 2018 13:07, Kirill Bychkov wrote:
> On Tue, December 11, 2018 13:40, Stuart Henderson wrote:
>> On 2018/12/11 18:47, YASUOKA Masahiko wrote:
>>> Hi,
>>>
>>> The diff does the followings:
>>>
>>> - update to jansson-2.12
>>> - include a static library
>>> - use configure && make, instead of cmake
>>>
>>> My motivation was to include the static library, since I'd like to use
>>> it within a statically linked CGI program.
>>>
>>> I had tried to modify CMakeLists.txt to build both static and shared
>>> library, but it was not easy for me. On the other hand, just doing
>>> "configure && make" does it as the default. I choiced "configure"
>>> rather than cmake. Is there any reason to keep using cmake?
>>
>> It needs testing with dependent ports either way, but the static
>> library can be added to the cmake build like this:
>>
>> Index: Makefile
>
> [...]
>
>>
>
> Hi!
> Thanks for the diff needed to build static libs alogside shared one.
> I think we could add it without updating jansson itself at this moment.
> Update will follow after testing dependent ports.
>
>
Forgot to add diff
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/jansson/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- Makefile 7 Sep 2018 11:10:30 -0000 1.12
+++ Makefile 12 Dec 2018 11:01:26 -0000
@@ -3,6 +3,7 @@
COMMENT = library for manipulating JSON data
DISTNAME = jansson-2.11
+REVISION = 0
SHARED_LIBS = jansson 3.1
@@ -19,7 +20,7 @@
MODULES = devel/cmake
-CONFIGURE_ARGS += -DBUILD_SHARED_LIBS=ON \
+CONFIGURE_ARGS += -DJANSSON_BUILD_SHARED_LIBS=ON \
-DJANSSON_BUILD_DOCS=OFF \
-DJANSSON_EXAMPLES=OFF
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: /cvs/ports/devel/jansson/patches/patch-CMakeLists_txt,v
retrieving revision 1.5
diff -u -r1.5 patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt 7 Sep 2018 11:10:30 -0000 1.5
+++ patches/patch-CMakeLists_txt 12 Dec 2018 11:01:26 -0000
@@ -1,13 +1,40 @@
-$OpenBSD: patch-CMakeLists_txt,v 1.5 2018/09/07 11:10:30 sthen Exp $
+$OpenBSD$
+
Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
-@@ -640,7 +640,7 @@ file(RELATIVE_PATH
- # so that the include dirs are given relative to where the
- # config file is located.
- set(JANSSON__INCLUDE_DIRS
-- "\${JANSSON_CMAKE_DIR}/${REL_INCLUDE_DIR}")
-+ "${CMAKE_INSTALL_PREFIX}/include")
- configure_file(${PROJECT_SOURCE_DIR}/cmake/JanssonConfig.cmake.in
-
${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/JanssonConfig.cmake
- @ONLY)
+@@ -352,17 +352,19 @@ if(JANSSON_BUILD_SHARED_LIBS)
+ ${JANSSON_HDR_PRIVATE}
+ ${JANSSON_HDR_PUBLIC}
+ src/jansson.def)
+-
+ set_target_properties(jansson PROPERTIES
+ VERSION ${JANSSON_VERSION}
+ SOVERSION ${JANSSON_SOVERSION})
+-else()
+- add_library(jansson
+- ${JANSSON_SRC}
+- ${JANSSON_HDR_PRIVATE}
+- ${JANSSON_HDR_PUBLIC})
+ endif()
+
++add_library(janssonstatic STATIC
++ ${JANSSON_SRC}
++ ${JANSSON_HDR_PRIVATE}
++ ${JANSSON_HDR_PUBLIC})
++set_target_properties(janssonstatic PROPERTIES
++ OUTPUT_NAME jansson
++ POSITION_INDEPENDENT_CODE true)
++
+ if (JANSSON_EXAMPLES)
+ add_executable(simple_parse "${PROJECT_SOURCE_DIR}/examples/simple_parse.c")
+ target_link_libraries(simple_parse jansson)
+@@ -659,7 +661,7 @@ set_target_properties(jansson PROPERTIES PUBLIC_HEADER
+ #
+ option(JANSSON_INSTALL "Generate installation target" ON)
+ if (JANSSON_INSTALL)
+-install(TARGETS jansson
++install(TARGETS jansson janssonstatic
+ EXPORT JanssonTargets
+ LIBRARY DESTINATION "${JANSSON_INSTALL_LIB_DIR}" COMPONENT lib
+ ARCHIVE DESTINATION "${JANSSON_INSTALL_LIB_DIR}" COMPONENT lib
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/devel/jansson/pkg/PLIST,v
retrieving revision 1.3
diff -u -r1.3 PLIST
--- pkg/PLIST 20 Mar 2015 13:28:23 -0000 1.3
+++ pkg/PLIST 12 Dec 2018 11:01:26 -0000
@@ -7,5 +7,6 @@
lib/cmake/jansson/JanssonConfigVersion.cmake
lib/cmake/jansson/JanssonTargets${MODCMAKE_BUILD_SUFFIX}
lib/cmake/jansson/JanssonTargets.cmake
+lib/libjansson.a
@lib lib/libjansson.so.${LIBjansson_VERSION}
lib/pkgconfig/jansson.pc
No comments:
Post a Comment