#!/bin/bash -ex 

# Build supplementary development tools (EPEL)

#rpmbuild --rebuild https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/36/Everything/source/tree/Packages/g/gnuchess-6.2.9-3.fc36.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/gnuchess-6*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/i/iceauth-1.0.8-4.el9.src.rpm \
 && sudo rpm -Uvh --force ${HOME}/rpmbuild/RPMS/*/iceauth-1*.rpm

#wget -nv \
#  https://archives.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/p/paper-2.3-6.el9.x86_64.rpm \
#  https://archives.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/p/psutils-2.07-1.el9.noarch.rpm \
# && sudo rpm -Uvh psutils-2.07-1.el9.noarch.rpm paper-2.3-6.el9.x86_64.rpm

#rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/g/gnulib-0-53.20250704git.el9.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/gnulib-devel-0*.rpm

#rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/p/paper-2.3-6.el9.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/paper-2*.rpm

#rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/p/psutils-2.07-1.el9.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/psutils-2*.rpm

#rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/a/audiofile-0.3.6-36.el9.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/audiofile{,-devel}-0*.rpm

#rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/v/vorbis-tools-1.4.2-10.el9.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/vorbis-tools-1*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/h/html2ps-1.0-0.53.b7.el9.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/html2ps-1*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/p/perl-Getopt-ArgvFile-1.11-38.el9.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/perl-Getopt-ArgvFile-1*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/p/perl-PAR-1.017-6.el9.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/perl-PAR-1*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/p/perl-PAR-Dist-0.51-5.el9.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/perl-PAR-Dist-0*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/p/perl-PAR-Packer-1.054-3.el9.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/perl-PAR-Packer-1*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/p/pcsc-perl-1.4.14-24.el9.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/pcsc-perl-1*.rpm

#rpmbuild --rebuild https://archives.fedoraproject.org/pub/epel/9/Everything/source/tree/Packages/l/lirc-0.10.0-36.el9.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/lirc-{core,devel,libs}-0*.rpm


# Build supplementary development tools (Fedora 42)

#rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/c/cvs-1.11.23-73.fc42.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/cvs-1*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/t/transfig-3.2.9-7.fc42.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/transfig-3*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/l/lcms-1.19-41.fc42.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/lcms{,-libs,-devel}-1*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/h/heimdal-7.8.0-9.fc40.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/heimdal{-libs,-devel}-7*.rpm

#rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/l/libvisual-0.4.1-5.fc41.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/libvisual{,-devel}-0*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/c/clucene-2.3.3.4-51.20130812.e8e3d20git.fc42.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/clucene-{core,contribs-lib,core-devel}-2*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/s/sword-1.9.0-29.fc42.src.rpm --undefine "__cmake_in_source_build" --define "__cmake_builddir build" \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/sword{,-devel}-1*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/y/yaz-5.34.4-1.fc42.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/libyaz{,-devel}-5*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/c/chmlib-0.40-45.fc42.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/chmlib{,-devel}-0*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/l/librevenge-0.0.5-9.fc42.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/librevenge{,-devel}-0*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/l/libwpd-0.10.3-22.fc42.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/libwpd{,-devel}-0*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/l/libotr-4.1.1-23.fc42.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/libotr{,-devel}-4*.rpm

#rpmbuild --rebuild https://archives.fedoraproject.org/pub/fedora/linux/releases/42/Everything/source/tree/Packages/t/torsocks-2.4.0-9.fc42.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/torsocks-2*.rpm

# Build supplementary development tools (Fedora archives)

#rpm -ivh https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/36/Everything/source/tree/Packages/p/pilot-link-0.12.5-50.fc36.src.rpm \
# && sed -i ${HOME}/rpmbuild/SPECS/pilot-link.spec -e "s|libusb-devel|libusb1-devel|" \
# && rpmbuild -bb ${HOME}/rpmbuild/SPECS/pilot-link.spec \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/pilot-link{,-devel}-0*.rpm

#wget -nv -P ${HOME}/rpmbuild/RPMS/x86_64 \
#  http://rpms.remirepo.net/enterprise/9/remi/x86_64/libicu69-69.1-4.el9.remi.x86_64.rpm \
#  http://rpms.remirepo.net/enterprise/9/remi/x86_64/libyaz{,-devel}-5.32.0-1.el9.remi.x86_64.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/lib{icu69,yaz}-*.rpm

rpmbuild --rebuild https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/35/Everything/source/tree/Packages/w/wireless-tools-29-28.fc35.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/wireless-tools{,-devel}-29*.rpm

#rpmbuild --rebuild https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/36/Everything/source/tree/Packages/l/liblo-0.31-5.fc36.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/liblo{,-devel}-0*.rpm 
