Files
termux-packages/packages/jsoncpp/build.sh
termux-pacman-bot 3ff11e7e2d fix(main/jsoncpp): remove "json_reader.cpp.o" properly
- Similar to https://github.com/termux/termux-packages/pull/24897, but `jsoncpp` instead of `qt6-qtbase`

- Fixes this error that might occur sometimes when some projects attempt to import `jsoncpp` through CMake:

```
CMake Error at /data/data/com.termux/files/usr/lib/cmake/jsoncpp/jsoncpp-targets.cmake:94 (message):
  The imported target "jsoncpp_object" references the file

     "/data/data/com.termux/files/usr/lib/objects-Release/jsoncpp_object/json_reader.cpp.o"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/data/data/com.termux/files/usr/lib/cmake/jsoncpp/jsoncpp-targets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /data/data/com.termux/files/usr/lib/cmake/jsoncpp/jsoncppConfig.cmake:30 (include)
  src/cmake/FindJsonCpp.cmake:68 (find_package)
  src/CMakeLists.txt:129 (find_package)

-- Configuring incomplete, errors occurred!
```

- Replaces fd1b62d216

- Found while attempting to compile this software: https://github.com/KhronosGroup/OpenXR-SDK-Source

- @truboxl wants to remove the unconventional "`lib/objects-*/*/*.c*.o`" files that have begun appearing in some packages, and after some time, I believe I have found a way to do so without causing `CMake Error` to happen - using `-DBUILD_OBJECT_LIBS=OFF` appears to be capable of removing these files, but without causing the `CMake Error`.
2025-06-07 08:40:24 +00:00

43 lines
1.5 KiB
Bash

TERMUX_PKG_HOMEPAGE=https://github.com/open-source-parsers/jsoncpp
TERMUX_PKG_DESCRIPTION="C++ library for interacting with JSON"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.9.6
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=f93b6dd7ce796b13d02c108bc9f79812245a82e577581c4c9aabe57075c90ea2
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_DEPENDS="libc++"
TERMUX_PKG_BREAKS="jsoncpp-dev"
TERMUX_PKG_REPLACES="jsoncpp-dev"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DBUILD_SHARED_LIBS=ON
-DBUILD_OBJECT_LIBS=OFF
-DJSONCPP_WITH_TESTS=OFF
-DCCACHE_FOUND=OFF
"
termux_step_post_get_source() {
# Do not forget to bump revision of reverse dependencies and rebuild them
# after SOVERSION is changed.
local _SOVERSION=26
local v=$(sed -En 's/^set\(PROJECT_SOVERSION\s+([0-9]+).*/\1/p' \
CMakeLists.txt)
if [ "${v}" != "${_SOVERSION}" ]; then
termux_error_exit "SOVERSION guard check failed."
fi
}
termux_step_pre_configure() {
# Certain packages are not safe to build on device because their
# build.sh script deletes specific files in $TERMUX_PREFIX.
if $TERMUX_ON_DEVICE_BUILD; then
termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds."
fi
# The installation does not overwrite symlinks such as libjsoncpp.so.1,
# so if rebuilding these are not detected as modified. Fix that:
rm -f $TERMUX_PREFIX/lib/libjsoncpp.so*
}