From cc8e65d444a3def70eb0bd85eefe294313b14441 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 24 Aug 2024 18:08:15 +1000 Subject: [PATCH] Deps: Switch to libjpeg-turbo --- .github/workflows/rolling-release.yml | 2 +- README.md | 4 +- scripts/deps/build-dependencies-linux.sh | 24 +- scripts/deps/build-dependencies-mac.sh | 34 +- .../deps/build-dependencies-windows-arm64.bat | 13 +- .../deps/build-dependencies-windows-x64.bat | 13 +- scripts/deps/libjpeg-cmake.patch | 422 ------------------ src/util/util.props | 4 +- 8 files changed, 42 insertions(+), 474 deletions(-) delete mode 100644 scripts/deps/libjpeg-cmake.patch diff --git a/.github/workflows/rolling-release.yml b/.github/workflows/rolling-release.yml index c982e1f99..50fea617b 100644 --- a/.github/workflows/rolling-release.yml +++ b/.github/workflows/rolling-release.yml @@ -216,7 +216,7 @@ jobs: libssl-dev libudev-dev libwayland-dev libx11-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-cursor-dev libxcb-damage0-dev libxcb-glx0-dev \ libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev \ libxcb-shm0-dev libxcb-sync-dev libxcb-util-dev libxcb-xfixes0-dev libxcb-xinput-dev libxcb-xkb-dev libxext-dev libxkbcommon-x11-dev libxrandr-dev lld-17 \ - llvm-17 ninja-build patchelf pkg-config zlib1g-dev + llvm-17 nasm ninja-build patchelf pkg-config zlib1g-dev - name: Cache Dependencies id: cache-deps diff --git a/README.md b/README.md index fdddb1a13..1a6627fc2 100644 --- a/README.md +++ b/README.md @@ -162,12 +162,12 @@ Requirements: Ubuntu/Debian package names: ``` -build-essential clang cmake curl extra-cmake-modules git libasound2-dev libcurl4-openssl-dev libdbus-1-dev libdecor-0-dev libegl-dev libevdev-dev libfontconfig-dev libfreetype-dev libgtk-3-dev libgudev-1.0-dev libharfbuzz-dev libinput-dev libopengl-dev libpipewire-0.3-dev libpulse-dev libssl-dev libudev-dev libwayland-dev libx11-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-cursor-dev libxcb-damage0-dev libxcb-glx0-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev libxcb-shm0-dev libxcb-sync-dev libxcb-util-dev libxcb-xfixes0-dev libxcb-xinput-dev libxcb-xkb-dev libxext-dev libxkbcommon-x11-dev libxrandr-dev lld llvm ninja-build pkg-config zlib1g-dev +build-essential clang cmake curl extra-cmake-modules git libasound2-dev libcurl4-openssl-dev libdbus-1-dev libdecor-0-dev libegl-dev libevdev-dev libfontconfig-dev libfreetype-dev libgtk-3-dev libgudev-1.0-dev libharfbuzz-dev libinput-dev libopengl-dev libpipewire-0.3-dev libpulse-dev libssl-dev libudev-dev libwayland-dev libx11-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-cursor-dev libxcb-damage0-dev libxcb-glx0-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev libxcb-shm0-dev libxcb-sync-dev libxcb-util-dev libxcb-xfixes0-dev libxcb-xinput-dev libxcb-xkb-dev libxext-dev libxkbcommon-x11-dev libxrandr-dev lld llvm nasm ninja-build pkg-config zlib1g-dev ``` Fedora package names: ``` -alsa-lib-devel brotli-devel clang cmake dbus-devel egl-wayland-devel extra-cmake-modules fontconfig-devel gcc-c++ gtk3-devel libavcodec-free-devel libavformat-free-devel libavutil-free-devel libcurl-devel libdecor-devel libevdev-devel libICE-devel libinput-devel libSM-devel libswresample-free-devel libswscale-free-devel libX11-devel libXau-devel libxcb-devel libXcomposite-devel libXcursor-devel libXext-devel libXfixes-devel libXft-devel libXi-devel libxkbcommon-devel libxkbcommon-x11-devel libXpresent-devel libXrandr-devel libXrender-devel lld llvm make mesa-libEGL-devel mesa-libGL-devel ninja-build openssl-devel patch pcre2-devel perl-Digest-SHA pipewire-devel pulseaudio-libs-devel systemd-devel wayland-devel xcb-util-cursor-devel xcb-util-devel xcb-util-errors-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel xcb-util-wm-devel xcb-util-xrm-devel zlib-devel +alsa-lib-devel brotli-devel clang cmake dbus-devel egl-wayland-devel extra-cmake-modules fontconfig-devel gcc-c++ gtk3-devel libavcodec-free-devel libavformat-free-devel libavutil-free-devel libcurl-devel libdecor-devel libevdev-devel libICE-devel libinput-devel libSM-devel libswresample-free-devel libswscale-free-devel libX11-devel libXau-devel libxcb-devel libXcomposite-devel libXcursor-devel libXext-devel libXfixes-devel libXft-devel libXi-devel libxkbcommon-devel libxkbcommon-x11-devel libXpresent-devel libXrandr-devel libXrender-devel lld llvm make mesa-libEGL-devel mesa-libGL-devel nasm ninja-build openssl-devel patch pcre2-devel perl-Digest-SHA pipewire-devel pulseaudio-libs-devel systemd-devel wayland-devel xcb-util-cursor-devel xcb-util-devel xcb-util-errors-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel xcb-util-wm-devel xcb-util-xrm-devel zlib-devel ``` #### Building diff --git a/scripts/deps/build-dependencies-linux.sh b/scripts/deps/build-dependencies-linux.sh index d883ec0da..1aaa34ae9 100755 --- a/scripts/deps/build-dependencies-linux.sh +++ b/scripts/deps/build-dependencies-linux.sh @@ -15,7 +15,7 @@ if [ "${INSTALLDIR:0:1}" != "/" ]; then fi LIBBACKTRACE=ad106d5fdd5d960bd33fae1c48a351af567fd075 -LIBJPEG=9f +LIBJPEGTURBO=3.0.3 LIBPNG=1.6.43 LIBWEBP=1.4.0 SDL2=2.30.6 @@ -33,7 +33,7 @@ cd deps-build cat > SHASUMS < 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} diff --git a/src/util/util.props b/src/util/util.props index fb3dae0c1..d6fdb23e8 100644 --- a/src/util/util.props +++ b/src/util/util.props @@ -26,7 +26,7 @@ %(AdditionalIncludeDirectories);$(DepsIncludeDir)SDL2 - %(AdditionalDependencies);cpuinfo.lib;freetype.lib;libjpeg.lib;libpng16.lib;libwebp.lib;SDL2.lib;soundtouch.lib;zlib.lib;zstd.lib + %(AdditionalDependencies);cpuinfo.lib;freetype.lib;jpeg.lib;libpng16.lib;libwebp.lib;SDL2.lib;soundtouch.lib;zlib.lib;zstd.lib @@ -34,7 +34,7 @@ - +