generate and install perl package files

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-02-28 11:57:56 +01:00
parent 3d447c9762
commit 9fcecb2c8f
5 changed files with 48 additions and 5 deletions

7
.gitignore vendored
View File

@ -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

View File

@ -1,5 +1,5 @@
[workspace]
exclude = [ "build", "common-src", "perl" ]
exclude = [ "build", "common-src", "perl", "scripts" ]
members = [
"pve-rs",
"pmg-rs",

View File

@ -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

View File

@ -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 \

View File

@ -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 \