Unify release makefile
Before this change, release.sh built some native stuff, and Makefile.CrossWindows built the Windows releases. Instead, use a single release.make to build the whole release. It also avoids to build the server one more time.
This commit is contained in:
parent
a46733906a
commit
230afd8966
2 changed files with 27 additions and 55 deletions
|
@ -9,15 +9,17 @@
|
||||||
# the server to the device.
|
# the server to the device.
|
||||||
|
|
||||||
.PHONY: default clean \
|
.PHONY: default clean \
|
||||||
|
test \
|
||||||
build-server \
|
build-server \
|
||||||
prepare-deps-win32 prepare-deps-win64 \
|
prepare-deps-win32 prepare-deps-win64 \
|
||||||
build-win32 build-win64 \
|
build-win32 build-win64 \
|
||||||
dist-win32 dist-win64 \
|
dist-win32 dist-win64 \
|
||||||
zip-win32 zip-win64 \
|
zip-win32 zip-win64 \
|
||||||
sums release
|
release
|
||||||
|
|
||||||
GRADLE ?= ./gradlew
|
GRADLE ?= ./gradlew
|
||||||
|
|
||||||
|
TEST_BUILD_DIR := build-test
|
||||||
SERVER_BUILD_DIR := build-server
|
SERVER_BUILD_DIR := build-server
|
||||||
WIN32_BUILD_DIR := build-win32
|
WIN32_BUILD_DIR := build-win32
|
||||||
WIN64_BUILD_DIR := build-win64
|
WIN64_BUILD_DIR := build-win64
|
||||||
|
@ -30,19 +32,35 @@ VERSION := $(shell git describe --tags --always)
|
||||||
WIN32_TARGET := $(WIN32_TARGET_DIR)-$(VERSION).zip
|
WIN32_TARGET := $(WIN32_TARGET_DIR)-$(VERSION).zip
|
||||||
WIN64_TARGET := $(WIN64_TARGET_DIR)-$(VERSION).zip
|
WIN64_TARGET := $(WIN64_TARGET_DIR)-$(VERSION).zip
|
||||||
|
|
||||||
release: clean zip-win32 zip-win64 sums
|
RELEASE_DIR := release-$(VERSION)
|
||||||
@echo "Windows archives generated in $(DIST)/"
|
|
||||||
|
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)/"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(GRADLE) clean
|
$(GRADLE) clean
|
||||||
rm -rf "$(SERVER_BUILD_DIR)" "$(WIN32_BUILD_DIR)" "$(WIN64_BUILD_DIR)" \
|
rm -rf "$(DIST)" "$(TEST_BUILD_DIR)" "$(SERVER_BUILD_DIR)" \
|
||||||
"$(DIST)"
|
"$(WIN32_BUILD_DIR)" "$(WIN64_BUILD_DIR)"
|
||||||
|
|
||||||
|
test:
|
||||||
|
[ -d "$(TEST_BUILD_DIR)" ] || ( mkdir "$(TEST_BUILD_DIR)" && \
|
||||||
|
meson "$(TEST_BUILD_DIR)" -Db_sanitize=address )
|
||||||
|
ninja -C "$(TEST_BUILD_DIR)"
|
||||||
|
$(GRADLE) -p server check
|
||||||
|
|
||||||
build-server:
|
build-server:
|
||||||
[ -d "$(SERVER_BUILD_DIR)" ] || ( mkdir "$(SERVER_BUILD_DIR)" && \
|
[ -d "$(SERVER_BUILD_DIR)" ] || ( mkdir "$(SERVER_BUILD_DIR)" && \
|
||||||
meson "$(SERVER_BUILD_DIR)" \
|
meson "$(SERVER_BUILD_DIR)" --buildtype release -Dcompile_app=false )
|
||||||
--buildtype release -Dcompile_app=false )
|
ninja -C "$(SERVER_BUILD_DIR)"
|
||||||
ninja -C "$(SERVER_BUILD_DIR)"
|
|
||||||
|
|
||||||
prepare-deps-win32:
|
prepare-deps-win32:
|
||||||
-$(MAKE) -C prebuilt-deps prepare-win32
|
-$(MAKE) -C prebuilt-deps prepare-win32
|
||||||
|
@ -109,7 +127,3 @@ zip-win32: dist-win32
|
||||||
zip-win64: dist-win64
|
zip-win64: dist-win64
|
||||||
cd "$(DIST)/$(WIN64_TARGET_DIR)"; \
|
cd "$(DIST)/$(WIN64_TARGET_DIR)"; \
|
||||||
zip -r "../$(WIN64_TARGET)" .
|
zip -r "../$(WIN64_TARGET)" .
|
||||||
|
|
||||||
sums:
|
|
||||||
cd "$(DIST)"; \
|
|
||||||
sha256sum *.zip > SHA256SUMS.txt
|
|
44
release.sh
44
release.sh
|
@ -1,44 +1,2 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
make -f release.make
|
||||||
|
|
||||||
# test locally
|
|
||||||
TESTDIR=build_test
|
|
||||||
rm -rf "$TESTDIR"
|
|
||||||
# run client tests with ASAN enabled
|
|
||||||
meson "$TESTDIR" -Db_sanitize=address
|
|
||||||
ninja -C"$TESTDIR" test
|
|
||||||
|
|
||||||
# test server
|
|
||||||
GRADLE=${GRADLE:-./gradlew}
|
|
||||||
$GRADLE -p server check
|
|
||||||
|
|
||||||
BUILDDIR=build_release
|
|
||||||
rm -rf "$BUILDDIR"
|
|
||||||
meson "$BUILDDIR" --buildtype release --strip -Db_lto=true
|
|
||||||
cd "$BUILDDIR"
|
|
||||||
ninja
|
|
||||||
cd -
|
|
||||||
|
|
||||||
# build Windows releases
|
|
||||||
make -f Makefile.CrossWindows
|
|
||||||
|
|
||||||
# the generated server must be the same everywhere
|
|
||||||
cmp "$BUILDDIR/server/scrcpy-server" dist/scrcpy-win32/scrcpy-server
|
|
||||||
cmp "$BUILDDIR/server/scrcpy-server" dist/scrcpy-win64/scrcpy-server
|
|
||||||
|
|
||||||
# get version name
|
|
||||||
TAG=$(git describe --tags --always)
|
|
||||||
|
|
||||||
# create release directory
|
|
||||||
mkdir -p "release-$TAG"
|
|
||||||
cp "$BUILDDIR/server/scrcpy-server" "release-$TAG/scrcpy-server-$TAG"
|
|
||||||
cp "dist/scrcpy-win32-$TAG.zip" "release-$TAG/"
|
|
||||||
cp "dist/scrcpy-win64-$TAG.zip" "release-$TAG/"
|
|
||||||
|
|
||||||
# generate checksums
|
|
||||||
cd "release-$TAG"
|
|
||||||
sha256sum "scrcpy-server-$TAG" \
|
|
||||||
"scrcpy-win32-$TAG.zip" \
|
|
||||||
"scrcpy-win64-$TAG.zip" > SHA256SUMS.txt
|
|
||||||
|
|
||||||
echo "Release generated in release-$TAG/"
|
|
||||||
|
|
Loading…
Reference in a new issue