From 51da5f32a8ba2fd2557459cc6bf048525be5872c Mon Sep 17 00:00:00 2001
From: Marcin Krol <hawk@tld-linux.org>
Date: Wed, 29 Apr 2020 17:14:05 +0200
Subject: [PATCH] - modified to support rpm-tld-macros which replaced
 rpm-build-macros

---
 rpm-compress-doc                 |  85 -----------
 rpm-disable-features-ti.patch    |   2 +-
 rpm-find-spec-bcond              |  64 --------
 rpm-java-requires                | 126 ----------------
 rpm-macros-ti.patch              |   2 +-
 rpm-macros.patch                 |   4 +-
 rpm-php-provides                 |  20 ---
 rpm-php-requires                 |  82 -----------
 rpm-php-requires.php             | 174 ----------------------
 rpm-provides-dont-obsolete.patch |   2 +-
 rpm-rpmpopt.patch                |  12 +-
 rpm-rubyprov.patch               |  20 ---
 rpm-tld-macros.patch             | 243 +++++++++++++++++++++++++++++++
 rpm.platform                     |   2 +-
 rpm.spec                         | 101 +------------
 15 files changed, 260 insertions(+), 679 deletions(-)
 delete mode 100644 rpm-compress-doc
 delete mode 100644 rpm-find-spec-bcond
 delete mode 100755 rpm-java-requires
 delete mode 100644 rpm-php-provides
 delete mode 100644 rpm-php-requires
 delete mode 100644 rpm-php-requires.php
 create mode 100644 rpm-tld-macros.patch

diff --git a/rpm-compress-doc b/rpm-compress-doc
deleted file mode 100644
index 3c5ff93..0000000
--- a/rpm-compress-doc
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/sh
-#
-# Compress documentation files found in $DOCDIR. Omit some files we don't
-# want to get compressed.
-#
-# /etc/rpm/noautocompressdoc and --noautocompressdoc= option can contain
-# whitespace delimated list of patters to omit.
-#
-
-#set -x
-
-COMPRESS_CMD="gzip -9nf"
-EXCLUDE_SUFFIXES="htm html jpg jpeg png gif pdf css dia js abw HTM JPG PNG GIF PDF CSS JS"
-EXCLUDE_MASKS=
-RECOMPRESS_BZIP2=yes
-
-nocompressdoc=''
-while [ $# -gt 0 ]; do
-	case "$1" in
-	  --noautocompressdoc=*)
-		EXCLUDE_MASKS=`echo "${1#--noautocompressdoc=}" | sed -e 's/^ *//;s/ *$//;s/ \+/|/g'`
-	esac
-	shift
-done
-
-if [ -r /etc/rpm/noautocompressdoc ]; then
-	exclude=$(cat /etc/rpm/noautocompressdoc | grep -v '^#' | xargs echo | sed -e 's/^ *//;s/ *$//;s/ \+/|/g')
-	if [ -n "${exclude}" ]; then
-		if [ -n "${EXCLUDE_MASKS}" ]; then
-			EXCLUDE_MASKS="${EXCLUDE_MASKS}|${exclude}"
-		else
-			EXCLUDE_MASKS="${exclude}"
-		fi
-	fi
-fi
-
-if [ "$DOCDIR" = "" ] ; then
-	echo '$DOCDIR not set; exiting.'
-	exit 1
-fi
-
-cd $DOCDIR
-
-echo "Compressing documentation in $DOCDIR..."
-
-if test "$EXCLUDE_MASKS" ; then
-	echo "Excluding pattern '$EXCLUDE_MASKS'"
-fi
-
-FIND_CMD="find . -type f "
-for SUF in $EXCLUDE_SUFFIXES ; do
-	FIND_CMD="$FIND_CMD -a -not -name '*.$SUF'"
-done
-
-eval $FIND_CMD | while read FILENAME ; do
-	if test -n "$EXCLUDE_MASKS" ; then
-		if eval "case \$(basename \"$FILENAME\") in
-			 $EXCLUDE_MASKS ) true ;;
-			 * ) false ;;
-			 esac" ; then
-			continue
-		fi
-	fi
-	case "$FILENAME" in
-	*.gz | *.Z)
-		gzip -d "$FILENAME"
-		FILENAME=$(echo "$FILENAME" | sed -e 's/\.gz$//; s/\.Z$//')
-		;;
-	*.bz2)
-		if [ "$RECOMPRESS_BZIP2" = yes ] ; then
-			bzip2 -d "$FILENAME"
-			FILENAME=$(echo "$FILENAME" | sed -e 's/\.bz2$//')
-		else
-			continue
-		fi
-		;;
-	esac
-
-	$COMPRESS_CMD "$FILENAME"
-
-	echo -n "$FILENAME "
-done
-
-echo
-echo "Documentation compressed."
diff --git a/rpm-disable-features-ti.patch b/rpm-disable-features-ti.patch
index b9200e8..7527eec 100644
--- a/rpm-disable-features-ti.patch
+++ b/rpm-disable-features-ti.patch
@@ -12,7 +12,7 @@
 @@ -1476,7 +1476,7 @@
  #%__scriptlet_requires	/bin/bash --rpm-requires
  
- # PLD rpm macros
+ # TLD rpm macros
 -%_enable_debug_packages 1
 +%_enable_debug_packages 0
  
