2018-05-13 22:03:39 +08:00
|
|
|
# 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
|
2019-10-31 06:40:10 +08:00
|
|
|
# locations (e.g. /usr/bin/scrcpy and /usr/share/scrcpy/scrcpy-server).
|
2018-05-13 22:03:39 +08:00
|
|
|
#
|
|
|
|
# In particular, this implies to change the location from where the client push
|
|
|
|
# the server to the device.
|
|
|
|
|
|
|
|
.PHONY: default clean \
|
2020-12-17 21:54:04 +08:00
|
|
|
test \
|
2018-05-13 22:03:39 +08:00
|
|
|
build-server \
|
|
|
|
prepare-deps-win32 prepare-deps-win64 \
|
2020-12-16 04:50:46 +08:00
|
|
|
build-win32 build-win64 \
|
2018-05-13 22:03:39 +08:00
|
|
|
dist-win32 dist-win64 \
|
|
|
|
zip-win32 zip-win64 \
|
2020-12-17 21:54:04 +08:00
|
|
|
release
|
2018-05-13 22:03:39 +08:00
|
|
|
|
|
|
|
GRADLE ?= ./gradlew
|
|
|
|
|
2020-12-17 21:54:04 +08:00
|
|
|
TEST_BUILD_DIR := build-test
|
2018-05-13 22:03:39 +08:00
|
|
|
SERVER_BUILD_DIR := build-server
|
|
|
|
WIN32_BUILD_DIR := build-win32
|
|
|
|
WIN64_BUILD_DIR := build-win64
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-12-17 21:54:04 +08:00
|
|
|
RELEASE_DIR := release-$(VERSION)
|
|
|
|
|
|
|
|
release: clean test build-server zip-win32 zip-win64
|
|
|
|
mkdir -p "$(RELEASE_DIR)"
|
|
|
|
cp "$(SERVER_BUILD_DIR)/server/scrcpy-server" \
|
|
|
|
"$(RELEASE_DIR)/scrcpy-server-$(VERSION)"
|
|
|
|
cp "$(DIST)/$(WIN32_TARGET)" "$(RELEASE_DIR)"
|
|
|
|
cp "$(DIST)/$(WIN64_TARGET)" "$(RELEASE_DIR)"
|
|
|
|
cd "$(RELEASE_DIR)" && \
|
|
|
|
sha256sum "scrcpy-server-$(VERSION)" \
|
|
|
|
"scrcpy-win32-$(VERSION).zip" \
|
|
|
|
"scrcpy-win64-$(VERSION).zip" > SHA256SUMS.txt
|
|
|
|
@echo "Release generated in $(RELEASE_DIR)/"
|
2018-05-13 22:03:39 +08:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(GRADLE) clean
|
2020-12-17 21:54:04 +08:00
|
|
|
rm -rf "$(DIST)" "$(TEST_BUILD_DIR)" "$(SERVER_BUILD_DIR)" \
|
|
|
|
"$(WIN32_BUILD_DIR)" "$(WIN64_BUILD_DIR)"
|
|
|
|
|
|
|
|
test:
|
|
|
|
[ -d "$(TEST_BUILD_DIR)" ] || ( mkdir "$(TEST_BUILD_DIR)" && \
|
2022-12-21 20:29:27 +08:00
|
|
|
meson setup "$(TEST_BUILD_DIR)" -Db_sanitize=address )
|
2020-12-17 21:54:04 +08:00
|
|
|
ninja -C "$(TEST_BUILD_DIR)"
|
|
|
|
$(GRADLE) -p server check
|
2018-05-13 22:03:39 +08:00
|
|
|
|
|
|
|
build-server:
|
|
|
|
[ -d "$(SERVER_BUILD_DIR)" ] || ( mkdir "$(SERVER_BUILD_DIR)" && \
|
2022-12-21 20:29:27 +08:00
|
|
|
meson setup "$(SERVER_BUILD_DIR)" --buildtype release -Dcompile_app=false )
|
2020-12-17 21:54:04 +08:00
|
|
|
ninja -C "$(SERVER_BUILD_DIR)"
|
2018-05-13 22:03:39 +08:00
|
|
|
|
|
|
|
prepare-deps-win32:
|
2022-02-10 06:10:38 +08:00
|
|
|
@app/prebuilt-deps/prepare-adb.sh
|
|
|
|
@app/prebuilt-deps/prepare-sdl.sh
|
|
|
|
@app/prebuilt-deps/prepare-ffmpeg-win32.sh
|
2022-02-07 15:52:17 +08:00
|
|
|
@app/prebuilt-deps/prepare-libusb.sh
|
2018-05-13 22:03:39 +08:00
|
|
|
|
2022-02-10 06:01:49 +08:00
|
|
|
prepare-deps-win64:
|
2022-02-10 06:10:38 +08:00
|
|
|
@app/prebuilt-deps/prepare-adb.sh
|
|
|
|
@app/prebuilt-deps/prepare-sdl.sh
|
|
|
|
@app/prebuilt-deps/prepare-ffmpeg-win64.sh
|
2022-02-07 15:52:17 +08:00
|
|
|
@app/prebuilt-deps/prepare-libusb.sh
|
2022-02-10 06:01:49 +08:00
|
|
|
|
2018-05-13 22:03:39 +08:00
|
|
|
build-win32: prepare-deps-win32
|
|
|
|
[ -d "$(WIN32_BUILD_DIR)" ] || ( mkdir "$(WIN32_BUILD_DIR)" && \
|
2022-12-21 20:29:27 +08:00
|
|
|
meson setup "$(WIN32_BUILD_DIR)" \
|
2018-05-13 22:03:39 +08:00
|
|
|
--cross-file cross_win32.txt \
|
|
|
|
--buildtype release --strip -Db_lto=true \
|
2019-07-29 21:19:07 +08:00
|
|
|
-Dcompile_server=false \
|
2019-06-09 01:03:22 +08:00
|
|
|
-Dportable=true )
|
2018-05-13 22:03:39 +08:00
|
|
|
ninja -C "$(WIN32_BUILD_DIR)"
|
|
|
|
|
|
|
|
build-win64: prepare-deps-win64
|
|
|
|
[ -d "$(WIN64_BUILD_DIR)" ] || ( mkdir "$(WIN64_BUILD_DIR)" && \
|
2022-12-21 20:29:27 +08:00
|
|
|
meson setup "$(WIN64_BUILD_DIR)" \
|
2018-05-13 22:03:39 +08:00
|
|
|
--cross-file cross_win64.txt \
|
|
|
|
--buildtype release --strip -Db_lto=true \
|
2019-07-29 21:19:07 +08:00
|
|
|
-Dcompile_server=false \
|
2019-06-09 01:03:22 +08:00
|
|
|
-Dportable=true )
|
2018-05-13 22:03:39 +08:00
|
|
|
ninja -C "$(WIN64_BUILD_DIR)"
|
|
|
|
|
2020-12-16 04:50:46 +08:00
|
|
|
dist-win32: build-server build-win32
|
2018-05-13 22:03:39 +08:00
|
|
|
mkdir -p "$(DIST)/$(WIN32_TARGET_DIR)"
|
2019-10-31 06:40:10 +08:00
|
|
|
cp "$(SERVER_BUILD_DIR)"/server/scrcpy-server "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2018-05-13 22:03:39 +08:00
|
|
|
cp "$(WIN32_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2022-02-21 00:56:50 +08:00
|
|
|
cp app/data/scrcpy-console.bat "$(DIST)/$(WIN32_TARGET_DIR)"
|
|
|
|
cp app/data/scrcpy-noconsole.vbs "$(DIST)/$(WIN32_TARGET_DIR)"
|
|
|
|
cp app/data/icon.png "$(DIST)/$(WIN32_TARGET_DIR)"
|
|
|
|
cp app/data/open_a_terminal_here.bat "$(DIST)/$(WIN32_TARGET_DIR)"
|
2022-02-10 06:10:38 +08:00
|
|
|
cp app/prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/avutil-56.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/avcodec-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/avformat-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/swresample-3.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/swscale-5.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2022-04-29 02:18:13 +08:00
|
|
|
cp app/prebuilt-deps/data/platform-tools-33.0.1/adb.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/platform-tools-33.0.1/AdbWinApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/platform-tools-33.0.1/AdbWinUsbApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2022-04-29 01:23:59 +08:00
|
|
|
cp app/prebuilt-deps/data/SDL2-2.0.22/i686-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2022-04-22 19:33:50 +08:00
|
|
|
cp app/prebuilt-deps/data/libusb-1.0.26/MinGW-Win32/msys-usb-1.0.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2018-05-13 22:03:39 +08:00
|
|
|
|
2020-12-16 04:50:46 +08:00
|
|
|
dist-win64: build-server build-win64
|
2018-05-13 22:03:39 +08:00
|
|
|
mkdir -p "$(DIST)/$(WIN64_TARGET_DIR)"
|
2019-10-31 06:40:10 +08:00
|
|
|
cp "$(SERVER_BUILD_DIR)"/server/scrcpy-server "$(DIST)/$(WIN64_TARGET_DIR)/"
|
2018-05-13 22:03:39 +08:00
|
|
|
cp "$(WIN64_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
|
2022-02-21 00:56:50 +08:00
|
|
|
cp app/data/scrcpy-console.bat "$(DIST)/$(WIN64_TARGET_DIR)"
|
|
|
|
cp app/data/scrcpy-noconsole.vbs "$(DIST)/$(WIN64_TARGET_DIR)"
|
|
|
|
cp app/data/icon.png "$(DIST)/$(WIN64_TARGET_DIR)"
|
|
|
|
cp app/data/open_a_terminal_here.bat "$(DIST)/$(WIN64_TARGET_DIR)"
|
2022-04-29 01:32:14 +08:00
|
|
|
cp app/prebuilt-deps/data/ffmpeg-win64-5.0.1/bin/avutil-57.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/ffmpeg-win64-5.0.1/bin/avcodec-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/ffmpeg-win64-5.0.1/bin/avformat-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/ffmpeg-win64-5.0.1/bin/swresample-4.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/ffmpeg-win64-5.0.1/bin/swscale-6.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
2022-04-29 02:18:13 +08:00
|
|
|
cp app/prebuilt-deps/data/platform-tools-33.0.1/adb.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/platform-tools-33.0.1/AdbWinApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp app/prebuilt-deps/data/platform-tools-33.0.1/AdbWinUsbApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
2022-04-29 01:23:59 +08:00
|
|
|
cp app/prebuilt-deps/data/SDL2-2.0.22/x86_64-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
2022-04-22 19:33:50 +08:00
|
|
|
cp app/prebuilt-deps/data/libusb-1.0.26/MinGW-x64/msys-usb-1.0.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
2018-05-13 22:03:39 +08:00
|
|
|
|
|
|
|
zip-win32: dist-win32
|
2019-07-31 22:33:30 +08:00
|
|
|
cd "$(DIST)/$(WIN32_TARGET_DIR)"; \
|
|
|
|
zip -r "../$(WIN32_TARGET)" .
|
2018-05-13 22:03:39 +08:00
|
|
|
|
|
|
|
zip-win64: dist-win64
|
2019-07-31 22:33:30 +08:00
|
|
|
cd "$(DIST)/$(WIN64_TARGET_DIR)"; \
|
|
|
|
zip -r "../$(WIN64_TARGET)" .
|