summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-10-09 13:24:32 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-10-09 13:24:32 +0200
commit6142280fe5d4e26c6f907b08b1b84d74aa5a6492 (patch)
tree0afb411938c90fbe7601aaa9f9f51fc62342cab6
parent165bd3a1e699b6416730bda629a8455501b9a990 (diff)
cJSON/1.7.18: Rely on DESTDIR
Otherwise, the installation prefix would be /opt/spm/cjson-1.7.18 instead of /usr/local, which can cause issues for CMake projects relying on the .cmake files installed by cJSON on /usr/local/lib.
-rw-r--r--cJSON/1.7.18/Dockerfile9
1 files changed, 5 insertions, 4 deletions
diff --git a/cJSON/1.7.18/Dockerfile b/cJSON/1.7.18/Dockerfile
index 3c33760..f83aad4 100644
--- a/cJSON/1.7.18/Dockerfile
+++ b/cJSON/1.7.18/Dockerfile
@@ -1,5 +1,6 @@
FROM alpine as base
-ARG PREFIX=/opt/spm/cjson-1.7.18
+ARG PREFIX=/usr/local
+ARG DESTDIR=/opt/spm/cjson-1.7.18
RUN apk update && apk add \
git \
cmake \
@@ -10,10 +11,10 @@ RUN git clone --depth 1 -b v1.7.18 https://github.com/DaveGamble/cJSON
WORKDIR /cJSON
RUN cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX=$PREFIX \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-ffunction-sections -fdata-sections"
RUN cmake --build build/ --parallel $(nproc --all)
-RUN cmake --install build/
+WORKDIR build
+RUN make install DESTDIR=$DESTDIR
FROM scratch
-COPY --from=base /opt/spm/cjson-1.7.18 /opt/spm/cjson-1.7.18
+COPY --from=base /opt/spm/cjson-1.7.18/usr/local /opt/spm/cjson-1.7.18