# h2xs -an LibArchive /usr/include/archive.h /usr/include/archive_entry.h
# perl Makefile.PL PREFIX=/usr
-#OPKGNAME = libarchive-2.2.4
-#DEB = libarchive1_2.2.4-1_i386.deb
-#DEVDEB = libarchive-dev_2.2.4-1_i386.deb
PPSRC = LibArchive
-DEB = libarchive-perl_3.2.1-1_amd64.deb
+
+ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+GITVERSION:=$(shell git rev-parse HEAD)
+
+BUILDSRC=${PACKAGE}-${VERSION}
+DEB=${PACKAGE}_${VERSION}-${PKGREL}_${ARCH}.deb
+DSC=${PACKAGE}_${VERSION}-${PKGREL}.dsc
all: ${DEB}
-${DEB}: ${PPSRC}/LibArchive.xs
- -rm -rf build
- rsync -a --exclude .svn ${PPSRC}/ build/
- cp -a debian build
- cd build; dpkg-buildpackage -b -us -uc -rfakeroot
+.PHONY: ${BUILDSRC}
+${BUILDSRC}:
+ rm -rf ${BUILDSRC}
+ rsync -a --exclude .svn ${PPSRC}/ ${BUILDSRC}
+ cp -a debian ${BUILDSRC}
+ echo "git clone git://git.proxmox.com/git/pve-storage.git\\ngit checkout ${GITVERSION}" >${BUILDSRC}/debian/SOURCE
+
+.PHONY: dsc
+dsc: ${DSC}
+${DSC}: ${BUILDSRC}
+ cd ${BUILDSRC}; dpkg-buildpackage -S -us -uc -d -nc
+ lintian ${DSC}
+
+.PHONY: deb
+deb: ${DEB}
+${DEB}: ${PPSRC}/LibArchive.xs ${BUILDSRC}
+ cd ${BUILDSRC}; dpkg-buildpackage -b -us -uc -rfakeroot
lintian ${DEB}
.phony: upload
upload: ${DEB}
tar cf - ${DEB} | ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist stretch
-CLEANFILES = *~ build *.deb libarchive_* ${OPKGNAME} libarchive-perl_*
+CLEANFILES = *~ build *.deb libarchive_* libarchive-perl_* ${BUILDSRC}
.phony: clean
clean: