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 \
|
|
|
|
build-server \
|
|
|
|
prepare-deps-win32 prepare-deps-win64 \
|
2018-05-28 03:30:32 +08:00
|
|
|
build-win32 build-win32-noconsole \
|
|
|
|
build-win64 build-win64-noconsole \
|
2018-05-13 22:03:39 +08:00
|
|
|
dist-win32 dist-win64 \
|
|
|
|
zip-win32 zip-win64 \
|
|
|
|
sums release
|
|
|
|
|
|
|
|
GRADLE ?= ./gradlew
|
|
|
|
|
|
|
|
SERVER_BUILD_DIR := build-server
|
|
|
|
WIN32_BUILD_DIR := build-win32
|
2018-05-28 03:30:32 +08:00
|
|
|
WIN32_NOCONSOLE_BUILD_DIR := build-win32-noconsole
|
2018-05-13 22:03:39 +08:00
|
|
|
WIN64_BUILD_DIR := build-win64
|
2018-05-28 03:30:32 +08:00
|
|
|
WIN64_NOCONSOLE_BUILD_DIR := build-win64-noconsole
|
2018-05-13 22:03:39 +08:00
|
|
|
|
|
|
|
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
|
2019-01-26 22:24:37 +08:00
|
|
|
@echo "Windows archives generated in $(DIST)/"
|
2018-05-13 22:03:39 +08:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(GRADLE) clean
|
2018-06-06 02:42:35 +08:00
|
|
|
rm -rf "$(SERVER_BUILD_DIR)" "$(WIN32_BUILD_DIR)" "$(WIN64_BUILD_DIR)" \
|
|
|
|
"$(WIN32_NOCONSOLE_BUILD_DIR)" "$(WIN64_NOCONSOLE_BUILD_DIR)" "$(DIST)"
|
2018-05-13 22:03:39 +08:00
|
|
|
|
|
|
|
build-server:
|
|
|
|
[ -d "$(SERVER_BUILD_DIR)" ] || ( mkdir "$(SERVER_BUILD_DIR)" && \
|
|
|
|
meson "$(SERVER_BUILD_DIR)" \
|
2019-07-29 21:19:07 +08:00
|
|
|
--buildtype release -Dcompile_app=false )
|
2018-05-13 22:03:39 +08:00
|
|
|
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 \
|
2018-06-06 02:43:47 +08:00
|
|
|
-Dcrossbuild_windows=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)"
|
|
|
|
|
2018-05-28 03:30:32 +08:00
|
|
|
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 \
|
2018-06-06 02:43:47 +08:00
|
|
|
-Dcrossbuild_windows=true \
|
2019-07-29 21:19:07 +08:00
|
|
|
-Dcompile_server=false \
|
2018-05-28 03:30:32 +08:00
|
|
|
-Dwindows_noconsole=true \
|
2019-06-09 01:03:22 +08:00
|
|
|
-Dportable=true )
|
2018-05-28 03:30:32 +08:00
|
|
|
ninja -C "$(WIN32_NOCONSOLE_BUILD_DIR)"
|
|
|
|
|
2018-05-13 22:03:39 +08:00
|
|
|
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 \
|
2018-06-06 02:43:47 +08:00
|
|
|
-Dcrossbuild_windows=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)"
|
|
|
|
|
2018-05-28 03:30:32 +08:00
|
|
|
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 \
|
2018-06-06 02:43:47 +08:00
|
|
|
-Dcrossbuild_windows=true \
|
2019-07-29 21:19:07 +08:00
|
|
|
-Dcompile_server=false \
|
2018-05-28 03:30:32 +08:00
|
|
|
-Dwindows_noconsole=true \
|
2019-06-09 01:03:22 +08:00
|
|
|
-Dportable=true )
|
2018-05-28 03:30:32 +08:00
|
|
|
ninja -C "$(WIN64_NOCONSOLE_BUILD_DIR)"
|
|
|
|
|
|
|
|
dist-win32: build-server build-win32 build-win32-noconsole
|
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)/"
|
2018-05-28 03:30:32 +08:00
|
|
|
cp "$(WIN32_NOCONSOLE_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN32_TARGET_DIR)/scrcpy-noconsole.exe"
|
2019-11-20 05:37:31 +08:00
|
|
|
cp prebuilt-deps/ffmpeg-4.2.1-win32-shared/bin/avutil-56.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp prebuilt-deps/ffmpeg-4.2.1-win32-shared/bin/avcodec-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp prebuilt-deps/ffmpeg-4.2.1-win32-shared/bin/avformat-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp prebuilt-deps/ffmpeg-4.2.1-win32-shared/bin/swresample-3.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
|
|
|
cp prebuilt-deps/ffmpeg-4.2.1-win32-shared/bin/swscale-5.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2018-05-13 22:03:39 +08:00
|
|
|
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)/"
|
2019-08-04 05:40:34 +08:00
|
|
|
cp prebuilt-deps/SDL2-2.0.10/i686-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
2018-05-13 22:03:39 +08:00
|
|
|
|
2018-05-28 03:30:32 +08:00
|
|
|
dist-win64: build-server build-win64 build-win64-noconsole
|
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)/"
|
2018-05-28 03:30:32 +08:00
|
|
|
cp "$(WIN64_NOCONSOLE_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN64_TARGET_DIR)/scrcpy-noconsole.exe"
|
2019-11-20 05:37:31 +08:00
|
|
|
cp prebuilt-deps/ffmpeg-4.2.1-win64-shared/bin/avutil-56.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp prebuilt-deps/ffmpeg-4.2.1-win64-shared/bin/avcodec-58.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp prebuilt-deps/ffmpeg-4.2.1-win64-shared/bin/avformat-58.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp prebuilt-deps/ffmpeg-4.2.1-win64-shared/bin/swresample-3.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
|
|
|
cp prebuilt-deps/ffmpeg-4.2.1-win64-shared/bin/swscale-5.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
2018-05-13 22:03:39 +08:00
|
|
|
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)/"
|
2019-08-04 05:40:34 +08:00
|
|
|
cp prebuilt-deps/SDL2-2.0.10/x86_64-w64-mingw32/bin/SDL2.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)" .
|
2018-05-13 22:03:39 +08:00
|
|
|
|
|
|
|
sums:
|
|
|
|
cd "$(DIST)"; \
|
2018-05-29 04:31:39 +08:00
|
|
|
sha256sum *.zip > SHA256SUMS.txt
|