Fix dependency install on Debian 11 (#16683)
[zfs.git] / config / deb.am
blob9e58e1905b7347d370f887840f1a92723460cf7b
1 PHONY += deb-kmod deb-dkms deb-utils deb deb-local native-deb-local \
2         native-deb-utils native-deb-kmod native-deb
4 native-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)
13 deb-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)
34 deb-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
44 deb-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
53 deb-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=libzfs6-$${version}.$${arch}.rpm; \
62         pkg5=libzpool6-$${version}.$${arch}.rpm; \
63         pkg6=libzfs6-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 -xlibzfs6linux -xlibzpool6linux" \
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;
90 deb: deb-kmod deb-dkms deb-utils
92 debian:
93         cp -r contrib/debian debian; chmod +x debian/rules;
95 native-deb-utils: native-deb-local debian
96         while [ -f debian/deb-build.lock ]; do sleep 1; done; \
97         echo "native-deb-utils" > debian/deb-build.lock; \
98         cp contrib/debian/control debian/control; \
99         $(DPKGBUILD) -b -rfakeroot -us -uc; \
100         $(RM) -f debian/deb-build.lock
102 native-deb-kmod: native-deb-local debian
103         while [ -f debian/deb-build.lock ]; do sleep 1; done; \
104         echo "native-deb-kmod" > debian/deb-build.lock; \
105         sh scripts/make_gitrev.sh; \
106         fakeroot debian/rules override_dh_binary-modules; \
107         $(RM) -f debian/deb-build.lock
109 native-deb: native-deb-utils native-deb-kmod