It is now necessary to rebuild Dpkg, as the first build requires the build host's system libraries.
Prepare Dpkg for compilation:
./configure --prefix=/tools \ --disable-dselect \ --without-selinux \ PERL_LIBDIR=/tools/lib/perl/5.20.2
Compile the package:
make
Compilation is now complete. At this point, the Dpkg test suite cannot run because the Perl installation is incomplete.
Install the package into a temporary directory:
make install DESTDIR=$(pwd)/debian/tmp
Create the package archive:
buildpkg --package=dpkg-pass2
Install the package:
dpkg -i --force-overwrite ../dpkg-pass2_1.18.0_*.deb
It is not necessary to manually remove dpkg-pass1, as Dpkg already detected that all files from dpkg-pass1 were replaced and automatically marked dpkg-pass1 as removed.