Compare commits

...

3 Commits

Author SHA1 Message Date
Romain Vimont
9521b2f22a meson-wrap-subprojects wip 2025-10-26 11:51:48 +01:00
Yan
f3d4fde15b Fix handling of non-integer ANDROID_PLATFORM
ANDROID_PLATFORM is not always an integer; it can also be a value like
"36.1". Handle such cases properly.

This fixes the following error:

    server/build_without_gradle.sh: line 89:
    [[: 36.1: syntax error: invalid arithmetic operator (error token is ".1")

PR #6408 <https://github.com/Genymobile/scrcpy/pull/6408>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2025-10-19 21:00:05 +02:00
Romain Vimont
eee3f24739 Upgrade Gradle and use Android SDK 36 2025-10-19 21:00:05 +02:00
8 changed files with 113 additions and 14 deletions

View File

@@ -112,13 +112,19 @@ cc = meson.get_compiler('c')
static = get_option('static')
sdl2_proj = subproject('sdl2')
sdl2_dep = sdl2_proj.get_variable('sdl2_dep')
meson.override_dependency('sdl2', sdl2_dep)
dependencies = [
dependency('libavformat', version: '>= 57.33', static: static),
dependency('libavcodec', version: '>= 57.37', static: static),
dependency('libavutil', static: static),
dependency('libswresample', static: static),
dependency('sdl2', version: '>= 2.0.5', static: static),
dependency('sdl2', static: static),
]
#dependency('sdl2', version: '>= 2.0.5', static: static),
if v4l2_support
dependencies += dependency('libavdevice', static: static)

View File

@@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.7.1'
classpath 'com.android.tools.build:gradle:8.13.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
# https://gradle.org/release-checksums/
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'
android {
namespace 'com.genymobile.scrcpy'
compileSdk 35
namespace = 'com.genymobile.scrcpy'
compileSdk 36
defaultConfig {
applicationId "com.genymobile.scrcpy"
applicationId = "com.genymobile.scrcpy"
minSdkVersion 21
targetSdkVersion 35
targetSdkVersion 36
versionCode 30303
versionName "3.3.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
@@ -18,8 +18,11 @@ android {
}
}
buildFeatures {
buildConfig true
aidl true
buildConfig = true
aidl = true
}
lint {
disable 'UseRequiresApi'
}
}

View File

@@ -14,8 +14,8 @@ set -e
SCRCPY_DEBUG=false
SCRCPY_VERSION_NAME=3.3.3
PLATFORM=${ANDROID_PLATFORM:-35}
BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-35.0.0}
PLATFORM=${ANDROID_PLATFORM:-36}
BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-36.0.0}
PLATFORM_TOOLS="$ANDROID_HOME/platforms/android-$PLATFORM"
BUILD_TOOLS_DIR="$ANDROID_HOME/build-tools/$BUILD_TOOLS"
@@ -86,7 +86,7 @@ javac -encoding UTF-8 -bootclasspath "$ANDROID_JAR" \
echo "Dexing..."
cd "$CLASSES_DIR"
if [[ $PLATFORM -lt 31 ]]
if [[ "${PLATFORM%%.*}" -lt 31 ]]
then
# use dx
"$BUILD_TOOLS_DIR/dx" --dex --output "$BUILD_DIR/classes.dex" \

View File

@@ -226,7 +226,11 @@ public final class Server {
private static void internalMain(String... args) throws Exception {
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
Ln.e("Exception on thread " + t, e);
if (defaultHandler != null) {
defaultHandler.uncaughtException(t, e);
}
});
prepareMainLooper();

View File

@@ -0,0 +1,77 @@
project('sdl2', 'c')
prefix = get_option('prefix')
link_type = get_option('default_library')
make_prog = find_program('make', required: true)
configure_command = []
configure_args = [
'./configure',
'--prefix=' + prefix,
]
if host_machine.system() == 'linux'
configure_args += [
'--enable-video-wayland',
'--enable-video-x11',
]
endif
if link_type == 'static'
configure_args += [
'--enable-static',
'--disable-shared',
]
else
configure_args += [
'--disable-static',
'--enable-shared',
]
endif
if meson.is_cross_build()
configure_args += [
'--host=' + host_machine.cpu_family() + '-w64-mingw32',
]
endif
configure_env = environment()
configure_env.set('CFLAGS', '-O2')
configure_env.set('CXXFLAGS', '-O2')
configure_target = custom_target('sdl2_configure',
output: 'config.h',
command: configure_args,
env: configure_env,
console: true
)
if host_machine.system() == 'windows' and link_type == 'shared'
build_output = ['SDL2.dll']
elif link_type == 'shared'
build_output = ['libSDL2.so']
else
build_output = ['libSDL2.a']
endif
sdl2_build = custom_target('sdl2_build',
depends: configure_target,
output: build_output,
command: [make_prog, '-j'],
console: true,
build_by_default: true
)
sdl2_install = custom_target('sdl2_install',
depends: sdl2_build,
output: 'install_done',
command: [make_prog, 'install', '&&', 'touch', '@OUTPUT@'],
console: true,
build_by_default: true,
install: false
)
sdl2_dep = declare_dependency(sources: sdl2_install)

9
subprojects/sdl2.wrap Normal file
View File

@@ -0,0 +1,9 @@
[wrap-file]
directory = SDL-release-2.32.8
source_url = https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.32.8.tar.gz
source_filename = libsdl2-2.32.8.tar.gz
source_hash = dd35e05644ae527848d02433bec24dd0ea65db59faecf1a0e5d1880c533dac2c
patch_directory = sdl2
[provide]
sdl2 = sdl2_dep