mirror of
https://github.com/scummvm/dockerized-bb.git
synced 2026-11-18 21:35:23 +00:00
ANDROID: Add support for Android platform
All official architectures are supported (arm, aarch64, x86, x86_64) Two toolchains are provided for stable and master ScummVM. Changes will come to simplify generation though
This commit is contained in:
1 parent
d60d6df70a
commit
da62f82ca7
19 files changed
+1178
No files matched your search
@@ -112,6 +112,95 @@ def _3ds():
|
||||
platforms.append(platform)
|
||||
_3ds()
|
||||
|
||||
def android(suffix, scummvm_target, ndk_target, cxx_target, abi_version,
|
||||
android_master_root = "/opt/android/master",
|
||||
android_stable_root = "/opt/android/stable"):
|
||||
android_master_toolchain = "{0}/ndk/toolchains/llvm/prebuilt/linux-x86_64".format(
|
||||
android_master_root)
|
||||
android_stable_toolchain = "{0}/toolchain".format(android_stable_root)
|
||||
platform = Platform("android_{0}".format(suffix))
|
||||
platform.workerimage = "android"
|
||||
platform.compatibleBuilds = (builds.ScummVMBuild, )
|
||||
platform.buildenv = {
|
||||
builds.ScummVMBuild: {
|
||||
"ANDROID_NDK_ROOT": "{0}/ndk".format(android_master_root),
|
||||
# configure script will find everything from this
|
||||
"ANDROID_TOOLCHAIN": "{0}".format(android_master_toolchain),
|
||||
# We keep SDK and gradle dynamic and outside the container
|
||||
# Their versions can change without the need to regenerate the image
|
||||
# Android build system can be shared across all versions so we don't specialize
|
||||
# the directory in /data/bshomes
|
||||
"ANDROID_SDK_ROOT": "/data/bshomes/android/sdk",
|
||||
"ANDROID_SDK_HOME": "/data/bshomes/android/sdk-home",
|
||||
"GRADLE_USER_HOME": "/data/bshomes/android/gradle",
|
||||
"CXX": "ccache {0}/bin/{1}{2}-clang++".format(
|
||||
android_master_toolchain, cxx_target, abi_version),
|
||||
# Worker has all libraries installed in the NDK sysroot
|
||||
"PKG_CONFIG_LIBDIR": "{0}/sysroot/usr/lib/{1}/{2}/pkgconfig".format(
|
||||
android_master_toolchain, ndk_target, abi_version),
|
||||
},
|
||||
builds.ScummVMStableBuild: {
|
||||
"ANDROID_NDK": "{0}/ndk".format(android_stable_root),
|
||||
"ANDROID_SDK": "{0}/sdk".format(android_stable_root),
|
||||
"ANDROID_SDK_HOME": "/data/bshomes/android/sdk-home",
|
||||
"AR": "{0}/bin/{1}-ar".format(
|
||||
android_stable_toolchain, ndk_target),
|
||||
"AS": "{0}/bin/{1}-as".format(
|
||||
android_stable_toolchain, ndk_target),
|
||||
"RANLIB": "{0}/bin/{1}-ranlib".format(
|
||||
android_stable_toolchain, ndk_target),
|
||||
"STRIP": "{0}/bin/{1}-strip".format(
|
||||
android_stable_toolchain, ndk_target),
|
||||
"STRINGS": "{0}/bin/{1}-strings".format(
|
||||
android_stable_toolchain, ndk_target),
|
||||
"CXX": "ccache {0}/bin/{1}-clang++".format(
|
||||
android_stable_toolchain, ndk_target),
|
||||
"CC": "ccache {0}/bin/{1}-clang".format(
|
||||
android_stable_toolchain, ndk_target),
|
||||
# Worker has all libraries installed in the toolchain
|
||||
"PKG_CONFIG_LIBDIR": "{0}/sysroot/usr/lib/{1}/pkgconfig".format(
|
||||
android_stable_toolchain, ndk_target),
|
||||
}
|
||||
}
|
||||
platform.configureargs.append("--host=android-{0}".format(scummvm_target))
|
||||
platform.buildconfigureargs = {
|
||||
builds.ScummVMBuild: [ "--enable-debug",
|
||||
# libcurl is detected using curl-config. Instead of modifying PATH just provide path to it to configure.
|
||||
"--with-libcurl-prefix={0}/sysroot/usr/bin/{1}/{2}".format(android_master_toolchain, ndk_target, abi_version)],
|
||||
builds.ScummVMStableBuild: [ "--enable-debug",
|
||||
# libcurl is detected using curl-config. Instead of modifying PATH just provide path to it to configure.
|
||||
"--with-libcurl-prefix={0}/sysroot/usr/bin/{1}".format(android_stable_toolchain, ndk_target)],
|
||||
}
|
||||
platform.packaging_cmd = "androiddistdebug"
|
||||
platform.built_files = {
|
||||
builds.ScummVMBuild: [ "debug" ],
|
||||
}
|
||||
platform.archiveext = "zip"
|
||||
platform.testable = False
|
||||
platform.run_tests = False
|
||||
platforms.append(platform)
|
||||
|
||||
android(suffix="arm",
|
||||
scummvm_target="arm-v7a",
|
||||
ndk_target="arm-linux-androideabi",
|
||||
cxx_target="armv7a-linux-androideabi",
|
||||
abi_version=16)
|
||||
android(suffix="arm64",
|
||||
scummvm_target="arm64-v8a",
|
||||
ndk_target="aarch64-linux-android",
|
||||
cxx_target="aarch64-linux-android",
|
||||
abi_version=21)
|
||||
android(suffix="x86",
|
||||
scummvm_target="x86",
|
||||
ndk_target="i686-linux-android",
|
||||
cxx_target="i686-linux-android",
|
||||
abi_version=16)
|
||||
android(suffix="x86_64",
|
||||
scummvm_target="x86_64",
|
||||
ndk_target="x86_64-linux-android",
|
||||
cxx_target="x86_64-linux-android",
|
||||
abi_version=21)
|
||||
|
||||
def debian_x86_64():
|
||||
platform = Platform("debian-x86_64")
|
||||
platform.env["CXX"] = "ccache g++"
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
# This toolchain is made of two sub-toolchains one for stable ScummVM and one for master one
|
||||
# Two sub-toolchains are used to avoid invalidating one when updating the other
|
||||
# The merging process, being only copies, is faster
|
||||
|
||||
FROM toolchains/common AS helpers
|
||||
|
||||
m4_include(`paths.m4')m4_dnl
|
||||
|
||||
# Don't import packages.m4 as it clashes with functions defined here
|
||||
|
||||
m4_define(`local_sdk_package', COPY packages/$1 lib-helpers/packages/$1/
|
||||
RUN $3 lib-helpers/packages/$1/build.sh $2)
|
||||
m4_define(`local_package', COPY packages/$1 lib-helpers/packages/$1/
|
||||
RUN $3 lib-helpers/multi-build.sh lib-helpers/packages/$1/build.sh $2)
|
||||
m4_define(`helpers_package', COPY --from=helpers /lib-helpers/packages/$1 lib-helpers/packages/$1/
|
||||
RUN $3 lib-helpers/multi-build.sh lib-helpers/packages/$1/build.sh $2)
|
||||
|
||||
##### master toolchain : NDK 21.0.6113669 + SDK licenses only / SDK and tools are download by Gradle #####
|
||||
FROM debian:stable-slim AS toolchain-master
|
||||
USER root
|
||||
|
||||
WORKDIR /usr/src
|
||||
|
||||
# Copy and execute each step separately to avoid invalidating cache
|
||||
COPY --from=helpers /lib-helpers/prepare.sh lib-helpers/
|
||||
RUN lib-helpers/prepare.sh
|
||||
|
||||
COPY --from=helpers /lib-helpers/functions.sh lib-helpers/
|
||||
|
||||
COPY functions-platform.sh lib-helpers/
|
||||
COPY functions-sdk.sh lib-helpers/
|
||||
COPY multi-build.sh lib-helpers/
|
||||
|
||||
# nasm is used for x86 ScummVM
|
||||
# Create man directories to please openjdk which expects them
|
||||
# cf. https://github.com/debuerreotype/debuerreotype/issues/10
|
||||
RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
|
||||
apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
default-jre-headless \
|
||||
golang-go \
|
||||
nasm && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# API is the API versions for which we will compile packages
|
||||
# This variable can also be :
|
||||
# - all which means all API versions of all possible targets
|
||||
# - lowest the lowest API version for each target
|
||||
# - version[:version...] which will search for the specified versions (or most approaching) in all targets
|
||||
#
|
||||
# API and ANDROID_NDK_VERSION must be kept in sync with ScummVM source tree
|
||||
# If multiple NDKs must be installed (for stable and master),
|
||||
# we should duplicate all instructions from this point
|
||||
#
|
||||
# API is synchronized with ScummVM minSdkVersion
|
||||
# As we follow same rules as Android, we should
|
||||
# always get the same API versions as expected by Android
|
||||
|
||||
ENV ANDROID_ROOT=/opt/android/master
|
||||
|
||||
ENV ANDROID_NDK_ROOT=${ANDROID_ROOT}/ndk \
|
||||
ANDROID_NDK_VERSION=21.0.6113669 \
|
||||
API=16 \
|
||||
HOST_TAG=linux-x86_64
|
||||
|
||||
# Install NDK using settings above
|
||||
local_sdk_package(ndk)
|
||||
|
||||
# Include the packaging instructions
|
||||
m4_include(`packages_list.m4')
|
||||
|
||||
# Only install licenses on this version as everything will be installed by gradle
|
||||
# It's installed last to avoid rebuilding everything if we just want to update licenses
|
||||
|
||||
ENV ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
|
||||
# Install SDK using settings above
|
||||
local_sdk_package(sdk)
|
||||
|
||||
##### stable toolchain : NDK r14b and SDK 25 #####
|
||||
FROM debian:stable-slim AS toolchain-stable
|
||||
USER root
|
||||
|
||||
WORKDIR /usr/src
|
||||
|
||||
# Copy and execute each step separately to avoid invalidating cache
|
||||
COPY --from=helpers /lib-helpers/prepare.sh lib-helpers/
|
||||
RUN lib-helpers/prepare.sh
|
||||
|
||||
COPY --from=helpers /lib-helpers/functions.sh lib-helpers/
|
||||
|
||||
COPY functions-platform.sh lib-helpers/
|
||||
# We don't need these functions for older SDK but that let's image reuse possible
|
||||
COPY functions-sdk.sh lib-helpers/
|
||||
COPY multi-build.sh lib-helpers/
|
||||
|
||||
# nasm is used for x86 ScummVM
|
||||
# JDK is needed instead of JRE to patch Android SDK for OpenJDK 11
|
||||
# Create man directories to please openjdk which expects them
|
||||
# cf. https://github.com/debuerreotype/debuerreotype/issues/10
|
||||
RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
|
||||
apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
default-jdk-headless \
|
||||
golang-go \
|
||||
nasm && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Unlike the newer toolchain, this one is quite static because it shouldn't evolve in time
|
||||
# and many tricks may depend on the NDK version
|
||||
|
||||
ENV ANDROID_ROOT=/opt/android/stable
|
||||
|
||||
# Old toolchains need python to create toolchains and old ncurses
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
libncurses5 \
|
||||
python && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# ABIS is for ndk-old package and determine how the unified toolchain will be composed
|
||||
# API is none because we don't have new style folder hierarchy
|
||||
ENV ANDROID_NDK_ROOT=${ANDROID_ROOT}/ndk \
|
||||
TOOLCHAIN=${ANDROID_ROOT}/toolchain \
|
||||
ABIS="arm/9 arm64/21 x86/9 x86_64/21" \
|
||||
API="none" \
|
||||
HOST_TAG=linux-x86_64
|
||||
|
||||
# Install NDK using settings above
|
||||
local_sdk_package(ndk-old)
|
||||
|
||||
# Include the packaging instructions
|
||||
m4_include(`packages_list.m4')
|
||||
|
||||
# Install an old (unsupported) SDK because build process depends on android project command
|
||||
|
||||
ENV ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
|
||||
local_sdk_package(sdk-old)
|
||||
|
||||
##### Resulting toolchain #####
|
||||
FROM debian:stable-slim
|
||||
USER root
|
||||
|
||||
WORKDIR /usr/src
|
||||
|
||||
# Copy and execute each step separately to avoid invalidating cache
|
||||
COPY --from=helpers /lib-helpers/prepare.sh lib-helpers/
|
||||
RUN lib-helpers/prepare.sh
|
||||
|
||||
COPY --from=helpers /lib-helpers/functions.sh lib-helpers/
|
||||
|
||||
COPY functions-platform.sh lib-helpers/
|
||||
COPY functions-sdk.sh lib-helpers/
|
||||
COPY multi-build.sh lib-helpers/
|
||||
|
||||
# Create man directories to please openjdk which expects them
|
||||
# cf. https://github.com/debuerreotype/debuerreotype/issues/10
|
||||
# ant is used by ScummVM build system
|
||||
# file is used ndk-build in NDK 14
|
||||
# libncurses5 is used by binaries in NDK 14
|
||||
# nasm is used for x86 ScummVM
|
||||
RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
|
||||
apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
ant \
|
||||
default-jre-headless \
|
||||
file \
|
||||
libncurses5 \
|
||||
nasm && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV ANDROID_ROOT=/opt/android
|
||||
|
||||
# Toolchains are not (yet?) relocatable, so we must not change their path once they are compiled
|
||||
COPY --from=toolchain-master ${ANDROID_ROOT}/master/ ${ANDROID_ROOT}/master/
|
||||
COPY --from=toolchain-stable ${ANDROID_ROOT}/stable/ ${ANDROID_ROOT}/stable/
|
||||
@@ -0,0 +1,37 @@
|
||||
# Paths are not standard in Android toolchain, adapt them
|
||||
__do_configure_android () {
|
||||
if [ "${API}" = "." ]; then
|
||||
__do_configure --libdir=${PREFIX}/lib/${TARGET} --bindir=${PREFIX}/bin/${TARGET} "$@"
|
||||
else
|
||||
__do_configure --libdir=${PREFIX}/lib/${TARGET}/${API} \
|
||||
--bindir=${PREFIX}/bin/${TARGET}/${API} "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
__do_cmake_android () {
|
||||
local cmake_target cmake_args orig_api
|
||||
orig_api=${API}
|
||||
if [ "${API}" = "." ]; then
|
||||
API=$(sed -ne 's/^.*-D__ANDROID_API__=\([0-9]\+\) .*$/\1/p' "$CC")
|
||||
cmake_args="-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang"
|
||||
fi
|
||||
case $TARGET in
|
||||
arm-linux-androideabi) cmake_target=armeabi-v7a ;;
|
||||
aarch64-linux-android) cmake_target=arm64-v8a ;;
|
||||
i686-linux-android) cmake_target=x86 ;;
|
||||
x86_64-linux-android) cmake_target=x86_64 ;;
|
||||
*) error "Unknown target ${TARGET}" ;;
|
||||
esac
|
||||
__do_cmake -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake \
|
||||
-DANDROID_ABI=${cmake_target} \
|
||||
-DANDROID_NATIVE_API_LEVEL=${API} \
|
||||
-DCMAKE_INSTALL_LIBDIR=${PREFIX}/lib/${TARGET}/${orig_api} \
|
||||
-DCMAKE_INSTALL_BINDIR=${PREFIX}/bin/${TARGET}/${orig_api} \
|
||||
$cmake_args \
|
||||
"$@"
|
||||
}
|
||||
|
||||
for f in do_configure do_cmake; do
|
||||
unset -f $f
|
||||
eval "$f () { __${f}_android \"\$@\"; }"
|
||||
done
|
||||
@@ -0,0 +1,37 @@
|
||||
CMDLINE_TOOLS_VERSION=6200805
|
||||
CMDLINE_TOOLS_CHECKSUM="sha256:f10f9d5bca53cc27e2d210be2cbc7c0f1ee906ad9b868748d74d62e10f2c8275"
|
||||
|
||||
# Disable HTTPS to allow caching in optional proxy
|
||||
|
||||
do_install_sdk_tools () {
|
||||
do_http_fetch tools "https://dl.google.com/android/repository/commandlinetools-${HOST_TAG%%-*}-${CMDLINE_TOOLS_VERSION}_latest.zip" 'unzip' \
|
||||
"${CMDLINE_TOOLS_CHECKSUM}"
|
||||
|
||||
# Don't stay in tools subdirectory
|
||||
cd ..
|
||||
|
||||
ANDROID_TEMP_SDK_DIR="$(pwd)"
|
||||
export ANDROID_SDK_HOME="$(pwd)"
|
||||
|
||||
# Make sure we have the last version
|
||||
yes | "${ANDROID_TEMP_SDK_DIR}/tools/bin/sdkmanager" --sdk_root="${ANDROID_TEMP_SDK_DIR}" --no_https --install "cmdline-tools;latest"
|
||||
}
|
||||
|
||||
do_sdk_accept_licenses () {
|
||||
local dst=$1
|
||||
if [ -z "$dst" ]; then
|
||||
dst=${ANDROID_TEMP_SDK_DIR}
|
||||
fi
|
||||
|
||||
yes | "${ANDROID_TEMP_SDK_DIR}/tools/bin/sdkmanager" --sdk_root="$dst" --no_https --licenses >/dev/null
|
||||
}
|
||||
|
||||
do_sdk_install () {
|
||||
local pkg=$1 dst=$2
|
||||
if [ -z "$dst" ]; then
|
||||
dst=${ANDROID_TEMP_SDK_DIR}
|
||||
fi
|
||||
|
||||
# Install requested NDK
|
||||
yes | "${ANDROID_TEMP_SDK_DIR}/tools/bin/sdkmanager" --sdk_root="$dst" --no_https --install "$pkg"
|
||||
}
|
||||
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#! /bin/sh
|
||||
|
||||
#set -x
|
||||
set -e
|
||||
|
||||
build_script=$1
|
||||
shift 1
|
||||
|
||||
original_path=$PATH
|
||||
|
||||
if [ -z "$API" ]; then
|
||||
API=all
|
||||
fi
|
||||
|
||||
# Old toolchains don't have this architecure so let it be configurable
|
||||
if [ -z "$TOOLCHAIN" ]; then
|
||||
TOOLCHAIN="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${HOST_TAG}"
|
||||
fi
|
||||
|
||||
targets=$(cd "$TOOLCHAIN/sysroot/usr/lib" && ls -d */)
|
||||
|
||||
for t in "$TOOLCHAIN/sysroot/usr/lib/"*/; do
|
||||
t=$(basename $t)
|
||||
if [ "$API" = "none" ]; then
|
||||
refined_apis='.'
|
||||
else
|
||||
lowest=$(basename "$(cd "$TOOLCHAIN/sysroot/usr/lib/$t" && ls -1d */ | head -n1)")
|
||||
if [ "$API" = "all" ]; then
|
||||
apis=$(cd "$TOOLCHAIN/sysroot/usr/lib/$t" && ls -1d */ | while read v; do echo -n "$(basename "$v") "; done)
|
||||
elif [ "$API" = "lowest" ]; then
|
||||
apis=$lowest
|
||||
else
|
||||
apis=$API
|
||||
fi
|
||||
|
||||
refined_apis=
|
||||
for a in $apis; do
|
||||
# Try to find the best API version available like specified in Android docs
|
||||
while [ ! -d "$TOOLCHAIN/sysroot/usr/lib/$t/$a" ]; do
|
||||
# First, decrement
|
||||
if [ $a -le 0 ]; then
|
||||
break
|
||||
fi
|
||||
a=$(($a - 1))
|
||||
done
|
||||
if [ ! -d "$TOOLCHAIN/sysroot/usr/lib/$t/$a" ]; then
|
||||
# Still not found, lowest supported version by NDK
|
||||
a=$lowest
|
||||
fi
|
||||
refined_apis="$refined_apis\n$a"
|
||||
done
|
||||
refined_apis=$(echo $refined_apis | sort -u | tr '\n' ' ')
|
||||
fi
|
||||
|
||||
for a in $refined_apis; do
|
||||
# Define all environment variables now that we have the target platform and API
|
||||
export HOST=$t TARGET=$t
|
||||
|
||||
# Don't know why but tools and compiler don't have the same target prefix for ARM
|
||||
comp_target=$TARGET
|
||||
if [ $comp_target = "arm-linux-androideabi" ]; then
|
||||
comp_target=armv7a-linux-androideabi
|
||||
fi
|
||||
for c in ar as c++filt ld nm objcopy objdump ranlib readelf strings strip; do
|
||||
v=$(echo $c | tr 'a-z+-' 'A-ZX_')
|
||||
export $v="$TOOLCHAIN/bin/$TARGET-$c"
|
||||
done
|
||||
# Frankenstein unified toolchains don't have the API version and use same name as TARGET
|
||||
if [ -f "$TOOLCHAIN/bin/$comp_target$a-clang" ]; then
|
||||
export CC=$TOOLCHAIN/bin/$comp_target$a-clang
|
||||
export CXX=$TOOLCHAIN/bin/$comp_target$a-clang++
|
||||
else
|
||||
export CC=$TOOLCHAIN/bin/$TARGET-clang
|
||||
export CXX=$TOOLCHAIN/bin/$TARGET-clang
|
||||
fi
|
||||
|
||||
export PREFIX=$TOOLCHAIN/sysroot/usr
|
||||
export PATH=$original_path:$TOOLCHAIN/bin:$PREFIX/bin/$TARGET/$a
|
||||
export ACLOCAL_PATH=$PREFIX/share/aclocal
|
||||
export PKG_CONFIG_LIBDIR=$PREFIX/lib/$TARGET/$a
|
||||
export PKG_CONFIG_PATH=$PREFIX/lib/$TARGET/$a/pkgconfig
|
||||
|
||||
echo "Building for $TARGET-$a"
|
||||
|
||||
API=$a $build_script "$@"
|
||||
done
|
||||
done
|
||||
@@ -0,0 +1,47 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 9dca996..6cc709e 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -72,6 +72,7 @@ mark_as_advanced ( LIB_SUFFIX )
|
||||
|
||||
# Default install directory names
|
||||
include ( DefaultDirs )
|
||||
+include ( GNUInstallDirs )
|
||||
|
||||
# Basic C library checks
|
||||
include ( CheckSTDC )
|
||||
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
|
||||
index 76a8f87..7973219 100644
|
||||
--- a/include/CMakeLists.txt
|
||||
+++ b/include/CMakeLists.txt
|
||||
@@ -22,5 +22,5 @@
|
||||
add_subdirectory ( fluidsynth )
|
||||
|
||||
IF (NOT MACOSX_FRAMEWORK )
|
||||
- install ( FILES fluidsynth.h DESTINATION ${INCLUDE_INSTALL_DIR} )
|
||||
+ install ( FILES fluidsynth.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
|
||||
ENDIF (NOT MACOSX_FRAMEWORK )
|
||||
diff --git a/include/fluidsynth/CMakeLists.txt b/include/fluidsynth/CMakeLists.txt
|
||||
index b146d13..d4c00b4 100644
|
||||
--- a/include/fluidsynth/CMakeLists.txt
|
||||
+++ b/include/fluidsynth/CMakeLists.txt
|
||||
@@ -46,6 +46,6 @@ if ( NOT MACOSX_FRAMEWORK )
|
||||
${include_HEADERS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.h
|
||||
DESTINATION
|
||||
- ${INCLUDE_INSTALL_DIR}/fluidsynth
|
||||
+ ${CMAKE_INSTALL_INCLUDEDIR}/fluidsynth
|
||||
)
|
||||
endif ( NOT MACOSX_FRAMEWORK )
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index c14622d..4e99dab 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -152,5 +152,5 @@ target_link_libraries ( libfluidsynth
|
||||
)
|
||||
|
||||
install(TARGETS libfluidsynth
|
||||
- LIBRARY DESTINATION lib
|
||||
- ARCHIVE DESTINATION lib)
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
@@ -0,0 +1,262 @@
|
||||
diff --git a/SDL2_net.pc.in b/SDL2_net.pc.in
|
||||
index e3ad892..e7731be 100644
|
||||
--- a/SDL2_net.pc.in
|
||||
+++ b/SDL2_net.pc.in
|
||||
@@ -6,6 +6,6 @@ includedir=@includedir@
|
||||
Name: SDL2_net
|
||||
Description: net library for Simple DirectMedia Layer
|
||||
Version: @VERSION@
|
||||
-Requires: sdl2 >= @SDL_VERSION@
|
||||
+Requires:
|
||||
Libs: -L${libdir} -lSDL2_net
|
||||
Cflags: -I${includedir}/SDL2
|
||||
diff --git a/SDL_net.h b/SDL_net.h
|
||||
index bd5ec7f..c7293e9 100644
|
||||
--- a/SDL_net.h
|
||||
+++ b/SDL_net.h
|
||||
@@ -25,7 +25,10 @@
|
||||
#ifndef _SDL_NET_H
|
||||
#define _SDL_NET_H
|
||||
|
||||
+#define WITHOUT_SDL
|
||||
+
|
||||
#ifdef WITHOUT_SDL
|
||||
+#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
typedef uint8_t Uint8;
|
||||
typedef uint16_t Uint16;
|
||||
@@ -37,6 +40,11 @@ typedef struct SDLNet_version {
|
||||
Uint8 patch;
|
||||
} SDLNet_version;
|
||||
|
||||
+#define SDL_memcpy memcpy
|
||||
+#define SDL_memset memset
|
||||
+#define SDL_malloc malloc
|
||||
+#define SDL_free free
|
||||
+
|
||||
#else /* WITHOUT_SDL */
|
||||
|
||||
#include "SDL.h"
|
||||
@@ -47,7 +55,156 @@ typedef SDL_version SDLNet_version;
|
||||
|
||||
#endif /* WITHOUT_SDL */
|
||||
|
||||
-#include "begin_code.h"
|
||||
+//#include "begin_code.h"
|
||||
+/**
|
||||
+ * \file begin_code.h
|
||||
+ *
|
||||
+ * This file sets things up for C dynamic library function definitions,
|
||||
+ * static inlined functions, and structures aligned at 4-byte alignment.
|
||||
+ * If you don't like ugly C preprocessor code, don't look at this file. :)
|
||||
+ */
|
||||
+
|
||||
+/* This shouldn't be nested -- included it around code only. */
|
||||
+#ifdef _begin_code_h
|
||||
+#error Nested inclusion of begin_code.h
|
||||
+#endif
|
||||
+#define _begin_code_h
|
||||
+
|
||||
+#ifndef SDL_DEPRECATED
|
||||
+# if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
|
||||
+# define SDL_DEPRECATED __attribute__((deprecated))
|
||||
+# else
|
||||
+# define SDL_DEPRECATED
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#ifndef SDL_UNUSED
|
||||
+# ifdef __GNUC__
|
||||
+# define SDL_UNUSED __attribute__((unused))
|
||||
+# else
|
||||
+# define SDL_UNUSED
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+/* Some compilers use a special export keyword */
|
||||
+#ifndef DECLSPEC
|
||||
+# if defined(__WIN32__) || defined(__WINRT__)
|
||||
+# ifdef __BORLANDC__
|
||||
+# ifdef BUILD_SDL
|
||||
+# define DECLSPEC
|
||||
+# else
|
||||
+# define DECLSPEC __declspec(dllimport)
|
||||
+# endif
|
||||
+# else
|
||||
+# define DECLSPEC __declspec(dllexport)
|
||||
+# endif
|
||||
+# elif defined(__OS2__)
|
||||
+# ifdef BUILD_SDL
|
||||
+# define DECLSPEC __declspec(dllexport)
|
||||
+# else
|
||||
+# define DECLSPEC
|
||||
+# endif
|
||||
+# else
|
||||
+# if defined(__GNUC__) && __GNUC__ >= 4
|
||||
+# define DECLSPEC __attribute__ ((visibility("default")))
|
||||
+# else
|
||||
+# define DECLSPEC
|
||||
+# endif
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+/* By default SDL uses the C calling convention */
|
||||
+#ifndef SDLCALL
|
||||
+#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
|
||||
+#define SDLCALL __cdecl
|
||||
+#elif defined(__OS2__) || defined(__EMX__)
|
||||
+#define SDLCALL _System
|
||||
+# if defined (__GNUC__) && !defined(_System)
|
||||
+# define _System /* for old EMX/GCC compat. */
|
||||
+# endif
|
||||
+#else
|
||||
+#define SDLCALL
|
||||
+#endif
|
||||
+#endif /* SDLCALL */
|
||||
+
|
||||
+/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
|
||||
+#ifdef __SYMBIAN32__
|
||||
+#undef DECLSPEC
|
||||
+#define DECLSPEC
|
||||
+#endif /* __SYMBIAN32__ */
|
||||
+
|
||||
+/* Force structure packing at 4 byte alignment.
|
||||
+ This is necessary if the header is included in code which has structure
|
||||
+ packing set to an alternate value, say for loading structures from disk.
|
||||
+ The packing is reset to the previous value in close_code.h
|
||||
+ */
|
||||
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
|
||||
+#ifdef _MSC_VER
|
||||
+#pragma warning(disable: 4103)
|
||||
+#endif
|
||||
+#ifdef __clang__
|
||||
+#pragma clang diagnostic ignored "-Wpragma-pack"
|
||||
+#endif
|
||||
+#ifdef __BORLANDC__
|
||||
+#pragma nopackwarning
|
||||
+#endif
|
||||
+#ifdef _M_X64
|
||||
+/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
|
||||
+#pragma pack(push,8)
|
||||
+#else
|
||||
+#pragma pack(push,4)
|
||||
+#endif
|
||||
+#endif /* Compiler needs structure packing set */
|
||||
+
|
||||
+#ifndef SDL_INLINE
|
||||
+#if defined(__GNUC__)
|
||||
+#define SDL_INLINE __inline__
|
||||
+#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
|
||||
+ defined(__DMC__) || defined(__SC__) || \
|
||||
+ defined(__WATCOMC__) || defined(__LCC__) || \
|
||||
+ defined(__DECC) || defined(__CC_ARM)
|
||||
+#define SDL_INLINE __inline
|
||||
+#ifndef __inline__
|
||||
+#define __inline__ __inline
|
||||
+#endif
|
||||
+#else
|
||||
+#define SDL_INLINE inline
|
||||
+#ifndef __inline__
|
||||
+#define __inline__ inline
|
||||
+#endif
|
||||
+#endif
|
||||
+#endif /* SDL_INLINE not defined */
|
||||
+
|
||||
+#ifndef SDL_FORCE_INLINE
|
||||
+#if defined(_MSC_VER)
|
||||
+#define SDL_FORCE_INLINE __forceinline
|
||||
+#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
|
||||
+#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
|
||||
+#else
|
||||
+#define SDL_FORCE_INLINE static SDL_INLINE
|
||||
+#endif
|
||||
+#endif /* SDL_FORCE_INLINE not defined */
|
||||
+
|
||||
+#ifndef SDL_NORETURN
|
||||
+#if defined(__GNUC__)
|
||||
+#define SDL_NORETURN __attribute__((noreturn))
|
||||
+#elif defined(_MSC_VER)
|
||||
+#define SDL_NORETURN __declspec(noreturn)
|
||||
+#else
|
||||
+#define SDL_NORETURN
|
||||
+#endif
|
||||
+#endif /* SDL_NORETURN not defined */
|
||||
+
|
||||
+/* Apparently this is needed by several Windows compilers */
|
||||
+#if !defined(__MACH__)
|
||||
+#ifndef NULL
|
||||
+#ifdef __cplusplus
|
||||
+#define NULL 0
|
||||
+#else
|
||||
+#define NULL ((void *)0)
|
||||
+#endif
|
||||
+#endif /* NULL */
|
||||
+#endif /* ! Mac OS X - breaks precompiled headers */
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
@@ -438,6 +595,25 @@ SDL_FORCE_INLINE Uint32 _SDLNet_Read32(const void *areap)
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
-#include "close_code.h"
|
||||
+//#include "close_code.h"
|
||||
+/**
|
||||
+ * \file close_code.h
|
||||
+ *
|
||||
+ * This file reverses the effects of begin_code.h and should be included
|
||||
+ * after you finish any function and structure declarations in your headers
|
||||
+ */
|
||||
+
|
||||
+#ifndef _begin_code_h
|
||||
+#error close_code.h included without matching begin_code.h
|
||||
+#endif
|
||||
+#undef _begin_code_h
|
||||
+
|
||||
+/* Reset structure packing at previous byte alignment */
|
||||
+#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
|
||||
+#ifdef __BORLANDC__
|
||||
+#pragma nopackwarning
|
||||
+#endif
|
||||
+#pragma pack(pop)
|
||||
+#endif /* Compiler needs structure packing set */
|
||||
|
||||
#endif /* _SDL_NET_H */
|
||||
diff --git a/SDLnet.c b/SDLnet.c
|
||||
index 53d125a..7e54e63 100644
|
||||
--- a/SDLnet.c
|
||||
+++ b/SDLnet.c
|
||||
@@ -66,7 +66,12 @@ void SDLCALL SDLNet_SetError(const char *fmt, ...)
|
||||
{
|
||||
va_list argp;
|
||||
va_start(argp, fmt);
|
||||
+#ifdef WITHOUT_SDL
|
||||
+ memset(errorbuf, 0, sizeof(errorbuf));
|
||||
+#else
|
||||
SDL_vsnprintf(errorbuf, sizeof(errorbuf), fmt, argp);
|
||||
+#endif
|
||||
+ vsnprintf(errorbuf, sizeof(errorbuf), fmt, argp);
|
||||
va_end(argp);
|
||||
#ifndef WITHOUT_SDL
|
||||
SDL_SetError("%s", errorbuf);
|
||||
diff --git a/configure.in b/configure.in
|
||||
index 4228c6f..dca90a6 100644
|
||||
--- a/configure.in
|
||||
+++ b/configure.in
|
||||
@@ -107,16 +107,6 @@ case "$host" in
|
||||
esac
|
||||
AC_SUBST(INETLIB)
|
||||
|
||||
-dnl Check for SDL
|
||||
-SDL_VERSION=2.0.0
|
||||
-AC_SUBST(SDL_VERSION)
|
||||
-AM_PATH_SDL2($SDL_VERSION,
|
||||
- :,
|
||||
- AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
|
||||
-)
|
||||
-CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
-LIBS="$LIBS $SDL_LIBS"
|
||||
-
|
||||
dnl Check for GUI library for the chat client
|
||||
have_GUI=no
|
||||
AC_ARG_ENABLE(gui,
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#! /bin/sh
|
||||
|
||||
PACKAGE_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
HELPERS_DIR=$PACKAGE_DIR/../..
|
||||
. $HELPERS_DIR/functions.sh
|
||||
|
||||
do_make_bdir
|
||||
|
||||
do_pkg_fetch libsdl2
|
||||
do_configure
|
||||
|
||||
do_make
|
||||
do_make install
|
||||
|
||||
# SDL uses SDL_config.h to enable features but they depend on architecture being cross-compiled.
|
||||
# As we use a unified include directory we must trick, so we move SDL_config.h to an arch
|
||||
# dependent name andwe create a toplevel file which selects the good file to include
|
||||
mv $PREFIX/include/SDL2/SDL_config.h $PREFIX/include/SDL2/SDL_config_$TARGET.h
|
||||
|
||||
cat > $PREFIX/include/SDL2/SDL_config.h <<END
|
||||
/*
|
||||
* This file is a placeholder put in place to allow SDL install in Android unified toolchain
|
||||
* This file is NOT part of SDL but generated by build scripts
|
||||
*/
|
||||
#if defined(__arm__)
|
||||
#include "SDL_config_arm-linux-androideabi.h"
|
||||
#elif defined(__aarch64__)
|
||||
#include "SDL_config_aarch64-linux-android.h"
|
||||
#elif defined(__i386__)
|
||||
#include "SDL_config_i686-linux-android.h"
|
||||
#elif defined(__x86_64__)
|
||||
#include "SDL_config_x86_64-linux-android.h"
|
||||
#else
|
||||
#error "Can't determine target to use, check toolchain build scripts"
|
||||
#endif
|
||||
END
|
||||
|
||||
do_clean_bdir
|
||||
@@ -0,0 +1,15 @@
|
||||
diff -burp libvorbis-1.3.6/configure.ac libvorbis-1.3.6-patched/configure.ac
|
||||
--- libvorbis-1.3.6/configure.ac 2018-03-16 12:19:52.000000000 -0400
|
||||
+++ libvorbis-1.3.6-patched/configure.ac 2020-01-18 03:50:19.449087695 -0500
|
||||
@@ -133,9 +133,9 @@ else
|
||||
case $host in
|
||||
*86-*-linux*)
|
||||
DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
|
||||
- CFLAGS="-O3 -Wall -Wextra -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
|
||||
+ CFLAGS="-O3 -Wall -Wextra -ffast-math -D_REENTRANT -fsigned-char"
|
||||
# PROFILE="-Wall -Wextra -pg -g -O3 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
|
||||
- PROFILE="-Wall -Wextra -pg -g -O3 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"
|
||||
+ PROFILE="-Wall -Wextra -pg -g -O3 -ffast-math -D_REENTRANT -fsigned-char -fno-inline"
|
||||
|
||||
# glibc < 2.1.3 has a serious FP bug in the math inline header
|
||||
# that will cripple Vorbis. Look to see if the magic FP stack
|
||||
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#! /bin/sh
|
||||
NDK_VERSION=14b
|
||||
NDK_SHA1=becd161da6ed9a823e25be5c02955d9cbca1dbeb
|
||||
|
||||
PACKAGE_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
HELPERS_DIR=$PACKAGE_DIR/../..
|
||||
|
||||
# Don't load functions-platform.sh as it's not needed
|
||||
NO_FUNCTIONS_PLATFORM=yes
|
||||
|
||||
. $HELPERS_DIR/functions.sh
|
||||
|
||||
do_make_bdir
|
||||
|
||||
do_http_fetch android-ndk "https://dl.google.com/android/repository/android-ndk-r${NDK_VERSION}-${HOST_TAG}.zip" 'unzip' \
|
||||
"sha1:${NDK_SHA1}"
|
||||
|
||||
# SDL2 can't compile with this version of NDK because of https://github.com/android/ndk/issues/370
|
||||
# Patch include files
|
||||
find . -path '*/usr/include/android/sensor.h' -exec sed -ie '/^#include <sys\/types.h>$/i #include <stdbool.h>' '{}' +
|
||||
|
||||
# What we do now is like Frankenstein, we make a unified toolchain from parts of toolchains not inteded to be unified.
|
||||
# It's not perfect (GCC don't work) but it works when compiling ScummVM, so who cares?
|
||||
|
||||
mkdir -p "${ANDROID_NDK_ROOT}/"
|
||||
# mv is faster than cp
|
||||
mv ./* "${ANDROID_NDK_ROOT}/"
|
||||
|
||||
mkdir -p "${TOOLCHAIN}/"
|
||||
|
||||
for t in ${ABIS}; do
|
||||
arch=${t%/*}
|
||||
api=${t##*/}
|
||||
echo "Installing ${arch} with API ${api}"
|
||||
|
||||
"${ANDROID_NDK_ROOT}/build/tools/make_standalone_toolchain.py" --arch "${arch}" --api "${api}" --install-dir toolchain-temp --unified-headers
|
||||
|
||||
triple=$(ls toolchain-temp/bin/*-clang| sed -n -e 's#^.*/\([^/]\+\)-clang$#\1#p')
|
||||
echo "Using triple ${triple}"
|
||||
|
||||
libdir=toolchain-temp/sysroot/usr/lib64
|
||||
if [ ! -d "${libdir}" ]; then
|
||||
libdir=toolchain-temp/sysroot/usr/lib
|
||||
fi
|
||||
|
||||
# Copy the whole toolchain
|
||||
cp -Rf toolchain-temp/. "${TOOLCHAIN}/"
|
||||
|
||||
# Remove parts which are arch specific
|
||||
rm -Rf "${TOOLCHAIN}"/sysroot/usr/lib64 "${TOOLCHAIN}"/sysroot/usr/lib
|
||||
rm -Rf "${TOOLCHAIN}"/sysroot/usr/include/asm
|
||||
rm -Rf "${TOOLCHAIN}"/sysroot/usr/include/machine
|
||||
rm -Rf "${TOOLCHAIN}"/bin/clang "${TOOLCHAIN}"/bin/clang++
|
||||
# Remove GCC as it's unsupported
|
||||
rm -Rf "${TOOLCHAIN}"/bin/${triple}-gcc "${TOOLCHAIN}"/bin/${triple}-g++
|
||||
|
||||
# Copy back arch specific missing parts to their right place
|
||||
# We use a temporary directory to not be picky when erasing above
|
||||
mkdir -p "${TOOLCHAIN}/sysroot/usr/.lib/${triple}"
|
||||
cp -Rf "${libdir}"/. "${TOOLCHAIN}/sysroot/usr/.lib/${triple}"
|
||||
|
||||
# Don't repeat over and over this, needs to be escaped, part
|
||||
sysroot_path='`dirname $0`/../sysroot'
|
||||
# Patch include search path to add arch specific directory
|
||||
for f in "${TOOLCHAIN}"/bin/${triple}-clang "${TOOLCHAIN}"/bin/${triple}-clang++; do
|
||||
sed -i -e "2 r /dev/stdin" \
|
||||
-e "s#--sysroot#-B=/usr/lib/${triple} \"\$linker\" -idirafter ${sysroot_path}/usr/include/${triple} &#" \
|
||||
"$f" <<EOF
|
||||
linker="-Wl,-L${sysroot_path}/usr/lib/${triple}"
|
||||
for a in "\$@"; do
|
||||
if [ "\$a" == "-E" -o "\$a" == "-S" -o "\$a" == "-c" -o "\$a" == "-fsyntax-only" ]; then
|
||||
linker=""
|
||||
break
|
||||
fi
|
||||
done
|
||||
EOF
|
||||
done
|
||||
rm -Rf toolchain-temp
|
||||
done
|
||||
|
||||
# NDK install bogus libstdc++ in sysroot, remove them
|
||||
find "${TOOLCHAIN}/sysroot/usr/.lib" '(' -name libstdc++.a -o -name libstdc++.so ')' -delete
|
||||
|
||||
# Move libs back where they should be
|
||||
mv "${TOOLCHAIN}/sysroot/usr/.lib" "${TOOLCHAIN}/sysroot/usr/lib"
|
||||
|
||||
do_clean_bdir
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#! /bin/sh
|
||||
|
||||
PACKAGE_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
HELPERS_DIR=$PACKAGE_DIR/../..
|
||||
|
||||
# Don't load functions-platform.sh as it's not needed
|
||||
NO_FUNCTIONS_PLATFORM=yes
|
||||
|
||||
. $HELPERS_DIR/functions-sdk.sh
|
||||
. $HELPERS_DIR/functions.sh
|
||||
|
||||
do_make_bdir
|
||||
|
||||
do_install_sdk_tools
|
||||
|
||||
do_sdk_install "ndk;${ANDROID_NDK_VERSION}"
|
||||
|
||||
cd "ndk/${ANDROID_NDK_VERSION}"
|
||||
|
||||
# Don't cleanup as OpenSSL still need them
|
||||
# Cleanup unused parts of the NDK (which will get removed in future versions)
|
||||
#rm -rf platforms sources/cxx-stl sysroot
|
||||
#for d in toolchains/*; do
|
||||
# if [ "$d" = "toolchains/llvm" ]; then
|
||||
# continue
|
||||
# fi
|
||||
# rm -rf "$d"
|
||||
#done
|
||||
|
||||
mkdir -p "${ANDROID_NDK_ROOT}/"
|
||||
# mv is faster than cp
|
||||
mv ./* "${ANDROID_NDK_ROOT}/"
|
||||
|
||||
do_clean_bdir
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#! /bin/sh
|
||||
|
||||
# This package is only for standalone toolchains of NDK
|
||||
|
||||
PACKAGE_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
HELPERS_DIR=$PACKAGE_DIR/../..
|
||||
. $HELPERS_DIR/functions.sh
|
||||
|
||||
do_make_bdir
|
||||
|
||||
do_pkg_fetch openssl
|
||||
|
||||
case $TARGET in
|
||||
arm-linux-androideabi) ssl_target=android-arm ;;
|
||||
aarch64-linux-android) ssl_target=android-arm64 ;;
|
||||
i686-linux-android) ssl_target=android-x86 ;;
|
||||
x86_64-linux-android) ssl_target=android-x86_64 ;;
|
||||
*) error "Unknown target ${TARGET}" ;;
|
||||
esac
|
||||
|
||||
# Configure script expects these values and not absolute paths
|
||||
export CC=clang
|
||||
export AR=ar
|
||||
export RANLIB=ranlib
|
||||
|
||||
if [ "$API" = "." ]; then
|
||||
# Standalone toolchain (even if merged)
|
||||
and_api=
|
||||
export ANDROID_NDK_HOME=$TOOLCHAIN
|
||||
else
|
||||
# Android fully unified toolchain
|
||||
and_api=-D__ANDROID_API__=$API
|
||||
export ANDROID_NDK_HOME=${ANDROID_NDK_ROOT}
|
||||
fi
|
||||
|
||||
./Configure $ssl_target no-shared no-threads -fno-integrated-as $and_api --prefix=${PREFIX} --libdir=${PREFIX}/lib/${TARGET}/${API}
|
||||
do_make build_libs
|
||||
do_make install_dev
|
||||
|
||||
do_clean_bdir
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#! /bin/sh
|
||||
SDK_VERSION=25.2.5
|
||||
SDK_SHA1=72df3aa1988c0a9003ccdfd7a13a7b8bd0f47fc1
|
||||
|
||||
PACKAGE_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
HELPERS_DIR=$PACKAGE_DIR/../..
|
||||
|
||||
# Don't load functions-platform.sh as it's not needed
|
||||
NO_FUNCTIONS_PLATFORM=yes
|
||||
|
||||
. $HELPERS_DIR/functions.sh
|
||||
|
||||
export ANDROID_SDK_HOME=$(pwd)
|
||||
|
||||
do_make_bdir
|
||||
|
||||
do_http_fetch tools "https://dl.google.com/android/repository/tools_r${SDK_VERSION}-${HOST_TAG%-*}.zip" 'unzip' \
|
||||
"sha1:${SDK_SHA1}"
|
||||
|
||||
# Fix permissions
|
||||
find . -type f -executable -exec chmod +x {} +
|
||||
|
||||
# Debian comes with OpenJDK 11 and SDK was designed for OpenJDK 8
|
||||
# Between these two version, OpenJDK lost Java EE packages which are used by SDK
|
||||
# Download interesting parts from Maven and fix loading
|
||||
|
||||
mkdir jaxb_libs
|
||||
|
||||
jaxb_wget () { wget --no-hsts --progress=dot "$1" -O "jaxb_libs/$(basename $1)"; }
|
||||
jaxb_wget 'https://repo1.maven.org/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar'
|
||||
jaxb_wget 'https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-xjc/2.3.2/jaxb-xjc-2.3.2.jar'
|
||||
jaxb_wget 'https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-core/2.3.0.1/jaxb-core-2.3.0.1.jar'
|
||||
jaxb_wget 'https://repo1.maven.org/maven2/org/glassfish/jaxb/jaxb-jxc/2.3.2/jaxb-jxc-2.3.2.jar'
|
||||
jaxb_wget 'https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar'
|
||||
jaxb_wget 'https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.3.2/jaxb-impl-2.3.2.jar'
|
||||
jaxb_wget 'https://repo1.maven.org/maven2/com/sun/istack/istack-commons-runtime/3.0.8/istack-commons-runtime-3.0.8.jar'
|
||||
|
||||
for f in ./bin/sdkmanager; do
|
||||
sed -ie '/^CLASSPATH=/r /dev/stdin' $f <<'EOF'
|
||||
CLASSPATH=$CLASSPATH:$APP_HOME/jaxb_libs/activation-1.1.1.jar:$APP_HOME/jaxb_libs/jaxb-xjc-2.3.2.jar:$APP_HOME/jaxb_libs/jaxb-core-2.3.0.1.jar:$APP_HOME/jaxb_libs/jaxb-jxc-2.3.2.jar:$APP_HOME/jaxb_libs/jaxb-api-2.3.1.jar:$APP_HOME/jaxb_libs/jaxb-impl-2.3.2.jar:$APP_HOME/jaxb_libs/istack-commons-runtime-3.0.8.jar
|
||||
EOF
|
||||
done
|
||||
|
||||
# The Debian we use don't support Java target 1.5 anymore (OpenJDK 11 is too recent), patch it to use 1.6
|
||||
sed -ie 's#<property name="java.\(target\|source\)" value="1.5" />#<property name="java.\1" value="1.6" />#' ./ant/build.xml
|
||||
|
||||
# OpenJDK 11 doesn't have sun.misc.Base64Encoder anymore, provide it and patch sdklibs.jar
|
||||
cp $PACKAGE_DIR/sun_misc_base64.jar ./lib/
|
||||
# Spawn a subshell to not alter working directory
|
||||
(DIR=$(pwd) && \
|
||||
cd .. && \
|
||||
jar xf "$DIR/lib/sdklib.jar" META-INF/MANIFEST.MF && \
|
||||
sed -i -e 's/^Class-Path: /Class-Path: sun_misc_base64.jar /' -e '/^Manifest-Version:/d' META-INF/MANIFEST.MF && \
|
||||
jar ufm "$DIR/lib/sdklib.jar" META-INF/MANIFEST.MF && \
|
||||
rm -rf META-INF)
|
||||
|
||||
mkdir -p "${ANDROID_SDK_ROOT}"
|
||||
|
||||
# Download needed parts
|
||||
yes | ./bin/sdkmanager --sdk_root="${ANDROID_SDK_ROOT}" "build-tools;25.0.3" platform-tools "platforms;android-28"
|
||||
|
||||
# Cleanup what we don't need in tools
|
||||
rm -rf apps lib/monitor-x86 lib/monitor-x86_64 qemu emulator* bin64 lib64 emulator64-crash-service
|
||||
|
||||
# Move
|
||||
mkdir "${ANDROID_SDK_ROOT}/tools/"
|
||||
mv ./* "${ANDROID_SDK_ROOT}/tools/"
|
||||
|
||||
do_clean_bdir
|
||||
Binary file not shown.
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#! /bin/sh
|
||||
|
||||
PACKAGE_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
HELPERS_DIR=$PACKAGE_DIR/../..
|
||||
|
||||
# Don't load functions-platform.sh as it's not needed
|
||||
NO_FUNCTIONS_PLATFORM=yes
|
||||
|
||||
. $HELPERS_DIR/functions-sdk.sh
|
||||
. $HELPERS_DIR/functions.sh
|
||||
|
||||
do_make_bdir
|
||||
|
||||
do_install_sdk_tools
|
||||
|
||||
mkdir -p "${ANDROID_SDK_ROOT}"
|
||||
|
||||
# Install licences outside the build tree
|
||||
do_sdk_accept_licenses "${ANDROID_SDK_ROOT}"
|
||||
|
||||
if [ -n "${ANDROID_SDK_VERSION}" ]; then
|
||||
do_sdk_install "platforms;android-${SDK_VERSION}"
|
||||
do_sdk_install "platform-tools"
|
||||
fi
|
||||
if [ -n "${ANDROID_BUILD_TOOLS_VERSION}" ]; then
|
||||
do_sdk_install "build-tools;${ANDROID_BUILD_TOOLS_VERSION}"
|
||||
fi
|
||||
|
||||
do_clean_bdir
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#! /bin/sh
|
||||
|
||||
PACKAGE_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
HELPERS_DIR=$PACKAGE_DIR/../..
|
||||
. $HELPERS_DIR/functions.sh
|
||||
|
||||
do_make_bdir
|
||||
|
||||
# Android already comes with zlib but it doesn't advertise it with pkg-config
|
||||
# As other libraries (libpng) requires it, just create a dummy .pc file
|
||||
|
||||
# Determine zlib version (the same way original zlib configure does)
|
||||
ZLIB_VERSION=$(sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${PREFIX}/include/zlib.h)
|
||||
if [ -z "${ZLIB_VERSION}" ]; then
|
||||
error "Can't find Android zlib version"
|
||||
fi
|
||||
|
||||
cat > zlib.pc <<EOF
|
||||
Name: zlib
|
||||
Description: zlib compression library
|
||||
Version: ${ZLIB_VERSION}
|
||||
Requires:
|
||||
Libs: -lz
|
||||
Cflags:
|
||||
EOF
|
||||
|
||||
pkgconfigdir=${PREFIX}/lib/${TARGET}/${API}/pkgconfig
|
||||
|
||||
# These steps are inspired from original zlib Makefile.in
|
||||
mkdir -p ${DESTDIR}/${pkgconfigdir}
|
||||
rm -f ${DESTDIR}/${pkgconfigdir}/zlib.pc
|
||||
cp zlib.pc ${DESTDIR}/${pkgconfigdir}
|
||||
chmod 644 ${DESTDIR}/${pkgconfigdir}/zlib.pc
|
||||
|
||||
do_clean_bdir
|
||||
@@ -0,0 +1,47 @@
|
||||
m4_dnl This file is included by Dockerfile.m4
|
||||
# zlib is already provided by Android but doesn't come with a pkg-config file
|
||||
# This package just installs one to please libpng and others which require it
|
||||
local_package(zlib)
|
||||
|
||||
helpers_package(libpng1.6)
|
||||
|
||||
helpers_package(libjpeg-turbo)
|
||||
|
||||
helpers_package(faad2)
|
||||
|
||||
helpers_package(libmad)
|
||||
|
||||
helpers_package(libogg)
|
||||
|
||||
helpers_package(libtheora)
|
||||
|
||||
# Copy platform patch
|
||||
COPY packages/libvorbis lib-helpers/packages/libvorbis
|
||||
helpers_package(libvorbis)
|
||||
|
||||
helpers_package(flac)
|
||||
|
||||
helpers_package(mpeg2dec)
|
||||
|
||||
helpers_package(a52dec)
|
||||
|
||||
helpers_package(libiconv)
|
||||
|
||||
local_package(openssl)
|
||||
|
||||
helpers_package(curl)
|
||||
|
||||
helpers_package(freetype)
|
||||
|
||||
# Specific android patched version
|
||||
local_package(libsdl2)
|
||||
|
||||
# Copy platform patch
|
||||
# Don't depend on SDL2 (paradoxical)
|
||||
# We have installed it but it depends on OpenGL so try to avoid these dependencies
|
||||
COPY packages/libsdl2-net lib-helpers/packages/libsdl2-net
|
||||
helpers_package(libsdl2-net)
|
||||
|
||||
# Copy platform patch
|
||||
COPY packages/fluidsynth-lite lib-helpers/packages/fluidsynth-lite
|
||||
helpers_package(fluidsynth-lite, -DBIN_INSTALL_DIR=bin/\$TARGET/\$API -DLIB_INSTALL_DIR=lib/\$TARGET/\$API)
|
||||
@@ -0,0 +1,32 @@
|
||||
FROM toolchains/android AS toolchain
|
||||
|
||||
m4_include(`debian-builder-base.m4')m4_dnl
|
||||
|
||||
# Create man directories to please openjdk which expects them
|
||||
# cf. https://github.com/debuerreotype/debuerreotype/issues/10
|
||||
# ant is used by ScummVM build system
|
||||
# file is used ndk-build in NDK 14
|
||||
# libncurses5 is used by binaries in NDK 14
|
||||
# nasm is used for x86 ScummVM
|
||||
RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
|
||||
apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
ant \
|
||||
default-jre-headless \
|
||||
file \
|
||||
libncurses5 \
|
||||
nasm && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV RO_ANDROID_ROOT=/opt/android \
|
||||
HOST_TAG=linux-x86_64
|
||||
|
||||
COPY --from=toolchain ${RO_ANDROID_ROOT} ${RO_ANDROID_ROOT}/
|
||||
|
||||
# Copy the wrapper script in charge of copying the licenses at the right place
|
||||
COPY setup_wrapper.sh ${RO_ANDROID_ROOT}/
|
||||
|
||||
# Don't forget quotes for the ENTRYPOINT as it's a list of strings
|
||||
# We can't use RO_ANDROID_ROOT there as it's not expanded when running
|
||||
m4_define(`ENTRY_WRAPPER', `"/opt/android/setup_wrapper.sh"')m4_dnl
|
||||
m4_include(`run-buildbot.m4')m4_dnl
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#! /bin/sh
|
||||
|
||||
unset ANDROID_SDK_ROOT ANDROID_SDK_HOME GRADLE_USER_HOME
|
||||
ANDROID_SDK_ROOT=/data/bshomes/android/sdk
|
||||
ANDROID_SDK_HOME=/data/bshomes/android/sdk-home
|
||||
GRADLE_USER_HOME=/data/bshomes/android/gradle
|
||||
|
||||
# Create all directories
|
||||
mkdir -p "${ANDROID_SDK_ROOT}" "${ANDROID_SDK_HOME}" "${GRADLE_USER_HOME}"
|
||||
|
||||
# Copy accepted licenses as we can't accept them during the build process
|
||||
cp -R "${RO_ANDROID_ROOT}"/master/sdk/licenses "${ANDROID_SDK_ROOT}"/licenses
|
||||
|
||||
# Disable gradle build daemon as we kill the container after the build
|
||||
echo "org.gradle.daemon=false" > "${GRADLE_USER_HOME}"/gradle.properties
|
||||
|
||||
# Don't do anything after so replace our process
|
||||
exec "$@"
|
||||
Reference in new issue
Block a user