From 618225fb6b36b14a0ad9bdc99cf4d61198a64ee0 Mon Sep 17 00:00:00 2001 From: William Horvath Date: Wed, 30 Oct 2024 21:52:55 -0700 Subject: [PATCH] fix libarchive using external zstd --- .gitignore | 2 +- umu-static-bundler/build.sh | 2 +- umu-static-bundler/lib/Dockerfile | 8 +++++--- umu-static-bundler/lib/umu-build.sh | 2 ++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 15b7770..f5c51f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/umu-static-bundler/third_party/cache +/umu-static-bundler/third_party /umu-static-bundler/work /umu-static-bundler/build /garbage diff --git a/umu-static-bundler/build.sh b/umu-static-bundler/build.sh index 4852e9f..e090daf 100755 --- a/umu-static-bundler/build.sh +++ b/umu-static-bundler/build.sh @@ -189,7 +189,7 @@ build_docker_image() { fi _message "Building Docker image..." - docker build -t "${docker_image}" -f "${u_scriptdir}/lib/Dockerfile" "${docker_context}" || { + docker build --progress=plain -t "${docker_image}" -f "${u_scriptdir}/lib/Dockerfile" "${docker_context}" || { local ret=$? _error "Docker build failed" rm -rf "${docker_context}" diff --git a/umu-static-bundler/lib/Dockerfile b/umu-static-bundler/lib/Dockerfile index 9849c41..6eaef3c 100644 --- a/umu-static-bundler/lib/Dockerfile +++ b/umu-static-bundler/lib/Dockerfile @@ -34,7 +34,9 @@ RUN CC=clang \ install -Dm644 libzstd.pc /usr/local/lib/pkgconfig/libzstd.pc && \ cd .. && \ install -Dm644 lib/libzstd.a /usr/local/lib/libzstd.a && \ - find lib -name "zstd*.h" -exec install -Dm644 {} /usr/local/include/{} \; && \ + install -Dm644 lib/zstd.h /usr/local/include/zstd.h && \ + install -Dm644 lib/zdict.h /usr/local/include/zdict.h && \ + install -Dm644 lib/zstd_errors.h /usr/local/include/zstd_errors.h && \ install -Dm755 programs/zstd /usr/local/bin/zstd && \ ln -sf /usr/local/bin/zstd /usr/local/bin/zstdmt && \ ln -sf /usr/local/bin/zstd /usr/local/bin/unzstd @@ -44,7 +46,7 @@ WORKDIR /build/libarchive COPY libarchive . RUN CPPFLAGS="-I/usr/local/include" \ CFLAGS="-static -Oz -fPIC -ffunction-sections -fdata-sections" \ - LDFLAGS="-static -Wl,--gc-sections,--strip-all -L/usr/local/lib" \ + LDFLAGS="-static -Wl,--gc-sections,--strip-all -L/usr/local/lib -l:libzstd.a" \ PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" \ autoreconf -fi && \ ./configure \ @@ -121,4 +123,4 @@ COPY lib/messaging.sh /build/lib/ COPY umu-build.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/umu-build.sh -ENTRYPOINT ["/usr/local/bin/umu-build.sh"] \ No newline at end of file +ENTRYPOINT ["/usr/local/bin/umu-build.sh"] diff --git a/umu-static-bundler/lib/umu-build.sh b/umu-static-bundler/lib/umu-build.sh index 34b26ee..6dec73b 100755 --- a/umu-static-bundler/lib/umu-build.sh +++ b/umu-static-bundler/lib/umu-build.sh @@ -47,7 +47,9 @@ if ! clang -static \ -o "${WORK_DIR}/umu-run" "${WRAPPER_SRC}" \ -I/usr/local/include \ -L/usr/local/lib \ + -Wl,--whole-archive \ -l:libarchive.a \ + -Wl,--no-whole-archive \ -l:libzstd.a \ -pthread; then _error "Failed to compile wrapper"