Skip to content

Commit

Permalink
Merge remote-tracking branch 'turbo/master'
Browse files Browse the repository at this point in the history
* turbo/master: (105 commits)
  makemacpkg.in: Allow universal DMG w/o ARMv8 arch
  Remove more unnecessary NULL checks before free()
  Eliminate unnecessary NULL checks before tjFree()
  Eliminate unnecessary NULL checks before free()
  simd/arm64/jsimd_neon.S: Fix checkstyle issue
  tjTransform(): Use instance err. for bad crop spec
  README.md, package specs: Various tweaks
  djpeg.c: Fix compiler warning w/o mem. src manager
  ARMv8 SIMD: Support execute-only memory (XOM)
  Travis: Use MacPorts instead of Homebrew
  Huffman enc.: Fix very rare local buffer overrun
  TurboJPEG: Fix erroneous subsampling detection
  ChangeLog.md: List CVE IDs for specific fixes
  tjDecompressToYUV*(): Fix OOB write/double free
  64-bit tjbench: Fix signed int overflow/segfault
  Fix copyright header formatting buglets
  example.txt: Avoid undefined setjmp() behavior
  Mac: Support hiding SIMD fct symbols w/ NASM 2.14+
  TJBench: Fix output with -componly -quiet
  Build: Don't require ASM_NASM if !REQUIRE_SIMD
  ...
  • Loading branch information
