2018-02-13 18:55:12 +08:00
|
|
|
# This makefile provides recipes to build a "portable" version of scrcpy.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# "make release-portable" builds a zip containing the client and the server.
|
|
|
|
#
|
2018-03-28 17:08:01 +08:00
|
|
|
# On Windows with MSYS2/mingw64, execute:
|
|
|
|
# GRADLE="$PWD/gradlew" mingw32-make release-portable
|
|
|
|
#
|
2018-02-13 18:55:12 +08:00
|
|
|
# This is a simple Makefile because Meson is not flexible enough to execute some
|
|
|
|
# arbitrary commands.
|
|
|
|
|
2018-02-16 22:24:58 +08:00
|
|
|
.PHONY: default clean build-portable release-portable dist-portable dist-portable-zip sums test check
|
2017-12-12 22:12:07 +08:00
|
|
|
|
2018-02-06 00:47:32 +08:00
|
|
|
GRADLE ?= ./gradlew
|
2018-01-30 00:06:44 +08:00
|
|
|
|
2018-02-13 18:55:12 +08:00
|
|
|
PORTABLE_BUILD_DIR := build-portable
|
2017-12-12 22:12:07 +08:00
|
|
|
DIST := dist
|
|
|
|
TARGET_DIR := scrcpy
|
|
|
|
|
|
|
|
VERSION := $(shell git describe --tags --always)
|
|
|
|
TARGET := $(TARGET_DIR)-$(VERSION).zip
|
|
|
|
|
|
|
|
default:
|
2018-02-13 18:55:12 +08:00
|
|
|
@echo 'You must specify a target. Try: make release-portable'
|
2017-12-12 22:12:07 +08:00
|
|
|
|
|
|
|
clean:
|
2018-01-30 00:06:44 +08:00
|
|
|
$(GRADLE) clean
|
2018-02-13 18:55:12 +08:00
|
|
|
rm -rf "$(PORTABLE_BUILD_DIR)" "$(DIST)"
|
2018-02-07 18:47:10 +08:00
|
|
|
|
2018-02-13 18:55:12 +08:00
|
|
|
build-portable:
|
|
|
|
[ -d "$(PORTABLE_BUILD_DIR)" ] || ( mkdir "$(PORTABLE_BUILD_DIR)" && \
|
|
|
|
meson "$(PORTABLE_BUILD_DIR)" \
|
|
|
|
--buildtype release --strip -Db_lto=true \
|
2018-02-16 22:19:35 +08:00
|
|
|
-Doverride_server_path=scrcpy-server.jar )
|
2018-02-13 18:55:12 +08:00
|
|
|
ninja -C "$(PORTABLE_BUILD_DIR)"
|
2017-12-12 22:12:07 +08:00
|
|
|
|
2018-02-13 18:55:12 +08:00
|
|
|
release-portable: clean dist-portable-zip sums
|
|
|
|
@echo "Release created in $(DIST)/."
|
2017-12-12 22:12:07 +08:00
|
|
|
|
2018-02-13 18:55:12 +08:00
|
|
|
dist-portable: build-portable
|
2017-12-12 22:12:07 +08:00
|
|
|
mkdir -p "$(DIST)/$(TARGET_DIR)"
|
2018-02-13 18:55:12 +08:00
|
|
|
cp "$(PORTABLE_BUILD_DIR)"/server/scrcpy-server.jar "$(DIST)/$(TARGET_DIR)/"
|
|
|
|
cp "$(PORTABLE_BUILD_DIR)"/app/scrcpy "$(DIST)/$(TARGET_DIR)/"
|
2017-12-12 22:12:07 +08:00
|
|
|
|
2018-02-13 18:55:12 +08:00
|
|
|
dist-portable-zip: dist-portable
|
2017-12-12 22:12:07 +08:00
|
|
|
cd "$(DIST)"; \
|
|
|
|
zip -r "$(TARGET)" "$(TARGET_DIR)"
|
|
|
|
|
|
|
|
sums:
|
|
|
|
cd "$(DIST)"; \
|
|
|
|
sha256sum *.zip > SHA256SUM.txt
|
2017-12-14 18:38:44 +08:00
|
|
|
|
2018-02-13 18:55:12 +08:00
|
|
|
test: build-portable
|
2018-01-30 00:06:44 +08:00
|
|
|
$(GRADLE) test
|
2018-02-13 18:55:12 +08:00
|
|
|
ninja -C "$(PORTABLE_BUILD_DIR)" test
|
|
|
|
|
|
|
|
check: build-portable
|
|
|
|
$(GRADLE) check
|
|
|
|
ninja -C "$(PORTABLE_BUILD_DIR)" test
|