diff --git a/rpm-find-spec-bcond b/rpm-find-spec-bcond
deleted file mode 100644
index f3d479b..0000000
--- a/rpm-find-spec-bcond
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-# Display bcond (_with_*, _without_*) macros from given spec 
-# $Id$
-
-if [ "$#" = 0 ]; then
-    echo "Usage: $0 SPEC"
-    exit 1
-fi
-
-SPEC=$1
-if [ $SPEC = "--" ]; then
-    if [ "$#" -lt 2 ]; then
-	echo "Usage: rpmbuikd --bcond SPEC"
-	exit 1
-    fi
-    SPEC=$2
-fi
-
-if [ ! -f $SPEC ]; then
-    echo "rpmbuild: $SPEC: no such file"
-    exit 1
-fi
-
-bconds=`awk -F"\n" 'BEGIN { chlog=0 }
-		/^%changelog/ { chlog=1 }
-		/_with(out)?_[_a-zA-Z0-9]+/ && chlog == 0 {
-			match($0, /_with(out)?_[_a-zA-Z0-9]+/);
-	       		print substr($0, RSTART, RLENGTH)                       
-	    	}
-		/^%bcond_with/ && chlog == 0 {
-			match($0, /bcond_with(out)?[ \t]+[_a-zA-Z0-9]+/);
-				 bcond = substr($0, RSTART +5 , RLENGTH -5);
-				 gsub(/[ \t]+/,"_",bcond);
-				 print bcond
-			}' $SPEC | sort -u`
-
-for c in $bconds; do
-    echo -n "$c"
-
-    if ! echo `rpm --eval "%$c"` | grep $c >/dev/null; then
-	echo " (on)"
-    else 
-	echo ""
-    fi
-done
-
-
-for bcond in $bconds; do
-    isset=`awk -F"\n" "BEGIN { val=0 }
-                   /^%define[\t ]+$bcond/ {
-                     if (match(\\$0, /$bcond[\t ]+0[\t ]*$/)) {
-                        val = 0
-                     } else if (match(\\$0, /$bcond[\t ]+1[\t ]*$/)) {
-                        val = 1
-                     } else {
-                        print \"couldn't determine $bcond value from \", \\$0
-                     }
-                  } END { print val }" $SPEC`;
-
-    if [ x"$isset" = x"1" ]; then
-	echo "WARN: $bcond defined in spec";
-    fi
-done
-	 
diff --git a/rpm-java-requires b/rpm-java-requires
deleted file mode 100755
index dc069c8..0000000
--- a/rpm-java-requires
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/bin/sh
-# This script reads filenames from STDIN and outputs any relevant requires
-# information that needs to be included in the package.
-#
-# Based on rpm-4.4.2/scripts/find-req.pl
-# Authors: Elan Ruusamäe <glen@pld-linux.org>
-
-export PATH="/sbin:/usr/sbin:/bin:/usr/bin"
-
-# Set the prefix, unless it is overriden
-: ${RPM_LIBDIR=/usr/lib/rpm}
-
-# Enable debug: JAVADEPS_DEBUG=true
-: ${JAVADEPS_DEBUG=false}
-
-# xsltproc for eclipse feature.xml
-: ${xsltproc=/usr/bin/xsltproc}
-
-# save $- state, to enable in functions
-debug=$-
-
-javaclassversion() {
-	set -$debug
-	local mode=$1; shift
-	[ $# -gt 0 ] || return 1
-	$JAVADEPS_DEBUG && echo >&2 ">> javaclassversion($mode): $*"
-
-	# process only requires
-	[ "$mode" = requires ] || return $ret
-
-	local classver=$(echo "$@" | xargs -r file | grep -o 'compiled Java class data, version [0-9.]*' | awk '{print $NF}' | sort -u)
-	if [ -z "$classver" ]; then
-		return 1
-	fi
-
-	local v
-	for v in $classver; do
-		echo "java(ClassDataVersion) >= $v"
-	done
-	return 0
-}
-
-javajarversion() {
-	set -$debug
-	local mode=$1; shift
-	local jar=$1
-	local tmp ret=0
-	$JAVADEPS_DEBUG && echo >&2 ">> javajarversion($mode): $jar"
-
-	# check only files, symlinks could point outside buildroot
-	[ -f "$jar" -a ! -L "$jar" ] || return $ret
-
-	tmp=$(mktemp -d)
-	unzip -q -d $tmp $jar >&2
-	# workaround for .jar files with stupid permissions
-	chmod -R u+rwX $tmp
-
-	# find .jar and .class files
-	find_javadeps $mode $(find $tmp -type f -regextype posix-extended  -regex '^.+\.(class|jar)$') || ret=1
-	rm -rf $tmp
-	return $ret
-}
-
-eclipse_feature() {
-	set -$debug
-	local mode=$1; shift
-	local file=$1
-	local ret=0
-
-	$JAVADEPS_DEBUG && echo >&2 ">> eclipse_feature($mode): $file"
-
-	if [ ! -x $xsltproc ]; then
-		return 0
-	fi
-
-	$xsltproc --stringparam mode $mode ${RPM_LIBDIR}/eclipse-feature.xslt $file
-}
-
-find_javadeps() {
-	set -$debug
-	local mode=$1; shift
-	local ret=0
-
-	$JAVADEPS_DEBUG && echo >&2 ">> find_javadeps($mode): $*"
-	for file in $@; do
-		case $file in
-		*.jar)
-			javajarversion $mode "$file" || ret=1
-		;;
-		*.class)
-			javaclassversion $mode "$file" || {
-				echo >&2 "ERROR: Class version could not be extracted from $file"
-				ret=1
-			}
-		;;
-		*/feature.xml)
-			eclipse_feature $mode "$file" || ret=1
-		;;
-		*)
-			$JAVADEPS_DEBUG && echo >&2 ">> find_javadeps($mode): no handle: $file"
-		;;
-		esac
-	done
-	return $ret
-}
-
-ret=0
-# default mode to requires for backward compat
-mode=requires
-case $1 in
--P|--provides)
-	mode=provides
-	shift
-	;;
--R|--requires)
-	mode=requires
-	shift
-	;;
-esac
-
-t=$(mktemp)
-find_javadeps $mode $(cat -) > $t || ret=1
-sort -u $t
-rm -f $t
-
-exit $ret
diff --git a/rpm-macros-ti.patch b/rpm-macros-ti.patch
index 1e2a934..9ddff0b 100644
--- a/rpm-macros-ti.patch
+++ b/rpm-macros-ti.patch
@@ -5,7 +5,7 @@ diff -ur rpm-4.5.orig/macros.in rpm-4.5/macros.in
  #
  #%distribution
  
-+# PLD Linux Release
++# TLD Linux Release for backward compatibility with PLD spec files
 +%pld_release	ti
 +
  #	Configurable distribution URL, same as DistURL: tag in a specfile.
diff --git a/rpm-macros.patch b/rpm-macros.patch
index 567b852..f41a082 100644
--- a/rpm-macros.patch
+++ b/rpm-macros.patch
@@ -152,7 +152,7 @@
 -%__scriptlet_requires	/bin/bash --rpm-requires
 +#%__scriptlet_requires	/bin/bash --rpm-requires
 +
-+# PLD rpm macros
++# TLD rpm macros
 +%_enable_debug_packages 1
 +
 +#-----------------------------------------------------------------
@@ -218,7 +218,7 @@
  AC_SUBST(SYSCONFIGDIR)
  
 -MACROFILES="${USRLIBRPM}/${VERSION}/macros:${USRLIBRPM}/%{_target}/macros:${SYSCONFIGDIR}/%{_host_vendor}/macros:${SYSCONFIGDIR}/%{_host_vendor}/%{_target}/macros:${SYSCONFIGDIR}/macros.*:${SYSCONFIGDIR}/macros.d/*.macros:${SYSCONFIGDIR}/macros:${SYSCONFIGDIR}/%{_target}/macros:~/.rpmmacros"
