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