#!/bin/bash

# Build supplementary development tools

#RUN 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/archive/fedora/linux/releases/36/Everything/source/tree/Packages/p/pilot-link-0.12.5-50.fc36.src.rpm \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/pilot-link-{devel,libs}-0*.rpm

sudo rpm -Uvh http://rpms.remirepo.net/enterprise/8/remi/x86_64/hiredis-0.13.3-9.el8.remi.x86_64.rpm http://rpms.remirepo.net/enterprise/8/remi/x86_64/libyaz{,-devel}-5.14.11-14.el8.remi.x86_64.rpm

#RUN rpmbuild --rebuild https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/36/Everything/source/tree/Packages/p/perl-PAR-1.017-5.fc36.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/perl-PAR-1*.rpm

#RUN rpmbuild --rebuild https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/36/Everything/source/tree/Packages/p/perl-Getopt-ArgvFile-1.11-37.fc36.src.rpm \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/perl-Getopt-ArgvFile-1*.rpm

#RUN rpmbuild --rebuild https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/36/Everything/source/tree/Packages/p/perl-PAR-Packer-1.054-3.fc36.src.rpm --nocheck \
# && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/perl-PAR-Packer-1*.rpm

rpm -ivh https://dl.fedoraproject.org/pub/epel/10/Everything/source/tree/Packages/l/libunibreak-6.1-2.el10_0.src.rpm \
 && sed -i ${HOME}/rpmbuild/SPECS/libunibreak.spec -e "/^Patch:.*offline_files.patch/ s/^Patch:/Patch1:/" -e "/^Patch:.*remove_unused_var.patch/ s/^Patch:/Patch2:/" \
 && rpmbuild -ba ${HOME}/rpmbuild/SPECS/libunibreak.spec \
 && sudo rpm -Uvh ${HOME}/rpmbuild/RPMS/*/libunibreak-{6,devel}*.rpm
