buildsys: generate Proxmox::Lib within the product Makefiles

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-11-15 13:09:27 +01:00
parent 807651bc7b
commit 6b2814d612
4 changed files with 17 additions and 11 deletions

View File

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

View File

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

View File

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

View File

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