#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

build: build-stamp
build-stamp:
	dh_testdir

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	ln -s libsolv-* libsolv
	cd /usr/src/packages/BUILD/libsolv && ls
	export CFLAGS="-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables"
	export CXXFLAGS="$(CFLAGS)"
	cd libsolv && cmake -DDISABLE_SHARED=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_RPATH=1 -DENABLE_RPMDB=1 -DENABLE_DEBIAN=1 -DENABLE_ARCHREPO=1 -DENABLE_LZMA_COMPRESSION=1 -DENABLE_ZSTD_COMPRESSION=1 -DENABLE_COMPLEX_DEPS=1 -DMULTI_SEMANTICS=1
	cd libsolv/src && make
	cd libsolv/ext && make
	perl Makefile.PL --bundled-libsolv && make

binary-indep: build install
	dh_testdir
	mkdir -p debian/perl-bssolv
	make DESTDIR=./debian/perl-bssolv install_vendor
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_install
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch: build install

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
