Last active
July 11, 2022 16:17
-
-
Save jkotra/75d6ceedbd472583bc80c584347999f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#armeabi-v7a -> armv7a-linux-androideabi | |
#arm64-v8a -> aarch64-linux-android | |
#x86 -> i686-linux-android | |
#x86-64 -> x86_64-linux-android | |
# https://developer.android.com/ndk/guides/other_build_systems | |
#set these! | |
API=31 | |
QPDF_VERSION=10.6.3 | |
JPEG_VERSION=9d | |
ROOT=$(pwd) | |
#ARCH=armeabi-v7a | |
#HOST=armv7a-linux-androideabi | |
#ARCH=arm64-v8a | |
#HOST=aarch64-linux-android | |
#ARCH=x86 | |
#HOST=i686-linux-android | |
#ARCH=x86-64 | |
#HOST=x86_64-linux-android | |
wget https://www.ijg.org/files/jpegsrc.v${JPEG_VERSION}.tar.gz | |
tar -xvf jpegsrc.v${JPEG_VERSION}.tar.gz | |
wget https://github.com/qpdf/qpdf/archive/refs/tags/release-qpdf-${QPDF_VERSION}.tar.gz | |
tar -xvf release-qpdf-${QPDF_VERSION}.tar.gz | |
compile_jpeg () { | |
cd ${JPEG} | |
make clean | |
./configure --host ${HOST} | |
make | |
cd .libs | |
llvm-strip libjpeg.so | |
cp libjpeg.so ${LIBFOLDER} | |
cd ${ROOT} | |
} | |
compile_qpdf () { | |
echo 'compiling QPDF' | |
cp disable_validation.patch qpdf-release-qpdf-${QPDF_VERSION} | |
cd qpdf-release-qpdf-${QPDF_VERSION} | |
make clean | |
patch -f --verbose < disable_validation.patch | |
QPDF_CONF="./configure --host ${HOST} --enable-crypto-native --disable-implicit-crypto CXXFLAGS='-L${LIBFOLDER} -I${JPEG}'" | |
echo ${QPDF_CONF} | |
eval ${QPDF_CONF} | |
make | |
llvm-strip libqpdf/build/.libs/libqpdf.so | |
cp libqpdf/build/.libs/libqpdf.so ${LIBFOLDER} | |
cd ${ROOT} | |
} | |
set_compiler_and_paths () { | |
LIBFOLDER=${ROOT}/libs/${ARCH}/ | |
mkdir -p ${LIBFOLDER} | |
JPEG=${ROOT}/jpeg-${JPEG_VERSION}/ | |
export CC=${NDK}toolchains/llvm/prebuilt/linux-x86_64/bin/${HOST}${API}-clang | |
export CXX=${NDK}toolchains/llvm/prebuilt/linux-x86_64/bin/${HOST}${API}-clang++ | |
export PATH=${NDK}toolchains/llvm/prebuilt/linux-x86_64/bin/:$PATH | |
} | |
#################################### | |
ARCH=armeabi-v7a | |
HOST=armv7a-linux-androideabi | |
set_compiler_and_paths | |
compile_jpeg | |
compile_qpdf | |
#################################### | |
#################################### | |
ARCH=arm64-v8a | |
HOST=aarch64-linux-android | |
set_compiler_and_paths | |
compile_jpeg | |
compile_qpdf | |
#################################### | |
#################################### | |
ARCH=x86 | |
HOST=i686-linux-android | |
set_compiler_and_paths | |
compile_jpeg | |
compile_qpdf | |
#################################### | |
#################################### | |
ARCH=x86-64 | |
HOST=x86_64-linux-android | |
set_compiler_and_paths | |
compile_jpeg | |
compile_qpdf | |
#################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment