@@ -15,13 +15,18 @@ Build Requirements
1515 * If using NASM, 2.10 or later is required.
1616 * If using NASM, 2.10 or later (except 2.11.08) is required for an x86-64 Mac
1717 build (2.11.08 does not work properly with libjpeg-turbo's x86-64 SIMD code
18- when building macho64 objects.) NASM or YASM can be obtained from
19- [ MacPorts] ( http://www.macports.org/ ) or [ Homebrew] ( http://brew.sh/ ) .
18+ when building macho64 objects.)
2019 * If using YASM, 1.2.0 or later is required.
20+ * If building on macOS, NASM or YASM can be obtained from
21+ [ MacPorts] ( http://www.macports.org/ ) or [ Homebrew] ( http://brew.sh/ ) .
2122 - NOTE: Currently, if it is desirable to hide the SIMD function symbols in
2223 Mac executables or shared libraries that statically link with
23- libjpeg-turbo, then YASM must be used when building libjpeg-turbo.
24+ libjpeg-turbo, then NASM 2.14 or later or YASM must be used when
25+ building libjpeg-turbo.
2426 * If building on Windows, ** nasm.exe** /** yasm.exe** should be in your ` PATH ` .
27+ * NASM and YASM are located in the CRB (Code Ready Builder) repository on
28+ Red Hat Enterprise Linux 8 and in the PowerTools repository on CentOS 8,
29+ which is not enabled by default.
2530
2631 The binary RPMs released by the NASM project do not work on older Linux
2732 systems, such as Red Hat Enterprise Linux 5. On such systems, you can easily
@@ -48,8 +53,9 @@ Build Requirements
4853 install the Java Developer Package, which can be downloaded from
4954 < http://developer.apple.com/downloads > (Apple ID required.) For other
5055 systems, you can obtain the Oracle Java Development Kit from
51- < http://www.java .com > .
56+ < http://www.oracle .com/technetwork/java/javase/downloads > .
5257
58+ * If using JDK 11 or later, CMake 3.10.x or later must also be used.
5359
5460### Windows
5561
@@ -83,7 +89,10 @@ Build Requirements
8389 appropriate compiler paths automatically set.
8490
8591- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This
86- can be downloaded from < http://www.java.com > .
92+ can be downloaded from
93+ < http://www.oracle.com/technetwork/java/javase/downloads > .
94+
95+ * If using JDK 11 or later, CMake 3.10.x or later must also be used.
8796
8897
8998Out-of-Tree Builds
@@ -521,7 +530,7 @@ a universal library.
521530Building libjpeg-turbo for Android
522531----------------------------------
523532
524- Building libjpeg-turbo for Android platforms requires the
533+ Building libjpeg-turbo for Android platforms requires v13b or later of the
525534[ Android NDK] ( https://developer.android.com/tools/sdk/ndk ) .
526535
527536
@@ -531,35 +540,21 @@ The following is a general recipe script that can be modified for your specific
531540needs.
532541
533542 # Set these variables to suit your needs
534- NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
535- BUILD_PLATFORM={the platform name for the NDK package you installed--
536- for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
537- TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
538- toolchain directory under ${NDK_PATH}/toolchains/.}
539- ANDROID_VERSION={The minimum version of Android to support-- for example,
543+ NDK_PATH={full path to the NDK directory-- for example,
544+ /opt/android/android-ndk-r16b}
545+ TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r16b and earlier,
546+ and "clang" must be used with NDK r17c and later}
547+ ANDROID_VERSION={the minimum version of Android to support-- for example,
540548 "16", "19", etc.}
541549
542- # It should not be necessary to modify the rest
543- HOST=arm-linux-androideabi
544- SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm
545- export CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \
546- -D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
547- -isystem ${NDK_PATH}/sysroot/usr/include \
548- -isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
549- export LDFLAGS=-pie
550- TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
551-
552550 cd {build_directory}
553-
554- cat <<EOF >toolchain.cmake
555- set(CMAKE_SYSTEM_NAME Linux)
556- set(CMAKE_SYSTEM_PROCESSOR arm)
557- set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
558- set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
559- EOF
560-
561- cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
562- -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
551+ cmake -G"Unix Makefiles" \
552+ -DANDROID_ABI=armeabi-v7a \
553+ -DANDROID_ARM_MODE=arm \
554+ -DANDROID_PLATFORM=android-${ANDROID_VERSION} \
555+ -DANDROID_TOOLCHAIN=${TOOLCHAIN} \
556+ -DCMAKE_ASM_FLAGS="--target=arm-linux-androideabi${ANDROID_VERSION}" \
557+ -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
563558 [additional CMake flags] {source_directory}
564559 make
565560
@@ -570,34 +565,21 @@ The following is a general recipe script that can be modified for your specific
570565needs.
571566
572567 # Set these variables to suit your needs
573- NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
574- BUILD_PLATFORM={the platform name for the NDK package you installed--
575- for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
576- TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
577- toolchain directory under ${NDK_PATH}/toolchains/.}
578- ANDROID_VERSION={The minimum version of Android to support. "21" or later
568+ NDK_PATH={full path to the NDK directory-- for example,
569+ /opt/android/android-ndk-r16b}
570+ TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier,
571+ and "clang" must be used with NDK r17c and later}
572+ ANDROID_VERSION={the minimum version of Android to support. "21" or later
579573 is required for a 64-bit build.}
580574
581- # It should not be necessary to modify the rest
582- HOST=aarch64-linux-android
583- SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm64
584- export CFLAGS="-D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
585- -isystem ${NDK_PATH}/sysroot/usr/include \
586- -isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
587- export LDFLAGS=-pie
588- TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
589-
590575 cd {build_directory}
591-
592- cat <<EOF >toolchain.cmake
593- set(CMAKE_SYSTEM_NAME Linux)
594- set(CMAKE_SYSTEM_PROCESSOR aarch64)
595- set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
596- set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
597- EOF
598-
599- cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
600- -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
576+ cmake -G"Unix Makefiles" \
577+ -DANDROID_ABI=arm64-v8a \
578+ -DANDROID_ARM_MODE=arm \
579+ -DANDROID_PLATFORM=android-${ANDROID_VERSION} \
580+ -DANDROID_TOOLCHAIN=${TOOLCHAIN} \
581+ -DCMAKE_ASM_FLAGS="--target=aarch64-linux-android${ANDROID_VERSION}" \
582+ -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
601583 [additional CMake flags] {source_directory}
602584 make
603585
@@ -608,34 +590,19 @@ The following is a general recipe script that can be modified for your specific
608590needs.
609591
610592 # Set these variables to suit your needs
611- NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
612- BUILD_PLATFORM={the platform name for the NDK package you installed--
613- for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
614- TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
615- toolchain directory under ${NDK_PATH}/toolchains/.}
593+ NDK_PATH={full path to the NDK directory-- for example,
594+ /opt/android/android-ndk-r16b}
595+ TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier,
596+ and "clang" must be used with NDK r17c and later}
616597 ANDROID_VERSION={The minimum version of Android to support-- for example,
617598 "16", "19", etc.}
618599
619- # It should not be necessary to modify the rest
620- HOST=i686-linux-android
621- SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-x86
622- export CFLAGS="-D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
623- -isystem ${NDK_PATH}/sysroot/usr/include \
624- -isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
625- export LDFLAGS=-pie
626- TOOLCHAIN=${NDK_PATH}/toolchains/x86-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
627-
628600 cd {build_directory}
629-
630- cat <<EOF >toolchain.cmake
631- set(CMAKE_SYSTEM_NAME Linux)
632- set(CMAKE_SYSTEM_PROCESSOR i386)
633- set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
634- set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
635- EOF
636-
637- cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
638- -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
601+ cmake -G"Unix Makefiles" \
602+ -DANDROID_ABI=x86 \
603+ -DANDROID_PLATFORM=android-${ANDROID_VERSION} \
604+ -DANDROID_TOOLCHAIN=${TOOLCHAIN} \
605+ -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
639606 [additional CMake flags] {source_directory}
640607 make
641608
@@ -646,45 +613,23 @@ The following is a general recipe script that can be modified for your specific
646613needs.
647614
648615 # Set these variables to suit your needs
649- NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
650- BUILD_PLATFORM={the platform name for the NDK package you installed--
651- for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
652- TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
653- toolchain directory under ${NDK_PATH}/toolchains/.}
654- ANDROID_VERSION={The minimum version of Android to support. "21" or later
616+ NDK_PATH={full path to the NDK directory-- for example,
617+ /opt/android/android-ndk-r16b}
618+ TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier,
619+ and "clang" must be used with NDK r17c and later}
620+ ANDROID_VERSION={the minimum version of Android to support. "21" or later
655621 is required for a 64-bit build.}
656622
657- # It should not be necessary to modify the rest
658- HOST=x86_64-linux-android
659- SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-x86_64
660- export CFLAGS="-D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
661- -isystem ${NDK_PATH}/sysroot/usr/include \
662- -isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
663- export LDFLAGS=-pie
664- TOOLCHAIN=${NDK_PATH}/toolchains/x86_64-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}
665-
666623 cd {build_directory}
667-
668- cat <<EOF >toolchain.cmake
669- set(CMAKE_SYSTEM_NAME Linux)
670- set(CMAKE_SYSTEM_PROCESSOR x86_64)
671- set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
672- set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
673- EOF
674-
675- cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
676- -DCMAKE_POSITION_INDEPENDENT_CODE=1 \
624+ cmake -G"Unix Makefiles" \
625+ -DANDROID_ABI=x86_64 \
626+ -DANDROID_PLATFORM=android-${ANDROID_VERSION} \
627+ -DANDROID_TOOLCHAIN=${TOOLCHAIN} \
628+ -DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
677629 [additional CMake flags] {source_directory}
678630 make
679631
680632
681- If building for Android 4.0.x (API level < 16) or earlier, remove
682- ` -DCMAKE_POSITION_INDEPENDENT_CODE=1 ` from the CMake arguments and ` -pie ` from
683- ` LDFLAGS ` .
684-
685- If building on Windows, add ` .exe ` to the end of ` CMAKE_C_COMPILER ` .
686-
687-
688633Advanced CMake Options
689634----------------------
690635
0 commit comments