From 68ff16e187b868b5b216a36e880913bc6b01ae29 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 24 Mar 2024 13:08:23 +1000 Subject: [PATCH] CI: Build zlib/zstd/libjpeg/libpng as part of deps --- scripts/build-dependencies-windows-arm64.bat | 68 ++- scripts/build-dependencies-windows-x64.bat | 70 ++- scripts/build-dependencies.sh | 109 ++++- scripts/libjpeg-cmake.patch | 422 +++++++++++++++++++ 4 files changed, 629 insertions(+), 40 deletions(-) create mode 100644 scripts/libjpeg-cmake.patch diff --git a/scripts/build-dependencies-windows-arm64.bat b/scripts/build-dependencies-windows-arm64.bat index b6b34be5d..293472ebf 100644 --- a/scripts/build-dependencies-windows-arm64.bat +++ b/scripts/build-dependencies-windows-arm64.bat @@ -12,6 +12,7 @@ if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Bu ) set SEVENZIP="C:\Program Files\7-Zip\7z.exe" +set PATCH="C:\Program Files\Git\usr\bin\patch.exe" if defined DEBUG ( echo DEBUG=%DEBUG% @@ -41,11 +42,18 @@ echo INSTALLDIR=%INSTALLDIR% cd "%BUILDDIR%" +set LIBJPEG=9f +set LIBPNG=1643 set QT=6.6.2 set QTMINOR=6.6 set SDL=SDL2-2.30.1 set WEBP=1.3.2 +set ZLIB=1.3.1 +set ZLIBSHORT=131 +set ZSTD=1.5.5 +call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lpng1643.zip fc466a1e638e635d6c66363bdf3f38555b81b0141d0b06ba45b49ccca327436d || goto error +call :downloadfile "jpegsr%LIBJPEG%.zip" https://ijg.org/files/jpegsr%LIBJPEG%.zip 6255da8c89e09d694e6800688c76145eb6870a76ac0d36c74fccd61b3940aafa || goto error call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" c15ded54e9f32f8a1f9ed3e3dc072837a320ed23c5d0e95b7c18ecbe05c1187b || goto error call :downloadfile "qtbase-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtbase-everywhere-src-%QT%.zip" 3582dbc46df280365fc5d5e6cc8fcfc72ddbddbd330a03a98eec24b8b44fa4d0 || goto error call :downloadfile "qtimageformats-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtimageformats-everywhere-src-%QT%.zip" 2176b623c9141b1136d57ff9ca1ed12e3636146b53c6feed2083e1cbecff6454 || goto error @@ -53,6 +61,8 @@ call :downloadfile "qtsvg-everywhere-src-%QT%.zip" "https://download.qt.io/offic call :downloadfile "qttools-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttools-everywhere-src-%QT%.zip" c760fbd229de8a02e793fa41ddd6843cd2cb9c93a4e99bc5384c646599aee996 || goto error call :downloadfile "qttranslations-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttranslations-everywhere-src-%QT%.zip" a061e8d61eb7c03823ead92fe46b5722ed7b8119aeb84157d80f10a53c77d262 || goto error call :downloadfile "libwebp-%WEBP%.tar.gz" "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-%WEBP%.tar.gz" 2a499607df669e40258e53d0ade8035ba4ec0175244869d1025d460562aa09b4 || goto error +call :downloadfile "zlib%ZLIBSHORT%.zip" "https://zlib.net/zlib%ZLIBSHORT%.zip" 72af66d44fcc14c22013b46b814d5d2514673dda3d115e64b690c1ad636e7b17 || goto error +call :downloadfile "zstd-%ZSTD%.zip" "https://github.com/facebook/zstd/archive/refs/tags/v%ZSTD%.zip" c5c8daa1d40dabc51790c62a5b86af2b36dfc4e1a738ff10dc4a46ea4e68ee51 || goto error if %DEBUG%==1 ( echo Building debug and release libraries... @@ -63,6 +73,51 @@ if %DEBUG%==1 ( set FORCEPDB=-DCMAKE_SHARED_LINKER_FLAGS_RELEASE="/DEBUG" set ARM64TOOLCHAIN=-DCMAKE_TOOLCHAIN_FILE="%SCRIPTDIR%\cmake-toolchain-windows-arm64.cmake" +echo Building Zlib... +rmdir /S /Q "zlib-%ZLIB%" +%SEVENZIP% x "zlib%ZLIBSHORT%.zip" || goto error +cd "zlib-%ZLIB%" || goto error +cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DZLIB_BUILD_EXAMPLES=OFF -B build -G Ninja || goto error +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + +echo Building libpng... +rmdir /S /Q "lpng%LIBPNG%" +%SEVENZIP% x "lpng%LIBPNG%.zip" || goto error +cd "lpng%LIBPNG%" || goto error +cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_STATIC=OFF -DPNG_SHARED=ON -DPNG_TOOLS=OFF -B build -G Ninja || goto error +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + +echo Building libjpeg... +%SEVENZIP% x "jpegsr%LIBJPEG%.zip" || goto error +cd "jpeg-%LIBJPEG%" || goto error +%PATCH% -p1 < "%SCRIPTDIR%\libjpeg-cmake.patch" || goto error +cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -B build -G Ninja || goto error +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + +echo Building Zstandard... +rmdir /S /Q "zstd-%ZSTD%" +%SEVENZIP% x "-x^!zstd-1.5.5\tests\cli-tests\bin" "zstd-%ZSTD%.zip" || goto error +cd "zstd-%ZSTD%" +cmake %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_SHARED=ON -DZSTD_BUILD_STATIC=OFF -DZSTD_BUILD_PROGRAMS=OFF -B build -G Ninja build/cmake +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + +echo Building WebP... +rmdir /S /Q "libwebp-%WEBP%" +tar -xf "libwebp-%WEBP%.tar.gz" || goto error +cd "libwebp-%WEBP%" || goto error +cmake -B build %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON -G Ninja || goto error +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + echo Building SDL... rmdir /S /Q "%SDL%" %SEVENZIP% x "%SDL%.zip" || goto error @@ -79,15 +134,6 @@ ninja -C build install || goto error copy build\SDL2.pdb "%INSTALLDIR%\bin" || goto error cd .. || goto error -echo Building WebP... -rmdir /S /Q "libwebp-%WEBP%" -tar -xf "libwebp-%WEBP%.tar.gz" || goto error -cd "libwebp-%WEBP%" || goto error -cmake -B build %ARM64TOOLCHAIN% -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON -G Ninja || goto error -cmake --build build --parallel || goto error -ninja -C build install || goto error -cd .. || goto error - if %DEBUG%==1 ( set QTBUILDSPEC=-DCMAKE_CONFIGURATION_TYPES="Release;Debug" -G "Ninja Multi-Config" ) else ( @@ -98,7 +144,7 @@ echo Building Qt base... rmdir /S /Q "qtbase-everywhere-src-%QT%" %SEVENZIP% x "qtbase-everywhere-src-%QT%.zip" || goto error cd "qtbase-everywhere-src-%QT%" || goto error -cmake -B build %ARM64TOOLCHAIN% -DFEATURE_sql=OFF -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DQT_HOST_PATH="%X64INSTALLDIR%" %FORCEPDB% -DINPUT_gui=yes -DINPUT_widgets=yes -DINPUT_ssl=yes -DINPUT_openssl=no -DINPUT_schannel=yes %QTBUILDSPEC% || goto error +cmake -B build %ARM64TOOLCHAIN% -DFEATURE_sql=OFF -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DQT_HOST_PATH="%X64INSTALLDIR%" %FORCEPDB% -DINPUT_gui=yes -DINPUT_widgets=yes -DINPUT_ssl=yes -DINPUT_openssl=no -DINPUT_schannel=yes -DFEATURE_system_png=ON -DFEATURE_system_jpeg=ON -DFEATURE_system_zlib=ON %QTBUILDSPEC% || goto error cmake --build build --parallel || goto error ninja -C build install || goto error cd .. || goto error @@ -109,7 +155,7 @@ rmdir /S /Q "qtsvg-everywhere-src-%QT%" cd "qtsvg-everywhere-src-%QT%" || goto error mkdir build || goto error cd build || goto error -call "%INSTALLDIR%\bin\qt-configure-module.bat" .. -- %FORCEPDB% || goto error +call "%INSTALLDIR%\bin\qt-configure-module.bat" .. -- %FORCEPDB% -DCMAKE_PREFIX_PATH="%INSTALLDIR%" || goto error cmake --build . --parallel || goto error ninja install || goto error cd ..\.. || goto error diff --git a/scripts/build-dependencies-windows-x64.bat b/scripts/build-dependencies-windows-x64.bat index ee922b134..0e102ed62 100644 --- a/scripts/build-dependencies-windows-x64.bat +++ b/scripts/build-dependencies-windows-x64.bat @@ -12,6 +12,7 @@ if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Bu ) set SEVENZIP="C:\Program Files\7-Zip\7z.exe" +set PATCH="C:\Program Files\Git\usr\bin\patch.exe" if defined DEBUG ( echo DEBUG=%DEBUG% @@ -35,13 +36,22 @@ echo SCRIPTDIR=%SCRIPTDIR% echo BUILDDIR=%BUILDDIR% echo INSTALLDIR=%INSTALLDIR% +set "PATH=%PATH%;%INSTALLDIR%\bin" + cd "%BUILDDIR%" +set LIBJPEG=9f +set LIBPNG=1643 set QT=6.6.2 set QTMINOR=6.6 set SDL=SDL2-2.30.1 set WEBP=1.3.2 +set ZLIB=1.3.1 +set ZLIBSHORT=131 +set ZSTD=1.5.5 +call :downloadfile "lpng%LIBPNG%.zip" https://download.sourceforge.net/libpng/lpng1643.zip fc466a1e638e635d6c66363bdf3f38555b81b0141d0b06ba45b49ccca327436d || goto error +call :downloadfile "jpegsr%LIBJPEG%.zip" https://ijg.org/files/jpegsr%LIBJPEG%.zip 6255da8c89e09d694e6800688c76145eb6870a76ac0d36c74fccd61b3940aafa || goto error call :downloadfile "%SDL%.zip" "https://libsdl.org/release/%SDL%.zip" c15ded54e9f32f8a1f9ed3e3dc072837a320ed23c5d0e95b7c18ecbe05c1187b || goto error call :downloadfile "qtbase-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtbase-everywhere-src-%QT%.zip" 3582dbc46df280365fc5d5e6cc8fcfc72ddbddbd330a03a98eec24b8b44fa4d0 || goto error call :downloadfile "qtimageformats-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qtimageformats-everywhere-src-%QT%.zip" 2176b623c9141b1136d57ff9ca1ed12e3636146b53c6feed2083e1cbecff6454 || goto error @@ -49,6 +59,8 @@ call :downloadfile "qtsvg-everywhere-src-%QT%.zip" "https://download.qt.io/offic call :downloadfile "qttools-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttools-everywhere-src-%QT%.zip" c760fbd229de8a02e793fa41ddd6843cd2cb9c93a4e99bc5384c646599aee996 || goto error call :downloadfile "qttranslations-everywhere-src-%QT%.zip" "https://download.qt.io/official_releases/qt/%QTMINOR%/%QT%/submodules/qttranslations-everywhere-src-%QT%.zip" a061e8d61eb7c03823ead92fe46b5722ed7b8119aeb84157d80f10a53c77d262 || goto error call :downloadfile "libwebp-%WEBP%.tar.gz" "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-%WEBP%.tar.gz" 2a499607df669e40258e53d0ade8035ba4ec0175244869d1025d460562aa09b4 || goto error +call :downloadfile "zlib%ZLIBSHORT%.zip" "https://zlib.net/zlib%ZLIBSHORT%.zip" 72af66d44fcc14c22013b46b814d5d2514673dda3d115e64b690c1ad636e7b17 || goto error +call :downloadfile "zstd-%ZSTD%.zip" "https://github.com/facebook/zstd/archive/refs/tags/v%ZSTD%.zip" c5c8daa1d40dabc51790c62a5b86af2b36dfc4e1a738ff10dc4a46ea4e68ee51 || goto error if %DEBUG%==1 ( echo Building debug and release libraries... @@ -58,6 +70,51 @@ if %DEBUG%==1 ( set FORCEPDB=-DCMAKE_SHARED_LINKER_FLAGS_RELEASE="/DEBUG" +echo Building Zlib... +rmdir /S /Q "zlib-%ZLIB%" +%SEVENZIP% x "zlib%ZLIBSHORT%.zip" || goto error +cd "zlib-%ZLIB%" || goto error +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DZLIB_BUILD_EXAMPLES=OFF -B build -G Ninja || goto error +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + +echo Building libpng... +rmdir /S /Q "lpng%LIBPNG%" +%SEVENZIP% x "lpng%LIBPNG%.zip" || goto error +cd "lpng%LIBPNG%" || goto error +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DBUILD_SHARED_LIBS=ON -DPNG_TESTS=OFF -DPNG_STATIC=OFF -DPNG_SHARED=ON -DPNG_TOOLS=OFF -B build -G Ninja || goto error +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + +echo Building libjpeg... +%SEVENZIP% x "jpegsr%LIBJPEG%.zip" || goto error +cd "jpeg-%LIBJPEG%" || goto error +%PATCH% -p1 < "%SCRIPTDIR%\libjpeg-cmake.patch" || goto error +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -B build -G Ninja || goto error +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + +echo Building Zstandard... +rmdir /S /Q "zstd-%ZSTD%" +%SEVENZIP% x "-x^!zstd-1.5.5\tests\cli-tests\bin" "zstd-%ZSTD%.zip" || goto error +cd "zstd-%ZSTD%" +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DBUILD_SHARED_LIBS=ON -DZSTD_BUILD_SHARED=ON -DZSTD_BUILD_STATIC=OFF -DZSTD_BUILD_PROGRAMS=OFF -B build -G Ninja build/cmake +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + +echo Building WebP... +rmdir /S /Q "libwebp-%WEBP%" +tar -xf "libwebp-%WEBP%.tar.gz" || goto error +cd "libwebp-%WEBP%" || goto error +cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON -G Ninja || goto error +cmake --build build --parallel || goto error +ninja -C build install || goto error +cd .. || goto error + echo Building SDL... rmdir /S /Q "%SDL%" %SEVENZIP% x "%SDL%.zip" || goto error @@ -74,15 +131,6 @@ ninja -C build install || goto error copy build\SDL2.pdb "%INSTALLDIR%\bin" || goto error cd .. || goto error -echo Building WebP... -rmdir /S /Q "libwebp-%WEBP%" -tar -xf "libwebp-%WEBP%.tar.gz" || goto error -cd "libwebp-%WEBP%" || goto error -cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="%INSTALLDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPINFO=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DBUILD_SHARED_LIBS=ON -G Ninja || goto error -cmake --build build --parallel || goto error -ninja -C build install || goto error -cd .. || goto error - if %DEBUG%==1 ( set QTBUILDSPEC=-DCMAKE_CONFIGURATION_TYPES="Release;Debug" -G "Ninja Multi-Config" ) else ( @@ -93,7 +141,7 @@ echo Building Qt base... rmdir /S /Q "qtbase-everywhere-src-%QT%" %SEVENZIP% x "qtbase-everywhere-src-%QT%.zip" || goto error cd "qtbase-everywhere-src-%QT%" || goto error -cmake -B build -DFEATURE_sql=OFF -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" %FORCEPDB% -DINPUT_gui=yes -DINPUT_widgets=yes -DINPUT_ssl=yes -DINPUT_openssl=no -DINPUT_schannel=yes %QTBUILDSPEC% || goto error +cmake -B build -DFEATURE_sql=OFF -DCMAKE_INSTALL_PREFIX="%INSTALLDIR%" %FORCEPDB% -DINPUT_gui=yes -DINPUT_widgets=yes -DINPUT_ssl=yes -DINPUT_openssl=no -DINPUT_schannel=yes -DFEATURE_system_png=ON -DFEATURE_system_jpeg=ON -DFEATURE_system_zlib=ON %QTBUILDSPEC% || goto error cmake --build build --parallel || goto error ninja -C build install || goto error cd .. || goto error @@ -104,7 +152,7 @@ rmdir /S /Q "qtsvg-everywhere-src-%QT%" cd "qtsvg-everywhere-src-%QT%" || goto error mkdir build || goto error cd build || goto error -call "%INSTALLDIR%\bin\qt-configure-module.bat" .. -- %FORCEPDB% || goto error +call "%INSTALLDIR%\bin\qt-configure-module.bat" .. -- %FORCEPDB% -DCMAKE_PREFIX_PATH="%INSTALLDIR%" || goto error cmake --build . --parallel || goto error ninja install || goto error cd ..\.. || goto error diff --git a/scripts/build-dependencies.sh b/scripts/build-dependencies.sh index 4dce94ced..2a2d2c5c7 100755 --- a/scripts/build-dependencies.sh +++ b/scripts/build-dependencies.sh @@ -9,16 +9,27 @@ fi INSTALLDIR="$1" NPROCS="$(getconf _NPROCESSORS_ONLN)" + +LIBBACKTRACE=ad106d5fdd5d960bd33fae1c48a351af567fd075 +LIBJPEG=9f +LIBPNG=1.6.43 +LIBWEBP=1.3.2 SDL=SDL2-2.30.1 QT=6.6.2 -LIBBACKTRACE=ad106d5fdd5d960bd33fae1c48a351af567fd075 +ZLIB=1.3.1 +ZSTD=1.5.5 mkdir -p deps-build cd deps-build cat > SHASUMS < ++ $ ++ ) ++ set_target_properties(libjpeg ++ PROPERTIES ++ VERSION ${PROJECT_VERSION_MAJOR} ++ POSITION_INDEPENDENT_CODE ON ++ CLEAN_DIRECT_OUTPUT ON ++ PUBLIC_HEADER "${PUBLIC_HDRS}" ++ ) ++ install(TARGETS libjpeg ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++ ) ++endif() ++ ++if(BUILD_STATIC_LIBS) ++ add_library(libjpeg_static STATIC $) ++ target_include_directories(libjpeg_static ++ PUBLIC ++ $ ++ $ ++ ) ++ set_target_properties(libjpeg_static ++ PROPERTIES ++ OUTPUT_NAME jpeg ++ VERSION ${PROJECT_VERSION_MAJOR} ++ POSITION_INDEPENDENT_CODE ON ++ CLEAN_DIRECT_OUTPUT ON ++ PUBLIC_HEADER "${PUBLIC_HDRS}" ++ ) ++ install(TARGETS libjpeg_static ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++ ) ++endif() ++ ++# Configure and install pkg-config and libtool files ++if(BUILD_STATIC_LIBS OR BUILD_SHARED_LIBS) ++ # Compute the la file's weird version number ++ math(EXPR JPEG_CONF_VER_MAJOR "${PROJECT_VERSION_MAJOR} + ${PROJECT_VERSION_MINOR}") ++ set(JPEG_LIB_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) ++ set(JPEG_LIB_VERSION_MINOR ${PROJECT_VERSION_MINOR}) ++ ++ # Configure and install ++ configure_file(libjpeg.pc.cmakein libjpeg.pc @ONLY) ++ install(FILES ++ ${CMAKE_CURRENT_BINARY_DIR}/libjpeg.pc ++ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig ++ ) ++endif() ++ +diff -ruN jpeg-9f/ConfigureJConfig.cmake jpeg-9f-new/ConfigureJConfig.cmake +--- jpeg-9f/ConfigureJConfig.cmake 1970-01-01 10:00:00.000000000 +1000 ++++ jpeg-9f-new/ConfigureJConfig.cmake 2024-03-23 21:09:37.223882900 +1000 +@@ -0,0 +1,95 @@ ++include(CheckIncludeFile) ++include(CheckSymbolExists) ++include(CheckTypeSize) ++ ++# Define this if your system has an ANSI-conforming file. ++check_include_file(stddef.h HAVE_STDDEF_H) ++ ++# Define this if your system has an ANSI-conforming file. ++check_include_file(stdlib.h HAVE_STDLIB_H) ++ ++# Does your compiler support function prototypes? ++# (If not, you also need to use ansi2knr, see install.txt) ++set(HAVE_PROTOTYPES true CACHE BOOL "Does your compiler support function prototypes?") ++ ++# Does your compiler support the declaration "unsigned char" ? ++# How about "unsigned short" ? ++check_type_size("unsigned char" UNSIGNED_CHAR LANGUAGE C) ++check_type_size("unsigned short" UNSIGNED_SHORT LANGUAGE C) ++ ++# Define "void" as "char" if your compiler doesn't know about type void. ++# NOTE: be sure to define void such that "void *" represents the most general ++# pointer type, e.g., that returned by malloc(). ++# NOT IMPLEMENTED: Modify in jconfig.h.in # ++ ++# Define "const" as empty if your compiler doesn't know the "const" keyword. ++# NOT IMPLEMENTED: Modify in jconfig.h.in # ++ ++# Define this if an ordinary "char" type is unsigned. ++# If you're not sure, leaving it undefined will work at some cost in speed. ++# If you defined HAVE_UNSIGNED_CHAR then the speed difference is minimal. ++set(CHAR_IS_UNSIGNED false CACHE BOOL "char type is unsigned") ++ ++# Define this if your system does not have an ANSI/SysV , ++# but does have a BSD-style . ++set(NEED_BSD_STRINGS false CACHE BOOL "Use BSD . Use only if system lacks ANSI/SysV ") ++ ++# Define this if your system does not provide typedef size_t in any of the ++# ANSI-standard places (stddef.h, stdlib.h, or stdio.h), but places it in ++# instead. ++set(NEED_SYS_TYPES_H false CACHE BOOL "size_t defined in ") ++ ++# For 80x86 machines, you need to define NEED_FAR_POINTERS, ++# unless you are using a large-data memory model or 80386 flat-memory mode. ++# On less brain-damaged CPUs this symbol must not be defined. ++# (Defining this symbol causes large data structures to be referenced through ++# "far" pointers and to be allocated with a special version of malloc.) ++set(NEED_FAR_POINTERS false CACHE BOOL "Reference large data structures through 'far' pointers allocated with a special version of malloc") ++ ++# Define this if your linker needs global names to be unique in less ++# than the first 15 characters. ++set(NEED_SHORT_EXTERNAL_NAMES false CACHE BOOL "Global names must be unique in less than the first 15 characters") ++ ++# Although a real ANSI C compiler can deal perfectly well with pointers to ++# unspecified structures (see "incomplete types" in the spec), a few pre-ANSI ++# and pseudo-ANSI compilers get confused. To keep one of these bozos happy, ++# define INCOMPLETE_TYPES_BROKEN. This is not recommended unless you ++# actually get "missing structure definition" warnings or errors while ++# compiling the JPEG code. ++set(INCOMPLETE_TYPES_BROKEN false CACHE BOOL "Disable pointers to unspecified structures") ++ ++# Define "boolean" as unsigned char, not enum, on Windows systems. ++# NOT IMPLEMENTED: Modify in jconfig.h.in # ++ ++# The following options affect code selection within the JPEG library, ++# but they don't need to be visible to applications using the library. ++# To minimize application namespace pollution, the symbols won't be ++# defined unless JPEG_INTERNALS has been defined. ++# ++ ++# Define this if your compiler implements ">>" on signed values as a logical ++# (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift, ++# which is the normal and rational definition. ++set(RIGHT_SHIFT_IS_UNSIGNED false CACHE BOOL "Compiler implements >> on signed values as a logical (unsigned) shift") ++ ++# The remaining options do not affect the JPEG library proper, ++# but only the sample applications cjpeg/djpeg (see cjpeg.c, djpeg.c). ++# Other applications can ignore these. ++# ++ ++mark_as_advanced(FORCE ++ HAVE_PROTOTYPES ++ HAVE_UNSIGNED_CHAR ++ HAVE_UNSIGNED_SHORT ++ CHAR_IS_UNSIGNED ++ HAVE_STDDEF_H ++ HAVE_STDLIB_H ++ NEED_BSD_STRINGS ++ NEED_SYS_TYPES_H ++ NEED_FAR_POINTERS ++ NEED_SHORT_EXTERNAL_NAMES ++ INCOMPLETE_TYPES_BROKEN ++ RIGHT_SHIFT_IS_UNSIGNED ++) ++ ++configure_file(jconfig.h.in ${CMAKE_CURRENT_SOURCE_DIR}/jconfig.h) +diff -ruN jpeg-9f/jconfig.h.in jpeg-9f-new/jconfig.h.in +--- jpeg-9f/jconfig.h.in 1970-01-01 10:00:00.000000000 +1000 ++++ jpeg-9f-new/jconfig.h.in 2024-03-23 21:06:05.204994600 +1000 +@@ -0,0 +1,173 @@ ++/* ++ * jconfig.h.in ++ * ++ * Copyright (C) 1991-1994, Thomas G. Lane. ++ * Modified 2009-2013 by Guido Vollbeding. ++ * This file is part of the Independent JPEG Group's software. ++ * For conditions of distribution and use, see the accompanying README file. ++ * ++ * This file is a modification of jconfig.txt from libjpeg. In addition to ++ * documenting the configuration options that are required to customize the ++ * JPEG software for a particular system, it is used by jpeg-cmake to configure ++ * jconfig.h ++ */ ++ ++ ++/* ++ * These symbols indicate the properties of your machine or compiler. ++ * #define the symbol if yes, #undef it if no. ++ */ ++ ++/* Does your compiler support function prototypes? ++ * (If not, you also need to use ansi2knr, see install.txt) ++ */ ++#cmakedefine HAVE_PROTOTYPES ++ ++/* Does your compiler support the declaration "unsigned char" ? ++ * How about "unsigned short" ? ++ */ ++#cmakedefine HAVE_UNSIGNED_CHAR ++#cmakedefine HAVE_UNSIGNED_SHORT ++ ++/* Define "void" as "char" if your compiler doesn't know about type void. ++ * NOTE: be sure to define void such that "void *" represents the most general ++ * pointer type, e.g., that returned by malloc(). ++ */ ++/* #define void char */ ++ ++/* Define "const" as empty if your compiler doesn't know the "const" keyword. ++ */ ++/* #define const */ ++ ++/* Define this if an ordinary "char" type is unsigned. ++ * If you're not sure, leaving it undefined will work at some cost in speed. ++ * If you defined HAVE_UNSIGNED_CHAR then the speed difference is minimal. ++ */ ++#cmakedefine CHAR_IS_UNSIGNED ++ ++/* Define this if your system has an ANSI-conforming file. ++ */ ++#cmakedefine HAVE_STDDEF_H ++ ++/* Define this if your system has an ANSI-conforming file. ++ */ ++#cmakedefine HAVE_STDLIB_H ++ ++/* Define this if your system does not have an ANSI/SysV , ++ * but does have a BSD-style . ++ */ ++#cmakedefine NEED_BSD_STRINGS ++ ++/* Define this if your system does not provide typedef size_t in any of the ++ * ANSI-standard places (stddef.h, stdlib.h, or stdio.h), but places it in ++ * instead. ++ */ ++#cmakedefine NEED_SYS_TYPES_H ++ ++/* For 80x86 machines, you need to define NEED_FAR_POINTERS, ++ * unless you are using a large-data memory model or 80386 flat-memory mode. ++ * On less brain-damaged CPUs this symbol must not be defined. ++ * (Defining this symbol causes large data structures to be referenced through ++ * "far" pointers and to be allocated with a special version of malloc.) ++ */ ++#cmakedefine NEED_FAR_POINTERS ++ ++/* Define this if your linker needs global names to be unique in less ++ * than the first 15 characters. ++ */ ++#cmakedefine NEED_SHORT_EXTERNAL_NAMES ++ ++/* Although a real ANSI C compiler can deal perfectly well with pointers to ++ * unspecified structures (see "incomplete types" in the spec), a few pre-ANSI ++ * and pseudo-ANSI compilers get confused. To keep one of these bozos happy, ++ * define INCOMPLETE_TYPES_BROKEN. This is not recommended unless you ++ * actually get "missing structure definition" warnings or errors while ++ * compiling the JPEG code. ++ */ ++#cmakedefine INCOMPLETE_TYPES_BROKEN ++ ++/* Define "boolean" as unsigned char, not enum, on Windows systems. ++ */ ++#ifdef _WIN32 ++#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ ++typedef unsigned char boolean; ++#endif ++#ifndef FALSE /* in case these macros already exist */ ++#define FALSE 0 /* values of boolean */ ++#endif ++#ifndef TRUE ++#define TRUE 1 ++#endif ++#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ ++#endif ++ ++ ++/* ++ * The following options affect code selection within the JPEG library, ++ * but they don't need to be visible to applications using the library. ++ * To minimize application namespace pollution, the symbols won't be ++ * defined unless JPEG_INTERNALS has been defined. ++ */ ++ ++#ifdef JPEG_INTERNALS ++ ++/* Define this if your compiler implements ">>" on signed values as a logical ++ * (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift, ++ * which is the normal and rational definition. ++ */ ++#cmakedefine RIGHT_SHIFT_IS_UNSIGNED ++ ++ ++#endif /* JPEG_INTERNALS */ ++ ++ ++/* ++ * The remaining options do not affect the JPEG library proper, ++ * but only the sample applications cjpeg/djpeg (see cjpeg.c, djpeg.c). ++ * Other applications can ignore these. ++ */ ++ ++#ifdef JPEG_CJPEG_DJPEG ++ ++/* These defines indicate which image (non-JPEG) file formats are allowed. */ ++ ++#cmakedefine BMP_SUPPORTED /* BMP image file format */ ++#cmakedefine GIF_SUPPORTED /* GIF image file format */ ++#cmakedefine PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */ ++#cmakedefine RLE_SUPPORTED /* Utah RLE image file format */ ++#cmakedefine TARGA_SUPPORTED /* Targa image file format */ ++ ++/* ++ * This defines the default output format for djpeg. Must be one of the FMT_* ++ * enums found in djpeg.c or djpegalt.c ++ */ ++#cmakedefine DEFAULT_FMT @DEFAULT_FMT@ ++ ++/* Define this if you want to name both input and output files on the command ++ * line, rather than using stdout and optionally stdin. You MUST do this if ++ * your system can't cope with binary I/O to stdin/stdout. See comments at ++ * head of cjpeg.c or djpeg.c. ++ */ ++#cmakedefine TWO_FILE_COMMANDLINE ++ ++/* Define this if your system needs explicit cleanup of temporary files. ++ * This is crucial under MS-DOS, where the temporary "files" may be areas ++ * of extended memory; on most other systems it's not as important. ++ */ ++#cmakedefine NEED_SIGNAL_CATCHER ++ ++/* By default, we open image files with fopen(...,"rb") or fopen(...,"wb"). ++ * This is necessary on systems that distinguish text files from binary files, ++ * and is harmless on most systems that don't. If you have one of the rare ++ * systems that complains about the "b" spec, define this symbol. ++ */ ++#cmakedefine DONT_USE_B_MODE ++ ++/* Define this if you want percent-done progress reports from cjpeg/djpeg. ++ */ ++#cmakedefine PROGRESS_REPORT ++ ++/* Define this if you *don't* want overwrite confirmation */ ++#cmakedefine NO_OVERWRITE_CHECK ++ ++#endif /* JPEG_CJPEG_DJPEG */ +diff -ruN jpeg-9f/jmorecfg.h jpeg-9f-new/jmorecfg.h +--- jpeg-9f/jmorecfg.h 2022-03-31 19:41:26.000000000 +1000 ++++ jpeg-9f-new/jmorecfg.h 2024-03-23 21:20:25.514814400 +1000 +@@ -244,8 +244,13 @@ + #define LOCAL(type) static type + /* a function referenced thru EXTERNs: */ + #define GLOBAL(type) type ++ + /* a reference to a GLOBAL function: */ +-#define EXTERN(type) extern type ++#ifdef COMPILING_LIBJPEG ++#define EXTERN(type) __declspec(dllexport) extern type ++#else ++#define EXTERN(type) __declspec(dllimport) extern type ++#endif + + + /* This macro is used to declare a "method", that is, a function pointer. +diff -ruN jpeg-9f/libjpeg.pc.cmakein jpeg-9f-new/libjpeg.pc.cmakein +--- jpeg-9f/libjpeg.pc.cmakein 1970-01-01 10:00:00.000000000 +1000 ++++ jpeg-9f-new/libjpeg.pc.cmakein 2024-03-23 21:06:13.922695100 +1000 +@@ -0,0 +1,10 @@ ++prefix=@CMAKE_INSTALL_PREFIX@ ++exec_prefix=${prefix} ++libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ ++includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ ++ ++Name: libjpeg ++Description: Reads and writes JPEG files ++Version: @JPEG_LIB_VERSION_MAJOR@.@JPEG_LIB_VERSION_MINOR@.0 ++Libs: -L${libdir} -ljpeg ++Cflags: -I${includedir}