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