]> git.proxmox.com Git - librados2-perl.git/blob - Makefile
d/control: define compat level via build-depends and raise to 13
[librados2-perl.git] / Makefile
1 include /usr/share/dpkg/pkg-info.mk
2 include /usr/share/dpkg/architecture.mk
3
4 PACKAGE=librados2-perl
5
6 BUILDSRC := $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
7
8 DESTDIR=
9 PREFIX=/usr
10 BINDIR=$(PREFIX)/bin
11 LIBDIR=$(PREFIX)/lib
12 SBINDIR=$(PREFIX)/sbin
13 MANDIR=$(PREFIX)/share/man
14 DOCDIR=$(PREFIX)/share/doc/$(PACKAGE)
15 MAN1DIR=$(MANDIR)/man1/
16 PERLDIR=$(PREFIX)/share/perl5
17
18 PERL_ARCHLIB := `perl -MConfig -e 'print $$Config{archlib};'`
19 PERL_INSTALLVENDORARCH := `perl -MConfig -e 'print $$Config{installvendorarch};'`
20 PERL_APIVER := `perl -MConfig -e 'print $$Config{debian_abi}//$$Config{version};'`
21
22 # overwrite as not all Debian default flags work for the XS code (e.g., -Wformat-security)
23 CFLAGS = -shared -fPIC -g -O2 -Werror -Wtype-limits -Wall -Wl,-z,relro
24 CFLAGS += -D_FORTIFY_SOURCE=2 -I$(PERL_ARCHLIB)/CORE -DXS_VERSION=\"1.0\"
25 CFLAGS += -fstack-protector-strong -Wformat
26
27 PERLSODIR=$(PERL_INSTALLVENDORARCH)/auto
28
29 GITVERSION:=$(shell git rev-parse HEAD)
30
31 DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_BUILD_ARCH).deb
32 DSC=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
33
34 all:
35
36 RADOS.c: RADOS.xs typemap
37 xsubpp RADOS.xs -typemap typemap > RADOS.xsc
38 mv RADOS.xsc RADOS.c
39
40 RADOS.so: RADOS.c
41 $(CC) $(CFLAGS) -o RADOS.so RADOS.c -lrados
42
43 .PHONY: dinstall
44 dinstall: deb
45 dpkg -i $(DEB)
46
47 .PHONY: install
48 install: PVE/RADOS.pm RADOS.so
49 install -D -m 0644 PVE/RADOS.pm $(DESTDIR)$(PERLDIR)/PVE/RADOS.pm
50 install -D -m 0644 -s RADOS.so $(DESTDIR)$(PERLSODIR)/PVE/RADOS/RADOS.so
51
52 .PHONY: $(BUILDSRC)
53 $(BUILDSRC):
54 rm -rf $(BUILDSRC)
55 rsync -a * $(BUILDSRC)
56 sed -e "s|@PERLAPI@|perlapi-$(PERL_APIVER)|g" debian/control.in >$(BUILDSRC)/debian/control
57 echo "git clone git://git.proxmox.com/git/librados2-perl.git\\ngit checkout $(GITVERSION)" > $(BUILDSRC)/debian/SOURCE
58
59 .PHONY: deb
60 deb: $(DEB)
61 $(DEB): $(BUILDSRC)
62 cd $(BUILDSRC); dpkg-buildpackage -b -us -uc
63 lintian $(DEB)
64
65 .PHONY: dsc
66 dsc: $(DSC)
67 $(DSC): $(BUILDSRC)
68 cd $(BUILDSRC); dpkg-buildpackage -S -us -uc -d -nc
69 lintian $(DSC)
70
71 .PHONY: clean
72 clean:
73 rm -rf *~ build *.deb *.changes *.buildinfo *.dsc *.tar.gz
74 find . -name '*~' -exec rm {} ';'
75
76 .PHONY: distclean
77 distclean: clean
78
79 .PHONY: upload
80 upload: $(DEB)
81 tar cf - $(DEB) | ssh repoman@repo.proxmox.com -- upload --product pve --dist bullseye --arch $(DEB_BUILD_ARCH)