Add mobot.mk Makefile to capture custom build steps

This commit is contained in:
Frank Leon Rose 2021-04-09 18:00:46 -04:00
parent 242744a7b2
commit 07c8abec02
3 changed files with 52 additions and 6 deletions

View file

@ -25,14 +25,29 @@ src = [
'src/util/str_util.c'
]
cc = meson.get_compiler('c')
if not get_option('crossbuild_windows')
libdir = get_option('local_libav')
if libdir != ''
lib_avformat = cc.find_library('avformat', dirs : libdir)
lib_avcodec = cc.find_library('avcodec', dirs : libdir)
lib_avutil = cc.find_library('avutil', dirs : libdir)
lib_swscale = cc.find_library('swscale', dirs : libdir)
else
lib_avformat = dependency('avformat')
lib_avcodec = dependency('avcodec')
lib_avutil = dependency('avutil')
lib_swscale = dependency('swscale')
endif
# native build
dependencies = [
dependency('libavformat'),
dependency('libavcodec'),
dependency('libavutil'),
dependency('libswscale'),
lib_avformat,
lib_avcodec,
lib_avutil,
lib_swscale,
dependency('libpng'),
dependency('sdl2'),
]
@ -76,8 +91,6 @@ else
endif
cc = meson.get_compiler('c')
if host_machine.system() == 'windows'
src += [ 'src/sys/win/command.c' ]
dependencies += cc.find_library('ws2_32')

View file

@ -6,3 +6,4 @@ option('portable', type: 'boolean', value: false, description: 'Use scrcpy-serve
option('hidpi_support', type: 'boolean', value: true, description: 'Enable High DPI support')
option('server_debugger', type: 'boolean', value: false, description: 'Run a server debugger and wait for a client to be attached')
option('server_debugger_method', type: 'combo', choices: ['old', 'new'], value: 'new', description: 'Select the debugger method (Android < 9: "old", Android >= 9: "new")')
option('local_libav', type: 'string', value: '', description: 'Path to local installation of libav (ffmpeg)')

32
mobot.mk Normal file
View file

@ -0,0 +1,32 @@
# Mobot makefile
# Build the Mobot version of scrcpy with Mobot's FFmpeg
# make -f mobot.mk
.DEFAULT_GOAL := scrcpy
build-ffmpeg:
git clone https://github.com/team-mobot/FFmpeg.git build-ffmpeg
AVLIBS:=build-libav/lib/libavformat.a build-libav/lib/libavcodec.a build-libav/lib/libavutil.a build-libav/lib/libswscale.a
$(AVLIBS): build-ffmpeg
# Build Mobot version of FFmpeg and install in subdir libav
cd build-ffmpeg && \
git checkout encode-png-metadata && \
./configure --prefix="../build-libav" \
--pkg-config-flags="--static" \
--extra-libs="-lpthread -lm" \
--enable-gpl --enable-nonfree \
--disable-bsfs --disable-filters \
--disable-encoders --enable-encoder=png \
--disable-decoders --enable-decoder=h264 \
--enable-libx264 && \
make install-libs install-headers
build-app:
meson build-app --buildtype release --strip -Db_lto=true \
-Dlocal_libav=${PWD}/build-libav/lib \
-Dprebuilt_server=/usr/local/share/scrcpy/scrcpy-server
scrcpy: build-app $(AVLIBS)
ninja -Cbuild-app
cp build-app/app/scrcpy .