From 9fcecb2c8f8129b3c1017de4c8463a628ecf3a13 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 28 Feb 2022 11:57:56 +0100 Subject: [PATCH] generate and install perl package files Signed-off-by: Wolfgang Bumiller --- .gitignore | 7 +++++-- Cargo.toml | 2 +- Makefile | 40 ++++++++++++++++++++++++++++++++++++++-- pmg-rs/Makefile | 2 ++ pve-rs/Makefile | 2 ++ 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index c74dd6c5..62b94bec 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,8 @@ /build Cargo.lock /test.pl -/PVE -/PMG +/perl/PVE +/perl/PMG +/perl/Proxmox/Lib/PMG.pm +/perl/Proxmox/Lib/PVE.pm +/perl/Proxmox/RS diff --git a/Cargo.toml b/Cargo.toml index 57d0f819..b49a5912 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -exclude = [ "build", "common-src", "perl" ] +exclude = [ "build", "common-src", "perl", "scripts" ] members = [ "pve-rs", "pmg-rs", diff --git a/Makefile b/Makefile index b9bed9a4..4d5336b2 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,20 @@ endef ifeq ($(BUILD_MODE), release) CARGO_BUILD_ARGS += --release +DEBUG_LIBPATH := +else +DEBUG_LIBPATH := "-L./target/debug", endif +define package_template + sed -r \ + -e 's/\{\{PRODUCT\}\}/$(1)/g;' \ + -e 's/\{\{LIBRARY\}\}/$(2)/g;' \ + -e 's|\{\{DEBUG_LIBPATH\}\}|$(DEBUG_LIBPATH)|g;' \ + Proxmox/Lib/template.pm \ + >Proxmox/Lib/$(1).pm +endef + .PHONY: all all: ifeq ($(BUILD_TARGET), pve) @@ -23,14 +35,38 @@ pve pmg: @PERLMOD_PRODUCT=$(call to_upper,$@) \ $(CARGO) build $(CARGO_BUILD_ARGS) -p $@-rs +.PHONY: gen +gen: + $(call package_template,PMG,pmg_rs) + $(call package_template,PVE,pve_rs) + perl ./scripts/genpackage.pl Common Proxmox::RS::CalendarEvent + perl ./scripts/genpackage.pl PVE \ + PVE::RS::APT::Repositories \ + PVE::RS::OpenId \ + PVE::RS::TFA + perl ./scripts/genpackage.pl PMG \ + PMG::RS::APT::Repositories \ + PMG::RS::Acme \ + PMG::RS::CSR \ + PMG::RS::OpenId \ + PMG::RS::TFA + build: + rm -rf build mkdir build echo system >build/rust-toolchain + cp -a ./scripts ./build cp -a ./common-src ./build cp -a ./pve-rs ./build cp -a ./pmg-rs ./build - cp -a ./perl ./build/pve-rs - cp -a ./perl ./build/pmg-rs + cp -a ./Proxmox ./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 pve-deb: build cd ./build/pve-rs && dpkg-buildpackage -b -uc -us diff --git a/pmg-rs/Makefile b/pmg-rs/Makefile index 69b27987..bed14896 100644 --- a/pmg-rs/Makefile +++ b/pmg-rs/Makefile @@ -15,9 +15,11 @@ DEBS=$(MAIN_DEB) $(DBGSYM_DEB) DESTDIR= PM_DIRS := \ + Proxmox/Lib \ PMG/RS/APT PM_FILES := \ + Proxmox/Lib/PVE.pm \ PMG/RS/APT/Repositories.pm \ PMG/RS/Acme.pm \ PMG/RS/CSR.pm \ diff --git a/pve-rs/Makefile b/pve-rs/Makefile index 0b53d4d2..77f90824 100644 --- a/pve-rs/Makefile +++ b/pve-rs/Makefile @@ -16,9 +16,11 @@ DEBS=$(MAIN_DEB) $(DBGSYM_DEB) DESTDIR= PM_DIRS := \ + Proxmox/Lib \ PVE/RS/APT PM_FILES := \ + Proxmox/Lib/PVE.pm \ PVE/RS/APT/Repositories.pm \ PVE/RS/CalendarEvent.pm \ PVE/RS/OpenId.pm \