kornelski committed Feb 13, 2020
2 parents bbb7550 + 7032729 commit 1d23209
Show file tree
Hide file tree
Showing 150 changed files with 2,780 additions and 2,551 deletions.
171 changes: 58 additions & 113 deletions BUILDING.md
Expand Up @@ -15,13 +15,18 @@ Build Requirements
* If using NASM, 2.10 or later is required.
* If using NASM, 2.10 or later (except 2.11.08) is required for an x86-64 Mac
build (2.11.08 does not work properly with libjpeg-turbo's x86-64 SIMD code
when building macho64 objects.) NASM or YASM can be obtained from
[MacPorts](http://www.macports.org/) or [Homebrew](http://brew.sh/).
when building macho64 objects.)
* If using YASM, 1.2.0 or later is required.
* If building on macOS, NASM or YASM can be obtained from
[MacPorts](http://www.macports.org/) or [Homebrew](http://brew.sh/).
- NOTE: Currently, if it is desirable to hide the SIMD function symbols in
Mac executables or shared libraries that statically link with
libjpeg-turbo, then YASM must be used when building libjpeg-turbo.
libjpeg-turbo, then NASM 2.14 or later or YASM must be used when
building libjpeg-turbo.
* If building on Windows, **nasm.exe**/**yasm.exe** should be in your `PATH`.
* NASM and YASM are located in the CRB (Code Ready Builder) repository on
Red Hat Enterprise Linux 8 and in the PowerTools repository on CentOS 8,
which is not enabled by default.

The binary RPMs released by the NASM project do not work on older Linux
systems, such as Red Hat Enterprise Linux 5. On such systems, you can easily
Expand All @@ -48,8 +53,9 @@ Build Requirements
install the Java Developer Package, which can be downloaded from
<http://developer.apple.com/downloads> (Apple ID required.) For other
systems, you can obtain the Oracle Java Development Kit from
<http://www.java.com>.
<http://www.oracle.com/technetwork/java/javase/downloads>.

* If using JDK 11 or later, CMake 3.10.x or later must also be used.

### Windows

Expand Down Expand Up @@ -83,7 +89,10 @@ Build Requirements
appropriate compiler paths automatically set.

- If building the TurboJPEG Java wrapper, JDK 1.5 or later is required. This
can be downloaded from <http://www.java.com>.
can be downloaded from
<http://www.oracle.com/technetwork/java/javase/downloads>.

* If using JDK 11 or later, CMake 3.10.x or later must also be used.


Out-of-Tree Builds
Expand Down Expand Up @@ -521,7 +530,7 @@ a universal library.
Building libjpeg-turbo for Android
----------------------------------

Building libjpeg-turbo for Android platforms requires the
Building libjpeg-turbo for Android platforms requires v13b or later of the
[Android NDK](https://developer.android.com/tools/sdk/ndk).


Expand All @@ -531,35 +540,21 @@ The following is a general recipe script that can be modified for your specific
needs.

# Set these variables to suit your needs
NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
BUILD_PLATFORM={the platform name for the NDK package you installed--
for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
toolchain directory under ${NDK_PATH}/toolchains/.}
ANDROID_VERSION={The minimum version of Android to support-- for example,
NDK_PATH={full path to the NDK directory-- for example,
/opt/android/android-ndk-r16b}
TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r16b and earlier,
and "clang" must be used with NDK r17c and later}
ANDROID_VERSION={the minimum version of Android to support-- for example,
"16", "19", etc.}

# It should not be necessary to modify the rest
HOST=arm-linux-androideabi
SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm
export CFLAGS="-march=armv7-a -mfloat-abi=softfp -fprefetch-loop-arrays \
-D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
-isystem ${NDK_PATH}/sysroot/usr/include \
-isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
export LDFLAGS=-pie
TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}

cd {build_directory}

cat <<EOF >toolchain.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
EOF

cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
-DCMAKE_POSITION_INDEPENDENT_CODE=1 \
cmake -G"Unix Makefiles" \
-DANDROID_ABI=armeabi-v7a \
-DANDROID_ARM_MODE=arm \
-DANDROID_PLATFORM=android-${ANDROID_VERSION} \
-DANDROID_TOOLCHAIN=${TOOLCHAIN} \
-DCMAKE_ASM_FLAGS="--target=arm-linux-androideabi${ANDROID_VERSION}" \
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
[additional CMake flags] {source_directory}
make

Expand All @@ -570,34 +565,21 @@ The following is a general recipe script that can be modified for your specific
needs.

# Set these variables to suit your needs
NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
BUILD_PLATFORM={the platform name for the NDK package you installed--
for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
toolchain directory under ${NDK_PATH}/toolchains/.}
ANDROID_VERSION={The minimum version of Android to support. "21" or later
NDK_PATH={full path to the NDK directory-- for example,
/opt/android/android-ndk-r16b}
TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier,
and "clang" must be used with NDK r17c and later}
ANDROID_VERSION={the minimum version of Android to support. "21" or later
is required for a 64-bit build.}

# It should not be necessary to modify the rest
HOST=aarch64-linux-android
SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-arm64
export CFLAGS="-D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
-isystem ${NDK_PATH}/sysroot/usr/include \
-isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
export LDFLAGS=-pie
TOOLCHAIN=${NDK_PATH}/toolchains/${HOST}-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}

cd {build_directory}

cat <<EOF >toolchain.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
EOF

cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
-DCMAKE_POSITION_INDEPENDENT_CODE=1 \
cmake -G"Unix Makefiles" \
-DANDROID_ABI=arm64-v8a \
-DANDROID_ARM_MODE=arm \
-DANDROID_PLATFORM=android-${ANDROID_VERSION} \
-DANDROID_TOOLCHAIN=${TOOLCHAIN} \
-DCMAKE_ASM_FLAGS="--target=aarch64-linux-android${ANDROID_VERSION}" \
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
[additional CMake flags] {source_directory}
make

Expand All @@ -608,34 +590,19 @@ The following is a general recipe script that can be modified for your specific
needs.

# Set these variables to suit your needs
NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
BUILD_PLATFORM={the platform name for the NDK package you installed--
for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
toolchain directory under ${NDK_PATH}/toolchains/.}
NDK_PATH={full path to the NDK directory-- for example,
/opt/android/android-ndk-r16b}
TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier,
and "clang" must be used with NDK r17c and later}
ANDROID_VERSION={The minimum version of Android to support-- for example,
"16", "19", etc.}

# It should not be necessary to modify the rest
HOST=i686-linux-android
SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-x86
export CFLAGS="-D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
-isystem ${NDK_PATH}/sysroot/usr/include \
-isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
export LDFLAGS=-pie
TOOLCHAIN=${NDK_PATH}/toolchains/x86-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}

cd {build_directory}

cat <<EOF >toolchain.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR i386)
set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
EOF

cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
-DCMAKE_POSITION_INDEPENDENT_CODE=1 \
cmake -G"Unix Makefiles" \
-DANDROID_ABI=x86 \
-DANDROID_PLATFORM=android-${ANDROID_VERSION} \
-DANDROID_TOOLCHAIN=${TOOLCHAIN} \
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
[additional CMake flags] {source_directory}
make

Expand All @@ -646,45 +613,23 @@ The following is a general recipe script that can be modified for your specific
needs.

# Set these variables to suit your needs
NDK_PATH={full path to the "ndk" directory-- for example, /opt/android/sdk/ndk-bundle}
BUILD_PLATFORM={the platform name for the NDK package you installed--
for example, "windows-x86" or "linux-x86_64" or "darwin-x86_64"}
TOOLCHAIN_VERSION={"4.8", "4.9", "clang3.5", etc. This corresponds to a
toolchain directory under ${NDK_PATH}/toolchains/.}
ANDROID_VERSION={The minimum version of Android to support. "21" or later
NDK_PATH={full path to the NDK directory-- for example,
/opt/android/android-ndk-r16b}
TOOLCHAIN={"gcc" or "clang"-- "gcc" must be used with NDK r14b and earlier,
and "clang" must be used with NDK r17c and later}
ANDROID_VERSION={the minimum version of Android to support. "21" or later
is required for a 64-bit build.}

# It should not be necessary to modify the rest
HOST=x86_64-linux-android
SYSROOT=${NDK_PATH}/platforms/android-${ANDROID_VERSION}/arch-x86_64
export CFLAGS="-D__ANDROID_API__=${ANDROID_VERSION} --sysroot=${SYSROOT} \
-isystem ${NDK_PATH}/sysroot/usr/include \
-isystem ${NDK_PATH}/sysroot/usr/include/${HOST}"
export LDFLAGS=-pie
TOOLCHAIN=${NDK_PATH}/toolchains/x86_64-${TOOLCHAIN_VERSION}/prebuilt/${BUILD_PLATFORM}

cd {build_directory}

cat <<EOF >toolchain.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/${HOST}-gcc)
set(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/${HOST})
EOF

cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake \
-DCMAKE_POSITION_INDEPENDENT_CODE=1 \
cmake -G"Unix Makefiles" \
-DANDROID_ABI=x86_64 \
-DANDROID_PLATFORM=android-${ANDROID_VERSION} \
-DANDROID_TOOLCHAIN=${TOOLCHAIN} \
-DCMAKE_TOOLCHAIN_FILE=${NDK_PATH}/build/cmake/android.toolchain.cmake \
[additional CMake flags] {source_directory}
make


If building for Android 4.0.x (API level < 16) or earlier, remove
`-DCMAKE_POSITION_INDEPENDENT_CODE=1` from the CMake arguments and `-pie` from
`LDFLAGS`.

If building on Windows, add `.exe` to the end of `CMAKE_C_COMPILER`.


Advanced CMake Options
----------------------

Expand Down
4 changes: 0 additions & 4 deletions Brewfile

This file was deleted.

0 comments on commit 1d23209

Please sign in to comment.