init
This commit is contained in:
81
scripts/compile_libs/cmake_lib_compile.sh
Executable file
81
scripts/compile_libs/cmake_lib_compile.sh
Executable file
@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
|
||||
ANDROID_HOME=~/Android/Sdk
|
||||
ANDROID_NDK="$(find "$ANDROID_HOME/ndk" -maxdepth 1 | sort -n | tail -1)"
|
||||
echo "$ANDROID_NDK"
|
||||
|
||||
export MAKEFLAGS=-j32
|
||||
|
||||
if [[ "${2}" == "webasm" ]]; then
|
||||
COMPILEFLAGS="-pthread -O3 -g -s USE_PTHREADS=1"
|
||||
LINKFLAGS="-pthread -O3 -g -s USE_PTHREADS=1 -s ASYNCIFY=1"
|
||||
fi
|
||||
|
||||
COMPILEFLAGS=$3
|
||||
LINKFLAGS=$4
|
||||
|
||||
function compile_source() {
|
||||
if [[ "${4}" == "android" ]]; then
|
||||
cmake \
|
||||
-H. \
|
||||
-G "Unix Makefiles" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DANDROID_NATIVE_API_LEVEL="android-$1" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \
|
||||
-DANDROID_ABI="${3}" \
|
||||
-DANDROID_ARM_NEON=TRUE \
|
||||
-B"$2" \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DHIDAPI_SKIP_LIBUSB=TRUE \
|
||||
-DCURL_USE_OPENSSL=ON \
|
||||
-DSDL_HIDAPI=OFF \
|
||||
-DOP_DISABLE_HTTP=ON \
|
||||
-DOP_DISABLE_EXAMPLES=ON \
|
||||
-DOP_DISABLE_DOCS=ON \
|
||||
-DOPENSSL_ROOT_DIR="$PWD"/../openssl/"$2" \
|
||||
-DOPENSSL_CRYPTO_LIBRARY="$PWD"/../openssl/"$2"/libcrypto.a \
|
||||
-DOPENSSL_SSL_LIBRARY="$PWD"/../openssl/"$2"/libssl.a \
|
||||
-DOPENSSL_INCLUDE_DIR="${PWD}/../openssl/include;${PWD}/../openssl/${2}/include"
|
||||
(
|
||||
cd "$2" || exit 1
|
||||
cmake --build .
|
||||
)
|
||||
else
|
||||
${5} cmake \
|
||||
-H. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-B"$2" \
|
||||
-DSDL_STATIC=TRUE \
|
||||
-DFT_DISABLE_HARFBUZZ=ON \
|
||||
-DFT_DISABLE_BZIP2=ON \
|
||||
-DFT_DISABLE_BROTLI=ON \
|
||||
-DFT_REQUIRE_ZLIB=TRUE \
|
||||
-DCMAKE_C_FLAGS="$COMPILEFLAGS -DGLEW_STATIC" -DCMAKE_CXX_FLAGS="$COMPILEFLAGS" -DCMAKE_CXX_FLAGS_RELEASE="$COMPILEFLAGS" -DCMAKE_C_FLAGS_RELEASE="$COMPILEFLAGS" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="$LINKFLAGS" -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$LINKFLAGS" \
|
||||
-DSDL_PTHREADS=ON -DSDL_THREADS=ON \
|
||||
-DCURL_USE_OPENSSL=ON \
|
||||
-DOPUS_HARDENING=OFF \
|
||||
-DOPUS_STACK_PROTECTOR=OFF \
|
||||
-DOPENSSL_ROOT_DIR="$PWD"/../openssl/"$2" \
|
||||
-DOPENSSL_CRYPTO_LIBRARY="$PWD"/../openssl/"$2"/libcrypto.a \
|
||||
-DOPENSSL_SSL_LIBRARY="$PWD"/../openssl/"$2"/libssl.a \
|
||||
-DOPENSSL_INCLUDE_DIR="${PWD}/../openssl/include;${PWD}/../openssl/${2}/include" \
|
||||
-DZLIB_LIBRARY="${PWD}/../zlib/${2}/libz.a" -DZLIB_INCLUDE_DIR="${PWD}/../zlib;${PWD}/../zlib/${2}"
|
||||
(
|
||||
cd "$2" || exit 1
|
||||
cmake --build .
|
||||
)
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "${2}" == "android" ]]; then
|
||||
compile_source "$1" build_"$2"_arm armeabi-v7a "$2" "" &
|
||||
compile_source "$1" build_"$2"_arm64 arm64-v8a "$2" "" &
|
||||
compile_source "$1" build_"$2"_x86 x86 "$2" "" &
|
||||
compile_source "$1" build_"$2"_x86_64 x86_64 "$2" "" &
|
||||
elif [[ "${2}" == "webasm" ]]; then
|
||||
sed -i "s/include(CheckSizes)//g" CMakeLists.txt
|
||||
compile_source "$1" build_"$2"_wasm wasm "$2" emcmake &
|
||||
fi
|
||||
|
||||
wait
|
253
scripts/compile_libs/gen_libs.sh
Executable file
253
scripts/compile_libs/gen_libs.sh
Executable file
@ -0,0 +1,253 @@
|
||||
#!/bin/bash
|
||||
|
||||
CURDIR="$PWD"
|
||||
if [ -z ${1+x} ]; then
|
||||
echo "Give a destination path where to run this script, please choose a path other than in the source directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z ${2+x} ]; then
|
||||
echo "Specify the target system"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OS_NAME=$2
|
||||
|
||||
COMPILEFLAGS="-fPIC"
|
||||
LINKFLAGS="-fPIC"
|
||||
if [[ "${OS_NAME}" == "webasm" ]]; then
|
||||
COMPILEFLAGS="-pthread -O3 -g -s USE_PTHREADS=1"
|
||||
LINKFLAGS="-pthread -O3 -g -s USE_PTHREADS=1 -s ASYNCIFY=1 -s WASM=1"
|
||||
fi
|
||||
|
||||
if [[ "${OS_NAME}" == "android" ]]; then
|
||||
OS_NAME_PATH="android"
|
||||
elif [[ "${OS_NAME}" == "windows" ]]; then
|
||||
OS_NAME_PATH="windows"
|
||||
elif [[ "${OS_NAME}" == "linux" ]]; then
|
||||
OS_NAME_PATH="linux"
|
||||
elif [[ "${OS_NAME}" == "webasm" ]]; then
|
||||
OS_NAME_PATH="webasm"
|
||||
fi
|
||||
|
||||
COMP_HAS_ARM32=0
|
||||
COMP_HAS_ARM64=0
|
||||
COMP_HAS_x86=0
|
||||
COMP_HAS_x64=0
|
||||
COMP_HAS_WEBASM=0
|
||||
|
||||
if [[ "${OS_NAME}" == "android" ]]; then
|
||||
COMP_HAS_ARM32=1
|
||||
COMP_HAS_ARM64=1
|
||||
COMP_HAS_x86=1
|
||||
COMP_HAS_x64=1
|
||||
elif [[ "${OS_NAME}" == "linux" ]]; then
|
||||
COMP_HAS_x64=1
|
||||
elif [[ "${OS_NAME}" == "windows" ]]; then
|
||||
COMP_HAS_x86=1
|
||||
COMP_HAS_x64=1
|
||||
elif [[ "${OS_NAME}" == "webasm" ]]; then
|
||||
COMP_HAS_WEBASM=1
|
||||
fi
|
||||
|
||||
mkdir -p "$1"
|
||||
cd "$1" || exit 1
|
||||
|
||||
function build_cmake_lib() {
|
||||
if [ ! -d "${1}" ]; then
|
||||
git clone "${2}" "${1}"
|
||||
fi
|
||||
(
|
||||
cd "${1}" || exit 1
|
||||
cp "${CURDIR}"/scripts/compile_libs/cmake_lib_compile.sh cmake_lib_compile.sh
|
||||
./cmake_lib_compile.sh "$_ANDROID_ABI_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS"
|
||||
)
|
||||
}
|
||||
|
||||
_ANDROID_ABI_LEVEL=24
|
||||
|
||||
mkdir -p compile_libs
|
||||
cd compile_libs || exit 1
|
||||
|
||||
# start with openssl
|
||||
(
|
||||
_WAS_THERE_SSLFILE=1
|
||||
if [ ! -d "openssl" ]; then
|
||||
git clone https://github.com/openssl/openssl openssl
|
||||
_WAS_THERE_SSLFILE=0
|
||||
fi
|
||||
(
|
||||
cd openssl || exit 1
|
||||
if [[ "$_WAS_THERE_SSLFILE" == 0 ]]; then
|
||||
./autogen.sh
|
||||
fi
|
||||
cp "${CURDIR}"/scripts/compile_libs/make_lib_openssl.sh make_lib_openssl.sh
|
||||
./make_lib_openssl.sh "$_ANDROID_ABI_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS"
|
||||
)
|
||||
)
|
||||
|
||||
build_cmake_lib zlib https://github.com/madler/zlib
|
||||
build_cmake_lib png https://github.com/glennrp/libpng
|
||||
build_cmake_lib curl https://github.com/curl/curl
|
||||
build_cmake_lib freetype2 https://gitlab.freedesktop.org/freetype/freetype
|
||||
build_cmake_lib sdl https://github.com/libsdl-org/SDL
|
||||
build_cmake_lib ogg https://github.com/xiph/ogg
|
||||
build_cmake_lib opus https://github.com/xiph/opus
|
||||
|
||||
(
|
||||
_WAS_THERE_OPUSFILE=1
|
||||
if [ ! -d "opusfile" ]; then
|
||||
git clone https://github.com/xiph/opusfile opusfile
|
||||
_WAS_THERE_OPUSFILE=0
|
||||
fi
|
||||
cd opusfile || exit 1
|
||||
if [[ "$_WAS_THERE_OPUSFILE" == 0 ]]; then
|
||||
./autogen.sh
|
||||
fi
|
||||
cp "${CURDIR}"/scripts/compile_libs/make_lib_opusfile.sh make_lib_opusfile.sh
|
||||
./make_lib_opusfile.sh "$_ANDROID_ABI_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS"
|
||||
)
|
||||
|
||||
# SQLite, just download and built by hand
|
||||
if [ ! -d "sqlite3" ]; then
|
||||
wget https://www.sqlite.org/2021/sqlite-amalgamation-3360000.zip
|
||||
7z e sqlite-amalgamation-3360000.zip -osqlite3
|
||||
fi
|
||||
|
||||
(
|
||||
cd sqlite3 || exit 1
|
||||
cp "${CURDIR}"/scripts/compile_libs/make_lib_sqlite3.sh make_lib_sqlite3.sh
|
||||
./make_lib_sqlite3.sh "$_ANDROID_ABI_LEVEL" "$OS_NAME" "$COMPILEFLAGS" "$LINKFLAGS"
|
||||
)
|
||||
|
||||
cd ..
|
||||
|
||||
function copy_arches_for_lib() {
|
||||
if [[ "$COMP_HAS_ARM32" == "1" ]]; then
|
||||
${1} arm arm
|
||||
fi
|
||||
if [[ "$COMP_HAS_ARM64" == "1" ]]; then
|
||||
${1} arm64 arm64
|
||||
fi
|
||||
if [[ "$COMP_HAS_x86" == "1" ]]; then
|
||||
${1} x86 32
|
||||
fi
|
||||
if [[ "$COMP_HAS_x64" == "1" ]]; then
|
||||
${1} x86_64 64
|
||||
fi
|
||||
if [[ "$COMP_HAS_WEBASM" == "1" ]]; then
|
||||
${1} wasm wasm
|
||||
fi
|
||||
}
|
||||
|
||||
mkdir ddnet-libs
|
||||
function _copy_curl() {
|
||||
mkdir -p ddnet-libs/curl/"$OS_NAME_PATH"/lib"$2"
|
||||
cp compile_libs/curl/build_"$OS_NAME"_"$1"/lib/libcurl.a ddnet-libs/curl/"$OS_NAME_PATH"/lib"$2"/libcurl.a
|
||||
}
|
||||
|
||||
copy_arches_for_lib _copy_curl
|
||||
|
||||
mkdir ddnet-libs
|
||||
function _copy_freetype2() {
|
||||
mkdir -p ddnet-libs/freetype/"$OS_NAME_PATH"/lib"$2"
|
||||
cp compile_libs/freetype2/build_"$OS_NAME"_"$1"/libfreetype.a ddnet-libs/freetype/"$OS_NAME_PATH"/lib"$2"/libfreetype.a
|
||||
}
|
||||
|
||||
copy_arches_for_lib _copy_freetype2
|
||||
|
||||
mkdir ddnet-libs
|
||||
function _copy_sdl() {
|
||||
mkdir -p ddnet-libs/sdl/"$OS_NAME_PATH"/lib"$2"
|
||||
cp compile_libs/sdl/build_"$OS_NAME"_"$1"/libSDL2.a ddnet-libs/sdl/"$OS_NAME_PATH"/lib"$2"/libSDL2.a
|
||||
cp compile_libs/sdl/build_"$OS_NAME"_"$1"/libSDL2main.a ddnet-libs/sdl/"$OS_NAME_PATH"/lib"$2"/libSDL2main.a
|
||||
if [ ! -d "ddnet-libs/sdl/include/$OS_NAME_PATH" ]; then
|
||||
mkdir -p ddnet-libs/sdl/include/"$OS_NAME_PATH"
|
||||
fi
|
||||
cp -R compile_libs/sdl/include/* ddnet-libs/sdl/include/"$OS_NAME_PATH"
|
||||
}
|
||||
|
||||
copy_arches_for_lib _copy_sdl
|
||||
|
||||
# copy java code from SDL2
|
||||
if [[ "$OS_NAME" == "android" ]]; then
|
||||
rm -R ddnet-libs/sdl/java
|
||||
mkdir -p ddnet-libs/sdl/java
|
||||
cp -R compile_libs/sdl/android-project/app/src/main/java/org ddnet-libs/sdl/java/
|
||||
fi
|
||||
|
||||
mkdir ddnet-libs
|
||||
function _copy_ogg() {
|
||||
mkdir -p ddnet-libs/opus/"$OS_NAME_PATH"/lib"$2"
|
||||
cp compile_libs/ogg/build_"$OS_NAME"_"$1"/libogg.a ddnet-libs/opus/"$OS_NAME_PATH"/lib"$2"/libogg.a
|
||||
}
|
||||
|
||||
copy_arches_for_lib _copy_ogg
|
||||
|
||||
mkdir ddnet-libs
|
||||
function _copy_opus() {
|
||||
mkdir -p ddnet-libs/opus/"$OS_NAME_PATH"/lib"$2"
|
||||
cp compile_libs/opus/build_"$OS_NAME"_"$1"/libopus.a ddnet-libs/opus/"$OS_NAME_PATH"/lib"$2"/libopus.a
|
||||
}
|
||||
|
||||
copy_arches_for_lib _copy_opus
|
||||
|
||||
mkdir ddnet-libs
|
||||
function _copy_opusfile() {
|
||||
mkdir -p ddnet-libs/opus/"$OS_NAME_PATH"/lib"$2"
|
||||
cp compile_libs/opusfile/build_"$OS_NAME"_"$1"/libopusfile.a ddnet-libs/opus/"$OS_NAME_PATH"/lib"$2"/libopusfile.a
|
||||
}
|
||||
|
||||
copy_arches_for_lib _copy_opusfile
|
||||
|
||||
mkdir ddnet-libs
|
||||
function _copy_sqlite3() {
|
||||
mkdir -p ddnet-libs/sqlite3/"$OS_NAME_PATH"/lib"$2"
|
||||
cp compile_libs/sqlite3/build_"$OS_NAME"_"$1"/sqlite3.a ddnet-libs/sqlite3/"$OS_NAME_PATH"/lib"$2"/libsqlite3.a
|
||||
}
|
||||
|
||||
copy_arches_for_lib _copy_sqlite3
|
||||
|
||||
mkdir ddnet-libs
|
||||
function _copy_openssl() {
|
||||
mkdir -p ddnet-libs/openssl/"$OS_NAME_PATH"/lib"$2"
|
||||
mkdir -p ddnet-libs/openssl/include
|
||||
mkdir -p ddnet-libs/openssl/include/"$OS_NAME_PATH"
|
||||
cp compile_libs/openssl/build_"$OS_NAME"_"$1"/libcrypto.a ddnet-libs/openssl/"$OS_NAME_PATH"/lib"$2"/libcrypto.a
|
||||
cp compile_libs/openssl/build_"$OS_NAME"_"$1"/libssl.a ddnet-libs/openssl/"$OS_NAME_PATH"/lib"$2"/libssl.a
|
||||
cp -R compile_libs/openssl/build_"$OS_NAME"_"$1"/include/* ddnet-libs/openssl/include/"$OS_NAME_PATH"
|
||||
cp -R compile_libs/openssl/include/* ddnet-libs/openssl/include
|
||||
}
|
||||
|
||||
copy_arches_for_lib _copy_openssl
|
||||
|
||||
mkdir ddnet-libs
|
||||
function _copy_zlib() {
|
||||
# copy headers
|
||||
(
|
||||
cd compile_libs/zlib || exit 1
|
||||
find . -maxdepth 1 -iname '*.h' -print0 | while IFS= read -r -d $'\0' file; do
|
||||
mkdir -p ../../ddnet-libs/zlib/include/"$(dirname "$file")"
|
||||
cp "$file" ../../ddnet-libs/zlib/include/"$(dirname "$file")"
|
||||
done
|
||||
|
||||
cd build_"$OS_NAME"_"$1" || exit 1
|
||||
find . -maxdepth 1 -iname '*.h' -print0 | while IFS= read -r -d $'\0' file; do
|
||||
mkdir -p ../../../ddnet-libs/zlib/include/"$OS_NAME_PATH"/"$(dirname "$file")"
|
||||
cp "$file" ../../../ddnet-libs/zlib/include/"$OS_NAME_PATH"/"$(dirname "$file")"
|
||||
done
|
||||
)
|
||||
|
||||
mkdir -p ddnet-libs/zlib/"$OS_NAME_PATH"/lib"$2"
|
||||
cp compile_libs/zlib/build_"$OS_NAME"_"$1"/libz.a ddnet-libs/zlib/"$OS_NAME_PATH"/lib"$2"/libz.a
|
||||
}
|
||||
|
||||
copy_arches_for_lib _copy_zlib
|
||||
|
||||
mkdir ddnet-libs
|
||||
function _copy_png() {
|
||||
mkdir -p ddnet-libs/png/"$OS_NAME_PATH"/lib"$2"
|
||||
cp compile_libs/png/build_"$OS_NAME"_"$1"/libpng16.a ddnet-libs/png/"$OS_NAME_PATH"/lib"$2"/libpng16.a
|
||||
}
|
||||
|
||||
copy_arches_for_lib _copy_png
|
48
scripts/compile_libs/make_lib_openssl.sh
Executable file
48
scripts/compile_libs/make_lib_openssl.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
ANDROID_HOME=~/Android/Sdk
|
||||
ANDROID_NDK="$(find "$ANDROID_HOME/ndk" -maxdepth 1 | sort -n | tail -1)"
|
||||
|
||||
export MAKEFLAGS=-j32
|
||||
|
||||
export CXXFLAGS="$3"
|
||||
export CFLAGS="$3"
|
||||
export CPPFLAGS="$4"
|
||||
export LDFLAGS="$4"
|
||||
|
||||
export ANDROID_NDK_ROOT=$ANDROID_NDK
|
||||
PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
|
||||
|
||||
function buid_openssl() {
|
||||
_EXISTS_PROJECT=0
|
||||
if [ -d "$1" ]; then
|
||||
_EXISTS_PROJECT=1
|
||||
else
|
||||
mkdir "$1"
|
||||
fi
|
||||
(
|
||||
cd "$1" || exit 1
|
||||
if [[ "$_EXISTS_PROJECT" == "0" ]]; then
|
||||
if [[ "${4}" == "webasm" ]]; then
|
||||
emconfigure ../Configure "$2" -no-tests -no-asm -static -no-afalgeng -DOPENSSL_SYS_NETWARE -DSIG_DFL=0 -DSIG_IGN=0 -DHAVE_FORK=0 -DOPENSSL_NO_AFALGENG=1 --with-rand-seed=getrandom
|
||||
|
||||
sed -i 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile
|
||||
else
|
||||
../Configure "$2" no-asm no-shared
|
||||
fi
|
||||
fi
|
||||
${5} make $MAKEFLAGS build_generated
|
||||
${5} make $MAKEFLAGS libcrypto.a
|
||||
${5} make $MAKEFLAGS libssl.a
|
||||
cd ..
|
||||
)
|
||||
}
|
||||
|
||||
if [[ "${2}" == "android" ]]; then
|
||||
buid_openssl build_"$2"_arm android-arm "$1" "$2" ""
|
||||
buid_openssl build_"$2"_arm64 android-arm64 "$1" "$2" ""
|
||||
buid_openssl build_"$2"_x86 android-x86 "$1" "$2" ""
|
||||
buid_openssl build_"$2"_x86_64 android-x86_64 "$1" "$2" ""
|
||||
elif [[ "${2}" == "webasm" ]]; then
|
||||
buid_openssl build_"$2"_wasm linux-generic64 "$1" "$2" emmake
|
||||
fi
|
80
scripts/compile_libs/make_lib_opusfile.sh
Executable file
80
scripts/compile_libs/make_lib_opusfile.sh
Executable file
@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
|
||||
ANDROID_HOME=~/Android/Sdk
|
||||
ANDROID_NDK="$(find "$ANDROID_HOME/ndk" -maxdepth 1 | sort -n | tail -1)"
|
||||
|
||||
export MAKEFLAGS=-j32
|
||||
|
||||
export CXXFLAGS="$3"
|
||||
export CFLAGS="$3"
|
||||
export CPPFLAGS="$4"
|
||||
export LDFLAGS="$4"
|
||||
|
||||
export ANDROID_NDK_ROOT="$ANDROID_NDK"
|
||||
|
||||
function make_opusfile() {
|
||||
_EXISTS_PROJECT=0
|
||||
if [ -d "$1" ]; then
|
||||
_EXISTS_PROJECT=1
|
||||
else
|
||||
mkdir "$1"
|
||||
fi
|
||||
(
|
||||
cd "$1" || exit 1
|
||||
if [[ "$_EXISTS_PROJECT" == 0 ]]; then
|
||||
#not nice but doesn't matter
|
||||
cp -R ../../ogg/include .
|
||||
cp -R ../../opus/include .
|
||||
cp -R ../../ogg/"$2"/include/ogg/* include/ogg/
|
||||
cp ../../ogg/"$2"/libogg.a libogg.a
|
||||
cp ../../opus/"$2"/libopus.a libopus.a
|
||||
fi
|
||||
|
||||
TMP_COMPILER=""
|
||||
TMP_AR=""
|
||||
if [[ "${5}" == "android" ]]; then
|
||||
TMP_COMPILER="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/$3$4-clang"
|
||||
TMP_AR="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
|
||||
elif [[ "${5}" == "webasm" ]]; then
|
||||
TMP_COMPILER="emcc"
|
||||
TMP_AR="emar"
|
||||
fi
|
||||
|
||||
${TMP_COMPILER} \
|
||||
-c \
|
||||
-fPIC \
|
||||
-I"${PWD}"/../include \
|
||||
-I"${PWD}"/include \
|
||||
../src/opusfile.c \
|
||||
../src/info.c \
|
||||
../src/internal.c
|
||||
${TMP_COMPILER} \
|
||||
-c \
|
||||
-fPIC \
|
||||
-I"${PWD}"/../include \
|
||||
-I"${PWD}"/include \
|
||||
-include stdio.h \
|
||||
../src/stream.c
|
||||
${TMP_AR} \
|
||||
rvs \
|
||||
libopusfile.a \
|
||||
opusfile.o \
|
||||
info.o \
|
||||
stream.o \
|
||||
internal.o
|
||||
)
|
||||
}
|
||||
|
||||
function compile_all_opusfile() {
|
||||
if [[ "${2}" == "android" ]]; then
|
||||
make_opusfile build_"$2"_arm build_"$2"_arm armv7a-linux-androideabi "$1" "$2"
|
||||
make_opusfile build_"$2"_arm64 build_"$2"_arm64 aarch64-linux-android "$1" "$2"
|
||||
make_opusfile build_"$2"_x86 build_"$2"_x86 i686-linux-android "$1" "$2"
|
||||
make_opusfile build_"$2"_x86_64 build_"$2"_x86_64 x86_64-linux-android "$1" "$2"
|
||||
elif [[ "${2}" == "webasm" ]]; then
|
||||
make_opusfile build_"$2"_wasm build_"$2"_wasm "" "$1" "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
compile_all_opusfile "$1" "$2"
|
||||
|
65
scripts/compile_libs/make_lib_sqlite3.sh
Executable file
65
scripts/compile_libs/make_lib_sqlite3.sh
Executable file
@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
ANDROID_HOME=~/Android/Sdk
|
||||
ANDROID_NDK="$(find "$ANDROID_HOME/ndk" -maxdepth 1 | sort -n | tail -1)"
|
||||
|
||||
export MAKEFLAGS=-j32
|
||||
|
||||
export CXXFLAGS="$3"
|
||||
export CFLAGS="$3"
|
||||
export CPPFLAGS="$4"
|
||||
LINKER_FLAGS="$4"
|
||||
|
||||
export ANDROID_NDK_ROOT="$ANDROID_NDK"
|
||||
PATH="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH"
|
||||
_LD_LIBRARY_PATH=".:$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$LD_LIBRARY_PATH"
|
||||
|
||||
function make_sqlite3() {
|
||||
(
|
||||
mkdir -p "$1"
|
||||
cd "$1" || exit 1
|
||||
|
||||
TMP_COMPILER=""
|
||||
TMP_AR=""
|
||||
if [[ "${5}" == "android" ]]; then
|
||||
TMP_COMPILER="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/$3$4-clang"
|
||||
TMP_AR="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar"
|
||||
elif [[ "${5}" == "webasm" ]]; then
|
||||
TMP_COMPILER="emcc"
|
||||
TMP_AR="emar"
|
||||
fi
|
||||
|
||||
LDFLAGS="${LINKER_FLAGS} -L./" \
|
||||
LD_LIBRARY_PATH="$_LD_LIBRARY_PATH" \
|
||||
${TMP_COMPILER} \
|
||||
-c \
|
||||
-fPIC \
|
||||
-DSQLITE_ENABLE_ATOMIC_WRITE=1 \
|
||||
-DSQLITE_ENABLE_BATCH_ATOMIC_WRITE=1 \
|
||||
-DSQLITE_ENABLE_MULTITHREADED_CHECKS=1 \
|
||||
-DSQLITE_THREADSAFE=1 \
|
||||
../sqlite3.c \
|
||||
-o sqlite3.o
|
||||
|
||||
LDFLAGS="${LINKER_FLAGS} -L./" \
|
||||
LD_LIBRARY_PATH="$_LD_LIBRARY_PATH" \
|
||||
${TMP_AR} \
|
||||
rvs \
|
||||
sqlite3.a \
|
||||
sqlite3.o
|
||||
)
|
||||
}
|
||||
|
||||
function compile_all_sqlite3() {
|
||||
if [[ "${2}" == "android" ]]; then
|
||||
make_sqlite3 build_"$2"_arm build_"$2"_arm armv7a-linux-androideabi "$1" "$2"
|
||||
make_sqlite3 build_"$2"_arm64 build_"$2"_arm64 aarch64-linux-android "$1" "$2"
|
||||
make_sqlite3 build_"$2"_x86 build_"$2"_x86 i686-linux-android "$1" "$2"
|
||||
make_sqlite3 build_"$2"_x86_64 build_"$2"_x86_64 x86_64-linux-android "$1" "$2"
|
||||
elif [[ "${2}" == "webasm" ]]; then
|
||||
make_sqlite3 build_"$2"_wasm build_"$2"_wasm "" "$1" "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
compile_all_sqlite3 "$1" "$2"
|
||||
|
Reference in New Issue
Block a user