-# lib/perl5 - perl scripts
-TERMUX_PKG_RM_AFTER_INSTALL="bin/git-cvsserver bin/git-shell lib/perl5 Library"
+TERMUX_PKG_RM_AFTER_INSTALL="
+bin/git-cvsserver
+bin/git-shell
+libexec/git-core/git-shell
+libexec/git-core/git-cvsserver
+share/man/man1/git-cvsserver.1
+share/man/man1/git-shell.1
+"
+
+termux_step_pre_configure () {
+ # Setup perl so that the build process can execute it:
+ rm -f $TERMUX_PREFIX/bin/perl
+ ln -s `which perl` $TERMUX_PREFIX/bin/perl
+
+ # Force fresh perl files (otherwise files from earlier builds
+ # remains without bumped modification times, so are not picked
+ # up by the package):
+ rm -Rf $TERMUX_PREFIX/share/git-perl
+
+ # Fixes build if utfcpp is installed:
+ CPPFLAGS="-I$TERMUX_PKG_SRCDIR $CPPFLAGS"
+
+ # XXX: Should no longer be necessary after git v2.13.2:
+ # https://public-inbox.org/git/20170605203409.GB25777@dinwoodie.org/T/
+ CPPFLAGS+=" -DSHA1DC_FORCE_LITTLEENDIAN"
+}