Last active
March 5, 2020 08:08
-
-
Save Mercandj/4f7343fe9bd7cb2511be63622b0d7a2d 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/bash | |
# Parameters: nothing | |
# Required `$ANDROID_NDK` in your path. For example /Users/jonathan/Library/Android/sdk/ndk-bundle | |
# Script to generate pre-build opus files | |
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" | |
if [ -z "$ANDROID_NDK" ]; then | |
echo "Please set ANDROID_NDK to the Android NDK folder" | |
exit 1 | |
fi | |
# You can pass the host os arch as the first argument | |
# To this script. Example: linux-x86_64 | |
if [ -z "$1" ]; then | |
echo "!!!!!!!!!" | |
echo "No HOST_OS_ARCH passed as argument, fallback to darwin-x86_64" | |
echo "!!!!!!!!!" | |
HOST_OS_ARCH=darwin-x86_64 | |
else | |
HOST_OS_ARCH=$1 | |
fi | |
if [ ! -d "$BASE_DIR/build_opus" ]; then | |
mkdir -p "$BASE_DIR/build_opus" | |
fi | |
pushd "$BASE_DIR" || exit | |
if [ ! -d "$BASE_DIR/opusfile" ]; then | |
git clone https://github.com/Mercandj/opusfile.git | |
fi | |
pushd ./opusfile || exit | |
git checkout de47b357edd438c154a815accb3a8968bcef350f | |
popd || exit | |
if [ ! -d "$BASE_DIR/ogg" ]; then | |
git clone https://github.com/xiph/ogg.git | |
fi | |
pushd ./ogg || exit | |
git checkout 572618e3f50f214a875d72b631115b67450fa939 | |
popd || exit | |
if [ ! -d "$BASE_DIR/opus-cmake" ]; then | |
git clone https://github.com/eppixx/opus-cmake.git | |
fi | |
pushd ./opus-cmake || exit | |
git checkout 1b6b192460781700c2dfe6a82c468298f597a0b5 | |
popd || exit | |
bash ./script/publish-opus-decoder-android-static.sh | |
if [ ! -d "$BASE_DIR/build_opus/output/opus-decoder/android/include/ogg/config_types.h" ]; then | |
echo "#ifndef __CONFIG_TYPES_H__ | |
#define __CONFIG_TYPES_H__ | |
/* these are filled in by configure */ | |
#define INCLUDE_INTTYPES_H 1 | |
#define INCLUDE_STDINT_H 1 | |
#define INCLUDE_SYS_TYPES_H 1 | |
#if INCLUDE_INTTYPES_H | |
# include <inttypes.h> | |
#endif | |
#if INCLUDE_STDINT_H | |
# include <stdint.h> | |
#endif | |
#if INCLUDE_SYS_TYPES_H | |
# include <sys/types.h> | |
#endif | |
typedef int16_t ogg_int16_t; | |
typedef uint16_t ogg_uint16_t; | |
typedef int32_t ogg_int32_t; | |
typedef uint32_t ogg_uint32_t; | |
typedef int64_t ogg_int64_t; | |
#endif | |
" >> $BASE_DIR/build_opus/output/opus-decoder/android/include/ogg/config_types.h | |
fi | |
sed -i -e 's/<opus_multistream.h>/"opus_multistream.h"/g' $BASE_DIR/build_opus/output/opus-decoder/android/include/opus/opusfile.h | |
popd || exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment