~aman/static-mozjpeg

cbbd7d6bf3fce2d3474495adbf5fd8f82d95e065 — Aman Verma 2 months ago ccdb49c
Fixes for Alpine and Void building.
2 files changed, 12 insertions(+), 6 deletions(-)

M Dockerfile
M build.sh
M Dockerfile => Dockerfile +1 -0
@@ 4,5 4,6 @@ RUN xbps-install -Su -y \
RUN useradd -m builder
WORKDIR /home/builder
USER builder
ENV NONALPINE 1
COPY /build.sh build.sh
RUN ./build.sh

M build.sh => build.sh +11 -6
@@ 18,12 18,17 @@ printf '==============================================================\n'
# This unsets CMAKE_SHARED_LIBRARY_LINK_C_FLAGS inside CMakeLists.txt because it won't work from the CLI.
perl -ni -e 'print; /set\(LIBJPEG_TURBO_V/ && print "set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)"' CMakeLists.txt

cmake -S . -B build -G Ninja -D ENABLE_SHARED=0 -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D CMAKE_FIND_LIBRARY_SUFFIXES=.a \
    -D CMAKE_LINK_SEARCH_END_STATIC=1 -D CMAKE_LINK_SEARCH_START_STATIC=1 \
    -D PNG_LIBRARY=/usr/lib/libpng.a -D PNG_PNG_INCLUDE_DIR=/usr/include -D ZLIB_LIBRARY=/lib/libz.a
# On Alpine CMake can't find libpng or libz. ^

if [ $NONALPINE -eq 1 ]; then
    cmake -S . -B build -G Ninja -D ENABLE_SHARED=0 -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D CMAKE_FIND_LIBRARY_SUFFIXES=.a \
        -D CMAKE_LINK_SEARCH_END_STATIC=1 -D CMAKE_LINK_SEARCH_START_STATIC=1
else
    # On Alpine, CMake can't find libpng or libz.
    cmake -S . -B build -G Ninja -D ENABLE_SHARED=0 -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D CMAKE_FIND_LIBRARY_SUFFIXES=.a \
        -D CMAKE_LINK_SEARCH_END_STATIC=1 -D CMAKE_LINK_SEARCH_START_STATIC=1 \
        -D PNG_LIBRARY=/usr/lib/libpng.a -D PNG_PNG_INCLUDE_DIR=/usr/include -D ZLIB_LIBRARY=/lib/libz.a
fi

cd build && ninja
binaries='cjpeg-static djpeg-static jpegtran-static'