From 6b2814d612214f8a7cbd96de4cd1355cefb3b0ef Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 15 Nov 2022 13:09:27 +0100 Subject: [PATCH] buildsys: generate Proxmox::Lib within the product Makefiles Signed-off-by: Wolfgang Bumiller --- Makefile | 10 ++++------ defines.mk | 2 +- pmg-rs/Makefile | 8 ++++++-- pve-rs/Makefile | 8 ++++++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 26277e51..c19b2168 100644 --- a/Makefile +++ b/Makefile @@ -35,8 +35,6 @@ pve pmg: .PHONY: gen gen: - $(call package_template,PMG,pmg_rs) - $(call package_template,PVE,pve_rs) perl ./scripts/genpackage.pl Common \ Proxmox::RS::APT::Repositories \ Proxmox::RS::CalendarEvent \ @@ -64,13 +62,13 @@ build: cp -a ./Proxmox ./build cp defines.mk ./build $(MAKE) BUILD_MODE=release -C build -f ../Makefile gen - mkdir -p ./build/pve-rs/Proxmox/Lib - mv ./build/Proxmox/Lib/PVE.pm ./build/pve-rs/Proxmox/Lib/PVE.pm - mkdir -p ./build/pmg-rs/Proxmox/Lib - mv ./build/Proxmox/Lib/PMG.pm ./build/pmg-rs/Proxmox/Lib/PMG.pm mv ./build/PVE ./build/pve-rs mv ./build/PMG ./build/pmg-rs mv ./build/Proxmox ./build/common/pkg +# The template.pm is required by the products to produce their Proxmox::Lib + mkdir ./build/Proxmox + mkdir ./build/Proxmox/Lib + cp ./Proxmox/Lib/template.pm ./build/Proxmox/Lib # So the common packages end up in ./build, rather than ./build/common mv ./build/common/pkg ./build/common-pkg diff --git a/defines.mk b/defines.mk index fd389ca3..b83abbf9 100644 --- a/defines.mk +++ b/defines.mk @@ -3,6 +3,6 @@ define package_template -e 's/\{\{PRODUCT\}\}/$(1)/g;' \ -e 's/\{\{LIBRARY\}\}/$(2)/g;' \ -e 's|\{\{DEBUG_LIBPATH\}\}|$(DEBUG_LIBPATH)|g;' \ - Proxmox/Lib/template.pm \ + $(3)Proxmox/Lib/template.pm \ >Proxmox/Lib/$(1).pm endef diff --git a/pmg-rs/Makefile b/pmg-rs/Makefile index 5ecaf5f7..0961172a 100644 --- a/pmg-rs/Makefile +++ b/pmg-rs/Makefile @@ -21,11 +21,15 @@ ifeq ($(BUILD_MODE), release) CARGO_BUILD_ARGS += --release endif -all: +all: Proxmox/Lib/PMG.pm ifneq ($(BUILD_MODE), skip) cargo build $(CARGO_BUILD_ARGS) endif +Proxmox/Lib/PMG.pm: ../Proxmox/Lib/template.pm + mkdir -p Proxmox/Lib + $(call package_template,PMG,pmg_rs,../) + # always re-create this dir # but also copy the local target/ and PMG/ dirs as a build-cache .PHONY: build @@ -35,7 +39,7 @@ build: rsync -a debian Makefile Cargo.toml Cargo.lock src target PMG build/ .PHONY: install -install: target/release/libpmg_rs.so +install: target/release/libpmg_rs.so Proxmox/Lib/PMG.pm install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORARCH)/auto install -m644 target/release/libpmg_rs.so $(DESTDIR)$(PERL_INSTALLVENDORARCH)/auto/libpmg_rs.so install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORLIB) diff --git a/pve-rs/Makefile b/pve-rs/Makefile index 7f54cccb..a63a42ba 100644 --- a/pve-rs/Makefile +++ b/pve-rs/Makefile @@ -22,11 +22,15 @@ ifeq ($(BUILD_MODE), release) CARGO_BUILD_ARGS += --release endif -all: +all: Proxmox/Lib/PVE.pm ifneq ($(BUILD_MODE), skip) cargo build $(CARGO_BUILD_ARGS) endif +Proxmox/Lib/PVE.pm: ../Proxmox/Lib/template.pm + mkdir -p Proxmox/Lib + $(call package_template,PVE,pve_rs,../) + # always re-create this dir # but also copy the local target/ and PVE/ dirs as a build-cache .PHONY: build @@ -36,7 +40,7 @@ build: rsync -a debian Makefile Cargo.toml Cargo.lock src target PVE build/ .PHONY: install -install: target/release/libpve_rs.so +install: target/release/libpve_rs.so Proxmox/Lib/PVE.pm install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORARCH)/auto install -m644 target/release/libpve_rs.so $(DESTDIR)$(PERL_INSTALLVENDORARCH)/auto/libpve_rs.so install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORLIB)