xref: /freebsd/sys/contrib/openzfs/config/deb.am (revision 5def4c47d4bd90b209b9b4a4ba9faec15846d8fd)
1PHONY += deb-kmod deb-dkms deb-utils deb deb-local
2
3deb-local:
4	@(if test "${HAVE_DPKGBUILD}" = "no"; then \
5		echo -e "\n" \
6	"*** Required util ${DPKGBUILD} missing.  Please install the\n" \
7	"*** package for your distribution which provides ${DPKGBUILD},\n" \
8	"*** re-run configure, and try again.\n"; \
9		exit 1; \
10	fi; \
11	if test "${HAVE_ALIEN}" = "no"; then \
12		echo -e "\n" \
13	"*** Required util ${ALIEN} missing.  Please install the\n" \
14	"*** package for your distribution which provides ${ALIEN},\n" \
15	"*** re-run configure, and try again.\n"; \
16		exit 1; \
17	fi; \
18        if test "${ALIEN_MAJOR}" = "8" && \
19           test "${ALIEN_MINOR}" = "95"; then \
20        if test "${ALIEN_POINT}" = "1" || \
21           test "${ALIEN_POINT}" = "2" || \
22           test "${ALIEN_POINT}" = "3"; then \
23                /bin/echo -e "\n" \
24        "*** Installed version of ${ALIEN} is known to be broken;\n" \
25        "*** attempting to generate debs will fail! See\n" \
26        "*** https://github.com/openzfs/zfs/issues/11650 for details.\n"; \
27                exit 1; \
28        fi; \
29        fi)
30
31deb-kmod: deb-local rpm-kmod
32	name=${PACKAGE}; \
33	version=${VERSION}-${RELEASE}; \
34	arch=`$(RPM) -qp $${name}-kmod-$${version}.src.rpm --qf %{arch} | tail -1`; \
35	debarch=`$(DPKG) --print-architecture`; \
36	pkg1=kmod-$${name}*$${version}.$${arch}.rpm; \
37	fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch $$pkg1 || exit 1; \
38	$(RM) $$pkg1
39
40
41deb-dkms: deb-local rpm-dkms
42	name=${PACKAGE}; \
43	version=${VERSION}-${RELEASE}; \
44	arch=`$(RPM) -qp $${name}-dkms-$${version}.src.rpm --qf %{arch} | tail -1`; \
45	debarch=`$(DPKG) --print-architecture`; \
46	pkg1=$${name}-dkms-$${version}.$${arch}.rpm; \
47	fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch $$pkg1 || exit 1; \
48	$(RM) $$pkg1
49
50deb-utils: deb-local rpm-utils-initramfs
51	name=${PACKAGE}; \
52	version=${VERSION}-${RELEASE}; \
53	arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \
54	debarch=`$(DPKG) --print-architecture`; \
55	pkg1=$${name}-$${version}.$${arch}.rpm; \
56	pkg2=libnvpair3-$${version}.$${arch}.rpm; \
57	pkg3=libuutil3-$${version}.$${arch}.rpm; \
58	pkg4=libzfs5-$${version}.$${arch}.rpm; \
59	pkg5=libzpool5-$${version}.$${arch}.rpm; \
60	pkg6=libzfs5-devel-$${version}.$${arch}.rpm; \
61	pkg7=$${name}-test-$${version}.$${arch}.rpm; \
62	pkg8=$${name}-dracut-$${version}.noarch.rpm; \
63	pkg9=$${name}-initramfs-$${version}.$${arch}.rpm; \
64	pkg10=`ls python*-pyzfs-$${version}* | tail -1`; \
65## Arguments need to be passed to dh_shlibdeps. Alien provides no mechanism
66## to do this, so we install a shim onto the path which calls the real
67## dh_shlibdeps with the required arguments.
68	path_prepend=`mktemp -d /tmp/intercept.XXXXXX`; \
69	echo "#$(SHELL)" > $${path_prepend}/dh_shlibdeps; \
70	echo "`which dh_shlibdeps` -- \
71	 -xlibuutil3linux -xlibnvpair3linux -xlibzfs5linux -xlibzpool5linux" \
72	 >> $${path_prepend}/dh_shlibdeps; \
73## These -x arguments are passed to dpkg-shlibdeps, which exclude the
74## Debianized packages from the auto-generated dependencies of the new debs,
75## which should NOT be mixed with the alien-generated debs created here
76	chmod +x $${path_prepend}/dh_shlibdeps; \
77	env PATH=$${path_prepend}:$${PATH} \
78	fakeroot $(ALIEN) --bump=0 --scripts --to-deb --target=$$debarch \
79	    $$pkg1 $$pkg2 $$pkg3 $$pkg4 $$pkg5 $$pkg6 $$pkg7 \
80	    $$pkg8 $$pkg9 $$pkg10 || exit 1; \
81	$(RM) $${path_prepend}/dh_shlibdeps; \
82	rmdir $${path_prepend}; \
83	$(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4 $$pkg5 $$pkg6 $$pkg7 \
84	    $$pkg8 $$pkg9 $$pkg10;
85
86deb: deb-kmod deb-dkms deb-utils
87