From 646ed1be0a2fb52fe7b080693083ec0872eae5f6 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 18 Dec 2023 11:04:50 +0100 Subject: [PATCH 1/4] Move steps from build into dependencies --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6019c4d..05e938f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,16 +37,16 @@ jobs: # nfpm curl -sS -Lo /tmp/nfpm.deb "https://github.com/goreleaser/nfpm/releases/download/v2.25.0/nfpm_amd64.deb" sudo dpkg -i /tmp/nfpm.deb - - - name: Build - run: | - set -x # for building cityhash for clickhouse-rs sudo apt-get install -y musl-tools # gcc cannot do cross compile, and there is no musl-g++ in musl-tools sudo ln -srf /usr/bin/clang /usr/bin/musl-g++ # musl for static binaries rustup target add x86_64-unknown-linux-musl + + - name: Build + run: | + set -x make packages target=x86_64-unknown-linux-musl for postfix in .x86_64.rpm -x86_64.pkg.tar.zst _amd64.deb; do cp chdig*$postfix chdig-latest$postfix From ca19d9ff9ab6e5a5d06509326701dae9a1fb2ea1 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 18 Dec 2023 13:54:05 +0100 Subject: [PATCH 2/4] Avoid copy-paste for PYO3_CONFIG_FILE --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9604164..4e61bfc 100644 --- a/Makefile +++ b/Makefile @@ -36,10 +36,10 @@ $(info PYO3_CONFIG_FILE = $(PYO3_CONFIG_FILE)) .PHONY: build chdig install deb rpm archlinux packages -contrib/flameshow/build/pyo3-build-config-file-$(target).txt: +$(PYO3_CONFIG_FILE): env -u PYO3_CONFIG_FILE cargo build $(cargo_build_opts) -p flameshow -chdig: contrib/flameshow/build/pyo3-build-config-file-$(target).txt +chdig: $(PYO3_CONFIG_FILE) cargo build $(cargo_build_opts) run: chdig From 8705c141e7303abcd2994d7a6b3750c0948a56a2 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 18 Dec 2023 13:57:57 +0100 Subject: [PATCH 3/4] Update .PHONY targets --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4e61bfc..f3f3e23 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,8 @@ endif export PYO3_CONFIG_FILE = $(PWD)/contrib/flameshow/build/pyo3-build-config-file-$(target).txt $(info PYO3_CONFIG_FILE = $(PYO3_CONFIG_FILE)) -.PHONY: build chdig install deb rpm archlinux packages +.PHONY: build build_completion deploy-binary chdig install run \ + deb rpm archlinux packages $(PYO3_CONFIG_FILE): env -u PYO3_CONFIG_FILE cargo build $(cargo_build_opts) -p flameshow From 641aa0a561f29e07de281e277fb359868ba676dd Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 18 Dec 2023 14:06:12 +0100 Subject: [PATCH 4/4] Fix make without arguments --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f3f3e23..995ce19 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,10 @@ $(info PYO3_CONFIG_FILE = $(PYO3_CONFIG_FILE)) .PHONY: build build_completion deploy-binary chdig install run \ deb rpm archlinux packages +# This should be the first target (since ".DEFAULT_GOAL" is supported only since 3.80+) +default: build +.DEFAULT_GOAL: default + $(PYO3_CONFIG_FILE): env -u PYO3_CONFIG_FILE cargo build $(cargo_build_opts) -p flameshow @@ -67,7 +71,5 @@ rpm: build archlinux: build CHDIG_VERSION=${CHDIG_VERSION_ARCH} nfpm package --config chdig-nfpm.yaml --packager archlinux -all: build - help: @echo "Usage: make [debug=1] [target=]"