Skip to content
Snippets Groups Projects
Forked from rc / hpc-factory
269 commits behind the upstream repository.
build-zsh.sh 1.28 KiB
#!/bin/bash
name=zsh
version=5.9

mkdir -p BUILD RPMS SOURCES SPECS SRPMS

prereqs="git epel-release bzip2 xz gzip tar"
rpm -q $prereqs

if [ $? -ne 0 ]; then sudo yum -y install $prereqs; fi

git clone https://src.fedoraproject.org/rpms/${name}.git

cp ${name}/${name}.spec SPECS/
cp ${name}/*.rhs SOURCES/
cp ${name}/dot* SOURCES/

# Perl may not be available, switching to sed
#perl -pi -e 's/^(BuildRequires: glibc-langpack-ja)/#$1/g;' ${name}/${name}.spec
sed -i '/BuildRequires: glibc-langpack-ja/s/^/#/' SPECS/${name}.spec

pkgs="rpm-build $(grep -E '^BuildRequires|^Requires' SPECS/${name}.spec | awk '{print $2}' | tr '\n' ' ')"; echo $pkgs
rpm -q $pkgs

if [ $? -ne 0 ]; then sudo yum install -y $pkgs; fi

if [ ! -f SOURCES/${name}-${version}.tar.xz ] ; then
  curl -L -o SOURCES/${name}-${version}.tar.xz https://downloads.sourceforge.net/${name}/${name}-${version}.tar.xz
fi

if [ ! -f SOURCES/${name}-${version}.tar.xz.asc ] ; then
  curl -L -o SOURCES/${name}-${version}.tar.xz.asc https://downloads.sourceforge.net/${name}/${name}-${version}.tar.xz.asc
fi

cd SOURCES
sha512sum -c ../${name}/sources
retval=$?
cd -
if [ $retval -ne 0 ]; then
#  echo "SOURCES/${name}-${version}.tar.gz did not match checksum in ${name}/source"
  exit 1
fi

rpmbuild --define "_topdir `pwd`" -bb SPECS/${name}.spec