On 2025/01/16 07:47, Stepan Zolotuev wrote:
> Hi ports@,
>
> Most packages contain both static and shared libraries, this one
> doesn't. I noticed this when trying to statically link my own software.
For software using cmake it is common to only build one version of a library.
> The diff simply enables building of statib library.
I don't see the benefit of having this in ports. If you want to build it
directly into your own software (which has the same downsides as static
linking - less ASLR, doesn't automaticslly get updated if there are
fixes in cJSON), it seems a better approach to do it this way?
: #### copying the source
:
: Because the entire library is only one C file and one header file, you
: can just copy `cJSON.h` and `cJSON.c` to your projects source and start
: using it.
>
> diff --git devel/cjson/Makefile devel/cjson/Makefile
> index 2a3e8579216..c8a8d017c17 100644
> --- devel/cjson/Makefile
> +++ devel/cjson/Makefile
> @@ -3,6 +3,7 @@ COMMENT = ultralightweight JSON parser in ANSI C
> GH_ACCOUNT = DaveGamble
> GH_PROJECT = cJSON
> GH_TAGNAME = v1.7.18
> +REVISION = 0
>
> PKGNAME = ${DISTNAME:L}
>
> @@ -20,8 +21,10 @@ WANTLIB += m
>
> MODULES = devel/cmake
>
> +CONFIGURE_ARGS += -DBUILD_SHARED_AND_STATIC_LIBS=ON
> +
> # evertyhing except tests
> -ALL_TARGET = cjson
> +ALL_TARGET = cjson cjson-static
>
> # build whatever is left (ca. 43 C test files)
> pre-test:
> diff --git devel/cjson/pkg/PLIST devel/cjson/pkg/PLIST
> index 72fecab4602..c64c876d1ee 100644
> --- devel/cjson/pkg/PLIST
> +++ devel/cjson/pkg/PLIST
> @@ -6,5 +6,6 @@ lib/cmake/cJSON/cJSONConfig.cmake
> lib/cmake/cJSON/cJSONConfigVersion.cmake
> lib/cmake/cJSON/cjson${MODCMAKE_BUILD_SUFFIX}
> lib/cmake/cJSON/cjson.cmake
> +@static-lib lib/libcjson.a
> @lib lib/libcjson.so.${LIBcjson_VERSION}
> lib/pkgconfig/libcjson.pc