-+MACROFILES="${USRLIBRPM}/macros:${USRLIBRPM}/macros.build:${USRLIBRPM}/%{_target}/macros:${SYSCONFIGDIR}/macros.*:${SYSCONFIGDIR}/macros:${SYSCONFIGDIR}/%{_target}/macros:~/etc/.rpmmacros:~/.rpmmacros"
++MACROFILES="${USRLIBRPM}/macros:${USRLIBRPM}/macros.build:${USRLIBRPM}/macros.d/macros.*:${USRLIBRPM}/%{_target}/macros:${SYSCONFIGDIR}/macros.*:${SYSCONFIGDIR}/macros:${SYSCONFIGDIR}/%{_target}/macros:~/etc/.rpmmacros:~/.rpmmacros"
  AC_DEFINE_UNQUOTED(MACROFILES, "$MACROFILES",
  	[Colon separated paths of macro files to read.])
  AC_SUBST(MACROFILES)
diff --git a/rpm-php-provides b/rpm-php-provides
deleted file mode 100644
index a094cba..0000000
--- a/rpm-php-provides
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/perl
-#####################################################################
-#                                                                   #
-# Check system dependences between php-pear modules                 #
-#                                                                   #
-# Pawe³ Go³aszewski <blues@ds.pg.gda.pl>                            #
-# Micha³ Moskal <malekith@pld-linux.org>                            #
-# ------------------------------------------------------------------#
-# TODO:                                                             #
-#####################################################################
-
-$pear = "/usr/share/pear";
-
-foreach (@ARGV ? @ARGV : <>) {
-	chomp;
-	$f = $_;
-	next unless ($f =~ /$pear.*\.php$/);
-	$f =~ s/.*$pear\///;
-	print "pear($f)\n";
-}
diff --git a/rpm-php-requires b/rpm-php-requires
deleted file mode 100644
index 2a3fb60..0000000
--- a/rpm-php-requires
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/perl
-#####################################################################
-#                                                                   #
-# Check system dependences between php-pear modules                 #
-#                                                                   #
-# Pawe³ Go³aszewski <blues@ds.pg.gda.pl>                            #
-# Micha³ Moskal <malekith@pld-linux.org>                            #
-# ------------------------------------------------------------------#
-# TODO:                                                             #
-# - extension_loaded - dependencies.                                #
-# - some clean-up...                                                #
-#####################################################################
-
-$pear = "/usr/share/pear";
-
-@files = ();
-%req = ();
-
-foreach (@ARGV ? $ARGV : <> ) {
-	chomp;
-	$f = $_;
-	push @files, $f;
-	# skip non-php files
-	next unless ($f =~ /\.php$/);
-	open(F, "< $f") or die;
-
-	if ($f =~ /$pear/) {
-		$file_dir = $f;
-		$file_dir =~ s|.*$pear/||;
-		$file_dir =~ s|/[^/]*$||;
-	} else {
-		$file_dir = undef;
-	}
-
-	while (<F>) {
-		# skip comments
-		next if (/^\s*(#|\/\/|\*|\/\*)/);
-
-		while (/(\W|^)(require|include)(_once)?
-			  \s* \(? \s* ("([^"]*)"|'([^']*)') 
-			  \s* \)? \s* ;/xg) {
-			if ($5 ne "") {
-				$x = $5;
-			} elsif ($6 ne "") {
-				$x = $6;
-			} else {
-				next;
-			}
-
-			next if ($x =~ m|^\./| or $x =~ /\$/);
-			next unless ($x =~ /\.php$/);
-			$req{$x} = 1;
-		}
-
-		next unless (defined $file_dir);
-
-		while (/(\W|^)(require|include)(_once)?
-			  \s* \(? \s* dirname \s* \( \s* __FILE__ \s* \) \s* \. \s*
-			  ("([^"]*)"|'([^']*)') 
-			  \s* \)? \s* ;/xg) {
-			if ($5 ne "") {
-				$x = $5;
-			} elsif ($6 ne "") {
-				$x = $6;
-			} else {
-				next;
-			}
-
-			next if ($x =~ /\$/);
-			next unless ($x =~ /\.php$/);
-
-			$x = "$file_dir/$x";
-			$x =~ s|/+|/|g;
-			$req{$x} = 1;
-		}
-	}
-}
-
-f: for $f (keys %req) {
-	for $g (@files) { next f if ($g =~ /\Q$f\E$/); }
-	print "pear($f)\n";
-}
diff --git a/rpm-php-requires.php b/rpm-php-requires.php
deleted file mode 100644
index b398029..0000000
--- a/rpm-php-requires.php
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/usr/bin/php
-<?php
-/*
- * minify.spec does not see these: pear(HTTP/ConditionalGet.php) pear(HTTP/Encoder.php)
- * perl version does
- */
-/**
- *
- * Check system dependences between php-pear modules.
- *
- * Paweł Gołaszewski <blues@pld-linux.org> (Perl version)
- * Michał Moskal <malekith@pld-linux.org> (Perl version)
- * Elan Ruusamäe <glen@pld-linux.org>
- *
- * URL: <http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpm/rpm-php-requires.php>
- *
- * Requires: php-pear-PHP_CompatInfo
- * Requires: php-pcre
- */
-
-/**
- * Produce pear(Path/To/File.php) deps
- * Ported to PHP from Perl version of rpm-php-requires.
- *
- * @TODO: use tokenizer to parse php files.
- */
-function peardeps($files) {
-	// files inside php_pear_dir have this prefix
-	$prefix = RPM_BUILD_ROOT. PHP_PEAR_DIR . DIRECTORY_SEPARATOR;
-	$length = strlen($prefix);
-
-	$req = array();
-	foreach ($files as $f) {
-		// skip non-php files
-		if (substr($f, -4) != '.php') {
-			continue;
-		}
-
-		// subdir inside php_pear_dir
-		if (substr($f, 0, $length) == $prefix) {
-			$file_dir = dirname(substr($f, $length));
-		} else {
-			$file_dir = null;
-		}
-
-		foreach (file($f) as $line) {
-			// skip comments -- not perfect, matches "*" at start of line (very rare altho)
-			if (preg_match('/^\s*(#|\/\/|\*|\/\*)/', $line)) {
-				continue;
-			}
-
-			if (preg_match("/(\W|^)(require|include)(_once)?
-					\s* \(? \s*
-					(\"([^\"]*)\"|'([^']*)')
-					\s* \)? \s* ;/x", $line, $m)) {
-
-				if ($m[5]) {
-					$x = $m[5];
-				} else if ($m[6]) {
-					$x = $m[6];
-				} else {
-					continue 2;
-				}
-
-				if (substr($x, 0, 2) == './' || substr($x, -1) == '$') {  # XXX must be: CONTAINS DOLLAR
-					continue 2;
-				}
-
-				if (substr($x, -4) != '.php') {
-					continue 2;
-				}
-				$req[$x] = 1;
-				continue 2;
-			}
-
-			if (is_null($file_dir)) {
-				continue;
-			}
-
-			if (preg_match("/(\W|^)(require|include)(_once)?
-					\s* \(? \s* dirname \s* \( \s* __FILE__ \s* \) \s* \. \s*
-					(\"([^\"]*)\"|'([^']*)')
-					\s* \)? \s* ;/x", $line, $m)) {
-
-				if ($m[5]) {
-					$x = $m[5];
-				} else if ($m[6]) {
-					$x = $m[6];
-				} else {
-					continue 2;
-				}
-
-				if (substr($x, -1) == '$') { # XXX must be: CONTAINS DOLLAR
-					continue 2;
-				}
-				if (substr($x, -4) != '.php') {
-					continue 2;
-				}
-
-				$x = "$file_dir/$x";
-				// remove double slashes
-				// TODO: resolve simpletest/test/../socket.php -> simpletest/socket.php
-				$x = str_replace("//", "/", $x);
-				$req[$x] = 1;
-				continue;
-			}
-		}
-	}
-
-	foreach (array_keys($req) as $f) {
-		// skip self deps
-		if (array_key_exists($f, $files)) {
-			continue;
-		}
-		echo "pear($f)\n";
-	}
-}
-
-/**
- * Produce dependencies for extensions using PEAR PHP_CompatInfo package.
- */
-function extdeps($files) {
-	require_once 'PHP/CompatInfo.php';
-
-	$info = new PHP_CompatInfo('null');
-	$res = $info->parseData($files);
-
-	// minimum php version we accept
-	// "%define php_min_version 5.1.2" in spec to minimum version to be 5.1.2
-	$version = max(PHP_MIN_VERSION, $res['version']);
-
-	if (version_compare($version, '5.0.0', 'ge')) {
-		# force php-<name> only deps when php5
-		# XXX what about php-pecl-<name> virtual provides?
-		$fmt = 'php-%s';
-		$epoch = 4;
-	} else {
-		$fmt = 'php(%s)';
-		$epoch = 3;
-	}
-	echo "php-common >= ", $epoch, ":", $version, "\n";
-
-	// process extensions
-	foreach ($res['extensions'] as $ext) {
-		// bz2 ext is in php-bzip2 package
-		if ($ext == 'bz2') {
-			$ext = 'bzip2';
-		}
-		// libxml ext is in php-xml package
-		if ($ext == 'libxml') {
-			$ext = 'xml';
-		}
-
-		// these need to be lowercased
-		if (in_array($ext, array('SPL', 'PDO', 'SQLite', 'Reflection', 'SimpleXML'))) {
-			$ext = strtolower($ext);
-		}
-
-		printf("$fmt\n", $ext);
-	}
-}
-
-define('RPM_BUILD_ROOT', getenv('RPM_BUILD_ROOT'));
-define('PHP_PEAR_DIR', '/usr/share/pear');
-define('PHP_MIN_VERSION', getenv('PHP_MIN_VERSION'));
-
-if ($argc > 1) {
-	$files = array_splice($argv, 1);
-} else {
-	$files = explode(PHP_EOL, trim(file_get_contents('php://stdin')));
-}
-
-peardeps($files);
-extdeps($files);
diff --git a/rpm-provides-dont-obsolete.patch b/rpm-provides-dont-obsolete.patch
index 5e764dc..1f09506 100644
--- a/rpm-provides-dont-obsolete.patch
+++ b/rpm-provides-dont-obsolete.patch
@@ -7,7 +7,7 @@
 +#   On upgrade, erase older packages of same color (if any).
 +#   "name" for RPMTAG_NAME, otherwise RPMTAG_PROVIDENAME
 +#
-+#   in PLD Linux we don't want to remove packages which only provided
++#   in TLD Linux we don't want to remove packages which only provided
 +#   %{name} (e.g. perl-modules in case of some newer perl modules),
 +#   so we use NAME instead of PROVIDENAME (as in vanilla rpm) here
 +%_upgrade_tag name
diff --git a/rpm-rpmpopt.patch b/rpm-rpmpopt.patch
index 6c44d0e..7d73d5d 100644
--- a/rpm-rpmpopt.patch
+++ b/rpm-rpmpopt.patch
@@ -4,13 +4,13 @@
  rpmb	alias --without		--define "_without_!#:+    --without-!#:+" \
  	--POPTdesc=$"disable configure <option> for build" \
  	--POPTargs=$"<option>"
-+# (PLD-specific) Make RPM build tree
++# (TLD-specific) Make RPM build tree
 +rpmb	exec --install-build-tree install-build-tree \
 +	--POPTdesc=$"make all needed dirs for building binary rpms"
-+# (PLD-specific) Compiling with debuginfo may be enabled by --debug
++# (TLD-specific) Compiling with debuginfo may be enabled by --debug
 +rpmb	alias --debug --define 'debug 1' \
 +	--POPTdesc=$"build packages with debug information"
-+# (PLD-specific) Conditional building
++# (TLD-specific) Conditional building
 +rpmb	exec  --bcond find-spec-bcond \
 +	--POPTdesc=$"find all --with/--without values"
  #==============================================================================
@@ -20,13 +20,13 @@
  rpmbuild alias --buildroot	--define '.buildroot !#:+' \
  	--POPTdesc=$"override build root" \
  	--POPTargs=$"DIRECTORY"
-+# (PLD-specific) Make RPM build tree
++# (TLD-specific) Make RPM build tree
 +rpmbuild exec --install-build-tree install-build-tree \
 +	--POPTdesc=$"make all needed dirs for building binary rpms"
-+# (PLD-specific) Compiling with debuginfo may be enabled by --debug
++# (TLD-specific) Compiling with debuginfo may be enabled by --debug
 +rpmbuild alias --debug --define 'debug 1' \
 +	--POPTdesc=$"build packages with debug information"
-+# (PLD-specific) Conditional building
++# (TLD-specific) Conditional building
 +rpmbuild exec  --bcond find-spec-bcond \
 +	--POPTdesc=$"find all --with/--without values"
  
diff --git a/rpm-rubyprov.patch b/rpm-rubyprov.patch
index 9c036ad..264e19a 100644
--- a/rpm-rubyprov.patch
+++ b/rpm-rubyprov.patch
@@ -170,23 +170,3 @@ diff -urpa rpm-4.5.orig/macros.in rpm-4.5/macros.in
  # libtool(...) configuration.
  #
  # Path to scripts to autogenerate libtool package dependencies,
-diff -urpa rpm-4.5.orig/scripts/Makefile.am rpm-4.5/scripts/Makefile.am
---- rpm-4.5.orig/scripts/Makefile.am	2008-05-21 20:48:02.000000000 +0000
-+++ rpm-4.5/scripts/Makefile.am	2018-02-23 13:52:54.439364538 +0000
-@@ -19,7 +19,8 @@ EXTRA_DIST = \
- 	sql.prov sql.req symclash.py symclash.sh tcl.req tgpg trpm u_pkg.sh \
- 	vpkg-provides.sh vpkg-provides2.sh \
- 	macros.perl* macros.python* \
--	macros.php* find-*.php find-php-*
-+	macros.php* find-*.php find-php-* \
-+	gem_helper.rb rubygems.rb
- 
- installprefix = $(DESTDIR)
- 
-@@ -43,4 +44,5 @@ versionlib_SCRIPTS = \
- 	rpmdb_loadcvt \
- 	rpm.daily rpm.log rpm.xinetd \
- 	symclash.py symclash.sh tgpg u_pkg.sh \
--	vpkg-provides.sh vpkg-provides2.sh
-+	vpkg-provides.sh vpkg-provides2.sh \
-+	gem_helper.rb rubygems.rb
diff --git a/rpm-tld-macros.patch b/rpm-tld-macros.patch
new file mode 100644
index 0000000..e0f4949
--- /dev/null
+++ b/rpm-tld-macros.patch
@@ -0,0 +1,243 @@
+diff -ur rpm-4.5.orig/macros.in rpm-4.5/macros.in
+--- rpm-4.5.orig/macros.in	2020-04-19 16:30:03.450641000 +0200
++++ rpm-4.5/macros.in	2020-04-29 16:30:36.671641000 +0200
+@@ -328,12 +328,6 @@
+ #	
+ #%_javaclasspath	all
+ 
+-#	Import packaging conventions from jpackage.org (prefixed with _
+-#	to avoid name collisions).
+-#	
+-%_javadir      %{_datadir}/java
+-%_javadocdir   %{_datadir}/javadoc
+-
+ #
+ #	Deprecated.
+ #
+@@ -1361,44 +1355,9 @@
+ #
+ # Note: Used iff _use_internal_dependency_generator is non-zero. The
+ # helpers are also used by %{_rpmhome}/rpmdeps {--provides|--requires}.
+-#%__perl_provides	%{_rpmhome}/perldeps.pl --provides
+-#%__perl_requires	%{_rpmhome}/perldeps.pl --requires
+ %__perl_provides	%{_rpmhome}/perl.prov
+ %__perl_requires	%{_rpmhome}/perl.req
+ 
+-# Useful macros for building *.rpm perl packages.
+-#	(from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
+-#
+-# For example, these can be used as (from ImageMagick.spec from PLD site)
+-#	[...]
+-#	BuildPrereq: perl
+-#	[...]
+-#	%package perl
+-#	Summary: libraries and modules for access to ImageMagick from perl
+-#	Group: Development/Languages/Perl
+-#	Requires: %{name} = %{version}
+-#	%requires_eq    perl
+-#	[...]
+-#	%install
+-#	rm -fr $RPM_BUILD_ROOT
+-#	install -d $RPM_BUILD_ROOT/%{perl_sitearch}
+-#	[...]
+-#	%files perl
+-#	%defattr(644,root,root,755)
+-#	%{perl_sitearch}/Image
+-#	%dir %{perl_sitearch}/auto/Image
+-#
+-
+-%requires_eq()	%(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
+-
+-%perl_sitearch	%(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
+-%perl_sitelib	%(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
+-%perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
+-%perl_vendorlib  %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
+-%perl_archlib	%(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
+-%perl_privlib	%(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
+-%perl_version	%(eval "`%{__perl} -V:version`"; echo $version)
+-
+ #------------------------------------------------------------------------
+ # python(...) configuration.
+ #
+@@ -1408,107 +1367,11 @@
+ # helpers are also used by %{_rpmhome}/rpmdeps {--provides|--requires}.
+ %__python_provides      %{_rpmhome}/pythoneggs.py --provides
+ %__python_requires      %{_rpmhome}/pythoneggs.py --requires
+-#
+-%python_sitearch %(%{__python} -c "import os; from distutils.sysconfig import get_python_lib; lib=get_python_lib(1); print os.path.islink(lib) and os.path.abspath(os.path.join(os.path.dirname(lib),os.readlink(lib))) or lib")
+-%python_sitelib %(%{__python} -c "import os; from distutils.sysconfig import get_python_lib; lib=get_python_lib(); print os.path.islink(lib) and os.path.abspath(os.path.join(os.path.dirname(lib),os.readlink(lib))) or lib")
+-%python_version %(%{__python} -c "import sys; print(sys.version[0:3])")
+-
+-# python main version
+-%py_ver                 %(%{__python} -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)
+-%py_prefix              %(%{__python} -c "import sys; print sys.prefix" 2>/dev/null || echo PYTHON-NOT-FOUND)
+-%py_platlibdir          %(%{__python} -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(standard_lib=1,plat_specific=1)' 2>/dev/null || echo PYTHON-LIBDIR-NOT-FOUND)
+-%py_purelibdir          %(%{__python} -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(standard_lib=1,plat_specific=0)' 2>/dev/null || echo PYTHON-LIBDIR-NOT-FOUND)
+-# backward compatibility
+-%py_libdir              %py_purelibdir
+-
+-%py_platsitedir         %(%{__python} -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(plat_specific=1)' 2>/dev/null || echo PYTHON-LIBDIR-NOT-FOUND)
+-%py_puresitedir         %(%{__python} -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()' 2>/dev/null || echo PYTHON-LIBDIR-NOT-FOUND)
+-%py_sitedir             %py_puresitedir
+-
+-%py_dyndir              %{py_platlibdir}/lib-dynload
+-
+-%py_incdir              %(%{__python} -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_inc()' 2>/dev/null || echo PYTHON-INCLUDEDIR-NOT-FOUND)
+-
+-%py_compile(O)  \
+-find %1 -name '*.pyc' -exec rm -f {} \\; \
+-%{__python} -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
+-%{-O: \
+-find %1 -name '*.pyo' -exec rm -f {} \\; \
+-%{__python} -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
+-}
+-
+-# pure python modules compilation
+-%py_comp        %{__python} -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('%{buildroot}'):])"
+-
+-%py_ocomp       %{__python} -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('%{buildroot}'):])"
+-
+-%py_requires(d) \
+-BuildRequires: %{__python} %{-d:python-devel}
+-
+-#------------------------------------------------------------------------
+-# php(...) configuration.
+-#
+-# Path to scripts to autogenerate php package dependencies,
+-#
+-# Note: Used iff _use_internal_dependency_generator is non-zero. The
+-# helpers are also used by %{_rpmhome}/rpmdeps {--provides|--requires}.
+-#%__php_provides	%{_rpmhome}/phpdeps.sh --provides
+-#%__php_requires	%{_rpmhome}/phpdeps.sh --requires
+-#%__php_provides		%{_rpmhome}/php.prov
+-#%__php_requires		%{_rpmhome}/php.req
+ 
+ %__mono_provides	%{nil}
+ %__mono_requires	%{nil}
+ 
+ #------------------------------------------------------------------------
+-# java(...) configuration.
+-#
+-# Path to scripts to autogenerate java package dependencies,
+-#
+-# Note: Used iff _use_internal_dependency_generator is non-zero. The
+-# helpers are also used by %{_rpmhome}/rpmdeps {--provides|--requires}.
+-#%__java_provides	%{_rpmhome}/javadeps.sh --provides
+-#%__java_requires	%{_rpmhome}/javadeps.sh --requires
+-
+-#------------------------------------------------------------------------
+-# ruby(...) configuration.
+-#
+-# Path to scripts to autogenerate ruby package dependencies,
+-
+-# Note: Used if _use_internal_dependency_generator is non-zero. The
+-# helpers are also used by %{_rpmhome}/rpmdeps {--provides|--requires}.
+-%__ruby_provides	%{_rpmhome}/rubygems.rb --provides
+-%__ruby_requires	%{_rpmhome}/rubygems.rb --requires
+-
+-%ruby_version		%(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["ruby_version"]')
+-
+-%ruby_archdir		%(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["archdir"]')
+-%ruby_libdir		%(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["rubylibdir"]')
+-%ruby_sitedir		%(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["sitedir"]')
+-%ruby_sitearchdir	%(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["sitearchdir"]')
+-%ruby_sitelibdir	%(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["sitelibdir"]')
+-%ruby_vendordir		%(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["vendordir"]')
+-%ruby_vendorarchdir	%(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["vendorarchdir"]')
+-%ruby_vendorlibdir	%(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["vendorlibdir"]')
+-%ruby_gemdir		%(%{__ruby} -rrbconfig -e 'print RbConfig::CONFIG["rubylibdir"].sub(RbConfig::CONFIG["ruby_version"], "gems/#{RbConfig::CONFIG["ruby_version"]}")')
+-%ruby_ridir		%(%{__ruby} -rrbconfig -e 'print File.join(RbConfig::CONFIG["datadir"], "ri", RbConfig::CONFIG["ruby_version"])')
+-
+-%__gem_helper %{_usrlibrpm}/gem_helper.rb
+-
+-%gem_build(f:j:) \
+-	%__gem_helper build \\\
+-	%{-f:-f%{-f*}} \\\
+-	%{!-j:%{_smp_mflags}}%{-j:-j%{-j*}}
+-
+-%gem_install(i:n:C) \
+-	DESTDIR=${DESTDIR:-%{buildroot}} \\\
+-	%__gem_helper install \\\
+-	--env-shebang --rdoc --ri --force --ignore-dependencies \\\
+-	%{!-i:--install-dir %{buildroot}%{ruby_gemdir}}%{-i:--install-dir %{-i*}} \\\
+-	%{!-n:--bindir %{buildroot}%{_bindir}}%{-n:--bindir%{-n*}} \\\
+-	%{!-C:--fix-permissions}
+-
+-#------------------------------------------------------------------------
+ # libtool(...) configuration.
+ #
+ # Path to scripts to autogenerate libtool package dependencies,
+@@ -1588,15 +1451,7 @@
+ %__common_cflags	-O2 -fwrapv -pipe %{Werror_cflags} %{debuginfocflags} %{?_fortify_cflags} %{!?nospecflags:%{?specflags}}
+ %__common_cflags_with_ssp	%{__common_cflags} %{?_ssp_cflags}
+ 
+-#------------------------------------------------------------------------
+-# mimetype(...) configuration.
+-#
+-# Path to script to autogenerate mimetype(foo) provides, based on MimeType
+-# key from desktop files.
+-#
+-# Note: Used if _use_internal_dependency_generator is non-zero. The
+-# helper is also used by %{_rpmhome}/rpmdeps --provides
+-%__mimetype_provides %{_rpmhome}/mimetypedeps.sh --provides
++%requires_eq()	%(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
+ 
+ %__gstreamer_provides %{nil}
+ 
+diff -ur rpm-4.5.orig/scripts/Makefile.am rpm-4.5/scripts/Makefile.am
+--- rpm-4.5.orig/scripts/Makefile.am	2020-04-19 16:30:03.450641000 +0200
++++ rpm-4.5/scripts/Makefile.am	2020-04-29 15:41:49.787641000 +0200
+@@ -11,11 +11,9 @@
+ 	cpanflute cpanflute2 Specfile.pm find-provides.perl \
+ 	find-requires.perl freshen.sh gendiff getpo.sh http.req \
+ 	check-java-closure.sh java.prov.sh java.req.sh \
+-	javadeps.sh libtooldeps.sh pkgconfigdeps.sh \
++	libtooldeps.sh pkgconfigdeps.sh \
+ 	perldeps.pl perl.prov perl.req pythondeps.sh pythoneggs.py \
+-	mimetypedeps.sh \
+-	php.prov php.req rpm2cpio \
+-	rpmdb_loadcvt rpmdiff rpmdiff.cgi \
++	rpm2cpio rpmdb_loadcvt rpmdiff rpmdiff.cgi \
+ 	rpm.daily rpm.log rpm.xinetd \
+ 	sql.prov sql.req symclash.py symclash.sh tcl.req tgpg trpm u_pkg.sh \
+ 	vpkg-provides.sh vpkg-provides2.sh \
+@@ -39,10 +37,8 @@
+ 	find-debuginfo.sh find-lang.sh find-prov.pl find-req.pl \
+ 	find-provides.perl \
+ 	find-requires.perl getpo.sh http.req \
+-	javadeps.sh libtooldeps.sh pkgconfigdeps.sh \
++	libtooldeps.sh pkgconfigdeps.sh \
+ 	perldeps.pl perl.prov perl.req pythondeps.sh pythoneggs.py \
+-	mimetypedeps.sh \
+-	php.prov php.req \
+ 	rpmdb_loadcvt \
+ 	rpm.daily rpm.log rpm.xinetd \
+ 	symclash.py symclash.sh tgpg u_pkg.sh \
+diff -ur rpm-4.5.orig/scripts/Makefile.in rpm-4.5/scripts/Makefile.in
+--- rpm-4.5.orig/scripts/Makefile.in	2008-07-09 11:41:32.000000000 +0200
++++ rpm-4.5/scripts/Makefile.in	2020-04-29 15:41:01.972641000 +0200
+@@ -339,9 +339,9 @@
+ 	cpanflute cpanflute2 Specfile.pm find-provides.perl \
+ 	find-requires.perl freshen.sh gendiff getpo.sh http.req \
+ 	check-java-closure.sh java.prov.sh java.req.sh \
+-	javadeps.sh libtooldeps.sh pkgconfigdeps.sh \
+-	perldeps.pl perl.prov perl.req pythondeps.sh mimetypedeps.sh \
+-	php.prov php.req rpm2cpio \
++	libtooldeps.sh pkgconfigdeps.sh \
++	perldeps.pl perl.prov perl.req pythondeps.sh \
++	rpm2cpio \
+ 	rpmdb_loadcvt rpmdiff rpmdiff.cgi \
+ 	rpm.daily rpm.log rpm.xinetd \
+ 	sql.prov sql.req symclash.py symclash.sh tcl.req tgpg trpm u_pkg.sh \
+@@ -360,9 +360,8 @@
+ 	find-debuginfo.sh find-lang.sh find-prov.pl find-req.pl \
+ 	find-provides.perl \
+ 	find-requires.perl getpo.sh http.req \
+-	javadeps.sh libtooldeps.sh pkgconfigdeps.sh \
+-	perldeps.pl perl.prov perl.req pythondeps.sh mimetypedeps.sh \
+-	php.prov php.req \
++	libtooldeps.sh pkgconfigdeps.sh \
++	perldeps.pl perl.prov perl.req pythondeps.sh \
+ 	rpmdb_loadcvt \
+ 	rpm.daily rpm.log rpm.xinetd \
+ 	symclash.py symclash.sh tgpg u_pkg.sh \
diff --git a/rpm.platform b/rpm.platform
index 6176f1e..15b2c81 100644
--- a/rpm.platform
+++ b/rpm.platform
@@ -1,4 +1,4 @@
-# PLD rpm macros
+# TLD rpm macros
 
 %__id		/bin/id
 %__id_u		%{__id} -u
diff --git a/rpm.spec b/rpm.spec
index 6a36f27..b3ae86e 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -42,7 +42,7 @@ Summary(ru.UTF-8):	Менеджер пакетов от RPM
 Summary(uk.UTF-8):	Менеджер пакетів від RPM
 Name:		rpm
 Version:	4.5
-Release:	89
+Release:	90
 License:	LGPL
 Group:		Base
 Source0:	%{name}-%{version}.tar.gz
@@ -50,25 +50,15 @@ Source0:	%{name}-%{version}.tar.gz
 Source1:	%{name}.groups
 Source2:	%{name}.platform
 Source3:	%{name}-install-tree
-Source4:	%{name}-find-spec-bcond
 Source5:	%{name}-hrmib-cache
 Source6:	%{name}-groups-po.awk
-Source7:	%{name}-compress-doc
-Source10:	%{name}-php-provides
-Source11:	%{name}-php-requires
 Source12:	%{name}.sysinfo
 Source13:	perl.prov
 Source14:	%{name}-user_group.sh
 Source15:	%{name}.sysconfig
-Source16:	%{name}-macros.java
-Source17:	%{name}-java-requires
 # http://svn.pld-linux.org/banner.sh/
 Source18:	banner.sh
 Source19:	%{name}-macros.gstreamer
-Source20:	macros.php
-Source21:	%{name}-php-requires.php
-Source22:	rubygems.rb
-Source23:	gem_helper.rb
 Patch1000:	%{name}-new-debuginfo.patch
 #Patch0:	%{name}-pl.po.patch
 Patch1:		%{name}-rpmrc.patch
@@ -180,6 +170,7 @@ Patch117:	%{name}-rpm2cpio-xz.patch
 Patch118:	%{name}-noarch-subpackages.patch
 Patch119:	%{name}-div0.patch
 Patch120:	%{name}-pythondeps.patch
+Patch121:	%{name}-tld-macros.patch
 URL:		http://rpm5.org/
 BuildRequires:	autoconf >= 2.57
 BuildRequires:	automake >= 1.4
@@ -523,7 +514,7 @@ Summary(ru.UTF-8):	Скрипты и утилиты, необходимые дл
 Summary(uk.UTF-8):	Скрипти та утиліти, необхідні для побудови пакетів
 Group:		Applications/File
 Requires(pretrans):	findutils
-Requires:	%{name}-build-macros >= 1.656
+Requires:	%{name}-tld-macros-build >= 1.744-3
 Requires:	%{name}-utils = %{version}-%{release}
 Requires:	/bin/id
 Requires:	awk
@@ -575,24 +566,6 @@ construir pacotes usando o RPM.
 Різноманітні допоміжні скрипти та утиліти, які використовуються для
 побудови RPM'ів.
 
-%package javaprov
-Summary:	Additional utilities for checking Java provides/requires in RPM packages
-Summary(pl.UTF-8):	Dodatkowe narzędzia do sprawdzania zależności kodu w Javie w pakietach RPM
-Group:		Applications/File
-Requires:	%{name} = %{version}-%{release}
-Requires:	file
-Requires:	findutils >= 1:4.2.26
-Requires:	mktemp
-Requires:	unzip
-
-%description javaprov
-Additional utilities for checking Java provides/requires in RPM
-packages.
-
-%description javaprov -l pl.UTF-8
-Dodatkowe narzędzia do sprawdzania zależności kodu w Javie w pakietach
-RPM.
-
 %package perlprov
 Summary:	Additional utilities for checking Perl provides/requires in RPM packages
 Summary(de.UTF-8):	Zusatzwerkzeuge fürs Nachsehen Perl-Abhängigkeiten in RPM-Paketen
@@ -629,38 +602,6 @@ software.
 Makra ułatwiające tworzenie pakietów RPM z programami napisanymi w
 Pythonie.
 
-%package php-pearprov
-Summary:	Additional utilities for checking PHP PEAR provides/requires in RPM packages
-Summary(pl.UTF-8):	Dodatkowe narzędzia do sprawdzania zależności skryptów php w RPM
-Group:		Applications/File
-Requires:	%{name} = %{version}-%{release}
-Requires:	sed >= 4.0
-
-%description php-pearprov
-Additional utilities for checking PHP PEAR provides/requires in RPM
-packages.
-
-%description php-pearprov -l pl.UTF-8
-Dodatkowe narzędzia do sprawdzenia zależności skryptów PHP PEAR w
-pakietach RPM.
-
-%package rubyprov
-Summary:	Ruby tools, which simplify creation of RPM packages with Ruby software
-Summary(pl.UTF-8):	Makra ułatwiające tworzenie pakietów RPM z programami napisanymi w Ruby
-Group:		Applications/File
-Requires:	%{name} = %{version}-%{release}
-Requires:	ruby
-Requires:	ruby-modules
-Requires:	ruby-rubygems
-
-%description rubyprov
-Ruby tools, which simplifies creation of RPM packages with Ruby
-software.
-
-%description rubyprov -l pl.UTF-8
-Makra ułatwiające tworzenie pakietów RPM z programami napisanymi w
-Ruby.
-
 %package -n python-rpm
 Summary:	Python interface to RPM library
 Summary(pl.UTF-8):	Pythonowy interfejs do biblioteki RPM-a
@@ -730,11 +671,8 @@ sed -e 's/^/@tld@/' %{SOURCE2} >>platform.in
 echo '%%define	__perl_provides	%%{__perl} /usr/lib/rpm/perl.prov' > macros.perl
 echo '%%define	__perl_requires	%%{__perl} /usr/lib/rpm/perl.req' >> macros.perl
 echo '# obsoleted file' > macros.python
-cp -p %{SOURCE20} macros.php
 echo '%%define	__mono_provides	/usr/lib/rpm/mono-find-provides' > macros.mono
 echo '%%define	__mono_requires	/usr/lib/rpm/mono-find-requires' >> macros.mono
-install %{SOURCE10} scripts/php.prov
-install %{SOURCE11} scripts/php.req
 install %{SOURCE13} scripts/perl.prov
 %patch21 -p1
 %patch22 -p1
@@ -827,6 +765,7 @@ install %{SOURCE13} scripts/perl.prov
 %patch118 -p1
 %patch119 -p1
 %patch120 -p1
+%patch121 -p1
 
 mv -f po/{sr,sr@Latn}.po
 rm -rf sqlite zlib popt
@@ -842,9 +781,6 @@ sed -i -e 's,AM_PTHREADS_SHARED("POSIX/.*,:,' db/dist/aclocal/mutex.ac
 rm -rf db3 db rpmdb/db.h
 %endif
 
-cp -p %{SOURCE22} scripts/rubygems.rb
-cp -p %{SOURCE23} scripts/gem_helper.rb
-
 # generate Group translations to *.po
 awk -f %{SOURCE6} %{SOURCE1}
 
@@ -1044,18 +980,11 @@ install -p scripts/rpmdiff scripts/rpmdiff.cgi $RPM_BUILD_ROOT%{_rpmlibdir}
 
 cp -a macros.perl	$RPM_BUILD_ROOT%{_rpmlibdir}/macros.perl
 cp -a macros.python	$RPM_BUILD_ROOT%{_rpmlibdir}/macros.python
-cp -a macros.php	$RPM_BUILD_ROOT%{_rpmlibdir}/macros.php
 cp -a macros.mono	$RPM_BUILD_ROOT%{_rpmlibdir}/macros.mono
-cp -a %{SOURCE16}	$RPM_BUILD_ROOT%{_rpmlibdir}/macros.java
 cp -a %{SOURCE19}	$RPM_BUILD_ROOT%{_rpmlibdir}/macros.gstreamer
 
 install -p %{SOURCE3} $RPM_BUILD_ROOT%{_rpmlibdir}/install-build-tree
-install -p %{SOURCE4} $RPM_BUILD_ROOT%{_rpmlibdir}/find-spec-bcond
-install -p %{SOURCE7} $RPM_BUILD_ROOT%{_rpmlibdir}/compress-doc
 install -p %{SOURCE14} $RPM_BUILD_ROOT%{_rpmlibdir}/user_group.sh
-install -p %{SOURCE17} $RPM_BUILD_ROOT%{_rpmlibdir}/java-find-requires
-install -p scripts/php.{prov,req}	$RPM_BUILD_ROOT%{_rpmlibdir}
-cp -p %{SOURCE21} $RPM_BUILD_ROOT%{_rpmlibdir}/php.req.php
 install -p %{SOURCE5} $RPM_BUILD_ROOT%{_rpmlibdir}/hrmib-cache
 install -p %{SOURCE18} $RPM_BUILD_ROOT%{_bindir}/banner.sh
 cp -p %{name}.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/rpm
@@ -1203,7 +1132,7 @@ done
 
 rm -f $RPM_BUILD_ROOT%{py_sitedir}/rpm/*.{la,a,py}
 
-# (currently) not used or supported in PLD
+# (currently) not used or supported in TLD
 %{__rm} $RPM_BUILD_ROOT%{_rpmlibdir}/{http.req,perldeps.pl}
 # wrong location, not used anyway
 %{__rm} $RPM_BUILD_ROOT%{_rpmlibdir}/rpm.{daily,log,xinetd}
@@ -1373,9 +1302,7 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
 %attr(755,root,root) %{_rpmlibdir}/brp-*
 %attr(755,root,root) %{_rpmlibdir}/check-files
 # %attr(755,root,root) %{_rpmlibdir}/check-prereqs
-%attr(755,root,root) %{_rpmlibdir}/compress-doc
 %attr(755,root,root) %{_rpmlibdir}/cross-build
-%attr(755,root,root) %{_rpmlibdir}/find-spec-bcond
 %attr(755,root,root) %{_rpmlibdir}/getpo.sh
 %attr(755,root,root) %{_rpmlibdir}/install-build-tree
 #%attr(755,root,root) %{_rpmlibdir}/config.*
@@ -1383,7 +1310,6 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
 %attr(755,root,root) %{_rpmlibdir}/u_pkg.sh
 %attr(755,root,root) %{_rpmlibdir}/executabledeps.sh
 %attr(755,root,root) %{_rpmlibdir}/libtooldeps.sh
-%attr(755,root,root) %{_rpmlibdir}/mimetypedeps.sh
 # needs hacked pkg-config to return anything
 %attr(755,root,root) %{_rpmlibdir}/pkgconfigdeps.sh
 #%attr(755,root,root) %{_rpmlibdir}/rpmb
@@ -1419,10 +1345,8 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
 %endif
 # must be here for "Requires: rpm-*prov" to work
 %{_rpmlibdir}/macros.gstreamer
-%{_rpmlibdir}/macros.java
 %{_rpmlibdir}/macros.mono
 %{_rpmlibdir}/macros.perl
-%{_rpmlibdir}/macros.php
 # not used yet ... these six depend on perl
 #%attr(755,root,root) %{_rpmlibdir}/http.req
 #%attr(755,root,root) %{_rpmlibdir}/magic.prov
@@ -1440,12 +1364,6 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
 %lang(pl) %{_mandir}/pl/man1/gendiff.1*
 %lang(pl) %{_mandir}/pl/man8/rpmbuild.8*
 
-%files javaprov
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_rpmlibdir}/java-find-requires
-# needs jar (any jdk), jcf-dump (gcc-java) to work
-%attr(755,root,root) %{_rpmlibdir}/javadeps.sh
-
 %files perlprov
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_rpmlibdir}/perl.*
@@ -1462,15 +1380,6 @@ find %{_rpmlibdir} -name '*-linux' -type l | xargs rm -f
 %attr(755,root,root) %{_rpmlibdir}/pythondeps.sh
 %attr(755,root,root) %{_rpmlibdir}/pythoneggs.py
 
-%files php-pearprov
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_rpmlibdir}/php*
-
-%files rubyprov
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_rpmlibdir}/gem_helper.rb
-%attr(755,root,root) %{_rpmlibdir}/rubygems.rb
-
 %if %{with python}
 %files -n python-rpm
 %defattr(644,root,root,755)
-- 
2.49.0