--- pacman-contrib-1.4.0/configure.ac.orig	2021-06-06 10:59:55.815788900 +0200
+++ pacman-contrib-1.4.0/configure.ac	2021-06-06 10:57:04.735607300 +0200
@@ -62,7 +62,7 @@
 	AC_MSG_ERROR([*** libarchive >= 2.8.0 is needed to build pacman-contrib!]))
 
 # Check for libalpm
-PKG_CHECK_MODULES(LIBALPM, [libalpm], ,
+PKG_CHECK_MODULES_STATIC(LIBALPM, [libalpm], ,
 	AC_MSG_ERROR([*** libalpm is needed to build pacman-contrib!]))
 
 PKG_CHECK_VAR(LIBMAKEPKGDIR, [libmakepkg], [libmakepkgdir], ,
--- pacman-contrib-1.0.0/src/Makefile.am.orig	2018-07-06 23:06:38.101782600 +0300
+++ pacman-contrib-1.0.0/src/Makefile.am	2018-07-06 23:07:26.634558600 +0300
@@ -86,6 +86,8 @@
 	$(LIBARCHIVE_CFLAGS) \
 	$(LIBALPM_CFLAGS)
 
+AM_LDFLAGS = --static
+
 edit = sed \
 	-e 's|@bindir[@]|${bindir}|g' \
 	-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
diff -Naur pacman-contrib-1.0.0-orig/src/checkupdates.sh.in pacman-contrib-1.0.0/src/checkupdates.sh.in
--- pacman-contrib-1.0.0-orig/src/checkupdates.sh.in	2015-10-18 08:38:28.000000000 +0300
+++ pacman-contrib-1.0.0/src/checkupdates.sh.in	2016-07-15 09:42:18.779037400 +0300
@@ -35,11 +35,6 @@
 	shift
 done
 
-if ! type -P fakeroot >/dev/null; then
-	error 'Cannot find the fakeroot binary.'
-	exit 1
-fi
-
 if [[ -z $CHECKUPDATES_DB ]]; then
 	CHECKUPDATES_DB="${TMPDIR:-/tmp}/checkup-db-${USER}/"
 fi
@@ -48,7 +48,7 @@
 
 mkdir -p "$CHECKUPDATES_DB"
 ln -s "${DBPath}/local" "$CHECKUPDATES_DB" &> /dev/null
-if ! fakeroot -- pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null; then
+if ! pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null; then
 	error 'Cannot fetch updates'
 	exit 1
 fi
diff -Naur pacman-contrib-1.0.0-orig/src/paccache.sh.in pacman-contrib-1.0.0/src/paccache.sh.in
--- pacman-contrib-1.0.0-orig/src/paccache.sh.in	2015-03-26 07:43:10.000000000 +0300
+++ pacman-contrib-1.0.0/src/paccache.sh.in	2016-07-15 09:42:18.787037400 +0300
@@ -24,7 +24,7 @@
 declare -r myver='@PACKAGE_VERSION@'
 
 declare -a cachedirs=() candidates=() cmdopts=() whitelist=() blacklist=()
-declare -i delete=0 dryrun=0 filecount=0 move=0 needsroot=0 totalsaved=0 verbose=0
+declare -i delete=0 dryrun=0 filecount=0 move=0 totalsaved=0 verbose=0
 declare -i min_atime=0 min_mtime=0
 declare    delim=$'\n' keep=3 movedir= scanarch=
 
@@ -123,16 +123,7 @@
 m4_include(../scripts/library/size_to_human.sh)
 
 runcmd() {
-	if (( needsroot && EUID != 0 )); then
-		msg "Privilege escalation required"
-		if sudo -v &>/dev/null && sudo -l &>/dev/null; then
-			sudo "$@"
-		else
-			die 'Unable to escalate privileges using sudo'
-		fi
-	else
-		"$@"
-	fi
+	"$@"
 }
 
 summarize() {
@@ -306,17 +297,12 @@
 if (( move || delete )); then
 	# make it an absolute path since we're about to chdir
 	[[ $movedir && ${movedir:0:1} != '/' ]] && movedir=$PWD/$movedir
-	[[ $movedir && ! -w $movedir ]] && needsroot=1
 fi
 
 for cachedir in "${cachedirs[@]}"; do
 	[[ -d $cachedir ]] ||
 		die "cachedir '%s' does not exist or is not a directory" "$cachedir"
 
-	if (( move || delete )); then
-		[[ ! -w $cachedir ]] && needsroot=1
-	fi
-
 	# unlikely that this will fail, but better make sure
 	pushd "$cachedir" &>/dev/null || die "failed to chdir to '%s'" "$cachedir"
 
diff -Naur pacman-contrib-1.0.0-orig/src/pacscripts.sh.in pacman-contrib-1.0.0/src/pacscripts.sh.in
--- pacman-contrib-1.0.0-orig/src/pacscripts.sh.in	2016-01-04 06:27:45.000000000 +0300
+++ pacman-contrib-1.0.0/src/pacscripts.sh.in	2016-07-15 09:42:18.804037400 +0300
@@ -42,7 +42,7 @@
 
 error() {
 	local mesg=$1; shift
-	printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2
+	printf "==> $(/usr/bin/gettext "ERROR:") ${mesg}\n" "$@" >&2
 }
 
 usage() {
@@ -67,17 +67,7 @@
 }
 
 spacman() {
-	if [ $EUID -eq 0 ]; then
-		pacman "$@"
-	else
-		if ! type -p sudo; then
-			error "Cannot find the sudo binary!"
-			error "${myname} requires root privileges. Either install \"sudo\" or run as root."
-			exit 1
-		else
-			sudo pacman "$@"
-		fi
-	fi
+	pacman "$@"
 }
 
 print_db() {
@@ -94,7 +84,7 @@
 }
 
 print_pkg() {
-	if ! bsdtar -xqOf "$1" .INSTALL 2>/dev/null; then
+	if ! /usr/bin/bsdtar -xqOf "$1" .INSTALL 2>/dev/null; then
 		error "Package $1 does not include any .INSTALL script"
 		return 1
 	fi
@@ -103,7 +93,7 @@
 
 print_scriptlet() {
 	if [ -f "$1" ]; then
-		if bsdtar tf "$1" .PKGINFO &>/dev/null; then
+		if /usr/bin/bsdtar tf "$1" .PKGINFO &>/dev/null; then
 			print_pkg "$1"
 			return
 		fi
diff -Naur pacman-contrib-1.0.0-orig/src/updpkgsums.sh.in pacman-contrib-1.0.0/src/updpkgsums.sh.in
--- pacman-contrib-1.0.0-orig/src/updpkgsums.sh.in	2016-01-04 06:27:45.000000000 +0300
+++ pacman-contrib-1.0.0/src/updpkgsums.sh.in	2016-07-15 09:42:18.816037400 +0300
@@ -98,7 +98,7 @@
 
 trap "rm -rf '$BUILDDIR' '$newbuildfile'" EXIT
 sumtypes=$(IFS='|'; echo "${known_hash_algos[*]}")
-newsums=$(makepkg -g -p "$buildfile" "${MAKEPKG_OPTS[@]}") || die 'Failed to generate new checksums'
+newsums=$(MINGW_PACKAGE_PREFIX=mingw-w64-i686 makepkg -g -p "$buildfile" "${MAKEPKG_OPTS[@]}") || die 'Failed to generate new checksums'
 awk -v sumtypes="$sumtypes" -v newsums="$newsums" '
 	$0 ~"^[[:blank:]]*(" sumtypes ")sums(_[^=]+)?=", $0 ~ "\\)[[:blank:]]*(#.*)?$" {
 		if (!w) {
