mirror of
https://github.com/Genymobile/scrcpy
synced 2024-11-17 03:25:38 +00:00
3b5e54278e
Include the last version of FFmpeg in Windows releases.
137 lines
5.4 KiB
Makefile
137 lines
5.4 KiB
Makefile
# This makefile provides recipes to build a "portable" version of scrcpy for
|
|
# Windows.
|
|
#
|
|
# Here, "portable" means that the client and server binaries are expected to be
|
|
# anywhere, but in the same directory, instead of well-defined separate
|
|
# locations (e.g. /usr/bin/scrcpy and /usr/share/scrcpy/scrcpy-server.jar).
|
|
#
|
|
# In particular, this implies to change the location from where the client push
|
|
# the server to the device.
|
|
|
|
.PHONY: default clean \
|
|
build-server \
|
|
prepare-deps-win32 prepare-deps-win64 \
|
|
build-win32 build-win32-noconsole \
|
|
build-win64 build-win64-noconsole \
|
|
dist-win32 dist-win64 \
|
|
zip-win32 zip-win64 \
|
|
sums release
|
|
|
|
GRADLE ?= ./gradlew
|
|
|
|
SERVER_BUILD_DIR := build-server
|
|
WIN32_BUILD_DIR := build-win32
|
|
WIN32_NOCONSOLE_BUILD_DIR := build-win32-noconsole
|
|
WIN64_BUILD_DIR := build-win64
|
|
WIN64_NOCONSOLE_BUILD_DIR := build-win64-noconsole
|
|
|
|
DIST := dist
|
|
WIN32_TARGET_DIR := scrcpy-win32
|
|
WIN64_TARGET_DIR := scrcpy-win64
|
|
|
|
VERSION := $(shell git describe --tags --always)
|
|
WIN32_TARGET := $(WIN32_TARGET_DIR)-$(VERSION).zip
|
|
WIN64_TARGET := $(WIN64_TARGET_DIR)-$(VERSION).zip
|
|
|
|
release: clean zip-win32 zip-win64 sums
|
|
@echo "Release created in $(DIST)/."
|
|
|
|
clean:
|
|
$(GRADLE) clean
|
|
rm -rf "$(SERVER_BUILD_DIR)" "$(WIN32_BUILD_DIR)" "$(WIN64_BUILD_DIR)" \
|
|
"$(WIN32_NOCONSOLE_BUILD_DIR)" "$(WIN64_NOCONSOLE_BUILD_DIR)" "$(DIST)"
|
|
|
|
build-server:
|
|
[ -d "$(SERVER_BUILD_DIR)" ] || ( mkdir "$(SERVER_BUILD_DIR)" && \
|
|
meson "$(SERVER_BUILD_DIR)" \
|
|
--buildtype release -Dbuild_app=false )
|
|
ninja -C "$(SERVER_BUILD_DIR)"
|
|
|
|
prepare-deps-win32:
|
|
-$(MAKE) -C prebuilt-deps prepare-win32
|
|
|
|
build-win32: prepare-deps-win32
|
|
[ -d "$(WIN32_BUILD_DIR)" ] || ( mkdir "$(WIN32_BUILD_DIR)" && \
|
|
meson "$(WIN32_BUILD_DIR)" \
|
|
--cross-file cross_win32.txt \
|
|
--buildtype release --strip -Db_lto=true \
|
|
-Dcrossbuild_windows=true \
|
|
-Dbuild_server=false \
|
|
-Doverride_server_path=scrcpy-server.jar )
|
|
ninja -C "$(WIN32_BUILD_DIR)"
|
|
|
|
build-win32-noconsole: prepare-deps-win32
|
|
[ -d "$(WIN32_NOCONSOLE_BUILD_DIR)" ] || ( mkdir "$(WIN32_NOCONSOLE_BUILD_DIR)" && \
|
|
meson "$(WIN32_NOCONSOLE_BUILD_DIR)" \
|
|
--cross-file cross_win32.txt \
|
|
--buildtype release --strip -Db_lto=true \
|
|
-Dcrossbuild_windows=true \
|
|
-Dbuild_server=false \
|
|
-Dwindows_noconsole=true \
|
|
-Doverride_server_path=scrcpy-server.jar )
|
|
ninja -C "$(WIN32_NOCONSOLE_BUILD_DIR)"
|
|
|
|
prepare-deps-win64:
|
|
-$(MAKE) -C prebuilt-deps prepare-win64
|
|
|
|
build-win64: prepare-deps-win64
|
|
[ -d "$(WIN64_BUILD_DIR)" ] || ( mkdir "$(WIN64_BUILD_DIR)" && \
|
|
meson "$(WIN64_BUILD_DIR)" \
|
|
--cross-file cross_win64.txt \
|
|
--buildtype release --strip -Db_lto=true \
|
|
-Dcrossbuild_windows=true \
|
|
-Dbuild_server=false \
|
|
-Doverride_server_path=scrcpy-server.jar )
|
|
ninja -C "$(WIN64_BUILD_DIR)"
|
|
|
|
build-win64-noconsole: prepare-deps-win64
|
|
[ -d "$(WIN64_NOCONSOLE_BUILD_DIR)" ] || ( mkdir "$(WIN64_NOCONSOLE_BUILD_DIR)" && \
|
|
meson "$(WIN64_NOCONSOLE_BUILD_DIR)" \
|
|
--cross-file cross_win64.txt \
|
|
--buildtype release --strip -Db_lto=true \
|
|
-Dcrossbuild_windows=true \
|
|
-Dbuild_server=false \
|
|
-Dwindows_noconsole=true \
|
|
-Doverride_server_path=scrcpy-server.jar )
|
|
ninja -C "$(WIN64_NOCONSOLE_BUILD_DIR)"
|
|
|
|
dist-win32: build-server build-win32 build-win32-noconsole
|
|
mkdir -p "$(DIST)/$(WIN32_TARGET_DIR)"
|
|
cp "$(SERVER_BUILD_DIR)"/server/scrcpy-server.jar "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
cp "$(WIN32_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
cp "$(WIN32_NOCONSOLE_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN32_TARGET_DIR)/scrcpy-noconsole.exe"
|
|
cp prebuilt-deps/ffmpeg-4.0.2-win32-shared/bin/avutil-56.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
cp prebuilt-deps/ffmpeg-4.0.2-win32-shared/bin/avcodec-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
cp prebuilt-deps/ffmpeg-4.0.2-win32-shared/bin/avformat-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
cp prebuilt-deps/ffmpeg-4.0.2-win32-shared/bin/swresample-3.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
cp prebuilt-deps/platform-tools/adb.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
cp prebuilt-deps/platform-tools/AdbWinApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
cp prebuilt-deps/platform-tools/AdbWinUsbApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
cp prebuilt-deps/SDL2-2.0.8/i686-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
dist-win64: build-server build-win64 build-win64-noconsole
|
|
mkdir -p "$(DIST)/$(WIN64_TARGET_DIR)"
|
|
cp "$(SERVER_BUILD_DIR)"/server/scrcpy-server.jar "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
cp "$(WIN64_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
cp "$(WIN64_NOCONSOLE_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN64_TARGET_DIR)/scrcpy-noconsole.exe"
|
|
cp prebuilt-deps/ffmpeg-4.0.2-win64-shared/bin/avutil-56.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
cp prebuilt-deps/ffmpeg-4.0.2-win64-shared/bin/avcodec-58.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
cp prebuilt-deps/ffmpeg-4.0.2-win64-shared/bin/avformat-58.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
cp prebuilt-deps/ffmpeg-4.0.2-win64-shared/bin/swresample-3.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
cp prebuilt-deps/platform-tools/adb.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
cp prebuilt-deps/platform-tools/AdbWinApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
cp prebuilt-deps/platform-tools/AdbWinUsbApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
cp prebuilt-deps/SDL2-2.0.8/x86_64-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
zip-win32: dist-win32
|
|
cd "$(DIST)"; \
|
|
zip -r "$(WIN32_TARGET)" "$(WIN32_TARGET_DIR)"
|
|
|
|
zip-win64: dist-win64
|
|
cd "$(DIST)"; \
|
|
zip -r "$(WIN64_TARGET)" "$(WIN64_TARGET_DIR)"
|
|
|
|
sums:
|
|
cd "$(DIST)"; \
|
|
sha256sum *.zip > SHA256SUMS.txt
|